summaryrefslogtreecommitdiff
path: root/include/vcl/unowrap.hxx
blob: 84035e90eadc66e510cecf760431ee631cd0eeef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */

#ifndef INCLUDED_VCL_UNOWRAP_HXX
#define INCLUDED_VCL_UNOWRAP_HXX

#include <com/sun/star/uno/Reference.h>
#include <vcl/dllapi.h>

class XWindowPeer;
class XToolkit;
class EventList;
namespace vcl { class Window; }
class OutputDevice;
class MouseEvent;
class CommandEvent;
class KeyEvent;
class Rectangle;
class Menu;

namespace com {
namespace sun {
namespace star {
namespace awt {
    class XGraphics;
    class XToolkit;
    class XWindowPeer;
}
namespace lang {
    class XMultiServiceFactory;
}
} } }

namespace com {
namespace sun {
namespace star {
namespace accessibility {
    class XAccessible;
}}}}

class VCL_DLLPUBLIC UnoWrapperBase
{
public:
    virtual void                Destroy() = 0;

    // Toolkit
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > GetVCLToolkit() = 0;

    // Graphics
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >    CreateGraphics( OutputDevice* pOutDev ) = 0;
    virtual void                ReleaseAllGraphics( OutputDevice* pOutDev ) = 0;

    // Window
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> GetWindowInterface( vcl::Window* pWindow, bool bCreate ) = 0;
    virtual void                SetWindowInterface( vcl::Window* pWindow, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xIFace ) = 0;

    virtual void                WindowDestroyed( vcl::Window* pWindow ) = 0;

    // Accessibility
    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
                                CreateAccessible( Menu* pMenu, bool bIsMenuBar ) = 0;

protected:
    ~UnoWrapperBase() {}
};

#endif // INCLUDED_VCL_UNOWRAP_HXX

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
d class='add' style='width: 1.9%;'/> -rw-r--r--include/avmedia/mediawindow.hxx123
-rw-r--r--include/basebmp/accessor.hxx113
-rw-r--r--include/basebmp/accessoradapters.hxx520
-rw-r--r--include/basebmp/accessorfunctors.hxx181
-rw-r--r--include/basebmp/accessortraits.hxx124
-rw-r--r--include/basebmp/basebmpdllapi.h32
-rw-r--r--include/basebmp/bitmapdevice.hxx719
-rw-r--r--include/basebmp/clippedlinerenderer.hxx411
-rw-r--r--include/basebmp/color.hxx93
-rw-r--r--include/basebmp/colorblendaccessoradapter.hxx142
-rw-r--r--include/basebmp/colormisc.hxx185
-rw-r--r--include/basebmp/colortraits.hxx144
-rw-r--r--include/basebmp/compositeiterator.hxx361
-rw-r--r--include/basebmp/debug.hxx57
-rw-r--r--include/basebmp/drawmodes.hxx49
-rw-r--r--include/basebmp/endian.hxx51
-rw-r--r--include/basebmp/fillimage.hxx63
-rw-r--r--include/basebmp/genericcolorimageaccessor.hxx76
-rw-r--r--include/basebmp/greylevelformats.hxx129
-rw-r--r--include/basebmp/iteratortraits.hxx49
-rw-r--r--include/basebmp/metafunctions.hxx226
-rw-r--r--include/basebmp/nonstandarditerator.hxx39
-rw-r--r--include/basebmp/packedpixeliterator.hxx671
-rw-r--r--include/basebmp/paletteformats.hxx139
-rw-r--r--include/basebmp/paletteimageaccessor.hxx162
-rw-r--r--include/basebmp/pixelformatadapters.hxx102
-rw-r--r--include/basebmp/pixeliterator.hxx349
-rw-r--r--include/basebmp/polypolygonrenderer.hxx360
-rw-r--r--include/basebmp/rgb24pixelformats.hxx92
-rw-r--r--include/basebmp/rgbmaskpixelformats.hxx331
-rw-r--r--include/basebmp/scaleimage.hxx189
-rw-r--r--include/basebmp/scanlineformats.hxx57
-rw-r--r--include/basebmp/stridedarrayiterator.hxx108
-rw-r--r--include/basebmp/tools.hxx85
-rw-r--r--include/basegfx/basegfxdllapi.h42
-rw-r--r--include/basegfx/color/bcolor.hxx229
-rw-r--r--include/basegfx/color/bcolormodifier.hxx137
-rw-r--r--include/basegfx/color/bcolortools.hxx52
-rw-r--r--include/basegfx/curve/b2dbeziertools.hxx57
-rw-r--r--include/basegfx/curve/b2dcubicbezier.hxx200
-rw-r--r--include/basegfx/matrix/b2dhommatrix.hxx139
-rw-r--r--include/basegfx/matrix/b2dhommatrixtools.hxx225
-rw-r--r--include/basegfx/matrix/b3dhommatrix.hxx155
-rw-r--r--include/basegfx/numeric/ftools.hxx198
-rw-r--r--include/basegfx/pixel/bpixel.hxx217
-rw-r--r--include/basegfx/point/b2dpoint.hxx146
-rw-r--r--include/basegfx/point/b2ipoint.hxx117
-rw-r--r--include/basegfx/point/b3dpoint.hxx145
-rw-r--r--include/basegfx/point/b3ipoint.hxx129
-rw-r--r--include/basegfx/polygon/b2dlinegeometry.hxx141
-rw-r--r--include/basegfx/polygon/b2dpolygon.hxx230
-rw-r--r--include/basegfx/polygon/b2dpolygonclipper.hxx70
-rw-r--r--include/basegfx/polygon/b2dpolygoncutandtouch.hxx58
-rw-r--r--include/basegfx/polygon/b2dpolygontools.hxx442
-rw-r--r--include/basegfx/polygon/b2dpolygontriangulator.hxx43
-rw-r--r--include/basegfx/polygon/b2dpolypolygon.hxx137
-rw-r--r--include/basegfx/polygon/b2dpolypolygoncutter.hxx153
-rw-r--r--include/basegfx/polygon/b2dpolypolygonfillrule.hxx54
-rw-r--r--include/basegfx/polygon/b2dpolypolygontools.hxx236
-rw-r--r--include/basegfx/polygon/b2dtrapezoid.hxx124
-rw-r--r--include/basegfx/polygon/b3dpolygon.hxx130
-rw-r--r--include/basegfx/polygon/b3dpolygontools.hxx135
-rw-r--r--include/basegfx/polygon/b3dpolypolygon.hxx117
-rw-r--r--include/basegfx/polygon/b3dpolypolygontools.hxx133
-rw-r--r--include/basegfx/range/b1drange.hxx174
-rw-r--r--include/basegfx/range/b1ibox.hxx164
-rw-r--r--include/basegfx/range/b1irange.hxx169
-rw-r--r--include/basegfx/range/b2dconnectedranges.hxx257
-rw-r--r--include/basegfx/range/b2dpolyrange.hxx94
-rw-r--r--include/basegfx/range/b2drange.hxx320
-rw-r--r--include/basegfx/range/b2drangeclipper.hxx45
-rw-r--r--include/basegfx/range/b2drectangle.hxx36
-rw-r--r--include/basegfx/range/b2ibox.hxx261
-rw-r--r--include/basegfx/range/b2irange.hxx287
-rw-r--r--include/basegfx/range/b2irectangle.hxx36
-rw-r--r--include/basegfx/range/b3drange.hxx273
-rw-r--r--include/basegfx/range/b3irange.hxx240
-rw-r--r--include/basegfx/range/basicbox.hxx127
-rw-r--r--include/basegfx/range/basicrange.hxx278
-rw-r--r--include/basegfx/raster/bpixelraster.hxx99
-rw-r--r--include/basegfx/raster/bzpixelraster.hxx90
-rw-r--r--include/basegfx/raster/rasterconvert3d.hxx340
-rw-r--r--include/basegfx/tools/b2dclipstate.hxx94
-rw-r--r--include/basegfx/tools/canvastools.hxx205
-rw-r--r--include/basegfx/tools/gradienttools.hxx405
-rw-r--r--include/basegfx/tools/keystoplerp.hxx92
-rw-r--r--include/basegfx/tools/lerp.hxx51
-rw-r--r--include/basegfx/tools/rectcliptools.hxx96
-rw-r--r--include/basegfx/tools/tools.hxx102
-rw-r--r--include/basegfx/tools/unopolypolygon.hxx110
-rw-r--r--include/basegfx/tools/unotools.hxx40
-rw-r--r--include/basegfx/tools/zoomtools.hxx50
-rw-r--r--include/basegfx/tuple/b2dtuple.hxx352
-rw-r--r--include/basegfx/tuple/b2i64tuple.hxx305
-rw-r--r--include/basegfx/tuple/b2ituple.hxx208
-rw-r--r--include/basegfx/tuple/b3dtuple.hxx421
-rw-r--r--include/basegfx/tuple/b3i64tuple.hxx336
-rw-r--r--include/basegfx/tuple/b3ituple.hxx335
-rw-r--r--include/basegfx/vector/b2dsize.hxx36
-rw-r--r--include/basegfx/vector/b2dvector.hxx254
-rw-r--r--include/basegfx/vector/b2enums.hxx70
-rw-r--r--include/basegfx/vector/b2isize.hxx36
-rw-r--r--include/basegfx/vector/b2ivector.hxx146
-rw-r--r--include/basegfx/vector/b3dvector.hxx322
-rw-r--r--include/basegfx/vector/b3ivector.hxx249
-rw-r--r--include/basic/basicdllapi.h23
-rw-r--r--include/basic/basicmanagerrepository.hxx142
-rw-r--r--include/basic/basmgr.hxx238
-rw-r--r--include/basic/basrdll.hxx52
-rw-r--r--include/basic/global.hxx28
-rw-r--r--include/basic/modsizeexceeded.hxx55
-rw-r--r--include/basic/sbdef.hxx68
-rw-r--r--include/basic/sberrors.hxx418
-rw-r--r--include/basic/sbmeth.hxx91
-rw-r--r--include/basic/sbmod.hxx164
-rw-r--r--include/basic/sbobjmod.hxx104
-rw-r--r--include/basic/sbprop.hxx67
-rw-r--r--include/basic/sbstar.hxx183
-rw-r--r--include/basic/sbstdobj.hxx136
-rw-r--r--include/basic/sbuno.hxx42
-rw-r--r--include/basic/sbx.hxx280
-rw-r--r--include/basic/sbxbase.hxx52
-rw-r--r--include/basic/sbxcore.hxx152
-rw-r--r--include/basic/sbxdef.hxx311
-rw-r--r--include/basic/sbxfac.hxx43
-rw-r--r--include/basic/sbxform.hxx173
-rw-r--r--include/basic/sbxmeth.hxx40
-rw-r--r--include/basic/sbxobj.hxx96
-rw-r--r--include/basic/sbxprop.hxx44
-rw-r--r--include/basic/sbxvar.hxx356
-rw-r--r--include/basic/vbahelper.hxx99
-rw-r--r--include/canvas/base/bitmapcanvasbase.hxx128
-rw-r--r--include/canvas/base/bufferedgraphicdevicebase.hxx276
-rw-r--r--include/canvas/base/cachedprimitivebase.hxx117
-rw-r--r--include/canvas/base/canvasbase.hxx474
-rw-r--r--include/canvas/base/canvascustomspritebase.hxx271
-rw-r--r--include/canvas/base/canvascustomspritehelper.hxx287
-rw-r--r--include/canvas/base/disambiguationhelper.hxx81
-rw-r--r--include/canvas/base/graphicdevicebase.hxx382
-rw-r--r--include/canvas/base/integerbitmapbase.hxx145
-rw-r--r--include/canvas/base/sprite.hxx116
-rw-r--r--include/canvas/base/spritecanvasbase.hxx193
-rw-r--r--include/canvas/base/spritesurface.hxx70
-rw-r--r--include/canvas/canvastools.hxx587
-rw-r--r--include/canvas/canvastoolsdllapi.h35
-rw-r--r--include/canvas/debug.hxx59
-rw-r--r--include/canvas/elapsedtime.hxx173
-rw-r--r--include/canvas/parametricpolypolygon.hxx161
-rw-r--r--include/canvas/propertysethelper.hxx152
-rw-r--r--include/canvas/rendering/bitmap.hxx314
-rw-r--r--include/canvas/rendering/icachedprimitive.hxx60
-rw-r--r--include/canvas/rendering/icolorbuffer.hxx88
-rw-r--r--include/canvas/rendering/irendermodule.hxx143
-rw-r--r--include/canvas/rendering/isurface.hxx82
-rw-r--r--include/canvas/rendering/isurfaceproxy.hxx107
-rw-r--r--include/canvas/rendering/isurfaceproxymanager.hxx74
-rw-r--r--include/canvas/spriteredrawmanager.hxx429
-rw-r--r--include/canvas/vclwrapper.hxx141
-rw-r--r--include/canvas/verbosetrace.hxx32
-rw-r--r--include/canvas/verifyinput.hxx667
-rw-r--r--include/codemaker/codemaker.hxx38
-rw-r--r--include/codemaker/commoncpp.hxx63
-rw-r--r--include/codemaker/commonjava.hxx42
-rw-r--r--include/codemaker/exceptiontree.hxx120
-rw-r--r--include/codemaker/generatedtypeset.hxx73
-rw-r--r--include/codemaker/global.hxx135
-rw-r--r--include/codemaker/options.hxx75
-rw-r--r--include/codemaker/typemanager.hxx76
-rw-r--r--include/codemaker/unotype.hxx91
-rw-r--r--include/comphelper/ChainablePropertySet.hxx138
-rw-r--r--include/comphelper/ChainablePropertySetInfo.hxx69
-rw-r--r--include/comphelper/IdPropArrayHelper.hxx117
-rw-r--r--include/comphelper/InlineContainer.hxx143
-rw-r--r--include/comphelper/MasterPropertySet.hxx143
-rw-r--r--include/comphelper/MasterPropertySetInfo.hxx59
-rw-r--r--include/comphelper/PropertyInfoHash.hxx65
-rw-r--r--include/comphelper/SelectionMultiplex.hxx105
-rw-r--r--include/comphelper/SettingsHelper.hxx113
-rw-r--r--include/comphelper/TypeGeneration.hxx122
-rw-r--r--include/comphelper/accessiblecomponenthelper.hxx140
-rw-r--r--include/comphelper/accessiblecontexthelper.hxx345
-rw-r--r--include/comphelper/accessibleeventnotifier.hxx161
-rw-r--r--include/comphelper/accessiblekeybindinghelper.hxx75
-rw-r--r--include/comphelper/accessibleselectionhelper.hxx124
-rw-r--r--include/comphelper/accessibletexthelper.hxx178
-rw-r--r--include/comphelper/accessiblewrapper.hxx410
-rw-r--r--include/comphelper/accimplaccess.hxx141
-rw-r--r--include/comphelper/anycompare.hxx219
-rw-r--r--include/comphelper/anytostring.hxx43
-rw-r--r--include/comphelper/asyncnotification.hxx184
-rw-r--r--include/comphelper/attributelist.hxx66
-rw-r--r--include/comphelper/basicio.hxx99
-rw-r--r--include/comphelper/broadcasthelper.hxx63
-rw-r--r--include/comphelper/classids.hxx388
-rw-r--r--include/comphelper/comphelperdllapi.h33
-rw-r--r--include/comphelper/componentbase.hxx154
-rw-r--r--include/comphelper/componentcontext.hxx243
-rw-r--r--include/comphelper/componentguard.hxx63
-rw-r--r--include/comphelper/componentmodule.hxx261
-rw-r--r--include/comphelper/configuration.hxx331
-rw-r--r--include/comphelper/configurationhelper.hxx240
-rw-r--r--include/comphelper/container.hxx80
-rw-r--r--include/comphelper/containermultiplexer.hxx106
-rw-r--r--include/comphelper/docpasswordhelper.hxx353
-rw-r--r--include/comphelper/docpasswordrequest.hxx122
-rw-r--r--include/comphelper/documentconstants.hxx171
-rw-r--r--include/comphelper/documentinfo.hxx51
-rw-r--r--include/comphelper/embeddedobjectcontainer.hxx181
-rw-r--r--include/comphelper/enumhelper.hxx143
-rw-r--r--include/comphelper/eventattachermgr.hxx52
-rw-r--r--include/comphelper/evtlistenerhlp.hxx50
-rw-r--r--include/comphelper/evtmethodhelper.hxx32
-rw-r--r--include/comphelper/extract.hxx158
-rw-r--r--include/comphelper/fileformat.h34
-rw-r--r--include/comphelper/flagguard.hxx78
-rw-r--r--include/comphelper/genericpropertyset.hxx34
-rw-r--r--include/comphelper/guarding.hxx56
-rw-r--r--include/comphelper/ihwrapnofilter.hxx99
-rw-r--r--include/comphelper/implbase_var.hxx436
-rw-r--r--include/comphelper/implementationreference.hxx267
-rw-r--r--include/comphelper/interaction.hxx161
-rw-r--r--include/comphelper/listenernotification.hxx298
-rw-r--r--include/comphelper/logging.hxx726
-rw-r--r--include/comphelper/make_shared_from_uno.hxx68
-rw-r--r--include/comphelper/makesequence.hxx80
-rw-r--r--include/comphelper/mediadescriptor.hxx310
-rw-r--r--include/comphelper/mimeconfighelper.hxx141
-rw-r--r--include/comphelper/namecontainer.hxx35
-rw-r--r--include/comphelper/namedvaluecollection.hxx376
-rw-r--r--include/comphelper/newarray.hxx51
-rw-r--r--include/comphelper/numberedcollection.hxx176
-rw-r--r--include/comphelper/numbers.hxx67
-rw-r--r--include/comphelper/officeresourcebundle.hxx94
-rw-r--r--include/comphelper/ofopxmlhelper.hxx130
-rw-r--r--include/comphelper/optional.hxx81
-rw-r--r--include/comphelper/oslfile2streamwrap.hxx89
-rw-r--r--include/comphelper/processfactory.hxx84
-rw-r--r--include/comphelper/propagg.hxx325
-rw-r--r--include/comphelper/proparrhlp.hxx175
-rw-r--r--include/comphelper/property.hxx205
-rw-r--r--include/comphelper/propertybag.hxx227
-rw-r--r--include/comphelper/propertycontainer.hxx90
-rw-r--r--include/comphelper/propertycontainerhelper.hxx203
-rw-r--r--include/comphelper/propertysethelper.hxx91
-rw-r--r--include/comphelper/propertysetinfo.hxx87
-rw-r--r--include/comphelper/propertystatecontainer.hxx114
-rw-r--r--include/comphelper/propmultiplex.hxx109
-rw-r--r--include/comphelper/propstate.hxx105
-rw-r--r--include/comphelper/proxyaggregation.hxx221
-rw-r--r--include/comphelper/scoped_disposing_ptr.hxx160
-rw-r--r--include/comphelper/scopeguard.hxx64
-rw-r--r--include/comphelper/seekableinput.hxx77
-rw-r--r--include/comphelper/seqstream.hxx139
-rw-r--r--include/comphelper/sequence.hxx369
-rw-r--r--include/comphelper/sequenceashashmap.hxx313
-rw-r--r--include/comphelper/sequenceasvector.hxx247
-rw-r--r--include/comphelper/servicedecl.hxx409
-rw-r--r--include/comphelper/servicehelper.hxx107
-rw-r--r--include/comphelper/serviceinfohelper.hxx54
-rw-r--r--include/comphelper/sharedmutex.hxx86
-rw-r--r--include/comphelper/stillreadwriteinteraction.hxx56
-rw-r--r--include/comphelper/stl_types.hxx273
-rw-r--r--include/comphelper/stlunosequence.hxx81
-rw-r--r--include/comphelper/storagehelper.hxx200
-rw-r--r--include/comphelper/streamsection.hxx78
-rw-r--r--include/comphelper/string.hxx466
-rw-r--r--include/comphelper/synchronousdispatch.hxx66
-rw-r--r--include/comphelper/syntaxhighlight.hxx162
-rw-r--r--include/comphelper/types.hxx174
-rw-r--r--include/comphelper/uno3.hxx275
-rw-r--r--include/comphelper/unwrapargs.hxx138
-rw-r--r--include/comphelper/weak.hxx56
-rw-r--r--include/comphelper/weakbag.hxx86
-rw-r--r--include/comphelper/weakeventlistener.hxx182
-rw-r--r--include/comphelper/xmltools.hxx28
-rw-r--r--include/connectivity/BlobHelper.hxx44
-rw-r--r--include/connectivity/CommonTools.hxx215
-rw-r--r--include/connectivity/ConnectionWrapper.hxx92
-rw-r--r--include/connectivity/DriversConfig.hxx80
-rw-r--r--include/connectivity/FValue.hxx539
-rw-r--r--include/connectivity/IParseContext.hxx104
-rw-r--r--include/connectivity/OSubComponent.hxx86
-rw-r--r--include/connectivity/PColumn.hxx154
-rw-r--r--include/connectivity/ParameterCont.hxx52
-rw-r--r--include/connectivity/SQLStatementHelper.hxx43
-rw-r--r--include/connectivity/StdTypeDefs.hxx40
-rw-r--r--include/connectivity/TColumnsHelper.hxx63
-rw-r--r--include/connectivity/TIndex.hxx49
-rw-r--r--include/connectivity/TIndexColumns.hxx44
-rw-r--r--include/connectivity/TIndexes.hxx50
-rw-r--r--include/connectivity/TKey.hxx47
-rw-r--r--include/connectivity/TKeyColumns.hxx44
-rw-r--r--include/connectivity/TKeys.hxx59
-rw-r--r--include/connectivity/TTableHelper.hxx166
-rw-r--r--include/connectivity/conncleanup.hxx90
-rw-r--r--include/connectivity/dbcharset.hxx164
-rw-r--r--include/connectivity/dbconversion.hxx213
-rw-r--r--include/connectivity/dbexception.hxx353
-rw-r--r--include/connectivity/dbmetadata.hxx192
-rw-r--r--include/connectivity/dbtools.hxx787
-rw-r--r--include/connectivity/dbtoolsdllapi.hxx35
-rw-r--r--include/connectivity/filtermanager.hxx123
-rw-r--r--include/connectivity/formattedcolumnvalue.hxx110
-rw-r--r--include/connectivity/parameters.hxx417
-rw-r--r--include/connectivity/paramwrapper.hxx200
-rw-r--r--include/connectivity/predicateinput.hxx125
-rw-r--r--include/connectivity/sdbcx/IRefreshable.hxx59
-rw-r--r--include/connectivity/sdbcx/VCatalog.hxx125
-rw-r--r--include/connectivity/sdbcx/VCollection.hxx237
-rw-r--r--include/connectivity/sdbcx/VColumn.hxx118
-rw-r--r--include/connectivity/sdbcx/VDescriptor.hxx95
-rw-r--r--include/connectivity/sdbcx/VGroup.hxx103
-rw-r--r--include/connectivity/sdbcx/VIndex.hxx106
-rw-r--r--include/connectivity/sdbcx/VIndexColumn.hxx65
-rw-r--r--include/connectivity/sdbcx/VKey.hxx121
-rw-r--r--include/connectivity/sdbcx/VKeyColumn.hxx67
-rw-r--r--include/connectivity/sdbcx/VTable.hxx141
-rw-r--r--include/connectivity/sdbcx/VTypeDef.hxx40
-rw-r--r--include/connectivity/sdbcx/VUser.hxx100
-rw-r--r--include/connectivity/sdbcx/VView.hxx101
-rw-r--r--include/connectivity/sqlerror.hxx317
-rw-r--r--include/connectivity/sqliterator.hxx356
-rw-r--r--include/connectivity/sqlnode.hxx466
-rw-r--r--include/connectivity/sqlparse.hxx253
-rw-r--r--include/connectivity/standardsqlstate.hxx68
-rw-r--r--include/connectivity/statementcomposer.hxx102
-rw-r--r--include/connectivity/virtualdbtools.hxx371
-rw-r--r--include/connectivity/warningscontainer.hxx102
-rw-r--r--include/cosv/bstream.hxx143
-rw-r--r--include/cosv/comdline.hxx63
-rw-r--r--include/cosv/comfunc.hxx67
-rw-r--r--include/cosv/csv_env.hxx148
-rw-r--r--include/cosv/csv_ostream.hxx127
-rw-r--r--include/cosv/csv_precomp.h40
-rw-r--r--include/cosv/dirchain.hxx146
-rw-r--r--include/cosv/file.hxx114
-rw-r--r--include/cosv/openclose.hxx137
-rw-r--r--include/cosv/persist.hxx98
-rw-r--r--include/cosv/ploc.hxx106
-rw-r--r--include/cosv/ploc_dir.hxx109
-rw-r--r--include/cosv/plocroot.hxx73
-rw-r--r--include/cosv/std_outp.hxx123
-rw-r--r--include/cosv/str_types.hxx85
-rw-r--r--include/cosv/streamstr.hxx310
-rw-r--r--include/cosv/string.hxx501
-rw-r--r--include/cosv/stringdata.hxx128
-rw-r--r--include/cosv/tpl/dyn.hxx232
-rw-r--r--include/cosv/tpl/processor.hxx129
-rw-r--r--include/cosv/tpl/swelist.hxx362
-rw-r--r--include/cosv/tpl/tpltools.hxx154
-rw-r--r--include/cosv/tpl/vvector.hxx535
-rw-r--r--include/cosv/x.hxx64
-rw-r--r--include/cppcanvas/basegfxfactory.hxx89
-rw-r--r--include/cppcanvas/bitmap.hxx74
-rw-r--r--include/cppcanvas/bitmapcanvas.hxx60
-rw-r--r--include/cppcanvas/canvas.hxx106
-rw-r--r--include/cppcanvas/canvasgraphic.hxx157
-rw-r--r--include/cppcanvas/color.hxx89
-rw-r--r--include/cppcanvas/cppcanvasdllapi.h30
-rw-r--r--include/cppcanvas/customsprite.hxx47
-rw-r--r--include/cppcanvas/font.hxx55
-rw-r--r--include/cppcanvas/polypolygon.hxx87
-rw-r--r--include/cppcanvas/renderer.hxx144
-rw-r--r--include/cppcanvas/sprite.hxx110
-rw-r--r--include/cppcanvas/spritecanvas.hxx76
-rw-r--r--include/cppcanvas/text.hxx45
-rw-r--r--include/cppcanvas/vclfactory.hxx102
-rw-r--r--include/drawinglayer/XShapeDumper.hxx71
-rw-r--r--include/drawinglayer/animation/animationtiming.hxx141
-rw-r--r--include/drawinglayer/attribute/fillbitmapattribute.hxx84
-rw-r--r--include/drawinglayer/attribute/fillgradientattribute.hxx107
-rw-r--r--include/drawinglayer/attribute/fillhatchattribute.hxx98
-rw-r--r--include/drawinglayer/attribute/fontattribute.hxx98
-rw-r--r--include/drawinglayer/attribute/lineattribute.hxx85
-rw-r--r--include/drawinglayer/attribute/linestartendattribute.hxx81
-rw-r--r--include/drawinglayer/attribute/materialattribute3d.hxx85
-rw-r--r--include/drawinglayer/attribute/sdrallattribute3d.hxx76
-rw-r--r--include/drawinglayer/attribute/sdrfillattribute.hxx87
-rw-r--r--include/drawinglayer/attribute/sdrfillbitmapattribute.hxx96
-rw-r--r--include/drawinglayer/attribute/sdrlightattribute3d.hxx83
-rw-r--r--include/drawinglayer/attribute/sdrlightingattribute3d.hxx87
-rw-r--r--include/drawinglayer/attribute/sdrlineattribute.hxx91
-rw-r--r--include/drawinglayer/attribute/sdrlinestartendattribute.hxx90
-rw-r--r--include/drawinglayer/attribute/sdrobjectattribute3d.hxx99
-rw-r--r--include/drawinglayer/attribute/sdrsceneattribute3d.hxx82
-rw-r--r--include/drawinglayer/attribute/sdrshadowattribute.hxx81
-rw-r--r--include/drawinglayer/attribute/strokeattribute.hxx75
-rw-r--r--include/drawinglayer/drawinglayerdllapi.h24
-rw-r--r--include/drawinglayer/geometry/viewinformation2d.hxx181
-rw-r--r--include/drawinglayer/geometry/viewinformation3d.hxx175
-rw-r--r--include/drawinglayer/primitive2d/animatedprimitive2d.hxx171
-rw-r--r--include/drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx86
-rw-r--r--include/drawinglayer/primitive2d/baseprimitive2d.hxx296
-rw-r--r--include/drawinglayer/primitive2d/bitmapprimitive2d.hxx80
-rw-r--r--include/drawinglayer/primitive2d/borderlineprimitive2d.hxx144
-rw-r--r--include/drawinglayer/primitive2d/clippedborderlineprimitive2d.hxx67
-rw-r--r--include/drawinglayer/primitive2d/controlprimitive2d.hxx113
-rw-r--r--include/drawinglayer/primitive2d/cropprimitive2d.hxx102
-rw-r--r--include/drawinglayer/primitive2d/discretebitmapprimitive2d.hxx78
-rw-r--r--include/drawinglayer/primitive2d/discreteshadowprimitive2d.hxx121
-rw-r--r--include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx111
-rw-r--r--include/drawinglayer/primitive2d/embedded3dprimitive2d.hxx122
-rw-r--r--include/drawinglayer/primitive2d/epsprimitive2d.hxx81
-rw-r--r--include/drawinglayer/primitive2d/fillbitmapprimitive2d.hxx88
-rw-r--r--include/drawinglayer/primitive2d/fillgradientprimitive2d.hxx109
-rw-r--r--include/drawinglayer/primitive2d/fillhatchprimitive2d.hxx89
-rw-r--r--include/drawinglayer/primitive2d/graphicprimitive2d.hxx95
-rw-r--r--include/drawinglayer/primitive2d/gridprimitive2d.hxx119
-rw-r--r--include/drawinglayer/primitive2d/groupprimitive2d.hxx95
-rw-r--r--include/drawinglayer/primitive2d/helplineprimitive2d.hxx114
-rw-r--r--include/drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx64
-rw-r--r--include/drawinglayer/primitive2d/invertprimitive2d.hxx59
-rw-r--r--include/drawinglayer/primitive2d/markerarrayprimitive2d.hxx88
-rw-r--r--include/drawinglayer/primitive2d/maskprimitive2d.hxx79
-rw-r--r--include/drawinglayer/primitive2d/mediaprimitive2d.hxx97
-rw-r--r--include/drawinglayer/primitive2d/metafileprimitive2d.hxx94
-rw-r--r--include/drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx79
-rw-r--r--include/drawinglayer/primitive2d/objectinfoprimitive2d.hxx73
-rw-r--r--include/drawinglayer/primitive2d/pagepreviewprimitive2d.hxx104
-rw-r--r--include/drawinglayer/primitive2d/patternfillprimitive2d.hxx81
-rw-r--r--include/drawinglayer/primitive2d/pointarrayprimitive2d.hxx83
-rw-r--r--include/drawinglayer/primitive2d/polygonprimitive2d.hxx310
-rw-r--r--include/drawinglayer/primitive2d/polypolygonprimitive2d.hxx382
-rw-r--r--include/drawinglayer/primitive2d/primitivetools2d.hxx192
-rw-r--r--include/drawinglayer/primitive2d/sceneprimitive2d.hxx159
-rw-r--r--include/drawinglayer/primitive2d/sdrdecompositiontools2d.hxx71
-rw-r--r--include/drawinglayer/primitive2d/shadowprimitive2d.hxx88
-rw-r--r--include/drawinglayer/primitive2d/structuretagprimitive2d.hxx71
-rw-r--r--include/drawinglayer/primitive2d/svggradientprimitive2d.hxx413
-rw-r--r--include/drawinglayer/primitive2d/textbreakuphelper.hxx84
-rw-r--r--include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx147
-rw-r--r--include/drawinglayer/primitive2d/texteffectprimitive2d.hxx106
-rw-r--r--include/drawinglayer/primitive2d/textenumsprimitive2d.hxx104
-rw-r--r--include/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx212
-rw-r--r--include/drawinglayer/primitive2d/textlayoutdevice.hxx155
-rw-r--r--include/drawinglayer/primitive2d/textlineprimitive2d.hxx84
-rw-r--r--include/drawinglayer/primitive2d/textprimitive2d.hxx181
-rw-r--r--include/drawinglayer/primitive2d/textstrikeoutprimitive2d.hxx152
-rw-r--r--include/drawinglayer/primitive2d/transformprimitive2d.hxx84
-rw-r--r--include/drawinglayer/primitive2d/transparenceprimitive2d.hxx88
-rw-r--r--include/drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx76
-rw-r--r--include/drawinglayer/primitive2d/wallpaperprimitive2d.hxx87
-rw-r--r--include/drawinglayer/primitive2d/wrongspellprimitive2d.hxx92
-rw-r--r--include/drawinglayer/primitive3d/baseprimitive3d.hxx213
-rw-r--r--include/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx55
-rw-r--r--include/drawinglayer/primitive3d/groupprimitive3d.hxx81
-rw-r--r--include/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx86
-rw-r--r--include/drawinglayer/primitive3d/hiddengeometryprimitive3d.hxx66
-rw-r--r--include/drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx69
-rw-r--r--include/drawinglayer/primitive3d/polygonprimitive3d.hxx129
-rw-r--r--include/drawinglayer/primitive3d/polygontubeprimitive3d.hxx108
-rw-r--r--include/drawinglayer/primitive3d/polypolygonprimitive3d.hxx83
-rw-r--r--include/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx69
-rw-r--r--include/drawinglayer/primitive3d/sdrdecompositiontools3d.hxx98
-rw-r--r--include/drawinglayer/primitive3d/sdrextrudelathetools3d.hxx137
-rw-r--r--include/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx129
-rw-r--r--include/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx147
-rw-r--r--include/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx81
-rw-r--r--include/drawinglayer/primitive3d/sdrprimitive3d.hxx88
-rw-r--r--include/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx80
-rw-r--r--include/drawinglayer/primitive3d/shadowprimitive3d.hxx84
-rw-r--r--include/drawinglayer/primitive3d/textureprimitive3d.hxx230
-rw-r--r--include/drawinglayer/primitive3d/transformprimitive3d.hxx74
-rw-r--r--include/drawinglayer/processor2d/baseprocessor2d.hxx196
-rw-r--r--include/drawinglayer/processor2d/canvasprocessor.hxx122
-rw-r--r--include/drawinglayer/processor2d/contourextractor2d.hxx68
-rw-r--r--include/drawinglayer/processor2d/hittestprocessor2d.hxx108
-rw-r--r--include/drawinglayer/processor2d/linegeometryextractor2d.hxx66
-rw-r--r--include/drawinglayer/processor2d/objectinfoextractor2d.hxx61
-rw-r--r--include/drawinglayer/processor2d/processorfromoutputdevice.hxx55
-rw-r--r--include/drawinglayer/processor2d/textaspolygonextractor2d.hxx98
-rw-r--r--include/drawinglayer/processor2d/vclmetafileprocessor2d.hxx151
-rw-r--r--include/drawinglayer/processor2d/vclpixelprocessor2d.hxx63
-rw-r--r--include/drawinglayer/processor2d/vclprocessor2d.hxx136
-rw-r--r--include/drawinglayer/processor3d/baseprocessor3d.hxx75
-rw-r--r--include/drawinglayer/processor3d/cutfindprocessor3d.hxx91
-rw-r--r--include/drawinglayer/processor3d/defaultprocessor3d.hxx158
-rw-r--r--include/drawinglayer/processor3d/geometry2dextractor.hxx75
-rw-r--r--include/drawinglayer/processor3d/shadow3dextractor.hxx110
-rw-r--r--include/drawinglayer/processor3d/zbufferprocessor3d.hxx113
-rw-r--r--include/drawinglayer/texture/texture.hxx260
-rw-r--r--include/drawinglayer/texture/texture3d.hxx159
-rw-r--r--include/drawinglayer/tools/converters.hxx47
-rw-r--r--include/editeng/AccessibleComponentBase.hxx141
-rw-r--r--include/editeng/AccessibleContextBase.hxx388
-rw-r--r--include/editeng/AccessibleEditableTextPara.hxx386
-rw-r--r--include/editeng/AccessibleImageBullet.hxx219
-rw-r--r--include/editeng/AccessibleParaManager.hxx334
-rw-r--r--include/editeng/AccessibleSelectionBase.hxx67
-rw-r--r--include/editeng/AccessibleStaticTextBase.hxx277
-rw-r--r--include/editeng/AccessibleStringWrap.hxx57
-rw-r--r--include/editeng/LatinLookupTree.hxx74
-rw-r--r--include/editeng/LatinTreeNode.hxx48
-rw-r--r--include/editeng/LookupTree.hxx95
-rw-r--r--include/editeng/Node.hxx102
-rw-r--r--include/editeng/SpellPortions.hxx89
-rw-r--r--include/editeng/TreeHead.hxx49
-rw-r--r--include/editeng/UnoForbiddenCharsTable.hxx59
-rw-r--r--include/editeng/acorrcfg.hxx121
-rw-r--r--include/editeng/adjustitem.hxx130
-rw-r--r--include/editeng/autokernitem.hxx61
-rw-r--r--include/editeng/blinkitem.hxx59
-rw-r--r--include/editeng/borderline.hxx169
-rw-r--r--include/editeng/boxitem.hxx226
-rw-r--r--include/editeng/brushitem.hxx125
-rw-r--r--include/editeng/bulletitem.hxx146
-rw-r--r--include/editeng/charhiddenitem.hxx53
-rw-r--r--include/editeng/charreliefitem.hxx68
-rw-r--r--include/editeng/charrotateitem.hxx81
-rw-r--r--include/editeng/charscaleitem.hxx67
-rw-r--r--include/editeng/charsetcoloritem.hxx66
-rw-r--r--include/editeng/cmapitem.hxx76
-rw-r--r--include/editeng/colritem.hxx82
-rw-r--r--include/editeng/contouritem.hxx58
-rw-r--r--include/editeng/crossedoutitem.hxx79
-rw-r--r--include/editeng/editdata.hxx368
-rw-r--r--include/editeng/editeng.hxx586
-rw-r--r--include/editeng/editengdllapi.h34
-rw-r--r--include/editeng/editerr.hxx30
-rw-r--r--include/editeng/editids.hrc236
-rw-r--r--include/editeng/editobj.hxx130
-rw-r--r--include/editeng/editrids.hrc395
-rw-r--r--include/editeng/editstat.hxx139
-rw-r--r--include/editeng/editund2.hxx67
-rw-r--r--include/editeng/editview.hxx247
-rw-r--r--include/editeng/edtdlg.hxx102
-rw-r--r--include/editeng/eedata.hxx65
-rw-r--r--include/editeng/eeitem.hxx97
-rw-r--r--include/editeng/eeitemid.hxx129
-rw-r--r--include/editeng/eerdll.hxx55
-rw-r--r--include/editeng/emphasismarkitem.hxx73
-rw-r--r--include/editeng/escapementitem.hxx101
-rw-r--r--include/editeng/fhgtitem.hxx103
-rw-r--r--include/editeng/fieldupdater.hxx47
-rw-r--r--include/editeng/flditem.hxx420
-rw-r--r--include/editeng/flstitem.hxx70
-rw-r--r--include/editeng/fontitem.hxx98
-rw-r--r--include/editeng/forbiddencharacterstable.hxx56
-rw-r--r--include/editeng/forbiddenruleitem.hxx60
-rw-r--r--include/editeng/formatbreakitem.hxx90
-rw-r--r--include/editeng/frmdir.hxx53
-rw-r--r--include/editeng/frmdiritem.hxx68
-rw-r--r--include/editeng/fwdtitem.hxx98
-rw-r--r--include/editeng/hangulhanja.hxx288
-rw-r--r--include/editeng/hngpnctitem.hxx60
-rw-r--r--include/editeng/hyphenzoneitem.hxx93
-rw-r--r--include/editeng/itemtype.hxx64
-rw-r--r--include/editeng/justifyitem.hxx119
-rw-r--r--include/editeng/keepitem.hxx65
-rw-r--r--include/editeng/kernitem.hxx67
-rw-r--r--include/editeng/langitem.hxx71
-rw-r--r--include/editeng/lcolitem.hxx54
-rw-r--r--include/editeng/lineitem.hxx75
-rw-r--r--include/editeng/lrspitem.hxx165
-rw-r--r--include/editeng/lspcitem.hxx107
-rw-r--r--include/editeng/macros.hxx17
-rw-r--r--include/editeng/measfld.hxx57
-rw-r--r--include/editeng/memberids.hrc185
-rw-r--r--include/editeng/mutxhelp.hxx37
-rw-r--r--include/editeng/nhypitem.hxx53
-rw-r--r--include/editeng/nlbkitem.hxx56
-rw-r--r--include/editeng/numdef.hxx23
-rw-r--r--include/editeng/numitem.hxx356
-rw-r--r--include/editeng/opaqitem.hxx68
-rw-r--r--include/editeng/optitems.hxx102
-rw-r--r--include/editeng/orphitem.hxx61
-rw-r--r--include/editeng/outliner.hxx1001
-rw-r--r--include/editeng/outlobj.hxx93
-rw-r--r--include/editeng/paperinf.hxx67
-rw-r--r--include/editeng/paragraphdata.hxx64
-rw-r--r--include/editeng/paravertalignitem.hxx69
-rw-r--r--include/editeng/pbinitem.hxx68
-rw-r--r--include/editeng/pgrditem.hxx55
-rw-r--r--include/editeng/pmdlitem.hxx77
-rw-r--r--include/editeng/postitem.hxx76
-rw-r--r--include/editeng/prntitem.hxx70
-rw-r--r--include/editeng/protitem.hxx90
-rw-r--r--include/editeng/prszitem.hxx59
-rw-r--r--include/editeng/rsiditem.hxx43
-rw-r--r--include/editeng/scriptspaceitem.hxx61
-rw-r--r--include/editeng/scripttypeitem.hxx82
-rw-r--r--include/editeng/shaditem.hxx98
-rw-r--r--include/editeng/shdditem.hxx61
-rw-r--r--include/editeng/sizeitem.hxx74
-rw-r--r--include/editeng/spltitem.hxx68
-rw-r--r--include/editeng/splwrap.hxx151
-rw-r--r--include/editeng/svxacorr.hxx441
-rw-r--r--include/editeng/svxenum.hxx239
-rw-r--r--include/editeng/svxfont.hxx119
-rw-r--r--include/editeng/svxrtf.hxx424
-rw-r--r--include/editeng/swafopt.hxx134
-rw-r--r--include/editeng/tstpitem.hxx161
-rw-r--r--include/editeng/twolinesitem.hxx77
-rw-r--r--include/editeng/txtrange.hxx112
-rw-r--r--include/editeng/udlnitem.hxx119
-rw-r--r--include/editeng/ulspitem.hxx104
-rw-r--r--include/editeng/unoedhlp.hxx161
-rw-r--r--include/editeng/unoedprx.hxx176
-rw-r--r--include/editeng/unoedsrc.hxx540
-rw-r--r--include/editeng/unofdesc.hxx46
-rw-r--r--include/editeng/unofield.hxx113
-rw-r--r--include/editeng/unofored.hxx93
-rw-r--r--include/editeng/unoforou.hxx122
-rw-r--r--include/editeng/unoipset.hxx78
-rw-r--r--include/editeng/unolingu.hxx192
-rw-r--r--include/editeng/unonames.hxx43
-rw-r--r--include/editeng/unonrule.hxx87
-rw-r--r--include/editeng/unopracc.hxx66
-rw-r--r--include/editeng/unoprnms.hxx372
-rw-r--r--include/editeng/unotext.hxx661
-rw-r--r--include/editeng/unoviwou.hxx57
-rw-r--r--include/editeng/wghtitem.hxx76
-rw-r--r--include/editeng/widwitem.hxx61
-rw-r--r--include/editeng/writingmodeitem.hxx57
-rw-r--r--include/editeng/wrlmitem.hxx62
-rw-r--r--include/editeng/xmlcnitm.hxx83
-rw-r--r--include/filter/dllapi.h40
-rw-r--r--include/filter/msfilter/countryid.hxx311
-rw-r--r--include/filter/msfilter/dffpropset.hxx70
-rw-r--r--include/filter/msfilter/dffrecordheader.hxx63
-rw-r--r--include/filter/msfilter/escherex.hxx1721
-rw-r--r--include/filter/msfilter/mscodec.hxx370
-rw-r--r--include/filter/msfilter/msdffimp.hxx809
-rw-r--r--include/filter/msfilter/msfilterdllapi.h35
-rw-r--r--include/filter/msfilter/msocximex.hxx106
-rw-r--r--include/filter/msfilter/msoleexp.hxx53
-rw-r--r--include/filter/msfilter/mstoolbar.hxx359
-rw-r--r--include/filter/msfilter/msvbahelper.hxx106
-rw-r--r--include/filter/msfilter/rtfutil.hxx52
-rw-r--r--include/filter/msfilter/svdfppt.hxx1564
-rw-r--r--include/filter/msfilter/svxmsbas.hxx75
-rw-r--r--include/filter/msfilter/util.hxx81
-rw-r--r--include/formula/ExternalReferenceHelper.hxx41
-rw-r--r--include/formula/FormulaCompiler.hxx388
-rw-r--r--include/formula/FormulaOpCodeMapperObj.hxx84
-rw-r--r--include/formula/IControlReferenceHandler.hxx42
-rw-r--r--include/formula/IFunctionDescription.hxx170
-rw-r--r--include/formula/compiler.hrc423
-rw-r--r--include/formula/errorcodes.hxx119
-rw-r--r--include/formula/formdata.hxx83
-rw-r--r--include/formula/formula.hxx142
-rw-r--r--include/formula/formuladllapi.h34
-rw-r--r--include/formula/formulahelper.hxx80
-rw-r--r--include/formula/funcutl.hxx109
-rw-r--r--include/formula/grammar.hxx242
-rw-r--r--include/formula/omoduleclient.hxx43
-rw-r--r--include/formula/opcode.hxx420
-rw-r--r--include/formula/token.hxx428
-rw-r--r--include/formula/tokenarray.hxx287
-rw-r--r--include/framework/actiontriggerhelper.hxx67
-rw-r--r--include/framework/addonmenu.hxx127
-rw-r--r--include/framework/addonsoptions.hxx350
-rw-r--r--include/framework/bmkmenu.hxx69
-rw-r--r--include/framework/configimporter.hxx47
-rw-r--r--include/framework/documentundoguard.hxx63
-rw-r--r--include/framework/eventsconfiguration.hxx43
-rw-r--r--include/framework/framelistanalyzer.hxx195
-rw-r--r--include/framework/fwedllapi.h34
-rw-r--r--include/framework/iguard.hxx54
-rw-r--r--include/framework/imageproducer.hxx50
-rw-r--r--include/framework/imutex.hxx53
-rw-r--r--include/framework/interaction.hxx103
-rw-r--r--include/framework/menuconfiguration.hxx107
-rw-r--r--include/framework/menuextensionsupplier.hxx43
-rw-r--r--include/framework/preventduplicateinteraction.hxx236
-rw-r--r--include/framework/sfxhelperfunctions.hxx97
-rw-r--r--include/framework/statusbarconfiguration.hxx53
-rw-r--r--include/framework/titlehelper.hxx206
-rw-r--r--include/framework/toolboxconfiguration.hxx52
-rw-r--r--include/framework/undomanagerhelper.hxx159
-rw-r--r--include/i18nlangtag/i18nlangtagdllapi.h34
-rw-r--r--include/i18nlangtag/lang.h568
-rw-r--r--include/i18nlangtag/languagetag.hxx400
-rw-r--r--include/i18nlangtag/mslangid.hxx309
-rw-r--r--include/i18nutil/casefolding.hxx79
-rw-r--r--include/i18nutil/i18nutildllapi.h34
-rw-r--r--include/i18nutil/oneToOneMapping.hxx85
-rw-r--r--include/i18nutil/paper.hxx148
-rw-r--r--include/i18nutil/scripttypedetector.hxx38
-rw-r--r--include/i18nutil/unicode.hxx63
-rw-r--r--include/i18nutil/widthfolding.hxx54
-rw-r--r--include/jvmaccess/classpath.hxx139
-rw-r--r--include/jvmaccess/jvmaccessdllapi.h24
-rw-r--r--include/jvmaccess/unovirtualmachine.hxx104
-rw-r--r--include/jvmaccess/virtualmachine.hxx151
-rw-r--r--include/jvmfwk/framework.h835
-rw-r--r--include/jvmfwk/jvmfwkdllapi.h24
-rw-r--r--include/jvmfwk/jvmfwkplugindllapi.h24
-rw-r--r--include/jvmfwk/vendorplugin.h258
-rw-r--r--include/linguistic/hyphdta.hxx136
-rw-r--r--include/linguistic/lngdllapi.h35
-rw-r--r--include/linguistic/lngprophelp.hxx360
-rw-r--r--include/linguistic/lngprops.hxx55
-rw-r--r--include/linguistic/misc.hxx215
-rw-r--r--include/linguistic/spelldta.hxx117
-rw-r--r--include/o3tl/compat_functional.hxx151
-rw-r--r--include/o3tl/cow_wrapper.hxx322
-rw-r--r--include/o3tl/heap_ptr.hxx305
-rw-r--r--include/o3tl/lazy_update.hxx265
-rw-r--r--include/o3tl/range.hxx183
-rw-r--r--include/o3tl/sorted_vector.hxx237
-rw-r--r--include/o3tl/vector_pool.hxx123
-rw-r--r--include/oox/core/binarycodec.hxx316
-rw-r--r--include/oox/core/contexthandler.hxx117
-rw-r--r--include/oox/core/contexthandler2.hxx272
-rw-r--r--include/oox/core/fastparser.hxx97
-rw-r--r--include/oox/core/fasttokenhandler.hxx67
-rw-r--r--include/oox/core/filterbase.hxx293
-rw-r--r--include/oox/core/filterdetect.hxx162
-rw-r--r--include/oox/core/fragmenthandler.hxx131
-rw-r--r--include/oox/core/fragmenthandler2.hxx121
-rw-r--r--include/oox/core/recordparser.hxx90
-rw-r--r--include/oox/core/relations.hxx103
-rw-r--r--include/oox/core/relationshandler.hxx54
-rw-r--r--include/oox/core/xmlfilterbase.hxx256
-rw-r--r--include/oox/dllapi.h33
-rw-r--r--include/oox/drawingml/chart/axiscontext.hxx120
-rw-r--r--include/oox/drawingml/chart/axisconverter.hxx64
-rw-r--r--include/oox/drawingml/chart/axismodel.hxx105
-rw-r--r--include/oox/drawingml/chart/chartcontextbase.hxx95
-rw-r--r--include/oox/drawingml/chart/chartconverter.hxx104
-rw-r--r--include/oox/drawingml/chart/chartdrawingfragment.hxx115
-rw-r--r--include/oox/drawingml/chart/chartspaceconverter.hxx57
-rw-r--r--include/oox/drawingml/chart/chartspacefragment.hxx55
-rw-r--r--include/oox/drawingml/chart/chartspacemodel.hxx72
-rw-r--r--include/oox/drawingml/chart/converterbase.hxx153
-rw-r--r--include/oox/drawingml/chart/datasourcecontext.hxx94
-rw-r--r--include/oox/drawingml/chart/datasourceconverter.hxx71
-rw-r--r--include/oox/drawingml/chart/datasourcemodel.hxx65
-rw-r--r--include/oox/drawingml/chart/modelbase.hxx134
-rw-r--r--include/oox/drawingml/chart/objectformatter.hxx157
-rw-r--r--include/oox/drawingml/chart/plotareacontext.hxx83
-rw-r--r--include/oox/drawingml/chart/plotareaconverter.hxx103
-rw-r--r--include/oox/drawingml/chart/plotareamodel.hxx87
-rw-r--r--include/oox/drawingml/chart/seriescontext.hxx266
-rw-r--r--include/oox/drawingml/chart/seriesconverter.hxx167
-rw-r--r--include/oox/drawingml/chart/seriesmodel.hxx237
-rw-r--r--include/oox/drawingml/chart/titlecontext.hxx83
-rw-r--r--include/oox/drawingml/chart/titleconverter.hxx106
-rw-r--r--include/oox/drawingml/chart/titlemodel.hxx89
-rw-r--r--include/oox/drawingml/chart/typegroupcontext.hxx164
-rw-r--r--include/oox/drawingml/chart/typegroupconverter.hxx198
-rw-r--r--include/oox/drawingml/chart/typegroupmodel.hxx96
-rw-r--r--include/oox/drawingml/clrscheme.hxx62
-rw-r--r--include/oox/drawingml/clrschemecontext.hxx62
-rw-r--r--include/oox/drawingml/color.hxx144
-rw-r--r--include/oox/drawingml/colorchoicecontext.hxx80
-rw-r--r--include/oox/drawingml/connectorshapecontext.hxx41
-rw-r--r--include/oox/drawingml/customshapegeometry.hxx71
-rw-r--r--include/oox/drawingml/customshapeproperties.hxx189
-rw-r--r--include/oox/drawingml/diagram/diagram.hxx58
-rw-r--r--include/oox/drawingml/drawingmltypes.hxx200
-rw-r--r--include/oox/drawingml/effectproperties.hxx53
-rw-r--r--include/oox/drawingml/effectpropertiescontext.hxx41
-rw-r--r--include/oox/drawingml/embeddedwavaudiofile.hxx51
-rw-r--r--include/oox/drawingml/fillproperties.hxx152
-rw-r--r--include/oox/drawingml/fillpropertiesgroupcontext.hxx208
-rw-r--r--include/oox/drawingml/graphicshapecontext.hxx110
-rw-r--r--include/oox/drawingml/guidcontext.hxx43
-rw-r--r--include/oox/drawingml/lineproperties.hxx74
-rw-r--r--include/oox/drawingml/linepropertiescontext.hxx52
-rw-r--r--include/oox/drawingml/objectdefaultcontext.hxx43
-rw-r--r--include/oox/drawingml/scene3dcontext.hxx47
-rw-r--r--include/oox/drawingml/shape.hxx273
-rw-r--r--include/oox/drawingml/shape3dproperties.hxx125
-rw-r--r--include/oox/drawingml/shapecontext.hxx53
-rw-r--r--include/oox/drawingml/shapegroupcontext.hxx46
-rw-r--r--include/oox/drawingml/shapepropertiescontext.hxx43
-rw-r--r--include/oox/drawingml/shapepropertymap.hxx147
-rw-r--r--include/oox/drawingml/shapestylecontext.hxx45
-rw-r--r--include/oox/drawingml/spdefcontext.hxx42
-rw-r--r--include/oox/drawingml/table/tablebackgroundstylecontext.hxx47
-rw-r--r--include/oox/drawingml/table/tablecell.hxx115
-rw-r--r--include/oox/drawingml/table/tablecellcontext.hxx48
-rw-r--r--include/oox/drawingml/table/tablecontext.hxx48
-rw-r--r--include/oox/drawingml/table/tablepartstylecontext.hxx47
-rw-r--r--include/oox/drawingml/table/tableproperties.hxx80
-rw-r--r--include/oox/drawingml/table/tablerow.hxx49
-rw-r--r--include/oox/drawingml/table/tablerowcontext.hxx49
-rw-r--r--include/oox/drawingml/table/tablestyle.hxx85
-rw-r--r--include/oox/drawingml/table/tablestylecellstylecontext.hxx48
-rw-r--r--include/oox/drawingml/table/tablestylecontext.hxx49
-rw-r--r--include/oox/drawingml/table/tablestylelist.hxx54
-rw-r--r--include/oox/drawingml/table/tablestylelistfragmenthandler.hxx56
-rw-r--r--include/oox/drawingml/table/tablestylepart.hxx73
-rw-r--r--include/oox/drawingml/table/tablestyletextstylecontext.hxx49
-rw-r--r--include/oox/drawingml/textbody.hxx73
-rw-r--r--include/oox/drawingml/textbodycontext.hxx63
-rw-r--r--include/oox/drawingml/textbodyproperties.hxx56
-rw-r--r--include/oox/drawingml/textbodypropertiescontext.hxx47
-rw-r--r--include/oox/drawingml/textcharacterproperties.hxx84
-rw-r--r--include/oox/drawingml/textcharacterpropertiescontext.hxx48
-rw-r--r--include/oox/drawingml/textfield.hxx62
-rw-r--r--include/oox/drawingml/textfieldcontext.hxx52
-rw-r--r--include/oox/drawingml/textfont.hxx73
-rw-r--r--include/oox/drawingml/textliststyle.hxx61
-rw-r--r--include/oox/drawingml/textliststylecontext.hxx45
-rw-r--r--include/oox/drawingml/textparagraph.hxx73
-rw-r--r--include/oox/drawingml/textparagraphproperties.hxx128
-rw-r--r--include/oox/drawingml/textparagraphpropertiescontext.hxx58
-rw-r--r--include/oox/drawingml/textrun.hxx62
-rw-r--r--include/oox/drawingml/textspacing.hxx69
-rw-r--r--include/oox/drawingml/theme.hxx116
-rw-r--r--include/oox/drawingml/themeelementscontext.hxx51
-rw-r--r--include/oox/drawingml/themefragmenthandler.hxx55
-rw-r--r--include/oox/drawingml/transform2dcontext.hxx52
-rw-r--r--include/oox/dump/dffdumper.hxx70
-rw-r--r--include/oox/dump/dumperbase.hxx1871
-rw-r--r--include/oox/dump/oledumper.hxx905
-rw-r--r--include/oox/dump/pptxdumper.hxx71
-rw-r--r--include/oox/dump/xlsbdumper.hxx136
-rw-r--r--include/oox/export/chartexport.hxx204
-rw-r--r--include/oox/export/drawingml.hxx160
-rw-r--r--include/oox/export/shapes.hxx170
-rw-r--r--include/oox/export/utils.hxx59
-rw-r--r--include/oox/export/vmlexport.hxx132
-rw-r--r--include/oox/helper/attributelist.hxx170
-rw-r--r--include/oox/helper/binaryinputstream.hxx438
-rw-r--r--include/oox/helper/binaryoutputstream.hxx189
-rw-r--r--include/oox/helper/binarystreambase.hxx187
-rw-r--r--include/oox/helper/containerhelper.hxx410
-rw-r--r--include/oox/helper/graphichelper.hxx168
-rw-r--r--include/oox/helper/helper.hxx334
-rw-r--r--include/oox/helper/modelobjecthelper.hxx125
-rw-r--r--include/oox/helper/progressbar.hxx138
-rw-r--r--include/oox/helper/propertymap.hxx111
-rw-r--r--include/oox/helper/propertyset.hxx146
-rw-r--r--include/oox/helper/refmap.hxx185
-rw-r--r--include/oox/helper/refvector.hxx195
-rw-r--r--include/oox/helper/storagebase.hxx191
-rw-r--r--include/oox/helper/textinputstream.hxx122
-rw-r--r--include/oox/helper/zipstorage.hxx88
-rw-r--r--include/oox/mathml/export.hxx40
-rw-r--r--include/oox/mathml/import.hxx46
-rw-r--r--include/oox/mathml/importutils.hxx254
-rw-r--r--include/oox/ole/axbinaryreader.hxx257
-rw-r--r--include/oox/ole/axbinarywriter.hxx194
-rw-r--r--include/oox/ole/axcontrol.hxx1031
-rw-r--r--include/oox/ole/axcontrolfragment.hxx74
-rw-r--r--include/oox/ole/axfontdata.hxx81
-rw-r--r--include/oox/ole/olehelper.hxx203
-rw-r--r--include/oox/ole/oleobjecthelper.hxx79
-rw-r--r--include/oox/ole/olestorage.hxx110
-rw-r--r--include/oox/ole/vbacontrol.hxx205
-rw-r--r--include/oox/ole/vbahelper.hxx98
-rw-r--r--include/oox/ole/vbainputstream.hxx74
-rw-r--r--include/oox/ole/vbamodule.hxx109
-rw-r--r--include/oox/ole/vbaproject.hxx206
-rw-r--r--include/oox/ppt/animationspersist.hxx126
-rw-r--r--include/oox/ppt/backgroundproperties.hxx44
-rw-r--r--include/oox/ppt/comments.hxx139
-rw-r--r--include/oox/ppt/customshowlistcontext.hxx53
-rw-r--r--include/oox/ppt/dgmimport.hxx62
-rw-r--r--include/oox/ppt/dgmlayout.hxx63
-rw-r--r--include/oox/ppt/headerfooter.hxx45
-rw-r--r--include/oox/ppt/layoutfragmenthandler.hxx42
-rw-r--r--include/oox/ppt/pptgraphicshapecontext.hxx40
-rw-r--r--include/oox/ppt/pptimport.hxx91
-rw-r--r--include/oox/ppt/pptshape.hxx73
-rw-r--r--include/oox/ppt/pptshapecontext.hxx40
-rw-r--r--include/oox/ppt/pptshapegroupcontext.hxx56
-rw-r--r--include/oox/ppt/pptshapepropertiescontext.hxx40
-rw-r--r--include/oox/ppt/presentationfragmenthandler.hxx72
-rw-r--r--include/oox/ppt/slidefragmenthandler.hxx60
-rw-r--r--include/oox/ppt/slidemastertextstylescontext.hxx45
-rw-r--r--include/oox/ppt/slidepersist.hxx161
-rw-r--r--include/oox/ppt/slidetimingcontext.hxx48
-rw-r--r--include/oox/ppt/slidetransition.hxx72
-rw-r--r--include/oox/ppt/slidetransitioncontext.hxx52
-rw-r--r--include/oox/ppt/soundactioncontext.hxx55
-rw-r--r--include/oox/ppt/timenode.hxx128
-rw-r--r--include/oox/ppt/timenodelistcontext.hxx65
-rw-r--r--include/oox/token/namespacemap.hxx43
-rw-r--r--include/oox/token/propertynames.hxx43
-rw-r--r--include/oox/token/tokenmap.hxx73
-rw-r--r--include/oox/vml/vmldrawing.hxx213
-rw-r--r--include/oox/vml/vmldrawingfragment.hxx60
-rw-r--r--include/oox/vml/vmlformatting.hxx248
-rw-r--r--include/oox/vml/vmlinputstream.hxx98
-rw-r--r--include/oox/vml/vmlshape.hxx439
-rw-r--r--include/oox/vml/vmlshapecontainer.hxx153
-rw-r--r--include/oox/vml/vmlshapecontext.hxx188
-rw-r--r--include/oox/vml/vmltextbox.hxx104
-rw-r--r--include/oox/vml/vmltextboxcontext.hxx78
-rw-r--r--include/package/Deflater.hxx65
-rw-r--r--include/package/Inflater.hxx57
-rw-r--r--include/package/packagedllapi.hxx22
-rw-r--r--include/registry/reader.h603
-rw-r--r--include/registry/reader.hxx624
-rw-r--r--include/registry/reflread.hxx513
-rw-r--r--include/registry/refltype.hxx80
-rw-r--r--include/registry/reflwrit.hxx350
-rw-r--r--include/registry/regdllapi.h33
-rw-r--r--include/registry/registry.h456
-rw-r--r--include/registry/registry.hxx1257
-rw-r--r--include/registry/regtype.h168
-rw-r--r--include/registry/types.h334
-rw-r--r--include/registry/version.h69
-rw-r--r--include/registry/writer.h262
-rw-r--r--include/registry/writer.hxx291
-rw-r--r--include/rsc/rsc-vcl-shared-types.hxx133
-rw-r--r--include/rsc/rscsfx.hxx56
-rw-r--r--include/sax/fastattribs.hxx85
-rw-r--r--include/sax/fshelper.hxx199
-rw-r--r--include/sax/saxdllapi.h33
-rw-r--r--include/sax/tools/converter.hxx206
-rw-r--r--include/sax/tools/documenthandleradapter.hxx254
-rw-r--r--include/sfx2/DocumentMetadataAccess.hxx208
-rw-r--r--include/sfx2/Metadatable.hxx181
-rw-r--r--include/sfx2/QuerySaveDocument.hxx38
-rw-r--r--include/sfx2/XmlIdRegistry.hxx84
-rw-r--r--include/sfx2/app.hxx278
-rw-r--r--include/sfx2/appuno.hxx108
-rw-r--r--include/sfx2/basedlgs.hxx238
-rw-r--r--include/sfx2/bindings.hxx248
-rw-r--r--include/sfx2/brokenpackageint.hxx48
-rw-r--r--include/sfx2/chalign.hxx57
-rw-r--r--include/sfx2/checkin.hxx35
-rw-r--r--include/sfx2/childwin.hxx370
-rw-r--r--include/sfx2/cntids.hrc49
-rw-r--r--include/sfx2/controlwrapper.hxx644
-rw-r--r--include/sfx2/ctrlitem.hxx100
-rw-r--r--include/sfx2/dialogs.hrc30
-rw-r--r--include/sfx2/dinfdlg.hxx501
-rw-r--r--include/sfx2/dinfedt.hxx40
-rw-r--r--include/sfx2/dispatch.hxx308
-rw-r--r--include/sfx2/dllapi.h36
-rw-r--r--include/sfx2/docfac.hxx125
-rw-r--r--include/sfx2/docfile.hxx286
-rw-r--r--include/sfx2/docfilt.hxx126
-rw-r--r--include/sfx2/docinf.hxx74
-rw-r--r--include/sfx2/docinsert.hxx71
-rw-r--r--include/sfx2/dockwin.hxx130
-rw-r--r--include/sfx2/docmacromode.hxx328
-rw-r--r--include/sfx2/docstoragemodifylistener.hxx86
-rw-r--r--include/sfx2/doctempl.hxx139
-rw-r--r--include/sfx2/event.hxx136
-rw-r--r--include/sfx2/evntconf.hxx120
-rw-r--r--include/sfx2/fcontnr.hxx153
-rw-r--r--include/sfx2/filedlghelper.hxx262
-rw-r--r--include/sfx2/frame.hxx290
-rw-r--r--include/sfx2/frmdescr.hxx259
-rw-r--r--include/sfx2/frmhtml.hxx47
-rw-r--r--include/sfx2/frmhtmlw.hxx82
-rw-r--r--include/sfx2/genlink.hxx50
-rw-r--r--include/sfx2/hintpost.hxx68
-rw-r--r--include/sfx2/htmlmode.hxx32
-rw-r--r--include/sfx2/imagemgr.hxx34
-rw-r--r--include/sfx2/imgmgr.hxx53
-rw-r--r--include/sfx2/infobar.hxx83
-rw-r--r--include/sfx2/ipclient.hxx95
-rw-r--r--include/sfx2/itemconnect.hxx578
-rw-r--r--include/sfx2/itemwrapper.hxx206
-rw-r--r--include/sfx2/linkmgr.hxx195
-rw-r--r--include/sfx2/linksrc.hxx121
-rw-r--r--include/sfx2/lnkbase.hxx176
-rw-r--r--include/sfx2/macropg.hxx137
-rw-r--r--include/sfx2/mailmodelapi.hxx136
-rw-r--r--include/sfx2/mgetempl.hxx93
-rw-r--r--include/sfx2/mieclip.hxx56
-rw-r--r--include/sfx2/minfitem.hxx72
-rw-r--r--include/sfx2/mnuitem.hxx121
-rw-r--r--include/sfx2/mnumgr.hxx111
-rw-r--r--include/sfx2/module.hxx115
-rw-r--r--include/sfx2/msg.hxx333
-rw-r--r--include/sfx2/msgpool.hxx84
-rw-r--r--include/sfx2/navigat.hxx55
-rw-r--r--include/sfx2/new.hxx75
-rw-r--r--include/sfx2/newstyle.hxx56
-rw-r--r--include/sfx2/objface.hxx125
-rw-r--r--include/sfx2/objitem.hxx47
-rw-r--r--include/sfx2/objsh.hxx824
-rw-r--r--include/sfx2/opengrf.hxx58
-rw-r--r--include/sfx2/passwd.hxx123
-rw-r--r--include/sfx2/printer.hxx75
-rw-r--r--include/sfx2/printopt.hxx109
-rw-r--r--include/sfx2/prnmon.hxx60
-rw-r--r--include/sfx2/progress.hxx74
-rw-r--r--include/sfx2/querystatus.hxx55
-rw-r--r--include/sfx2/request.hxx125
-rw-r--r--include/sfx2/securitypage.hxx49
-rw-r--r--include/sfx2/sfx.hrc289
-rw-r--r--include/sfx2/sfxbasecontroller.hxx386
-rw-r--r--include/sfx2/sfxbasemodel.hxx1554
-rw-r--r--include/sfx2/sfxcommands.h70
-rw-r--r--include/sfx2/sfxdefs.hxx27
-rw-r--r--include/sfx2/sfxdlg.hxx158
-rw-r--r--include/sfx2/sfxhelp.hxx65
-rw-r--r--include/sfx2/sfxhtml.hxx112
-rw-r--r--include/sfx2/sfxmodelfactory.hxx67
-rw-r--r--include/sfx2/sfxresid.hxx37
-rw-r--r--include/sfx2/sfxsids.hrc753
-rw-r--r--include/sfx2/sfxstatuslistener.hxx88
-rw-r--r--include/sfx2/sfxuno.hxx638
-rw-r--r--include/sfx2/shell.hxx371
-rw-r--r--include/sfx2/signaturestate.hxx38
-rw-r--r--include/sfx2/stbitem.hxx142
-rw-r--r--include/sfx2/styfitem.hxx99
-rw-r--r--include/sfx2/styledlg.hxx52
-rw-r--r--include/sfx2/tabdlg.hxx306
-rw-r--r--include/sfx2/tabpage.hrc33
-rw-r--r--include/sfx2/taskpane.hxx233
-rw-r--r--include/sfx2/tbxctrl.hxx412
-rw-r--r--include/sfx2/templateabstractview.hxx147
-rw-r--r--include/sfx2/templatecontaineritem.hxx46
-rw-r--r--include/sfx2/templateinfodlg.hxx50
-rw-r--r--include/sfx2/templatelocalview.hxx104
-rw-r--r--include/sfx2/templatelocnames.hrc54
-rw-r--r--include/sfx2/templateproperties.hxx29
-rw-r--r--include/sfx2/templateremoteview.hxx48
-rw-r--r--include/sfx2/templaterepository.hxx46
-rw-r--r--include/sfx2/templateviewitem.hxx61
-rw-r--r--include/sfx2/templdlg.hxx84
-rw-r--r--include/sfx2/thumbnailview.hxx332
-rw-r--r--include/sfx2/thumbnailviewitem.hxx134
-rw-r--r--include/sfx2/titledockwin.hxx161
-rw-r--r--include/sfx2/tplpitem.hxx51
-rw-r--r--include/sfx2/unoctitm.hxx198
-rw-r--r--include/sfx2/userinputinterception.hxx75
-rw-r--r--include/sfx2/viewfac.hxx61
-rw-r--r--include/sfx2/viewfrm.hxx335
-rw-r--r--include/sfx2/viewsh.hxx343
-rw-r--r--include/sfx2/zoomitem.hxx83
-rw-r--r--include/shell/kde_headers.h99
-rw-r--r--include/shell/tde_defines.h109
-rw-r--r--include/shell/tde_headers.h97
-rw-r--r--include/sot/exchange.hxx224
-rw-r--r--include/sot/factory.hxx76
-rw-r--r--include/sot/filelist.hxx65
-rw-r--r--include/sot/formats.hxx182
-rw-r--r--include/sot/object.hxx307
-rw-r--r--include/sot/sotdata.hxx57
-rw-r--r--include/sot/sotdllapi.h34
-rw-r--r--include/sot/stg.hxx366
-rw-r--r--include/sot/storage.hxx223
-rw-r--r--include/sot/storinfo.hxx61
-rw-r--r--include/store/store.h405
-rw-r--r--include/store/store.hxx605
-rw-r--r--include/store/storedllapi.h32
-rw-r--r--include/store/types.h160
-rw-r--r--include/svl/PasswordHelper.hxx46
-rw-r--r--include/svl/adrparse.hxx78
-rw-r--r--include/svl/aeitem.hxx63
-rw-r--r--include/svl/asiancfg.hxx70
-rw-r--r--include/svl/brdcst.hxx68
-rw-r--r--include/svl/broadcast.hxx58
-rw-r--r--include/svl/cenumitm.hxx170
-rw-r--r--include/svl/cintitem.hxx274
-rw-r--r--include/svl/cjkoptions.hxx70
-rw-r--r--include/svl/cntwall.hxx71
-rw-r--r--include/svl/cntwids.hrc208
-rw-r--r--include/svl/converter.hxx36
-rw-r--r--include/svl/ctloptions.hxx87
-rw-r--r--include/svl/ctypeitm.hxx73
-rw-r--r--include/svl/custritm.hxx85
-rw-r--r--include/svl/dateitem.hxx76
-rw-r--r--include/svl/documentlockfile.hxx63
-rw-r--r--include/svl/eitem.hxx62
-rw-r--r--include/svl/filenotation.hxx64
-rw-r--r--include/svl/filerec.hxx1031
-rw-r--r--include/svl/flagitem.hxx69
-rw-r--r--include/svl/folderrestriction.hxx47
-rw-r--r--include/svl/fstathelper.hxx59
-rw-r--r--include/svl/globalnameitem.hxx52
-rw-r--r--include/svl/hint.hxx59
-rw-r--r--include/svl/ilstitem.hxx56
-rw-r--r--include/svl/imageitm.hxx51
-rw-r--r--include/svl/inethist.hxx125
-rw-r--r--include/svl/inettype.hxx304
-rw-r--r--include/svl/instrm.hxx73
-rw-r--r--include/svl/intitem.hxx163
-rw-r--r--include/svl/isethint.hxx45
-rw-r--r--include/svl/itemiter.hxx61
-rw-r--r--include/svl/itempool.hxx259
-rw-r--r--include/svl/itemprop.hxx203
-rw-r--r--include/svl/itemset.hxx191
-rw-r--r--include/svl/languageoptions.hxx113
-rw-r--r--include/svl/lckbitem.hxx56
-rw-r--r--include/svl/listener.hxx58
-rw-r--r--include/svl/listeneriter.hxx65
-rw-r--r--include/svl/lngmisc.hxx56
-rw-r--r--include/svl/lockfilecommon.hxx69
-rw-r--r--include/svl/lstner.hxx69
-rw-r--r--include/svl/macitem.hxx215
-rw-r--r--include/svl/mailenum.hxx88
-rw-r--r--include/svl/memberid.hrc61
-rw-r--r--include/svl/metitem.hxx46
-rw-r--r--include/svl/nfkeytab.hxx122
-rw-r--r--include/svl/nfsymbol.hxx63
-rw-r--r--include/svl/nfversi.hxx64
-rw-r--r--include/svl/nranges.hxx65
-rw-r--r--include/svl/numuno.hxx92
-rw-r--r--include/svl/ondemand.hxx384
-rw-r--r--include/svl/outstrm.hxx59
-rw-r--r--include/svl/ownlist.hxx90
-rw-r--r--include/svl/pickerhistoryaccess.hxx45
-rw-r--r--include/svl/poolcach.hxx62
-rw-r--r--include/svl/poolitem.hxx415
-rw-r--r--include/svl/ptitem.hxx70
-rw-r--r--include/svl/rectitem.hxx69
-rw-r--r--include/svl/restrictedpaths.hxx75
-rw-r--r--include/svl/rngitem.hxx83
-rw-r--r--include/svl/sfontitm.hxx207
-rw-r--r--include/svl/sharecontrolfile.hxx77
-rw-r--r--include/svl/slstitm.hxx73
-rw-r--r--include/svl/smplhint.hxx93
-rw-r--r--include/svl/solar.hrc207
-rw-r--r--include/svl/srchdefs.hxx42
-rw-r--r--include/svl/srchitem.hxx287
-rw-r--r--include/svl/stritem.hxx48
-rw-r--r--include/svl/strmadpt.hxx127
-rw-r--r--include/svl/style.hrc34
-rw-r--r--include/svl/style.hxx386
-rw-r--r--include/svl/stylepool.hxx91
-rw-r--r--include/svl/stylesheetuser.hxx38
-rw-r--r--include/svl/svdde.hxx416
-rw-r--r--include/svl/svl.hrc114
-rw-r--r--include/svl/svldllapi.h34
-rw-r--r--include/svl/szitem.hxx68
-rw-r--r--include/svl/undo.hxx474
-rw-r--r--include/svl/urihelper.hxx165
-rw-r--r--include/svl/urlbmk.hxx62
-rw-r--r--include/svl/urlfilter.hxx56
-rw-r--r--include/svl/visitem.hxx87
-rw-r--r--include/svl/whiter.hxx48
-rw-r--r--include/svl/xmlement.hxx34
-rw-r--r--include/svl/zforlist.hxx1037
-rw-r--r--include/svl/zformat.hxx712
-rw-r--r--include/svtools/AccessibleBrowseBoxObjType.hxx52
-rw-r--r--include/svtools/DocumentInfoPreview.hxx73
-rw-r--r--include/svtools/DocumentToGraphicRenderer.hxx62
-rw-r--r--include/svtools/GraphicExportOptionsDialog.hxx78
-rw-r--r--include/svtools/PlaceEditDialog.hxx92
-rw-r--r--include/svtools/QueryFolderName.hxx57
-rw-r--r--include/svtools/ServerDetailsControls.hxx148
-rw-r--r--include/svtools/acceleratorexecute.hxx246
-rw-r--r--include/svtools/accessibilityoptions.hxx72
-rw-r--r--include/svtools/accessiblefactory.hxx184
-rw-r--r--include/svtools/accessibletable.hxx203
-rw-r--r--include/svtools/accessibletableprovider.hxx241
-rw-r--r--include/svtools/addresstemplate.hxx144
-rw-r--r--include/svtools/apearcfg.hxx97
-rw-r--r--include/svtools/asynclink.hxx66
-rw-r--r--include/svtools/bindablecontrolhelper.hxx52
-rw-r--r--include/svtools/borderhelper.hxx47
-rw-r--r--include/svtools/brwbox.hxx831
-rw-r--r--include/svtools/brwhead.hxx46
-rw-r--r--include/svtools/calendar.hxx451
-rw-r--r--include/svtools/cliplistener.hxx54
-rw-r--r--include/svtools/collatorres.hxx42
-rw-r--r--include/svtools/colorcfg.hxx138
-rw-r--r--include/svtools/colrdlg.hxx60
-rw-r--r--include/svtools/contextmenuhelper.hxx116
-rw-r--r--include/svtools/controldims.hrc93
-rw-r--r--include/svtools/ctrlbox.hxx552
-rw-r--r--include/svtools/ctrltool.hxx241
-rw-r--r--include/svtools/dialogclosedlistener.hxx69
-rw-r--r--include/svtools/dialogcontrolling.hxx293
-rw-r--r--include/svtools/editbrowsebox.hxx685
-rw-r--r--include/svtools/editimplementation.hxx144
-rw-r--r--include/svtools/editsyntaxhighlighter.hxx56
-rw-r--r--include/svtools/ehdl.hxx77
-rw-r--r--include/svtools/embedhlp.hxx124
-rw-r--r--include/svtools/embedtransfer.hxx57
-rw-r--r--include/svtools/extcolorcfg.hxx111
-rw-r--r--include/svtools/extensionlistbox.hxx98
-rw-r--r--include/svtools/filechangedchecker.hxx54
-rw-r--r--include/svtools/filectrl.hxx96
-rw-r--r--include/svtools/filedlg2.hrc23
-rw-r--r--include/svtools/fileurlbox.hxx68
-rw-r--r--include/svtools/fileview.hxx258
-rw-r--r--include/svtools/fmtfield.hxx319
-rw-r--r--include/svtools/fontsubstconfig.hxx61
-rw-r--r--include/svtools/framestatuslistener.hxx101
-rw-r--r--include/svtools/generictoolboxcontroller.hxx61
-rw-r--r--include/svtools/genericunodialog.hxx185
-rw-r--r--include/svtools/grfmgr.hxx624
-rw-r--r--include/svtools/headbar.hxx377
-rw-r--r--include/svtools/helpid.hrc97
-rw-r--r--include/svtools/helpopt.hxx65
-rw-r--r--include/svtools/htmlcfg.hxx94
-rw-r--r--include/svtools/htmlkywd.hxx796
-rw-r--r--include/svtools/htmlout.hxx118
-rw-r--r--include/svtools/htmltokn.h561
-rw-r--r--include/svtools/hyperlabel.hxx87
-rw-r--r--include/svtools/imagemgr.hrc147
-rw-r--r--include/svtools/imagemgr.hxx79
-rw-r--r--include/svtools/imageresourceaccess.hxx81
-rw-r--r--include/svtools/imap.hxx151
-rw-r--r--include/svtools/imapcirc.hxx75
-rw-r--r--include/svtools/imapobj.hxx145
-rw-r--r--include/svtools/imappoly.hxx81
-rw-r--r--include/svtools/imaprect.hxx73
-rw-r--r--include/svtools/imgdef.hxx36
-rw-r--r--include/svtools/indexentryres.hxx42
-rw-r--r--include/svtools/inetimg.hxx78
-rw-r--r--include/svtools/inettbc.hxx97
-rw-r--r--include/svtools/insdlg.hxx79
-rw-r--r--include/svtools/itemdel.hxx30
-rw-r--r--include/svtools/ivctrl.hxx353
-rw-r--r--include/svtools/javacontext.hxx82
-rw-r--r--include/svtools/javainteractionhandler.hxx75
-rw-r--r--include/svtools/langhelp.hxx30
-rw-r--r--include/svtools/langtab.hxx57
-rw-r--r--include/svtools/localresaccess.hxx75
-rw-r--r--include/svtools/menuoptions.hxx128
-rw-r--r--include/svtools/miscopt.hxx150
-rw-r--r--include/svtools/optionsdrawinglayer.hxx198
-rw-r--r--include/svtools/parhtml.hxx289
-rw-r--r--include/svtools/parrtf.hxx85
-rw-r--r--include/svtools/place.hxx42
-rw-r--r--include/svtools/popupmenucontrollerbase.hxx131
-rw-r--r--include/svtools/popupwindowcontroller.hxx79
-rw-r--r--include/svtools/printoptions.hxx120
-rw-r--r--include/svtools/prnsetup.hxx93
-rw-r--r--include/svtools/restartdialog.hxx47
-rw-r--r--include/svtools/roadmap.hxx123
-rw-r--r--include/svtools/roadmapwizard.hxx246
-rw-r--r--include/svtools/rtfkeywd.hxx1212
-rw-r--r--include/svtools/rtfout.hxx58
-rw-r--r--include/svtools/rtftoken.h1265
-rw-r--r--include/svtools/ruler.hxx802
-rw-r--r--include/svtools/sampletext.hxx49
-rw-r--r--include/svtools/scriptedtext.hxx95
-rw-r--r--include/svtools/scrwin.hxx93
-rw-r--r--include/svtools/sfxecode.hxx113
-rw-r--r--include/svtools/slidesorterbaropt.hxx98
-rw-r--r--include/svtools/soerr.hxx74
-rw-r--r--include/svtools/sores.hxx103
-rw-r--r--include/svtools/statusbarcontroller.hxx141
-rw-r--r--include/svtools/stdctrl.hxx41
-rw-r--r--include/svtools/stdmenu.hxx161
-rw-r--r--include/svtools/stringtransfer.hxx76
-rw-r--r--include/svtools/svlbitm.hxx257
-rw-r--r--include/svtools/svmedit.hxx45
-rw-r--r--include/svtools/svmedit2.hxx46
-rw-r--r--include/svtools/svparser.hxx278
-rw-r--r--include/svtools/svtabbx.hxx255
-rw-r--r--include/svtools/svtdllapi.h34
-rw-r--r--include/svtools/svtools.hrc324
-rw-r--r--include/svtools/svtresid.hxx38
-rw-r--r--include/svtools/svxbox.hxx178
-rw-r--r--include/svtools/tabbar.hxx557
-rw-r--r--include/svtools/table/defaultinputhandler.hxx65
-rw-r--r--include/svtools/table/gridtablerenderer.hxx121
-rw-r--r--include/svtools/table/tablecontrol.hxx218
-rw-r--r--include/svtools/table/tablecontrolinterface.hxx257
-rw-r--r--include/svtools/table/tableinputhandler.hxx73
-rw-r--r--include/svtools/table/tablemodel.hxx539
-rw-r--r--include/svtools/table/tablerenderer.hxx285
-rw-r--r--include/svtools/table/tablesort.hxx89
-rw-r--r--include/svtools/table/tabletypes.hxx64
-rw-r--r--include/svtools/templatefoldercache.hxx102
-rw-r--r--include/svtools/templdlg.hxx81
-rw-r--r--include/svtools/textwindowpeer.hxx65
-rw-r--r--include/svtools/toolbarmenu.hxx140
-rw-r--r--include/svtools/toolboxcontroller.hxx162
-rw-r--r--include/svtools/toolpanel/decklayouter.hxx99
-rw-r--r--include/svtools/toolpanel/drawerlayouter.hxx97
-rw-r--r--include/svtools/toolpanel/paneltabbar.hxx96
-rw-r--r--include/svtools/toolpanel/refbase.hxx75
-rw-r--r--include/svtools/toolpanel/tabalignment.hxx42
-rw-r--r--include/svtools/toolpanel/tabitemcontent.hxx43
-rw-r--r--include/svtools/toolpanel/tablayouter.hxx99
-rw-r--r--include/svtools/toolpanel/toolpanel.hxx138
-rw-r--r--include/svtools/toolpanel/toolpaneldeck.hxx194
-rw-r--r--include/svtools/toolpanelopt.hxx99
-rw-r--r--include/svtools/transfer.hxx521
-rw-r--r--include/svtools/treelist.hxx366
-rw-r--r--include/svtools/treelistbox.hxx806
-rwxr-xr-xinclude/svtools/treelistentries.hxx20
-rw-r--r--include/svtools/treelistentry.hxx104
-rw-r--r--include/svtools/unitconv.hxx54
-rw-r--r--include/svtools/unoevent.hxx320
-rw-r--r--include/svtools/unoimap.hxx39
-rw-r--r--include/svtools/urlcontrol.hxx53
-rw-r--r--include/svtools/valueset.hxx391
-rw-r--r--include/svtools/viewdataentry.hxx81
-rw-r--r--include/svtools/wizardmachine.hxx385
-rw-r--r--include/svtools/wizdlg.hxx301
-rw-r--r--include/svtools/xwindowitem.hxx58
-rw-r--r--include/svx/AccessibleControlShape.hxx210
-rw-r--r--include/svx/AccessibleGraphicShape.hxx117
-rw-r--r--include/svx/AccessibleOLEShape.hxx123
-rw-r--r--include/svx/AccessibleShape.hxx397
-rw-r--r--include/svx/AccessibleShapeInfo.hxx103
-rw-r--r--include/svx/AccessibleShapeTreeInfo.hxx197
-rw-r--r--include/svx/AccessibleTableShape.hxx126
-rw-r--r--include/svx/AccessibleTextHelper.hxx425
-rw-r--r--include/svx/ActionDescriptionProvider.hxx59
-rw-r--r--include/svx/ChildrenManager.hxx210
-rw-r--r--include/svx/DescriptionGenerator.hxx200
-rw-r--r--include/svx/EnhancedCustomShape2d.hxx228
-rw-r--r--include/svx/EnhancedCustomShapeFunctionParser.hxx208
-rw-r--r--include/svx/EnhancedCustomShapeGeometry.hxx95
-rw-r--r--include/svx/EnhancedCustomShapeTypeNames.hxx33
-rw-r--r--include/svx/IAccessibleParent.hxx89
-rw-r--r--include/svx/IAccessibleViewForwarder.hxx126
-rw-r--r--include/svx/IAccessibleViewForwarderListener.hxx70
-rw-r--r--include/svx/ParseContext.hxx80
-rw-r--r--include/svx/ShapeTypeHandler.hxx220
-rw-r--r--include/svx/SmartTagCtl.hxx78
-rw-r--r--include/svx/SmartTagItem.hxx87
-rw-r--r--include/svx/SmartTagMgr.hxx226
-rw-r--r--include/svx/SpellDialogChildWindow.hxx119
-rw-r--r--include/svx/SvxShapeTypes.hxx75
-rw-r--r--include/svx/UnoNamespaceMap.hxx36
-rw-r--r--include/svx/XPropertyTable.hxx39
-rw-r--r--include/svx/algitem.hxx122
-rw-r--r--include/svx/anchorid.hxx36
-rw-r--r--include/svx/bmpmask.hxx181
-rw-r--r--include/svx/camera3d.hxx78
-rw-r--r--include/svx/charmap.hxx134
-rw-r--r--include/svx/charthelper.hxx52
-rw-r--r--include/svx/checklbx.hxx81
-rw-r--r--include/svx/chrtitem.hxx334
-rw-r--r--include/svx/clipboardctl.hxx58
-rw-r--r--include/svx/clipfmtitem.hxx57
-rw-r--r--include/svx/colrctrl.hxx135
-rw-r--r--include/svx/compressgraphicdialog.hxx95
-rw-r--r--include/svx/connctrl.hxx66
-rw-r--r--include/svx/contdlg.hxx98
-rw-r--r--include/svx/ctredlin.hxx391
-rw-r--r--include/svx/cube3d.hxx88
-rw-r--r--include/svx/dataaccessdescriptor.hxx136
-rw-r--r--include/svx/databaselocationinput.hxx88
-rw-r--r--include/svx/databaseregistrationui.hxx47
-rw-r--r--include/svx/dbaexchange.hxx290
-rw-r--r--include/svx/dbaobjectex.hxx78
-rw-r--r--include/svx/dbcharsethelper.hxx59
-rw-r--r--include/svx/dbtoolsclient.hxx204
-rw-r--r--include/svx/def3d.hxx48
-rw-r--r--include/svx/deflt3d.hxx129
-rw-r--r--include/svx/dialcontrol.hxx140
-rw-r--r--include/svx/dialmgr.hxx39
-rw-r--r--include/svx/dialogs.hrc1031
-rw-r--r--include/svx/dlgctl3d.hxx204
-rw-r--r--include/svx/dlgctrl.hxx449
-rw-r--r--include/svx/dlgutil.hxx40
-rw-r--r--include/svx/drawitem.hxx213
-rw-r--r--include/svx/dstribut_enum.hxx42
-rw-r--r--include/svx/e3ditem.hxx65
-rw-r--r--include/svx/e3dsceneupdater.hxx68
-rw-r--r--include/svx/e3dundo.hxx112
-rw-r--r--include/svx/extedit.hxx53
-rw-r--r--include/svx/exthelpid.hrc34
-rw-r--r--include/svx/extrud3d.hxx102
-rw-r--r--include/svx/extrusionbar.hxx55
-rw-r--r--include/svx/extrusioncolorcontrol.hxx50
-rw-r--r--include/svx/f3dchild.hxx44
-rw-r--r--include/svx/fillctrl.hxx99
-rw-r--r--include/svx/flagsdef.hxx97
-rw-r--r--include/svx/float3d.hxx291
-rw-r--r--include/svx/fmdmod.hxx40
-rw-r--r--include/svx/fmdpage.hxx67
-rw-r--r--include/svx/fmglob.hxx59
-rw-r--r--include/svx/fmgridcl.hxx206
-rw-r--r--include/svx/fmgridif.hxx544
-rw-r--r--include/svx/fmmodel.hxx93
-rw-r--r--include/svx/fmobjfac.hxx44
-rw-r--r--include/svx/fmpage.hxx82
-rw-r--r--include/svx/fmresids.hrc227
-rw-r--r--include/svx/fmsearch.hxx77
-rw-r--r--include/svx/fmshell.hxx181
-rw-r--r--include/svx/fmsrccfg.hxx147
-rw-r--r--include/svx/fmsrcimp.hxx390
-rw-r--r--include/svx/fmtools.hxx225
-rw-r--r--include/svx/fmview.hxx164
-rw-r--r--include/svx/fntctl.hxx58
-rw-r--r--include/svx/fntctrl.hxx97
-rw-r--r--include/svx/fntszctl.hxx58
-rw-r--r--include/svx/fontlb.hxx105
-rw-r--r--include/svx/fontwork.hxx182
-rw-r--r--include/svx/fontworkbar.hxx55
-rw-r--r--include/svx/fontworkgallery.hxx124
-rw-r--r--include/svx/formatpaintbrushctrl.hxx67
-rw-r--r--include/svx/framebordertype.hxx58
-rw-r--r--include/svx/framelink.hxx699
-rw-r--r--include/svx/framelinkarray.hxx479
-rw-r--r--include/svx/frmdirlbox.hxx97
-rw-r--r--include/svx/frmsel.hxx202
-rw-r--r--include/svx/galbrws.hxx89
-rw-r--r--include/svx/galctrl.hxx167
-rw-r--r--include/svx/gallery.hxx120
-rw-r--r--include/svx/gallery1.hxx171
-rw-r--r--include/svx/galmisc.hxx223
-rw-r--r--include/svx/galtheme.hxx225
-rw-r--r--include/svx/globl3d.hxx42
-rw-r--r--include/svx/grafctrl.hxx183
-rw-r--r--include/svx/graphctl.hxx160
-rw-r--r--include/svx/graphichelper.hxx40
-rw-r--r--include/svx/grfcrop.hxx74
-rw-r--r--include/svx/grfflt.hxx61
-rw-r--r--include/svx/gridctrl.hxx606
-rw-r--r--include/svx/hdft.hxx127
-rw-r--r--include/svx/helperhittest3d.hxx102
-rw-r--r--include/svx/hlnkitem.hxx103
-rw-r--r--include/svx/hyperdlg.hxx49
-rw-r--r--include/svx/ifaceids.hxx38
-rw-r--r--include/svx/imapdlg.hxx180
-rw-r--r--include/svx/insctrl.hxx51
-rw-r--r--include/svx/ipolypolygoneditorcontroller.hxx72
-rw-r--r--include/svx/itemwin.hxx186
-rw-r--r--include/svx/itextprovider.hxx42
-rw-r--r--include/svx/langbox.hxx93
-rw-r--r--include/svx/lathe3d.hxx114
-rw-r--r--include/svx/layctrl.hxx69
-rw-r--r--include/svx/lboxctrl.hxx77
-rw-r--r--include/svx/linectrl.hxx168
-rw-r--r--include/svx/linkwarn.hxx47
-rw-r--r--include/svx/measctrl.hxx59
-rw-r--r--include/svx/modctrl.hxx59
-rw-r--r--include/svx/msdffdef.hxx1184
-rw-r--r--include/svx/numfmtsh.hxx229
-rw-r--r--include/svx/numinf.hxx87
-rw-r--r--include/svx/numvset.hxx117
-rw-r--r--include/svx/obj3d.hxx319
-rw-r--r--include/svx/objfac3d.hxx50
-rw-r--r--include/svx/ofaitem.hxx78
-rw-r--r--include/svx/optgenrl.hxx42
-rw-r--r--include/svx/optgrid.hxx170
-rw-r--r--include/svx/orienthelper.hxx121
-rw-r--r--include/svx/pagectrl.hxx164
-rw-r--r--include/svx/pageitem.hxx134
-rw-r--r--include/svx/paraprev.hxx102
-rw-r--r--include/svx/passwd.hxx71
-rw-r--r--include/svx/pfiledlg.hxx51
-rw-r--r--include/svx/polygn3d.hxx72
-rw-r--r--include/svx/polypolygoneditor.hxx68
-rw-r--r--include/svx/polysc3d.hxx45
-rw-r--r--include/svx/postattr.hxx122
-rw-r--r--include/svx/prtqry.hxx34
-rw-r--r--include/svx/pszctrl.hxx51
-rw-r--r--include/svx/rectenum.hxx40
-rw-r--r--include/svx/relfld.hxx55
-rw-r--r--include/svx/rotmodit.hxx62
-rw-r--r--include/svx/rubydialog.hxx177
-rw-r--r--include/svx/ruler.hxx259
-rw-r--r--include/svx/rulritem.hxx278
-rw-r--r--include/svx/scene3d.hxx239
-rw-r--r--include/svx/sdangitm.hxx49
-rw-r--r--include/svx/sdasaitm.hxx71
-rw-r--r--include/svx/sdasitm.hxx132
-rw-r--r--include/svx/sderitm.hxx36
-rw-r--r--include/svx/sdgcoitm.hxx80
-rw-r--r--include/svx/sdgcpitm.hxx48
-rw-r--r--include/svx/sdggaitm.hxx49
-rw-r--r--include/svx/sdginitm.hxx46
-rw-r--r--include/svx/sdgluitm.hxx63
-rw-r--r--include/svx/sdgmoitm.hxx56
-rw-r--r--include/svx/sdgtritm.hxx45
-rw-r--r--include/svx/sdmetitm.hxx51
-rw-r--r--include/svx/sdooitm.hxx48
-rw-r--r--include/svx/sdprcitm.hxx65
-rw-r--r--include/svx/sdr/animation/animationstate.hxx75
-rw-r--r--include/svx/sdr/animation/objectanimator.hxx49
-rw-r--r--include/svx/sdr/animation/scheduler.hxx148
-rw-r--r--include/svx/sdr/attribute/sdrfilltextattribute.hxx65
-rw-r--r--include/svx/sdr/attribute/sdrformtextattribute.hxx83
-rw-r--r--include/svx/sdr/attribute/sdrformtextoutlineattribute.hxx74
-rw-r--r--include/svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx69
-rw-r--r--include/svx/sdr/attribute/sdrlineshadowtextattribute.hxx67
-rw-r--r--include/svx/sdr/attribute/sdrshadowtextattribute.hxx64
-rw-r--r--include/svx/sdr/attribute/sdrtextattribute.hxx122
-rw-r--r--include/svx/sdr/contact/displayinfo.hxx107
-rw-r--r--include/svx/sdr/contact/objectcontact.hxx221
-rw-r--r--include/svx/sdr/contact/objectcontactofobjlistpainter.hxx145
-rw-r--r--include/svx/sdr/contact/objectcontactofpageview.hxx144
-rw-r--r--include/svx/sdr/contact/viewcontact.hxx168
-rw-r--r--include/svx/sdr/contact/viewcontactofe3d.hxx109
-rw-r--r--include/svx/sdr/contact/viewcontactofe3dcube.hxx61
-rw-r--r--include/svx/sdr/contact/viewcontactofe3dextrude.hxx61
-rw-r--r--include/svx/sdr/contact/viewcontactofe3dlathe.hxx61
-rw-r--r--include/svx/sdr/contact/viewcontactofe3dpolygon.hxx61
-rw-r--r--include/svx/sdr/contact/viewcontactofe3dscene.hxx114
-rw-r--r--include/svx/sdr/contact/viewcontactofe3dsphere.hxx61
-rw-r--r--include/svx/sdr/contact/viewcontactofgraphic.hxx86
-rw-r--r--include/svx/sdr/contact/viewcontactofgroup.hxx67
-rw-r--r--include/svx/sdr/contact/viewcontactofmasterpagedescriptor.hxx77
-rw-r--r--include/svx/sdr/contact/viewcontactofpageobj.hxx68
-rw-r--r--include/svx/sdr/contact/viewcontactofsdrcaptionobj.hxx62
-rw-r--r--include/svx/sdr/contact/viewcontactofsdrcircobj.hxx62
-rw-r--r--include/svx/sdr/contact/viewcontactofsdredgeobj.hxx62
-rw-r--r--include/svx/sdr/contact/viewcontactofsdrmeasureobj.hxx62
-rw-r--r--include/svx/sdr/contact/viewcontactofsdrmediaobj.hxx83
-rw-r--r--include/svx/sdr/contact/viewcontactofsdrobj.hxx96
-rw-r--r--include/svx/sdr/contact/viewcontactofsdrobjcustomshape.hxx65
-rw-r--r--include/svx/sdr/contact/viewcontactofsdrole2obj.hxx77
-rw-r--r--include/svx/sdr/contact/viewcontactofsdrpage.hxx303
-rw-r--r--include/svx/sdr/contact/viewcontactofsdrpathobj.hxx62
-rw-r--r--include/svx/sdr/contact/viewcontactofsdrrectobj.hxx62
-rw-r--r--include/svx/sdr/contact/viewcontactoftextobj.hxx57
-rw-r--r--include/svx/sdr/contact/viewcontactofunocontrol.hxx92
-rw-r--r--include/svx/sdr/contact/viewcontactofvirtobj.hxx62
-rw-r--r--include/svx/sdr/contact/viewobjectcontact.hxx147
-rw-r--r--include/svx/sdr/contact/viewobjectcontactofe3d.hxx74
-rw-r--r--include/svx/sdr/contact/viewobjectcontactofe3dscene.hxx54
-rw-r--r--include/svx/sdr/contact/viewobjectcontactofgraphic.hxx73
-rw-r--r--include/svx/sdr/contact/viewobjectcontactofgroup.hxx54
-rw-r--r--include/svx/sdr/contact/viewobjectcontactofmasterpagedescriptor.hxx57
-rw-r--r--include/svx/sdr/contact/viewobjectcontactofpageobj.hxx63
-rw-r--r--include/svx/sdr/contact/viewobjectcontactofsdrmediaobj.hxx66
-rw-r--r--include/svx/sdr/contact/viewobjectcontactofsdrobj.hxx62
-rw-r--r--include/svx/sdr/contact/viewobjectcontactofsdrole2obj.hxx54
-rw-r--r--include/svx/sdr/contact/viewobjectcontactofsdrpage.hxx238
-rw-r--r--include/svx/sdr/contact/viewobjectcontactofunocontrol.hxx131
-rw-r--r--include/svx/sdr/contact/viewobjectcontactredirector.hxx66
-rw-r--r--include/svx/sdr/event/eventhandler.hxx132
-rw-r--r--include/svx/sdr/overlay/overlayanimatedbitmapex.hxx92
-rw-r--r--include/svx/sdr/overlay/overlaybitmapex.hxx66
-rw-r--r--include/svx/sdr/overlay/overlaycrosshair.hxx51
-rw-r--r--include/svx/sdr/overlay/overlayhatchrect.hxx71
-rw-r--r--include/svx/sdr/overlay/overlayhelpline.hxx60
-rw-r--r--include/svx/sdr/overlay/overlayline.hxx59
-rw-r--r--include/svx/sdr/overlay/overlaymanager.hxx151
-rw-r--r--include/svx/sdr/overlay/overlaymanagerbuffered.hxx98
-rw-r--r--include/svx/sdr/overlay/overlayobject.hxx196
-rw-r--r--include/svx/sdr/overlay/overlayobjectcell.hxx62
-rw-r--r--include/svx/sdr/overlay/overlayobjectlist.hxx78
-rw-r--r--include/svx/sdr/overlay/overlaypolypolygon.hxx58
-rw-r--r--include/svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx62
-rw-r--r--include/svx/sdr/overlay/overlayrollingrectangle.hxx75
-rw-r--r--include/svx/sdr/overlay/overlayselection.hxx87
-rw-r--r--include/svx/sdr/overlay/overlaytools.hxx270
-rw-r--r--include/svx/sdr/overlay/overlaytriangle.hxx62
-rw-r--r--include/svx/sdr/primitive2d/primitiveFactory2d.hxx76
-rw-r--r--include/svx/sdr/primitive2d/sdrattributecreator.hxx133
-rw-r--r--include/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx79
-rw-r--r--include/svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx68
-rw-r--r--include/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx89
-rw-r--r--include/svx/sdr/primitive2d/sdrdecompositiontools.hxx80
-rw-r--r--include/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx112
-rw-r--r--include/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx76
-rw-r--r--include/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx125
-rw-r--r--include/svx/sdr/primitive2d/sdrole2primitive2d.hxx70
-rw-r--r--include/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx80
-rw-r--r--include/svx/sdr/primitive2d/sdrpathprimitive2d.hxx72
-rw-r--r--include/svx/sdr/primitive2d/sdrprimitivetools.hxx49
-rw-r--r--include/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx81
-rw-r--r--include/svx/sdr/primitive2d/sdrtextprimitive2d.hxx338
-rw-r--r--include/svx/sdr/primitive2d/svx_primitivetypes2d.hxx56
-rw-r--r--include/svx/sdr/primitive3d/sdrattributecreator3d.hxx55
-rw-r--r--include/svx/sdr/properties/attributeproperties.hxx96
-rw-r--r--include/svx/sdr/properties/captionproperties.hxx67
-rw-r--r--include/svx/sdr/properties/circleproperties.hxx67
-rw-r--r--include/svx/sdr/properties/connectorproperties.hxx63
-rw-r--r--include/svx/sdr/properties/customshapeproperties.hxx86
-rw-r--r--include/svx/sdr/properties/defaultproperties.hxx104
-rw-r--r--include/svx/sdr/properties/e3dcompoundproperties.hxx71
-rw-r--r--include/svx/sdr/properties/e3dextrudeproperties.hxx58
-rw-r--r--include/svx/sdr/properties/e3dlatheproperties.hxx58
-rw-r--r--include/svx/sdr/properties/e3dproperties.hxx64
-rw-r--r--include/svx/sdr/properties/e3dsceneproperties.hxx88
-rw-r--r--include/svx/sdr/properties/e3dsphereproperties.hxx57
-rw-r--r--include/svx/sdr/properties/emptyproperties.hxx96
-rw-r--r--include/svx/sdr/properties/graphicproperties.hxx67
-rw-r--r--include/svx/sdr/properties/groupproperties.hxx121
-rw-r--r--include/svx/sdr/properties/itemsettools.hxx68
-rw-r--r--include/svx/sdr/properties/measureproperties.hxx67
-rw-r--r--include/svx/sdr/properties/oleproperties.hxx58
-rw-r--r--include/svx/sdr/properties/pageproperties.hxx73
-rw-r--r--include/svx/sdr/properties/properties.hxx193
-rw-r--r--include/svx/sdr/properties/rectangleproperties.hxx61
-rw-r--r--include/svx/sdr/properties/textproperties.hxx93
-rw-r--r--include/svx/sdr/table/tabledesign.hxx48
-rw-r--r--include/svx/sdrhittesthelper.hxx68
-rw-r--r--include/svx/sdrmasterpagedescriptor.hxx94
-rw-r--r--include/svx/sdrobjectfilter.hxx51
-rw-r--r--include/svx/sdrobjectuser.hxx56
-rw-r--r--include/svx/sdrpageuser.hxx56
-rw-r--r--include/svx/sdrpagewindow.hxx131
-rw-r--r--include/svx/sdrpaintwindow.hxx151
-rw-r--r--include/svx/sdshcitm.hxx36
-rw-r--r--include/svx/sdshitm.hxx36
-rw-r--r--include/svx/sdshtitm.hxx36
-rw-r--r--include/svx/sdsxyitm.hxx45
-rw-r--r--include/svx/sdtaaitm.hxx41
-rw-r--r--include/svx/sdtacitm.hxx34
-rw-r--r--include/svx/sdtaditm.hxx55
-rw-r--r--include/svx/sdtagitm.hxx45
-rw-r--r--include/svx/sdtaiitm.hxx39
-rw-r--r--include/svx/sdtaitm.hxx82
-rw-r--r--include/svx/sdtakitm.hxx97
-rw-r--r--include/svx/sdtayitm.hxx38
-rw-r--r--include/svx/sdtcfitm.hxx36
-rw-r--r--include/svx/sdtditm.hxx54
-rw-r--r--include/svx/sdtfchim.hxx47
-rw-r--r--include/svx/sdtfsitm.hxx67
-rw-r--r--include/svx/sdtmfitm.hxx63
-rw-r--r--include/svx/sdynitm.hxx46
-rw-r--r--include/svx/selctrl.hxx46
-rw-r--r--include/svx/selectioncontroller.hxx79
-rw-r--r--include/svx/shapeproperty.hxx51
-rw-r--r--include/svx/shapepropertynotifier.hxx141
-rw-r--r--include/svx/simptabl.hxx157
-rw-r--r--include/svx/sphere3d.hxx80
-rw-r--r--include/svx/srchdlg.hxx282
-rw-r--r--include/svx/stddlg.hxx43
-rw-r--r--include/svx/strarray.hxx40
-rw-r--r--include/svx/subtoolboxcontrol.hxx48
-rw-r--r--include/svx/svdattr.hxx57
-rw-r--r--include/svx/svdattrx.hxx71
-rw-r--r--include/svx/svdcrtv.hxx200
-rw-r--r--include/svx/svddef.hxx306
-rw-r--r--include/svx/svddrag.hxx184
-rw-r--r--include/svx/svddrgmt.hxx320
-rw-r--r--include/svx/svddrgv.hxx302
-rw-r--r--include/svx/svdedtv.hxx450
-rw-r--r--include/svx/svdedxv.hxx292
-rw-r--r--include/svx/svdetc.hxx266
-rw-r--r--include/svx/svdfield.hxx29
-rw-r--r--include/svx/svdglev.hxx111
-rw-r--r--include/svx/svdglob.hxx48
-rw-r--r--include/svx/svdglue.hxx147
-rw-r--r--include/svx/svdhdl.hxx515
-rw-r--r--include/svx/svdhlpln.hxx107
-rw-r--r--include/svx/svditer.hxx79
-rw-r--r--include/svx/svdlayer.hxx171
-rw-r--r--include/svx/svdmark.hxx298
-rw-r--r--include/svx/svdmodel.hxx712
-rw-r--r--include/svx/svdmrkv.hxx500
-rw-r--r--include/svx/svdoashp.hxx263
-rw-r--r--include/svx/svdoattr.hxx83
-rw-r--r--include/svx/svdobj.hxx1135
-rw-r--r--include/svx/svdocapt.hxx161
-rw-r--r--include/svx/svdocirc.hxx146
-rw-r--r--include/svx/svdoedge.hxx434
-rw-r--r--include/svx/svdograf.hxx203
-rw-r--r--include/svx/svdogrp.hxx118
-rw-r--r--include/svx/svdomeas.hxx210
-rw-r--r--include/svx/svdomedia.hxx88
-rw-r--r--include/svx/svdoole2.hxx195
-rw-r--r--include/svx/svdopage.hxx70
-rw-r--r--include/svx/svdopath.hxx193
-rw-r--r--include/svx/svdorect.hxx126
-rw-r--r--include/svx/svdotable.hxx326
-rw-r--r--include/svx/svdotext.hxx595
-rw-r--r--include/svx/svdouno.hxx155
-rw-r--r--include/svx/svdoutl.hxx52
-rw-r--r--include/svx/svdovirt.hxx157
-rw-r--r--include/svx/svdpage.hxx605
-rw-r--r--include/svx/svdpagv.hxx268
-rw-r--r--include/svx/svdpntv.hxx554
-rw-r--r--include/svx/svdpoev.hxx99
-rw-r--r--include/svx/svdpool.hxx54
-rw-r--r--include/svx/svdsnpv.hxx330
-rw-r--r--include/svx/svdsob.hxx117
-rw-r--r--include/svx/svdstr.hrc718
-rw-r--r--include/svx/svdtext.hxx82
-rw-r--r--include/svx/svdtrans.hxx304
-rw-r--r--include/svx/svdtypes.hxx162
-rw-r--r--include/svx/svdundo.hxx879
-rw-r--r--include/svx/svdview.hxx324
-rw-r--r--include/svx/svdviter.hxx98
-rw-r--r--include/svx/svdxcgv.hxx133
-rw-r--r--include/svx/svx3ditems.hxx371
-rw-r--r--include/svx/svxcommands.h154
-rw-r--r--include/svx/svxdlg.hxx499
-rw-r--r--include/svx/svxdllapi.h34
-rw-r--r--include/svx/svxerr.hxx96
-rw-r--r--include/svx/svxgrahicitem.hxx48
-rw-r--r--include/svx/svxids.hrc950
-rw-r--r--include/svx/svxitems.hrc117
-rw-r--r--include/svx/swframeexample.hxx95
-rw-r--r--include/svx/swframeposstrings.hxx87
-rw-r--r--include/svx/swframevalidation.hxx80
-rw-r--r--include/svx/sxallitm.hxx63
-rw-r--r--include/svx/sxcaitm.hxx52
-rw-r--r--include/svx/sxcecitm.hxx87
-rw-r--r--include/svx/sxcgitm.hxx37
-rw-r--r--include/svx/sxciaitm.hxx45
-rw-r--r--include/svx/sxcikitm.hxx49
-rw-r--r--include/svx/sxcllitm.hxx52
-rw-r--r--include/svx/sxctitm.hxx46
-rw-r--r--include/svx/sxekitm.hxx52
-rw-r--r--include/svx/sxelditm.hxx58
-rw-r--r--include/svx/sxenditm.hxx72
-rw-r--r--include/svx/sxfiitm.hxx48
-rw-r--r--include/svx/sxlayitm.hxx50
-rw-r--r--include/svx/sxlogitm.hxx45
-rw-r--r--include/svx/sxmbritm.hxx40
-rw-r--r--include/svx/sxmfsitm.hxx36
-rw-r--r--include/svx/sxmkitm.hxx49
-rw-r--r--include/svx/sxmlhitm.hxx79
-rw-r--r--include/svx/sxmoitm.hxx35
-rw-r--r--include/svx/sxmovitm.hxx45
-rw-r--r--include/svx/sxmsitm.hxx37
-rw-r--r--include/svx/sxmspitm.hxx45
-rw-r--r--include/svx/sxmsuitm.hxx34
-rw-r--r--include/svx/sxmtaitm.hxx45
-rw-r--r--include/svx/sxmtfitm.hxx52
-rw-r--r--include/svx/sxmtpitm.hxx71
-rw-r--r--include/svx/sxmtritm.hxx43
-rw-r--r--include/svx/sxmuitm.hxx48
-rw-r--r--include/svx/sxoneitm.hxx63
-rw-r--r--include/svx/sxonitm.hxx38
-rw-r--r--include/svx/sxopitm.hxx42
-rw-r--r--include/svx/sxraitm.hxx36
-rw-r--r--include/svx/sxreaitm.hxx48
-rw-r--r--include/svx/sxreoitm.hxx48
-rw-r--r--include/svx/sxroaitm.hxx36
-rw-r--r--include/svx/sxrooitm.hxx36
-rw-r--r--include/svx/sxsaitm.hxx36
-rw-r--r--include/svx/sxsalitm.hxx45
-rw-r--r--include/svx/sxsiitm.hxx37
-rw-r--r--include/svx/sxsoitm.hxx45
-rw-r--r--include/svx/sxtraitm.hxx63
-rw-r--r--include/svx/tabarea.hxx52
-rw-r--r--include/svx/tabline.hxx53
-rw-r--r--include/svx/tbcontrl.hxx389
-rw-r--r--include/svx/tbxalign.hxx48
-rw-r--r--include/svx/tbxcolor.hxx64
-rw-r--r--include/svx/tbxcolorupdate.hxx76
-rw-r--r--include/svx/tbxctl.hxx55
-rw-r--r--include/svx/tbxcustomshapes.hxx61
-rw-r--r--include/svx/tbxdraw.hxx66
-rw-r--r--include/svx/txencbox.hxx107
-rw-r--r--include/svx/txenctab.hxx44
-rw-r--r--include/svx/ucsubset.hrc255
-rw-r--r--include/svx/ucsubset.hxx80
-rw-r--r--include/svx/unoapi.hxx97
-rw-r--r--include/svx/unofill.hxx37
-rw-r--r--include/svx/unomaster.hxx62
-rw-r--r--include/svx/unomid.hxx108
-rw-r--r--include/svx/unomod.hxx62
-rw-r--r--include/svx/unomodel.hxx101
-rw-r--r--include/svx/unopage.hxx144
-rw-r--r--include/svx/unopool.hxx90
-rw-r--r--include/svx/unoprov.hxx122
-rw-r--r--include/svx/unoshape.hxx868
-rw-r--r--include/svx/unoshcol.hxx92
-rw-r--r--include/svx/unoshprp.hxx537
-rw-r--r--include/svx/unoshtxt.hxx91
-rw-r--r--include/svx/verttexttbxctrl.hxx57
-rw-r--r--include/svx/view3d.hxx266
-rw-r--r--include/svx/viewlayoutitem.hxx55
-rw-r--r--include/svx/viewpt3d.hxx116
-rw-r--r--include/svx/wrapfield.hxx51
-rw-r--r--include/svx/xattr.hxx38
-rw-r--r--include/svx/xbitmap.hxx66
-rw-r--r--include/svx/xbtmpit.hxx75
-rw-r--r--include/svx/xcolit.hxx61
-rw-r--r--include/svx/xdash.hxx71
-rw-r--r--include/svx/xdef.hxx97
-rw-r--r--include/svx/xenum.hxx53
-rw-r--r--include/svx/xexch.hxx59
-rw-r--r--include/svx/xfillit.hxx42
-rw-r--r--include/svx/xfillit0.hxx57
-rw-r--r--include/svx/xflasit.hxx48
-rw-r--r--include/svx/xflbckit.hxx52
-rw-r--r--include/svx/xflbmpit.hxx48
-rw-r--r--include/svx/xflbmsli.hxx44
-rw-r--r--include/svx/xflbmsxy.hxx70
-rw-r--r--include/svx/xflbmtit.hxx44
-rw-r--r--include/svx/xflboxy.hxx60
-rw-r--r--include/svx/xflbstit.hxx44
-rw-r--r--include/svx/xflbtoxy.hxx60
-rw-r--r--include/svx/xflclit.hxx56
-rw-r--r--include/svx/xflftrit.hxx62
-rw-r--r--include/svx/xflgrit.hxx67
-rw-r--r--include/svx/xflhtit.hxx67
-rw-r--r--include/svx/xfltrit.hxx48
-rw-r--r--include/svx/xftadit.hxx49
-rw-r--r--include/svx/xftdiit.hxx44
-rw-r--r--include/svx/xftmrit.hxx44
-rw-r--r--include/svx/xftouit.hxx43
-rw-r--r--include/svx/xftsfit.hxx48
-rw-r--r--include/svx/xftshcit.hxx46
-rw-r--r--include/svx/xftshit.hxx49
-rw-r--r--include/svx/xftshtit.hxx43
-rw-r--r--include/svx/xftshxy.hxx60
-rw-r--r--include/svx/xftstit.hxx44
-rw-r--r--include/svx/xgrad.hxx83
-rw-r--r--include/svx/xgrscit.hxx48
-rw-r--r--include/svx/xhatch.hxx59
-rw-r--r--include/svx/xit.hxx76
-rw-r--r--include/svx/xlineit.hxx46
-rw-r--r--include/svx/xlineit0.hxx52
-rw-r--r--include/svx/xlinjoit.hxx54
-rw-r--r--include/svx/xlnasit.hxx49
-rw-r--r--include/svx/xlncapit.hxx55
-rw-r--r--include/svx/xlnclit.hxx52
-rw-r--r--include/svx/xlndsit.hxx69
-rw-r--r--include/svx/xlnedcit.hxx49
-rw-r--r--include/svx/xlnedit.hxx65
-rw-r--r--include/svx/xlnedwit.hxx52
-rw-r--r--include/svx/xlnstcit.hxx49
-rw-r--r--include/svx/xlnstit.hxx65
-rw-r--r--include/svx/xlnstwit.hxx52
-rw-r--r--include/svx/xlntrit.hxx48
-rw-r--r--include/svx/xlnwtit.hxx49
-rw-r--r--include/svx/xmleohlp.hxx148
-rw-r--r--include/svx/xmlexchg.hxx95
-rw-r--r--include/svx/xmlgrhlp.hxx158
-rw-r--r--include/svx/xmlsecctrl.hxx51
-rw-r--r--include/svx/xoutbmp.hxx73
-rw-r--r--include/svx/xpoly.hxx181
-rw-r--r--include/svx/xpool.hxx54
-rw-r--r--include/svx/xsetit.hxx45
-rw-r--r--include/svx/xsflclit.hxx50
-rw-r--r--include/svx/xtable.hxx501
-rw-r--r--include/svx/xtextit.hxx41
-rw-r--r--include/svx/xtextit0.hxx66
-rw-r--r--include/svx/zoom_def.hxx29
-rw-r--r--include/svx/zoomctrl.hxx48
-rw-r--r--include/svx/zoomsliderctrl.hxx53
-rw-r--r--include/svx/zoomslideritem.hxx60
-rw-r--r--include/test/beans/xpropertyset.hxx70
-rw-r--r--include/test/bootstrapfixture.hxx56
-rw-r--r--include/test/container/xelementaccess.hxx35
-rw-r--r--include/test/container/xindexaccess.hxx36
-rw-r--r--include/test/container/xnamecontainer.hxx38
-rw-r--r--include/test/container/xnamed.hxx35
-rw-r--r--include/test/container/xnamereplace.hxx39
-rw-r--r--include/test/sheet/cellproperties.hxx32
-rw-r--r--include/test/sheet/datapilotfield.hxx34
-rw-r--r--include/test/sheet/tableautoformatfield.hxx30
-rw-r--r--include/test/sheet/xcellrangedata.hxx32
-rw-r--r--include/test/sheet/xcellrangereferrer.hxx36
-rw-r--r--include/test/sheet/xcellrangesquery.hxx40
-rw-r--r--include/test/sheet/xdatabaserange.hxx37
-rw-r--r--include/test/sheet/xdatapilotdescriptor.hxx50
-rw-r--r--include/test/sheet/xdatapilotfieldgrouping.hxx32
-rw-r--r--include/test/sheet/xdatapilottable.hxx36
-rw-r--r--include/test/sheet/xdatapilottable2.hxx55
-rw-r--r--include/test/sheet/xgoalseek.hxx31
-rw-r--r--include/test/sheet/xnamedrange.hxx58
-rw-r--r--include/test/sheet/xnamedranges.hxx65
-rw-r--r--include/test/sheet/xprintareas.hxx59
-rw-r--r--include/test/sheet/xsheetannotation.hxx60
-rw-r--r--include/test/sheet/xsheetannotations.hxx56
-rw-r--r--include/test/sheet/xsheetoutline.hxx57
-rw-r--r--include/test/sheet/xspreadsheetdocument.hxx35
-rw-r--r--include/test/sheet/xspreadsheets2.hxx84
-rw-r--r--include/test/testdllapi.hxx33
-rw-r--r--include/test/text/xtext.hxx39
-rw-r--r--include/test/text/xtextcontent.hxx38
-rw-r--r--include/test/text/xtextfield.hxx31
-rw-r--r--include/test/unoapi_test.hxx41
-rw-r--r--include/test/util/xreplaceable.hxx38
-rw-r--r--include/test/util/xsearchable.hxx37
-rw-r--r--include/test/xmldiff.hxx16
-rw-r--r--include/toolkit/awt/animatedimagespeer.hxx99
-rw-r--r--include/toolkit/awt/scrollabledialog.hxx83
-rw-r--r--include/toolkit/awt/vclxaccessiblecomponent.hxx155
-rw-r--r--include/toolkit/awt/vclxbitmap.hxx80
-rw-r--r--include/toolkit/awt/vclxcontainer.hxx76
-rw-r--r--include/toolkit/awt/vclxdevice.hxx118
-rw-r--r--include/toolkit/awt/vclxfont.hxx89
-rw-r--r--include/toolkit/awt/vclxgraphics.hxx130
-rw-r--r--include/toolkit/awt/vclxmenu.hxx184
-rw-r--r--include/toolkit/awt/vclxpointer.hxx78
-rw-r--r--include/toolkit/awt/vclxprinter.hxx219
-rw-r--r--include/toolkit/awt/vclxregion.hxx89
-rw-r--r--include/toolkit/awt/vclxspinbutton.hxx93
-rw-r--r--include/toolkit/awt/vclxsystemdependentwindow.hxx60
-rw-r--r--include/toolkit/awt/vclxtabpagecontainer.hxx81
-rw-r--r--include/toolkit/awt/vclxtabpagemodel.hxx73
-rw-r--r--include/toolkit/awt/vclxtoolkit.hxx206
-rw-r--r--include/toolkit/awt/vclxtopwindow.hxx114
-rw-r--r--include/toolkit/awt/vclxwindow.hxx235
-rw-r--r--include/toolkit/awt/vclxwindows.hxx1242
-rw-r--r--include/toolkit/awt/xsimpleanimation.hxx70
-rw-r--r--include/toolkit/awt/xthrobber.hxx73
-rw-r--r--include/toolkit/controls/accessiblecontrolcontext.hxx129
-rw-r--r--include/toolkit/controls/animatedimages.hxx138
-rw-r--r--include/toolkit/controls/controlmodelcontainerbase.hxx271
-rw-r--r--include/toolkit/controls/dialogcontrol.hxx268
-rw-r--r--include/toolkit/controls/eventcontainer.hxx131
-rw-r--r--include/toolkit/controls/formattedcontrol.hxx124
-rw-r--r--include/toolkit/controls/geometrycontrolmodel.hxx262
-rw-r--r--include/toolkit/controls/geometrycontrolmodel_impl.hxx82
-rw-r--r--include/toolkit/controls/roadmapcontrol.hxx200
-rw-r--r--include/toolkit/controls/roadmapentry.hxx83
-rw-r--r--include/toolkit/controls/spinningprogress.hxx62
-rw-r--r--include/toolkit/controls/stdtabcontroller.hxx87
-rw-r--r--include/toolkit/controls/stdtabcontrollermodel.hxx138
-rw-r--r--include/toolkit/controls/tabpagecontainer.hxx139
-rw-r--r--include/toolkit/controls/tabpagemodel.hxx89
-rw-r--r--include/toolkit/controls/tkscrollbar.hxx118
-rw-r--r--include/toolkit/controls/tksimpleanimation.hxx95
-rw-r--r--include/toolkit/controls/tkspinbutton.hxx121
-rw-r--r--include/toolkit/controls/tkthrobber.hxx103
-rw-r--r--include/toolkit/controls/unocontrol.hxx237
-rw-r--r--include/toolkit/controls/unocontrolbase.hxx62
-rw-r--r--include/toolkit/controls/unocontrolcontainer.hxx160
-rw-r--r--include/toolkit/controls/unocontrolcontainermodel.hxx59
-rw-r--r--include/toolkit/controls/unocontrolmodel.hxx186
-rw-r--r--include/toolkit/controls/unocontrols.hxx1518
-rw-r--r--include/toolkit/dllapi.h34
-rw-r--r--include/toolkit/helper/accessibilityclient.hxx66
-rw-r--r--include/toolkit/helper/accessiblefactory.hxx134
-rw-r--r--include/toolkit/helper/convert.hxx61
-rw-r--r--include/toolkit/helper/emptyfontdescriptor.hxx49
-rw-r--r--include/toolkit/helper/externallock.hxx38
-rw-r--r--include/toolkit/helper/formpdfexport.hxx55
-rw-r--r--include/toolkit/helper/imagealign.hxx53
-rw-r--r--include/toolkit/helper/listenermultiplexer.hxx268
-rw-r--r--include/toolkit/helper/macros.hxx305
-rw-r--r--include/toolkit/helper/mutexandbroadcasthelper.hxx44
-rw-r--r--include/toolkit/helper/mutexhelper.hxx44
-rw-r--r--include/toolkit/helper/property.hxx254
-rw-r--r--include/toolkit/helper/servicenames.hxx118
-rw-r--r--include/toolkit/helper/tkresmgr.hxx71
-rw-r--r--include/toolkit/helper/unopropertyarrayhelper.hxx58
-rw-r--r--include/toolkit/helper/unowrapper.hxx86
-rw-r--r--include/toolkit/helper/vclunohelper.hxx155
-rw-r--r--include/toolkit/unohlp.hxx3
-rw-r--r--include/tools/StringListResource.hxx50
-rw-r--r--include/tools/appendunixshellword.hxx47
-rw-r--r--include/tools/b3dtrans.hxx259
-rw-r--r--include/tools/bigint.hxx311
-rw-r--r--include/tools/cachestr.hxx67
-rw-r--r--include/tools/color.hxx215
-rw-r--r--include/tools/config.hxx81
-rw-r--r--include/tools/contnr.hxx33
-rw-r--r--include/tools/date.hxx152
-rw-r--r--include/tools/datetime.hxx112
-rw-r--r--include/tools/debug.hxx496
-rw-r--r--include/tools/diagnose_ex.h186
-rw-r--r--include/tools/errcode.hxx313
-rw-r--r--include/tools/errinf.hxx181
-rw-r--r--include/tools/extendapplicationenvironment.hxx35
-rw-r--r--include/tools/fldunit.hxx29
-rw-r--r--include/tools/fontenum.hxx125
-rw-r--r--include/tools/fract.hxx143
-rw-r--r--include/tools/gen.hxx692
-rw-r--r--include/tools/getprocessworkingdir.hxx40
-rw-r--r--include/tools/globname.hxx108
-rw-r--r--include/tools/helpers.hxx29
-rw-r--r--include/tools/inetmime.hxx1261
-rw-r--r--include/tools/inetmsg.hxx518
-rw-r--r--include/tools/inetstrm.hxx222
-rw-r--r--include/tools/line.hxx59
-rw-r--r--include/tools/lineend.hxx33
-rw-r--r--include/tools/link.hxx144
-rw-r--r--include/tools/mapunit.hxx30
-rw-r--r--include/tools/mempool.hxx106
-rw-r--r--include/tools/multisel.hxx186
-rw-r--r--include/tools/pathutils.hxx87
-rw-r--r--include/tools/poly.hxx285
-rw-r--r--include/tools/postsys.h234
-rw-r--r--include/tools/presys.h34
-rw-r--r--include/tools/pstm.hxx245
-rw-r--r--include/tools/rc.h216
-rw-r--r--include/tools/rc.hxx96
-rw-r--r--include/tools/rcid.h125
-rw-r--r--include/tools/ref.hxx256
-rw-r--r--include/tools/resary.hxx61
-rw-r--r--include/tools/resid.hxx156
-rw-r--r--include/tools/resmgr.hxx223
-rw-r--r--include/tools/rtti.hxx125
-rw-r--r--include/tools/shl.hxx88
-rw-r--r--include/tools/simplerm.hxx83
-rw-r--r--include/tools/solar.h154
-rw-r--r--include/tools/solarmutex.hxx38
-rw-r--r--include/tools/stream.hxx779
-rw-r--r--include/tools/string.hxx411
-rw-r--r--include/tools/svborder.hxx98
-rw-r--r--include/tools/tempfile.hxx66
-rw-r--r--include/tools/tenccvt.hxx58
-rw-r--r--include/tools/time.hxx136
-rw-r--r--include/tools/tools.h32
-rw-r--r--include/tools/toolsdllapi.h34
-rw-r--r--include/tools/unqidx.hxx73
-rw-r--r--include/tools/urlobj.hxx1783
-rw-r--r--include/tools/vcompat.hxx56
-rw-r--r--include/tools/vector2d.hxx107
-rw-r--r--include/tools/weakbase.h146
-rw-r--r--include/tools/weakbase.hxx176
-rw-r--r--include/tools/wintypes.hxx325
-rw-r--r--include/tools/wldcrd.hxx62
-rw-r--r--include/tools/zcodec.hxx110
-rw-r--r--include/touch/touch.h44
-rw-r--r--include/tubes/collaboration.hxx50
-rw-r--r--include/tubes/conference.hxx83
-rw-r--r--include/tubes/constants.h54
-rw-r--r--include/tubes/file-transfer-helper.h125
-rw-r--r--include/tubes/manager.hxx155
-rw-r--r--include/tubes/tubesdllapi.h16
-rw-r--r--include/ucbhelper/activedatasink.hxx69
-rw-r--r--include/ucbhelper/activedatastreamer.hxx64
-rw-r--r--include/ucbhelper/cancelcommandexecution.hxx104
-rw-r--r--include/ucbhelper/commandenvironment.hxx94
-rw-r--r--include/ucbhelper/content.hxx719
-rw-r--r--include/ucbhelper/contenthelper.hxx504
-rw-r--r--include/ucbhelper/contentidentifier.hxx84
-rw-r--r--include/ucbhelper/contentinfo.hxx162
-rw-r--r--include/ucbhelper/fd_inputstream.hxx130
-rw-r--r--include/ucbhelper/fileidentifierconverter.hxx114
-rw-r--r--include/ucbhelper/getcomponentcontext.hxx47
-rw-r--r--include/ucbhelper/interactionrequest.hxx721
-rw-r--r--include/ucbhelper/interceptedinteraction.hxx334
-rw-r--r--include/ucbhelper/macros.hxx761
-rw-r--r--include/ucbhelper/propertyvalueset.hxx275
-rw-r--r--include/ucbhelper/providerhelper.hxx278
-rw-r--r--include/ucbhelper/proxydecider.hxx138
-rw-r--r--include/ucbhelper/registerucb.hxx122
-rw-r--r--include/ucbhelper/resultset.hxx573
-rw-r--r--include/ucbhelper/resultsethelper.hxx204
-rw-r--r--include/ucbhelper/resultsetmetadata.hxx470
-rw-r--r--include/ucbhelper/simpleauthenticationrequest.hxx149
-rw-r--r--include/ucbhelper/simplecertificatevalidationrequest.hxx63
-rw-r--r--include/ucbhelper/simpleinteractionrequest.hxx90
-rw-r--r--include/ucbhelper/simpleioerrorrequest.hxx69
-rw-r--r--include/ucbhelper/simplenameclashresolverequest.hxx77
-rw-r--r--include/ucbhelper/std_inputstream.hxx115
-rw-r--r--include/ucbhelper/std_outputstream.hxx71
-rw-r--r--include/ucbhelper/ucbhelperdllapi.h34
-rw-r--r--include/udm/html/htmlitem.hxx342
-rw-r--r--include/udm/xml/xmlitem.hxx339
-rw-r--r--include/unoidl/detail/dllapi.hxx26
-rw-r--r--include/unoidl/detail/unoidldllapi.hxx26
-rw-r--r--include/unoidl/legacyprovider.hxx48
-rw-r--r--include/unoidl/unoidl.hxx642
-rw-r--r--include/unoidl/unoidlprovider.hxx60
-rw-r--r--include/unotest/bootstrapfixturebase.hxx81
-rw-r--r--include/unotest/detail/unotestdllapi.hxx34
-rw-r--r--include/unotest/filters-test.hxx74
-rw-r--r--include/unotest/gettestargument.hxx39
-rw-r--r--include/unotest/macros_test.hxx40
-rw-r--r--include/unotest/officeconnection.hxx64
-rw-r--r--include/unotest/toabsolutefileurl.hxx39
-rw-r--r--include/unotest/uniquepipename.hxx37
-rw-r--r--include/unotools/accessiblerelationsethelper.hxx153
-rw-r--r--include/unotools/accessiblestatesethelper.hxx161
-rw-r--r--include/unotools/atom.hxx70
-rw-r--r--include/unotools/bootstrap.hxx120
-rw-r--r--include/unotools/calendarwrapper.hxx131
-rw-r--r--include/unotools/caserotate.hxx34
-rw-r--r--include/unotools/charclass.hxx225
-rw-r--r--include/unotools/closeveto.hxx60
-rw-r--r--include/unotools/cmdoptions.hxx167
-rw-r--r--include/unotools/collatorwrapper.hxx74
-rw-r--r--include/unotools/compatibility.hxx240
-rw-r--r--include/unotools/componentresmodule.hxx180
-rw-r--r--include/unotools/configitem.hxx195
-rw-r--r--include/unotools/configmgr.hxx93
-rw-r--r--include/unotools/confignode.hxx325
-rw-r--r--include/unotools/configpaths.hxx170
-rw-r--r--include/unotools/configvaluecontainer.hxx183
-rw-r--r--include/unotools/datetime.hxx59
-rw-r--r--include/unotools/defaultoptions.hxx47
-rw-r--r--include/unotools/desktopterminationobserver.hxx72
-rw-r--r--include/unotools/digitgroupingiterator.hxx198
-rw-r--r--include/unotools/docinfohelper.hxx40
-rw-r--r--include/unotools/dynamicmenuoptions.hxx138
-rw-r--r--include/unotools/eventcfg.hxx113
-rw-r--r--include/unotools/eventlisteneradapter.hxx64
-rw-r--r--include/unotools/extendedsecurityoptions.hxx121
-rw-r--r--include/unotools/fltrcfg.hxx91
-rw-r--r--include/unotools/fontcfg.hxx221
-rw-r--r--include/unotools/fontcvt.hxx73
-rw-r--r--include/unotools/fontdefs.hxx95
-rw-r--r--include/unotools/fontoptions.hxx129
-rw-r--r--include/unotools/historyoptions.hxx204
-rw-r--r--include/unotools/idhelper.hxx199
-rw-r--r--include/unotools/intlwrapper.hxx98
-rw-r--r--include/unotools/itemholderbase.hxx104
-rw-r--r--include/unotools/lingucfg.hxx228
-rw-r--r--include/unotools/linguprops.hxx114
-rw-r--r--include/unotools/localedatawrapper.hxx362
-rw-r--r--include/unotools/localfilehelper.hxx60
-rw-r--r--include/unotools/localisationoptions.hxx136
-rw-r--r--include/unotools/misccfg.hxx57
-rw-r--r--include/unotools/moduleoptions.hxx206
-rw-r--r--include/unotools/nativenumberwrapper.hxx64
-rw-r--r--include/unotools/numberformatcodewrapper.hxx68
-rw-r--r--include/unotools/options.hxx95
-rw-r--r--include/unotools/optionsdlg.hxx47
-rw-r--r--include/unotools/pathoptions.hxx130
-rw-r--r--include/unotools/printwarningoptions.hxx121
-rw-r--r--include/unotools/progresshandlerwrap.hxx50
-rw-r--r--include/unotools/readwritemutexguard.hxx106
-rw-r--r--include/unotools/saveopt.hxx129
-rw-r--r--include/unotools/searchopt.hxx111
-rw-r--r--include/unotools/securityoptions.hxx261
-rw-r--r--include/unotools/sharedunocomponent.hxx364
-rw-r--r--include/unotools/streamhelper.hxx78
-rw-r--r--include/unotools/streamsection.hxx78
-rw-r--r--include/unotools/streamwrap.hxx173
-rw-r--r--include/unotools/syslocale.hxx79
-rw-r--r--include/unotools/syslocaleoptions.hxx177
-rw-r--r--include/unotools/tempfile.hxx154
-rw-r--r--include/unotools/textsearch.hxx186
-rw-r--r--include/unotools/transliterationwrapper.hxx133
-rw-r--r--include/unotools/ucbhelper.hxx76
-rw-r--r--include/unotools/ucblockbytes.hxx198
-rw-r--r--include/unotools/ucbstreamhelper.hxx73
-rw-r--r--include/unotools/unotoolsdllapi.h34
-rw-r--r--include/unotools/useroptions.hxx97
-rw-r--r--include/unotools/viewoptions.hxx318
-rw-r--r--include/unotools/xmlaccelcfg.hxx110
-rw-r--r--include/vbahelper/helperdecl.hxx49
-rw-r--r--include/vbahelper/vbaaccesshelper.hxx73
-rw-r--r--include/vbahelper/vbaapplicationbase.hxx69
-rw-r--r--include/vbahelper/vbacollectionimpl.hxx352
-rw-r--r--include/vbahelper/vbadialogbase.hxx45
-rw-r--r--include/vbahelper/vbadialogsbase.hxx45
-rw-r--r--include/vbahelper/vbadllapi.h34
-rw-r--r--include/vbahelper/vbadocumentbase.hxx65
-rw-r--r--include/vbahelper/vbadocumentsbase.hxx60
-rw-r--r--include/vbahelper/vbaeventshelperbase.hxx184
-rw-r--r--include/vbahelper/vbafontbase.hxx96
-rw-r--r--include/vbahelper/vbaglobalbase.hxx45
-rw-r--r--include/vbahelper/vbahelper.hxx256
-rw-r--r--include/vbahelper/vbahelperinterface.hxx185
-rw-r--r--include/vbahelper/vbapagesetupbase.hxx61
-rw-r--r--include/vbahelper/vbapropvalue.hxx54
-rw-r--r--include/vbahelper/vbashape.hxx109
-rw-r--r--include/vbahelper/vbashaperange.hxx82
-rw-r--r--include/vbahelper/vbashapes.hxx74
-rw-r--r--include/vbahelper/vbatextframe.hxx61
-rw-r--r--include/vbahelper/vbawindowbase.hxx76
-rw-r--r--include/vcl/FilterConfigItem.hxx87
-rw-r--r--include/vcl/GraphicNativeMetadata.hxx39
-rw-r--r--include/vcl/GraphicNativeTransform.hxx42
-rw-r--r--include/vcl/ImageListProvider.hxx51
-rw-r--r--include/vcl/abstdlg.hxx84
-rw-r--r--include/vcl/accel.hxx105
-rw-r--r--include/vcl/alpha.hxx149
-rw-r--r--include/vcl/animate.hxx238
-rw-r--r--include/vcl/apptypes.hxx51
-rw-r--r--include/vcl/bitmap.hxx896
-rw-r--r--include/vcl/bitmapex.hxx389
-rw-r--r--include/vcl/bmpacc.hxx454
-rw-r--r--include/vcl/btndlg.hxx105
-rw-r--r--include/vcl/builder.hxx365
-rw-r--r--include/vcl/button.hxx574
-rw-r--r--include/vcl/canvastools.hxx175
-rw-r--r--include/vcl/cmdevt.hxx466
-rw-r--r--include/vcl/combobox.h31
-rw-r--r--include/vcl/combobox.hxx227
-rw-r--r--include/vcl/configsettings.hxx66
-rw-r--r--include/vcl/controllayout.hxx79
-rw-r--r--include/vcl/ctrl.hxx195
-rw-r--r--include/vcl/cursor.hxx114
-rw-r--r--include/vcl/cvtgrf.hxx57
-rw-r--r--include/vcl/cvtsvm.hxx102
-rw-r--r--include/vcl/decoview.hxx102
-rw-r--r--include/vcl/dialog.hxx185
-rw-r--r--include/vcl/displayconnectiondispatch.hxx46
-rw-r--r--include/vcl/dllapi.h40
-rw-r--r--include/vcl/dndhelp.hxx119
-rw-r--r--include/vcl/dockingarea.hxx59
-rw-r--r--include/vcl/dockwin.hxx420
-rw-r--r--include/vcl/edit.hxx265
-rw-r--r--include/vcl/embeddedfontshelper.hxx89
-rw-r--r--include/vcl/event.hxx522
-rw-r--r--include/vcl/evntpost.hxx51
-rw-r--r--include/vcl/extoutdevdata.hxx41
-rw-r--r--include/vcl/field.hxx832
-rw-r--r--include/vcl/fixed.hxx208
-rw-r--r--include/vcl/fixedhyper.hxx127
-rw-r--r--include/vcl/floatwin.hxx152
-rw-r--r--include/vcl/fltcall.hxx68
-rw-r--r--include/vcl/fntstyle.hxx47
-rw-r--r--include/vcl/font.hxx137
-rw-r--r--include/vcl/fontcapabilities.hxx204
-rw-r--r--include/vcl/fontmanager.hxx578
-rw-r--r--include/vcl/fpicker.hrc36
-rw-r--r--include/vcl/gdimtf.hxx248
-rw-r--r--include/vcl/gfxlink.hxx180
-rw-r--r--include/vcl/gradient.hxx118
-rw-r--r--include/vcl/graph.h74
-rw-r--r--include/vcl/graph.hxx201
-rw-r--r--include/vcl/graphicfilter.hxx325
-rw-r--r--include/vcl/graphictools.hxx348
-rw-r--r--include/vcl/group.hxx61
-rw-r--r--include/vcl/hatch.hxx89
-rw-r--r--include/vcl/help.hxx120
-rw-r--r--include/vcl/helper.hxx59
-rw-r--r--include/vcl/i18nhelp.hxx87
-rw-r--r--include/vcl/image.hxx145
-rw-r--r--include/vcl/imagerepository.hxx68
-rw-r--r--include/vcl/imgctrl.hxx57
-rw-r--r--include/vcl/impdel.hxx81
-rw-r--r--include/vcl/inputctx.hxx82
-rw-r--r--include/vcl/introwin.hxx44
-rw-r--r--include/vcl/jobdata.hxx85
-rw-r--r--include/vcl/jobset.hxx74
-rw-r--r--include/vcl/keycod.hxx132
-rw-r--r--include/vcl/keycodes.hxx186
-rw-r--r--include/vcl/layout.hxx702
-rw-r--r--include/vcl/lazydelete.hxx299
-rw-r--r--include/vcl/lineinfo.hxx127
-rw-r--r--include/vcl/longcurr.hxx134
-rw-r--r--include/vcl/lstbox.h57
-rw-r--r--include/vcl/lstbox.hxx250
-rw-r--r--include/vcl/mapmod.hxx110
-rw-r--r--include/vcl/menu.hxx494
-rw-r--r--include/vcl/menubtn.hxx98
-rw-r--r--include/vcl/metaact.hxx1319
-rw-r--r--include/vcl/metric.hxx152
-rw-r--r--include/vcl/mnemonic.hxx82
-rw-r--r--include/vcl/mnemonicengine.hxx154
-rw-r--r--include/vcl/morebtn.hxx88
-rw-r--r--include/vcl/msgbox.hxx172
-rw-r--r--include/vcl/octree.hxx127
-rw-r--r--include/vcl/oldprintadaptor.hxx46
-rw-r--r--include/vcl/outdev.hxx1170
-rw-r--r--include/vcl/pdfextoutdevdata.hxx492
-rw-r--r--include/vcl/pdfwriter.hxx1310
-rw-r--r--include/vcl/pngread.hxx64
-rw-r--r--include/vcl/pngwrite.hxx61
-rw-r--r--include/vcl/pointr.hxx53
-rw-r--r--include/vcl/popupmenuwindow.hxx44
-rw-r--r--include/vcl/ppdparser.hxx311
-rw-r--r--include/vcl/prgsbar.hxx89
-rw-r--r--include/vcl/print.hxx688
-rw-r--r--include/vcl/printerinfomanager.hxx239
-rw-r--r--include/vcl/prntypes.hxx89
-rw-r--r--include/vcl/ptrstyle.hxx134
-rw-r--r--include/vcl/quickselectionengine.hxx94
-rw-r--r--include/vcl/regband.hxx142
-rw-r--r--include/vcl/region.hxx155
-rw-r--r--include/vcl/salbtype.hxx887
-rw-r--r--include/vcl/salctype.hxx71
-rw-r--r--include/vcl/salgtype.hxx84
-rw-r--r--include/vcl/salnativewidgets.hxx476
-rw-r--r--include/vcl/scopedbitmapaccess.hxx94
-rw-r--r--include/vcl/scrbar.hxx166
-rw-r--r--include/vcl/seleng.hxx232
-rw-r--r--include/vcl/settings.hxx1104
-rw-r--r--include/vcl/slider.hxx122
-rw-r--r--include/vcl/solarmutex.hxx71
-rw-r--r--include/vcl/sound.hxx39
-rw-r--r--include/vcl/spin.h38
-rw-r--r--include/vcl/spin.hxx110
-rw-r--r--include/vcl/spinfld.hxx111
-rw-r--r--include/vcl/split.hxx116
-rw-r--r--include/vcl/splitwin.hxx241
-rw-r--r--include/vcl/status.hxx198
-rw-r--r--include/vcl/stdtext.hxx47
-rw-r--r--include/vcl/strhelper.hxx74
-rw-r--r--include/vcl/svapp.hxx538
-rw-r--r--include/vcl/svgdata.hxx86
-rw-r--r--include/vcl/syschild.hxx65
-rw-r--r--include/vcl/sysdata.hxx272
-rw-r--r--include/vcl/syswin.hxx270
-rw-r--r--include/vcl/tabctrl.hxx208
-rw-r--r--include/vcl/tabdlg.hxx64
-rw-r--r--include/vcl/tabpage.hxx65
-rw-r--r--include/vcl/taskpanelist.hxx48
-rw-r--r--include/vcl/textdata.hxx172
-rw-r--r--include/vcl/texteng.hxx322
-rw-r--r--include/vcl/textview.hxx208
-rw-r--r--include/vcl/threadex.hxx261
-rw-r--r--include/vcl/throbber.hxx94
-rw-r--r--include/vcl/timer.hxx81
-rw-r--r--include/vcl/toolbox.hxx606
-rw-r--r--include/vcl/txtattr.hxx227
-rw-r--r--include/vcl/unohelp.hxx63
-rw-r--r--include/vcl/unohelp2.hxx77
-rw-r--r--include/vcl/unowrap.hxx86
-rw-r--r--include/vcl/vclenum.hxx137
-rw-r--r--include/vcl/vclevent.hxx289
-rw-r--r--include/vcl/vclmain.hxx27
-rw-r--r--include/vcl/vclmedit.hxx142
-rw-r--r--include/vcl/virdev.hxx142
-rw-r--r--include/vcl/waitobj.hxx47
-rw-r--r--include/vcl/wall.hxx133
-rw-r--r--include/vcl/window.hxx1279
-rw-r--r--include/vcl/wmf.hxx70
-rw-r--r--include/vcl/wrkwin.hxx105
-rw-r--r--include/vcl/xtextedt.hxx69
-rw-r--r--include/xmloff/DashStyle.hxx66
-rw-r--r--include/xmloff/DocumentSettingsContext.hxx57
-rw-r--r--include/xmloff/EnumPropertyHdl.hxx46
-rw-r--r--include/xmloff/GradientStyle.hxx68
-rw-r--r--include/xmloff/HatchStyle.hxx65
-rw-r--r--include/xmloff/ImageStyle.hxx54
-rw-r--r--include/xmloff/MarkerStyle.hxx67
-rw-r--r--include/xmloff/NamedBoolPropertyHdl.hxx56
-rw-r--r--include/xmloff/PageMasterStyleMap.hxx168
-rw-r--r--include/xmloff/ProgressBarHelper.hxx70
-rw-r--r--include/xmloff/PropertySetInfoHash.hxx59
-rw-r--r--include/xmloff/PropertySetInfoKey.hxx61
-rw-r--r--include/xmloff/SchXMLExportHelper.hxx67
-rw-r--r--include/xmloff/SchXMLImportHelper.hxx153
-rw-r--r--include/xmloff/SchXMLSeriesHelper.hxx73
-rw-r--r--include/xmloff/SettingsExportHelper.hxx104
-rw-r--r--include/xmloff/SinglePropertySetInfoCache.hxx73
-rw-r--r--include/xmloff/WordWrapPropertyHdl.hxx47
-rw-r--r--include/xmloff/XMLBase64ImportContext.hxx57
-rw-r--r--include/xmloff/XMLCharContext.hxx65
-rw-r--r--include/xmloff/XMLConstantsPropertyHandler.hxx63
-rw-r--r--include/xmloff/XMLEmbeddedObjectExportFilter.hxx85
-rw-r--r--include/xmloff/XMLEventExport.hxx133
-rw-r--r--include/xmloff/XMLEventsImportContext.hxx131
-rw-r--r--include/xmloff/XMLFilterServiceNames.h40
-rw-r--r--include/xmloff/XMLFontAutoStylePool.hxx73
-rw-r--r--include/xmloff/XMLFontStylesContext.hxx89
-rw-r--r--include/xmloff/XMLGraphicsDefaultStyle.hxx56
-rw-r--r--include/xmloff/XMLPageExport.hxx105
-rw-r--r--include/xmloff/XMLSettingsExportContext.hxx62
-rw-r--r--include/xmloff/XMLShapeStyleContext.hxx70
-rw-r--r--include/xmloff/XMLStringVector.hxx32
-rw-r--r--include/xmloff/XMLTextListAutoStylePool.hxx77
-rw-r--r--include/xmloff/XMLTextMasterPageContext.hxx89
-rw-r--r--include/xmloff/XMLTextMasterPageExport.hxx68
-rw-r--r--include/xmloff/XMLTextMasterStylesContext.hxx55
-rw-r--r--include/xmloff/XMLTextShapeImportHelper.hxx51
-rw-r--r--include/xmloff/XMLTextShapeStyleContext.hxx66
-rw-r--r--include/xmloff/XMLTextTableContext.hxx53
-rw-r--r--include/xmloff/animationexport.hxx53
-rw-r--r--include/xmloff/animexp.hxx45
-rw-r--r--include/xmloff/attrlist.hxx86
-rw-r--r--include/xmloff/contextid.hxx48
-rw-r--r--include/xmloff/controlpropertyhdl.hxx136
-rw-r--r--include/xmloff/dllapi.h34
-rw-r--r--include/xmloff/families.hxx110
-rw-r--r--include/xmloff/formlayerexport.hxx189
-rw-r--r--include/xmloff/formlayerimport.hxx136
-rw-r--r--include/xmloff/i18nmap.hxx73
-rw-r--r--include/xmloff/maptype.hxx68
-rw-r--r--include/xmloff/nmspmap.hxx170
-rw-r--r--include/xmloff/numehelp.hxx116
-rw-r--r--include/xmloff/odffields.hxx53
-rw-r--r--include/xmloff/prhdlfac.hxx103
-rw-r--r--include/xmloff/prstylei.hxx99
-rw-r--r--include/xmloff/settingsstore.hxx59
-rw-r--r--include/xmloff/shapeexport.hxx331
-rw-r--r--include/xmloff/shapeimport.hxx426
-rw-r--r--include/xmloff/styleexp.hxx127
-rw-r--r--include/xmloff/table/XMLTableExport.hxx106
-rw-r--r--include/xmloff/table/XMLTableImport.hxx72
-rw-r--r--include/xmloff/txtimp.hxx725
-rw-r--r--include/xmloff/txtimppr.hxx75
-rw-r--r--include/xmloff/txtparae.hxx728
-rw-r--r--include/xmloff/txtprmap.hxx204
-rw-r--r--include/xmloff/txtstyli.hxx112
-rw-r--r--include/xmloff/uniref.hxx224
-rw-r--r--include/xmloff/unoatrcn.hxx79
-rw-r--r--include/xmloff/unointerfacetouniqueidentifiermapper.hxx77
-rw-r--r--include/xmloff/xformsexport.hxx54
-rw-r--r--include/xmloff/xformsimport.hxx79
-rw-r--r--include/xmloff/xmlaustp.hxx124
-rw-r--r--include/xmloff/xmlcnimp.hxx74
-rw-r--r--include/xmloff/xmlement.hxx51
-rw-r--r--include/xmloff/xmlerror.hxx147
-rw-r--r--include/xmloff/xmlevent.hxx145
-rw-r--r--include/xmloff/xmlexp.hxx659
-rw-r--r--include/xmloff/xmlexppr.hxx188
-rw-r--r--include/xmloff/xmlictxt.hxx101
-rw-r--r--include/xmloff/xmlimp.hxx525
-rw-r--r--include/xmloff/xmlimppr.hxx192
-rw-r--r--include/xmloff/xmlmetae.hxx120
-rw-r--r--include/xmloff/xmlmetai.hxx69
-rw-r--r--include/xmloff/xmlmultiimagehelper.hxx59
-rw-r--r--include/xmloff/xmlnmspe.hxx106
-rw-r--r--include/xmloff/xmlnume.hxx94
-rw-r--r--include/xmloff/xmlnumfe.hxx134
-rw-r--r--include/xmloff/xmlnumfi.hxx214
-rw-r--r--include/xmloff/xmlnumi.hxx104
-rw-r--r--include/xmloff/xmlprcon.hxx70
-rw-r--r--include/xmloff/xmlprhdl.hxx58
-rw-r--r--include/xmloff/xmlprmap.hxx181
-rw-r--r--include/xmloff/xmlreg.hxx36
-rw-r--r--include/xmloff/xmlscripti.hxx54
-rw-r--r--include/xmloff/xmlstyle.hxx265
-rw-r--r--include/xmloff/xmltabe.hxx53
-rw-r--r--include/xmloff/xmltkmap.hxx59
-rw-r--r--include/xmloff/xmltoken.hxx3212
-rw-r--r--include/xmloff/xmltypes.hxx283
-rw-r--r--include/xmloff/xmluconv.hxx230
-rw-r--r--include/xmlreader/README28
-rw-r--r--include/xmlreader/detail/xmlreaderdllapi.hxx35
-rw-r--r--include/xmlreader/pad.hxx53
-rw-r--r--include/xmlreader/span.hxx79
-rw-r--r--include/xmlreader/xmlreader.hxx193
-rw-r--r--include/xmlscript/xml_helper.hxx139
-rw-r--r--include/xmlscript/xmldlg_imexp.hxx81
-rw-r--r--include/xmlscript/xmllib_imexp.hxx88
-rw-r--r--include/xmlscript/xmlmod_imexp.hxx59
-rw-r--r--include/xmlscript/xmlns.h39
-rw-r--r--include/xmlscript/xmlscriptdllapi.h33
2384 files changed, 357820 insertions, 0 deletions
diff --git a/include/animations/animationnodehelper.hxx b/include/animations/animationnodehelper.hxx
new file mode 100644
index 000000000000..d6f000d5dd40
--- /dev/null
+++ b/include/animations/animationnodehelper.hxx
@@ -0,0 +1,124 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_ANIMATIONS_ANIMATIONNODEHELPER_HXX
+#define INCLUDED_ANIMATIONS_ANIMATIONNODEHELPER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/animations/XAnimationNode.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
+
+#include <vector>
+
+/* Declaration and definition of AnimationNode helper */
+
+namespace anim
+{
+ // TODO(Q1): this could possibly be implemented with a somewhat
+ // more lightweight template, by having the actual worker receive
+ // only a function pointer, and a thin templated wrapper around
+ // that which converts member functions into that.
+
+ /** Apply given functor to every animation node child.
+
+ @param xNode
+ Parent node
+
+ @param rFunctor
+ Functor to apply. The functor must have an appropriate
+ operator()( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::animations::XAnimationNode >& ) member.
+
+ @return true, if the functor was successfully applied to
+ all children, false otherwise.
+ */
+ template< typename Functor > inline bool for_each_childNode( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode,
+ Functor& rFunctor )
+ {
+ try
+ {
+ // get an XEnumerationAccess to the children
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumerationAccess >
+ xEnumerationAccess( xNode,
+ ::com::sun::star::uno::UNO_QUERY_THROW );
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration >
+ xEnumeration( xEnumerationAccess->createEnumeration(),
+ ::com::sun::star::uno::UNO_QUERY_THROW );
+
+ while( xEnumeration->hasMoreElements() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >
+ xChildNode( xEnumeration->nextElement(),
+ ::com::sun::star::uno::UNO_QUERY_THROW );
+
+ rFunctor( xChildNode );
+ }
+
+ return true;
+ }
+ catch( ::com::sun::star::uno::Exception& )
+ {
+ return false;
+ }
+ }
+
+
+ /** pushes the given node to the given vector and recursivly calls itself for each child node.
+ */
+ inline void create_deep_vector( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode,
+ std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > >& rVector )
+ {
+ rVector.push_back( xNode );
+
+ try
+ {
+ // get an XEnumerationAccess to the children
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumerationAccess >
+ xEnumerationAccess( xNode,
+ ::com::sun::star::uno::UNO_QUERY );
+
+ if( xEnumerationAccess.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration >
+ xEnumeration( xEnumerationAccess->createEnumeration(),
+ ::com::sun::star::uno::UNO_QUERY );
+
+ if( xEnumeration.is() )
+ {
+ while( xEnumeration->hasMoreElements() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >
+ xChildNode( xEnumeration->nextElement(),
+ ::com::sun::star::uno::UNO_QUERY_THROW );
+
+ create_deep_vector( xChildNode, rVector );
+ }
+ }
+ }
+ }
+ catch( ::com::sun::star::uno::Exception& )
+ {
+ }
+ }
+}
+
+#endif /* INCLUDED_ANIMATIONS_ANIMATIONNODEHELPER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/apple_remote/RemoteControl.h b/include/apple_remote/RemoteControl.h
new file mode 100644
index 000000000000..6e2c67765890
--- /dev/null
+++ b/include/apple_remote/RemoteControl.h
@@ -0,0 +1,113 @@
+/* -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*****************************************************************************
+ * RemoteControl.h
+ * RemoteControlWrapper
+ *
+ * Created by Martin Kahr on 11.03.06 under a MIT-style license.
+ * Copyright (c) 2006 martinkahr.com. All rights reserved.
+ *
+ * Code modified and adapted to OpenOffice.org
+ * by Eric Bachard on 11.08.2008 under the same License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *****************************************************************************/
+
+#import <Cocoa/Cocoa.h>
+
+// notifaction names that are being used to signal that an application wants to
+// have access to the remote control device or if the application has finished
+// using the remote control device
+extern NSString* REQUEST_FOR_REMOTE_CONTROL_NOTIFCATION;
+extern NSString* FINISHED_USING_REMOTE_CONTROL_NOTIFICATION;
+
+// keys used in user objects for distributed notifications
+extern NSString* kRemoteControlDeviceName;
+extern NSString* kApplicationIdentifier;
+extern NSString* kTargetApplicationIdentifier;
+
+// we have a 6 bit offset to make a hold event out of a normal event
+#define EVENT_TO_HOLD_EVENT_OFFSET 6
+
+@class RemoteControl;
+
+typedef enum _RemoteControlEventIdentifier {
+ // normal events
+ kRemoteButtonPlus =1<<1,
+ kRemoteButtonMinus =1<<2,
+ kRemoteButtonMenu =1<<3,
+ kRemoteButtonPlay =1<<4,
+ kRemoteButtonRight =1<<5,
+ kRemoteButtonLeft =1<<6,
+
+ // hold events
+ kRemoteButtonPlus_Hold =1<<7,
+ kRemoteButtonMinus_Hold =1<<8,
+ kRemoteButtonMenu_Hold =1<<9,
+ kRemoteButtonPlay_Hold =1<<10,
+ kRemoteButtonRight_Hold =1<<11,
+ kRemoteButtonLeft_Hold =1<<12,
+
+ // special events (not supported by all devices)
+ kRemoteControl_Switched =1<<13,
+
+ // New values for the "metallic" Remote (2009 model)
+ kMetallicRemote2009ButtonPlay =1<<14,
+ kMetallicRemote2009ButtonMiddlePlay =1<<15
+
+} RemoteControlEventIdentifier;
+
+@interface NSObject(RemoteControlDelegate)
+
+- (void) sendRemoteButtonEvent: (RemoteControlEventIdentifier) event pressedDown: (BOOL) pressedDown remoteControl: (RemoteControl*) remoteControl;
+
+@end
+
+/*
+ Base Interface for Remote Control devices
+*/
+@interface RemoteControl : NSObject {
+ id delegate;
+}
+
+// returns nil if the remote control device is not available
+- (id) initWithDelegate: (id) remoteControlDelegate;
+
+- (void) setListeningToRemote: (BOOL) value;
+- (BOOL) isListeningToRemote;
+
+- (BOOL) isOpenInExclusiveMode;
+- (void) setOpenInExclusiveMode: (BOOL) value;
+
+- (void) startListening: (id) sender;
+- (void) stopListening: (id) sender;
+
+// is this remote control sending the given event?
+- (BOOL) sendsEventForButtonIdentifier: (RemoteControlEventIdentifier) identifier;
+
+// sending of notifications between applications
++ (void) sendFinishedNotifcationForAppIdentifier: (NSString*) identifier;
++ (void) sendRequestForRemoteControlNotification;
+
+// name of the device
++ (const char*) remoteControlDeviceName;
+
+@end
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/apple_remote/RemoteMainController.h b/include/apple_remote/RemoteMainController.h
new file mode 100644
index 000000000000..5fde4639c155
--- /dev/null
+++ b/include/apple_remote/RemoteMainController.h
@@ -0,0 +1,52 @@
+/* -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*****************************************************************************
+ * RemoteMainController.h
+ *
+ *
+ * Created by Martin Kahr on 11.03.06 under a MIT-style license.
+ * Copyright (c) 2006 martinkahr.com. All rights reserved.
+ *
+ * Code modified and adapted to OpenOffice.org
+ * by Eric Bachard on 11.08.2008 under the same License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *****************************************************************************/
+
+#import <Cocoa/Cocoa.h>
+
+#define AppleRemoteControlEvent 15
+
+@class RemoteControl;
+@class MultiClickRemoteBehavior;
+
+//static void sendTheEvent( unichar, int );
+
+@interface MainController : NSObject {
+@public // else remoteControl is not reachable from GetSalData()->mpMainController
+ RemoteControl* remoteControl;
+@private
+ MultiClickRemoteBehavior* remoteControlBehavior;
+}
+- (RemoteControl*) remoteControl;
+- (MultiClickRemoteBehavior*) remoteBehavior;
+
+@end
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/avmedia/avmediadllapi.h b/include/avmedia/avmediadllapi.h
new file mode 100644
index 000000000000..351b82854a7f
--- /dev/null
+++ b/include/avmedia/avmediadllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_AVMEDIADLLAPI_H
+#define INCLUDED_AVMEDIADLLAPI_H
+
+#include "sal/types.h"
+
+#if defined(AVMEDIA_DLLIMPLEMENTATION)
+#define AVMEDIA_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define AVMEDIA_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define AVMEDIA_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif /* INCLUDED_AVMEDIADLLAPI_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/avmedia/mediaitem.hxx b/include/avmedia/mediaitem.hxx
new file mode 100644
index 000000000000..f14281999307
--- /dev/null
+++ b/include/avmedia/mediaitem.hxx
@@ -0,0 +1,132 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef AVMEDIA_MEDIAITEM_HXX
+#define AVMEDIA_MEDIAITEM_HXX
+
+#include <boost/scoped_ptr.hpp>
+
+#include <tools/rtti.hxx>
+#include <svl/poolitem.hxx>
+#include <com/sun/star/media/ZoomLevel.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <avmedia/avmediadllapi.h>
+
+#define AVMEDIA_SETMASK_NONE ((sal_uInt32)(0x00000000))
+#define AVMEDIA_SETMASK_STATE ((sal_uInt32)(0x00000001))
+#define AVMEDIA_SETMASK_DURATION ((sal_uInt32)(0x00000002))
+#define AVMEDIA_SETMASK_TIME ((sal_uInt32)(0x00000004))
+#define AVMEDIA_SETMASK_LOOP ((sal_uInt32)(0x00000008))
+#define AVMEDIA_SETMASK_MUTE ((sal_uInt32)(0x00000010))
+#define AVMEDIA_SETMASK_VOLUMEDB ((sal_uInt32)(0x00000020))
+#define AVMEDIA_SETMASK_ZOOM ((sal_uInt32)(0x00000040))
+#define AVMEDIA_SETMASK_URL ((sal_uInt32)(0x00000080))
+#define AVMEDIA_SETMASK_ALL ((sal_uInt32)(0xffffffff))
+
+class SvStream;
+
+namespace avmedia
+{
+
+//---------------
+// - MediaState -
+// --------------
+
+enum MediaState
+{
+ MEDIASTATE_STOP = 0,
+ MEDIASTATE_PLAY = 1,
+ MEDIASTATE_PLAYFFW = 2,
+ MEDIASTATE_PAUSE = 3
+};
+
+// -------------
+// - MediaItem -
+// -------------
+
+class AVMEDIA_DLLPUBLIC MediaItem : public SfxPoolItem
+{
+public:
+ TYPEINFO();
+
+ explicit MediaItem( sal_uInt16 const i_nWhich = 0,
+ sal_uInt32 const nMaskSet = AVMEDIA_SETMASK_NONE );
+ MediaItem( const MediaItem& rMediaItem );
+ virtual ~MediaItem();
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreUnit,
+ SfxMapUnit ePresUnit,
+ OUString& rText,
+ const IntlWrapper *pIntl ) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ void merge( const MediaItem& rMediaItem );
+
+ sal_uInt32 getMaskSet() const;
+
+ void setState( MediaState eState );
+ MediaState getState() const;
+
+ void setDuration( double fDuration );
+ double getDuration() const;
+
+ void setTime( double fTime );
+ double getTime() const;
+
+ void setLoop( bool bLoop );
+ bool isLoop() const;
+
+ void setMute( bool bMute );
+ bool isMute() const;
+
+ void setVolumeDB( sal_Int16 nDB );
+ sal_Int16 getVolumeDB() const;
+
+ void setZoom( ::com::sun::star::media::ZoomLevel eZoom );
+ ::com::sun::star::media::ZoomLevel getZoom() const;
+
+ void setURL( const OUString& rURL,
+ OUString const*const pTempURL);
+ const OUString& getURL() const;
+
+ const OUString& getTempURL() const;
+
+private:
+
+ struct Impl;
+ ::boost::scoped_ptr<Impl> m_pImpl;
+};
+
+typedef ::avmedia::MediaItem avmedia_MediaItem;
+
+bool AVMEDIA_DLLPUBLIC EmbedMedia(
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel>
+ const& xModel,
+ OUString const& rSourceURL,
+ OUString & o_rEmbeddedURL);
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/avmedia/mediaplayer.hxx b/include/avmedia/mediaplayer.hxx
new file mode 100644
index 000000000000..b823f7c63b67
--- /dev/null
+++ b/include/avmedia/mediaplayer.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _AVMEDIA_MEDIACHILD_HXX
+#define _AVMEDIA_MEDIACHILD_HXX
+
+#include <sfx2/ctrlitem.hxx>
+#include <sfx2/dockwin.hxx>
+#include <avmedia/avmediadllapi.h>
+
+#define AVMEDIA_MEDIAWINDOW() \
+(static_cast< ::avmedia::MediaFloater* >( ( \
+SfxViewFrame::Current() && SfxViewFrame::Current()->GetChildWindow(::avmedia::MediaPlayer::GetChildWindowId())) ? \
+SfxViewFrame::Current()->GetChildWindow(::avmedia::MediaPlayer::GetChildWindowId())->GetWindow() : \
+NULL))
+
+namespace avmedia
+{
+
+class AVMEDIA_DLLPUBLIC MediaPlayer : public SfxChildWindow
+{
+public:
+ MediaPlayer( Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo* );
+ ~MediaPlayer();
+
+ SFX_DECL_CHILDWINDOW_WITHID( MediaPlayer );
+};
+
+class MediaWindow;
+
+class AVMEDIA_DLLPUBLIC MediaFloater : public SfxDockingWindow
+{
+public:
+
+ MediaFloater( SfxBindings* pBindings, SfxChildWindow* pCW, Window* pParent );
+ ~MediaFloater();
+
+ void setURL( const OUString& rURL, bool bPlayImmediately );
+ const OUString& getURL() const;
+
+ void dispatchCurrentURL();
+
+protected:
+
+ virtual void Resize();
+ virtual void ToggleFloatingMode();
+
+private:
+
+ MediaWindow* mpMediaWindow;
+ Size maLastSize;
+
+ AVMEDIA_DLLPRIVATE void implInit();
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/avmedia/mediatoolbox.hxx b/include/avmedia/mediatoolbox.hxx
new file mode 100644
index 000000000000..570167024aff
--- /dev/null
+++ b/include/avmedia/mediatoolbox.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _AVMEDIA_MEDIATOOLBOX_HXX
+#define _AVMEDIA_MEDIATOOLBOX_HXX
+
+#include <svl/lstner.hxx>
+#include <sfx2/tbxctrl.hxx>
+#include <avmedia/avmediadllapi.h>
+
+namespace avmedia
+{
+
+// -------------------------------
+// - SvxGrafFilterToolBoxControl -
+// -------------------------------
+
+class MediaItem;
+
+class AVMEDIA_DLLPUBLIC MediaToolBoxControl : public SfxToolBoxControl
+{
+ friend class MediaToolBoxControl_Impl;
+
+public:
+
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ MediaToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbX );
+ ~MediaToolBoxControl();
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+ virtual Window* CreateItemWindow( Window* pParent );
+
+private:
+
+ AVMEDIA_DLLPRIVATE void implUpdateMediaControl();
+ AVMEDIA_DLLPRIVATE void implExecuteMediaControl( const MediaItem& rItem );
+};
+
+}
+
+#endif // _AVMEDIA_MEDIATOOLBOX_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/avmedia/mediawindow.hxx b/include/avmedia/mediawindow.hxx
new file mode 100644
index 000000000000..a5cb5dc8e7a8
--- /dev/null
+++ b/include/avmedia/mediawindow.hxx
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _AVMEDIA_MEDIAWINDOW_HXX
+#define _AVMEDIA_MEDIAWINDOW_HXX
+
+#include <memory>
+#include <vector>
+#include <tools/gen.hxx>
+#include <com/sun/star/media/ZoomLevel.hpp>
+#include <com/sun/star/media/XPlayer.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <avmedia/avmediadllapi.h>
+
+#define AVMEDIA_FRAMEGRABBER_DEFAULTFRAME -1.0
+
+class Window;
+class KeyEvent;
+class MouseEvent;
+class CommandEvent;
+class PopupMenu;
+class Pointer;
+struct AcceptDropEvent;
+struct ExecuteDropEvent;
+
+
+namespace avmedia
+{
+ typedef ::std::vector< ::std::pair< OUString, OUString > > FilterNameVector;
+
+ class MediaItem;
+
+ namespace priv { class MediaWindowImpl; }
+
+ class AVMEDIA_DLLPUBLIC MediaWindow
+ {
+ public:
+ MediaWindow( Window* parent, bool bInternalMediaControl );
+ virtual ~MediaWindow();
+
+ void setURL( const OUString& rURL );
+ const OUString& getURL() const;
+
+ bool isValid() const;
+ Size getPreferredSize() const;
+
+ Window* getWindow() const;
+
+ void setPosSize( const Rectangle& rNewRect );
+
+ void setPointer( const Pointer& rPointer );
+
+ bool start();
+
+ void updateMediaItem( MediaItem& rItem ) const;
+ void executeMediaItem( const MediaItem& rItem );
+
+ void show();
+ void hide();
+
+ public:
+
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void KeyUp( const KeyEvent& rKEvt );
+
+ virtual void Command( const CommandEvent& rCEvt );
+
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
+
+ virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
+
+ public:
+
+ static void getMediaFilters( FilterNameVector& rFilterNameVector );
+ /// @param o_pbLink if not 0, this is an "insert" dialog: display link
+ /// checkbox and store its state in *o_pbLink
+ static bool executeMediaURLDialog( Window* pParent,
+ OUString& rURL, bool *const o_pbLink );
+ static void executeFormatErrorBox( Window* pParent );
+ static bool isMediaURL( const OUString& rURL, bool bDeep = false, Size* pPreferredSizePixel = NULL );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > createPlayer( const OUString& rURL );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > grabFrame( const OUString& rURL,
+ bool bAllowToCreateReplacementGraphic = false,
+ double fMediaTime = AVMEDIA_FRAMEGRABBER_DEFAULTFRAME );
+
+ private:
+
+ // default: disabled copy/assignment
+ AVMEDIA_DLLPRIVATE MediaWindow(const MediaWindow&);
+ AVMEDIA_DLLPRIVATE MediaWindow& operator =( const MediaWindow& );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxIFace;
+ priv::MediaWindowImpl* mpImpl;
+ };
+}
+
+#endif // _AVMEDIA_MEDIAWINDOW_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/accessor.hxx b/include/basebmp/accessor.hxx
new file mode 100644
index 000000000000..0ef3b5716465
--- /dev/null
+++ b/include/basebmp/accessor.hxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_ACCESSOR_HXX
+#define INCLUDED_BASEBMP_ACCESSOR_HXX
+
+#include <vigra/numerictraits.hxx>
+
+namespace basebmp
+{
+
+/** Standard accessor type
+
+ Accesses the iterator values the standard way (i.e. via
+ *operator()/operator[])
+ */
+template<typename ValueType> class StandardAccessor
+{
+public:
+ typedef ValueType value_type;
+
+ // -------------------------------------------------------
+
+ template< class Iterator >
+ value_type operator()(Iterator const& i) const
+ {
+ return *i;
+ }
+
+ template< class Iterator, class Difference >
+ value_type operator()(Iterator const& i, Difference const& diff) const
+ {
+ return i[diff];
+ }
+
+ // -------------------------------------------------------
+
+ template< typename V, class Iterator >
+ void set(V const& value, Iterator const& i) const
+ {
+ *i = vigra::detail::RequiresExplicitCast<value_type>::cast(value);
+ }
+
+ template< typename V, class Iterator, class Difference >
+ void set(V const& value, Iterator const& i, Difference const& diff) const
+ {
+ i[diff] = vigra::detail::RequiresExplicitCast<value_type>::cast(value);
+ }
+};
+
+//-----------------------------------------------------------------------------
+
+/** Non-standard accessor type
+
+ Uses getter/setter methods at the given iterator type, to access
+ the underlying values.
+ */
+template<typename ValueType> class NonStandardAccessor
+{
+public:
+ typedef ValueType value_type;
+
+ // -------------------------------------------------------
+
+ template< class Iterator >
+ value_type operator()(Iterator const& i) const
+ {
+ return i.get();
+ }
+
+ template< class Iterator, class Difference >
+ value_type operator()(Iterator const& i, Difference const& diff) const
+ {
+ return i.get(diff);
+ }
+
+ // -------------------------------------------------------
+
+ template< typename V, class Iterator >
+ void set(V const& value, Iterator const& i) const
+ {
+ i.set( vigra::detail::RequiresExplicitCast<value_type>::cast(value) );
+ }
+
+ template< typename V, class Iterator, class Difference >
+ void set(V const& value, Iterator const& i, Difference const& diff) const
+ {
+ i.set( vigra::detail::RequiresExplicitCast<value_type>::cast(value),
+ diff );
+ }
+};
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_ACCESSOR_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/accessoradapters.hxx b/include/basebmp/accessoradapters.hxx
new file mode 100644
index 000000000000..f4a05dc331c2
--- /dev/null
+++ b/include/basebmp/accessoradapters.hxx
@@ -0,0 +1,520 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_ACCESSORADAPTERS_HXX
+#define INCLUDED_BASEBMP_ACCESSORADAPTERS_HXX
+
+#include <vigra/numerictraits.hxx>
+
+namespace basebmp
+{
+
+/** Interpose given accessor's set and get methods with two unary
+ functors.
+
+ @tpl WrappedAccessor
+ Wrapped type must provide the usual get and set accessor methods,
+ with the usual signatures (see StandardAccessor for a conforming
+ example).
+
+ @tpl GetterFunctor
+ An Adaptable Unary Function (i.e. providing result_type and
+ argument_type typedefs)
+
+ @tpl SetterFunctor
+ An Adaptable Unary Function (i.e. providing result_type and
+ argument_type typedefs)
+ */
+template< class WrappedAccessor,
+ typename GetterFunctor,
+ typename SetterFunctor > class UnaryFunctionAccessorAdapter
+{
+public:
+ typedef typename GetterFunctor::result_type value_type;
+ typedef typename SetterFunctor::argument_type argument_type;
+
+#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+// making all members public, if no member template friends
+private:
+ template<class A, typename G, typename S> friend class UnaryFunctionAccessorAdapter;
+#endif
+
+ // we don't derive from wrapped type, to avoid ambiguities
+ // regarding templatized getter/setter methods.
+ WrappedAccessor maAccessor;
+ GetterFunctor maGetterFunctor;
+ SetterFunctor maSetterFunctor;
+
+public:
+ UnaryFunctionAccessorAdapter() :
+ maAccessor(),
+ maGetterFunctor(),
+ maSetterFunctor()
+ {}
+
+ template< class A > explicit
+ UnaryFunctionAccessorAdapter( UnaryFunctionAccessorAdapter< A,
+ GetterFunctor,
+ SetterFunctor > const& rSrc ) :
+ maAccessor( rSrc.maAccessor ),
+ maGetterFunctor( rSrc.maGetterFunctor ),
+ maSetterFunctor( rSrc.maSetterFunctor )
+ {}
+
+ template< class T > explicit UnaryFunctionAccessorAdapter( T const& accessor ) :
+ maAccessor( accessor ),
+ maGetterFunctor(),
+ maSetterFunctor()
+ {}
+
+ template< class T > UnaryFunctionAccessorAdapter( T accessor,
+ GetterFunctor getterFunctor,
+ SetterFunctor setterFunctor) :
+ maAccessor( accessor ),
+ maGetterFunctor( getterFunctor ),
+ maSetterFunctor( setterFunctor )
+ {}
+
+ // -------------------------------------------------------
+
+ WrappedAccessor const& getWrappedAccessor() const { return maAccessor; }
+ WrappedAccessor& getWrappedAccessor() { return maAccessor; }
+
+ // -------------------------------------------------------
+
+ value_type getter(typename GetterFunctor::argument_type v) const
+ {
+ return maGetterFunctor(v);
+ }
+ typename SetterFunctor::result_type setter(argument_type v) const
+ {
+ return maSetterFunctor(v);
+ }
+
+ // -------------------------------------------------------
+
+ template< class Iterator >
+ value_type operator()(Iterator const& i) const
+ {
+ return maGetterFunctor( maAccessor(i) );
+ }
+
+ template< class Iterator, class Difference >
+ value_type operator()(Iterator const& i, Difference const& diff) const
+ {
+ return maGetterFunctor( maAccessor(i,diff) );
+ }
+
+ // -------------------------------------------------------
+
+ template< typename V, class Iterator >
+ void set(V const& value, Iterator const& i) const
+ {
+ maAccessor.set(
+ maSetterFunctor(
+ vigra::detail::RequiresExplicitCast<argument_type>::cast(value) ),
+ i );
+ }
+
+ template< typename V, class Iterator, class Difference >
+ void set(V const& value, Iterator const& i, Difference const& diff) const
+ {
+ maAccessor.set(
+ maSetterFunctor(
+ vigra::detail::RequiresExplicitCast<argument_type>::cast(value) ),
+ i,
+ diff );
+ }
+
+};
+
+//-----------------------------------------------------------------------------
+
+/** Interpose given accessor's set methods with a binary function,
+ taking both old and new value.
+
+ The wrappee's getter methods kept as-is.
+
+ @tpl WrappedAccessor
+ Wrapped type must provide the usual get and set accessor methods,
+ with the usual signatures (see StandardAccessor for a conforming
+ example). Furthermore, must provide a nested typedef value_type.
+
+ @tpl SetterFunctor
+ An adaptable binary function (i.e. providing nested typedefs for
+ result_type and first and second argument type)
+ */
+template< class WrappedAccessor,
+ typename SetterFunctor > class BinarySetterFunctionAccessorAdapter
+{
+public:
+ typedef typename WrappedAccessor::value_type value_type;
+ typedef typename SetterFunctor::second_argument_type argument_type;
+
+#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+// making all members public, if no member template friends
+private:
+ template<class A, typename S> friend class BinarySetterFunctionAccessorAdapter;
+#endif
+
+ WrappedAccessor maAccessor;
+ SetterFunctor maFunctor;
+
+public:
+ BinarySetterFunctionAccessorAdapter() :
+ maAccessor(),
+ maFunctor()
+ {}
+
+ template< class A > explicit
+ BinarySetterFunctionAccessorAdapter(
+ BinarySetterFunctionAccessorAdapter< A,
+ SetterFunctor > const& rSrc ) :
+ maAccessor( rSrc.maAccessor ),
+ maFunctor( rSrc.maFunctor )
+ {}
+
+ template< class T > explicit BinarySetterFunctionAccessorAdapter( T const& accessor ) :
+ maAccessor( accessor ),
+ maFunctor()
+ {}
+
+ template< class T > BinarySetterFunctionAccessorAdapter( T accessor,
+ SetterFunctor functor ) :
+ maAccessor( accessor ),
+ maFunctor( functor )
+ {}
+
+ // -------------------------------------------------------
+
+ WrappedAccessor const& getWrappedAccessor() const { return maAccessor; }
+ WrappedAccessor& getWrappedAccessor() { return maAccessor; }
+
+ // -------------------------------------------------------
+
+ typename SetterFunctor::result_type setter(
+ typename SetterFunctor::first_argument_type v1,
+ argument_type v2 ) const
+ {
+ return maSetterFunctor(v1,v2);
+ }
+
+ // -------------------------------------------------------
+
+ template< class Iterator >
+ value_type operator()(Iterator const& i) const
+ {
+ return maAccessor(i);
+ }
+
+ template< class Iterator, class Difference >
+ value_type operator()(Iterator const& i, Difference const& diff) const
+ {
+ return maAccessor(i,diff);
+ }
+
+ // -------------------------------------------------------
+
+ template< typename V, class Iterator >
+ void set(V const& value, Iterator const& i) const
+ {
+ maAccessor.set(
+ maFunctor(maAccessor(i),
+ vigra::detail::RequiresExplicitCast<argument_type>::cast(value)),
+ i );
+ }
+
+ template< typename V, class Iterator, class Difference >
+ void set(V const& value, Iterator const& i, Difference const& diff) const
+ {
+ maAccessor.set(
+ maFunctor(maAccessor(i,diff),
+ vigra::detail::RequiresExplicitCast<argument_type>::cast(value)),
+ i,
+ diff );
+ }
+
+};
+
+//-----------------------------------------------------------------------------
+
+/** Write through a CompositeIterator's first wrapped iterator, by
+ piping the first wrapped iterator value, the second iterator
+ value, and the specified new value through a ternary function.
+
+ Passed iterator must fulfill the CompositeIterator concept. Note
+ that the getter/setter methods are not templatized regarding the
+ iterator type, to make the mask calculation optimization below
+ safe (see the maskedAccessor template metafunction below)
+
+ @tpl WrappedAccessor1
+ Wrapped type must provide the usual get and set accessor methods,
+ with the usual signatures (see StandardAccessor for a conforming
+ example). Furthermore, the type must provide a nested typedef
+ value_type (the selection of WrappedAccessor1 as the provider for
+ that typedef is rather arbitrary. Could have been
+ WrappedAccessor2, too. So sue me)
+
+ @tpl Functor
+ An adaptable ternary function (i.e. providing nested typedefs for
+ result_type and first, second and third argument type)
+ */
+template< class WrappedAccessor1,
+ class WrappedAccessor2,
+ typename Functor > class TernarySetterFunctionAccessorAdapter
+{
+public:
+ typedef typename WrappedAccessor1::value_type value_type;
+ typedef typename Functor::third_argument_type argument_type;
+
+#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+// making all members public, if no member template friends
+private:
+ template<class A1, class A2, typename F> friend class TernarySetterFunctionAccessorAdapter;
+#endif
+
+ WrappedAccessor1 ma1stAccessor;
+ WrappedAccessor2 ma2ndAccessor;
+ Functor maFunctor;
+
+public:
+ TernarySetterFunctionAccessorAdapter() :
+ ma1stAccessor(),
+ ma2ndAccessor(),
+ maFunctor()
+ {}
+
+ template< class T > explicit TernarySetterFunctionAccessorAdapter( T const& accessor ) :
+ ma1stAccessor( accessor ),
+ ma2ndAccessor(),
+ maFunctor()
+ {}
+
+ template< class A1, class A2 > explicit
+ TernarySetterFunctionAccessorAdapter(
+ TernarySetterFunctionAccessorAdapter< A1,
+ A2,
+ Functor > const& rSrc ) :
+ ma1stAccessor( rSrc.ma1stAccessor ),
+ ma2ndAccessor( rSrc.ma2ndAccessor ),
+ maFunctor( rSrc.maFunctor )
+ {}
+
+ template< class T1, class T2 >
+ TernarySetterFunctionAccessorAdapter( T1 accessor1,
+ T2 accessor2 ) :
+ ma1stAccessor( accessor1 ),
+ ma2ndAccessor( accessor2 ),
+ maFunctor()
+ {}
+
+ template< class T1, class T2 >
+ TernarySetterFunctionAccessorAdapter( T1 accessor1,
+ T2 accessor2,
+ Functor func ) :
+ ma1stAccessor( accessor1 ),
+ ma2ndAccessor( accessor2 ),
+ maFunctor( func )
+ {}
+
+ // -------------------------------------------------------
+
+ WrappedAccessor1 const& get1stWrappedAccessor() const { return ma1stAccessor; }
+ WrappedAccessor1& get1stWrappedAccessor() { return ma1stAccessor; }
+
+ WrappedAccessor2 const& get2ndWrappedAccessor() const { return ma2ndAccessor; }
+ WrappedAccessor2& get2ndWrappedAccessor() { return ma2ndAccessor; }
+
+ // -------------------------------------------------------
+
+ typename Functor::result_type setter(
+ typename Functor::first_argument_type v1,
+ typename Functor::second_argument_type v2,
+ argument_type v3 ) const
+ {
+ return maSetterFunctor(v1,v2,v3);
+ }
+
+ // -------------------------------------------------------
+
+ template< class Iterator >
+ value_type operator()(Iterator const& i) const
+ {
+ return ma1stAccessor(i.first());
+ }
+
+ template< class Iterator, class Difference >
+ value_type operator()(Iterator const& i, Difference const& diff) const
+ {
+ return ma1stAccessor(i.second(),diff);
+ }
+
+ // -------------------------------------------------------
+
+ template< typename V, class Iterator >
+ void set(V const& value, Iterator const& i) const
+ {
+ ma1stAccessor.set(
+ maFunctor(ma1stAccessor(i.first()),
+ ma2ndAccessor(i.second()),
+ vigra::detail::RequiresExplicitCast<argument_type>::cast(value)),
+ i.first() );
+ }
+
+ template< typename V, class Iterator, class Difference >
+ void set(V const& value, Iterator const& i, Difference const& diff) const
+ {
+ ma1stAccessor.set(
+ maFunctor(ma1stAccessor(i.first(), diff),
+ ma2ndAccessor(i.second(),diff),
+ vigra::detail::RequiresExplicitCast<argument_type>::cast(value)),
+ i.first(),
+ diff );
+ }
+
+};
+
+//-----------------------------------------------------------------------------
+
+/** Access two distinct images simultaneously
+
+ Passed iterator must fulfill the CompositeIterator concept
+ (i.e. wrap the two image's iterators into one
+ CompositeIterator). The getter and setter methods expect and
+ return a pair of values, with types equal to the two accessors
+ value types
+
+ @tpl WrappedAccessor1
+ Wrapped type must provide the usual get and set accessor methods,
+ with the usual signatures (see StandardAccessor for a conforming
+ example). Furthermore, the type must provide a nested typedef
+ value_type.
+
+ @tpl WrappedAccessor2
+ Wrapped type must provide the usual get and set accessor methods,
+ with the usual signatures (see StandardAccessor for a conforming
+ example). Furthermore, the type must provide a nested typedef
+ value_type.
+ */
+template< class WrappedAccessor1,
+ class WrappedAccessor2 > class JoinImageAccessorAdapter
+{
+public:
+ // TODO(F3): Need numeric traits and a few free functions to
+ // actually calculate with a pair (semantic: apply every operation
+ // individually to the contained types)
+ typedef std::pair<typename WrappedAccessor1::value_type,
+ typename WrappedAccessor2::value_type> value_type;
+
+#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+// making all members public, if no member template friends
+private:
+ template<class A1, class A2> friend class JoinImageAccessorAdapter;
+#endif
+
+ WrappedAccessor1 ma1stAccessor;
+ WrappedAccessor2 ma2ndAccessor;
+
+public:
+ JoinImageAccessorAdapter() :
+ ma1stAccessor(),
+ ma2ndAccessor()
+ {}
+
+ template< class T > explicit JoinImageAccessorAdapter( T const& accessor ) :
+ ma1stAccessor( accessor ),
+ ma2ndAccessor()
+ {}
+
+ template< class A1, class A2 > explicit
+ JoinImageAccessorAdapter(
+ JoinImageAccessorAdapter< A1,
+ A2 > const& rSrc ) :
+ ma1stAccessor( rSrc.ma1stAccessor ),
+ ma2ndAccessor( rSrc.ma2ndAccessor )
+ {}
+
+ template< class T1, class T2 >
+ JoinImageAccessorAdapter( T1 accessor1,
+ T2 accessor2 ) :
+ ma1stAccessor( accessor1 ),
+ ma2ndAccessor( accessor2 )
+ {}
+
+ // -------------------------------------------------------
+
+ WrappedAccessor1 const& get1stWrappedAccessor() const { return ma1stAccessor; }
+ WrappedAccessor1& get1stWrappedAccessor() { return ma1stAccessor; }
+
+ WrappedAccessor2 const& get2ndWrappedAccessor() const { return ma2ndAccessor; }
+ WrappedAccessor2& get2ndWrappedAccessor() { return ma2ndAccessor; }
+
+ // -------------------------------------------------------
+
+ template< class Iterator >
+ value_type operator()(Iterator const& i) const
+ {
+ return std::make_pair(ma1stAccessor(i.first()),
+ ma2ndAccessor(i.second()));
+ }
+
+ template< class Iterator, class Difference >
+ value_type operator()(Iterator const& i, Difference const& diff) const
+ {
+ return std::make_pair(ma1stAccessor(i.first(),diff),
+ ma2ndAccessor(i.second(),diff));
+ }
+
+ // -------------------------------------------------------
+
+ template< typename V, class Iterator >
+ void set(V const& value, Iterator const& i) const
+ {
+ ma1stAccessor.set(
+ vigra::detail::RequiresExplicitCast<typename WrappedAccessor1::value_type>::cast(
+ value.first),
+ i.first() );
+ ma2ndAccessor.set(
+ vigra::detail::RequiresExplicitCast<typename WrappedAccessor2::value_type>::cast(
+ value.second),
+ i.second() );
+ }
+
+ template< typename V, class Iterator, class Difference >
+ void set(V const& value, Iterator const& i, Difference const& diff) const
+ {
+ ma1stAccessor.set(
+ vigra::detail::RequiresExplicitCast<typename WrappedAccessor1::value_type>::cast(
+ value.first),
+ i.first(),
+ diff );
+ ma2ndAccessor.set(
+ vigra::detail::RequiresExplicitCast<typename WrappedAccessor2::value_type>::cast(
+ value.second),
+ i.second(),
+ diff );
+ }
+
+};
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_ACCESSORADAPTERS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/accessorfunctors.hxx b/include/basebmp/accessorfunctors.hxx
new file mode 100644
index 000000000000..58550b010512
--- /dev/null
+++ b/include/basebmp/accessorfunctors.hxx
@@ -0,0 +1,181 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_ACCESSORFUNCTORS_HXX
+#define INCLUDED_BASEBMP_ACCESSORFUNCTORS_HXX
+
+#include <osl/diagnose.h>
+#include <basebmp/metafunctions.hxx>
+
+#include <functional>
+
+namespace basebmp
+{
+
+// Some common accessor functors
+// ------------------------------------------------------------
+
+
+/// combine two values via XOR
+template< typename T > struct XorFunctor : public std::binary_function<T,T,T>
+{
+ T operator()( T v1, T v2 ) const { return v1 ^ v2; }
+};
+
+//-----------------------------------------------------------------------------
+
+/// Base class, passing on the arg types
+template< typename T, typename M > struct MaskFunctorBase :
+ public TernaryFunctorBase<T,M,T,T> {};
+
+
+/** Let a mask flag decide between two values
+
+ @tpl polarity
+ Mask polarity. When true, a false in the mask denotes
+ transparency, i.e. the original value will display. And vice
+ versa.
+ */
+template< typename T,
+ typename M,
+ bool polarity > struct GenericOutputMaskFunctor : public MaskFunctorBase<T,M>
+{
+ /// Ternary mask operation - selects v1 for !m == polarity, v2 otherwise
+ T operator()( T v1, M m, T v2 ) const
+ {
+ return !m == polarity ? v1 : v2;
+ }
+};
+
+/** Let a mask bit decide between two values (specialization for
+ integer mask types)
+ */
+template< typename T,
+ typename M,
+ bool polarity > struct IntegerOutputMaskFunctor;
+template< typename T,
+ typename M > struct IntegerOutputMaskFunctor<T,M,true> : public MaskFunctorBase<T,M>
+{
+ /** Mask v with state of m
+
+ @return v2, if m != 0, v1 otherwise.
+ */
+ T operator()( T v1, M m, T v2 ) const
+ {
+ typedef typename make_unsigned<T>::type unsigned_T;
+
+ // mask will be 0, iff m == 0, and 1 otherwise
+ const T mask( unsigned_cast<T>(m | -m) >> (sizeof(unsigned_T)*8 - 1) );
+ return v1*(M)(1-mask) + v2*mask;
+ }
+};
+template< typename T,
+ typename M > struct IntegerOutputMaskFunctor<T,M,false> : public MaskFunctorBase<T,M>
+{
+ /** Mask v with state of m
+
+ @return v2, if m != 0, v1 otherwise.
+ */
+ T operator()( T v1, M m, T v2 ) const
+ {
+ typedef typename make_unsigned<T>::type unsigned_T;
+
+ // mask will be 0, iff m == 0, and 1 otherwise
+ const T mask( unsigned_cast<T>(m | -m) >> (sizeof(unsigned_T)*8 - 1) );
+ return v1*mask + v2*(M)(1-mask);
+ }
+};
+
+/** Let a mask bit decide between two values (specialization for
+ binary-valued mask types)
+ */
+template< typename T, typename M, bool polarity > struct FastIntegerOutputMaskFunctor;
+template< typename T, typename M > struct FastIntegerOutputMaskFunctor<T,M,true> :
+ public MaskFunctorBase<T,M>
+{
+ /// Specialization, only valid if mask can only attain 0 or 1
+ T operator()( T v1, M m, T v2 ) const
+ {
+ OSL_ASSERT(m<=1);
+
+ return v1*(M)(1-m) + v2*m;
+ }
+};
+template< typename T, typename M > struct FastIntegerOutputMaskFunctor<T,M,false> :
+ public MaskFunctorBase<T,M>
+{
+ /// Specialization, only valid if mask can only attain 0 or 1
+ T operator()( T v1, M m, T v2 ) const
+ {
+ OSL_ASSERT(m<=1);
+
+ return v1*m + v2*(M)(1-m);
+ }
+};
+
+//-----------------------------------------------------------------------------
+
+/** Split a pair value from a JoinImageAccessorAdapter into its
+ individual values, and pass it on to a ternary functor
+
+ This wrapper is an adaptable binary functor, and can thus be used
+ with a BinarySetterFunctionAccessorAdapter. Useful e.g. for
+ out-of-image alpha channel, or a masked image.
+
+ @tpl Functor
+ An adaptable ternary functor (as can e.g. be passed to the
+ TernarySetterFunctionAccessorAdapter)
+ */
+template< typename Functor > struct BinaryFunctorSplittingWrapper :
+ public std::binary_function<typename Functor::first_argument_type,
+ std::pair<typename Functor::third_argument_type,
+ typename Functor::second_argument_type>,
+ typename Functor::result_type>
+{
+#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+// making all members public, if no member template friends
+private:
+ template<class A> friend struct BinaryFunctorSplittingWrapper;
+#endif
+ Functor maFunctor;
+
+public:
+ BinaryFunctorSplittingWrapper() : maFunctor() {}
+
+ template< class A > explicit
+ BinaryFunctorSplittingWrapper(
+ BinaryFunctorSplittingWrapper<A> const& src ) : maFunctor(src.maFunctor) {}
+
+ template< class F > explicit
+ BinaryFunctorSplittingWrapper( F const& func ) : maFunctor(func) {}
+
+ typename Functor::result_type operator()(
+ typename Functor::first_argument_type v1,
+ std::pair< typename Functor::third_argument_type,
+ typename Functor::second_argument_type > const& v2 ) const
+ {
+ return maFunctor( v1, v2.second, v2.first );
+ }
+};
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_ACCESSORFUNCTORS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/accessortraits.hxx b/include/basebmp/accessortraits.hxx
new file mode 100644
index 000000000000..4ce9e6926e35
--- /dev/null
+++ b/include/basebmp/accessortraits.hxx
@@ -0,0 +1,124 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_ACCESSORTRAITS_HXX
+#define INCLUDED_BASEBMP_ACCESSORTRAITS_HXX
+
+#include <basebmp/accessorfunctors.hxx>
+#include <basebmp/accessoradapters.hxx>
+#include <basebmp/metafunctions.hxx>
+
+#include <functional>
+
+namespace basebmp
+{
+
+struct FastMask;
+struct NoFastMask;
+
+/// Metafunction to select output mask functor from iterator and mask value type
+template< typename T, typename M, bool polarity, typename DUMMY > struct outputMaskFunctorSelector : public
+ ifBothScalarIntegral< T, M,
+ IntegerOutputMaskFunctor< T, M, polarity >,
+ GenericOutputMaskFunctor< T, M, polarity > >
+{
+};
+template< typename T, typename M, bool polarity > struct outputMaskFunctorSelector< T, M, polarity, FastMask > : public
+ ifBothScalarIntegral< T, M,
+ FastIntegerOutputMaskFunctor< T, M, polarity >,
+ GenericOutputMaskFunctor< T, M, polarity > >
+{
+};
+
+/** Metafunction providing a point of configuration for iterators
+ capable of employing the fast output mask functor.
+
+ Specialize this metafunction for your case, and pass FastMask to
+ the outputMaskFunctorSelector.
+ */
+template< class Accessor,
+ class MaskAccessor,
+ class Iterator,
+ class MaskIterator,
+ bool polarity > struct maskedAccessorSelector
+{
+ typedef TernarySetterFunctionAccessorAdapter<
+ Accessor,
+ MaskAccessor,
+ typename outputMaskFunctorSelector<
+ typename Accessor::value_type,
+ typename MaskAccessor::value_type,
+ polarity,
+ NoFastMask > ::type >
+ type;
+};
+
+//-----------------------------------------------------------------------------
+
+/** Traits template for Accessor
+
+ Provides wrapped types for color lookup, raw pixel access, xor and
+ mask accessors.
+ */
+template< class Accessor > struct AccessorTraits
+{
+ /// value type of described accessor
+ typedef typename Accessor::value_type value_type;
+
+ /// Retrieve stand-alone color lookup function for given Accessor type
+ typedef project2nd< Accessor, value_type > color_lookup;
+
+ /// Retrieve raw pixel data accessor for given Accessor type
+ typedef Accessor raw_accessor;
+
+ /// Retrieve wrapped accessor for XOR setter access
+ typedef BinarySetterFunctionAccessorAdapter<
+ Accessor,
+ XorFunctor< value_type > > xor_accessor;
+
+ /** Retrieve masked accessor for given types
+
+ A masked accessor works like a filter, where the mask gates
+ the accessor's setter methods (if the mask contains a 0 at a
+ given iterator position, the original value is
+ preserved. Otherwise, the new value gets set).
+
+ @attention be careful when retrieving a masked accessor for a
+ set of types, and using it for a different one - there are
+ partial specializations that take an optimized functor for
+ certain mask accessors.
+ */
+ template< class MaskAccessor,
+ class Iterator,
+ class MaskIterator,
+ bool polarity > struct masked_accessor :
+ public maskedAccessorSelector< Accessor,
+ MaskAccessor,
+ Iterator,
+ MaskIterator,
+ polarity >
+ {};
+
+};
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_ACCESSORTRAITS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/basebmpdllapi.h b/include/basebmp/basebmpdllapi.h
new file mode 100644
index 000000000000..c44eee01ce7b
--- /dev/null
+++ b/include/basebmp/basebmpdllapi.h
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_BASEBMPDLLAPI_H
+#define INCLUDED_BASEBMP_BASEBMPDLLAPI_H
+
+#if defined BASEBMP_DLLIMPLEMENTATION
+#define BASEBMP_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define BASEBMP_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define BASEBMP_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif /* INCLUDED_BASEBMP_BASEBMPDLLAPI_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/bitmapdevice.hxx b/include/basebmp/bitmapdevice.hxx
new file mode 100644
index 000000000000..941b01c840c3
--- /dev/null
+++ b/include/basebmp/bitmapdevice.hxx
@@ -0,0 +1,719 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_BITMAPDEVICE_HXX
+#define INCLUDED_BASEBMP_BITMAPDEVICE_HXX
+
+#include <sal/types.h>
+#include <basebmp/drawmodes.hxx>
+#include <basebmp/basebmpdllapi.h>
+
+#include <boost/scoped_ptr.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/shared_array.hpp>
+#include <boost/enable_shared_from_this.hpp>
+#include <boost/noncopyable.hpp>
+#include <vector>
+
+namespace basegfx
+{
+ class B2IPoint;
+ class B2DPoint;
+ class B2IVector;
+ class B2IBox;
+ class B2DPolygon;
+ class B2DPolyPolygon;
+}
+
+namespace basebmp
+{
+
+// Temporary. Use like the tools color object
+class Color;
+typedef boost::shared_ptr< class BitmapDevice > BitmapDeviceSharedPtr;
+typedef boost::shared_ptr< struct IBitmapDeviceDamageTracker > IBitmapDeviceDamageTrackerSharedPtr;
+typedef boost::shared_array< sal_uInt8 > RawMemorySharedArray;
+typedef boost::shared_ptr< const std::vector<Color> > PaletteMemorySharedVector;
+
+struct ImplBitmapDevice;
+
+/// Interface for getting damage tracking events
+struct IBitmapDeviceDamageTracker
+{
+ /// gets called when said region is clobbered
+ virtual void damaged(const basegfx::B2IBox& rDamageRect) const = 0;
+
+protected:
+ ~IBitmapDeviceDamageTracker() {}
+};
+
+/** Definition of BitmapDevice interface
+
+ Use the createBitmapDevice() function to create instances.
+
+ Implementation note: the clip mask and bitmap parameter instances
+ of BitmapDevice that are passed to individual BitmapDevice
+ instances work best with 1 bit grey masks for the clip and a
+ format matching that of the target BitmapDevice for the other
+ parameters. The alpha mask passed to the drawMaskedColor() methods
+ works best when given as an eight bit grey bitmap. Everything else
+ is accepted, but potentially slow.
+ */
+class BASEBMP_DLLPUBLIC BitmapDevice : public boost::enable_shared_from_this<BitmapDevice>,
+ private boost::noncopyable
+{
+public:
+ /** Query size of device in pixel columns (X) and rows (Y, "scanlines")
+ */
+ basegfx::B2IVector getSize() const;
+
+ /** Query whether buffer starts with 0th scanline
+
+ @return true, if the buffer memory starts with the 0th
+ scanline, and false if it starts with the last one. The latter
+ is e.g. the typical scan line ordering for the Windows BMP
+ format.
+ */
+ bool isTopDown() const;
+
+ /** Query the size of the whole frame buffer
+
+ @ return the size of the whole frame buffer, the same as
+ getSize() unless this is a "subset" device.
+ */
+ basegfx::B2IVector getBufferSize() const;
+
+ /** Query type of scanline memory format
+ */
+ sal_Int32 getScanlineFormat() const;
+
+ /** Query byte offset to get from scanline n to scanline n+1
+
+ @return the scanline stride in bytes.
+ */
+ sal_Int32 getScanlineStride() const;
+
+ /** Get pointer to frame buffer
+
+ @return a shared ptr to the bitmap buffer memory. As this is a
+ shared ptr, you can freely store and use the pointer, even
+ after this object has been deleted.
+ */
+ RawMemorySharedArray getBuffer() const;
+
+ /// Query current damage tracking object (if any)
+ IBitmapDeviceDamageTrackerSharedPtr getDamageTracker() const;
+
+ /** Set new damage tracking object
+
+ @param rDamage
+ Object implementing the IBitmapDeviceDamageTracker interface -
+ everytime some area of the surface gets clobbered, that object
+ gets notified.
+ */
+ void setDamageTracker( const IBitmapDeviceDamageTrackerSharedPtr& rDamage );
+
+ /** Get pointer to palette
+
+ The returned pointer is const on purpose, since the
+ BitmapDevice might internally cache lookup information. Don't
+ modify the returned data, unless you want to enter the realm
+ of completely undefined behaviour.
+
+ @return shared pointer to vector of Color entries.
+ */
+ PaletteMemorySharedVector getPalette() const;
+
+ /** Clear whole device with given color
+
+ This method works like a fill with the given color value,
+ resulting in a bitmap uniformly colored in fillColor.
+ */
+ void clear( Color fillColor );
+
+ /** Set given pixel to specified color
+
+ @param rPt
+ Pixel to set
+
+ @param pixelColor
+ Color value to set the pixel to
+
+ @param drawMode
+ Draw mode to use when changing the pixel value
+ */
+ void setPixel( const basegfx::B2IPoint& rPt,
+ Color pixelColor,
+ DrawMode drawMode );
+
+ /** Set given pixel to specified color
+
+ @param rPt
+ Pixel to set
+
+ @param pixelColor
+ Color value to set the pixel to
+
+ @param drawMode
+ Draw mode to use when changing the pixel value
+
+ @param rClip
+ Clip mask to use. If the clip mask is 1 at the given pixel
+ position, no change will take place.
+ */
+ void setPixel( const basegfx::B2IPoint& rPt,
+ Color pixelColor,
+ DrawMode drawMode,
+ const BitmapDeviceSharedPtr& rClip );
+
+ /** Get color value at given pixel
+ */
+ Color getPixel( const basegfx::B2IPoint& rPt );
+
+ /** Get underlying pixel data value at given position
+
+ This method returns the raw pixel data. In the case of
+ paletted bitmaps, this is the palette index, not the final
+ color value.
+ */
+ sal_uInt32 getPixelData( const basegfx::B2IPoint& rPt );
+
+ /** Draw a line
+
+ @param rPt1
+ Start point of the line
+
+ @param rPt2
+ End point of the line. If the analytical line from rP1 to rPt2
+ (with the actual pixel positions assumed to be the center of
+ the pixel) is exactly in the middle between two pixel, this
+ method always selects the pixel closer to rPt1.
+
+ @param lineColor
+ Color value to draw the line with
+
+ @param drawMode
+ Draw mode to use when changing the pixel value
+ */
+ void drawLine( const basegfx::B2IPoint& rPt1,
+ const basegfx::B2IPoint& rPt2,
+ Color lineColor,
+ DrawMode drawMode );
+
+ /** Draw a line
+
+ @param rPt1
+ Start point of the line
+
+ @param rPt2
+ End point of the line. If the analytical line from rP1 to rPt2
+ (with the actual pixel positions assumed to be the center of
+ the pixel) is exactly in the middle between two pixel, this
+ method always selects the pixel closer to rPt1.
+
+ @param lineColor
+ Color value to draw the line with
+
+ @param drawMode
+ Draw mode to use when changing the pixel value
+
+ @param rClip
+ Clip mask to use. Pixel where the corresponding clip mask
+ pixel is 1 will not be modified.
+ */
+ void drawLine( const basegfx::B2IPoint& rPt1,
+ const basegfx::B2IPoint& rPt2,
+ Color lineColor,
+ DrawMode drawMode,
+ const BitmapDeviceSharedPtr& rClip );
+
+ /** Draw a polygon
+
+ @param rPoly
+ Polygon to draw. Depending on the value returned by rPoly's
+ isClosed() method, the resulting line polygon will be drawn
+ closed or not.
+
+ @param lineColor
+ Color value to draw the polygon with
+
+ @param drawMode
+ Draw mode to use when changing pixel values
+ */
+ void drawPolygon( const basegfx::B2DPolygon& rPoly,
+ Color lineColor,
+ DrawMode drawMode );
+
+ /** Draw a polygon
+
+ @param rPoly
+ Polygon to draw. Depending on the value returned by rPoly's
+ isClosed() method, the resulting line polygon will be drawn
+ closed or not.
+
+ @param lineColor
+ Color value to draw the polygon with
+
+ @param drawMode
+ Draw mode to use when changing pixel values
+
+ @param rClip
+ Clip mask to use. Pixel where the corresponding clip mask
+ pixel is 1 will not be modified.
+ */
+ void drawPolygon( const basegfx::B2DPolygon& rPoly,
+ Color lineColor,
+ DrawMode drawMode,
+ const BitmapDeviceSharedPtr& rClip );
+
+ /** Fill a poly-polygon
+
+ @param rPoly
+ Poly-polygon to fill. Regardless of the value returned by
+ rPoly's isClosed() method, the resulting filled poly-polygon
+ is always considered closed. As usual, when filling a shape,
+ the rightmost and bottommost pixel are not filled, compared to
+ the drawPolygon() method. For example, the rectangle
+ (0,0),(1,1) will have four pixel set, when drawn via
+ drawPolygon(), and only one pixel, when filled via
+ fillPolyPolygon().
+
+ @param fillColor
+ Color value to fill the poly-polygon with
+
+ @param drawMode
+ Draw mode to use when changing pixel values
+ */
+ void fillPolyPolygon( const basegfx::B2DPolyPolygon& rPoly,
+ Color fillColor,
+ DrawMode drawMode );
+
+ /** Fill a poly-polygon
+
+ @param rPoly
+ Poly-polygon to fill. Regardless of the value returned by
+ rPoly's isClosed() method, the resulting filled poly-polygon
+ is always considered closed. As usual, when filling a shape,
+ the rightmost and bottommost pixel are not filled, compared to
+ the drawPolygon() method. For example, the rectangle
+ (0,0),(1,1) will have four pixel set, when drawn via
+ drawPolygon(), and only one pixel, when filled via
+ fillPolyPolygon().
+
+ @param fillColor
+ Color value to fill the poly-polygon with
+
+ @param drawMode
+ Draw mode to use when changing pixel values
+
+ @param rClip
+ Clip mask to use. Pixel where the corresponding clip mask
+ pixel is 1 will not be modified.
+ */
+ void fillPolyPolygon( const basegfx::B2DPolyPolygon& rPoly,
+ Color fillColor,
+ DrawMode drawMode,
+ const BitmapDeviceSharedPtr& rClip );
+
+ /** Draw another bitmap into this device
+
+ @param rSrcBitmap
+ Bitmap to render into this one. It is permitted that source
+ and destination bitmap are the same.
+
+ @param rSrcRect
+ Rectangle within the source bitmap to take the pixel from.
+
+ @param rDstRect
+ Rectangle in the destination bitmap to put the pixel
+ into. Source and destination rectangle are permitted to have
+ differing sizes; this method will scale the source pixel
+ accordingly. Please note that both source and destination
+ rectangle are interpreted excluding the rightmost pixel column
+ and the bottommost pixel row, this is much like polygon
+ filling. As a result, filling a given rectangle with
+ fillPolyPolygon(), and using the same rectangle as the
+ destination rectangle of this method, will affect exactly the
+ same set of pixel.
+
+ @param drawMode
+ Draw mode to use when changing pixel values
+ */
+ void drawBitmap( const BitmapDeviceSharedPtr& rSrcBitmap,
+ const basegfx::B2IBox& rSrcRect,
+ const basegfx::B2IBox& rDstRect,
+ DrawMode drawMode );
+
+ /** Draw another bitmap into this device
+
+ @param rSrcBitmap
+ Bitmap to render into this one. It is permitted that source
+ and destination bitmap are the same.
+
+ @param rSrcRect
+ Rectangle within the source bitmap to take the pixel from.
+
+ @param rDstRect
+ Rectangle in the destination bitmap to put the pixel
+ into. Source and destination rectangle are permitted to have
+ differing sizes; this method will scale the source pixel
+ accordingly. Please note that both source and destination
+ rectangle are interpreted excluding the rightmost pixel column
+ and the bottommost pixel row, this is much like polygon
+ filling. As a result, filling a given rectangle with
+ fillPolyPolygon(), and using the same rectangle as the
+ destination rectangle of this method, will affect exactly the
+ same set of pixel.
+
+ @param drawMode
+ Draw mode to use when changing pixel values
+
+ @param rClip
+ Clip mask to use. Pixel where the corresponding clip mask
+ pixel is 1 will not be modified.
+ */
+ void drawBitmap( const BitmapDeviceSharedPtr& rSrcBitmap,
+ const basegfx::B2IBox& rSrcRect,
+ const basegfx::B2IBox& rDstRect,
+ DrawMode drawMode,
+ const BitmapDeviceSharedPtr& rClip );
+
+ /** Draw a color with an alpha-modulation bitmap into this device
+
+ This method takes a fixed color value, and an alpha mask. For
+ each pixel in the alpha mask, the given color value is blended
+ with the corresponding alpha value against the content of this
+ object.
+
+ @param aSrcColor
+ Color value to use for blending
+
+ @param rAlphaMask
+ Alpha mask to use for blending. It is permitted that alpha
+ mask and this bitmap are the same object.
+
+ @param rSrcRect
+ Rectangle within the alpha mask to take the pixel from.
+ Please note that the destination rectangle is interpreted
+ excluding the rightmost pixel column and the bottommost pixel
+ row, this is much like polygon filling. As a result, filling a
+ given rectangle with fillPolyPolygon(), and using the same
+ rectangle as the source rectangle of this method, will affect
+ exactly the same set of pixel.
+
+ @param rDstPoint
+ Destination point, where to start placing the pixel from the
+ source rectangle
+ */
+ void drawMaskedColor( Color aSrcColor,
+ const BitmapDeviceSharedPtr& rAlphaMask,
+ const basegfx::B2IBox& rSrcRect,
+ const basegfx::B2IPoint& rDstPoint );
+
+ /** Draw a color with an alpha-modulation bitmap into this device
+
+ This method takes a fixed color value, and an alpha mask. For
+ each pixel in the alpha mask, the given color value is blended
+ with the corresponding alpha value against the content of this
+ object.
+
+ @param aSrcColor
+ Color value to use for blending
+
+ @param rAlphaMask
+ Alpha mask to use for blending. It is permitted that alpha
+ mask and this bitmap are the same object.
+
+ @param rSrcRect
+ Rectangle within the alpha mask to take the pixel from.
+ Please note that the destination rectangle is interpreted
+ excluding the rightmost pixel column and the bottommost pixel
+ row, this is much like polygon filling. As a result, filling a
+ given rectangle with fillPolyPolygon(), and using the same
+ rectangle as the source rectangle of this method, will affect
+ exactly the same set of pixel.
+
+ @param rDstPoint
+ Destination point, where to start placing the pixel from the
+ source rectangle
+
+ @param rClip
+ Clip mask to use. Pixel where the corresponding clip mask
+ pixel is 1 will not be modified.
+ */
+ void drawMaskedColor( Color aSrcColor,
+ const BitmapDeviceSharedPtr& rAlphaMask,
+ const basegfx::B2IBox& rSrcRect,
+ const basegfx::B2IPoint& rDstPoint,
+ const BitmapDeviceSharedPtr& rClip );
+
+ /** Draw another bitmap through a mask into this device
+
+ This method renders a source bitmap into this device, much
+ like the drawBitmap() method. The only difference is the
+ additional mask parameter, which operates much like an
+ additional clip mask: pixel with value zero in this mask
+ result in destination pixel not being modified.
+
+ @param rSrcBitmap
+ Bitmap to render into this one. It is permitted that source
+ and destination bitmap are the same.
+
+ @param rMask
+ Bitmap to use as a mask. Pixel with value != zero in this mask
+ will result in destination pixel not being affected by the
+ blit operation.
+
+ @param rSrcRect
+ Rectangle within the source bitmap to take the pixel from.
+
+ @param rDstRect
+ Rectangle in the destination bitmap to put the pixel
+ into. Source and destination rectangle are permitted to have
+ differing sizes; this method will scale the source pixel
+ accordingly. Please note that both source and destination
+ rectangle are interpreted excluding the rightmost pixel column
+ and the bottommost pixel row, this is much like polygon
+ filling. As a result, filling a given rectangle with
+ fillPolyPolygon(), and using the same rectangle as the
+ destination rectangle of this method, will affect exactly the
+ same set of pixel.
+
+ @param drawMode
+ Draw mode to use when changing pixel values
+ */
+ void drawMaskedBitmap( const BitmapDeviceSharedPtr& rSrcBitmap,
+ const BitmapDeviceSharedPtr& rMask,
+ const basegfx::B2IBox& rSrcRect,
+ const basegfx::B2IBox& rDstRect,
+ DrawMode drawMode );
+
+ /** Draw another bitmap through a mask into this device
+
+ This method renders a source bitmap into this device, much
+ like the drawBitmap() method. The only difference is the
+ additional mask parameter, which operates much like an
+ additional clip mask: pixel with value != zero in this mask
+ result in destination pixel not being modified.
+
+ @param rSrcBitmap
+ Bitmap to render into this one. It is permitted that source
+ and destination bitmap are the same.
+
+ @param rMask
+ Bitmap to use as a mask. Pixel with value != zero in this mask
+ will result in destination pixel not being affected by the
+ blit operation.
+
+ @param rSrcRect
+ Rectangle within the source bitmap to take the pixel from.
+
+ @param rDstRect
+ Rectangle in the destination bitmap to put the pixel
+ into. Source and destination rectangle are permitted to have
+ differing sizes; this method will scale the source pixel
+ accordingly. Please note that both source and destination
+ rectangle are interpreted excluding the rightmost pixel column
+ and the bottommost pixel row, this is much like polygon
+ filling. As a result, filling a given rectangle with
+ fillPolyPolygon(), and using the same rectangle as the
+ destination rectangle of this method, will affect exactly the
+ same set of pixel.
+
+ @param drawMode
+ Draw mode to use when changing pixel values
+
+ @param rClip
+ Clip mask to use. Pixel where the corresponding clip mask
+ pixel is 1 will not be modified.
+ */
+ void drawMaskedBitmap( const BitmapDeviceSharedPtr& rSrcBitmap,
+ const BitmapDeviceSharedPtr& rMask,
+ const basegfx::B2IBox& rSrcRect,
+ const basegfx::B2IBox& rDstRect,
+ DrawMode drawMode,
+ const BitmapDeviceSharedPtr& rClip );
+
+protected:
+ BASEBMP_DLLPRIVATE BitmapDevice( const basegfx::B2IBox& rBounds,
+ const basegfx::B2IVector& rBufferSize,
+ sal_Int32 nScanlineFormat,
+ sal_Int32 nScanlineStride,
+ sal_uInt8* pFirstScanline,
+ const RawMemorySharedArray& rMem,
+ const PaletteMemorySharedVector& rPalette );
+ BASEBMP_DLLPRIVATE virtual ~BitmapDevice();
+
+private:
+ BASEBMP_DLLPRIVATE virtual bool isCompatibleBitmap( const BitmapDeviceSharedPtr& bmp ) const = 0;
+ BASEBMP_DLLPRIVATE virtual bool isCompatibleClipMask( const BitmapDeviceSharedPtr& bmp ) const = 0;
+ BASEBMP_DLLPRIVATE virtual bool isCompatibleAlphaMask( const BitmapDeviceSharedPtr& bmp ) const = 0;
+
+ BASEBMP_DLLPRIVATE virtual void clear_i( Color fillColor,
+ const basegfx::B2IBox& rBounds ) = 0;
+
+ BASEBMP_DLLPRIVATE virtual void setPixel_i( const basegfx::B2IPoint& rPt,
+ Color lineColor,
+ DrawMode drawMode ) = 0;
+ BASEBMP_DLLPRIVATE virtual void setPixel_i( const basegfx::B2IPoint& rPt,
+ Color lineColor,
+ DrawMode drawMode,
+ const BitmapDeviceSharedPtr& rClip ) = 0;
+
+ BASEBMP_DLLPRIVATE virtual Color getPixel_i( const basegfx::B2IPoint& rPt ) = 0;
+
+ BASEBMP_DLLPRIVATE virtual sal_uInt32 getPixelData_i( const basegfx::B2IPoint& rPt ) = 0;
+
+ BASEBMP_DLLPRIVATE virtual void drawLine_i( const basegfx::B2IPoint& rPt1,
+ const basegfx::B2IPoint& rPt2,
+ const basegfx::B2IBox& rBounds,
+ Color lineColor,
+ DrawMode drawMode ) = 0;
+ BASEBMP_DLLPRIVATE virtual void drawLine_i( const basegfx::B2IPoint& rPt1,
+ const basegfx::B2IPoint& rPt2,
+ const basegfx::B2IBox& rBounds,
+ Color lineColor,
+ DrawMode drawMode,
+ const BitmapDeviceSharedPtr& rClip ) = 0;
+
+ BASEBMP_DLLPRIVATE virtual void drawPolygon_i( const basegfx::B2DPolygon& rPoly,
+ const basegfx::B2IBox& rBounds,
+ Color lineColor,
+ DrawMode drawMode ) = 0;
+ BASEBMP_DLLPRIVATE virtual void drawPolygon_i( const basegfx::B2DPolygon& rPoly,
+ const basegfx::B2IBox& rBounds,
+ Color lineColor,
+ DrawMode drawMode,
+ const BitmapDeviceSharedPtr& rClip ) = 0;
+
+ BASEBMP_DLLPRIVATE virtual void fillPolyPolygon_i( const basegfx::B2DPolyPolygon& rPoly,
+ Color fillColor,
+ DrawMode drawMode,
+ const basegfx::B2IBox& rBounds ) = 0;
+ BASEBMP_DLLPRIVATE virtual void fillPolyPolygon_i( const basegfx::B2DPolyPolygon& rPoly,
+ Color fillColor,
+ DrawMode drawMode,
+ const basegfx::B2IBox& rBounds,
+ const BitmapDeviceSharedPtr& rClip ) = 0;
+
+ // must work with *this == rSrcBitmap!
+ BASEBMP_DLLPRIVATE virtual void drawBitmap_i( const BitmapDeviceSharedPtr& rSrcBitmap,
+ const basegfx::B2IBox& rSrcRect,
+ const basegfx::B2IBox& rDstRect,
+ DrawMode drawMode ) = 0;
+ BASEBMP_DLLPRIVATE virtual void drawBitmap_i( const BitmapDeviceSharedPtr& rSrcBitmap,
+ const basegfx::B2IBox& rSrcRect,
+ const basegfx::B2IBox& rDstRect,
+ DrawMode drawMode,
+ const BitmapDeviceSharedPtr& rClip ) = 0;
+
+ // must work with *this == rSrcBitmap!
+ BASEBMP_DLLPRIVATE virtual void drawMaskedColor_i( Color rSrcColor,
+ const BitmapDeviceSharedPtr& rAlphaMask,
+ const basegfx::B2IBox& rSrcRect,
+ const basegfx::B2IPoint& rDstPoint ) = 0;
+ BASEBMP_DLLPRIVATE virtual void drawMaskedColor_i( Color rSrcColor,
+ const BitmapDeviceSharedPtr& rAlphaMask,
+ const basegfx::B2IBox& rSrcRect,
+ const basegfx::B2IPoint& rDstPoint,
+ const BitmapDeviceSharedPtr& rClip ) = 0;
+
+ // must work with *this == rSrcBitmap!
+ BASEBMP_DLLPRIVATE virtual void drawMaskedBitmap_i( const BitmapDeviceSharedPtr& rSrcBitmap,
+ const BitmapDeviceSharedPtr& rMask,
+ const basegfx::B2IBox& rSrcRect,
+ const basegfx::B2IBox& rDstRect,
+ DrawMode drawMode ) = 0;
+ BASEBMP_DLLPRIVATE virtual void drawMaskedBitmap_i( const BitmapDeviceSharedPtr& rSrcBitmap,
+ const BitmapDeviceSharedPtr& rMask,
+ const basegfx::B2IBox& rSrcRect,
+ const basegfx::B2IBox& rDstRect,
+ DrawMode drawMode,
+ const BitmapDeviceSharedPtr& rClip ) = 0;
+
+ BASEBMP_DLLPRIVATE virtual IBitmapDeviceDamageTrackerSharedPtr getDamageTracker_i() const = 0;
+ BASEBMP_DLLPRIVATE virtual void setDamageTracker_i( const IBitmapDeviceDamageTrackerSharedPtr& rDamage ) = 0;
+
+ BitmapDeviceSharedPtr getGenericRenderer() const;
+
+ boost::scoped_ptr< ImplBitmapDevice > mpImpl;
+};
+
+/** Function to create a BitmapDevice for given scanline format
+ */
+BitmapDeviceSharedPtr BASEBMP_DLLPUBLIC createBitmapDevice( const basegfx::B2IVector& rSize,
+ bool bTopDown,
+ sal_Int32 nScanlineFormat );
+
+/** Function to create a BitmapDevice for given scanline format
+ with the given palette
+
+ Note: the provided palette must have sufficient size, to satisfy
+ lookups for the whole range of pixel values from the specified
+ format.
+ */
+BitmapDeviceSharedPtr BASEBMP_DLLPUBLIC createBitmapDevice( const basegfx::B2IVector& rSize,
+ bool bTopDown,
+ sal_Int32 nScanlineFormat,
+ const PaletteMemorySharedVector& rPalette );
+
+/** Function to create a BitmapDevice for given scanline format
+ from the given piece of raw memory and palette
+
+ Note: the provided memory must have sufficient size, to store the
+ image of the specified area and format.
+ */
+BitmapDeviceSharedPtr BASEBMP_DLLPUBLIC createBitmapDevice( const basegfx::B2IVector& rSize,
+ bool bTopDown,
+ sal_Int32 nScanlineFormat,
+ const RawMemorySharedArray& rMem,
+ const PaletteMemorySharedVector& rPalette );
+
+
+/** Function to retrieve a subsetted BitmapDevice to the same
+ memory.
+
+ Note that there is no coordinate system translation or offsetting
+ involved.
+
+ This method creates a second bitmap device instance, which renders
+ to the same memory as the original, with the same pixel coordinate
+ pairs refering to the same pixels in the memory buffer, but with
+ rendering clipped to a rectangular area. Useful to implement
+ rectangular clips (usually faster than setting up a 1bpp clip
+ mask).
+
+ */
+BitmapDeviceSharedPtr BASEBMP_DLLPUBLIC subsetBitmapDevice( const BitmapDeviceSharedPtr& rProto,
+ const basegfx::B2IBox& rSubset );
+
+/** Function to clone a BitmapDevice from a given prototype.
+
+ All attributes (like scanline format and top-down state) are
+ copied, only the size can be varied. Note that the prototype's
+ bitmap content is <em>not</em> copied, only a palette (if any).
+ */
+BitmapDeviceSharedPtr BASEBMP_DLLPUBLIC cloneBitmapDevice( const basegfx::B2IVector& rSize,
+ const BitmapDeviceSharedPtr& rProto );
+
+}
+
+#endif /* INCLUDED_BASEBMP_BITMAPDEVICE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/clippedlinerenderer.hxx b/include/basebmp/clippedlinerenderer.hxx
new file mode 100644
index 000000000000..92ca167730f5
--- /dev/null
+++ b/include/basebmp/clippedlinerenderer.hxx
@@ -0,0 +1,411 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_CLIPPEDLINERENDERER_HXX
+#define INCLUDED_BASEBMP_CLIPPEDLINERENDERER_HXX
+
+#include <basegfx/tools/rectcliptools.hxx>
+#include <basegfx/point/b2ipoint.hxx>
+#include <basegfx/range/b2ibox.hxx>
+
+#include <vigra/diff2d.hxx>
+#include <vigra/iteratortraits.hxx>
+
+namespace basebmp
+{
+
+// factored-out bresenham setup code, which is used from two different
+// places in renderClippedLine() below. Admittedly messy for the long
+// parameter list...
+inline bool prepareClip( sal_Int32 a1,
+ sal_Int32 a2,
+ sal_Int32 b1,
+ sal_Int32 da,
+ sal_Int32 db,
+ sal_Int32& o_as,
+ sal_Int32& o_bs,
+ int sa,
+ int sb,
+ sal_Int32& io_rem,
+ int& o_n,
+ sal_uInt32 clipCode1,
+ sal_uInt32 clipCount1,
+ sal_uInt32 clipCode2,
+ sal_uInt32 clipCount2,
+ sal_Int32 aMin,
+ sal_uInt32 aMinFlag,
+ sal_Int32 aMax,
+ sal_uInt32 aMaxFlag,
+ sal_Int32 bMin,
+ sal_uInt32 bMinFlag,
+ sal_Int32 bMax,
+ sal_uInt32 bMaxFlag,
+ bool bRoundTowardsPt2,
+ bool& o_bUseAlternateBresenham )
+{
+ int ca(0), cb(0);
+ if( clipCode1 )
+ {
+ if( clipCode1 & aMinFlag )
+ {
+ ca = 2*db*(aMin - a1);
+ o_as = aMin;
+ }
+ else if( clipCode1 & aMaxFlag )
+ {
+ ca = 2*db*(a1 - aMax);
+ o_as = aMax;
+ }
+
+ if( clipCode1 & bMinFlag )
+ {
+ cb = 2*da*(bMin - b1);
+ o_bs = bMin;
+ }
+ else if( clipCode1 & bMaxFlag )
+ {
+ cb = 2*da*(b1 - bMax);
+ o_bs = bMax;
+ }
+
+ if( clipCount1 == 2 )
+ clipCode1 &= (ca + da < cb + !bRoundTowardsPt2) ? ~(aMinFlag|aMaxFlag) : ~(bMinFlag|bMaxFlag);
+
+ if( clipCode1 & (aMinFlag|aMaxFlag) )
+ {
+ cb = (ca + da - !bRoundTowardsPt2) / (2*da);
+
+ if( sb >= 0 )
+ {
+ o_bs = b1 + cb;
+ if( o_bs > bMax )
+ return false; // fully clipped
+ }
+ else
+ {
+ o_bs = b1 - cb;
+ if( o_bs < bMin )
+ return false; // fully clipped
+ }
+
+ io_rem += ca - 2*da*cb;
+ }
+ else
+ {
+ ca = (cb - da + 2*db - bRoundTowardsPt2) / (2*db);
+ if( sa >= 0 )
+ {
+ o_as = a1 + ca;
+ if( o_as > aMax )
+ return false; // fully clipped
+ }
+ else
+ {
+ o_as = a1 - ca;
+ if( o_as < aMin )
+ return false; // fully clipped
+ }
+
+ io_rem += 2*db*ca - cb;
+ }
+ }
+ else
+ {
+ o_as = a1; o_bs = b1;
+ }
+
+ if( clipCode2 )
+ {
+ if( clipCount2 == 2 )
+ {
+ ca = 2*db*((clipCode2 & aMinFlag) ? a1 - aMin : aMax - a1);
+ cb = 2*da*((clipCode2 & bMinFlag) ? b1 - bMin : bMax - b1);
+ clipCode2 &= (cb + da < ca + bRoundTowardsPt2) ? ~(aMinFlag|aMaxFlag) : ~(bMinFlag|bMaxFlag);
+ }
+
+ if( clipCode2 & (aMinFlag|aMaxFlag) )
+ o_n = (clipCode2 & aMinFlag) ? o_as - aMin : aMax - o_as;
+ else
+ {
+ o_n = (clipCode2 & bMinFlag) ? o_bs - bMin : bMax - o_bs;
+ o_bUseAlternateBresenham = true;
+ }
+ }
+ else
+ o_n = (a2 >= o_as) ? a2 - o_as : o_as - a2;
+
+ return true; // at least one pixel to render
+}
+
+
+/** Render line to image iterators, clip against given rectangle
+
+ This method renders a line from aPt1 to aPt2, clipped against
+ rClipRect (the clipping will take place pixel-perfect, i.e. as if
+ the original bresenham-rendered line would have been clipped each
+ pixel individually. No slight shifts compared to unclipped lines).
+
+ @param aPt1
+ Start point of the line
+
+ @param aPt2
+ End point of the line
+
+ @param rClipRect
+ Rectangle to clip against
+
+ @param color
+ Color value to render the line with
+
+ @param begin
+ left-top image iterator
+
+ @param end
+ right-bottom image iterator
+
+ @param acc
+ Image accessor
+
+ @param bRoundTowardsPt2
+ Rounding mode to use. Giving false here results in line pixel tend
+ towards pt1, i.e. when a pixel exactly hits the middle between two
+ pixel, the pixel closer to pt1 will be chosen. Giving true here
+ makes renderClippedLine() choose pt2 in those cases.
+ */
+template< class Iterator, class Accessor >
+void renderClippedLine( basegfx::B2IPoint aPt1,
+ basegfx::B2IPoint aPt2,
+ const basegfx::B2IBox& rClipRect,
+ typename Accessor::value_type color,
+ Iterator begin,
+ Accessor acc,
+ bool bRoundTowardsPt2=false )
+{
+ // Algorithm according to Steven Eker's 'Pixel-perfect line clipping',
+ // Graphics Gems V, pp. 314-322
+ sal_uInt32 clipCode1 = basegfx::tools::getCohenSutherlandClipFlags(aPt1,
+ rClipRect);
+ sal_uInt32 clipCode2 = basegfx::tools::getCohenSutherlandClipFlags(aPt2,
+ rClipRect);
+
+ if( clipCode1 & clipCode2 )
+ return; // line fully clipped away, both endpoints share a half-plane
+
+ sal_uInt32 clipCount1 = basegfx::tools::getNumberOfClipPlanes(clipCode1);
+ sal_uInt32 clipCount2 = basegfx::tools::getNumberOfClipPlanes(clipCode2);
+
+ if( (clipCode1 != 0 && clipCode2 == 0)
+ || (clipCount1 == 2 && clipCount2 == 1) )
+ {
+ std::swap(clipCount2,clipCount1);
+ std::swap(clipCode2,clipCode1);
+ std::swap(aPt1,aPt2);
+ bRoundTowardsPt2 = !bRoundTowardsPt2;
+ }
+
+ const sal_Int32 x1 = aPt1.getX();
+ const sal_Int32 x2 = aPt2.getX();
+ const sal_Int32 y1 = aPt1.getY();
+ const sal_Int32 y2 = aPt2.getY();
+
+ // TODO(E1): This might overflow
+ sal_Int32 adx = x2 - x1;
+ int sx = 1;
+ if( adx < 0 )
+ {
+ adx *= -1;
+ sx = -1;
+ }
+
+ // TODO(E1): This might overflow
+ sal_Int32 ady = y2 - y1;
+ int sy = 1;
+ if( ady < 0 )
+ {
+ ady *= -1;
+ sy = -1;
+ }
+
+ int n = 0;
+ sal_Int32 xs = x1;
+ sal_Int32 ys = y1;
+ bool bUseAlternateBresenham=false;
+ if( adx >= ady )
+ {
+ // semi-horizontal line
+ sal_Int32 rem = 2*ady - adx - !bRoundTowardsPt2;
+
+ if( !prepareClip(x1, x2, y1, adx, ady, xs, ys, sx, sy,
+ rem, n, clipCode1, clipCount1, clipCode2, clipCount2,
+ rClipRect.getMinX(), basegfx::tools::RectClipFlags::LEFT,
+ rClipRect.getMaxX()-1, basegfx::tools::RectClipFlags::RIGHT,
+ rClipRect.getMinY(), basegfx::tools::RectClipFlags::TOP,
+ rClipRect.getMaxY()-1, basegfx::tools::RectClipFlags::BOTTOM,
+ bRoundTowardsPt2, bUseAlternateBresenham ) )
+ return; // line fully clipped away, no active pixel inside rect
+
+ Iterator currIter( begin + vigra::Diff2D(0,ys) );
+ typename vigra::IteratorTraits<Iterator>::row_iterator
+ rowIter( currIter.rowIterator() + xs );
+
+ adx *= 2;
+ ady *= 2;
+
+ if( bUseAlternateBresenham )
+ {
+ while(true)
+ {
+ acc.set(color, rowIter);
+
+ if( rem >= 0 )
+ {
+ // this is intended - we clip endpoint against y
+ // plane, so n here denotes y range to render
+ if( --n < 0 )
+ break;
+
+ ys += sy;
+ xs += sx;
+ rem -= adx;
+
+ currIter.y += sy;
+ rowIter = currIter.rowIterator() + xs;
+ }
+ else
+ {
+ xs += sx;
+ rowIter += sx;
+ }
+
+ rem += ady;
+ }
+ }
+ else
+ {
+ while(true)
+ {
+ acc.set(color, rowIter);
+
+ if( --n < 0 )
+ break;
+
+ if( rem >= 0 )
+ {
+ ys += sy;
+ xs += sx;
+ rem -= adx;
+
+ currIter.y += sy;
+ rowIter = currIter.rowIterator() + xs;
+ }
+ else
+ {
+ xs += sx;
+ rowIter += sx;
+ }
+
+ rem += ady;
+ }
+ }
+ }
+ else
+ {
+ // semi-vertical line
+ sal_Int32 rem = 2*adx - ady - !bRoundTowardsPt2;
+
+ if( !prepareClip(y1, y2, x1, ady, adx, ys, xs, sy, sx,
+ rem, n, clipCode1, clipCount1, clipCode2, clipCount2,
+ rClipRect.getMinY(), basegfx::tools::RectClipFlags::TOP,
+ rClipRect.getMaxY()-1, basegfx::tools::RectClipFlags::BOTTOM,
+ rClipRect.getMinX(), basegfx::tools::RectClipFlags::LEFT,
+ rClipRect.getMaxX()-1, basegfx::tools::RectClipFlags::RIGHT,
+ bRoundTowardsPt2, bUseAlternateBresenham ) )
+ return; // line fully clipped away, no active pixel inside rect
+
+ Iterator currIter( begin + vigra::Diff2D(xs,0) );
+ typename vigra::IteratorTraits<Iterator>::column_iterator
+ colIter( currIter.columnIterator() + ys );
+
+ adx *= 2;
+ ady *= 2;
+
+ if( bUseAlternateBresenham )
+ {
+ while(true)
+ {
+ acc.set(color, colIter);
+
+ if( rem >= 0 )
+ {
+ // this is intended - we clip endpoint against x
+ // plane, so n here denotes x range to render
+ if( --n < 0 )
+ break;
+
+ xs += sx;
+ ys += sy;
+ rem -= ady;
+
+ currIter.x += sx;
+ colIter = currIter.columnIterator() + ys;
+ }
+ else
+ {
+ ys += sy;
+ colIter += sy;
+ }
+
+ rem += adx;
+ }
+ }
+ else
+ {
+ while(true)
+ {
+ acc.set(color, colIter);
+
+ if( --n < 0 )
+ break;
+
+ if( rem >= 0 )
+ {
+ xs += sx;
+ ys += sy;
+ rem -= ady;
+
+ currIter.x += sx;
+ colIter = currIter.columnIterator() + ys;
+ }
+ else
+ {
+ ys += sy;
+ colIter += sy;
+ }
+
+ rem += adx;
+ }
+ }
+ }
+}
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_CLIPPEDLINERENDERER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/color.hxx b/include/basebmp/color.hxx
new file mode 100644
index 000000000000..52451fff7fed
--- /dev/null
+++ b/include/basebmp/color.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_COLOR_HXX
+#define INCLUDED_BASEBMP_COLOR_HXX
+
+#include <sal/types.h>
+#include <rtl/math.hxx>
+
+namespace basebmp
+{
+
+class Color
+{
+private:
+ sal_uInt32 mnColor;
+
+public:
+ typedef sal_uInt32 value_type;
+ typedef sal_uInt8 component_type;
+
+ Color() : mnColor(0) {}
+ explicit Color( sal_uInt32 nVal ) : mnColor(nVal) {}
+ Color( sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue ) :
+ mnColor( ((sal_uInt32)nRed << 16) | ((sal_uInt32)nGreen << 8) | nBlue )
+ {}
+
+ void setRed( sal_uInt8 nRed ) { mnColor &= ~0x00FF0000UL; mnColor |= (sal_uInt32)nRed << 16; }
+ void setGreen( sal_uInt8 nGreen ) { mnColor &= ~0x0000FF00UL; mnColor |= (sal_uInt32)nGreen << 8; }
+ void setBlue( sal_uInt8 nBlue ) { mnColor &= ~0x000000FFUL; mnColor |= nBlue; }
+
+ void setGrey( sal_uInt8 nGreyVal ) { mnColor = (sal_uInt32)nGreyVal << 16 | (sal_uInt32)nGreyVal << 8 | nGreyVal; }
+
+ sal_uInt8 getRed() const { return 0xFF & (sal_uInt8)(mnColor >> 16); }
+ sal_uInt8 getGreen() const { return 0xFF & (sal_uInt8)(mnColor >> 8); }
+ sal_uInt8 getBlue() const { return 0xFF & (sal_uInt8)mnColor; }
+
+ sal_uInt8 getGreyscale() const { return (sal_uInt8)((getBlue()*28UL +
+ getGreen()*151 +
+ getRed()*77) / 256); }
+
+ sal_uInt32 toInt32() const { return mnColor; }
+
+ bool operator!() const { return mnColor == 0; }
+ Color operator&( sal_uInt32 nMask ) const { return Color(mnColor & nMask); }
+ Color operator^( Color col ) const { return Color(col.getRed()^getRed(),
+ col.getGreen()^getGreen(),
+ col.getBlue()^getBlue()); }
+ Color operator-( Color col ) const { return Color((sal_uInt8)abs((int)getRed()-col.getRed()),
+ (sal_uInt8)abs((int)getGreen()-col.getGreen()),
+ (sal_uInt8)abs((int)getBlue()-col.getBlue())); }
+ Color operator+( Color col ) const { return Color(getRed()+col.getRed(),
+ getGreen()+col.getGreen(),
+ getBlue()+col.getBlue()); }
+ Color operator*( Color col ) const { return Color((sal_uInt8)((sal_uInt32)col.getRed()*getRed()/SAL_MAX_UINT8),
+ (sal_uInt8)((sal_uInt32)col.getGreen()*getGreen()/SAL_MAX_UINT8),
+ (sal_uInt8)((sal_uInt32)col.getBlue()*getBlue()/SAL_MAX_UINT8)); }
+ Color operator*( sal_uInt8 n ) const { return Color((sal_uInt8)((sal_uInt32)n*getRed()/SAL_MAX_UINT8),
+ (sal_uInt8)((sal_uInt32)n*getGreen()/SAL_MAX_UINT8),
+ (sal_uInt8)((sal_uInt32)n*getBlue()/SAL_MAX_UINT8)); }
+ Color operator*( double n ) const { return Color((sal_uInt8)(n*getRed()+.5),
+ (sal_uInt8)(n*getGreen()+.5),
+ (sal_uInt8)(n*getBlue()+.5)); }
+ bool operator==( const Color& rhs ) const { return (getRed()==rhs.getRed() &&
+ getGreen()==rhs.getGreen() &&
+ getBlue()==rhs.getBlue()); }
+ bool operator!=( const Color& rhs ) const { return !(*this==rhs); }
+ double magnitude() const { return sqrt((double)getRed()*getRed()
+ + getGreen()*getGreen()
+ + getBlue()*getBlue()); }
+};
+
+} // namespace vigra
+
+#endif /* INCLUDED_BASEBMP_COLOR_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/colorblendaccessoradapter.hxx b/include/basebmp/colorblendaccessoradapter.hxx
new file mode 100644
index 000000000000..c4511c709844
--- /dev/null
+++ b/include/basebmp/colorblendaccessoradapter.hxx
@@ -0,0 +1,142 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_COLORBLENDACCESSORADAPTER_HXX
+#define INCLUDED_BASEBMP_COLORBLENDACCESSORADAPTER_HXX
+
+#include <basebmp/colortraits.hxx>
+
+namespace basebmp
+{
+
+/** Accessor adapter that blends input value against fixed color value
+
+ Used to blend an alpha mask 'through' a fixed color value into the
+ destination.
+
+ The getter functors return a constant value (usually the zero of
+ the value type, this preserves the original destination content
+ when blitting through a mask) - there really isn't no other
+ sensible default behaviour for these methods.
+ */
+template< class WrappedAccessor,
+ typename AlphaType,
+ bool polarity > class ConstantColorBlendSetterAccessorAdapter
+{
+public:
+ typedef AlphaType alpha_type;
+ typedef AlphaType value_type;
+ typedef typename WrappedAccessor::value_type color_type;
+
+private:
+ typename ColorTraits< color_type >::
+ template blend_functor<alpha_type,polarity>::type maFunctor;
+ WrappedAccessor maWrappee;
+ color_type maBlendColor;
+ value_type maGetterValue;
+
+public:
+ ConstantColorBlendSetterAccessorAdapter() :
+ maFunctor(),
+ maWrappee(),
+ maBlendColor(),
+ maGetterValue()
+ {}
+
+ template< class T > explicit ConstantColorBlendSetterAccessorAdapter( T acc ) :
+ maFunctor(),
+ maWrappee(acc),
+ maBlendColor(),
+ maGetterValue()
+ {}
+
+ template< class T > ConstantColorBlendSetterAccessorAdapter( T acc,
+ color_type col ) :
+ maFunctor(),
+ maWrappee(acc),
+ maBlendColor(col),
+ maGetterValue()
+ {}
+
+ template< class T > ConstantColorBlendSetterAccessorAdapter( T acc,
+ color_type col,
+ value_type val ) :
+ maFunctor(),
+ maWrappee(acc),
+ maBlendColor(col),
+ maGetterValue(val)
+ {}
+
+ // -------------------------------------------------------
+
+ void setColor( color_type col ) { maBlendColor=col; }
+ color_type getColor() { return maBlendColor; }
+ void setGetterValue( value_type val ) { maGetterValue=val; }
+ value_type getGetterValue() { return maGetterValue; }
+
+ // -------------------------------------------------------
+
+ WrappedAccessor const& getWrappedAccessor() const { return maWrappee; }
+ WrappedAccessor& getWrappedAccessor() { return maWrappee; }
+
+ // -------------------------------------------------------
+
+ /// @return constant value, regardless of iterator content
+ template< typename IteratorType > value_type operator()(SAL_UNUSED_PARAMETER IteratorType const& ) const
+ {
+ return maGetterValue;
+ }
+ /// @return constant value, regardless of iterator content
+ template< typename IteratorType, class Difference >
+ value_type operator()(SAL_UNUSED_PARAMETER IteratorType const& , SAL_UNUSED_PARAMETER Difference const& ) const
+ {
+ return maGetterValue;
+ }
+
+ // -------------------------------------------------------
+
+ template< typename V, typename IteratorType >
+ void set(V const& value, IteratorType const& i) const
+ {
+ maWrappee.set(
+ maFunctor(
+ vigra::detail::RequiresExplicitCast<alpha_type>::cast(value),
+ maWrappee(i),
+ maBlendColor),
+ i );
+ }
+
+ template< typename V, typename IteratorType, class Difference >
+ void set(V const& value, IteratorType const& i, Difference const& diff) const
+ {
+ maWrappee.set(
+ maFunctor(
+ vigra::detail::RequiresExplicitCast<alpha_type>::cast(value),
+ maWrappee(i,diff),
+ maBlendColor),
+ i,
+ diff );
+ }
+};
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_COLORBLENDACCESSORADAPTER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/colormisc.hxx b/include/basebmp/colormisc.hxx
new file mode 100644
index 000000000000..d2142968d3ba
--- /dev/null
+++ b/include/basebmp/colormisc.hxx
@@ -0,0 +1,185 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_COLORMISC_HXX
+#define INCLUDED_BASEBMP_COLORMISC_HXX
+
+#include <osl/diagnose.h>
+#include <basebmp/color.hxx>
+#include <basebmp/colortraits.hxx>
+#include <basebmp/accessortraits.hxx>
+#include <vigra/mathutil.hxx>
+
+// Contents of this header moved out of color.hxx, as it is not useful
+// for the general public (drags in vigra and other template
+// functionality, that shouldn't be necessary for the ordinary client
+// of BitmapDevice etc.)
+
+namespace basebmp
+{
+
+template< bool polarity > struct ColorBitmaskOutputMaskFunctor;
+template<> struct ColorBitmaskOutputMaskFunctor<true> : MaskFunctorBase<Color,sal_uInt8>
+{
+ Color operator()( Color v1, sal_uInt8 m, Color v2 ) const
+ {
+ OSL_ASSERT(m<=1);
+
+ return Color(v1.toInt32()*(sal_uInt8)(1-m) + v2.toInt32()*m);
+ }
+};
+template<> struct ColorBitmaskOutputMaskFunctor<false> : MaskFunctorBase<Color,sal_uInt8>
+{
+ Color operator()( Color v1, sal_uInt8 m, Color v2 ) const
+ {
+ OSL_ASSERT(m<=1);
+
+ return Color(v1.toInt32()*m + v2.toInt32()*(sal_uInt8)(1-m));
+ }
+};
+
+/// Specialized output mask functor for Color value type
+template<bool polarity> struct outputMaskFunctorSelector< Color, sal_uInt8, polarity, FastMask >
+{
+ typedef ColorBitmaskOutputMaskFunctor<polarity> type;
+};
+
+template< bool polarity > struct ColorBlendFunctor8
+ : public TernaryFunctorBase<sal_uInt8,Color,Color,Color>
+{
+ Color operator()( sal_uInt8 alpha,
+ Color v1,
+ Color v2 ) const
+ {
+ alpha = polarity ? alpha : 255 - alpha;
+
+ const sal_uInt8 v1_red( v1.getRed() );
+ const sal_uInt8 v1_green( v1.getGreen() );
+ const sal_uInt8 v1_blue( v1.getBlue() );
+
+ // using '>> 8' instead of '/ 0x100' is ill-advised (shifted
+ // value might be negative). Better rely on decent optimizer
+ // here...
+ return Color(((((sal_Int32)v2.getRed() - v1_red)*alpha) / 0x100) + v1_red,
+ ((((sal_Int32)v2.getGreen() - v1_green)*alpha) / 0x100) + v1_green,
+ ((((sal_Int32)v2.getBlue() - v1_blue)*alpha) / 0x100) + v1_blue);
+ }
+};
+
+template< bool polarity > struct ColorBlendFunctor32
+ : public TernaryFunctorBase<Color,Color,Color,Color>
+{
+ Color operator()( Color input,
+ Color v1,
+ Color v2 ) const
+ {
+ sal_uInt8 alpha = input.getGreyscale();
+ alpha = polarity ? alpha : 255 - alpha;
+
+ const sal_uInt8 v1_red( v1.getRed() );
+ const sal_uInt8 v1_green( v1.getGreen() );
+ const sal_uInt8 v1_blue( v1.getBlue() );
+
+ // using '>> 8' instead of '/ 0x100' is ill-advised (shifted
+ // value might be negative). Better rely on decent optimizer
+ // here...
+ return Color(((((sal_Int32)v2.getRed() - v1_red)*alpha) / 0x100) + v1_red,
+ ((((sal_Int32)v2.getGreen() - v1_green)*alpha) / 0x100) + v1_green,
+ ((((sal_Int32)v2.getBlue() - v1_blue)*alpha) / 0x100) + v1_blue);
+ }
+};
+
+//-----------------------------------------------------------------------------
+
+template<> struct ColorTraits< Color >
+{
+ /// @return number of color channels
+ static int numChannels() { return 3; }
+
+ /// Type of a color component (i.e. the type of an individual channel)
+ typedef sal_uInt8 component_type;
+
+ /// Metafunction to select blend functor from color and alpha type
+ template< typename AlphaType, bool polarity > struct blend_functor;
+
+ /// Calculate normalized distance between color c1 and c2
+ static inline double distance( const Color& c1,
+ const Color& c2 )
+ {
+ return (c1 - c2).magnitude();
+ }
+
+ static inline component_type toGreyscale( const Color& c )
+ {
+ return c.getGreyscale();
+ }
+
+ static inline Color fromGreyscale( component_type c )
+ {
+ return Color(c,c,c);
+ }
+};
+
+/// The version for plain 8 bit alpha
+template<bool polarity> struct ColorTraits< Color >::blend_functor< sal_uInt8, polarity >
+{
+ typedef ColorBlendFunctor8<polarity> type;
+};
+
+/// The version taking grey value of a Color
+template<bool polarity> struct ColorTraits< Color >::blend_functor< Color, polarity >
+{
+ typedef ColorBlendFunctor32<polarity> type;
+};
+
+} // namespace basebmp
+
+namespace vigra
+{
+
+template<>
+struct NumericTraits<basebmp::Color>
+{
+ typedef basebmp::Color Type;
+ typedef basebmp::Color Promote;
+ typedef basebmp::Color RealPromote;
+ typedef std::complex<basebmp::Color> ComplexPromote;
+ typedef sal_uInt8 ValueType;
+
+ typedef VigraTrueType isIntegral;
+ typedef VigraFalseType isScalar;
+ typedef VigraTrueType isSigned;
+ typedef VigraTrueType isOrdered;
+ typedef VigraFalseType isComplex;
+
+ static Type zero() { return Type(); }
+ static Type one() { return Type(0x01010101); }
+ static Type nonZero() { return Type(0x01010101); }
+
+ static Promote toPromote(const Type& v) { return v; }
+ static RealPromote toRealPromote(const Type& v) { return v; }
+ static Type fromPromote(const Promote& v) { return v; }
+ static Type fromRealPromote(const RealPromote& v) { return v; }
+};
+
+} // namespace vigra
+
+#endif /* INCLUDED_BASEBMP_COLORMISC_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/colortraits.hxx b/include/basebmp/colortraits.hxx
new file mode 100644
index 000000000000..bcbc8f9b259d
--- /dev/null
+++ b/include/basebmp/colortraits.hxx
@@ -0,0 +1,144 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_COLORTRAITS_HXX
+#define INCLUDED_BASEBMP_COLORTRAITS_HXX
+
+#include <basebmp/accessoradapters.hxx>
+#include <basebmp/metafunctions.hxx>
+
+#include <vigra/mathutil.hxx>
+
+namespace basebmp
+{
+
+/** Functor template, to calculate alpha blending between two
+ values. Float case.
+
+ @tpl polarity
+ When true, 0 means fully transparent, and 1 fully opaque. And vice
+ versa.
+ */
+template< typename ValueType,
+ typename AlphaType,
+ bool polarity > struct BlendFunctor;
+template< typename ValueType,
+ typename AlphaType > struct BlendFunctor<ValueType,AlphaType,true>
+ : public TernaryFunctorBase<AlphaType,ValueType,ValueType,ValueType>
+{
+ ValueType operator()( AlphaType alpha,
+ ValueType v1,
+ ValueType v2 ) const
+ {
+ const typename vigra::NumericTraits<AlphaType>::RealPromote fAlpha(
+ vigra::NumericTraits<AlphaType>::toRealPromote(alpha));
+ return (vigra::NumericTraits<AlphaType>::one()-fAlpha)*v1 + fAlpha*v2;
+ }
+};
+template< typename ValueType,
+ typename AlphaType > struct BlendFunctor<ValueType,AlphaType,false>
+ : public TernaryFunctorBase<AlphaType,ValueType,ValueType,ValueType>
+{
+ ValueType operator()( AlphaType alpha,
+ ValueType v1,
+ ValueType v2 ) const
+ {
+ const typename vigra::NumericTraits<AlphaType>::RealPromote fAlpha(
+ vigra::NumericTraits<AlphaType>::toRealPromote(alpha));
+ return fAlpha*v1 + (vigra::NumericTraits<AlphaType>::one()-fAlpha)*v2;
+ }
+};
+
+/** Functor template, to calculate alpha blending between two
+ values. Integer case.
+
+ @tpl polarity
+ When true, 0 means fully transparent, and 1 fully opaque. And vice
+ versa.
+ */
+template< typename ValueType,
+ typename AlphaType,
+ bool polarity > struct IntegerBlendFunctor;
+template< typename ValueType,
+ typename AlphaType > struct IntegerBlendFunctor<ValueType,AlphaType,true>
+ : public TernaryFunctorBase<AlphaType,ValueType,ValueType,ValueType>
+{
+ ValueType operator()( AlphaType alpha,
+ ValueType v1,
+ ValueType v2 ) const
+ {
+ return (vigra::NumericTraits<AlphaType>::toPromote(
+ vigra::NumericTraits<AlphaType>::max()-alpha)*v1 + alpha*v2) /
+ vigra::NumericTraits<AlphaType>::max();
+ }
+};
+template< typename ValueType,
+ typename AlphaType > struct IntegerBlendFunctor<ValueType,AlphaType,false>
+ : public TernaryFunctorBase<AlphaType,ValueType,ValueType,ValueType>
+{
+ ValueType operator()( AlphaType alpha,
+ ValueType v1,
+ ValueType v2 ) const
+ {
+ return (alpha*v1 +
+ vigra::NumericTraits<AlphaType>::toPromote(
+ vigra::NumericTraits<AlphaType>::max()-alpha)*v2) /
+ vigra::NumericTraits<AlphaType>::max();
+ }
+};
+
+//-----------------------------------------------------------------------------
+
+template< typename ColorType > struct ColorTraits
+{
+ /// Metafunction to select blend functor from color and alpha type
+ template< typename AlphaType, bool polarity > struct blend_functor : public
+ ifScalarIntegral< AlphaType,
+ IntegerBlendFunctor< ColorType, AlphaType, polarity >,
+ BlendFunctor< ColorType, AlphaType, polarity > > {};
+
+ /// @return number of color channels
+ static int numChannels() { return 1; }
+
+ /// Type of a color component (i.e. the type of an individual channel)
+ typedef ColorType component_type;
+
+ /// Calculate normalized distance between color c1 and c2
+ static inline vigra::NormTraits<ColorType> distance( ColorType c1,
+ ColorType c2 )
+ {
+ return vigra::norm(c1 - c2);
+ }
+
+ static inline component_type toGreyscale( ColorType c )
+ {
+ return c;
+ }
+
+ static inline ColorType fromGreyscale( component_type c )
+ {
+ return c;
+ }
+};
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_COLORTRAITS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/compositeiterator.hxx b/include/basebmp/compositeiterator.hxx
new file mode 100644
index 000000000000..4fb9c10f0bb4
--- /dev/null
+++ b/include/basebmp/compositeiterator.hxx
@@ -0,0 +1,361 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_COMPOSITEITERATOR_HXX
+#define INCLUDED_BASEBMP_COMPOSITEITERATOR_HXX
+
+#include <sal/types.h>
+#include <osl/diagnose.h>
+
+#include <basebmp/nonstandarditerator.hxx>
+#include <vigra/tuple.hxx>
+#include <vigra/iteratortraits.hxx>
+
+
+namespace basebmp
+{
+
+namespace detail
+{
+ template< typename T1, typename T2 > class ArithmeticProxy
+ {
+ public:
+ ArithmeticProxy(T1& val1, T2& val2) :
+ mpVal1( &val1 ),
+ mpVal2( &val2 )
+ {}
+
+ void operator++() { ++(*mpVal1); ++(*mpVal2); }
+ void operator++(int) { (*mpVal1)++; (*mpVal2)++; }
+ void operator--() { --(*mpVal1); --(*mpVal2); }
+ void operator--(int) { (*mpVal1)--; (*mpVal2)--; }
+ void operator+=(int d) {*mpVal1+=d; *mpVal2+=d; }
+ void operator-=(int d) {*mpVal1-=d; *mpVal2-=d; }
+
+ bool operator==(ArithmeticProxy const & rhs) const
+ { return *mpVal1==*rhs.mpVal1 && *mpVal2==*rhs.mpVal2; }
+
+ bool operator!=(ArithmeticProxy const & rhs) const
+ { return *mpVal1!=*rhs.mpVal1 || *mpVal2!=*rhs.mpVal2; }
+
+ bool operator<(ArithmeticProxy const & rhs) const
+ { return *mpVal1<*rhs.mpVal1 && *mpVal2<*rhs.mpVal2; }
+
+ bool operator<=(ArithmeticProxy const & rhs) const
+ { return *mpVal1<=*rhs.mpVal1 && *mpVal2<=*rhs.mpVal2; }
+
+ bool operator>(ArithmeticProxy const & rhs) const
+ { return *mpVal1>*rhs.mpVal1 && *mpVal2>*rhs.mpVal2; }
+
+ bool operator>=(ArithmeticProxy const & rhs) const
+ { return *mpVal1>=*rhs.mpVal1 && *mpVal2>=*rhs.mpVal2; }
+
+ int operator-(ArithmeticProxy const & rhs) const
+ { return *mpVal1 - *rhs.mpVal1; }
+
+ private:
+ T1* mpVal1;
+ T2* mpVal2;
+ };
+
+ template< typename Iterator1,
+ typename Iterator2,
+ typename ValueType,
+ typename DifferenceType,
+ typename IteratorCategory,
+ class Derived >
+ class CompositeIteratorBase : public NonStandardIterator
+ {
+ public:
+ typedef Iterator1 iterator1_type;
+ typedef Iterator2 iterator2_type;
+ typedef ValueType value_type;
+ typedef DifferenceType difference_type;
+ typedef IteratorCategory iterator_category;
+
+ protected:
+ iterator1_type maIter1;
+ iterator2_type maIter2;
+
+ private:
+ bool equal(CompositeIteratorBase const & rhs) const
+ {
+ return (maIter1 == rhs.maIter1) && (maIter2 == rhs.maIter2);
+ }
+
+ public:
+ CompositeIteratorBase() :
+ maIter1(),
+ maIter2()
+ {}
+
+ CompositeIteratorBase( const iterator1_type& rIter1, const iterator2_type& rIter2 ) :
+ maIter1( rIter1 ),
+ maIter2( rIter2 )
+ {}
+
+ bool operator==(Derived const & rhs) const
+ {
+ return equal(rhs);
+ }
+
+ bool operator!=(Derived const & rhs) const
+ {
+ return !equal(rhs);
+ }
+
+ difference_type operator-(Derived const & rhs) const
+ {
+ OSL_ASSERT( maIter1 - rhs.maIter1 == maIter2 - rhs.maIter2 );
+ return maIter1 - rhs.maIter1;
+ }
+
+ Derived & operator+=(difference_type const & s)
+ {
+ maIter1 += s;
+ maIter2 += s;
+ return static_cast<Derived&>(*this);
+ }
+
+ Derived & operator-=(difference_type const & s)
+ {
+ maIter1 -= s;
+ maIter2 -= s;
+ return static_cast<Derived&>(*this);
+ }
+
+ Derived operator+(difference_type const & s) const
+ {
+ Derived ret(static_cast<Derived const&>(*this));
+ ret += s;
+ return ret;
+ }
+
+ Derived operator-(difference_type const & s) const
+ {
+ Derived ret(static_cast<Derived const&>(*this));
+ ret -= s;
+ return ret;
+ }
+
+ Derived& operator++()
+ {
+ ++maIter1;
+ ++maIter2;
+ return static_cast<Derived&>(*this);
+ }
+
+ Derived& operator--()
+ {
+ --maIter1;
+ --maIter2;
+ return static_cast<Derived&>(*this);
+ }
+
+ Derived operator++(int)
+ {
+ Derived ret(static_cast<Derived const&>(*this));
+ ++maIter1;
+ ++maIter2;
+ return ret;
+ }
+
+ Derived operator--(int)
+ {
+ Derived ret(static_cast<Derived const&>(*this));
+ --maIter1;
+ --maIter2;
+ return ret;
+ }
+
+ value_type get() const
+ {
+ return value_type(maIter1.get(),
+ maIter2.get());
+ }
+
+ value_type get(difference_type const & d) const
+ {
+ return value_type(maIter1.get(d),
+ maIter2.get(d));
+ }
+
+ void set( value_type v ) const
+ {
+ maIter1.set(v);
+ maIter2.set(v);
+ }
+
+ void set( value_type v, difference_type const & d ) const
+ {
+ maIter1.set(v,d);
+ maIter2.set(v,d);
+ }
+
+ const iterator1_type& first() const { return maIter1; }
+ iterator1_type& first() { return maIter1; }
+
+ const iterator2_type& second() const { return maIter2; }
+ iterator2_type& second() { return maIter2; }
+ };
+}
+
+/** Provide the composition of two 1D image iterators
+
+ Use this template to compose two iterators into one (e.g. image
+ and mask). Operations are transitive, e.g. operator== only returns
+ true, if both wrapped iterator operator== have yielded true.
+
+ Note that both iterators must have compatible difference types. To
+ avoid funny effects, iterator ranges given by a CompositeIterator
+ should consist of wrapped iterators of similar range
+ */
+template< typename Iterator1,
+ typename Iterator2,
+ typename ValueType,
+ typename DifferenceType,
+ typename IteratorCategory >
+class CompositeIterator1D :
+ public detail::CompositeIteratorBase< Iterator1,
+ Iterator2,
+ ValueType,
+ DifferenceType,
+ IteratorCategory,
+ CompositeIterator1D<Iterator1,
+ Iterator2,
+ ValueType,
+ DifferenceType,
+ IteratorCategory> >
+{
+ typedef detail::CompositeIteratorBase< Iterator1,
+ Iterator2,
+ ValueType,
+ DifferenceType,
+ IteratorCategory,
+ CompositeIterator1D<Iterator1,
+ Iterator2,
+ ValueType,
+ DifferenceType,
+ IteratorCategory> > base_type;
+public:
+ CompositeIterator1D() :
+ base_type()
+ {}
+
+ CompositeIterator1D( const Iterator1& rIter1,
+ const Iterator2& rIter2 ) :
+ base_type( rIter1, rIter2 )
+ {}
+};
+
+/** Provide the composition of two 2D image iterators
+
+ Use this template to compose two iterators into one (e.g. image
+ and mask). Operations are transitive, e.g. operator== only returns
+ true, if both wrapped iterator operator== have yielded true.
+
+ Note that both iterators must have compatible difference types. To
+ avoid funny effects, iterator ranges given by a CompositeIterator
+ should consist of wrapped iterators of similar range
+ */
+template< typename Iterator1, typename Iterator2 > class CompositeIterator2D :
+ public detail::CompositeIteratorBase< Iterator1,
+ Iterator2,
+ std::pair<
+ typename vigra::IteratorTraits<Iterator1>::value_type,
+ typename vigra::IteratorTraits<Iterator2>::value_type >,
+ typename vigra::IteratorTraits<Iterator1>::difference_type,
+ typename vigra::IteratorTraits<Iterator1>::iterator_category,
+ CompositeIterator2D<Iterator1, Iterator2> >
+{
+ typedef detail::CompositeIteratorBase< Iterator1,
+ Iterator2,
+ std::pair<
+ typename vigra::IteratorTraits<Iterator1>::value_type,
+ typename vigra::IteratorTraits<Iterator2>::value_type >,
+ typename vigra::IteratorTraits<Iterator1>::difference_type,
+ typename vigra::IteratorTraits<Iterator1>::iterator_category,
+ CompositeIterator2D<Iterator1, Iterator2> > base_type;
+public:
+ typedef CompositeIterator1D< typename Iterator1::row_iterator,
+ typename Iterator2::row_iterator,
+ typename base_type::value_type,
+ int,
+ typename base_type::iterator_category > row_iterator;
+ typedef CompositeIterator1D< typename Iterator1::column_iterator,
+ typename Iterator2::column_iterator,
+ typename base_type::value_type,
+ int,
+ typename base_type::iterator_category > column_iterator;
+
+ typedef detail::ArithmeticProxy< typename Iterator1::MoveX,
+ typename Iterator2::MoveX > MoveX;
+ typedef detail::ArithmeticProxy< typename Iterator1::MoveY,
+ typename Iterator2::MoveY > MoveY;
+
+ MoveX x;
+ MoveY y;
+
+ CompositeIterator2D() :
+ base_type(),
+ x(this->maIter1.x,this->maIter2.x),
+ y(this->maIter1.y,this->maIter2.y)
+ {}
+
+ CompositeIterator2D( const Iterator1& rIter1, const Iterator2& rIter2 ) :
+ base_type( rIter1, rIter2 ),
+ x(this->maIter1.x,this->maIter2.x),
+ y(this->maIter1.y,this->maIter2.y)
+ {}
+
+ CompositeIterator2D( const CompositeIterator2D& rOld ) :
+ base_type(rOld),
+ x(this->maIter1.x,this->maIter2.x),
+ y(this->maIter1.y,this->maIter2.y)
+ {}
+
+ CompositeIterator2D& operator=( const CompositeIterator2D& rNew )
+ {
+ this->maIter1 = rNew.maIter1;
+ this->maIter2 = rNew.maIter2;
+
+ x = MoveX(this->maIter1.x,
+ this->maIter2.x);
+ y = MoveY(this->maIter1.y,
+ this->maIter2.y);
+ }
+
+ row_iterator rowIterator() const
+ {
+ return row_iterator(this->maIter1.rowIterator(),
+ this->maIter2.rowIterator());
+ }
+
+ column_iterator columnIterator() const
+ {
+ return column_iterator(this->maIter1.columnIterator(),
+ this->maIter2.columnIterator());
+ }
+};
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_COMPOSITEITERATOR_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/debug.hxx b/include/basebmp/debug.hxx
new file mode 100644
index 000000000000..688daf41c834
--- /dev/null
+++ b/include/basebmp/debug.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_DEBUG_HXX
+#define INCLUDED_BASEBMP_DEBUG_HXX
+
+#include <iostream>
+#include <boost/shared_ptr.hpp>
+#include <basebmp/basebmpdllapi.h>
+
+namespace basebmp
+{
+ class BitmapDevice;
+
+ /** Dump content of BitmapDevice to given output stream.
+
+ @param rDevice
+ Device whose content should be dumped.
+
+ @param rOutputStream
+ Stream to write output to.
+
+ Used in vcl/headless/svpgdi.cxx when OSL_DEBUG_LEVEL > 2
+
+ Use like this:
+<pre>
+ #include <basebmp/debug.hxx>
+ #include <iostream>
+ #include <fstream>
+
+ std::ofstream output("/tmp/my_test.dump");
+ debugDump( pMyDevice, output );
+</pre>
+ */
+ void BASEBMP_DLLPUBLIC debugDump( const boost::shared_ptr< BitmapDevice >& rDevice,
+ ::std::ostream& rOutputStream );
+}
+
+#endif /* INCLUDED_BASEBMP_DEBUG_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/drawmodes.hxx b/include/basebmp/drawmodes.hxx
new file mode 100644
index 000000000000..a5f98ed3d418
--- /dev/null
+++ b/include/basebmp/drawmodes.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_DRAWMODES_HXX
+#define INCLUDED_BASEBMP_DRAWMODES_HXX
+
+/* Definition of Draw modes */
+
+namespace basebmp
+{
+ enum DrawMode
+ {
+ /** Default draw mode, which simply renders pixel in the
+ requested color
+ */
+ DrawMode_PAINT,
+
+ /** XOR draw mode, which XORs each existing pixel value with
+ the new color.
+
+ The result of this XOR operation strongly depends on the
+ underlying pixel format, as it is defined by the bitwise
+ XOR of the (potentially palette-looked-up) color value and
+ the existing pixel content (being it true color or a
+ palette index).
+ */
+ DrawMode_XOR
+ };
+}
+
+#endif /* INCLUDED_BASEBMP_DRAWMODES_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/endian.hxx b/include/basebmp/endian.hxx
new file mode 100644
index 000000000000..22c32b6077ac
--- /dev/null
+++ b/include/basebmp/endian.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_ENDIAN_HXX
+#define INCLUDED_BASEBMP_ENDIAN_HXX
+
+#include <osl/endian.h>
+
+namespace basebmp
+{
+
+/// Swap the order of bytes for the given POD type
+template< typename T > inline T byteSwap( T );
+
+#define BASEBMP_BYTE_SWAP(Type,SwapFunc) \
+ template<> inline Type byteSwap<Type>( Type v ) \
+ { \
+ return SwapFunc(v); \
+ }
+
+// byteSwap<T> shall fail for any type T not in the list below
+BASEBMP_BYTE_SWAP(sal_Int8,)
+BASEBMP_BYTE_SWAP(sal_uInt8,)
+BASEBMP_BYTE_SWAP(sal_Int16,OSL_SWAPWORD)
+BASEBMP_BYTE_SWAP(sal_uInt16,OSL_SWAPWORD)
+BASEBMP_BYTE_SWAP(sal_Int32,OSL_SWAPDWORD)
+BASEBMP_BYTE_SWAP(sal_uInt32,OSL_SWAPDWORD)
+
+#undef BASEBMP_BYTE_SWAP
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_ENDIAN_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/fillimage.hxx b/include/basebmp/fillimage.hxx
new file mode 100644
index 000000000000..815ec32539bf
--- /dev/null
+++ b/include/basebmp/fillimage.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_FILLIMAGE_HXX
+#define INCLUDED_BASEBMP_FILLIMAGE_HXX
+
+#include <vigra/tuple.hxx>
+#include <vigra/iteratortraits.hxx>
+
+namespace basebmp
+{
+
+template< class DestIterator, class DestAccessor, typename T >
+void fillImage( DestIterator begin,
+ DestIterator end,
+ DestAccessor ad,
+ T fillVal )
+{
+ const int width ( end.x - begin.x );
+ const int height( end.y - begin.y );
+
+ for( int y=0; y<height; ++y, ++begin.y )
+ {
+ typename vigra::IteratorTraits<DestIterator>::row_iterator
+ rowIter( begin.rowIterator() );
+ const typename vigra::IteratorTraits<DestIterator>::row_iterator
+ rowEnd( rowIter + width );
+
+ // TODO(P2): Provide specialized span fill methods on the
+ // iterator/accessor
+ while( rowIter != rowEnd )
+ ad.set(fillVal, rowIter++);
+ }
+}
+
+template< class DestIterator, class DestAccessor, typename T >
+inline void fillImage( vigra::triple<DestIterator,DestIterator,DestAccessor> const& src,
+ T fillVal )
+{
+ fillImage(src.first,src.second,src.third,fillVal);
+}
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_FILLIMAGE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/genericcolorimageaccessor.hxx b/include/basebmp/genericcolorimageaccessor.hxx
new file mode 100644
index 000000000000..5aaa95327176
--- /dev/null
+++ b/include/basebmp/genericcolorimageaccessor.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_GENERICCOLORIMAGEACCESSOR_HXX
+#define INCLUDED_BASEBMP_GENERICCOLORIMAGEACCESSOR_HXX
+
+#include <basebmp/color.hxx>
+#include <basebmp/bitmapdevice.hxx>
+
+namespace basebmp
+{
+ /** Access a BitmapDevice generically
+
+ This accessor deals with an opaque BitmapDevice generically,
+ via getPixel()/setPixel() at the published interface.
+ */
+ class GenericColorImageAccessor
+ {
+ BitmapDeviceSharedPtr mpDevice;
+ DrawMode meDrawMode;
+
+ public:
+ typedef Color value_type;
+
+ explicit GenericColorImageAccessor( BitmapDeviceSharedPtr const& rTarget ) :
+ mpDevice(rTarget),
+ meDrawMode(DrawMode_PAINT)
+ {}
+
+ GenericColorImageAccessor( BitmapDeviceSharedPtr const& rTarget,
+ DrawMode eDrawMode ) :
+ mpDevice(rTarget),
+ meDrawMode(eDrawMode)
+ {}
+
+ template< typename Iterator >
+ Color operator()( Iterator const& i ) const
+ { return mpDevice->getPixel( basegfx::B2IPoint( i->x,i->y ) ); }
+
+ template< typename Iterator, typename Difference >
+ Color operator()( Iterator const& i, Difference const& diff) const
+ { return mpDevice->getPixel( basegfx::B2IPoint( i[diff]->x,
+ i[diff]->y ) ); }
+
+ template< typename Iterator >
+ void set(Color const& value, Iterator const& i) const
+ { return mpDevice->setPixel( basegfx::B2IPoint( i->x,i->y ),
+ value, meDrawMode ); }
+
+ template< class Iterator, class Difference >
+ void set(value_type const& value, Iterator const& i, Difference const& diff) const
+ { return mpDevice->setPixel( basegfx::B2IPoint( i[diff]->x,
+ i[diff]->y ),
+ value, meDrawMode ); }
+ };
+}
+
+#endif /* INCLUDED_BASEBMP_GENERICCOLORIMAGEACCESSOR_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/greylevelformats.hxx b/include/basebmp/greylevelformats.hxx
new file mode 100644
index 000000000000..3fcd90fcda5f
--- /dev/null
+++ b/include/basebmp/greylevelformats.hxx
@@ -0,0 +1,129 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_GREYLEVELFORMATS_HXX
+#define INCLUDED_BASEBMP_GREYLEVELFORMATS_HXX
+
+#include <basebmp/color.hxx>
+#include <basebmp/colortraits.hxx>
+#include <basebmp/accessor.hxx>
+#include <basebmp/pixeliterator.hxx>
+#include <basebmp/packedpixeliterator.hxx>
+#include <basebmp/pixelformatadapters.hxx>
+#include <basebmp/metafunctions.hxx>
+
+#include <vigra/numerictraits.hxx>
+#include <vigra/metaprogramming.hxx>
+
+#include <functional>
+
+namespace basebmp
+{
+
+template< typename PixelType,
+ typename ColorType,
+ int UsedRange > struct GreylevelGetter :
+ public std::unary_function<PixelType, ColorType>
+{
+ ColorType operator()( PixelType const& c ) const
+ {
+ return ColorTraits<ColorType>::fromGreyscale(
+ vigra::NumericTraits<PixelType>::toPromote(c) *
+ vigra::NumericTraits<PixelType>::maxConst / UsedRange );
+ }
+};
+
+template< typename PixelType,
+ typename ColorType,
+ int UsedRange > struct GreylevelSetter :
+ public std::unary_function<ColorType, PixelType>
+{
+ PixelType operator()( ColorType const& c ) const
+ {
+ return vigra::NumericTraits<PixelType>::toPromote(
+ ColorTraits<ColorType>::toGreyscale(c)) *
+ UsedRange /
+ vigra::NumericTraits<PixelType>::maxConst;
+ }
+};
+
+//-----------------------------------------------------------------------------
+
+template< class Iterator,
+ class Accessor,
+ int UsedRange > struct PixelFormatTraitsTemplate_Greylevel
+{
+ typedef typename Iterator::value_type pixel_type;
+
+ typedef GreylevelGetter<pixel_type,
+ Color,
+ UsedRange> getter_type;
+ typedef GreylevelSetter<pixel_type,
+ Color,
+ UsedRange> setter_type;
+
+ typedef Iterator iterator_type;
+ typedef Accessor raw_accessor_type;
+ typedef AccessorSelector<
+ getter_type,
+ setter_type > accessor_selector;
+};
+
+template< int BitsPerPixel,
+ bool MsbFirst > struct PixelFormatTraitsTemplate_PackedGreylevel :
+ public PixelFormatTraitsTemplate_Greylevel<
+ PackedPixelIterator< sal_uInt8,
+ BitsPerPixel,
+ true >,
+ NonStandardAccessor< sal_uInt8 >,
+ (1UL << BitsPerPixel)-1 >
+{};
+
+//-----------------------------------------------------------------------------
+
+// 1bpp MSB
+typedef PixelFormatTraitsTemplate_PackedGreylevel<1, true> PixelFormatTraits_GREY1_MSB;
+
+// 1bpp LSB
+typedef PixelFormatTraitsTemplate_PackedGreylevel<1, false> PixelFormatTraits_GREY1_LSB;
+BASEBMP_SPECIALIZE_ACCESSORTRAITS(PixelFormatTraits_GREY1_MSB::getter_type,
+ PixelFormatTraits_GREY1_MSB::setter_type);
+
+
+// 4bpp MSB
+typedef PixelFormatTraitsTemplate_PackedGreylevel<4, true> PixelFormatTraits_GREY4_MSB;
+
+// 4bpp LSB
+typedef PixelFormatTraitsTemplate_PackedGreylevel<4, false> PixelFormatTraits_GREY4_LSB;
+BASEBMP_SPECIALIZE_ACCESSORTRAITS(PixelFormatTraits_GREY4_MSB::getter_type,
+ PixelFormatTraits_GREY4_MSB::setter_type);
+
+// 8bpp
+typedef PixelFormatTraitsTemplate_Greylevel<
+ PixelIterator< sal_uInt8 >,
+ StandardAccessor< sal_uInt8 >,
+ 255 > PixelFormatTraits_GREY8;
+BASEBMP_SPECIALIZE_ACCESSORTRAITS(PixelFormatTraits_GREY8::getter_type,
+ PixelFormatTraits_GREY8::setter_type);
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_GREYLEVELFORMATS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/iteratortraits.hxx b/include/basebmp/iteratortraits.hxx
new file mode 100644
index 000000000000..5d87df7d5a85
--- /dev/null
+++ b/include/basebmp/iteratortraits.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_ITERATORTRAITS_HXX
+#define INCLUDED_BASEBMP_ITERATORTRAITS_HXX
+
+#include <basebmp/accessor.hxx>
+#include <basebmp/nonstandarditerator.hxx>
+
+namespace basebmp
+{
+
+template< class Iterator > struct IteratorTraits
+{
+ /// VigraTrueType, if iterator does not provide *operator()/operator[] methods
+ typedef typename vigra::IsDerivedFrom<Iterator,NonStandardIterator>::result
+ isNonStandardIterator;
+
+ /// Retrieve default accessor for this iterator (and given value type)
+ template< typename ValueType > struct defaultAccessor : public
+ // select according to non-standardness of iterator type
+ vigra::If< isNonStandardIterator,
+ NonStandardAccessor< ValueType >,
+ StandardAccessor< ValueType > >
+ {};
+
+};
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_ITERATORTRAITS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/metafunctions.hxx b/include/basebmp/metafunctions.hxx
new file mode 100644
index 000000000000..e451dce8e4d9
--- /dev/null
+++ b/include/basebmp/metafunctions.hxx
@@ -0,0 +1,226 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_METAFUNCTIONS_HXX
+#define INCLUDED_BASEBMP_METAFUNCTIONS_HXX
+
+#include <boost/mpl/integral_c.hpp>
+#include <vigra/metaprogramming.hxx>
+#include <vigra/numerictraits.hxx>
+
+#include <functional>
+
+namespace basebmp
+{
+
+// TODO(Q3): move to generic place (o3tl?)
+
+/** template meta function: add const qualifier to 2nd type, if given
+ 1st type has it
+*/
+template<typename A, typename B> struct clone_const
+{
+ typedef B type;
+};
+template<typename A, typename B> struct clone_const<const A,B>
+{
+ typedef const B type;
+};
+
+/** template meta function: add const qualifier to plain type (if not
+ already there)
+ */
+template <typename T> struct add_const
+{
+ typedef const T type;
+};
+template <typename T> struct add_const<const T>
+{
+ typedef const T type;
+};
+
+/// template meta function: remove const qualifier from plain type
+template <typename T> struct remove_const
+{
+ typedef T type;
+};
+template <typename T> struct remove_const<const T>
+{
+ typedef T type;
+};
+
+//--------------------------------------------------------------
+
+/// Base class for an adaptable ternary functor
+template< typename A1, typename A2, typename A3, typename R > struct TernaryFunctorBase
+{
+ typedef A1 first_argument_type;
+ typedef A2 second_argument_type;
+ typedef A3 third_argument_type;
+ typedef R result_type;
+};
+
+//--------------------------------------------------------------
+
+/** template meta function: ensure that given integer type is unsigned
+
+ If given integer type is already unsigned, return as-is -
+ otherwise, convert to unsigned type of same or greater range.
+ */
+template< typename T > struct make_unsigned;
+
+#define BASEBMP_MAKE_UNSIGNED(T,U) \
+ template<> struct make_unsigned<T> { \
+ typedef U type; \
+ };
+
+BASEBMP_MAKE_UNSIGNED(signed char,unsigned char)
+BASEBMP_MAKE_UNSIGNED(unsigned char,unsigned char)
+BASEBMP_MAKE_UNSIGNED(short,unsigned short)
+BASEBMP_MAKE_UNSIGNED(unsigned short,unsigned short)
+BASEBMP_MAKE_UNSIGNED(int,unsigned int)
+BASEBMP_MAKE_UNSIGNED(unsigned int,unsigned int)
+BASEBMP_MAKE_UNSIGNED(long,unsigned long)
+BASEBMP_MAKE_UNSIGNED(unsigned long,unsigned long)
+
+#undef BASEBMP_MAKE_UNSIGNED
+
+/// cast integer to unsigned type of similar size
+template< typename T > inline typename make_unsigned<T>::type unsigned_cast( T value )
+{
+ return static_cast< typename make_unsigned<T>::type >(value);
+}
+
+//--------------------------------------------------------------
+
+/// returns true, if given number is strictly less than 0
+template< typename T > inline bool is_negative( T x )
+{
+ return x < 0;
+}
+
+/// Overload for ints (branch-free)
+inline bool is_negative( int x )
+{
+ // force logic shift (result for signed shift right is undefined)
+ return static_cast<unsigned int>(x) >> (sizeof(int)*8-1);
+}
+
+//--------------------------------------------------------------
+
+/// Results in VigraTrueType, if T is of integer type and scalar
+template< typename T, typename trueCase, typename falseCase >
+struct ifScalarIntegral
+{
+ typedef
+ typename vigra::If<
+ typename vigra::NumericTraits< T >::isIntegral,
+ typename vigra::If<
+ typename vigra::NumericTraits< T >::isScalar,
+ trueCase,
+ falseCase >::type,
+ falseCase >::type type;
+};
+
+/// Results in VigraTrueType, if T is of non-integer type and scalar
+template< typename T, typename trueCase, typename falseCase >
+struct ifScalarNonIntegral
+{
+ typedef
+ typename vigra::If<
+ typename vigra::NumericTraits< T >::isIntegral,
+ falseCase,
+ typename vigra::If<
+ typename vigra::NumericTraits< T >::isScalar,
+ trueCase,
+ falseCase >::type >::type type;
+};
+
+/// Results in VigraTrueType, if both T1 and T2 are of integer type and scalar
+template< typename T1, typename T2, typename trueCase, typename falseCase >
+struct ifBothScalarIntegral
+{
+ typedef
+ typename ifScalarIntegral<
+ T1,
+ typename ifScalarIntegral<
+ T2,
+ trueCase,
+ falseCase >::type,
+ falseCase >::type type;
+};
+
+//--------------------------------------------------------------
+
+/// Count number of trailing zeros
+template< unsigned int val > struct numberOfTrailingZeros
+{
+ enum { next = val >> 1 };
+ enum { value = vigra::IfBool< (val & 1) == 0,
+ numberOfTrailingZeros<next>,
+ boost::mpl::integral_c< int,-1 > > ::type::value + 1 };
+};
+
+template<> struct numberOfTrailingZeros<0>
+{
+ enum { value = 0 };
+};
+
+//--------------------------------------------------------------
+
+/// Count number of one bits
+template< unsigned int val > struct bitcount
+{
+ enum { next = val >> 1 };
+ enum { value = bitcount<next>::value + (val & 1) };
+};
+
+template<> struct bitcount<0>
+{
+ enum { value = 0 };
+};
+
+//--------------------------------------------------------------
+
+/// Shift left for positive shift value, and right otherwise
+template< typename T > inline T shiftLeft( T v, int shift )
+{
+ return shift > 0 ? v << shift : v >> (-shift);
+}
+
+/// Shift right for positive shift value, and left otherwise
+template< typename T > inline T shiftRight( T v, int shift )
+{
+ return shift > 0 ? v >> shift : v << (-shift);
+}
+
+//--------------------------------------------------------------
+
+/// Replace non-std project2nd from SGI extensions
+template< typename T1, typename T2 >
+struct project2nd : public std::binary_function<T1, T2, T2>
+{
+ T2 operator() (const T1&, const T2& v) const { return v; }
+};
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_METAFUNCTIONS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/nonstandarditerator.hxx b/include/basebmp/nonstandarditerator.hxx
new file mode 100644
index 000000000000..ff51c59afcee
--- /dev/null
+++ b/include/basebmp/nonstandarditerator.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_NONSTANDARDITERATOR_HXX
+#define INCLUDED_BASEBMP_NONSTANDARDITERATOR_HXX
+
+#include <vigra/metaprogramming.hxx>
+
+namespace basebmp
+{
+ /// Base class defining pointer and reference types as VigraFalseType
+ struct NonStandardIterator
+ {
+ typedef vigra::VigraFalseType reference;
+ typedef vigra::VigraFalseType index_reference;
+ typedef vigra::VigraFalseType pointer;
+ };
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_NONSTANDARDITERATOR_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/packedpixeliterator.hxx b/include/basebmp/packedpixeliterator.hxx
new file mode 100644
index 000000000000..89a88506bbcd
--- /dev/null
+++ b/include/basebmp/packedpixeliterator.hxx
@@ -0,0 +1,671 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_PACKEDPIXELITERATOR_HXX
+#define INCLUDED_BASEBMP_PACKEDPIXELITERATOR_HXX
+
+#include <basebmp/metafunctions.hxx>
+#include <basebmp/stridedarrayiterator.hxx>
+#include <basebmp/nonstandarditerator.hxx>
+#include <basebmp/accessortraits.hxx>
+
+#include <boost/static_assert.hpp>
+#include <vigra/metaprogramming.hxx>
+#include <vigra/diff2d.hxx>
+
+namespace basebmp
+{
+
+/// Get bitmask for data at given intra-word position, for given bit depth
+template< typename value_type,
+ int bits_per_pixel,
+ bool MsbFirst,
+ typename difference_type >
+inline value_type get_mask( difference_type d )
+{
+ BOOST_STATIC_ASSERT(bits_per_pixel > 0);
+ BOOST_STATIC_ASSERT(sizeof(value_type)*8 % bits_per_pixel == 0);
+ BOOST_STATIC_ASSERT(sizeof(value_type)*8 / bits_per_pixel > 1);
+ BOOST_STATIC_ASSERT(vigra::TypeTraits<value_type>::isPOD::asBool);
+
+ const unsigned int nIntraWordPositions( sizeof(value_type)*8 / bits_per_pixel );
+
+ // create bits_per_pixel 1s shift to intra-word position
+ return ((~(~0 << bits_per_pixel)) << bits_per_pixel*(MsbFirst ?
+ (nIntraWordPositions-1 - (d % nIntraWordPositions)) :
+ (d % nIntraWordPositions)));
+}
+
+template< int num_intraword_positions, int bits_per_pixel, bool MsbFirst, typename difference_type > inline difference_type get_shift( difference_type remainder )
+{
+ return bits_per_pixel*(MsbFirst ?
+ (num_intraword_positions - 1 - remainder) :
+ remainder);
+}
+
+template< typename Valuetype,
+ int bits_per_pixel,
+ bool MsbFirst > class PackedPixelColumnIterator : public NonStandardIterator
+{
+public:
+ // no reference, no index_reference type here
+ typedef Valuetype value_type;
+ typedef int difference_type;
+ typedef image_traverser_tag iterator_category;
+
+ typedef typename remove_const<value_type>::type mask_type;
+ typedef value_type* pointer;
+ typedef StridedArrayIterator< value_type > MoveY;
+
+ enum {
+ /** The number of pixel within a single value_type value
+ */
+ num_intraword_positions=sizeof(value_type)*8/bits_per_pixel,
+ /** Bit mask for one pixel (least significant bits)
+ */
+ bit_mask=~(~0 << bits_per_pixel)
+ };
+
+private:
+ MoveY y;
+ mask_type mask_;
+ difference_type shift_;
+
+ void inc()
+ {
+ ++y;
+ }
+
+ void dec()
+ {
+ --y;
+ }
+
+ bool equal( PackedPixelColumnIterator const & rhs ) const
+ {
+ return rhs.y == y;
+ }
+
+ bool less( PackedPixelColumnIterator const & rhs ) const
+ {
+ return y < rhs.y;
+ }
+
+public:
+ PackedPixelColumnIterator() :
+ y(0),
+ mask_( get_mask<value_type, bits_per_pixel, MsbFirst, difference_type>(0) ),
+ shift_( get_shift<num_intraword_positions, bits_per_pixel, MsbFirst, difference_type>(0) )
+ {}
+
+ PackedPixelColumnIterator( const MoveY& base, difference_type remainder ) :
+ y(base),
+ mask_( get_mask<value_type, bits_per_pixel, MsbFirst>(remainder) ),
+ shift_( get_shift<num_intraword_positions, bits_per_pixel, MsbFirst>(remainder) )
+ {}
+
+ PackedPixelColumnIterator& operator+=( difference_type d )
+ {
+ y += d;
+ return *this;
+ }
+
+ PackedPixelColumnIterator& operator-=( difference_type d )
+ {
+ y -= d;
+ return *this;
+ }
+
+ PackedPixelColumnIterator operator+( difference_type d )
+ {
+ PackedPixelColumnIterator res(*this);
+ res += d;
+ return res;
+ }
+
+ PackedPixelColumnIterator operator-( difference_type d )
+ {
+ PackedPixelColumnIterator res(*this);
+ res -= d;
+ return res;
+ }
+
+ PackedPixelColumnIterator& operator++()
+ {
+ inc();
+ return *this;
+ }
+
+ PackedPixelColumnIterator& operator--()
+ {
+ dec();
+ return *this;
+ }
+
+ PackedPixelColumnIterator operator++(int)
+ {
+ PackedPixelColumnIterator res(*this);
+ inc();
+ return res;
+ }
+
+ PackedPixelColumnIterator operator--(int)
+ {
+ PackedPixelColumnIterator res(*this);
+ dec();
+ return res;
+ }
+
+ bool operator==(PackedPixelColumnIterator const & rhs) const
+ {
+ return equal( rhs );
+ }
+
+ bool operator!=(PackedPixelColumnIterator const & rhs) const
+ {
+ return !equal( rhs );
+ }
+
+ bool operator<(PackedPixelColumnIterator const & rhs) const
+ {
+ return less(rhs);
+ }
+
+ bool operator<=(PackedPixelColumnIterator const & rhs) const
+ {
+ return !rhs.less(*this);
+ }
+
+ bool operator>(PackedPixelColumnIterator const & rhs) const
+ {
+ return rhs.less(*this);
+ }
+
+ bool operator>=(PackedPixelColumnIterator const & rhs) const
+ {
+ return !less(rhs);
+ }
+
+ difference_type operator-(PackedPixelColumnIterator const & rhs) const
+ {
+ return y - rhs.y;
+ }
+
+ value_type get() const
+ {
+ return unsigned_cast<value_type>(*y() & mask_) >> shift_;
+ }
+
+ value_type get(difference_type d) const
+ {
+ return unsigned_cast<value_type>(*y(d) & mask_) >> shift_;
+ }
+
+ void set( value_type v ) const
+ {
+ const value_type pixel_value( (v << shift_) & mask_ );
+ *y() = (*y() & ~mask_) | pixel_value;
+ }
+
+ void set( value_type v, difference_type d ) const
+ {
+ const value_type pixel_value( (v << shift_) & mask_ );
+ *y(d) = (*y(d) & ~mask_) | pixel_value;
+ }
+};
+
+template< typename Valuetype,
+ int bits_per_pixel,
+ bool MsbFirst > class PackedPixelRowIterator : public NonStandardIterator
+{
+public:
+ // no reference, no index_reference type here
+ typedef Valuetype value_type;
+ typedef int difference_type;
+ typedef image_traverser_tag iterator_category;
+
+ typedef typename remove_const<value_type>::type mask_type;
+ typedef value_type* pointer;
+
+ enum {
+ /** The number of pixel within a single value_type value
+ */
+ num_intraword_positions=sizeof(value_type)*8/bits_per_pixel,
+ /** Bit mask for one pixel (least significant bits)
+ */
+ bit_mask=~(~0 << bits_per_pixel)
+ };
+
+private:
+ pointer data_;
+ mask_type mask_;
+ difference_type remainder_;
+
+ void update_mask()
+ {
+ mask_ = get_mask<value_type, bits_per_pixel, MsbFirst>(remainder_);
+ }
+
+ void inc()
+ {
+ const difference_type newValue( remainder_ + 1 );
+ const difference_type data_offset( newValue / num_intraword_positions );
+
+ data_ += data_offset;
+ remainder_ = newValue % num_intraword_positions;
+
+ const mask_type shifted_mask(
+ MsbFirst ?
+ unsigned_cast<mask_type>(mask_) >> bits_per_pixel :
+ mask_ << bits_per_pixel );
+
+ // data_offset is 0 for shifted mask, and 1 for wrapped-around mask
+ mask_ = (1-data_offset)*shifted_mask + data_offset*(MsbFirst ?
+ bit_mask << bits_per_pixel*(num_intraword_positions-1) :
+ bit_mask);
+ }
+
+ void dec()
+ {
+ const difference_type newValue( remainder_ - 1 );
+ const bool isNegative( is_negative(newValue) );
+ const difference_type newRemainder( newValue % num_intraword_positions );
+
+ // calc data_ += newValue / num_intraword_positions;
+ // remainder_ = newRemainder;
+ // for newValue >= 0, and
+ // data_ += newValue / num_intraword_positions - 1;
+ // remainder_ = num_intraword_positions - newRemainder;
+ // (to force remainder_ to be positive).
+ // This is branch-free, if is_negative() is branch-free
+ const difference_type data_offset( newValue / num_intraword_positions - isNegative );
+ data_ += data_offset;
+ remainder_ = newRemainder + isNegative*num_intraword_positions;
+
+ const mask_type shifted_mask(
+ MsbFirst ?
+ mask_ << bits_per_pixel :
+ unsigned_cast<mask_type>(mask_) >> bits_per_pixel );
+
+ // data_offset is 0 for shifted mask, and 1 for wrapped-around mask
+ mask_ = (1-data_offset)*shifted_mask + data_offset*(MsbFirst ?
+ bit_mask :
+ bit_mask << bits_per_pixel*(num_intraword_positions-1));
+ }
+
+ bool equal( PackedPixelRowIterator const & rhs ) const
+ {
+ return rhs.data_ == data_ && rhs.remainder_ == remainder_;
+ }
+
+ bool less( PackedPixelRowIterator const & rhs ) const
+ {
+ return data_ == rhs.data_ ?
+ (remainder_ < rhs.remainder_) :
+ (data_ < rhs.data_);
+ }
+
+public:
+ PackedPixelRowIterator() :
+ data_(0),
+ mask_( get_mask<value_type, bits_per_pixel, MsbFirst, difference_type>(0) ),
+ remainder_(0)
+ {}
+
+ explicit PackedPixelRowIterator( pointer base, int x ) :
+ data_(base),
+ mask_(0),
+ remainder_(x % num_intraword_positions)
+ {
+ update_mask();
+ }
+
+ PackedPixelRowIterator& operator+=( difference_type d )
+ {
+ const difference_type newValue( remainder_ + d );
+ const bool isNegative( is_negative(newValue) );
+ const difference_type newRemainder( newValue % num_intraword_positions );
+
+ // calc data_ += newValue / num_intraword_positions;
+ // remainder_ = newRemainder;
+ // for newValue >= 0, and
+ // data_ += newValue / num_intraword_positions - 1;
+ // remainder_ = newRemainder + num_intraword_positions;
+ // (to force remainder_ to be positive).
+ // This is branch-free, if is_negative() is branch-free
+ data_ += newValue / num_intraword_positions - isNegative;
+ remainder_ = newRemainder + isNegative*num_intraword_positions;
+ update_mask();
+
+ return *this;
+ }
+
+ PackedPixelRowIterator& operator-=( difference_type d )
+ {
+ // forward to operator+= - which has to cope with negative
+ // values, anyway.
+ return *this += -d;
+ }
+
+ PackedPixelRowIterator operator+( difference_type d )
+ {
+ PackedPixelRowIterator res(*this);
+ res += d;
+ return res;
+ }
+
+ PackedPixelRowIterator operator-( difference_type d )
+ {
+ PackedPixelRowIterator res(*this);
+ res -= d;
+ return res;
+ }
+
+ PackedPixelRowIterator& operator++()
+ {
+ inc();
+ return *this;
+ }
+
+ PackedPixelRowIterator& operator--()
+ {
+ dec();
+ return *this;
+ }
+
+ PackedPixelRowIterator operator++(int)
+ {
+ PackedPixelRowIterator res(*this);
+ inc();
+ return res;
+ }
+
+ PackedPixelRowIterator operator--(int)
+ {
+ PackedPixelRowIterator res(*this);
+ dec();
+ return res;
+ }
+
+ bool operator==(PackedPixelRowIterator const & rhs) const
+ {
+ return equal( rhs );
+ }
+
+ bool operator!=(PackedPixelRowIterator const & rhs) const
+ {
+ return !equal( rhs );
+ }
+
+ bool operator<(PackedPixelRowIterator const & rhs) const
+ {
+ return less(rhs);
+ }
+
+ bool operator<=(PackedPixelRowIterator const & rhs) const
+ {
+ return !rhs.less(*this);
+ }
+
+ bool operator>(PackedPixelRowIterator const & rhs) const
+ {
+ return rhs.less(*this);
+ }
+
+ bool operator>=(PackedPixelRowIterator const & rhs) const
+ {
+ return !less(rhs);
+ }
+
+ difference_type operator-(PackedPixelRowIterator const & rhs) const
+ {
+ return (data_ - rhs.data_)*num_intraword_positions + (remainder_ - rhs.remainder_);
+ }
+
+ value_type get() const
+ {
+ return unsigned_cast<value_type>(*data_ & mask_) >>
+ get_shift<num_intraword_positions,
+ bits_per_pixel,
+ MsbFirst>(remainder_);
+ }
+
+ value_type get(difference_type d) const
+ {
+ PackedPixelRowIterator tmp(*this);
+ tmp += d;
+ return tmp.get();
+ }
+
+ void set( value_type v ) const
+ {
+ const value_type pixel_value(
+ (v <<
+ get_shift<num_intraword_positions, bits_per_pixel, MsbFirst>(remainder_))
+ & mask_ );
+ *data_ = (*data_ & ~mask_) | pixel_value;
+ }
+
+ void set( value_type v, difference_type d ) const
+ {
+ PackedPixelRowIterator tmp(*this);
+ tmp += d;
+ tmp.set(v);
+ }
+};
+
+/** 2D image iterator for packed pixel formats
+
+ This iterator can be used for image formats that pack more than
+ one pixel into an machine data type (like one bit per pixel, eight
+ of which packed into one char)
+ */
+template< typename Valuetype,
+ int bits_per_pixel,
+ bool MsbFirst > class PackedPixelIterator : public NonStandardIterator
+{
+public:
+ // no reference, no index_reference type here
+ typedef Valuetype value_type;
+ typedef vigra::Diff2D difference_type;
+ typedef image_traverser_tag iterator_category;
+ typedef PackedPixelRowIterator<value_type,
+ bits_per_pixel,
+ MsbFirst> row_iterator;
+ typedef PackedPixelColumnIterator<value_type,
+ bits_per_pixel,
+ MsbFirst> column_iterator;
+
+ typedef value_type* pointer;
+ typedef int MoveX;
+ typedef StridedArrayIterator< value_type > MoveY;
+
+ enum {
+ /** The number of pixel within a single value_type value
+ */
+ num_intraword_positions=sizeof(value_type)*8/bits_per_pixel,
+ /** Bit mask for one pixel (least significant bits)
+ */
+ bit_mask=~(~0 << bits_per_pixel)
+ };
+
+ // TODO(F2): direction of iteration (ImageIterator can be made to
+ // run backwards)
+
+private:
+ pointer current() const
+ {
+ return y() + (x / num_intraword_positions);
+ }
+
+ pointer current(int dx, int dy) const
+ {
+ return y(dy) + ((x+dx)/num_intraword_positions);
+ }
+
+ bool equal(PackedPixelIterator const & rhs) const
+ {
+ return (x == rhs.x) && (y == rhs.y);
+ }
+
+public:
+ PackedPixelIterator() :
+ x(0),
+ y(0)
+ {}
+
+ PackedPixelIterator(pointer base, int ystride) :
+ x(0),
+ y(ystride,base)
+ {}
+
+ bool operator==(PackedPixelIterator const & rhs) const
+ {
+ return equal(rhs);
+ }
+
+ bool operator!=(PackedPixelIterator const & rhs) const
+ {
+ return !equal(rhs);
+ }
+
+ difference_type operator-(PackedPixelIterator const & rhs) const
+ {
+ return difference_type(x - rhs.x, y - rhs.y);
+ }
+
+ MoveX x;
+ MoveY y;
+
+ PackedPixelIterator & operator+=(difference_type const & s)
+ {
+ x += s.x;
+ y += s.y;
+ return *this;
+ }
+
+ PackedPixelIterator & operator-=(difference_type const & s)
+ {
+ x -= s.x;
+ y -= s.y;
+ return *this;
+ }
+
+ PackedPixelIterator operator+(difference_type const & s) const
+ {
+ PackedPixelIterator ret(*this);
+ ret += s;
+ return ret;
+ }
+
+ PackedPixelIterator operator-(difference_type const & s) const
+ {
+ PackedPixelIterator ret(*this);
+ ret -= s;
+ return ret;
+ }
+
+ row_iterator rowIterator() const
+ {
+ return row_iterator(current(),x);
+ }
+
+ column_iterator columnIterator() const
+ {
+ return column_iterator(MoveY(y,
+ x / num_intraword_positions),
+ x % num_intraword_positions);
+ }
+
+ value_type get() const
+ {
+ const int remainder( x % num_intraword_positions );
+
+ return (unsigned_cast<value_type>(*current() &
+ get_mask<value_type, bits_per_pixel, MsbFirst>(remainder))
+ >> get_shift<num_intraword_positions, bits_per_pixel, MsbFirst>(remainder));
+ }
+
+ value_type get(difference_type const & d) const
+ {
+ const int remainder( x(d.x) % num_intraword_positions );
+
+ return (unsigned_cast<value_type>(*current(d.x,d.y) &
+ get_mask<value_type, bits_per_pixel, MsbFirst>(remainder))
+ >> get_shift<num_intraword_positions, bits_per_pixel, MsbFirst>(remainder));
+ }
+
+ void set( value_type v ) const
+ {
+ const int remainder( x % num_intraword_positions );
+ const int mask( get_mask<value_type, bits_per_pixel, MsbFirst>(remainder) );
+ const value_type pixel_value(
+ (v <<
+ get_shift<num_intraword_positions, bits_per_pixel, MsbFirst>(remainder))
+ & mask );
+ pointer p = current();
+ *p = (*p & ~mask) | pixel_value;
+ }
+
+ void set( value_type v, difference_type const & d ) const
+ {
+ const int remainder( (x + d.x) % num_intraword_positions );
+ const int mask( get_mask<value_type, bits_per_pixel, MsbFirst>(remainder) );
+ const value_type pixel_value(
+ (v <<
+ get_shift<num_intraword_positions, bits_per_pixel, MsbFirst>(remainder))
+ & mask );
+ pointer p = current(d.x,d.y);
+ *p = (*p & ~mask) | pixel_value;
+ }
+};
+
+//-----------------------------------------------------------------------------
+
+// partial specialization for the accessor traits masked_accessor
+// selector metafunction - can employ fast mask functor for the 1bpp
+// case.
+template< class Accessor,
+ class MaskAccessor,
+ class Iterator,
+ bool polarity,
+ bool MsbFirst > struct maskedAccessorSelector< Accessor,
+ MaskAccessor,
+ Iterator,
+ PackedPixelIterator< typename MaskAccessor::value_type,
+ 1,
+ MsbFirst >,
+ polarity >
+{
+ typedef TernarySetterFunctionAccessorAdapter<
+ Accessor,
+ MaskAccessor,
+ typename outputMaskFunctorSelector<
+ typename Accessor::value_type,
+ typename MaskAccessor::value_type,
+ polarity,
+ FastMask>::type >
+ type;
+};
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_PACKEDPIXELITERATOR_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/paletteformats.hxx b/include/basebmp/paletteformats.hxx
new file mode 100644
index 000000000000..5c2c58d49b94
--- /dev/null
+++ b/include/basebmp/paletteformats.hxx
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_PACKEDPIXELFORMATS_HXX
+#define INCLUDED_BASEBMP_PACKEDPIXELFORMATS_HXX
+
+#include <basebmp/color.hxx>
+#include <basebmp/colortraits.hxx>
+#include <basebmp/accessor.hxx>
+#include <basebmp/pixeliterator.hxx>
+#include <basebmp/packedpixeliterator.hxx>
+#include <basebmp/pixelformatadapters.hxx>
+#include <basebmp/paletteimageaccessor.hxx>
+#include <basebmp/metafunctions.hxx>
+
+#include <vigra/numerictraits.hxx>
+#include <vigra/metaprogramming.hxx>
+
+namespace basebmp
+{
+
+//-----------------------------------------------------------------------------
+
+/** Lookup index value for given color value in a PaletteImageAccessor
+ */
+template< class Accessor > struct ColorLookup
+{
+ typename Accessor::data_type operator()( const Accessor& acc,
+ typename Accessor::value_type v ) const
+ {
+ return acc.lookup(v);
+ }
+};
+
+//-----------------------------------------------------------------------------
+
+// partial specialization of AccessorTraits for PaletteAccessor
+template< class Accessor, typename ColorType > struct AccessorTraits<
+ PaletteImageAccessor< Accessor, ColorType > >
+{
+ /// value type of described accessor
+ typedef typename PaletteImageAccessor< Accessor, ColorType >::value_type value_type;
+
+ /// Retrieve stand-alone color lookup function for given Accessor type
+ typedef ColorLookup< PaletteImageAccessor< Accessor, ColorType > > color_lookup;
+
+ /// Retrieve raw pixel data accessor for given Accessor type
+ typedef Accessor raw_accessor;
+
+ /** accessor for XOR setter access is disabled, since the results
+ * are usually completely unintended - you'll usually want to
+ * wrap an xor_accessor with a PaletteAccessor, not the other way
+ * around.
+ */
+ typedef vigra::VigraFalseType xor_accessor;
+
+ /** accessor for masked setter access is disabled, since the
+ * results are usually completely unintended - you'll usually
+ * want to wrap a masked_accessor with a PaletteAccessor, not the
+ * other way around.
+ */
+ template< class MaskAccessor,
+ class Iterator,
+ class MaskIterator > struct masked_accessor
+ {
+ typedef vigra::VigraFalseType type;
+ };
+};
+
+//-----------------------------------------------------------------------------
+
+template< typename ColorType > struct PaletteAccessorSelector
+{
+ template< class Accessor > struct wrap_accessor
+ {
+ typedef PaletteImageAccessor< Accessor, ColorType > type;
+ };
+};
+
+//-----------------------------------------------------------------------------
+
+template< class Iterator,
+ class Accessor > struct PixelFormatTraitsTemplate_Palette
+{
+ typedef typename Iterator::value_type pixel_type;
+ typedef Iterator iterator_type;
+ typedef Accessor raw_accessor_type;
+ typedef PaletteAccessorSelector<Color> accessor_selector;
+};
+
+template< int BitsPerPixel,
+ bool MsbFirst > struct PixelFormatTraitsTemplate_PackedPalette :
+ public PixelFormatTraitsTemplate_Palette<
+ PackedPixelIterator< sal_uInt8,
+ BitsPerPixel,
+ MsbFirst >,
+ NonStandardAccessor< sal_uInt8 > >
+{};
+
+//-----------------------------------------------------------------------------
+
+// 1bpp MSB
+typedef PixelFormatTraitsTemplate_PackedPalette<1, true> PixelFormatTraits_PAL1_MSB;
+
+// 1bpp LSB
+typedef PixelFormatTraitsTemplate_PackedPalette<1, false> PixelFormatTraits_PAL1_LSB;
+
+// 4bpp MSB
+typedef PixelFormatTraitsTemplate_PackedPalette<4, true> PixelFormatTraits_PAL4_MSB;
+
+// 4bpp LSB
+typedef PixelFormatTraitsTemplate_PackedPalette<4, false> PixelFormatTraits_PAL4_LSB;
+
+// 8bpp
+typedef PixelFormatTraitsTemplate_Palette<
+ PixelIterator< sal_uInt8 >,
+ StandardAccessor< sal_uInt8 > > PixelFormatTraits_PAL8;
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_PACKEDPIXELFORMATS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/paletteimageaccessor.hxx b/include/basebmp/paletteimageaccessor.hxx
new file mode 100644
index 000000000000..6f0164e64af6
--- /dev/null
+++ b/include/basebmp/paletteimageaccessor.hxx
@@ -0,0 +1,162 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_PALETTEIMAGEACCESSOR_HXX
+#define INCLUDED_BASEBMP_PALETTEIMAGEACCESSOR_HXX
+
+#include <basebmp/colortraits.hxx>
+#include <basebmp/accessortraits.hxx>
+
+#include <vigra/numerictraits.hxx>
+#include <vigra/metaprogramming.hxx>
+
+#include <algorithm>
+#include <functional>
+
+namespace basebmp
+{
+
+/** Access pixel data via palette indirection
+
+ @tpl Accessor
+ Raw accessor, to be used to actually access the pixel values
+
+ @tpl ColorType
+ The color value type to use - e.g. the palette is an array of that
+ type
+ */
+template< class Accessor, typename ColorType > class PaletteImageAccessor
+{
+public:
+ typedef typename Accessor::value_type data_type;
+ typedef ColorType value_type;
+
+#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+// making all members public, if no member template friends
+private:
+ template<class A, typename C> friend class PaletteImageAccessor;
+#endif
+
+ Accessor maAccessor;
+ const value_type* mpPalette;
+ std::size_t mnNumEntries;
+
+public:
+ PaletteImageAccessor() :
+ maAccessor(),
+ mpPalette(0),
+ mnNumEntries(0)
+ {}
+
+ template< class A > explicit
+ PaletteImageAccessor( PaletteImageAccessor<A,ColorType> const& rSrc ) :
+ maAccessor( rSrc.maAccessor ),
+ mpPalette( rSrc.mpPalette ),
+ mnNumEntries( rSrc.mnNumEntries )
+ {}
+
+ PaletteImageAccessor( const value_type* pPalette,
+ std::size_t numEntries ) :
+ maAccessor(),
+ mpPalette(pPalette),
+ mnNumEntries(numEntries)
+ {}
+
+ template< class T > PaletteImageAccessor( T accessor,
+ const value_type* pPalette,
+ std::size_t numEntries ) :
+ maAccessor(accessor),
+ mpPalette(pPalette),
+ mnNumEntries(numEntries)
+ {}
+
+ // -------------------------------------------------------
+
+ Accessor const& getWrappedAccessor() const { return maAccessor; }
+ Accessor& getWrappedAccessor() { return maAccessor; }
+
+ // -------------------------------------------------------
+
+ data_type lookup(value_type const& v) const
+ {
+ // TODO(P3): use table-based/octree approach here!
+ const value_type* best_entry;
+ const value_type* palette_end( mpPalette+mnNumEntries );
+ if( (best_entry=std::find( mpPalette, palette_end, v)) != palette_end )
+ return best_entry-mpPalette;
+
+ const value_type* curr_entry( mpPalette );
+ best_entry = curr_entry;
+ while( curr_entry != palette_end )
+ {
+ if( ColorTraits<value_type>::distance(*curr_entry,
+ *best_entry)
+ > ColorTraits<value_type>::distance(*curr_entry,
+ v) )
+ {
+ best_entry = curr_entry;
+ }
+
+ ++curr_entry;
+ }
+
+ return best_entry-mpPalette;
+ }
+
+ // -------------------------------------------------------
+
+ template< class Iterator >
+ value_type operator()(Iterator const& i) const
+ {
+ return mpPalette[ maAccessor(i) ];
+ }
+
+ template< class Iterator, class Difference >
+ value_type operator()(Iterator const& i, Difference const& diff) const
+ {
+ return mpPalette[ maAccessor(i,diff) ];
+ }
+
+ // -------------------------------------------------------
+
+ template< typename V, class Iterator >
+ void set(V const& value, Iterator const& i) const
+ {
+ maAccessor.set(
+ lookup(
+ vigra::detail::RequiresExplicitCast<value_type>::cast(value) ),
+ i );
+ }
+
+ template< typename V, class Iterator, class Difference >
+ void set(V const& value, Iterator const& i, Difference const& diff) const
+ {
+ maAccessor.set(
+ lookup(
+ vigra::detail::RequiresExplicitCast<value_type>::cast(value) ),
+ i,
+ diff );
+ }
+};
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_PALETTEIMAGEACCESSOR_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/pixelformatadapters.hxx b/include/basebmp/pixelformatadapters.hxx
new file mode 100644
index 000000000000..09cc9368394d
--- /dev/null
+++ b/include/basebmp/pixelformatadapters.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_PIXELFORMATADAPTERS_HXX
+#define INCLUDED_BASEBMP_PIXELFORMATADAPTERS_HXX
+
+#include <basebmp/accessortraits.hxx>
+#include <basebmp/accessoradapters.hxx>
+
+#include <vigra/metaprogramming.hxx>
+
+namespace basebmp
+{
+
+// convenience functionality, providing everything necessary for a new
+// pixel format. simply plug in two conversion functors from/to a
+// common color format.
+
+/** Accessor selection metafunction, used to wrap a given accessor
+ with one converting between the pixel and color types
+
+ Use the nested template's typedef type, to retrieve an
+ AccessorAdapter which operates on a pixel value accessor, and
+ provides color values to the outside.
+
+ Nested like this, to avoid template template parameters at other
+ places: an instantiated version of AccessorSelector can be passed
+ to other templates, which in turn can invoke the nested meta
+ function.
+ */
+template< typename Getter,
+ typename Setter > struct AccessorSelector
+{
+ template< typename Accessor > struct wrap_accessor
+ {
+ typedef UnaryFunctionAccessorAdapter< Accessor,
+ Getter,
+ Setter > type;
+ };
+};
+
+//-----------------------------------------------------------------------------
+
+/** Convert color value to pixel data type
+ */
+template< class Accessor, typename DataType > struct ColorConvert
+{
+ DataType operator()( const Accessor& acc,
+ typename Accessor::value_type v ) const
+ {
+ return acc.setter(v);
+ }
+};
+
+//-----------------------------------------------------------------------------
+
+/** Macro generates partial specialization for color-conversion
+ UnaryFunctionAccessorAdapter, and the given getter/setter functors
+ */
+#define BASEBMP_SPECIALIZE_ACCESSORTRAITS(Getter,Setter) \
+template< class Accessor > struct AccessorTraits< \
+ UnaryFunctionAccessorAdapter< Accessor, \
+ Getter, \
+ Setter > > \
+{ \
+ typedef typename Accessor::value_type data_type; \
+ typedef UnaryFunctionAccessorAdapter< \
+ Accessor, \
+ Getter, \
+ Setter > accessor_type; \
+ typedef typename accessor_type::value_type value_type; \
+ typedef ColorConvert< accessor_type, \
+ data_type > color_lookup; \
+ typedef Accessor raw_accessor; \
+ typedef vigra::VigraFalseType xor_accessor; \
+ template< class MaskAccessor, \
+ class Iterator, \
+ class MaskIterator > struct masked_accessor\
+ { typedef vigra::VigraFalseType type; }; \
+}
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_PIXELFORMATADAPTERS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/pixeliterator.hxx b/include/basebmp/pixeliterator.hxx
new file mode 100644
index 000000000000..e629af275dd9
--- /dev/null
+++ b/include/basebmp/pixeliterator.hxx
@@ -0,0 +1,349 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_PIXELITERATOR_HXX
+#define INCLUDED_BASEBMP_PIXELITERATOR_HXX
+
+#include <basebmp/metafunctions.hxx>
+#include <basebmp/stridedarrayiterator.hxx>
+
+#include <vigra/metaprogramming.hxx>
+#include <vigra/diff2d.hxx>
+
+namespace basebmp
+{
+
+template< typename Valuetype > class PixelColumnIterator
+{
+public:
+ typedef Valuetype value_type;
+ typedef Valuetype& reference;
+ typedef reference index_reference;
+ typedef Valuetype* pointer;
+ typedef int difference_type;
+ typedef image_traverser_tag iterator_category;
+
+ typedef StridedArrayIterator< value_type > MoveY;
+
+private:
+ MoveY y;
+
+ bool equal( PixelColumnIterator const & rhs ) const
+ {
+ return rhs.y == y;
+ }
+
+ bool less( PixelColumnIterator const & rhs ) const
+ {
+ return y < rhs.y;
+ }
+
+public:
+ PixelColumnIterator() :
+ y(0)
+ {}
+
+ explicit PixelColumnIterator( const MoveY& pos ) :
+ y(pos)
+ {}
+
+ PixelColumnIterator( const MoveY& pos, int x ) :
+ y(pos,x)
+ {}
+
+ PixelColumnIterator& operator+=( difference_type d )
+ {
+ y += d;
+ return *this;
+ }
+
+ PixelColumnIterator& operator-=( difference_type d )
+ {
+ y -= d;
+ return *this;
+ }
+
+ PixelColumnIterator operator+( difference_type d )
+ {
+ PixelColumnIterator res(*this);
+ res += d;
+ return res;
+ }
+
+ PixelColumnIterator operator-( difference_type d )
+ {
+ PixelColumnIterator res(*this);
+ res -= d;
+ return res;
+ }
+
+ PixelColumnIterator& operator++()
+ {
+ ++y;
+ return *this;
+ }
+
+ PixelColumnIterator& operator--()
+ {
+ --y;
+ return *this;
+ }
+
+ PixelColumnIterator operator++(int)
+ {
+ PixelColumnIterator res(*this);
+ ++y;
+ return res;
+ }
+
+ PixelColumnIterator operator--(int)
+ {
+ PixelColumnIterator res(*this);
+ --y;
+ return res;
+ }
+
+ bool operator==(PixelColumnIterator const & rhs) const
+ {
+ return equal( rhs );
+ }
+
+ bool operator!=(PixelColumnIterator const & rhs) const
+ {
+ return !equal( rhs );
+ }
+
+ bool operator<(PixelColumnIterator const & rhs) const
+ {
+ return less(rhs);
+ }
+
+ bool operator<=(PixelColumnIterator const & rhs) const
+ {
+ return !rhs.less(*this);
+ }
+
+ bool operator>(PixelColumnIterator const & rhs) const
+ {
+ return rhs.less(*this);
+ }
+
+ bool operator>=(PixelColumnIterator const & rhs) const
+ {
+ return !less(rhs);
+ }
+
+ difference_type operator-(PixelColumnIterator const & rhs) const
+ {
+ return y - rhs.y;
+ }
+
+ value_type get() const
+ {
+ return *y();
+ }
+
+ value_type get(difference_type d) const
+ {
+ return *y(d);
+ }
+
+ void set( value_type v ) const
+ {
+ *y() = v;
+ }
+
+ void set( value_type v, difference_type d ) const
+ {
+ *y(d) = v;
+ }
+
+ reference operator*() const
+ {
+ return *y();
+ }
+
+ pointer operator->() const
+ {
+ return y();
+ }
+
+ reference operator[](difference_type d) const
+ {
+ return *y(d);
+ }
+
+ reference operator()(int dy) const
+ {
+ return *y(dy);
+ }
+};
+
+template< typename Valuetype > class PixelIterator
+{
+public:
+ typedef Valuetype value_type;
+ typedef Valuetype& reference;
+ typedef reference index_reference;
+ typedef Valuetype* pointer;
+ typedef vigra::Diff2D difference_type;
+ typedef image_traverser_tag iterator_category;
+ typedef pointer row_iterator;
+ typedef PixelColumnIterator<value_type> column_iterator;
+
+ typedef int MoveX;
+ typedef StridedArrayIterator< value_type > MoveY;
+
+ // TODO(F2): direction of iteration (ImageIterator can be made to
+ // run backwards)
+
+private:
+ bool equal(PixelIterator const & rhs) const
+ {
+ return (x == rhs.x) && (y == rhs.y);
+ }
+
+ pointer current() const
+ {
+ return y() + x;
+ }
+
+ pointer current(int dx, int dy) const
+ {
+ return y(dy) + x+dx;
+ }
+
+public:
+ PixelIterator() :
+ x(0),
+ y(0)
+ {}
+
+ PixelIterator(pointer base, int ystride) :
+ x(0),
+ y(ystride,base)
+ {}
+
+ bool operator==(PixelIterator const & rhs) const
+ {
+ return equal(rhs);
+ }
+
+ bool operator!=(PixelIterator const & rhs) const
+ {
+ return !equal(rhs);
+ }
+
+ difference_type operator-(PixelIterator const & rhs) const
+ {
+ return difference_type(x - rhs.x, y - rhs.y);
+ }
+
+ MoveX x;
+ MoveY y;
+
+ PixelIterator & operator+=(difference_type const & s)
+ {
+ x += s.x;
+ y += s.y;
+ return *this;
+ }
+
+ PixelIterator & operator-=(difference_type const & s)
+ {
+ x -= s.x;
+ y -= s.y;
+ return *this;
+ }
+
+ PixelIterator operator+(difference_type const & s) const
+ {
+ PixelIterator ret(*this);
+ ret += s;
+ return ret;
+ }
+
+ PixelIterator operator-(difference_type const & s) const
+ {
+ PixelIterator ret(*this);
+ ret -= s;
+ return ret;
+ }
+
+ row_iterator rowIterator() const
+ {
+ return row_iterator(y()+x);
+ }
+
+ column_iterator columnIterator() const
+ {
+ return column_iterator(y,x);
+ }
+
+ value_type get() const
+ {
+ return *current();
+ }
+
+ value_type get(difference_type const & d) const
+ {
+ return *current(d.y, d.x);
+ }
+
+ void set( value_type v ) const
+ {
+ *current() = v;
+ }
+
+ void set( value_type v, difference_type const & d ) const
+ {
+ *current(d.y,d.x) = v;
+ }
+
+ reference operator*() const
+ {
+ return *current();
+ }
+
+ pointer operator->() const
+ {
+ return current();
+ }
+
+ reference operator[]( const vigra::Diff2D& d ) const
+ {
+ return *current(d.x,d.y);
+ }
+
+ reference operator()(int dx, int dy) const
+ {
+ return *current(dx,dy);
+ }
+
+ pointer operator[](int dy) const
+ {
+ return y(dy) + x;
+ }
+};
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_PIXELITERATOR_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/polypolygonrenderer.hxx b/include/basebmp/polypolygonrenderer.hxx
new file mode 100644
index 000000000000..80f73ac01279
--- /dev/null
+++ b/include/basebmp/polypolygonrenderer.hxx
@@ -0,0 +1,360 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_POLYPOLYGONRENDERER_HXX
+#define INCLUDED_BASEBMP_POLYPOLYGONRENDERER_HXX
+
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/range/b2ibox.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <basegfx/polygon/b2dpolypolygonfillrule.hxx>
+#include <basegfx/numeric/ftools.hxx>
+
+#include <vigra/diff2d.hxx>
+#include <vigra/iteratortraits.hxx>
+
+#include <vector>
+
+
+namespace basebmp
+{
+ namespace detail
+ {
+ /// convert int32 to 32:32 fixed point
+ inline sal_Int64 toFractional( sal_Int32 v ) { return (sal_Int64)v << 32; }
+ /// convert double to 32:32 fixed point
+ inline sal_Int64 toFractional( double v ) { return (sal_Int64)(v*SAL_MAX_UINT32 + (v < 0.0 ? -0.5 : 0.5 )); }
+ /// convert 32:32 fixed point to int32 (truncate)
+ inline sal_Int32 toInteger( sal_Int64 v ) { return (sal_Int32)(v < 0 ? ~((~v) >> 32) : v >> 32); }
+ /// convert 32:32 fixed point to int32 (properly rounded)
+ inline sal_Int32 toRoundedInteger( sal_Int64 v ) { return toInteger(v) + (sal_Int32)((v&0x80000000) >> 31); }
+
+ /** internal vertex store -
+
+ Different from B2DPoint, since we don't need floating
+ point coords, but orientation of vertex and y counter
+ */
+ struct Vertex
+ {
+ sal_Int32 mnYCounter;
+ sal_Int64 mnX;
+ sal_Int64 mnXDelta;
+
+ bool mbDownwards; // needed for nonzero winding rule
+ // fills
+
+ Vertex() :
+ mnYCounter(0),
+ mnX(0),
+ mnXDelta(0),
+ mbDownwards(true)
+ {}
+ Vertex( basegfx::B2DPoint const& rPt1,
+ basegfx::B2DPoint const& rPt2,
+ bool bDownwards ) :
+ mnYCounter( basegfx::fround(rPt2.getY()) -
+ basegfx::fround(rPt1.getY()) ),
+ mnX( toFractional( basegfx::fround(rPt1.getX()) )),
+ mnXDelta( toFractional(
+ ((rPt2.getX() - rPt1.getX()) /
+ (double)mnYCounter) )),
+ mbDownwards(bDownwards)
+ {}
+ };
+
+ typedef std::vector< std::vector<Vertex> > VectorOfVectorOfVertices;
+ typedef std::vector< Vertex* > VectorOfVertexPtr;
+
+ /// non-templated setup of GET
+ sal_uInt32 setupGlobalEdgeTable( VectorOfVectorOfVertices& rGET,
+ basegfx::B2DPolyPolygon const& rPoly,
+ sal_Int32 nMinY );
+ /// sort rAETSrc, copy not-yet-ended edges over to rAETDest
+ void sortAET( VectorOfVertexPtr& rAETSrc,
+ VectorOfVertexPtr& rAETDest );
+
+ /// For the STL algorithms
+ struct RasterConvertVertexComparator
+ {
+ RasterConvertVertexComparator() {}
+
+ bool operator()( const Vertex& rLHS,
+ const Vertex& rRHS ) const
+ {
+ return rLHS.mnX < rRHS.mnX;
+ }
+
+ bool operator()( const Vertex* pLHS,
+ const Vertex* pRHS ) const
+ {
+ return pLHS->mnX < pRHS->mnX;
+ }
+ };
+
+ } // namespace detail
+
+
+ /** Raster-convert a poly-polygon.
+
+ This algorithm does not perform antialiasing, and thus
+ internally works with integer vertex coordinates.
+
+ @param begin
+ Left, top edge of the destination bitmap. This position is
+ considered (0,0) relative to all polygon vertices
+
+ @param ad
+ Accessor to set pixel values
+
+ @param fillColor
+ Color to use for filling
+
+ @param rClipRect
+ Clipping rectangle, relative to the begin iterator. No pixel outside
+ this clip rect will be modified.
+
+ @param rPoly
+ Polygon to fill
+ */
+ template< class DestIterator, class DestAccessor, typename T >
+ void renderClippedPolyPolygon( DestIterator begin,
+ DestAccessor ad,
+ T fillColor,
+ const basegfx::B2IBox& rClipRect,
+ basegfx::B2DPolyPolygon const& rPoly,
+ basegfx::FillRule eFillRule )
+ {
+ const sal_Int32 nClipX1( std::max((sal_Int32)0,rClipRect.getMinX()) );
+ const sal_Int32 nClipX2( rClipRect.getMaxX() );
+ const sal_Int32 nClipY1( std::max((sal_Int32)0,rClipRect.getMinY()) );
+ const sal_Int32 nClipY2( rClipRect.getMaxY() );
+ const sal_Int64 nClipX1_frac( detail::toFractional(nClipX1) );
+ const sal_Int64 nClipX2_frac( detail::toFractional(nClipX2) );
+
+ basegfx::B2DRange const aPolyBounds( basegfx::tools::getRange(rPoly) );
+
+ const sal_Int32 nMinY( basegfx::fround(aPolyBounds.getMinY()) );
+ const sal_Int32 nMaxY(
+ std::min(
+ nClipY2-1,
+ basegfx::fround(aPolyBounds.getMaxY())));
+
+ if( nMinY > nMaxY )
+ return; // really, nothing to do then.
+
+ detail::VectorOfVectorOfVertices aGET; // the Global Edge Table
+ aGET.resize( nMaxY - nMinY + 1 );
+
+ sal_uInt32 const nVertexCount(
+ detail::setupGlobalEdgeTable( aGET, rPoly, nMinY ) );
+
+
+ // Perform actual scan conversion
+ //----------------------------------------------------------------------
+
+ if( aGET.empty() )
+ return;
+
+ detail::VectorOfVertexPtr aAET1; // the Active Edge Table
+ detail::VectorOfVertexPtr aAET2;
+ detail::VectorOfVertexPtr* pAET = &aAET1;
+ detail::VectorOfVertexPtr* pAETOther = &aAET2;
+ aAET1.reserve( nVertexCount );
+ aAET2.reserve( nVertexCount );
+
+ // current scanline - initially, points to first scanline
+ // within the clip rect, or to the polygon's first scanline
+ // (whichever is greater)
+ DestIterator aScanline( begin +
+ vigra::Diff2D(
+ 0,
+ std::max(nMinY,
+ nClipY1)) );
+ detail::RasterConvertVertexComparator aComp;
+
+
+ // now process each of the nMaxY - nMinY + 1 scanlines
+ // ------------------------------------------------------------
+
+ for( sal_Int32 y=nMinY; y <= nMaxY; ++y )
+ {
+ if( !aGET[y-nMinY].empty() )
+ {
+ // merge AET with current scanline's new vertices (both
+ // are already correctly sorted)
+ detail::VectorOfVectorOfVertices::value_type::iterator vertex=aGET[y-nMinY].begin();
+ detail::VectorOfVectorOfVertices::value_type::iterator const end=aGET[y-nMinY].end();
+ while( vertex != end )
+ {
+ // find insertion pos by binary search, and put ptr
+ // into active edge vector
+ pAET->insert( std::lower_bound( pAET->begin(),
+ pAET->end(),
+ &(*vertex),
+ aComp ),
+ &(*vertex) );
+
+ ++vertex;
+ }
+ }
+
+ // with less than two active edges, no fill visible
+ if( pAET->size() >= 2 )
+ {
+ typename vigra::IteratorTraits<DestIterator>::row_iterator
+ rowIter( aScanline.rowIterator() );
+
+ // process each span in current scanline, with
+ // even-odd fill rule
+ detail::VectorOfVertexPtr::iterator currVertex( pAET->begin() );
+ detail::VectorOfVertexPtr::iterator const lastVertex( pAET->end()-1 );
+ sal_uInt32 nCrossedEdges(0);
+ sal_Int32 nWindingNumber(0);
+ while( currVertex != lastVertex )
+ {
+ // TODO(P1): might be worth a try to extend the
+ // size()==2 case also to the actual filling
+ // here. YMMV.
+ detail::Vertex& rV1( **currVertex );
+ detail::Vertex const& rV2( **++currVertex );
+
+ nWindingNumber += -1 + 2*rV1.mbDownwards;
+
+ // calc fill status for both rules. might save a
+ // few percent runtime to specialize here...
+ const bool bEvenOddFill(
+ eFillRule == basegfx::FillRule_EVEN_ODD && !(nCrossedEdges & 0x01) );
+ const bool bNonZeroWindingFill(
+ eFillRule == basegfx::FillRule_NONZERO_WINDING_NUMBER && nWindingNumber != 0 );
+
+ // is span visible?
+ if( (bEvenOddFill || bNonZeroWindingFill) &&
+ y >= nClipY1 &&
+ rV1.mnX < nClipX2_frac &&
+ rV2.mnX > nClipX1_frac )
+ {
+ // clip span to horizontal bounds
+ sal_Int32 const nStartX(
+ std::max( nClipX1,
+ std::min( nClipX2-1,
+ detail::toRoundedInteger(rV1.mnX) )));
+ sal_Int32 const nEndX(
+ std::max( nClipX1,
+ std::min( nClipX2,
+ detail::toRoundedInteger(rV2.mnX) )));
+
+ typename vigra::IteratorTraits<DestIterator>::row_iterator
+ currPix( rowIter + nStartX);
+ typename vigra::IteratorTraits<DestIterator>::row_iterator
+ rowEnd( rowIter + nEndX );
+
+ // TODO(P2): Provide specialized span fill methods on the
+ // iterator/accessor
+ while( currPix != rowEnd )
+ ad.set(fillColor, currPix++);
+ }
+
+ // step vertices
+ rV1.mnX += rV1.mnXDelta;
+ --rV1.mnYCounter;
+
+ ++nCrossedEdges;
+ }
+
+ // step vertex also for the last one
+ detail::Vertex& rLastV( **currVertex );
+ rLastV.mnX += rLastV.mnXDelta;
+ --rLastV.mnYCounter;
+
+
+ // prune AET from ended edges, and keep it sorted
+ // ---------------------------------------------------------
+
+ pAETOther->clear();
+ if( pAET->size() == 2 )
+ {
+ // the case of exactly two active edges is both
+ // sufficiently common (all 'simple' polygons have
+ // it), and further more would complicate the
+ // generic case below (which works with a sliding
+ // triple of vertices).
+ if( !aComp(*(*pAET)[0], *(*pAET)[1]) )
+ std::swap(*(*pAET)[0], *(*pAET)[1]);
+
+ if( (*pAET)[0]->mnYCounter > 0 )
+ pAETOther->push_back( (*pAET)[0] );
+ if( (*pAET)[1]->mnYCounter > 0 )
+ pAETOther->push_back( (*pAET)[1] );
+ }
+ else
+ {
+ bool bFallbackTaken(false);
+ currVertex = pAET->begin();
+ detail::VectorOfVertexPtr::iterator prevVertex( currVertex );
+ while( currVertex != lastVertex )
+ {
+ // try to get away with one linear swoop and
+ // simple neighbor swapping. this is an
+ // overwhelmingly common case - polygons with
+ // excessively crisscrossing edges (which on
+ // top of that cross more than one other edge
+ // per scanline) are seldom. And even if we
+ // get such a beast here, this extra loop has
+ // still only linear cost
+ if( aComp(**(currVertex+1),**currVertex) )
+ {
+ std::swap(*currVertex, *(currVertex+1));
+
+ if( aComp(**currVertex,**prevVertex) )
+ {
+ // one swap was not sufficient -
+ // fallback to generic sort algo, then
+ detail::sortAET(*pAET, *pAETOther);
+ bFallbackTaken = true;
+ break;
+ }
+ }
+
+ if( (*currVertex)->mnYCounter > 0 )
+ pAETOther->push_back( *currVertex );
+
+ prevVertex = currVertex++;
+ }
+
+ // don't forget to add last vertex (loop above
+ // only deals with n-1 vertices)
+ if( !bFallbackTaken && (*currVertex)->mnYCounter > 0 )
+ pAETOther->push_back( *currVertex );
+ }
+
+ std::swap( pAET, pAETOther );
+ }
+
+ if( y >= nClipY1 )
+ ++aScanline.y;
+ }
+ }
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_POLYPOLYGONRENDERER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/rgb24pixelformats.hxx b/include/basebmp/rgb24pixelformats.hxx
new file mode 100644
index 000000000000..c4f460cc5e10
--- /dev/null
+++ b/include/basebmp/rgb24pixelformats.hxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_RGB24PIXELFORMATS_HXX
+#define INCLUDED_BASEBMP_RGB24PIXELFORMATS_HXX
+
+#include <basebmp/color.hxx>
+#include <basebmp/accessor.hxx>
+#include <basebmp/pixeliterator.hxx>
+#include <basebmp/pixelformatadapters.hxx>
+
+#include <vigra/rgbvalue.hxx>
+
+#include <functional>
+
+namespace basebmp
+{
+
+template< typename PixelType, typename ColorType > struct RGBValueGetter :
+ public std::unary_function<PixelType, ColorType>
+{
+ ColorType operator()( PixelType const& c ) const
+ {
+ return ColorType(c.red(),c.green(),c.blue());
+ }
+};
+
+template< typename PixelType, typename ColorType > struct RGBValueSetter :
+ public std::unary_function<ColorType, PixelType>
+{
+ PixelType operator()( ColorType const& c ) const
+ {
+ PixelType res;
+ res.setRed(c.getRed());
+ res.setGreen(c.getGreen());
+ res.setBlue(c.getBlue());
+ return res;
+ }
+};
+
+//-----------------------------------------------------------------------------
+
+template< typename PixelType > struct PixelFormatTraitsTemplate_RGBValue
+{
+ typedef PixelType pixel_type;
+
+ typedef RGBValueGetter<pixel_type,
+ Color> getter_type;
+ typedef RGBValueSetter<pixel_type,
+ Color> setter_type;
+
+ typedef PixelIterator<pixel_type> iterator_type;
+ typedef StandardAccessor<pixel_type> raw_accessor_type;
+ typedef AccessorSelector<
+ getter_type, setter_type> accessor_selector;
+};
+
+//-----------------------------------------------------------------------------
+
+// 24bpp RGB
+typedef PixelFormatTraitsTemplate_RGBValue<
+ vigra::RGBValue<sal_uInt8> > PixelFormatTraits_RGB24;
+BASEBMP_SPECIALIZE_ACCESSORTRAITS(PixelFormatTraits_RGB24::getter_type,
+ PixelFormatTraits_RGB24::setter_type);
+
+// 24bpp BGR
+typedef PixelFormatTraitsTemplate_RGBValue<
+ vigra::RGBValue<sal_uInt8,2,1,0> > PixelFormatTraits_BGR24;
+BASEBMP_SPECIALIZE_ACCESSORTRAITS(PixelFormatTraits_BGR24::getter_type,
+ PixelFormatTraits_BGR24::setter_type);
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_RGB24PIXELFORMATS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/rgbmaskpixelformats.hxx b/include/basebmp/rgbmaskpixelformats.hxx
new file mode 100644
index 000000000000..19cf65f97e0d
--- /dev/null
+++ b/include/basebmp/rgbmaskpixelformats.hxx
@@ -0,0 +1,331 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_RGBMASKPIXELFORMATS_HXX
+#define INCLUDED_BASEBMP_RGBMASKPIXELFORMATS_HXX
+
+#include <basebmp/color.hxx>
+#include <basebmp/colortraits.hxx>
+#include <basebmp/accessor.hxx>
+#include <basebmp/pixeliterator.hxx>
+#include <basebmp/pixelformatadapters.hxx>
+#include <basebmp/metafunctions.hxx>
+#include <basebmp/endian.hxx>
+
+#include <vigra/numerictraits.hxx>
+#include <vigra/metaprogramming.hxx>
+
+#include <functional>
+
+namespace basebmp
+{
+
+/** Base class operating on RGB truecolor mask pixel
+
+ Use this template, if you have an (integer) pixel type, and three
+ bitmasks denoting where the channel bits are.
+
+ @tpl PixelType
+ Input pixel type to operate on
+
+ @tpl ColorType
+ Underlying color type, to convert the pixel values into
+
+ @tpl RedMask
+ Bitmask, to access the red bits in the data type
+
+ @tpl GreenMask
+ Bitmask, to access the green bits in the data type
+
+ @tpl BlueMask
+ Bitmask, to access the blue bits in the data type
+
+ @tpl SwapBytes
+ When true, the final pixel values will be byte-swapped before
+ passed on.
+ */
+template< typename PixelType,
+ typename ColorType,
+ unsigned int RedMask,
+ unsigned int GreenMask,
+ unsigned int BlueMask,
+ bool SwapBytes > struct RGBMaskFunctorBase
+{
+ typedef PixelType pixel_type;
+ typedef ColorType color_type;
+ typedef typename make_unsigned<pixel_type>::type unsigned_pixel_type;
+ typedef typename ColorTraits<ColorType>::component_type component_type;
+
+ // calc corrective shifts for all three channels in advance
+ enum {
+ red_shift = numberOfTrailingZeros<RedMask>::value,
+ green_shift = numberOfTrailingZeros<GreenMask>::value,
+ blue_shift = numberOfTrailingZeros<BlueMask>::value,
+
+ red_bits = bitcount<RedMask>::value,
+ green_bits = bitcount<GreenMask>::value,
+ blue_bits = bitcount<BlueMask>::value
+ };
+};
+
+template< typename PixelType,
+ typename ColorType,
+ unsigned int RedMask,
+ unsigned int GreenMask,
+ unsigned int BlueMask,
+ bool SwapBytes > struct RGBMaskGetter :
+ public RGBMaskFunctorBase<PixelType,
+ ColorType,
+ RedMask,
+ GreenMask,
+ BlueMask,
+ SwapBytes>,
+ public std::unary_function<PixelType, ColorType>
+{
+ typedef RGBMaskFunctorBase<PixelType,
+ ColorType,
+ RedMask,
+ GreenMask,
+ BlueMask,
+ SwapBytes> base_type;
+
+ ColorType operator()( PixelType v ) const
+ {
+ v = SwapBytes ? byteSwap(v) : v;
+
+ const typename base_type::unsigned_pixel_type red (v & RedMask);
+ const typename base_type::unsigned_pixel_type green(v & GreenMask);
+ const typename base_type::unsigned_pixel_type blue (v & BlueMask);
+
+ // shift color nibbles to right-aligend position. ORing it
+ // channel value shifted twice the number of channel bits, to
+ // spread the value into the component_type range
+ ColorType res( (shiftRight(red,
+ base_type::red_shift-8*
+ (signed)sizeof(typename base_type::component_type)+
+ base_type::red_bits)) |
+ (shiftRight(red,
+ base_type::red_shift-8*
+ (signed)sizeof(typename base_type::component_type)+
+ 2*base_type::red_bits)),
+
+ (shiftRight(green,
+ base_type::green_shift-8*
+ (signed)sizeof(typename base_type::component_type)+
+ base_type::green_bits)) |
+ (shiftRight(green,
+ base_type::green_shift-8*
+ (signed)sizeof(typename base_type::component_type)+
+ 2*base_type::green_bits)),
+
+ (shiftRight(blue,
+ base_type::blue_shift-8*
+ (signed)sizeof(typename base_type::component_type)+
+ base_type::blue_bits)) |
+ (shiftRight(blue,
+ base_type::blue_shift-8*
+ (signed)sizeof(typename base_type::component_type)+
+ 2*base_type::blue_bits)) );
+ return res;
+ }
+};
+
+template< typename PixelType,
+ typename ColorType,
+ unsigned int RedMask,
+ unsigned int GreenMask,
+ unsigned int BlueMask,
+ bool SwapBytes > struct RGBMaskSetter :
+ public RGBMaskFunctorBase<PixelType,
+ ColorType,
+ RedMask,
+ GreenMask,
+ BlueMask,
+ SwapBytes>,
+ public std::unary_function<ColorType, PixelType>
+{
+ typedef RGBMaskFunctorBase<PixelType,
+ ColorType,
+ RedMask,
+ GreenMask,
+ BlueMask,
+ SwapBytes> base_type;
+
+ PixelType operator()( ColorType const& c ) const
+ {
+ const typename base_type::unsigned_pixel_type red (c.getRed());
+ const typename base_type::unsigned_pixel_type green(c.getGreen());
+ const typename base_type::unsigned_pixel_type blue (c.getBlue());
+
+ typename base_type::unsigned_pixel_type res(
+ (shiftLeft(red,
+ base_type::red_shift-8*
+ (signed)sizeof(typename base_type::component_type)+
+ base_type::red_bits) & RedMask) |
+ (shiftLeft(green,
+ base_type::green_shift-8*
+ (signed)sizeof(typename base_type::component_type)+
+ base_type::green_bits) & GreenMask) |
+ (shiftLeft(blue,
+ base_type::blue_shift-8*
+ (signed)sizeof(typename base_type::component_type)+
+ base_type::blue_bits) & BlueMask) );
+
+ return SwapBytes ? byteSwap(res) : res;
+ }
+};
+
+//-----------------------------------------------------------------------------
+
+template< typename PixelType,
+ unsigned int RedMask,
+ unsigned int GreenMask,
+ unsigned int BlueMask,
+ bool SwapBytes > struct PixelFormatTraitsTemplate_RGBMask
+{
+ typedef PixelType pixel_type;
+
+ typedef RGBMaskGetter<pixel_type,
+ Color,
+ RedMask,
+ GreenMask,
+ BlueMask,
+ SwapBytes> getter_type;
+ typedef RGBMaskSetter<pixel_type,
+ Color,
+ RedMask,
+ GreenMask,
+ BlueMask,
+ SwapBytes> setter_type;
+
+ typedef PixelIterator<pixel_type> iterator_type;
+ typedef StandardAccessor<pixel_type> raw_accessor_type;
+ typedef AccessorSelector<
+ getter_type, setter_type> accessor_selector;
+};
+
+//-----------------------------------------------------------------------------
+
+// Hopefully this is an understandable plaintext explanation that matches
+// reality...
+
+// BASEBMP_TRUECOLORMASK_LSB_SWAP means that on a big-endian platform, a pixel
+// value when viewed as an integer (16 or 32 bits) has to be byte-swapped for
+// the channels to match the masks. Or equivalently (I think), on a big-endian
+// platform, the masks need to be byte-swapped to be correct.
+
+// I.e. on a litte-endian platform the masks work as such.
+
+// BASEBMP_TRUECOLORMASK_MSB_SWAP means the opposite. The masks work as such
+// on big-endian platforms, on little-endian platforms the pixel needs to be
+// byte-swapped for the masks to work.
+
+// So in a sense these two names are "backward". It sounds to me as if
+// BASEBMP_TRUECOLORMASK_LSB_SWAP would mean "when on LSB, swap" ;)
+
+#ifdef OSL_LITENDIAN
+# define BASEBMP_TRUECOLORMASK_LSB_SWAP false
+# define BASEBMP_TRUECOLORMASK_MSB_SWAP true
+#else
+# ifdef OSL_BIGENDIAN
+# define BASEBMP_TRUECOLORMASK_LSB_SWAP true
+# define BASEBMP_TRUECOLORMASK_MSB_SWAP false
+# else
+# error Undetermined endianness!
+# endif
+#endif
+
+//-----------------------------------------------------------------------------
+
+// 16bpp MSB RGB
+typedef PixelFormatTraitsTemplate_RGBMask<
+ sal_uInt16,
+ 0xF800,
+ 0x07E0,
+ 0x001F,
+ BASEBMP_TRUECOLORMASK_MSB_SWAP > PixelFormatTraits_RGB16_565_MSB;
+BASEBMP_SPECIALIZE_ACCESSORTRAITS(PixelFormatTraits_RGB16_565_MSB::getter_type,
+ PixelFormatTraits_RGB16_565_MSB::setter_type);
+
+// 16bpp LSB RGB
+typedef PixelFormatTraitsTemplate_RGBMask<
+ sal_uInt16,
+ 0xF800,
+ 0x07E0,
+ 0x001F,
+ BASEBMP_TRUECOLORMASK_LSB_SWAP > PixelFormatTraits_RGB16_565_LSB;
+BASEBMP_SPECIALIZE_ACCESSORTRAITS(PixelFormatTraits_RGB16_565_LSB::getter_type,
+ PixelFormatTraits_RGB16_565_LSB::setter_type);
+
+
+// 32bpp formats
+
+// The intent is that the order of channel names in the names of the 32bpp
+// format typedefs below correspond to the order of the channel bytes in
+// memory, if I understand correctly.... I think the point with the below
+// formats is that the channel byte order in memory is the same regardless of
+// platform byte order.
+
+// This one used to be called PixelFormatTraits_RGB32_888.
+
+typedef PixelFormatTraitsTemplate_RGBMask<
+ sal_uInt32,
+ 0x00FF0000,
+ 0x0000FF00,
+ 0x000000FF,
+ BASEBMP_TRUECOLORMASK_LSB_SWAP > PixelFormatTraits_BGRX32_8888;
+BASEBMP_SPECIALIZE_ACCESSORTRAITS(PixelFormatTraits_BGRX32_8888::getter_type,
+ PixelFormatTraits_BGRX32_8888::setter_type);
+
+// This one used to be called PixelFormatTraits_BGR32_888.
+
+typedef PixelFormatTraitsTemplate_RGBMask<
+ sal_uInt32,
+ 0x00FF0000,
+ 0x0000FF00,
+ 0x000000FF,
+ BASEBMP_TRUECOLORMASK_MSB_SWAP > PixelFormatTraits_XRGB32_8888;
+BASEBMP_SPECIALIZE_ACCESSORTRAITS(PixelFormatTraits_XRGB32_8888::getter_type,
+ PixelFormatTraits_XRGB32_8888::setter_type);
+
+// The following two ones were added for Android needs and for completeness
+
+typedef PixelFormatTraitsTemplate_RGBMask<
+ sal_uInt32,
+ 0xFF000000,
+ 0x00FF0000,
+ 0x0000FF00,
+ BASEBMP_TRUECOLORMASK_LSB_SWAP > PixelFormatTraits_XBGR32_8888;
+BASEBMP_SPECIALIZE_ACCESSORTRAITS(PixelFormatTraits_XBGR32_8888::getter_type,
+ PixelFormatTraits_XBGR32_8888::setter_type);
+
+typedef PixelFormatTraitsTemplate_RGBMask<
+ sal_uInt32,
+ 0xFF000000,
+ 0x00FF0000,
+ 0x0000FF00,
+ BASEBMP_TRUECOLORMASK_MSB_SWAP > PixelFormatTraits_RGBX32_8888;
+BASEBMP_SPECIALIZE_ACCESSORTRAITS(PixelFormatTraits_RGBX32_8888::getter_type,
+ PixelFormatTraits_RGBX32_8888::setter_type);
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_RGBMASKPIXELFORMATS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/scaleimage.hxx b/include/basebmp/scaleimage.hxx
new file mode 100644
index 000000000000..fc9022357fe6
--- /dev/null
+++ b/include/basebmp/scaleimage.hxx
@@ -0,0 +1,189 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_SCALEIMAGE_HXX
+#define INCLUDED_BASEBMP_SCALEIMAGE_HXX
+
+#include <osl/diagnose.h>
+
+#include <vigra/tuple.hxx>
+#include <vigra/copyimage.hxx>
+#include <vigra/basicimage.hxx>
+#include <vigra/iteratortraits.hxx>
+
+namespace basebmp
+{
+
+template< class SourceIter, class SourceAcc,
+ class DestIter, class DestAcc >
+void scaleLine( SourceIter s_begin,
+ SourceIter s_end,
+ SourceAcc s_acc,
+ DestIter d_begin,
+ DestIter d_end,
+ DestAcc d_acc )
+{
+ const int src_width = s_end - s_begin;
+ const int dest_width = d_end - d_begin;
+
+ OSL_ASSERT( src_width > 0 && dest_width > 0 );
+
+ if( src_width >= dest_width )
+ {
+ // shrink
+ int rem = 0;
+ while( s_begin != s_end )
+ {
+ if( rem >= 0 )
+ {
+ d_acc.set( s_acc(s_begin), d_begin );
+
+ rem -= src_width;
+ ++d_begin;
+ }
+
+ rem += dest_width;
+ ++s_begin;
+ }
+ }
+ else
+ {
+ // enlarge
+ int rem = -dest_width;
+ while( d_begin != d_end )
+ {
+ if( rem >= 0 )
+ {
+ rem -= dest_width;
+ ++s_begin;
+ }
+
+ d_acc.set( s_acc(s_begin), d_begin );
+
+ rem += src_width;
+ ++d_begin;
+ }
+ }
+}
+
+/** Scale an image using zero order interpolation (pixel replication)
+
+ Source and destination range must be at least one pixel wide and
+ high.
+
+ @param s_begin
+ Start iterator for source image
+
+ @param s_end
+ End iterator for source image
+
+ @param s_acc
+ Source accessor
+
+ @param d_begin
+ Start iterator for destination image
+
+ @param d_end
+ End iterator for destination image
+
+ @param d_acc
+ Destination accessor
+
+ @param bMustCopy
+ When true, scaleImage always copies source, even when doing 1:1
+ copy
+ */
+template< class SourceIter, class SourceAcc,
+ class DestIter, class DestAcc >
+void scaleImage( SourceIter s_begin,
+ SourceIter s_end,
+ SourceAcc s_acc,
+ DestIter d_begin,
+ DestIter d_end,
+ DestAcc d_acc,
+ bool bMustCopy=false )
+{
+ const int src_width ( s_end.x - s_begin.x );
+ const int src_height( s_end.y - s_begin.y );
+
+ const int dest_width ( d_end.x - d_begin.x );
+ const int dest_height( d_end.y - d_begin.y );
+
+ if( !bMustCopy &&
+ src_width == dest_width &&
+ src_height == dest_height )
+ {
+ // no scaling involved, can simply copy
+ vigra::copyImage( s_begin, s_end, s_acc,
+ d_begin, d_acc );
+ return;
+ }
+
+ typedef vigra::BasicImage<typename SourceAcc::value_type> TmpImage;
+ typedef typename TmpImage::traverser TmpImageIter;
+
+ TmpImage tmp_image(src_width,
+ dest_height);
+ TmpImageIter t_begin = tmp_image.upperLeft();
+
+ // scale in y direction
+ for( int x=0; x<src_width; ++x, ++s_begin.x, ++t_begin.x )
+ {
+ typename SourceIter::column_iterator s_cbegin = s_begin.columnIterator();
+ typename TmpImageIter::column_iterator t_cbegin = t_begin.columnIterator();
+
+ scaleLine(s_cbegin, s_cbegin+src_height, s_acc,
+ t_cbegin, t_cbegin+dest_height, tmp_image.accessor());
+ }
+
+ t_begin = tmp_image.upperLeft();
+
+ // scale in x direction
+ for( int y=0; y<dest_height; ++y, ++d_begin.y, ++t_begin.y )
+ {
+ typename DestIter::row_iterator d_rbegin = d_begin.rowIterator();
+ typename TmpImageIter::row_iterator t_rbegin = t_begin.rowIterator();
+
+ scaleLine(t_rbegin, t_rbegin+src_width, tmp_image.accessor(),
+ d_rbegin, d_rbegin+dest_width, d_acc);
+ }
+}
+
+/** Scale an image, range tuple version
+
+ @param bMustCopy
+ When true, scaleImage always copies source, even when doing 1:1
+ copy
+ */
+template< class SourceIter, class SourceAcc,
+ class DestIter, class DestAcc >
+inline void scaleImage( vigra::triple<SourceIter,SourceIter,SourceAcc> const& src,
+ vigra::triple<DestIter,DestIter,DestAcc> const& dst,
+ bool bMustCopy=false )
+{
+ scaleImage(src.first,src.second,src.third,
+ dst.first,dst.second,dst.third,
+ bMustCopy);
+}
+
+}
+
+#endif /* INCLUDED_BASEBMP_SCALEIMAGE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/scanlineformats.hxx b/include/basebmp/scanlineformats.hxx
new file mode 100644
index 000000000000..a1708980b5ac
--- /dev/null
+++ b/include/basebmp/scanlineformats.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_SCANLINEFORMATS_HXX
+#define INCLUDED_BASEBMP_SCANLINEFORMATS_HXX
+
+#include <sal/types.h>
+
+/* Definition of Scanline formats */
+
+namespace basebmp { namespace Format
+{
+ static const sal_Int32 NONE = 0;
+ static const sal_Int32 ONE_BIT_MSB_GREY = (sal_Int32)0x01;
+ static const sal_Int32 ONE_BIT_LSB_GREY = (sal_Int32)0x02;
+ static const sal_Int32 ONE_BIT_MSB_PAL = (sal_Int32)0x03;
+ static const sal_Int32 ONE_BIT_LSB_PAL = (sal_Int32)0x04;
+ static const sal_Int32 FOUR_BIT_MSB_GREY = (sal_Int32)0x05;
+ static const sal_Int32 FOUR_BIT_LSB_GREY = (sal_Int32)0x06;
+ static const sal_Int32 FOUR_BIT_MSB_PAL = (sal_Int32)0x07;
+ static const sal_Int32 FOUR_BIT_LSB_PAL = (sal_Int32)0x08;
+ static const sal_Int32 EIGHT_BIT_PAL = (sal_Int32)0x09;
+ static const sal_Int32 EIGHT_BIT_GREY = (sal_Int32)0x0A;
+ static const sal_Int32 SIXTEEN_BIT_LSB_TC_MASK = (sal_Int32)0x0B;
+ static const sal_Int32 SIXTEEN_BIT_MSB_TC_MASK = (sal_Int32)0x0C;
+ static const sal_Int32 TWENTYFOUR_BIT_TC_MASK = (sal_Int32)0x0D;
+ static const sal_Int32 THIRTYTWO_BIT_TC_MASK = (sal_Int32)0x0E;
+ // The order of the channels code letters indicates the order of the
+ // channel bytes in memory, I think
+ static const sal_Int32 THIRTYTWO_BIT_TC_MASK_BGRA = THIRTYTWO_BIT_TC_MASK;
+ static const sal_Int32 THIRTYTWO_BIT_TC_MASK_ARGB = (sal_Int32)0x0F;
+ static const sal_Int32 THIRTYTWO_BIT_TC_MASK_ABGR = (sal_Int32)0x10;
+ static const sal_Int32 THIRTYTWO_BIT_TC_MASK_RGBA = (sal_Int32)0x11;
+ static const sal_Int32 MAX = (sal_Int32)0x11;
+
+ const char *formatName(sal_Int32 nScanlineFormat);
+} }
+
+#endif /* INCLUDED_BASEBMP_SCANLINEFORMATS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/stridedarrayiterator.hxx b/include/basebmp/stridedarrayiterator.hxx
new file mode 100644
index 000000000000..6f5772e527c6
--- /dev/null
+++ b/include/basebmp/stridedarrayiterator.hxx
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_STRIDEDARRAYITERATOR_HXX
+#define INCLUDED_BASEBMP_STRIDEDARRAYITERATOR_HXX
+
+#include <basebmp/metafunctions.hxx>
+
+namespace basebmp
+{
+
+/** Like vigra::StridedArrayIterator
+
+ Changed semantics re. DirectionSelector<StridedArrayTag>: stride
+ now counts in <em>raw</em> bytes
+
+ Adapts given ptr, in a way that iterator increments move forward
+ in strided steps. Stride can, by the way, also be negative
+ */
+template< typename T > class StridedArrayIterator
+{
+public:
+ typedef typename clone_const<T, unsigned char>::type internal_type;
+
+ /** Create iterator
+
+ @param stride
+
+ Stride in bytes. Given value should better match memory layout
+ of T, as memory gets reinterpret-casted.
+ */
+ explicit StridedArrayIterator(int stride, T* ptr = 0) :
+ stride_(stride),
+ current_(reinterpret_cast<internal_type*>(ptr))
+ {}
+
+ /** Copy from other StridedArrayIterator, plus given offset
+
+ @param offset
+ Offset in bytes
+ */
+ StridedArrayIterator( StridedArrayIterator const& rSrc,
+ int offset ) :
+ stride_(rSrc.stride_),
+ current_(reinterpret_cast<internal_type*>(
+ reinterpret_cast<T*>(rSrc.current_)+offset))
+ {}
+
+ void operator++() {current_ += stride_; }
+ void operator++(int) {current_ += stride_; }
+ void operator--() {current_ -= stride_; }
+ void operator--(int) {current_ -= stride_; }
+ void operator+=(int dy) {current_ += dy*stride_; }
+ void operator-=(int dy) {current_ -= dy*stride_; }
+
+ int operator-(StridedArrayIterator const & rhs) const
+ { return (current_ - rhs.current_) / stride_; }
+
+ bool operator==(StridedArrayIterator const & rhs) const
+ { return current_ == rhs.current_; }
+
+ bool operator!=(StridedArrayIterator const & rhs) const
+ { return current_ != rhs.current_; }
+
+ bool operator<(StridedArrayIterator const & rhs) const
+ { return *this - rhs < 0; }
+
+ bool operator<=(StridedArrayIterator const & rhs) const
+ { return *this - rhs <= 0; }
+
+ bool operator>(StridedArrayIterator const & rhs) const
+ { return *this - rhs > 0; }
+
+ bool operator>=(StridedArrayIterator const & rhs) const
+ { return *this - rhs >= 0; }
+
+ T* operator()() const
+ { return reinterpret_cast<T*>(current_); }
+
+ T* operator()(int d) const
+ { return reinterpret_cast<T*>(current_ + d*stride_); }
+
+private:
+ int stride_;
+ internal_type* current_;
+};
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_STRIDEDARRAYITERATOR_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/tools.hxx b/include/basebmp/tools.hxx
new file mode 100644
index 000000000000..31854a1d5e25
--- /dev/null
+++ b/include/basebmp/tools.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_TOOLS_HXX
+#define INCLUDED_BASEBMP_TOOLS_HXX
+
+#include <basegfx/range/b2ibox.hxx>
+#include <basegfx/point/b2ipoint.hxx>
+#include <vigra/tuple.hxx>
+#include <vigra/diff2d.hxx>
+
+namespace basebmp
+{
+ inline vigra::Diff2D topLeft( const basegfx::B2IBox& rRange )
+ { return vigra::Diff2D(rRange.getMinX(),rRange.getMinY()); }
+
+ inline vigra::Diff2D bottomRight( const basegfx::B2IBox& rRange )
+ { return vigra::Diff2D(rRange.getMaxX(),rRange.getMaxY()); }
+
+ template< class Iterator, class Accessor >
+ inline vigra::triple<Iterator,Iterator,Accessor>
+ destIterRange(Iterator const& begin,
+ Accessor const& accessor,
+ const basegfx::B2IBox& rRange)
+ {
+ return vigra::triple<Iterator,Iterator,Accessor>(
+ begin + topLeft(rRange),
+ begin + bottomRight(rRange),
+ accessor);
+ }
+
+ template< class Iterator, class Accessor >
+ inline vigra::triple<Iterator,Iterator,Accessor>
+ srcIterRange(Iterator const& begin,
+ Accessor const& accessor,
+ const basegfx::B2IBox& rRange)
+ {
+ return vigra::triple<Iterator,Iterator,Accessor>(
+ begin + topLeft(rRange),
+ begin + bottomRight(rRange),
+ accessor);
+ }
+
+ template< class Iterator, class Accessor >
+ inline vigra::pair<Iterator,Accessor>
+ srcIter(Iterator const& begin,
+ Accessor const& accessor,
+ const basegfx::B2IPoint& rPt)
+ {
+ return vigra::pair<Iterator,Accessor>(
+ begin + vigra::Diff2D(rPt.getX(),rPt.getY()),
+ accessor);
+ }
+
+ template< class Iterator, class Accessor >
+ inline vigra::pair<Iterator,Accessor>
+ destIter(Iterator const& begin,
+ Accessor const& accessor,
+ const basegfx::B2IPoint& rPt)
+ {
+ return vigra::pair<Iterator,Accessor>(
+ begin + vigra::Diff2D(rPt.getX(),rPt.getY()),
+ accessor);
+ }
+}
+
+#endif /* INCLUDED_BASEBMP_TOOLS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/basegfxdllapi.h b/include/basegfx/basegfxdllapi.h
new file mode 100644
index 000000000000..b71f0755d277
--- /dev/null
+++ b/include/basegfx/basegfxdllapi.h
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEGFXDLLAPI_H
+#define INCLUDED_BASEGFXDLLAPI_H
+
+#if defined BASEGFX_STATICLIBRARY
+
+#define BASEGFX_DLLPUBLIC
+#define BASEGFX_DLLPRIVATE
+
+#else /*BASEGFX_STATICLIBRARY*/
+
+#if defined BASEGFX_DLLIMPLEMENTATION
+#define BASEGFX_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define BASEGFX_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define BASEGFX_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif /*BASEGFX_STATICLIBRARY*/
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/color/bcolor.hxx b/include/basegfx/color/bcolor.hxx
new file mode 100644
index 000000000000..9b91e212ec89
--- /dev/null
+++ b/include/basegfx/color/bcolor.hxx
@@ -0,0 +1,229 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_COLOR_BCOLOR_HXX
+#define _BGFX_COLOR_BCOLOR_HXX
+
+#include <basegfx/tuple/b3dtuple.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <vector>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+namespace com { namespace sun { namespace star { namespace rendering {
+ class XGraphicDevice;
+}}}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ /** Base Color class with three double values
+
+ This class derives all operators and common handling for
+ a 3D data class from B3DTuple. All necessary extensions
+ which are special for colors will be added here.
+
+ @see B3DTuple
+ */
+ class BASEGFX_DLLPUBLIC SAL_WARN_UNUSED BColor : public B3DTuple
+ {
+ public:
+ /** Create a Color with red, green and blue components from [0.0 to 1.0]
+
+ The color is initialized to (0.0, 0.0, 0.0)
+ */
+ BColor()
+ : B3DTuple()
+ {}
+
+ /** Create a 3D Color
+
+ @param fRed
+ @param fGreen
+ @param fBlue
+ These parameters are used to initialize the red, green and blue intensities of the color
+ */
+ BColor(double fRed, double fGreen, double fBlue)
+ : B3DTuple(fRed, fGreen, fBlue)
+ {}
+
+ /** Create a 3D Color
+
+ @param fLuminosity
+ The parameter is used to initialize the red, green and blue intensities of the color
+ */
+ explicit BColor(double fLuminosity)
+ : B3DTuple(fLuminosity, fLuminosity, fLuminosity)
+ {}
+
+ /** Create a copy of a Color
+
+ @param rVec
+ The Color which will be copied.
+ */
+ BColor(const BColor& rVec)
+ : B3DTuple(rVec)
+ {}
+
+ /** constructor with tuple to allow copy-constructing
+ from B3DTuple-based classes
+ */
+ BColor(const ::basegfx::B3DTuple& rTuple)
+ : B3DTuple(rTuple)
+ {}
+
+ ~BColor()
+ {}
+
+ // data access read
+ double getRed() const { return mfX; }
+ double getGreen() const { return mfY; }
+ double getBlue() const { return mfZ; }
+
+ // data access write
+ void setRed(double fNew) { mfX = fNew; }
+ void setGreen(double fNew) { mfY = fNew; }
+ void setBlue(double fNew) { mfZ = fNew; }
+
+ /** *=operator to allow usage from BColor, too
+ */
+ BColor& operator*=( const BColor& rPnt )
+ {
+ mfX *= rPnt.mfX;
+ mfY *= rPnt.mfY;
+ mfZ *= rPnt.mfZ;
+ return *this;
+ }
+
+ /** *=operator to allow usage from BColor, too
+ */
+ BColor& operator*=(double t)
+ {
+ mfX *= t;
+ mfY *= t;
+ mfZ *= t;
+ return *this;
+ }
+
+ /** assignment operator to allow assigning the results
+ of B3DTuple calculations
+ */
+ BColor& operator=( const ::basegfx::B3DTuple& rVec )
+ {
+ mfX = rVec.getX();
+ mfY = rVec.getY();
+ mfZ = rVec.getZ();
+ return *this;
+ }
+
+ // blend to another color using luminance
+ void blend(const BColor& rColor)
+ {
+ const double fLuminance(luminance());
+ mfX = rColor.getRed() * fLuminance;
+ mfY = rColor.getGreen() * fLuminance;
+ mfZ = rColor.getBlue() * fLuminance;
+ }
+
+ // luminance
+ double luminance() const
+ {
+ const double fRedWeight(77.0 / 256.0); // 0.30
+ const double fGreenWeight(151.0 / 256.0); // 0.59
+ const double fBlueWeight(28.0 / 256.0); // 0.11
+
+ return (mfX * fRedWeight + mfY * fGreenWeight + mfZ * fBlueWeight);
+ }
+
+ // distances in color space
+ double getDistanceRed(const BColor& rColor) const { return (getRed() > rColor.getRed() ? getRed() - rColor.getRed() : rColor.getRed() - getRed()); }
+ double getDistanceGreen(const BColor& rColor) const { return (getGreen() > rColor.getGreen() ? getGreen() - rColor.getGreen() : rColor.getGreen() - getGreen()); }
+ double getDistanceBlue(const BColor& rColor) const { return (getBlue() > rColor.getBlue() ? getBlue() - rColor.getBlue() : rColor.getBlue() - getBlue()); }
+
+ double getDistance(const BColor& rColor) const
+ {
+ const double fDistR(getDistanceRed(rColor));
+ const double fDistG(getDistanceGreen(rColor));
+ const double fDistB(getDistanceBlue(rColor));
+
+ return sqrt(fDistR * fDistR + fDistG * fDistG + fDistB * fDistB);
+ }
+
+ double getMinimumDistance(const BColor& rColor) const
+ {
+ const double fDistR(getDistanceRed(rColor));
+ const double fDistG(getDistanceGreen(rColor));
+ const double fDistB(getDistanceBlue(rColor));
+
+ double fRetval(fDistR < fDistG ? fDistR : fDistG);
+ return (fRetval < fDistB ? fRetval : fDistB);
+ }
+
+ double getMaximumDistance(const BColor& rColor) const
+ {
+ const double fDistR(getDistanceRed(rColor));
+ const double fDistG(getDistanceGreen(rColor));
+ const double fDistB(getDistanceBlue(rColor));
+
+ double fRetval(fDistR > fDistG ? fDistR : fDistG);
+ return (fRetval > fDistB ? fRetval : fDistB);
+ }
+
+ // clamp color to [0.0..1.0] values in all three intensity components
+ void clamp()
+ {
+ mfX = basegfx::clamp(mfX, 0.0, 1.0);
+ mfY = basegfx::clamp(mfY, 0.0, 1.0);
+ mfZ = basegfx::clamp(mfZ, 0.0, 1.0);
+ }
+
+ void invert()
+ {
+ mfX = 1.0 - mfX;
+ mfY = 1.0 - mfY;
+ mfZ = 1.0 - mfZ;
+ }
+
+ static const BColor& getEmptyBColor()
+ {
+ return (const BColor&) ::basegfx::B3DTuple::getEmptyTuple();
+ }
+
+ com::sun::star::uno::Sequence< double > colorToDoubleSequence(const com::sun::star::uno::Reference< com::sun::star::rendering::XGraphicDevice >& /*xGraphicDevice*/) const
+ {
+ com::sun::star::uno::Sequence< double > aRet(4);
+ double* pRet = aRet.getArray();
+
+ pRet[0] = mfX;
+ pRet[1] = mfY;
+ pRet[2] = mfZ;
+ pRet[3] = 1.0;
+
+ return aRet;
+ }
+ };
+} // end of namespace basegfx
+
+#endif /* _BGFX_COLOR_BCOLOR_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/color/bcolormodifier.hxx b/include/basegfx/color/bcolormodifier.hxx
new file mode 100644
index 000000000000..4b6f04efc8e9
--- /dev/null
+++ b/include/basegfx/color/bcolormodifier.hxx
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_COLOR_BCOLORMODIFIER_HXX
+#define _BGFX_COLOR_BCOLORMODIFIER_HXX
+
+#include <basegfx/color/bcolor.hxx>
+#include <vector>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ /** Descriptor for type of color modification
+ */
+ enum BColorModifyMode
+ {
+ BCOLORMODIFYMODE_REPLACE, // replace all color with local color
+ BCOLORMODIFYMODE_INTERPOLATE, // interpolate color between given and local with local value
+ BCOLORMODIFYMODE_GRAY, // convert color to gray
+ BCOLORMODIFYMODE_BLACKANDWHITE, // convert color to B&W, local value is treshhold
+ BCOLORMODIFYMODE_INVERT, // invert color
+ BCOLORMODIFYMODE_LUMINANCE_TO_ALPHA // convert color to alpha value (used for Svg Mask)
+ };
+
+ /** Class to hold a color, value and mode for a color modification. Color modification is
+ done calling the getModifiedColor() method
+ */
+ class BASEGFX_DLLPUBLIC SAL_WARN_UNUSED BColorModifier
+ {
+ protected:
+ ::basegfx::BColor maBColor;
+ double mfValue;
+ BColorModifyMode meMode;
+
+ public:
+ BColorModifier(
+ const ::basegfx::BColor& rBColor,
+ double fValue = 0.5,
+ BColorModifyMode eMode = BCOLORMODIFYMODE_REPLACE)
+ : maBColor(rBColor),
+ mfValue(fValue),
+ meMode(eMode)
+ {}
+
+ // compare operator(s)
+ bool operator==(const BColorModifier& rCompare) const
+ {
+ return (maBColor == rCompare.maBColor && mfValue == rCompare.mfValue && meMode == rCompare.meMode);
+ }
+
+ bool operator!=(const BColorModifier& rCompare) const
+ {
+ return !(operator==(rCompare));
+ }
+
+ // data access
+ const ::basegfx::BColor& getBColor() const { return maBColor; }
+ double getValue() const { return mfValue; }
+ BColorModifyMode getMode() const { return meMode; }
+
+ // compute modified color
+ ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& aSourceColor) const;
+ };
+
+ /** Class to hold a stack of BColorModifiers and to get the modified color with
+ applying all existing entry changes
+ */
+ class BASEGFX_DLLPUBLIC BColorModifierStack
+ {
+ protected:
+ ::std::vector< BColorModifier > maBColorModifiers;
+
+ public:
+ sal_uInt32 count() const
+ {
+ return maBColorModifiers.size();
+ }
+
+ const BColorModifier& getBColorModifier(sal_uInt32 nIndex) const
+ {
+ OSL_ENSURE(nIndex < count(), "BColorModifierStack: Access out of range (!)");
+ return maBColorModifiers[nIndex];
+ }
+
+ ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& rSource) const
+ {
+ if(count())
+ {
+ ::basegfx::BColor aRetval(rSource);
+ ::std::vector< BColorModifier >::const_iterator aEnd(maBColorModifiers.end());
+
+ while(aEnd != maBColorModifiers.begin())
+ {
+ aRetval = (--aEnd)->getModifiedColor(aRetval);
+ }
+
+ return aRetval;
+ }
+ else
+ {
+ return rSource;
+ }
+ }
+
+ void push(const BColorModifier& rNew)
+ {
+ maBColorModifiers.push_back(rNew);
+ }
+
+ void pop()
+ {
+ maBColorModifiers.pop_back();
+ }
+ };
+} // end of namespace basegfx
+
+#endif // _BGFX_COLOR_BCOLORMODIFIER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/color/bcolortools.hxx b/include/basegfx/color/bcolortools.hxx
new file mode 100644
index 000000000000..42ac7aafb3cc
--- /dev/null
+++ b/include/basegfx/color/bcolortools.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_COLOR_BCOLORTOOLS_HXX
+#define _BGFX_COLOR_BCOLORTOOLS_HXX
+
+#include <sal/types.h>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ class BColor;
+
+ namespace tools
+ {
+ /// Transform from RGB to HSL
+ BASEGFX_DLLPUBLIC BColor rgb2hsl(const BColor& rRGBColor);
+ /// Transform from HSL to RGB
+ BASEGFX_DLLPUBLIC BColor hsl2rgb(const BColor& rHSLColor);
+
+ /// Transform from RGB to HSV
+ BASEGFX_DLLPUBLIC BColor rgb2hsv(const BColor& rRGBColor);
+ /// Transform from HSV to RGB
+ BASEGFX_DLLPUBLIC BColor hsv2rgb(const BColor& rHSVColor);
+
+ /// Transform from Rec. 709 RGB (D65 white point) into CIE XYZ
+ BASEGFX_DLLPUBLIC BColor rgb2ciexyz( const BColor& rRGBColor );
+
+ }
+} // end of namespace basegfx
+
+#endif /* _BGFX_COLOR_BCOLORTOOLS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/curve/b2dbeziertools.hxx b/include/basegfx/curve/b2dbeziertools.hxx
new file mode 100644
index 000000000000..f52f00a1912f
--- /dev/null
+++ b/include/basegfx/curve/b2dbeziertools.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_CURVE_B2DBEZIERTOOLS_HXX
+#define _BGFX_CURVE_B2DBEZIERTOOLS_HXX
+
+#include <sal/types.h>
+#include <vector>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx
+{
+ class B2DCubicBezier;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ class BASEGFX_DLLPUBLIC B2DCubicBezierHelper
+ {
+ private:
+ ::std::vector< double > maLengthArray;
+ sal_uInt32 mnEdgeCount;
+
+ public:
+ explicit B2DCubicBezierHelper(const B2DCubicBezier& rBase, sal_uInt32 nDivisions = 9);
+
+ double getLength() const { if(!maLengthArray.empty()) return maLengthArray[maLengthArray.size() - 1]; else return 0.0; }
+ double distanceToRelative(double fDistance) const;
+ };
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif /* _BGFX_CURVE_B2DBEZIERTOOLS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/curve/b2dcubicbezier.hxx b/include/basegfx/curve/b2dcubicbezier.hxx
new file mode 100644
index 000000000000..003a1970bb0a
--- /dev/null
+++ b/include/basegfx/curve/b2dcubicbezier.hxx
@@ -0,0 +1,200 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_CURVE_B2DCUBICBEZIER_HXX
+#define _BGFX_CURVE_B2DCUBICBEZIER_HXX
+
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+namespace basegfx
+{
+ class B2DPolygon;
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ class BASEGFX_DLLPUBLIC B2DCubicBezier
+ {
+ B2DPoint maStartPoint;
+ B2DPoint maEndPoint;
+ B2DPoint maControlPointA;
+ B2DPoint maControlPointB;
+
+ public:
+ B2DCubicBezier();
+ B2DCubicBezier(const B2DCubicBezier& rBezier);
+ B2DCubicBezier(const B2DPoint& rStart, const B2DPoint& rControlPointA, const B2DPoint& rControlPointB, const B2DPoint& rEnd);
+ ~B2DCubicBezier();
+
+ // assignment operator
+ B2DCubicBezier& operator=(const B2DCubicBezier& rBezier);
+
+ // compare operators
+ bool operator==(const B2DCubicBezier& rBezier) const;
+ bool operator!=(const B2DCubicBezier& rBezier) const;
+ bool equal(const B2DCubicBezier& rBezier) const;
+
+ // test if vectors are used
+ bool isBezier() const;
+
+ // test if contained bezier is trivial and reset vectors accordingly
+ void testAndSolveTrivialBezier();
+
+ /** get length of edge
+
+ This method handles beziers and simple edges. For
+ beziers, the deviation describes the maximum allowed
+ deviation from the real edge length. The default
+ allows a deviation of 1% from the correct length.
+
+ For beziers, there is no direct way to get the length,
+ thus this method may subdivide the bezier edge and may
+ not be cheap.
+
+ @param fDeviation
+ The maximal allowed deviation between correct length
+ and bezier edge length
+
+ @return
+ The length of the edge
+ */
+ double getLength(double fDeviation = 0.01) const;
+
+ // get distance between start and end point
+ double getEdgeLength() const;
+
+ // get length of control polygon
+ double getControlPolygonLength() const;
+
+ // data interface
+ B2DPoint getStartPoint() const { return maStartPoint; }
+ void setStartPoint(const B2DPoint& rValue) { maStartPoint = rValue; }
+
+ B2DPoint getEndPoint() const { return maEndPoint; }
+ void setEndPoint(const B2DPoint& rValue) { maEndPoint = rValue; }
+
+ B2DPoint getControlPointA() const { return maControlPointA; }
+ void setControlPointA(const B2DPoint& rValue) { maControlPointA = rValue; }
+
+ B2DPoint getControlPointB() const { return maControlPointB; }
+ void setControlPointB(const B2DPoint& rValue) { maControlPointB = rValue; }
+
+ /** get the tangent in point t
+
+ This method handles all the exceptions, e.g. when control point
+ A is equal to start point and/or control point B is equal to end
+ point
+
+ @param t
+ The bezier index in the range [0.0 .. 1.0]. It will be truncated.
+
+ @return
+ The tangent vector in point t
+ */
+ B2DVector getTangent(double t) const;
+
+ /** adaptive subdivide by angle criteria
+ no start point is added, but all necessary created edges
+ and the end point
+ #i37443# allow the criteria to get unsharp in recursions
+ */
+ void adaptiveSubdivideByAngle(B2DPolygon& rTarget, double fAngleBound, bool bAllowUnsharpen) const;
+
+ /** #i37443# adaptive subdivide by nCount subdivisions
+ no start point is added, but all necessary created edges
+ and the end point
+ */
+ void adaptiveSubdivideByCount(B2DPolygon& rTarget, sal_uInt32 nCount) const;
+
+ /** Subdivide cubic bezier segment.
+
+ This function adaptively subdivides the bezier
+ segment into as much straight line segments as necessary,
+ such that the maximal orthogonal distance from any of the
+ segments to the true curve is less than the given error
+ value.
+ No start point is added, but all necessary created edges
+ and the end point
+
+ @param rPoly
+ Output polygon. The subdivided bezier segment is added to
+ this polygon via B2DPolygon::append().
+
+ @param rCurve
+ The cubic bezier curve to subdivide
+
+ @param fDistanceBound
+ Bound on the maximal distance of the approximation to the
+ true curve.
+ */
+ void adaptiveSubdivideByDistance(B2DPolygon& rTarget, double fDistanceBound) const;
+
+ // get point at given relative position
+ B2DPoint interpolatePoint(double t) const;
+
+ // calculate the smallest distance from given point to this cubic bezier segment
+ // and return the value. The relative position on the segment is returned in rCut.
+ double getSmallestDistancePointToBezierSegment(const B2DPoint& rTestPoint, double& rCut) const;
+
+ // do a split at position t and fill both resulting segments
+ void split(double t, B2DCubicBezier* pBezierA, B2DCubicBezier* pBezierB) const;
+
+ // extract snippet from fStart to fEnd from this bezier
+ B2DCubicBezier snippet(double fStart, double fEnd) const;
+
+ // get range including conrol points
+ B2DRange getRange() const;
+
+ /** Get the minimum extremum position t
+
+ @param rfResult
+ Will be changed and set to a eventually found split value which should be in the
+ range [0.0 .. 1.0]. It will be the smallest current extremum; there may be more
+
+ @return
+ Returns true if there was at least one extremum found
+ */
+ bool getMinimumExtremumPosition(double& rfResult) const;
+
+ /** Get all extremum pos of this segment
+
+ This method will calculate all extremum positions of the segment
+ and add them to rResults if they are in the range ]0.0 .. 1.0[
+
+ @param rResults
+ The vector of doubles where the results will be added. Evtl.
+ existing contents will be removed since an empty vector is a
+ necessary result to express that there are no extreme positions
+ anymore. Since there is an upper maximum of 4 values, it makes
+ sense to use reserve(4) at the vector as preparation.
+ */
+ void getAllExtremumPositions(::std::vector< double >& rResults) const;
+ };
+} // end of namespace basegfx
+
+#endif /* _BGFX_CURVE_B2DCUBICBEZIER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/matrix/b2dhommatrix.hxx b/include/basegfx/matrix/b2dhommatrix.hxx
new file mode 100644
index 000000000000..30204b91fad5
--- /dev/null
+++ b/include/basegfx/matrix/b2dhommatrix.hxx
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX
+#define _BGFX_MATRIX_B2DHOMMATRIX_HXX
+
+#include <sal/types.h>
+#include <o3tl/cow_wrapper.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ class B2DTuple;
+ class Impl2DHomMatrix;
+
+ class BASEGFX_DLLPUBLIC B2DHomMatrix
+ {
+ public:
+ typedef o3tl::cow_wrapper< Impl2DHomMatrix > ImplType;
+
+ private:
+ ImplType mpImpl;
+
+ public:
+ B2DHomMatrix();
+ B2DHomMatrix(const B2DHomMatrix& rMat);
+ ~B2DHomMatrix();
+
+ /** constructor to allow setting all needed values for a 3x2 matrix at once. The
+ parameter f_0x1 e.g. is the same as using set(0, 1, f)
+ */
+ B2DHomMatrix(double f_0x0, double f_0x1, double f_0x2, double f_1x0, double f_1x1, double f_1x2);
+
+ double get(sal_uInt16 nRow, sal_uInt16 nColumn) const;
+ void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue);
+
+ /** allow setting all needed values for a 3x2 matrix in one call. The
+ parameter f_0x1 e.g. is the same as using set(0, 1, f)
+ */
+ void set3x2(double f_0x0, double f_0x1, double f_0x2, double f_1x0, double f_1x1, double f_1x2);
+
+ // test if last line is default to see if last line needs to be
+ // involved in calculations
+ bool isLastLineDefault() const;
+
+ // reset to a standard matrix
+ bool isIdentity() const;
+ void identity();
+
+ bool isInvertible() const;
+ bool invert();
+
+ void rotate(double fRadiant);
+
+ void translate(double fX, double fY);
+
+ void scale(double fX, double fY);
+
+ // Shearing-Matrices
+ void shearX(double fSx);
+ void shearY(double fSy);
+
+ B2DHomMatrix& operator+=(const B2DHomMatrix& rMat);
+ B2DHomMatrix& operator-=(const B2DHomMatrix& rMat);
+
+ bool operator==(const B2DHomMatrix& rMat) const;
+ bool operator!=(const B2DHomMatrix& rMat) const;
+
+ B2DHomMatrix& operator*=(double fValue);
+ B2DHomMatrix& operator/=(double fValue);
+
+ // matrix multiplication from the left to the local
+ B2DHomMatrix& operator*=(const B2DHomMatrix& rMat);
+
+ // assignment operator
+ B2DHomMatrix& operator=(const B2DHomMatrix& rMat);
+
+ // Help routine to decompose given homogen 3x3 matrix to components. A correction of
+ // the components is done to avoid inaccuracies.
+ bool decompose(B2DTuple& rScale, B2DTuple& rTranslate, double& rRotate, double& rShearX) const;
+ };
+
+ // addition, subtraction
+ inline B2DHomMatrix operator+(const B2DHomMatrix& rMatA, const B2DHomMatrix& rMatB)
+ {
+ B2DHomMatrix aSum(rMatA);
+ aSum += rMatB;
+ return aSum;
+ }
+
+ inline B2DHomMatrix operator-(const B2DHomMatrix& rMatA, const B2DHomMatrix& rMatB)
+ {
+ B2DHomMatrix aDiv(rMatA);
+ aDiv -= rMatB;
+ return aDiv;
+ }
+
+ // multiplication, division by a constant
+ inline B2DHomMatrix operator*(const B2DHomMatrix& rMat, double fValue)
+ {
+ B2DHomMatrix aNew(rMat);
+ aNew *= fValue;
+ return aNew;
+ }
+
+ inline B2DHomMatrix operator/(const B2DHomMatrix& rMat, double fValue)
+ {
+ B2DHomMatrix aNew(rMat);
+ aNew *= 1.0 / fValue;
+ return aNew;
+ }
+
+ inline B2DHomMatrix operator*(const B2DHomMatrix& rMatA, const B2DHomMatrix& rMatB)
+ {
+ B2DHomMatrix aMul(rMatB);
+ aMul *= rMatA;
+ return aMul;
+ }
+} // end of namespace basegfx
+
+#endif /* _BGFX_MATRIX_B2DHOMMATRIX_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/matrix/b2dhommatrixtools.hxx b/include/basegfx/matrix/b2dhommatrixtools.hxx
new file mode 100644
index 000000000000..ed255360f831
--- /dev/null
+++ b/include/basegfx/matrix/b2dhommatrixtools.hxx
@@ -0,0 +1,225 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_MATRIX_B2DHOMMATRIXTOOLS_HXX
+#define _BGFX_MATRIX_B2DHOMMATRIXTOOLS_HXX
+
+#include <sal/types.h>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+
+///////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ namespace tools
+ {
+ /** If the rotation angle is an approximate multiple of pi/2,
+ force fSin/fCos to -1/0/1, to maintain orthogonality (which
+ might also be advantageous for the other cases, but: for
+ multiples of pi/2, the exact values _can_ be attained. It
+ would be largely unintuitive, if a 180 degrees rotation
+ would introduce slight roundoff errors, instead of exactly
+ mirroring the coordinate system)
+ */
+ BASEGFX_DLLPUBLIC void createSinCosOrthogonal(double& o_rSin, double& rCos, double fRadiant);
+
+ /** Tooling methods for on-the-fly matrix generation e.g. for inline
+ multiplications
+ */
+ BASEGFX_DLLPUBLIC B2DHomMatrix createScaleB2DHomMatrix(double fScaleX, double fScaleY);
+ BASEGFX_DLLPUBLIC B2DHomMatrix createShearXB2DHomMatrix(double fShearX);
+ BASEGFX_DLLPUBLIC B2DHomMatrix createShearYB2DHomMatrix(double fShearY);
+ BASEGFX_DLLPUBLIC B2DHomMatrix createRotateB2DHomMatrix(double fRadiant);
+ BASEGFX_DLLPUBLIC B2DHomMatrix createTranslateB2DHomMatrix(double fTranslateX, double fTranslateY);
+
+ /// inline versions for parameters as tuples
+ inline B2DHomMatrix createScaleB2DHomMatrix(const B2DTuple& rScale)
+ {
+ return createScaleB2DHomMatrix(rScale.getX(), rScale.getY());
+ }
+
+ inline B2DHomMatrix createTranslateB2DHomMatrix(const B2DTuple& rTranslate)
+ {
+ return createTranslateB2DHomMatrix(rTranslate.getX(), rTranslate.getY());
+ }
+
+ /** Tooling methods for faster completely combined matrix creation
+ when scale, shearX, rotation and translation needs to be done in
+ exactly that order. It's faster since it direcly calculates
+ each matrix value based on a symbolic calculation of the three
+ matrix multiplications.
+ Inline versions for parameters as tuples added, too.
+ */
+ BASEGFX_DLLPUBLIC B2DHomMatrix createScaleShearXRotateTranslateB2DHomMatrix(
+ double fScaleX, double fScaleY,
+ double fShearX,
+ double fRadiant,
+ double fTranslateX, double fTranslateY);
+ inline B2DHomMatrix createScaleShearXRotateTranslateB2DHomMatrix(
+ const B2DTuple& rScale,
+ double fShearX,
+ double fRadiant,
+ const B2DTuple& rTranslate)
+ {
+ return createScaleShearXRotateTranslateB2DHomMatrix(
+ rScale.getX(), rScale.getY(),
+ fShearX,
+ fRadiant,
+ rTranslate.getX(), rTranslate.getY());
+ }
+
+ BASEGFX_DLLPUBLIC B2DHomMatrix createShearXRotateTranslateB2DHomMatrix(
+ double fShearX,
+ double fRadiant,
+ double fTranslateX, double fTranslateY);
+ inline B2DHomMatrix createShearXRotateTranslateB2DHomMatrix(
+ double fShearX,
+ double fRadiant,
+ const B2DTuple& rTranslate)
+ {
+ return createShearXRotateTranslateB2DHomMatrix(
+ fShearX,
+ fRadiant,
+ rTranslate.getX(), rTranslate.getY());
+ }
+
+ BASEGFX_DLLPUBLIC B2DHomMatrix createScaleTranslateB2DHomMatrix(
+ double fScaleX, double fScaleY,
+ double fTranslateX, double fTranslateY);
+ inline B2DHomMatrix createScaleTranslateB2DHomMatrix(
+ const B2DTuple& rScale,
+ const B2DTuple& rTranslate)
+ {
+ return createScaleTranslateB2DHomMatrix(
+ rScale.getX(), rScale.getY(),
+ rTranslate.getX(), rTranslate.getY());
+ }
+
+ /// special for the often used case of rotation around a point
+ BASEGFX_DLLPUBLIC B2DHomMatrix createRotateAroundPoint(
+ double fPointX, double fPointY,
+ double fRadiant);
+ inline B2DHomMatrix createRotateAroundPoint(
+ const B2DTuple& rPoint,
+ double fRadiant)
+ {
+ return createRotateAroundPoint(
+ rPoint.getX(), rPoint.getY(),
+ fRadiant);
+ }
+
+ } // end of namespace tools
+} // end of namespace basegfx
+
+///////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ namespace tools
+ {
+ class BASEGFX_DLLPUBLIC B2DHomMatrixBufferedDecompose
+ {
+ private:
+ B2DVector maScale;
+ B2DVector maTranslate;
+ double mfRotate;
+ double mfShearX;
+
+ public:
+ B2DHomMatrixBufferedDecompose(const B2DHomMatrix& rB2DHomMatrix = B2DHomMatrix())
+ : maScale(),
+ maTranslate(),
+ mfRotate(0.0),
+ mfShearX(0.0)
+ {
+ rB2DHomMatrix.decompose(maScale, maTranslate, mfRotate, mfShearX);
+ }
+
+ // data access
+ B2DHomMatrix getB2DHomMatrix() const
+ {
+ return createScaleShearXRotateTranslateB2DHomMatrix(
+ maScale, mfShearX, mfRotate, maTranslate);
+ }
+
+ const B2DVector& getScale() const { return maScale; }
+ const B2DVector& getTranslate() const { return maTranslate; }
+ double getRotate() const { return mfRotate; }
+ double getShearX() const { return mfShearX; }
+ };
+ } // end of namespace tools
+} // end of namespace basegfx
+
+///////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ namespace tools
+ {
+ class BASEGFX_DLLPUBLIC B2DHomMatrixBufferedOnDemandDecompose
+ {
+ private:
+ B2DHomMatrix maB2DHomMatrix;
+ B2DVector maScale;
+ B2DVector maTranslate;
+ double mfRotate;
+ double mfShearX;
+
+ // bitfield
+ unsigned mbDecomposed : 1;
+
+ void impCheckDecompose()
+ {
+ if(!mbDecomposed)
+ {
+ maB2DHomMatrix.decompose(maScale, maTranslate, mfRotate, mfShearX);
+ mbDecomposed = true;
+ }
+ }
+
+ public:
+ B2DHomMatrixBufferedOnDemandDecompose(const B2DHomMatrix& rB2DHomMatrix = B2DHomMatrix())
+ : maB2DHomMatrix(rB2DHomMatrix),
+ maScale(),
+ maTranslate(),
+ mfRotate(0.0),
+ mfShearX(0.0),
+ mbDecomposed(false)
+ {
+ }
+
+ // data access
+ const B2DHomMatrix& getB2DHomMatrix() const { return maB2DHomMatrix; }
+ const B2DVector& getScale() const { const_cast< B2DHomMatrixBufferedOnDemandDecompose* >(this)->impCheckDecompose(); return maScale; }
+ const B2DVector& getTranslate() const { const_cast< B2DHomMatrixBufferedOnDemandDecompose* >(this)->impCheckDecompose(); return maTranslate; }
+ double getRotate() const { const_cast< B2DHomMatrixBufferedOnDemandDecompose* >(this)->impCheckDecompose(); return mfRotate; }
+ double getShearX() const { const_cast< B2DHomMatrixBufferedOnDemandDecompose* >(this)->impCheckDecompose(); return mfShearX; }
+ };
+ } // end of namespace tools
+
+} // end of namespace basegfx
+
+///////////////////////////////////////////////////////////////////////////////
+
+#endif /* _BGFX_MATRIX_B2DHOMMATRIXTOOLS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/matrix/b3dhommatrix.hxx b/include/basegfx/matrix/b3dhommatrix.hxx
new file mode 100644
index 000000000000..037d400d674f
--- /dev/null
+++ b/include/basegfx/matrix/b3dhommatrix.hxx
@@ -0,0 +1,155 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_MATRIX_B3DHOMMATRIX_HXX
+#define _BGFX_MATRIX_B3DHOMMATRIX_HXX
+
+#include <sal/types.h>
+#include <basegfx/point/b3dpoint.hxx>
+#include <basegfx/vector/b3dvector.hxx>
+#include <o3tl/cow_wrapper.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ class B3DTuple;
+ class Impl3DHomMatrix;
+
+ class BASEGFX_DLLPUBLIC B3DHomMatrix
+ {
+ public:
+ typedef o3tl::cow_wrapper< Impl3DHomMatrix > ImplType;
+
+ private:
+ ImplType mpImpl;
+
+ public:
+ B3DHomMatrix();
+ B3DHomMatrix(const B3DHomMatrix& rMat);
+ ~B3DHomMatrix();
+
+ double get(sal_uInt16 nRow, sal_uInt16 nColumn) const;
+ void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue);
+
+ // test if last line is default to see if last line needs to be
+ // involved in calculations
+ bool isLastLineDefault() const;
+
+ bool isIdentity() const;
+ /// Reset to the identity matrix
+ void identity();
+
+ /// Invert the matrix (if possible)
+ bool invert();
+
+ /// Calc the matrix determinant
+ double determinant() const;
+
+ /// Rotation
+ void rotate(double fAngleX,double fAngleY,double fAngleZ);
+
+ /// Translation
+ void translate(double fX, double fY, double fZ);
+
+ /// Scaling
+ void scale(double fX, double fY, double fZ);
+
+ // Shearing-Matrices
+ void shearXY(double fSx, double fSy);
+ void shearXZ(double fSx, double fSz);
+
+ // Projection matrices, used for converting between eye and
+ // clip coordinates
+ void frustum(double fLeft = -1.0, double fRight = 1.0,
+ double fBottom = -1.0, double fTop = 1.0,
+ double fNear = 0.001, double fFar = 1.0);
+
+ void ortho(double fLeft = -1.0, double fRight = 1.0,
+ double fBottom = -1.0, double fTop = 1.0,
+ double fNear = 0.0, double fFar = 1.0);
+
+ // build orientation matrix
+ void orientation(
+ B3DPoint aVRP = B3DPoint(0.0,0.0,1.0),
+ B3DVector aVPN = B3DVector(0.0,0.0,1.0),
+ B3DVector aVUV = B3DVector(0.0,1.0,0.0));
+
+ // addition, subtraction
+ B3DHomMatrix& operator+=(const B3DHomMatrix& rMat);
+ B3DHomMatrix& operator-=(const B3DHomMatrix& rMat);
+
+ // comparison
+ bool operator==(const B3DHomMatrix& rMat) const;
+ bool operator!=(const B3DHomMatrix& rMat) const;
+
+ // multiplication, division by constant value
+ B3DHomMatrix& operator*=(double fValue);
+ B3DHomMatrix& operator/=(double fValue);
+
+ // matrix multiplication (from the left)
+ B3DHomMatrix& operator*=(const B3DHomMatrix& rMat);
+
+ // assignment operator
+ B3DHomMatrix& operator=(const B3DHomMatrix& rMat);
+
+ // decomposition
+ bool decompose(B3DTuple& rScale, B3DTuple& rTranslate, B3DTuple& rRotate, B3DTuple& rShear) const;
+ };
+
+ // addition, subtraction
+ inline B3DHomMatrix operator+(const B3DHomMatrix& rMatA, const B3DHomMatrix& rMatB)
+ {
+ B3DHomMatrix aSum(rMatA);
+ aSum += rMatB;
+ return aSum;
+ }
+
+ inline B3DHomMatrix operator-(const B3DHomMatrix& rMatA, const B3DHomMatrix& rMatB)
+ {
+ B3DHomMatrix aDiv(rMatA);
+ aDiv -= rMatB;
+ return aDiv;
+ }
+
+ // multiplication, division by constant value
+ inline B3DHomMatrix operator*(const B3DHomMatrix& rMat, double fValue)
+ {
+ B3DHomMatrix aNew(rMat);
+ aNew *= fValue;
+ return aNew;
+ }
+
+ inline B3DHomMatrix operator/(const B3DHomMatrix& rMat, double fValue)
+ {
+ B3DHomMatrix aNew(rMat);
+ aNew *= 1.0 / fValue;
+ return aNew;
+ }
+
+ inline B3DHomMatrix operator*(const B3DHomMatrix& rMatA, const B3DHomMatrix& rMatB)
+ {
+ B3DHomMatrix aMul(rMatB);
+ aMul *= rMatA;
+ return aMul;
+ }
+} // end of namespace basegfx
+
+#endif /* _BGFX_MATRIX_B3DHOMMATRIX_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/numeric/ftools.hxx b/include/basegfx/numeric/ftools.hxx
new file mode 100644
index 000000000000..70dcabe1a190
--- /dev/null
+++ b/include/basegfx/numeric/ftools.hxx
@@ -0,0 +1,198 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_NUMERIC_FTOOLS_HXX
+#define _BGFX_NUMERIC_FTOOLS_HXX
+
+#include <rtl/math.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// standard PI defines from solar.h, but we do not want to link against tools
+
+#ifndef F_PI
+#define F_PI M_PI
+#endif
+#ifndef F_PI2
+#define F_PI2 M_PI_2
+#endif
+#ifndef F_PI4
+#define F_PI4 M_PI_4
+#endif
+#ifndef F_PI180
+#define F_PI180 (M_PI/180.0)
+#endif
+#ifndef F_PI1800
+#define F_PI1800 (M_PI/1800.0)
+#endif
+#ifndef F_PI18000
+#define F_PI18000 (M_PI/18000.0)
+#endif
+#ifndef F_2PI
+#define F_2PI (2.0*M_PI)
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+// fTools defines
+
+namespace basegfx
+{
+ /** Round double to nearest integer
+
+ @return the nearest integer
+ */
+ inline sal_Int32 fround( double fVal )
+ {
+ return fVal > 0.0 ? static_cast<sal_Int32>( fVal + .5 ) : -static_cast<sal_Int32>( -fVal + .5 );
+ }
+
+ /** Round double to nearest integer
+
+ @return the nearest 64 bit integer
+ */
+ inline sal_Int64 fround64( double fVal )
+ {
+ return fVal > 0.0 ? static_cast<sal_Int64>( fVal + .5 ) : -static_cast<sal_Int64>( -fVal + .5 );
+ }
+
+ /** Prune a small epsilon range around zero.
+
+ Use this method e.g. for calculating scale values. There, it
+ is usually advisable not to set a scaling to 0.0, because that
+ yields singular transformation matrices.
+
+ @param fVal
+ An arbitrary, but finite and valid number
+
+ @return either fVal, or a small value slightly above (when
+ fVal>0) or below (when fVal<0) zero.
+ */
+ inline double pruneScaleValue( double fVal )
+ {
+ // old version used ::std::min/max, but this collides if min is defined as preprocessor
+ // macro which is the case e.g with windows.h headers. The simplest way to avoid this is to
+ // just use the full comparison. I keep the original here, maybe there will be a better
+ // solution some day.
+ //
+ //return fVal < 0.0 ?
+ // (::std::min(fVal,-0.00001)) :
+ // (::std::max(fVal,0.00001));
+
+ if(fVal < 0.0)
+ return (fVal < -0.00001 ? fVal : -0.00001);
+ else
+ return (fVal > 0.00001 ? fVal : 0.00001);
+ }
+
+ /** clamp given value against given minimum and maximum values
+ */
+ template <class T> inline const T& clamp(const T& value, const T& minimum, const T& maximum)
+ {
+ if(value < minimum)
+ {
+ return minimum;
+ }
+ else if(value > maximum)
+ {
+ return maximum;
+ }
+ else
+ {
+ return value;
+ }
+ }
+
+ /** Convert value from degrees to radians
+ */
+ inline double deg2rad( double v )
+ {
+ // divide first, to get exact values for v being a multiple of
+ // 90 degrees
+ return v / 90.0 * M_PI_2;
+ }
+
+ /** Convert value radians to degrees
+ */
+ inline double rad2deg( double v )
+ {
+ // divide first, to get exact values for v being a multiple of
+ // pi/2
+ return v / M_PI_2 * 90.0;
+ }
+
+
+ class BASEGFX_DLLPUBLIC fTools
+ {
+ /// Threshold value for equalZero()
+ static double mfSmallValue;
+
+ public:
+ /// Get threshold value for equalZero and friends
+ static double getSmallValue() { return mfSmallValue; }
+ /// Set threshold value for equalZero and friends
+ static void setSmallValue(const double& rfNew) { mfSmallValue = rfNew; }
+
+ /// Compare against small value
+ static bool equalZero(const double& rfVal)
+ {
+ return (fabs(rfVal) <= getSmallValue());
+ }
+
+ /// Compare against given small value
+ static bool equalZero(const double& rfVal, const double& rfSmallValue)
+ {
+ return (fabs(rfVal) <= rfSmallValue);
+ }
+
+ static bool equal(const double& rfValA, const double& rfValB)
+ {
+ // changed to approxEqual usage for better numerical correctness
+ return rtl::math::approxEqual(rfValA, rfValB);
+ }
+
+ static bool equal(const double& rfValA, const double& rfValB, const double& rfSmallValue)
+ {
+ return (fabs(rfValA - rfValB) <= rfSmallValue);
+ }
+
+ static bool less(const double& rfValA, const double& rfValB)
+ {
+ return (rfValA < rfValB && !equal(rfValA, rfValB));
+ }
+
+ static bool lessOrEqual(const double& rfValA, const double& rfValB)
+ {
+ return (rfValA < rfValB || equal(rfValA, rfValB));
+ }
+
+ static bool more(const double& rfValA, const double& rfValB)
+ {
+ return (rfValA > rfValB && !equal(rfValA, rfValB));
+ }
+
+ static bool moreOrEqual(const double& rfValA, const double& rfValB)
+ {
+ return (rfValA > rfValB || equal(rfValA, rfValB));
+ }
+ };
+} // end of namespace basegfx
+
+#endif /* _BGFX_NUMERIC_FTOOLS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/pixel/bpixel.hxx b/include/basegfx/pixel/bpixel.hxx
new file mode 100644
index 000000000000..a2c59101fa78
--- /dev/null
+++ b/include/basegfx/pixel/bpixel.hxx
@@ -0,0 +1,217 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_PIXEL_BPIXEL_HXX
+#define _BGFX_PIXEL_BPIXEL_HXX
+
+#include <sal/types.h>
+#include <basegfx/numeric/ftools.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ class BASEGFX_DLLPUBLIC BPixel
+ {
+ protected:
+ union
+ {
+ struct
+ {
+ // bitfield
+ unsigned mnR : 8; // red intensity
+ unsigned mnG : 8; // green intensity
+ unsigned mnB : 8; // blue intensity
+ unsigned mnO : 8; // opacity, 0 == full transparence
+ } maRGBO;
+
+ struct
+ {
+ // bitfield
+ unsigned mnValue : 32; // all values
+ } maCombinedRGBO;
+ } maPixelUnion;
+
+ public:
+ BPixel()
+ {
+ maPixelUnion.maCombinedRGBO.mnValue = 0L;
+ }
+
+ // use explicit here to make sure everyone knows what he is doing. Values range from
+ // 0..255 integer here.
+ explicit BPixel(sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue, sal_uInt8 nOpacity)
+ {
+ maPixelUnion.maRGBO.mnR = nRed;
+ maPixelUnion.maRGBO.mnG = nGreen;
+ maPixelUnion.maRGBO.mnB = nBlue;
+ maPixelUnion.maRGBO.mnO = nOpacity;
+ }
+
+ // constructor from BColor which uses double precision color, so change it
+ // to local integer format. It will also be clamped here.
+ BPixel(const BColor& rColor, sal_uInt8 nOpacity)
+ {
+ maPixelUnion.maRGBO.mnR = sal_uInt8((rColor.getRed() * 255.0) + 0.5);
+ maPixelUnion.maRGBO.mnG = sal_uInt8((rColor.getGreen() * 255.0) + 0.5);
+ maPixelUnion.maRGBO.mnB = sal_uInt8((rColor.getBlue() * 255.0) + 0.5);
+ maPixelUnion.maRGBO.mnO = nOpacity;
+ }
+
+ // copy constructor
+ BPixel(const BPixel& rPixel)
+ {
+ maPixelUnion.maCombinedRGBO.mnValue = rPixel.maPixelUnion.maCombinedRGBO.mnValue;
+ }
+
+ ~BPixel()
+ {}
+
+ // assignment operator
+ BPixel& operator=( const BPixel& rPixel )
+ {
+ maPixelUnion.maCombinedRGBO.mnValue = rPixel.maPixelUnion.maCombinedRGBO.mnValue;
+ return *this;
+ }
+
+ // data access read
+ sal_uInt8 getRed() const { return maPixelUnion.maRGBO.mnR; }
+ sal_uInt8 getGreen() const { return maPixelUnion.maRGBO.mnG; }
+ sal_uInt8 getBlue() const { return maPixelUnion.maRGBO.mnB; }
+ sal_uInt8 getOpacity() const { return maPixelUnion.maRGBO.mnO; }
+ sal_uInt32 getRedGreenBlueOpacity() const { return maPixelUnion.maCombinedRGBO.mnValue; }
+
+ // data access write
+ void setRed(sal_uInt8 nNew) { maPixelUnion.maRGBO.mnR = nNew; }
+ void setGreen(sal_uInt8 nNew) { maPixelUnion.maRGBO.mnG = nNew; }
+ void setBlue(sal_uInt8 nNew) { maPixelUnion.maRGBO.mnB = nNew; }
+ void setOpacity(sal_uInt8 nNew) { maPixelUnion.maRGBO.mnO = nNew; }
+ void setRedGreenBlueOpacity(sal_uInt32 nRedGreenBlueOpacity) { maPixelUnion.maCombinedRGBO.mnValue = nRedGreenBlueOpacity; }
+ void setRedGreenBlue(sal_uInt8 nR, sal_uInt8 nG, sal_uInt8 nB) { maPixelUnion.maRGBO.mnR = nR; maPixelUnion.maRGBO.mnG = nG; maPixelUnion.maRGBO.mnB = nB; }
+
+ // comparators
+ bool isInvisible() const { return (0 == maPixelUnion.maRGBO.mnO); }
+ bool isVisible() const { return (0 != maPixelUnion.maRGBO.mnO); }
+ bool isEmpty() const { return isInvisible(); }
+ bool isUsed() const { return isVisible(); }
+
+ bool operator==( const BPixel& rPixel ) const
+ {
+ return (rPixel.maPixelUnion.maCombinedRGBO.mnValue == maPixelUnion.maCombinedRGBO.mnValue);
+ }
+
+ bool operator!=( const BPixel& rPixel ) const
+ {
+ return (rPixel.maPixelUnion.maCombinedRGBO.mnValue != maPixelUnion.maCombinedRGBO.mnValue);
+ }
+
+ // empty element
+ static const BPixel& getEmptyBPixel();
+ };
+
+ //////////////////////////////////////////////////////////////////////////
+ // external operators
+
+ inline BPixel minimum(const BPixel& rTupA, const BPixel& rTupB)
+ {
+ BPixel aMin(
+ (rTupB.getRed() < rTupA.getRed()) ? rTupB.getRed() : rTupA.getRed(),
+ (rTupB.getGreen() < rTupA.getGreen()) ? rTupB.getGreen() : rTupA.getGreen(),
+ (rTupB.getBlue() < rTupA.getBlue()) ? rTupB.getBlue() : rTupA.getBlue(),
+ (rTupB.getOpacity() < rTupA.getOpacity()) ? rTupB.getOpacity() : rTupA.getOpacity());
+ return aMin;
+ }
+
+ inline BPixel maximum(const BPixel& rTupA, const BPixel& rTupB)
+ {
+ BPixel aMax(
+ (rTupB.getRed() > rTupA.getRed()) ? rTupB.getRed() : rTupA.getRed(),
+ (rTupB.getGreen() > rTupA.getGreen()) ? rTupB.getGreen() : rTupA.getGreen(),
+ (rTupB.getBlue() > rTupA.getBlue()) ? rTupB.getBlue() : rTupA.getBlue(),
+ (rTupB.getOpacity() > rTupA.getOpacity()) ? rTupB.getOpacity() : rTupA.getOpacity());
+ return aMax;
+ }
+
+ inline BPixel interpolate(const BPixel& rOld1, const BPixel& rOld2, double t)
+ {
+ if(rOld1 == rOld2)
+ {
+ return rOld1;
+ }
+ else if(0.0 >= t)
+ {
+ return rOld1;
+ }
+ else if(1.0 <= t)
+ {
+ return rOld2;
+ }
+ else
+ {
+ const sal_uInt32 nFactor(fround(256.0 * t));
+ const sal_uInt32 nNegFac(256L - nFactor);
+ return BPixel(
+ (sal_uInt8)(((sal_uInt32)rOld1.getRed() * nNegFac + (sal_uInt32)rOld2.getRed() * nFactor) >> 8L),
+ (sal_uInt8)(((sal_uInt32)rOld1.getGreen() * nNegFac + (sal_uInt32)rOld2.getGreen() * nFactor) >> 8L),
+ (sal_uInt8)(((sal_uInt32)rOld1.getBlue() * nNegFac + (sal_uInt32)rOld2.getBlue() * nFactor) >> 8L),
+ (sal_uInt8)(((sal_uInt32)rOld1.getOpacity() * nNegFac + (sal_uInt32)rOld2.getOpacity() * nFactor) >> 8L));
+ }
+ }
+
+ inline BPixel average(const BPixel& rOld1, const BPixel& rOld2)
+ {
+ if(rOld1 == rOld2)
+ {
+ return rOld1;
+ }
+ else
+ {
+ return BPixel(
+ (sal_uInt8)(((sal_uInt32)rOld1.getRed() + (sal_uInt32)rOld2.getRed()) >> 1L),
+ (sal_uInt8)(((sal_uInt32)rOld1.getGreen() + (sal_uInt32)rOld2.getGreen()) >> 1L),
+ (sal_uInt8)(((sal_uInt32)rOld1.getBlue() + (sal_uInt32)rOld2.getBlue()) >> 1L),
+ (sal_uInt8)(((sal_uInt32)rOld1.getOpacity() + (sal_uInt32)rOld2.getOpacity()) >> 1L));
+ }
+ }
+
+ inline BPixel average(const BPixel& rOld1, const BPixel& rOld2, const BPixel& rOld3)
+ {
+ if(rOld1 == rOld2 && rOld2 == rOld3)
+ {
+ return rOld1;
+ }
+ else
+ {
+ return BPixel(
+ (sal_uInt8)(((sal_uInt32)rOld1.getRed() + (sal_uInt32)rOld2.getRed() + (sal_uInt32)rOld3.getRed()) / 3L),
+ (sal_uInt8)(((sal_uInt32)rOld1.getGreen() + (sal_uInt32)rOld2.getGreen() + (sal_uInt32)rOld3.getGreen()) / 3L),
+ (sal_uInt8)(((sal_uInt32)rOld1.getBlue() + (sal_uInt32)rOld2.getBlue() + (sal_uInt32)rOld3.getBlue()) / 3L),
+ (sal_uInt8)(((sal_uInt32)rOld1.getOpacity() + (sal_uInt32)rOld2.getOpacity() + (sal_uInt32)rOld3.getOpacity()) / 3L));
+ }
+ }
+} // end of namespace basegfx
+
+#endif /* _BGFX_PIXEL_BPIXEL_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/point/b2dpoint.hxx b/include/basegfx/point/b2dpoint.hxx
new file mode 100644
index 000000000000..ef73c8ab46c9
--- /dev/null
+++ b/include/basegfx/point/b2dpoint.hxx
@@ -0,0 +1,146 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POINT_B2DPOINT_HXX
+#define _BGFX_POINT_B2DPOINT_HXX
+
+#include <basegfx/tuple/b2dtuple.hxx>
+#include <basegfx/point/b2ipoint.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ // predeclaration
+ class B2DHomMatrix;
+
+ /** Base Point class with two double values
+
+ This class derives all operators and common handling for
+ a 2D data class from B2DTuple. All necessary extensions
+ which are special for points will be added here.
+
+ @see B2DTuple
+ */
+ class SAL_WARN_UNUSED B2DPoint : public ::basegfx::B2DTuple
+ {
+ public:
+ /** Create a 2D Point
+
+ The point is initialized to (0.0, 0.0)
+ */
+ B2DPoint()
+ : B2DTuple()
+ {}
+
+ /** Create a 2D Point
+
+ @param fX
+ This parameter is used to initialize the X-coordinate
+ of the 2D Point.
+
+ @param fY
+ This parameter is used to initialize the Y-coordinate
+ of the 2D Point.
+ */
+ B2DPoint(double fX, double fY)
+ : B2DTuple(fX, fY)
+ {}
+
+ /** Create a copy of a 2D Point
+
+ @param rPoint
+ The 2D Point which will be copied.
+ */
+ B2DPoint(const B2DPoint& rPoint)
+ : B2DTuple(rPoint)
+ {}
+
+ /** Create a copy of a 2D Point
+
+ @param rPoint
+ The 2D Point which will be copied.
+ */
+ explicit B2DPoint(const ::basegfx::B2IPoint& rPoint)
+ : B2DTuple(rPoint)
+ {}
+
+ /** constructor with tuple to allow copy-constructing
+ from B2DTuple-based classes
+ */
+ B2DPoint(const ::basegfx::B2DTuple& rTuple)
+ : B2DTuple(rTuple)
+ {}
+
+ ~B2DPoint()
+ {}
+
+ /** *=operator to allow usage from B2DPoint, too
+ */
+ B2DPoint& operator*=( const B2DPoint& rPnt )
+ {
+ mfX *= rPnt.mfX;
+ mfY *= rPnt.mfY;
+ return *this;
+ }
+
+ /** *=operator to allow usage from B2DPoint, too
+ */
+ B2DPoint& operator*=(double t)
+ {
+ mfX *= t;
+ mfY *= t;
+ return *this;
+ }
+
+ /** assignment operator to allow assigning the results
+ of B2DTuple calculations
+ */
+ BASEGFX_DLLPUBLIC B2DPoint& operator=( const ::basegfx::B2DTuple& rPoint );
+
+ /** Transform point by given transformation matrix.
+
+ The translational components of the matrix are, in
+ contrast to B2DVector, applied.
+ */
+ BASEGFX_DLLPUBLIC B2DPoint& operator*=( const ::basegfx::B2DHomMatrix& rMat );
+
+ static const B2DPoint& getEmptyPoint()
+ {
+ return (const B2DPoint&) ::basegfx::B2DTuple::getEmptyTuple();
+ }
+ };
+
+ // external operators
+ //////////////////////////////////////////////////////////////////////////
+
+ /** Transform B2DPoint by given transformation matrix.
+
+ Since this is a Point, translational components of the
+ matrix are used.
+ */
+ BASEGFX_DLLPUBLIC B2DPoint operator*( const B2DHomMatrix& rMat, const B2DPoint& rPoint );
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif /* _BGFX_POINT_B2DPOINT_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/point/b2ipoint.hxx b/include/basegfx/point/b2ipoint.hxx
new file mode 100644
index 000000000000..33b225a2a36d
--- /dev/null
+++ b/include/basegfx/point/b2ipoint.hxx
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POINT_B2IPOINT_HXX
+#define _BGFX_POINT_B2IPOINT_HXX
+
+#include <basegfx/tuple/b2ituple.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ // predeclaration
+ class B2DHomMatrix;
+
+ /** Base Point class with two sal_Int32 values
+
+ This class derives all operators and common handling for
+ a 2D data class from B2ITuple. All necessary extensions
+ which are special for points will be added here.
+
+ @see B2ITuple
+ */
+ class BASEGFX_DLLPUBLIC SAL_WARN_UNUSED B2IPoint : public ::basegfx::B2ITuple
+ {
+ public:
+ /** Create a 2D Point
+
+ The point is initialized to (0, 0)
+ */
+ B2IPoint()
+ : B2ITuple()
+ {}
+
+ /** Create a 2D Point
+
+ @param nX
+ This parameter is used to initialize the X-coordinate
+ of the 2D Point.
+
+ @param nY
+ This parameter is used to initialize the Y-coordinate
+ of the 2D Point.
+ */
+ B2IPoint(sal_Int32 nX, sal_Int32 nY)
+ : B2ITuple(nX, nY)
+ {}
+
+ /** Create a copy of a 2D Point
+
+ @param rPoint
+ The 2D Point which will be copied.
+ */
+ B2IPoint(const B2IPoint& rPoint)
+ : B2ITuple(rPoint)
+ {}
+
+ /** constructor with tuple to allow copy-constructing
+ from B2ITuple-based classes
+ */
+ B2IPoint(const ::basegfx::B2ITuple& rTuple)
+ : B2ITuple(rTuple)
+ {}
+
+ ~B2IPoint()
+ {}
+
+ /** *=operator to allow usage from B2IPoint, too
+ */
+ B2IPoint& operator*=( const B2IPoint& rPnt )
+ {
+ mnX *= rPnt.mnX;
+ mnY *= rPnt.mnY;
+ return *this;
+ }
+
+ /** *=operator to allow usage from B2IPoint, too
+ */
+ B2IPoint& operator*=(sal_Int32 t)
+ {
+ mnX *= t;
+ mnY *= t;
+ return *this;
+ }
+
+ /** assignment operator to allow assigning the results
+ of B2ITuple calculations
+ */
+ B2IPoint& operator=( const ::basegfx::B2ITuple& rPoint );
+
+ /** Transform point by given transformation matrix.
+
+ The translational components of the matrix are, in
+ contrast to B2DVector, applied.
+ */
+ B2IPoint& operator*=( const ::basegfx::B2DHomMatrix& rMat );
+ };
+} // end of namespace basegfx
+
+#endif /* _BGFX_POINT_B2IPOINT_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/point/b3dpoint.hxx b/include/basegfx/point/b3dpoint.hxx
new file mode 100644
index 000000000000..391bc128b9fb
--- /dev/null
+++ b/include/basegfx/point/b3dpoint.hxx
@@ -0,0 +1,145 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POINT_B3DPOINT_HXX
+#define _BGFX_POINT_B3DPOINT_HXX
+
+#include <basegfx/tuple/b3dtuple.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ // predeclaration
+ class B3DHomMatrix;
+
+ /** Base Point class with three double values
+
+ This class derives all operators and common handling for
+ a 3D data class from B3DTuple. All necessary extensions
+ which are special for points will be added here.
+
+ @see B3DTuple
+ */
+ class BASEGFX_DLLPUBLIC SAL_WARN_UNUSED B3DPoint : public ::basegfx::B3DTuple
+ {
+ public:
+ /** Create a 3D Point
+
+ The point is initialized to (0.0, 0.0, 0.0)
+ */
+ B3DPoint()
+ : B3DTuple()
+ {}
+
+ /** Create a 3D Point
+
+ @param fX
+ This parameter is used to initialize the X-coordinate
+ of the 3D Point.
+
+ @param fY
+ This parameter is used to initialize the Y-coordinate
+ of the 3D Point.
+
+ @param fZ
+ This parameter is used to initialize the Z-coordinate
+ of the 3D Point.
+ */
+ B3DPoint(double fX, double fY, double fZ)
+ : B3DTuple(fX, fY, fZ)
+ {}
+
+ /** Create a copy of a 3D Point
+
+ @param rVec
+ The 3D Point which will be copied.
+ */
+ B3DPoint(const B3DPoint& rVec)
+ : B3DTuple(rVec)
+ {}
+
+ /** constructor with tuple to allow copy-constructing
+ from B3DTuple-based classes
+ */
+ B3DPoint(const ::basegfx::B3DTuple& rTuple)
+ : B3DTuple(rTuple)
+ {}
+
+ ~B3DPoint()
+ {}
+
+ /** *=operator to allow usage from B3DPoint, too
+ */
+ B3DPoint& operator*=( const B3DPoint& rPnt )
+ {
+ mfX *= rPnt.mfX;
+ mfY *= rPnt.mfY;
+ mfZ *= rPnt.mfZ;
+ return *this;
+ }
+
+ /** *=operator to allow usage from B3DPoint, too
+ */
+ B3DPoint& operator*=(double t)
+ {
+ mfX *= t;
+ mfY *= t;
+ mfZ *= t;
+ return *this;
+ }
+
+ /** assignment operator to allow assigning the results
+ of B3DTuple calculations
+ */
+ B3DPoint& operator=( const ::basegfx::B3DTuple& rVec )
+ {
+ mfX = rVec.getX();
+ mfY = rVec.getY();
+ mfZ = rVec.getZ();
+ return *this;
+ }
+
+ /** Transform point by given transformation matrix.
+
+ The translational components of the matrix are, in
+ contrast to B3DVector, applied.
+ */
+ B3DPoint& operator*=( const ::basegfx::B3DHomMatrix& rMat );
+
+ static const B3DPoint& getEmptyPoint()
+ {
+ return (const B3DPoint&) ::basegfx::B3DTuple::getEmptyTuple();
+ }
+ };
+
+ // external operators
+ //////////////////////////////////////////////////////////////////////////
+
+ /** Transform B3DPoint by given transformation matrix.
+
+ Since this is a Point, translational components of the
+ matrix are used.
+ */
+ BASEGFX_DLLPUBLIC B3DPoint operator*( const B3DHomMatrix& rMat, const B3DPoint& rPoint );
+
+} // end of namespace basegfx
+
+#endif /* _BGFX_POINT_B3DPOINT_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/point/b3ipoint.hxx b/include/basegfx/point/b3ipoint.hxx
new file mode 100644
index 000000000000..e80514c13de2
--- /dev/null
+++ b/include/basegfx/point/b3ipoint.hxx
@@ -0,0 +1,129 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POINT_B3IPOINT_HXX
+#define _BGFX_POINT_B3IPOINT_HXX
+
+#include <basegfx/tuple/b3ituple.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ // predeclaration
+ class B3DHomMatrix;
+
+ /** Base Point class with three sal_Int32 values
+
+ This class derives all operators and common handling for
+ a 3D data class from B3ITuple. All necessary extensions
+ which are special for points will be added here.
+
+ @see B3ITuple
+ */
+ class BASEGFX_DLLPUBLIC SAL_WARN_UNUSED B3IPoint : public ::basegfx::B3ITuple
+ {
+ public:
+ /** Create a 3D Point
+
+ The point is initialized to (0, 0, 0)
+ */
+ B3IPoint()
+ : B3ITuple()
+ {}
+
+ /** Create a 3D Point
+
+ @param nX
+ This parameter is used to initialize the X-coordinate
+ of the 3D Point.
+
+ @param nY
+ This parameter is used to initialize the Y-coordinate
+ of the 3D Point.
+
+ @param nZ
+ This parameter is used to initialize the Z-coordinate
+ of the 3D Point.
+ */
+ B3IPoint(sal_Int32 nX, sal_Int32 nY, sal_Int32 nZ)
+ : B3ITuple(nX, nY, nZ)
+ {}
+
+ /** Create a copy of a 3D Point
+
+ @param rVec
+ The 3D Point which will be copied.
+ */
+ B3IPoint(const B3IPoint& rVec)
+ : B3ITuple(rVec)
+ {}
+
+ /** constructor with tuple to allow copy-constructing
+ from B3ITuple-based classes
+ */
+ B3IPoint(const ::basegfx::B3ITuple& rTuple)
+ : B3ITuple(rTuple)
+ {}
+
+ ~B3IPoint()
+ {}
+
+ /** *=operator to allow usage from B3IPoint, too
+ */
+ B3IPoint& operator*=( const B3IPoint& rPnt )
+ {
+ mnX *= rPnt.mnX;
+ mnY *= rPnt.mnY;
+ mnZ *= rPnt.mnZ;
+ return *this;
+ }
+
+ /** *=operator to allow usage from B3IPoint, too
+ */
+ B3IPoint& operator*=(sal_Int32 t)
+ {
+ mnX *= t;
+ mnY *= t;
+ mnZ *= t;
+ return *this;
+ }
+
+ /** assignment operator to allow assigning the results
+ of B3ITuple calculations
+ */
+ B3IPoint& operator=( const ::basegfx::B3ITuple& rVec )
+ {
+ mnX = rVec.getX();
+ mnY = rVec.getY();
+ mnZ = rVec.getZ();
+ return *this;
+ }
+
+ /** Transform point by given transformation matrix.
+
+ The translational components of the matrix are, in
+ contrast to B3DVector, applied.
+ */
+ B3IPoint& operator*=( const ::basegfx::B3DHomMatrix& rMat );
+ };
+} // end of namespace basegfx
+
+#endif /* _BGFX_POINT_B3IPOINT_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b2dlinegeometry.hxx b/include/basegfx/polygon/b2dlinegeometry.hxx
new file mode 100644
index 000000000000..934158f88a2f
--- /dev/null
+++ b/include/basegfx/polygon/b2dlinegeometry.hxx
@@ -0,0 +1,141 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POLYGON_B2DLINEGEOMETRY_HXX
+#define _BGFX_POLYGON_B2DLINEGEOMETRY_HXX
+
+#include <sal/types.h>
+#include <basegfx/numeric/ftools.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <com/sun/star/drawing/LineCap.hpp>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ namespace tools
+ {
+ /** Create line start/end geometry element, mostly arrows and things like that.
+
+ @param rCandidate
+ The polygon which needs to get that line ends and needs to have two points
+ at least.
+
+ @param rArrow
+ The line start/end geometry. It is assumed that the tip is pointing
+ upwards. Result will be rotated and scaled to fit.
+
+ @param bStart
+ describes if creation is for start or end of candidate.
+
+ @param fWidth
+ defines the size of the element, it's describing the target width in X
+ of the arrow.
+
+ @param fDockingPosition needs to be in [0.0 ..1.0] range, where 0.0 means
+ that the tip of the arrow will be aligned with the polygon start, 1.0 means
+ the bottom. The default of 0.5 describes a centered arrow.
+
+ @param pConsumedLength
+ Using this parameter it is possible to get back how much from the candidate
+ geometry is overlapped by the created element (consumed).
+
+ @param fCandidateLength
+ This should contain the length of rCandidate to allow work without
+ again calculating the length (which may be expensive with beziers). If 0.0 is
+ given, the length is calculated on demand.
+
+ @return
+ The Line start and end polygon, correctly rotated and scaled
+ */
+ BASEGFX_DLLPUBLIC B2DPolyPolygon createAreaGeometryForLineStartEnd(
+ const B2DPolygon& rCandidate,
+ const B2DPolyPolygon& rArrow,
+ bool bStart,
+ double fWidth,
+ double fCandidateLength = 0.0, // 0.0 -> calculate self
+ double fDockingPosition = 0.5, // 0->top, 1->bottom
+ double* pConsumedLength = 0L);
+
+ /** create filled polygon geometry for lines with a line width
+
+ This method will create bezier based, fillable polygons which
+ will resample the curve if it was extended for the given half
+ line width. It will remove extrema positions from contained
+ bezier segments and get as close as possible and defined by
+ the given parameters to the ideal result.
+
+ It will check edges for trivial bezier to avoid unnecessary
+ bezier polygons. Care is taken to produce the in-between
+ polygon points (the ones original on the source poygon) since
+ it has showed that without those, the raster converters leave
+ non-filled gaps.
+
+ @param rCandidate
+ The source polygon defining the hairline polygon path
+
+ @param fHalfLineWidth
+ The width of the line to one side
+
+ @param eJoin
+ The LineJoin if the edges meeting in a point do not have a C1
+ or C2 continuity
+
+ @param eCap
+ The kind of cap, which is added to the line.
+
+ @param fMaxAllowedAngle
+ Allows to hand over the maximum allowed angle between an edge and
+ it's control vectors. The smaller, the more subdivisions will be
+ needed to create the filled geometry. Allowed range is cropped to
+ [F_PI2 .. 0.01 * F_PI2].
+
+ @param fMaxPartOfEdge
+ Allows to influence from with relative length of a control vector
+ compared to it's edge a split is forced. The smaller, the more
+ subdivisions will be needed to create the filled geometry. Allowed
+ range is cropped to [1.0 .. 0.01]
+
+ @praram fMiterMinimumAngle
+ The minimum wanted angle between two edges when edge rounding
+ is using miter. When an edge is smaller than this (tighter)
+ the usual fallback to bevel is used. Allowed range is cropped
+ to [F_PI .. 0.01 * F_PI].
+
+ @return
+ The PolyPolygon containing the geometry of the extended line by
+ it's line width. Contains bezier segments and edge roundings as
+ needed and defined.
+ */
+ BASEGFX_DLLPUBLIC B2DPolyPolygon createAreaGeometry(
+ const B2DPolygon& rCandidate,
+ double fHalfLineWidth,
+ B2DLineJoin eJoin = B2DLINEJOIN_ROUND,
+ com::sun::star::drawing::LineCap eCap = com::sun::star::drawing::LineCap_BUTT,
+ double fMaxAllowedAngle = (12.5 * F_PI180),
+ double fMaxPartOfEdge = 0.4,
+ double fMiterMinimumAngle = (15.0 * F_PI180));
+ } // end of namespace tools
+} // end of namespace basegfx
+
+#endif /* _BGFX_POLYGON_B2DLINEGEOMETRY_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b2dpolygon.hxx b/include/basegfx/polygon/b2dpolygon.hxx
new file mode 100644
index 000000000000..7c854fdc8a0e
--- /dev/null
+++ b/include/basegfx/polygon/b2dpolygon.hxx
@@ -0,0 +1,230 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POLYGON_B2DPOLYGON_HXX
+#define _BGFX_POLYGON_B2DPOLYGON_HXX
+
+#include <sal/types.h>
+#include <o3tl/cow_wrapper.hxx>
+#include <basegfx/vector/b2enums.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+class ImplB2DPolygon;
+
+namespace basegfx
+{
+ class B2DPolygon;
+ class B2DPoint;
+ class B2DVector;
+ class B2DHomMatrix;
+ class B2DCubicBezier;
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ class BASEGFX_DLLPUBLIC B2DPolygon
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImplB2DPolygon > ImplType;
+
+ private:
+ // internal data.
+ ImplType mpPolygon;
+
+ public:
+ /// diverse constructors
+ B2DPolygon();
+ B2DPolygon(const B2DPolygon& rPolygon);
+ B2DPolygon(const B2DPolygon& rPolygon, sal_uInt32 nIndex, sal_uInt32 nCount);
+ ~B2DPolygon();
+
+ /// assignment operator
+ B2DPolygon& operator=(const B2DPolygon& rPolygon);
+
+ /// unshare this polygon with all internally shared instances
+ void makeUnique();
+
+ /// compare operators
+ bool operator==(const B2DPolygon& rPolygon) const;
+ bool operator!=(const B2DPolygon& rPolygon) const;
+
+ /// member count
+ sal_uInt32 count() const;
+
+ /// Coordinate interface
+ basegfx::B2DPoint getB2DPoint(sal_uInt32 nIndex) const;
+ void setB2DPoint(sal_uInt32 nIndex, const basegfx::B2DPoint& rValue);
+
+ /// Coordinate insert/append
+ void insert(sal_uInt32 nIndex, const basegfx::B2DPoint& rPoint, sal_uInt32 nCount = 1);
+ void append(const basegfx::B2DPoint& rPoint, sal_uInt32 nCount);
+ void append(const basegfx::B2DPoint& rPoint);
+ void reserve(sal_uInt32 nCount);
+
+ /// Basic ControlPoint interface
+ basegfx::B2DPoint getPrevControlPoint(sal_uInt32 nIndex) const;
+ basegfx::B2DPoint getNextControlPoint(sal_uInt32 nIndex) const;
+ void setPrevControlPoint(sal_uInt32 nIndex, const basegfx::B2DPoint& rValue);
+ void setNextControlPoint(sal_uInt32 nIndex, const basegfx::B2DPoint& rValue);
+ void setControlPoints(sal_uInt32 nIndex, const basegfx::B2DPoint& rPrev, const basegfx::B2DPoint& rNext);
+
+ /// ControlPoint resets
+ void resetPrevControlPoint(sal_uInt32 nIndex);
+ void resetNextControlPoint(sal_uInt32 nIndex);
+ void resetControlPoints();
+
+ /// Bezier segment append with control points. The current last polygon point is implicitly taken as start point.
+ void appendBezierSegment(const basegfx::B2DPoint& rNextControlPoint, const basegfx::B2DPoint& rPrevControlPoint, const basegfx::B2DPoint& rPoint);
+
+ /// ControlPoint checks
+ bool areControlPointsUsed() const;
+ bool isPrevControlPointUsed(sal_uInt32 nIndex) const;
+ bool isNextControlPointUsed(sal_uInt32 nIndex) const;
+ B2VectorContinuity getContinuityInPoint(sal_uInt32 nIndex) const;
+
+ /** bezier segment access
+
+ This method also works when it is no bezier segment at all and will fill
+ the given B2DCubicBezier as needed.
+ In any case, the given B2DCubicBezier will be filled, if necessary with
+ the single start point (if no valid edge exists).
+
+ @param nIndex
+ Index of the addressed edge's start point
+
+ @param rTarget
+ The B2DCubicBezier to be filled. It's data WILL be changed.
+ */
+ void getBezierSegment(sal_uInt32 nIndex, B2DCubicBezier& rTarget) const;
+
+ /** Default adaptive subdivision access
+
+ This method will return a default adapive subdivision of the polygon.
+ If the polygon does not contain any bezier curve segments, it will
+ just return itself.
+
+ The subdivision is created on first request and buffered, so when using
+ this subdivision You have the guarantee for fast accesses for multiple
+ usages. It is intended for tooling usage for tasks which would be hard
+ to accomplish on bezier segments (e.g. isInEpsilonRange).
+
+ The current default subdivision uses adaptiveSubdivideByCount with 9
+ subdivisions which gives 10 edges and 11 points per segment and is
+ usually pretty usable for processing purposes. There is no parameter
+ passing here ATM but it may be changed on demand. If needed, a TYPE
+ and PARAMETER (both defaulted) may be added to allow for switching
+ between the different kinds of subdivisiond and passing them one
+ parameter.
+
+ The lifetime of the buffered subdivision is based on polygon changes.
+ When changing the polygon, it will be flushed. It is buffered at the
+ refcounted implementation class, so it will survive copy by value and
+ combinations in PolyPolygons.
+
+ @return
+ The default (and buffered) subdivision of this polygon. It may
+ be this polygon itself when it has no bezier segments. It is guaranteed
+ to have no more bezier segments
+ */
+ B2DPolygon getDefaultAdaptiveSubdivision() const;
+
+ /** Get the B2DRange (Rectangle dimensions) of this B2DPolygon
+
+ A polygon may have up to three ranges:
+
+ (a) the range of the polygon points
+ (b) the range of the polygon points and control points
+ (c) the outer range of the subdivided bezier curve
+
+ Ranges (a) and (c) are produced by tools::getRange(); resp. this
+ getB2DRange(). tools::getRangeWithControlPoints handles case (b).
+
+ To get range (c) a simple solution would be to subdivide the polygon
+ and use getRange() on it. Since subdivision is expensive and decreases
+ the polygon quality, i added this new method. It will use a
+ methodology suggested by HDU. First, it gets the range (a).
+ Then it iterates over the bezier segments and for each it
+ first tests if the outer range of the bezier segment is already
+ contained in the result range.
+
+ The subdivision itself uses getAllExtremumPositions() to only
+ calculate extremum points and to expand the result accordingly.
+ Thus it calculates maximal four extremum points on the bezier
+ segment, no split is used at all.
+
+ @return
+ The outer range of the bezier curve/polygon
+ */
+ B2DRange getB2DRange() const;
+
+ /** append other 2D polygons
+
+ The default (nIndex ==0 && nCount == 0) will append
+ the whole rPoly
+
+ @param rPoly
+ The source polygon
+
+ @param nIndex
+ The index to the first point of rPoly to append
+
+ @param nCount
+ The number of points to append from rPoly, starting
+ from nIndex. If zero, as much as possibel is appended
+ */
+ void append(const B2DPolygon& rPoly, sal_uInt32 nIndex = 0, sal_uInt32 nCount = 0);
+
+ /// remove points
+ void remove(sal_uInt32 nIndex, sal_uInt32 nCount = 1);
+
+ /// clear all points
+ void clear();
+
+ /// closed state interface
+ bool isClosed() const;
+ void setClosed(bool bNew);
+
+ /// flip polygon direction
+ void flip();
+
+ /// test if Polygon has double points
+ bool hasDoublePoints() const;
+
+ /// remove double points, at the begin/end and follow-ups, too
+ void removeDoublePoints();
+
+ /// apply transformation given in matrix form
+ void transform(const basegfx::B2DHomMatrix& rMatrix);
+ };
+
+ // typedef for a vector of B2DPolygons
+ typedef ::std::vector< B2DPolygon > B2DPolygonVector;
+
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif /* _BGFX_POLYGON_B2DPOLYGON_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b2dpolygonclipper.hxx b/include/basegfx/polygon/b2dpolygonclipper.hxx
new file mode 100644
index 000000000000..197958e45a00
--- /dev/null
+++ b/include/basegfx/polygon/b2dpolygonclipper.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POLYPOLYGON_B2DPOLYGONCLIPPER_HXX
+#define _BGFX_POLYPOLYGON_B2DPOLYGONCLIPPER_HXX
+
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ // predefinitions
+ class B2DRange;
+
+ namespace tools
+ {
+ // This method clips the given PolyPolygon against a horizontal or vertical axis (parallell to X or Y axis). The axis is
+ // defined by bParallelToXAxis (true -> it's parallel to the X-Axis of the coordinate system, else to the Y-Axis) and the
+ // fValueOnOtherAxis (gives the translation to the coordinate system axis). For example, when You want to define
+ // a clip axis parallel to X.Axis and 100 above it, use bParallelToXAxis = true and fValueOnOtherAxis = 100.
+ // The value bAboveAxis defines on which side the return value will be (true -> above X, right of Y).
+ // The switch bStroke decides if the polygon is interpreted as area (false) or strokes (true).
+ BASEGFX_DLLPUBLIC B2DPolyPolygon clipPolyPolygonOnParallelAxis(const B2DPolyPolygon& rCandidate, bool bParallelToXAxis, bool bAboveAxis, double fValueOnOtherAxis, bool bStroke);
+ BASEGFX_DLLPUBLIC B2DPolyPolygon clipPolygonOnParallelAxis(const B2DPolygon& rCandidate, bool bParallelToXAxis, bool bAboveAxis, double fValueOnOtherAxis, bool bStroke);
+
+ // Clip the given PolyPolygon against the given range. bInside defines if the result will contain the
+ // parts which are contained in the range or vice versa.
+ // The switch bStroke decides if the polygon is interpreted as area (false) or strokes (true).
+ BASEGFX_DLLPUBLIC B2DPolyPolygon clipPolyPolygonOnRange(const B2DPolyPolygon& rCandidate, const B2DRange& rRange, bool bInside, bool bStroke);
+ BASEGFX_DLLPUBLIC B2DPolyPolygon clipPolygonOnRange(const B2DPolygon& rCandidate, const B2DRange& rRange, bool bInside, bool bStroke);
+
+ // Clip given PolyPolygon against given clipping polygon.
+ // The switch bStroke decides if the polygon is interpreted as area (false) or strokes (true).
+ // With stroke polygons, You get all line snippets inside rCip.
+ // With filled polygons, You get all PolyPolygon parts which were inside rClip.
+ // The switch bInside decides if the parts inside the clip polygon or outside shall be created.
+ // The clip polygon is always assumed closed, even when it's isClosed() is false.
+ BASEGFX_DLLPUBLIC B2DPolyPolygon clipPolyPolygonOnPolyPolygon(const B2DPolyPolygon& rCandidate, const B2DPolyPolygon& rClip, bool bInside, bool bStroke);
+ BASEGFX_DLLPUBLIC B2DPolyPolygon clipPolygonOnPolyPolygon(const B2DPolygon& rCandidate, const B2DPolyPolygon& rClip, bool bInside, bool bStroke);
+
+ // clip the given polygon against the given range. the resulting polygon will always contain
+ // the inside parts which will always be interpreted as areas. the incoming polygon is expected
+ // to be a simple triangle list. the result is also a simple triangle list.
+ BASEGFX_DLLPUBLIC B2DPolygon clipTriangleListOnRange( const B2DPolygon& rCandidate, const B2DRange& rRange );
+
+ } // end of namespace tools
+} // end of namespace basegfx
+
+#endif /* _BGFX_POLYPOLYGON_B2DPOLYGONCLIPPER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b2dpolygoncutandtouch.hxx b/include/basegfx/polygon/b2dpolygoncutandtouch.hxx
new file mode 100644
index 000000000000..05f8e0e0cb3a
--- /dev/null
+++ b/include/basegfx/polygon/b2dpolygoncutandtouch.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POLYGON_CUTANDTOUCH_HXX
+#define _BGFX_POLYGON_CUTANDTOUCH_HXX
+
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ namespace tools
+ {
+ // look for self-intersections and self-touches (points on an edge) in given polygon and add
+ // extra points there. Result will have no touches or intersections on an edge, only on points
+ BASEGFX_DLLPUBLIC B2DPolygon addPointsAtCutsAndTouches(const B2DPolygon& rCandidate);
+
+ // look for polypolygon-intersections and polypolygon-touches (point of poly A on an edge of poly B) in given PolyPolygon and add
+ // extra points there. Result will have no touches or intersections between contained polygons on an edge, only on points. For
+ // convenience, the correction for self-intersections for each member polygon will be used, too.
+ // Changed: Self intersections are searched by default, but may be switched off by 2nd parameter.
+ BASEGFX_DLLPUBLIC B2DPolyPolygon addPointsAtCutsAndTouches(const B2DPolyPolygon& rCandidate, bool bSelfIntersections = true);
+
+ // look for intersections of rCandidate with the edge from rStart to rEnd and add extra points there.
+ // Points are only added in the range of the edge, not on the endless vector.
+ BASEGFX_DLLPUBLIC B2DPolygon addPointsAtCuts(const B2DPolygon& rCandidate, const B2DPoint& rStart, const B2DPoint& rEnd);
+
+ // look for intersections of rCandidate with the mask Polygon and add extra points there.
+ // The mask polygon is assumed to be closed, even when it's not explicitly.
+ BASEGFX_DLLPUBLIC B2DPolygon addPointsAtCuts(const B2DPolygon& rCandidate, const B2DPolyPolygon& rMask);
+
+ } // end of namespace tools
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif /* _BGFX_POLYGON_CUTANDTOUCH_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b2dpolygontools.hxx b/include/basegfx/polygon/b2dpolygontools.hxx
new file mode 100644
index 000000000000..dce479847d65
--- /dev/null
+++ b/include/basegfx/polygon/b2dpolygontools.hxx
@@ -0,0 +1,442 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POLYGON_B2DPOLYGONTOOLS_HXX
+#define _BGFX_POLYGON_B2DPOLYGONTOOLS_HXX
+
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/range/b2drectangle.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b3dpolygon.hxx>
+#include <vector>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ // predefinitions
+ class B2DPolygon;
+ class B2DRange;
+
+ namespace tools
+ {
+ // B2DPolygon tools
+
+ // open/close with point add/remove and control point corrections
+ BASEGFX_DLLPUBLIC void openWithGeometryChange(B2DPolygon& rCandidate);
+ BASEGFX_DLLPUBLIC void closeWithGeometryChange(B2DPolygon& rCandidate);
+
+ /** Check if given polygon is closed.
+
+ This is kind of a 'classic' method to support old polygon
+ definitions. Those old polygon definitions define the
+ closed state of the polygon using identical start and
+ endpoints. This method corrects this (removes double
+ start/end points) and sets the Closed()-state of the
+ polygon correctly.
+ */
+ BASEGFX_DLLPUBLIC void checkClosed(B2DPolygon& rCandidate);
+
+ // Get successor and predecessor indices. Returning the same index means there
+ // is none. Same for successor.
+ BASEGFX_DLLPUBLIC sal_uInt32 getIndexOfPredecessor(sal_uInt32 nIndex, const B2DPolygon& rCandidate);
+ BASEGFX_DLLPUBLIC sal_uInt32 getIndexOfSuccessor(sal_uInt32 nIndex, const B2DPolygon& rCandidate);
+
+ // Get orientation of Polygon
+ BASEGFX_DLLPUBLIC B2VectorOrientation getOrientation(const B2DPolygon& rCandidate);
+
+ // isInside tests for B2dPoint and other B2dPolygon. On border is not inside as long as
+ // not true is given in bWithBorder flag.
+ BASEGFX_DLLPUBLIC bool isInside(const B2DPolygon& rCandidate, const B2DPoint& rPoint, bool bWithBorder = false);
+ BASEGFX_DLLPUBLIC bool isInside(const B2DPolygon& rCandidate, const B2DPolygon& rPolygon, bool bWithBorder = false);
+
+ /** Get the range of a polygon
+
+ This method creates the outer range of the subdivided bezier curve.
+ For detailed discussion see B2DPolygon::getB2DRange()
+
+ @param rCandidate
+ The B2DPolygon eventually containing bezier segments
+
+ @return
+ The outer range of the bezier curve
+ */
+ BASEGFX_DLLPUBLIC B2DRange getRange(const B2DPolygon& rCandidate);
+
+ // get signed area of polygon
+ BASEGFX_DLLPUBLIC double getSignedArea(const B2DPolygon& rCandidate);
+
+ // get area of polygon
+ BASEGFX_DLLPUBLIC double getArea(const B2DPolygon& rCandidate);
+
+ /** get length of polygon edge from point nIndex to nIndex + 1 */
+ BASEGFX_DLLPUBLIC double getEdgeLength(const B2DPolygon& rCandidate, sal_uInt32 nIndex);
+
+ /** get length of polygon */
+ BASEGFX_DLLPUBLIC double getLength(const B2DPolygon& rCandidate);
+
+ // get position on polygon for absolute given distance. If
+ // length is given, it is assumed the correct polygon length, if 0.0 it is calculated
+ // using getLength(...)
+ BASEGFX_DLLPUBLIC B2DPoint getPositionAbsolute(const B2DPolygon& rCandidate, double fDistance, double fLength = 0.0);
+
+ // get position on polygon for relative given distance in range [0.0 .. 1.0]. If
+ // length is given, it is assumed the correct polygon length, if 0.0 it is calculated
+ // using getLength(...)
+ BASEGFX_DLLPUBLIC B2DPoint getPositionRelative(const B2DPolygon& rCandidate, double fDistance, double fLength = 0.0);
+
+ // get a snippet from given polygon for absolute distances. The polygon is assumed
+ // to be opened (not closed). fFrom and fTo need to be in range [0.0 .. fLength], where
+ // fTo >= fFrom. If length is given, it is assumed the correct polygon length,
+ // if 0.0 it is calculated using getLength(...)
+ BASEGFX_DLLPUBLIC B2DPolygon getSnippetAbsolute(const B2DPolygon& rCandidate, double fFrom, double fTo, double fLength = 0.0);
+
+ // Continuity check for point with given index
+ BASEGFX_DLLPUBLIC B2VectorContinuity getContinuityInPoint(const B2DPolygon& rCandidate, sal_uInt32 nIndex);
+
+ // Subdivide all contained curves. Use distanceBound value if given.
+ BASEGFX_DLLPUBLIC B2DPolygon adaptiveSubdivideByDistance(const B2DPolygon& rCandidate, double fDistanceBound = 0.0);
+
+ // Subdivide all contained curves. Use angleBound value if given.
+ BASEGFX_DLLPUBLIC B2DPolygon adaptiveSubdivideByAngle(const B2DPolygon& rCandidate, double fAngleBound = 0.0);
+
+ // #i37443# Subdivide all contained curves.
+ BASEGFX_DLLPUBLIC B2DPolygon adaptiveSubdivideByCount(const B2DPolygon& rCandidate, sal_uInt32 nCount = 0L);
+
+ // Definitions for the cut flags used from the findCut methods
+ typedef sal_uInt16 CutFlagValue;
+
+ #define CUTFLAG_NONE (0x0000)
+ #define CUTFLAG_LINE (0x0001)
+ #define CUTFLAG_START1 (0x0002)
+ #define CUTFLAG_START2 (0x0004)
+ #define CUTFLAG_END1 (0x0008)
+ #define CUTFLAG_END2 (0x0010)
+ #define CUTFLAG_ALL (CUTFLAG_LINE|CUTFLAG_START1|CUTFLAG_START2|CUTFLAG_END1|CUTFLAG_END2)
+ #define CUTFLAG_DEFAULT (CUTFLAG_LINE|CUTFLAG_START2|CUTFLAG_END2)
+
+ // This version works with two points and vectors to define the
+ // edges for the cut test.
+ BASEGFX_DLLPUBLIC CutFlagValue findCut(
+ const B2DPoint& rEdge1Start, const B2DVector& rEdge1Delta,
+ const B2DPoint& rEdge2Start, const B2DVector& rEdge2Delta,
+ CutFlagValue aCutFlags = CUTFLAG_DEFAULT,
+ double* pCut1 = 0L, double* pCut2 = 0L);
+
+ // test if point is on the given edge in range ]0.0..1.0[ without
+ // the start/end points. If so, return true and put the parameter
+ // value in pCut (if provided)
+ BASEGFX_DLLPUBLIC bool isPointOnEdge(
+ const B2DPoint& rPoint,
+ const B2DPoint& rEdgeStart,
+ const B2DVector& rEdgeDelta,
+ double* pCut = 0L);
+
+ /** Apply given LineDashing to given polygon
+
+ This method is used to cut down line polygons to the needed
+ pieces when a dashing needs to be applied.
+ It is now capable of keeping contained bezier segments.
+ It is also capable of delivering line and non-line portions
+ depending on what target polygons You provide. This is useful
+ e.g. for dashed lines with two colors.
+ If the last and the first snippet in one of the results have
+ a common start/end ppoint, they will be merged to achieve as
+ view as needed result line snippets. This is also relevant for
+ further processing the results.
+
+ @param rCandidate
+ The polygon based on which the snippets will be created.
+
+ @param rDotDashArray
+ The line pattern given as array of length values
+
+ @param pLineTarget
+ The target for line snippets, e.g. the first entry will be
+ a line segment with length rDotDashArray[0]. The given
+ polygon will be emptied as preparation.
+
+ @param pGapTarget
+ The target for gap snippets, e.g. the first entry will be
+ a line segment with length rDotDashArray[1]. The given
+ polygon will be emptied as preparation.
+
+ @param fFullDashDotLen
+ The sumed-up length of the rDotDashArray. If zero, it will
+ be calculated internally.
+ */
+ BASEGFX_DLLPUBLIC void applyLineDashing(
+ const B2DPolygon& rCandidate,
+ const ::std::vector<double>& rDotDashArray,
+ B2DPolyPolygon* pLineTarget,
+ B2DPolyPolygon* pGapTarget = 0,
+ double fFullDashDotLen = 0.0);
+
+ // test if point is inside epsilon-range around an edge defined
+ // by the two given points. Can be used for HitTesting. The epsilon-range
+ // is defined to be the rectangle centered to the given edge, using height
+ // 2 x fDistance, and the circle around both points with radius fDistance.
+ BASEGFX_DLLPUBLIC bool isInEpsilonRange(const B2DPoint& rEdgeStart, const B2DPoint& rEdgeEnd, const B2DPoint& rTestPosition, double fDistance);
+
+ // test if point is inside epsilon-range around the given Polygon. Can be used
+ // for HitTesting. The epsilon-range is defined to be the rectangle centered
+ // to the given edge, using height 2 x fDistance, and the circle around both points
+ // with radius fDistance.
+ BASEGFX_DLLPUBLIC bool isInEpsilonRange(const B2DPolygon& rCandidate, const B2DPoint& rTestPosition, double fDistance);
+
+ /** Create a polygon from a rectangle.
+
+ @param rRect
+ The rectangle which describes the polygon size
+
+ @param fRadiusX
+ @param fRadiusY
+ Radius of the edge rounding, relative to the rectangle size. 0.0 means no
+ rounding, 1.0 will lead to an ellipse
+ */
+ BASEGFX_DLLPUBLIC B2DPolygon createPolygonFromRect( const B2DRectangle& rRect, double fRadiusX, double fRadiusY );
+
+ /** Create a polygon from a rectangle.
+ */
+ BASEGFX_DLLPUBLIC B2DPolygon createPolygonFromRect( const B2DRectangle& rRect );
+
+ /** Create the unit polygon
+ */
+ BASEGFX_DLLPUBLIC B2DPolygon createUnitPolygon();
+
+ /** Create a circle polygon with given radius.
+
+ This method creates a circle approximation consisting of
+ four cubic bezier segments, which approximate the given
+ circle with an error of less than 0.5 percent.
+
+ @param rCenter
+ Center point of the circle
+
+ @param fRadius
+ Radius of the circle
+ */
+ BASEGFX_DLLPUBLIC B2DPolygon createPolygonFromCircle( const B2DPoint& rCenter, double fRadius );
+
+ /// create half circle centered on (0,0) from [0 .. F_PI]
+ B2DPolygon createHalfUnitCircle();
+
+ /** create a polygon which describes the unit circle and close it
+
+ @param nStartQuadrant
+ To be able to rebuild the old behaviour where the circles started at bottom,
+ this parameter is used. Default is 0 which is the first quadrant and the
+ polygon's start point will be the rightmost one. When using e.g. 1, the
+ first created quadrant will start at the YMax-position (with Y down on screens,
+ this is the lowest one). This is needed since when lines are dashed, toe old
+ geometry started at bottom point, else it would look different.
+ */
+ BASEGFX_DLLPUBLIC B2DPolygon createPolygonFromUnitCircle(sal_uInt32 nStartQuadrant = 0);
+
+ /** Create an ellipse polygon with given radii.
+
+ This method creates an ellipse approximation consisting of
+ four cubic bezier segments, which approximate the given
+ ellipse with an error of less than 0.5 percent.
+
+ @param rCenter
+ Center point of the circle
+
+ @param fRadiusX
+ Radius of the ellipse in X direction
+
+ @param fRadiusY
+ Radius of the ellipse in Y direction
+ */
+ BASEGFX_DLLPUBLIC B2DPolygon createPolygonFromEllipse( const B2DPoint& rCenter, double fRadiusX, double fRadiusY );
+
+ /** Create an unit ellipse polygon with the given angles, from start to end
+ */
+ BASEGFX_DLLPUBLIC B2DPolygon createPolygonFromEllipseSegment( const B2DPoint& rCenter, double fRadiusX, double fRadiusY, double fStart, double fEnd );
+
+ BASEGFX_DLLPUBLIC B2DPolygon createPolygonFromUnitEllipseSegment( double fStart, double fEnd );
+
+ /** Predicate whether a given polygon is a rectangle.
+
+ @param rPoly
+ Polygon to check
+
+ @return true, if the polygon describes a rectangle
+ (polygon is closed, and the points are either cw or ccw
+ enumerations of a rectangle's vertices). Note that
+ intermediate points and duplicate points are ignored.
+ */
+ BASEGFX_DLLPUBLIC bool isRectangle( const B2DPolygon& rPoly );
+
+ // create 3d polygon from given 2d polygon. The given fZCoordinate is used to expand the
+ // third coordinate.
+ BASEGFX_DLLPUBLIC B3DPolygon createB3DPolygonFromB2DPolygon(const B2DPolygon& rCandidate, double fZCoordinate = 0.0);
+
+ // create 2d PolyPolygon from given 3d PolyPolygon. All coordinates are transformed using the given
+ // matrix and the resulting x,y is used to form the new polygon.
+ BASEGFX_DLLPUBLIC B2DPolygon createB2DPolygonFromB3DPolygon(const B3DPolygon& rCandidate, const B3DHomMatrix& rMat);
+
+ // calculate the smallest distance to given edge and return. The relative position on the edge is returned in Cut.
+ // That position is in the range [0.0 .. 1.0] and the returned distance is adapted accordingly to the start or end
+ // point of the edge
+ BASEGFX_DLLPUBLIC double getSmallestDistancePointToEdge(const B2DPoint& rPointA, const B2DPoint& rPointB, const B2DPoint& rTestPoint, double& rCut);
+
+ // for each contained edge calculate the smallest distance. Return the index to the smallest
+ // edge in rEdgeIndex. The relative position on the edge is returned in rCut.
+ // If nothing was found (e.g. empty input plygon), DBL_MAX is returned.
+ BASEGFX_DLLPUBLIC double getSmallestDistancePointToPolygon(const B2DPolygon& rCandidate, const B2DPoint& rTestPoint, sal_uInt32& rEdgeIndex, double& rCut);
+
+ // distort single point. rOriginal describes the original range, where the given points describe the distorted corresponding points.
+ BASEGFX_DLLPUBLIC B2DPoint distort(const B2DPoint& rCandidate, const B2DRange& rOriginal, const B2DPoint& rTopLeft, const B2DPoint& rTopRight, const B2DPoint& rBottomLeft, const B2DPoint& rBottomRight);
+
+ // distort polygon. rOriginal describes the original range, where the given points describe the distorted corresponding points.
+ BASEGFX_DLLPUBLIC B2DPolygon distort(const B2DPolygon& rCandidate, const B2DRange& rOriginal, const B2DPoint& rTopLeft, const B2DPoint& rTopRight, const B2DPoint& rBottomLeft, const B2DPoint& rBottomRight);
+
+ // expand all segments (which are not yet) to curve segments. This is done with setting the control
+ // vectors on the 1/3 resp. 2/3 distances on each segment.
+ BASEGFX_DLLPUBLIC B2DPolygon expandToCurve(const B2DPolygon& rCandidate);
+
+ // expand given segment to curve segment. This is done with setting the control
+ // vectors on the 1/3 resp. 2/3 distances. The return value describes if a change took place.
+ BASEGFX_DLLPUBLIC bool expandToCurveInPoint(B2DPolygon& rCandidate, sal_uInt32 nIndex);
+
+ // set continuity for given index. If not a curve, nothing will change. Non-curve points are not changed, too.
+ // The return value describes if a change took place.
+ BASEGFX_DLLPUBLIC bool setContinuityInPoint(B2DPolygon& rCandidate, sal_uInt32 nIndex, B2VectorContinuity eContinuity);
+
+ // test if polygon contains neutral points. A neutral point is one whos orientation is neutral
+ // e.g. positioned on the edge of it's predecessor and successor
+ BASEGFX_DLLPUBLIC bool hasNeutralPoints(const B2DPolygon& rCandidate);
+
+ // remove neutral points. A neutral point is one whos orientation is neutral
+ // e.g. positioned on the edge of it's predecessor and successor
+ BASEGFX_DLLPUBLIC B2DPolygon removeNeutralPoints(const B2DPolygon& rCandidate);
+
+ // tests if polygon is convex
+ BASEGFX_DLLPUBLIC bool isConvex(const B2DPolygon& rCandidate);
+
+ // calculates the orientation at edge nIndex
+ BASEGFX_DLLPUBLIC B2VectorOrientation getOrientationForIndex(const B2DPolygon& rCandidate, sal_uInt32 nIndex);
+
+ // calculates if given point is on given line, taking care of the numerical epsilon
+ BASEGFX_DLLPUBLIC bool isPointOnLine(const B2DPoint& rStart, const B2DPoint& rEnd, const B2DPoint& rCandidate, bool bWithPoints = false);
+
+ // calculates if given point is on given polygon, taking care of the numerical epsilon. Uses
+ // isPointOnLine internally
+ BASEGFX_DLLPUBLIC bool isPointOnPolygon(const B2DPolygon& rCandidate, const B2DPoint& rPoint, bool bWithPoints = true);
+
+ // test if candidate is inside triangle
+ BASEGFX_DLLPUBLIC bool isPointInTriangle(const B2DPoint& rA, const B2DPoint& rB, const B2DPoint& rC, const B2DPoint& rCandidate, bool bWithBorder = false);
+
+ // test if candidateA and candidateB are on the same side of the given line
+ BASEGFX_DLLPUBLIC bool arePointsOnSameSideOfLine(const B2DPoint& rStart, const B2DPoint& rEnd, const B2DPoint& rCandidateA, const B2DPoint& rCandidateB, bool bWithLine = false);
+
+ // add triangles for given rCandidate to rTarget. For each triangle, 3 points will be added to rCandidate.
+ // All triangles will go from the start point of rCandidate to two consecutive points, building (rCandidate.count() - 2)
+ // triangles.
+ BASEGFX_DLLPUBLIC void addTriangleFan(const B2DPolygon& rCandidate, B2DPolygon& rTarget);
+
+ // grow for polygon. Move all geometry in each point in the direction of the normal in that point
+ // with the given amount. Value may be negative.
+ BASEGFX_DLLPUBLIC B2DPolygon growInNormalDirection(const B2DPolygon& rCandidate, double fValue);
+
+ // force all sub-polygons to a point count of nSegments
+ BASEGFX_DLLPUBLIC B2DPolygon reSegmentPolygon(const B2DPolygon& rCandidate, sal_uInt32 nSegments);
+
+ // create polygon state at t from 0.0 to 1.0 between the two polygons. Both polygons must have the same
+ // organisation, e.g. same amount of points
+ BASEGFX_DLLPUBLIC B2DPolygon interpolate(const B2DPolygon& rOld1, const B2DPolygon& rOld2, double t);
+
+ // #i76891# Try to remove existing curve segments if they are simply edges
+ BASEGFX_DLLPUBLIC B2DPolygon simplifyCurveSegments(const B2DPolygon& rCandidate);
+
+ // makes the given indexed point the new polygon start point. To do that, the points in the
+ // polygon will be rotated. This is only valid for closed polygons, for non-closed ones
+ // an assertion will be triggered
+ BASEGFX_DLLPUBLIC B2DPolygon makeStartPoint(const B2DPolygon& rCandidate, sal_uInt32 nIndexOfNewStatPoint);
+
+ /** create edges of given length along given B2DPolygon
+
+ @param rCandidate
+ The polygon to move along. Points at the given polygon are created, starting
+ at position fStart and stopping at less or equal to fEnd. The closed state is
+ preserved.
+ The polygon is subdivided if curve segments are included. That subdivision is the base
+ for the newly created points.
+ If the source is closed, the indirectly existing last edge may NOT have the
+ given length.
+ If the source is open, all edges will have the given length. You may use the last
+ point of the original when You want to add the last edge Yourself.
+
+ @param fLength
+ The length of the created edges. If less or equal zero, an empty polygon is returned.
+
+ @param fStart
+ The start distance for the first to be generated point. Use 0.0 to get the
+ original start point. Negative values are truncated to 0.0.
+
+ @param fEnd
+ The maximum distance for the last point. No more points behind this distance will be created.
+ Use 0.0 to proccess the whole polygon. Negative values are truncated to 0.0. It also
+ needs to be more or equal to fStart, else it is truncated to fStart.
+
+ @return
+ The newly created polygon
+ */
+ BASEGFX_DLLPUBLIC B2DPolygon createEdgesOfGivenLength(const B2DPolygon& rCandidate, double fLength, double fStart = 0.0, double fEnd = 0.0);
+
+ /** Create Waveline along given polygon
+ The implementation is based on createEdgesOfGivenLength and creates a curve
+ segment with the given dimensions for each created line segment. The polygon
+ is treated as if opened (closed state will be ignored) and only for whole
+ edges a curve segment will be created (no rest handling)
+
+ @param rCandidate
+ The polygon along which the waveline will be created
+
+ @param fWaveWidth
+ The length of a single waveline curve segment
+
+ @param fgWaveHeight
+ The height of the waveline (amplitude)
+ */
+ BASEGFX_DLLPUBLIC B2DPolygon createWaveline(const B2DPolygon& rCandidate, double fWaveWidth, double fWaveHeight);
+
+ /** snap some polygon coordinates to discrete coordinates
+
+ This method allows to snap some polygon points to discrete (integer) values
+ which equals e.g. a snap to discrete coordinates. It will snap points of
+ horizontal and vertical edges
+
+ @param rCandidate
+ The source polygon
+
+ @return
+ The modified version of the source polygon
+ */
+ BASEGFX_DLLPUBLIC B2DPolygon snapPointsOfHorizontalOrVerticalEdges(const B2DPolygon& rCandidate);
+
+ } // end of namespace tools
+} // end of namespace basegfx
+
+#endif /* _BGFX_POLYGON_B2DPOLYGONTOOLS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b2dpolygontriangulator.hxx b/include/basegfx/polygon/b2dpolygontriangulator.hxx
new file mode 100644
index 000000000000..5af34ae1ecd2
--- /dev/null
+++ b/include/basegfx/polygon/b2dpolygontriangulator.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POLYGON_B2DPOLYGONTRIANGULATOR_HXX
+#define _BGFX_POLYGON_B2DPOLYGONTRIANGULATOR_HXX
+
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ namespace triangulator
+ {
+ // triangulate given polygon
+ BASEGFX_DLLPUBLIC ::basegfx::B2DPolygon triangulate(const ::basegfx::B2DPolygon& rCandidate);
+
+ // triangulate given PolyPolygon
+ BASEGFX_DLLPUBLIC ::basegfx::B2DPolygon triangulate(const ::basegfx::B2DPolyPolygon& rCandidate);
+
+ } // end of namespace triangulator
+} // end of namespace basegfx
+
+#endif /* _BGFX_POLYGON_B2DPOLYGONTRIANGULATOR_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b2dpolypolygon.hxx b/include/basegfx/polygon/b2dpolypolygon.hxx
new file mode 100644
index 000000000000..cd22644ab8ce
--- /dev/null
+++ b/include/basegfx/polygon/b2dpolypolygon.hxx
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POLYGON_B2DPOLYPOLYGON_HXX
+#define _BGFX_POLYGON_B2DPOLYPOLYGON_HXX
+
+#include <sal/types.h>
+#include <o3tl/cow_wrapper.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/basegfxdllapi.h>
+#include <vector>
+
+// predeclarations
+class ImplB2DPolyPolygon;
+
+namespace basegfx
+{
+ class B2DPolygon;
+ class B2DHomMatrix;
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ class BASEGFX_DLLPUBLIC B2DPolyPolygon
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImplB2DPolyPolygon > ImplType;
+
+ private:
+ ImplType mpPolyPolygon;
+
+ public:
+ B2DPolyPolygon();
+ B2DPolyPolygon(const B2DPolyPolygon& rPolyPolygon);
+ explicit B2DPolyPolygon(const B2DPolygon& rPolygon);
+ ~B2DPolyPolygon();
+
+ // assignment operator
+ B2DPolyPolygon& operator=(const B2DPolyPolygon& rPolyPolygon);
+
+ /// unshare this poly-polygon (and all included polygons) with all internally shared instances
+ void makeUnique();
+
+ // compare operators
+ bool operator==(const B2DPolyPolygon& rPolyPolygon) const;
+ bool operator!=(const B2DPolyPolygon& rPolyPolygon) const;
+
+ // polygon interface
+ sal_uInt32 count() const;
+
+ B2DPolygon getB2DPolygon(sal_uInt32 nIndex) const;
+ void setB2DPolygon(sal_uInt32 nIndex, const B2DPolygon& rPolygon);
+
+ // test for curve
+ bool areControlPointsUsed() const;
+
+ // insert/append single polygon
+ void insert(sal_uInt32 nIndex, const B2DPolygon& rPolygon, sal_uInt32 nCount = 1);
+ void append(const B2DPolygon& rPolygon, sal_uInt32 nCount = 1);
+
+ /** Default adaptive subdivision access
+
+ For details refer to B2DPolygon::getDefaultAdaptiveSubdivision()
+
+ @return
+ The default subdivision of this polygon
+ */
+ B2DPolyPolygon getDefaultAdaptiveSubdivision() const;
+
+ /** Get the B2DRange (Rectangle dimensions) of this B2DPolyPolygon
+
+ For details refer to B2DPolygon::getB2DRange()
+
+ @return
+ The outer range of the bezier curve/polygon
+ */
+ B2DRange getB2DRange() const;
+
+ // insert/append multiple polygons
+ void insert(sal_uInt32 nIndex, const B2DPolyPolygon& rPolyPolygon);
+ void append(const B2DPolyPolygon& rPolyPolygon);
+
+ // remove
+ void remove(sal_uInt32 nIndex, sal_uInt32 nCount = 1);
+
+ // reset to empty state
+ void clear();
+
+ // closed state
+ bool isClosed() const;
+ void setClosed(bool bNew);
+
+ // flip polygon direction
+ void flip();
+
+ // test if PolyPolygon has double points
+ bool hasDoublePoints() const;
+
+ // remove double points, at the begin/end and follow-ups, too
+ void removeDoublePoints();
+
+ // apply transformation given in matrix form to the polygon
+ void transform(const basegfx::B2DHomMatrix& rMatrix);
+
+ // polygon iterators (same iterator validity conditions as for vector)
+ const B2DPolygon* begin() const;
+ const B2DPolygon* end() const;
+ B2DPolygon* begin();
+ B2DPolygon* end();
+ };
+
+ // typedef for a vector of B2DPolyPolygons
+ typedef ::std::vector< B2DPolyPolygon > B2DPolyPolygonVector;
+
+} // end of namespace basegfx
+
+#endif /* _BGFX_POLYGON_B2DPOLYPOLYGON_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b2dpolypolygoncutter.hxx b/include/basegfx/polygon/b2dpolypolygoncutter.hxx
new file mode 100644
index 000000000000..31bd8b6279f9
--- /dev/null
+++ b/include/basegfx/polygon/b2dpolypolygoncutter.hxx
@@ -0,0 +1,153 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POLYGON_B2DPOLYPOLYGONCUTTER_HXX
+#define _BGFX_POLYGON_B2DPOLYPOLYGONCUTTER_HXX
+
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ namespace tools
+ {
+ /** Solve all crossovers (aka self-intersections) in a polyPolygon.
+
+ This re-layouts all contained polygons so that the result
+ will contain only non-cutting polygons. For that reason,
+ points will be added at crossover and touch points and the
+ single Polygons may be re-combined. The orientations of
+ the contained polygons in not changed but used as
+ topological information. Self crossovers of the contained
+ sub-polygons are implicitely handled, but to not lose the
+ topological information, it may be necessary to remove
+ self-intersections of the contained sub-polygons in a
+ preparing step and to explicitly correct their
+ orientations.
+ */
+ BASEGFX_DLLPUBLIC B2DPolyPolygon solveCrossovers(const B2DPolyPolygon& rCandidate);
+
+ /** Solve all crossovers (aka self-intersections) in a Polygon
+
+ Same as above, but for single polygons. Result will be
+ free of self-intersections. When result contains multiple
+ polygons, it may be necessary to rearrange their
+ orientations since holes may have been created (use
+ correctOrientations eventually).
+ */
+ BASEGFX_DLLPUBLIC B2DPolyPolygon solveCrossovers(const B2DPolygon& rCandidate);
+
+ /** Strip neutral polygons from PolyPolygon.
+
+ Neutral polygons are ones who's orientation is neutral, so
+ normally they have no volume -> just closed paths. A
+ polygon with the same positive and negative oriented
+ volume is also neutral, so this may not be wanted. It is
+ safe to call with self-intersection-free polygons, though
+ (that's where it's mostly used).
+ */
+ BASEGFX_DLLPUBLIC B2DPolyPolygon stripNeutralPolygons(const B2DPolyPolygon& rCandidate);
+
+ /** Remove unnecessary/non-displayed polygons.
+
+ Works only correct with self-intersection-free
+ polygons. For each polygon, the depth for the PolyPolygon
+ is calculated. The orientation is used to identify holes.
+ Start value for holes is -1, for polygons it's zero. Ech
+ time a polygon is contained in another one, it's depth is
+ increased when inside a polygon, decreased when inside a
+ hole. The result is a depth which e.g. is -1 for holes
+ outside everything, 1 for a polygon covered by another
+ polygon and zero for e.g. holes in a polygon or polygons
+ outside everythig else. In the 2nd step, all polygons
+ with depth other than zero are removed. If bKeepAboveZero
+ is used, all polygons < 1 are removed. The bKeepAboveZero
+ mode is useful for clipping, e.g. just append one polygon
+ to another and use this mode -> only parts where two
+ polygons overlapped will be kept. In combination with
+ correct orientation of the input orientations and the
+ SolveCrossover calls this can be combined for logical
+ polygon operations or polygon clipping.
+ */
+ BASEGFX_DLLPUBLIC B2DPolyPolygon stripDispensablePolygons(const B2DPolyPolygon& rCandidate, bool bKeepAboveZero = false);
+
+ /** Emulate nonzero winding rule filling.
+
+ Geometrically convert PolyPolygons which are proposed to
+ use nonzero fill rule to a representation where evenodd
+ paint will give the same result. To do this all
+ intersections and self-intersections get solved (the
+ polygons will be rearranged if needed). Then all polygons
+ which are inside another one with the same orientation get
+ deleted
+ */
+ BASEGFX_DLLPUBLIC B2DPolyPolygon createNonzeroConform(const B2DPolyPolygon& rCandidate);
+
+ // For convenience: The four basic operations OR, XOR, AND and DIFF for
+ // two PolyPolygons. These are combinations of the above methods. To not be forced
+ // to do evtl. already done preparations twice, You have to do the operations Yourself.
+ //
+ // A source preparation consists of preparing it to be seen as XOR-Rule PolyPolygon,
+ // so it is freed of intersections, self-intersections and the orientations are corrected.
+ // Important is that it will define the same areas as before, but is intersection-free.
+ // As an example think about a single polygon looping in itself and having holes. To
+ // topologically correctly handle this, it is necessary to remove all intersections and
+ // to correct the orientations. The orientation of the isolated holes e.g. will be negative.
+ // Topologically it is necessary to prepare each polygon which is seen as entity. It is
+ // not sufficient just to concatenate them and prepare the result, this may be topologically
+ // different since the simple concatenation will be seen as XOR. To work correctly, You
+ // may need to OR those polygons.
+
+ /// prep for ops - solve self-intersections and intersections, remove neutral parts and check orientations.
+ BASEGFX_DLLPUBLIC B2DPolyPolygon prepareForPolygonOperation(const B2DPolygon& rCandidate);
+ /// prep for ops - solve self-intersections and intersections, remove neutral parts and check orientations.
+ BASEGFX_DLLPUBLIC B2DPolyPolygon prepareForPolygonOperation(const B2DPolyPolygon& rCandidate);
+
+ /// OR: Return all areas where CandidateA or CandidateB exist
+ BASEGFX_DLLPUBLIC B2DPolyPolygon solvePolygonOperationOr(const B2DPolyPolygon& rCandidateA, const B2DPolyPolygon& rCandidateB);
+
+ /// XOR: Return all areas where CandidateA or CandidateB exist, but not both
+ BASEGFX_DLLPUBLIC B2DPolyPolygon solvePolygonOperationXor(const B2DPolyPolygon& rCandidateA, const B2DPolyPolygon& rCandidateB);
+
+ /// AND: Return all areas where CandidateA and CandidateB exist
+ BASEGFX_DLLPUBLIC B2DPolyPolygon solvePolygonOperationAnd(const B2DPolyPolygon& rCandidateA, const B2DPolyPolygon& rCandidateB);
+
+ /// DIFF: Return all areas where CandidateA is not covered by CandidateB (cut B out of A)
+ BASEGFX_DLLPUBLIC B2DPolyPolygon solvePolygonOperationDiff(const B2DPolyPolygon& rCandidateA, const B2DPolyPolygon& rCandidateB);
+
+ /** merge all single PolyPolygons to a single, OR-ed PolyPolygon
+
+ @param rInput
+ The source PolyPolygons
+
+ @return A single PolyPolygon containing the Or-merged result
+ */
+ BASEGFX_DLLPUBLIC B2DPolyPolygon mergeToSinglePolyPolygon(const B2DPolyPolygonVector& rInput);
+
+ } // end of namespace tools
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+#endif /* _BGFX_POLYGON_B2DPOLYPOLYGONCUTTER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b2dpolypolygonfillrule.hxx b/include/basegfx/polygon/b2dpolypolygonfillrule.hxx
new file mode 100644
index 000000000000..390dd9bac9f0
--- /dev/null
+++ b/include/basegfx/polygon/b2dpolypolygonfillrule.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POLYGON_B2DPOLYPOLYGONFILLRULE_HXX
+#define _BGFX_POLYGON_B2DPOLYPOLYGONFILLRULE_HXX
+
+#include <sal/types.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ /** Fill rule to use for poly-polygon filling.
+
+ The fill rule determines which areas are inside, and which are
+ outside the poly-polygon.
+ */
+ enum FillRule
+ {
+ /** Areas, for which a scanline has crossed an odd number of
+ vertices, are regarded 'inside', the remainder 'outside'
+ of the poly-polygon.
+ */
+ FillRule_EVEN_ODD,
+
+ /** For each edge a scanline crosses, a current winding number
+ is updated. Downward edges count +1, upward edges count
+ -1. If the total accumulated winding number for one area
+ is not zero, this area is regarded 'inside', otherwise,
+ 'outside'.
+ */
+ FillRule_NONZERO_WINDING_NUMBER
+ };
+}
+
+#endif /* _BGFX_POLYGON_B2DPOLYPOLYGONFILLRULE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b2dpolypolygontools.hxx b/include/basegfx/polygon/b2dpolypolygontools.hxx
new file mode 100644
index 000000000000..29ae3e042133
--- /dev/null
+++ b/include/basegfx/polygon/b2dpolypolygontools.hxx
@@ -0,0 +1,236 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POLYPOLYGON_B2DPOLYGONTOOLS_HXX
+#define _BGFX_POLYPOLYGON_B2DPOLYGONTOOLS_HXX
+
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b3dpolypolygon.hxx>
+#include <vector>
+#include <basegfx/basegfxdllapi.h>
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ // predefinitions
+ class B2DPolyPolygon;
+ class B2DRange;
+
+ namespace tools
+ {
+ // B2DPolyPolygon tools
+
+ // Check and evtl. correct orientations of all contained Polygons so that
+ // the orientations of contained polygons will variate to express areas and
+ // holes
+ BASEGFX_DLLPUBLIC B2DPolyPolygon correctOrientations(const B2DPolyPolygon& rCandidate);
+
+ // make sure polygon with index 0L is not a hole. This may evtl. change the
+ // sequence of polygons, but allows to use polygon with index 0L to
+ // get the correct normal for the whole polyPolygon
+ BASEGFX_DLLPUBLIC B2DPolyPolygon correctOutmostPolygon(const B2DPolyPolygon& rCandidate);
+
+ // Subdivide all contained curves. Use distanceBound value if given.
+ BASEGFX_DLLPUBLIC B2DPolyPolygon adaptiveSubdivideByDistance(const B2DPolyPolygon& rCandidate, double fDistanceBound = 0.0);
+
+ // Subdivide all contained curves. Use distanceBound value if given. Else, a convenient one
+ // is created.
+ BASEGFX_DLLPUBLIC B2DPolyPolygon adaptiveSubdivideByAngle(const B2DPolyPolygon& rCandidate, double fAngleBound = 0.0);
+
+ // Subdivide all contained curves. Use nCount divisions if given. Else, a convenient one
+ // is created.
+ BASEGFX_DLLPUBLIC B2DPolyPolygon adaptiveSubdivideByCount(const B2DPolyPolygon& rCandidate, sal_uInt32 nCount = 0L);
+
+ // isInside test for B2dPoint. On border is not inside as long as not true is given
+ // in bWithBorder flag. It is assumed that the orientations of the given polygon are correct.
+ BASEGFX_DLLPUBLIC bool isInside(const B2DPolyPolygon& rCandidate, const B2DPoint& rPoint, bool bWithBorder = false);
+
+ /** Get the range of a polyPolygon
+
+ For detailed description look at getRange(const B2DPolygon&).
+ This method just expands by the range of every sub-Polygon.
+
+ @param rCandidate
+ The B2DPolyPolygon eventually containing bezier segments
+
+ @return
+ The outer range of the polygon
+ */
+ BASEGFX_DLLPUBLIC B2DRange getRange(const B2DPolyPolygon& rCandidate);
+
+ /** Apply given LineDashing to given polyPolygon
+
+ For a description see applyLineDashing in b2dpolygontoos.hxx
+ */
+ BASEGFX_DLLPUBLIC void applyLineDashing(
+ const B2DPolyPolygon& rCandidate,
+ const ::std::vector<double>& rDotDashArray,
+ B2DPolyPolygon* pLineTarget,
+ B2DPolyPolygon* pGapTarget = 0,
+ double fFullDashDotLen = 0.0);
+
+ // test if point is inside epsilon-range around the given PolyPolygon. Can be used
+ // for HitTesting. The epsilon-range is defined to be the tube around the PolyPolygon
+ // with distance fDistance and rounded edges (start and end point).
+ BASEGFX_DLLPUBLIC bool isInEpsilonRange(const B2DPolyPolygon& rCandidate, const B2DPoint& rTestPosition, double fDistance);
+
+ /** Read poly-polygon from SVG.
+
+ This function imports a poly-polygon from an SVG-D
+ attribute.
+
+ @param o_rPolyPoly
+ The output poly-polygon
+
+ @param rSvgDAttribute
+ A valid SVG-D attribute string
+
+ @param rWrongPositionAfterZ
+ Indicates wheter the generator interprets wrongly
+ the position in the path after Z or z elements
+ https://bugs.freedesktop.org/show_bug.cgi?id=47406
+
+ @return true, if the string was successfully parsed
+ */
+ BASEGFX_DLLPUBLIC bool importFromSvgD( B2DPolyPolygon& o_rPolyPoly,
+ const OUString& rSvgDAttribute, bool bWrongPositionAfterZ = false );
+
+ /** Read poly-polygon from SVG.
+
+ This function imports a poly-polygon from an SVG points
+ attribute (a plain list of coordinate pairs).
+
+ @param o_rPoly
+ The output polygon. Note that svg:points can only define a
+ single polygon
+
+ @param rSvgPointsAttribute
+ A valid SVG points attribute string
+
+ @return true, if the string was successfully parsed
+ */
+ BASEGFX_DLLPUBLIC bool importFromSvgPoints( B2DPolygon& o_rPoly,
+ const OUString& rSvgPointsAttribute );
+
+
+ // grow for polyPolygon. Move all geometry in each point in the direction of the normal in that point
+ // with the given amount. Value may be negative.
+ BASEGFX_DLLPUBLIC B2DPolyPolygon growInNormalDirection(const B2DPolyPolygon& rCandidate, double fValue);
+
+ // This method will correct a pair of polyPolygons where the goal is to keep same point count
+ // to allow direct point association and also to remove self-intersections produced by shrinks.
+ // This method will eventually change both polyPolygons to reach that goal because there are cases
+ // where it is necessary to add new cut points to the original
+ BASEGFX_DLLPUBLIC void correctGrowShrinkPolygonPair(B2DPolyPolygon& rOriginal, B2DPolyPolygon& rGrown);
+
+ // force all sub-polygons to a point count of nSegments
+ BASEGFX_DLLPUBLIC B2DPolyPolygon reSegmentPolyPolygon(const B2DPolyPolygon& rCandidate, sal_uInt32 nSegments);
+
+ // create polygon state at t from 0.0 to 1.0 between the two polygons. Both polygons must have the same
+ // organisation, e.g. same amount of polygons
+ BASEGFX_DLLPUBLIC B2DPolyPolygon interpolate(const B2DPolyPolygon& rOld1, const B2DPolyPolygon& rOld2, double t);
+
+ // create 3d PolyPolygon from given 2d PolyPolygon. The given fZCoordinate is used to expand the
+ // third coordinate.
+ BASEGFX_DLLPUBLIC B3DPolyPolygon createB3DPolyPolygonFromB2DPolyPolygon(const B2DPolyPolygon& rCandidate, double fZCoordinate = 0.0);
+
+ // create 2d PolyPolygon from given 3d PolyPolygon. All coordinates are transformed using the given
+ // matrix and the resulting x,y is used to form the new polygon.
+ BASEGFX_DLLPUBLIC B2DPolyPolygon createB2DPolyPolygonFromB3DPolyPolygon(const B3DPolyPolygon& rCandidate, const B3DHomMatrix& rMat);
+
+ // for each contained edge in each contained polygon calculate the smallest distance. Return the index to the smallest
+ // edge in rEdgeIndex and the index to the polygon in rPolygonIndex. The relative position on the edge is returned in rCut.
+ // If nothing was found (e.g. empty input plygon), DBL_MAX is returned.
+ BASEGFX_DLLPUBLIC double getSmallestDistancePointToPolyPolygon(const B2DPolyPolygon& rCandidate, const B2DPoint& rTestPoint, sal_uInt32& rPolygonIndex, sal_uInt32& rEdgeIndex, double& rCut);
+
+ // distort PolyPolygon. rOriginal describes the original range, where the given points describe the distorted
+ // corresponding points.
+ BASEGFX_DLLPUBLIC B2DPolyPolygon distort(const B2DPolyPolygon& rCandidate, const B2DRange& rOriginal, const B2DPoint& rTopLeft, const B2DPoint& rTopRight, const B2DPoint& rBottomLeft, const B2DPoint& rBottomRight);
+
+ // expand all segments (which are not yet) to curve segments. This is done with setting the control
+ // vectors on the 1/3 resp. 2/3 distances on each segment.
+ BASEGFX_DLLPUBLIC B2DPolyPolygon expandToCurve(const B2DPolyPolygon& rCandidate);
+
+ /** Predicate whether a given poly-polygon is a rectangle.
+
+ @param rPoly
+ PolyPolygon to check
+
+ @return true, if the poly-polygon describes a rectangle
+ (contains exactly one polygon, polygon is closed, and the
+ points are either cw or ccw enumerations of a rectangle's
+ vertices). Note that intermediate points and duplicate
+ points are ignored.
+ */
+ BASEGFX_DLLPUBLIC bool isRectangle( const B2DPolyPolygon& rPoly );
+
+ /** Export poly-polygon to SVG.
+
+ This function exports a poly-polygon into an SVG-D
+ statement. Currently, output of relative point sequences
+ is not yet supported (might cause slightly larger output)
+
+ @param rPolyPoly
+ The poly-polygon to export
+
+ @param bUseRelativeCoordinates
+ When true, all coordinate values are exported as relative
+ to the current position. This tends to save some space,
+ since fewer digits needs to be written.
+
+ @param bDetectQuadraticBeziers
+ When true, the export tries to detect cubic bezier
+ segments in the input polygon, which can be represented by
+ quadratic bezier segments. Note that the generated string
+ causes versions prior to OOo2.0 to crash.
+
+ @return the generated SVG-D statement (the XML d attribute
+ value alone, without any "<path ...>" or "d="...")
+ */
+ BASEGFX_DLLPUBLIC OUString exportToSvgD( const B2DPolyPolygon& rPolyPoly,
+ bool bUseRelativeCoordinates=true,
+ bool bDetectQuadraticBeziers=true );
+
+ // #i76891# Try to remove existing curve segments if they are simply edges
+ BASEGFX_DLLPUBLIC B2DPolyPolygon simplifyCurveSegments(const B2DPolyPolygon& rCandidate);
+
+ /** snap some polygon coordinates to discrete coordinates
+
+ This method allows to snap some polygon points to discrete (integer) values
+ which equals e.g. a snap to discrete coordinates. It will snap points of
+ horizontal and vertical edges
+
+ @param rCandidate
+ The source polygon
+
+ @return
+ The modified version of the source polygon
+ */
+ BASEGFX_DLLPUBLIC B2DPolyPolygon snapPointsOfHorizontalOrVerticalEdges(const B2DPolyPolygon& rCandidate);
+
+ } // end of namespace tools
+} // end of namespace basegfx
+
+#endif /* _BGFX_POLYPOLYGON_B2DPOLYGONTOOLS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b2dtrapezoid.hxx b/include/basegfx/polygon/b2dtrapezoid.hxx
new file mode 100644
index 000000000000..43ee9fb37f6c
--- /dev/null
+++ b/include/basegfx/polygon/b2dtrapezoid.hxx
@@ -0,0 +1,124 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POLYGON_B2DTRAPEZOID_HXX
+#define _BGFX_POLYGON_B2DTRAPEZOID_HXX
+
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <vector>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ // class to hold a single trapezoid
+ class BASEGFX_DLLPUBLIC B2DTrapezoid
+ {
+ private:
+ // Geometry data. YValues are down-oriented, this means bottom should
+ // be bigger than top to be below it. The constructor implementation
+ // guarantees:
+ //
+ // - mfBottomY >= mfTopY
+ // - mfTopXRight >= mfTopXLeft
+ // - mfBottomXRight >= mfBottomXLeft
+ double mfTopXLeft;
+ double mfTopXRight;
+ double mfTopY;
+ double mfBottomXLeft;
+ double mfBottomXRight;
+ double mfBottomY;
+
+ public:
+ // constructor
+ B2DTrapezoid(
+ const double& rfTopXLeft,
+ const double& rfTopXRight,
+ const double& rfTopY,
+ const double& rfBottomXLeft,
+ const double& rfBottomXRight,
+ const double& rfBottomY);
+
+ // data read access
+ const double& getTopXLeft() const { return mfTopXLeft; }
+ const double& getTopXRight() const { return mfTopXRight; }
+ const double& getTopY() const { return mfTopY; }
+ const double& getBottomXLeft() const { return mfBottomXLeft; }
+ const double& getBottomXRight() const { return mfBottomXRight; }
+ const double& getBottomY() const { return mfBottomY; }
+
+ // convenience method to get content as Polygon
+ B2DPolygon getB2DPolygon() const;
+ };
+
+ typedef ::std::vector< B2DTrapezoid > B2DTrapezoidVector;
+
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ namespace tools
+ {
+ // convert SourcePolyPolygon to trapezoids. The trapezoids will be appended to
+ // ro_Result. ro_Result will not be cleared. If SourcePolyPolygon contains curves,
+ // it's default AdaptiveSubdivision will be used.
+ // CAUTION: Trapezoids are oreintation-dependent in the sense that the upper and lower
+ // lines have to be parallel to the X-Axis, thus this subdivision is NOT simply usable
+ // for primitive decompositions. To use it, the shear and rotate parts of the
+ // involved transformations HAVE to be taken into account.
+ BASEGFX_DLLPUBLIC void trapezoidSubdivide(
+ B2DTrapezoidVector& ro_Result,
+ const B2DPolyPolygon& rSourcePolyPolygon);
+
+ // directly create trapezoids from given edge. Depending on the given geometry,
+ // none up to three trapezoids will be created
+ BASEGFX_DLLPUBLIC void createLineTrapezoidFromEdge(
+ B2DTrapezoidVector& ro_Result,
+ const B2DPoint& rPointA,
+ const B2DPoint& rPointB,
+ double fLineWidth = 1.0);
+
+ // create trapezoids for all edges of the given polygon. The closed state of
+ // the polygon is taken into account. If curves are contaned, the default
+ // AdaptiveSubdivision will be used.
+ BASEGFX_DLLPUBLIC void createLineTrapezoidFromB2DPolygon(
+ B2DTrapezoidVector& ro_Result,
+ const B2DPolygon& rPolygon,
+ double fLineWidth = 1.0);
+
+ // create trapezoids for all edges of the given polyPolygon. The closed state of
+ // the PolyPolygon is taken into account. If curves are contaned, the default
+ // AdaptiveSubdivision will be used.
+ BASEGFX_DLLPUBLIC void createLineTrapezoidFromB2DPolyPolygon(
+ B2DTrapezoidVector& ro_Result,
+ const B2DPolyPolygon& rPolyPolygon,
+ double fLineWidth = 1.0);
+
+ } // end of namespace tools
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif /* _BGFX_POLYGON_B2DTRAPEZOID_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b3dpolygon.hxx b/include/basegfx/polygon/b3dpolygon.hxx
new file mode 100644
index 000000000000..7199eea9684c
--- /dev/null
+++ b/include/basegfx/polygon/b3dpolygon.hxx
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POLYGON_B3DPOLYGON_HXX
+#define _BGFX_POLYGON_B3DPOLYGON_HXX
+
+#include <sal/types.h>
+#include <o3tl/cow_wrapper.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+class ImplB3DPolygon;
+
+namespace basegfx
+{
+ class B3DPolygon;
+ class B3DPoint;
+ class B3DHomMatrix;
+ class B3DVector;
+ class B2DPoint;
+ class B2DHomMatrix;
+ class BColor;
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ class BASEGFX_DLLPUBLIC B3DPolygon
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImplB3DPolygon > ImplType;
+
+ private:
+ // internal data.
+ ImplType mpPolygon;
+
+ public:
+ B3DPolygon();
+ B3DPolygon(const B3DPolygon& rPolygon);
+ ~B3DPolygon();
+
+ // assignment operator
+ B3DPolygon& operator=(const B3DPolygon& rPolygon);
+
+ // compare operators
+ bool operator==(const B3DPolygon& rPolygon) const;
+ bool operator!=(const B3DPolygon& rPolygon) const;
+
+ // member count
+ sal_uInt32 count() const;
+
+ // Coordinate interface
+ B3DPoint getB3DPoint(sal_uInt32 nIndex) const;
+ void setB3DPoint(sal_uInt32 nIndex, const B3DPoint& rValue);
+
+ // Coordinate append
+ void append(const B3DPoint& rPoint, sal_uInt32 nCount = 1);
+
+ // BColor interface
+ BColor getBColor(sal_uInt32 nIndex) const;
+ void setBColor(sal_uInt32 nIndex, const BColor& rValue);
+ bool areBColorsUsed() const;
+ void clearBColors();
+
+ // Normals interface
+ B3DVector getNormal() const; // plane normal
+ B3DVector getNormal(sal_uInt32 nIndex) const; // normal in each point
+ void setNormal(sal_uInt32 nIndex, const B3DVector& rValue);
+ void transformNormals(const B3DHomMatrix& rMatrix);
+ bool areNormalsUsed() const;
+ void clearNormals();
+
+ // TextureCoordinate interface
+ B2DPoint getTextureCoordinate(sal_uInt32 nIndex) const;
+ void setTextureCoordinate(sal_uInt32 nIndex, const B2DPoint& rValue);
+ void transformTextureCoordiantes(const B2DHomMatrix& rMatrix);
+ bool areTextureCoordinatesUsed() const;
+ void clearTextureCoordinates();
+
+ // append other 2D polygons
+ void append(const B3DPolygon& rPoly, sal_uInt32 nIndex = 0, sal_uInt32 nCount = 0);
+
+ // remove
+ void remove(sal_uInt32 nIndex, sal_uInt32 nCount = 1);
+
+ // clear all points
+ void clear();
+
+ // closed state
+ bool isClosed() const;
+ void setClosed(bool bNew);
+
+ // flip polygon direction
+ void flip();
+
+ // test if Polygon has double points
+ bool hasDoublePoints() const;
+
+ // remove double points, at the begin/end and follow-ups, too
+ void removeDoublePoints();
+
+ // apply transformation given in matrix form to the polygon
+ void transform(const B3DHomMatrix& rMatrix);
+ };
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+#endif /* _BGFX_POLYGON_B3DPOLYGON_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b3dpolygontools.hxx b/include/basegfx/polygon/b3dpolygontools.hxx
new file mode 100644
index 000000000000..9ed32b42fb90
--- /dev/null
+++ b/include/basegfx/polygon/b3dpolygontools.hxx
@@ -0,0 +1,135 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POLYGON_B3DPOLYGONTOOLS_HXX
+#define _BGFX_POLYGON_B3DPOLYGONTOOLS_HXX
+
+#include <basegfx/point/b3dpoint.hxx>
+#include <basegfx/vector/b3dvector.hxx>
+#include <basegfx/polygon/b3dpolypolygon.hxx>
+#include <basegfx/vector/b2enums.hxx>
+#include <vector>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ // predefinitions
+ class B3DPolygon;
+ class B3DRange;
+
+ namespace tools
+ {
+ // B3DPolygon tools
+
+ /** Check if given polygon is closed. This is kind of a
+ 'classic' method to support old polygon definitions.
+ Those old polygon definitions define the closed state
+ of the polygon using identical start and endpoints. This
+ method corrects this (removes double start/end points)
+ and sets the Closed()-state of the polygon correctly.
+ */
+ BASEGFX_DLLPUBLIC void checkClosed(B3DPolygon& rCandidate);
+
+ // Get successor and predecessor indices. Returning the same index means there
+ // is none. Same for successor.
+ BASEGFX_DLLPUBLIC sal_uInt32 getIndexOfSuccessor(sal_uInt32 nIndex, const B3DPolygon& rCandidate);
+
+ // get size of polygon. Control vectors are included in that ranges.
+ BASEGFX_DLLPUBLIC B3DRange getRange(const B3DPolygon& rCandidate);
+
+ // get normal vector of polygon
+ BASEGFX_DLLPUBLIC B3DVector getNormal(const B3DPolygon& rCandidate);
+
+ // get area of polygon
+ BASEGFX_DLLPUBLIC double getArea(const ::basegfx::B3DPolygon& rCandidate);
+
+ // get length of polygon
+ BASEGFX_DLLPUBLIC double getLength(const B3DPolygon& rCandidate);
+
+ /** Apply given LineDashing to given polygon
+
+ For a description see applyLineDashing in b2dpolygontoos.hxx
+ */
+ BASEGFX_DLLPUBLIC void applyLineDashing(
+ const B3DPolygon& rCandidate,
+ const ::std::vector<double>& rDotDashArray,
+ B3DPolyPolygon* pLineTarget,
+ B3DPolyPolygon* pGapTarget = 0,
+ double fFullDashDotLen = 0.0);
+
+ /** Create/replace normals for given 3d geometry with default normals from given center to outside.
+ rCandidate: the 3d geometry to change
+ rCenter: the center of the 3d geometry
+ */
+ BASEGFX_DLLPUBLIC B3DPolygon applyDefaultNormalsSphere( const B3DPolygon& rCandidate, const B3DPoint& rCenter);
+
+ /** invert normals for given 3d geometry.
+ */
+ BASEGFX_DLLPUBLIC B3DPolygon invertNormals( const B3DPolygon& rCandidate);
+
+ /** Create/replace texture coordinates for given 3d geometry with parallel projected one
+ rRange: the full range of the 3d geometry
+ If bChangeX, x texture coordinate will be recalculated.
+ If bChangeY, y texture coordinate will be recalculated.
+ */
+ BASEGFX_DLLPUBLIC B3DPolygon applyDefaultTextureCoordinatesParallel( const B3DPolygon& rCandidate, const B3DRange& rRange, bool bChangeX = true, bool bChangeY = true);
+
+ /** Create/replace texture coordinates for given 3d geometry with spherical one
+ rCenter: the centre of the used 3d geometry
+ If bChangeX, x texture coordinate will be recalculated.
+ If bChangeY, y texture coordinate will be recalculated.
+ */
+ BASEGFX_DLLPUBLIC B3DPolygon applyDefaultTextureCoordinatesSphere( const B3DPolygon& rCandidate, const B3DPoint& rCenter, bool bChangeX = true, bool bChangeY = true);
+
+ // isInside tests for B3DPoint. On border is not inside as long as not true is given in bWithBorder flag.
+ BASEGFX_DLLPUBLIC bool isInside(const B3DPolygon& rCandidate, const B3DPoint& rPoint, bool bWithBorder = false);
+
+ // calculates if given point is on given line, taking care of the numerical epsilon
+ BASEGFX_DLLPUBLIC bool isPointOnLine(const B3DPoint& rStart, const B3DPoint& rEnd, const B3DPoint& rCandidate, bool bWithPoints = false);
+
+ // calculates if given point is on given polygon, taking care of the numerical epsilon. Uses
+ // isPointOnLine internally
+ BASEGFX_DLLPUBLIC bool isPointOnPolygon(const B3DPolygon& rCandidate, const B3DPoint& rPoint, bool bWithPoints = true);
+
+ // helper to get a fCut position between a plane (given with normal and a point)
+ // and a line given by start and end point
+ BASEGFX_DLLPUBLIC bool getCutBetweenLineAndPlane(const B3DVector& rPlaneNormal, const B3DPoint& rPlanePoint, const B3DPoint& rEdgeStart, const B3DPoint& rEdgeEnd, double& fCut);
+
+ /** snap some polygon coordinates to discrete coordinates
+
+ This method allows to snap some polygon points to discrete (integer) values
+ which equals e.g. a snap to discrete coordinates. It will snap points of
+ horizontal and vertical edges
+
+ @param rCandidate
+ The source polygon
+
+ @return
+ The modified version of the source polygon
+ */
+ BASEGFX_DLLPUBLIC B3DPolygon snapPointsOfHorizontalOrVerticalEdges(const B3DPolygon& rCandidate);
+
+ } // end of namespace tools
+} // end of namespace basegfx
+
+#endif /* _BGFX_POLYGON_B3DPOLYGONTOOLS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b3dpolypolygon.hxx b/include/basegfx/polygon/b3dpolypolygon.hxx
new file mode 100644
index 000000000000..d67da6ad690b
--- /dev/null
+++ b/include/basegfx/polygon/b3dpolypolygon.hxx
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POLYGON_B3DPOLYPOLYGON_HXX
+#define _BGFX_POLYGON_B3DPOLYPOLYGON_HXX
+
+#include <sal/types.h>
+#include <o3tl/cow_wrapper.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+// predeclarations
+class ImplB3DPolyPolygon;
+
+namespace basegfx
+{
+ class B3DPolygon;
+ class B3DHomMatrix;
+ class B2DHomMatrix;
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ class BASEGFX_DLLPUBLIC B3DPolyPolygon
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImplB3DPolyPolygon > ImplType;
+
+ private:
+ ImplType mpPolyPolygon;
+
+ public:
+ B3DPolyPolygon();
+ B3DPolyPolygon(const B3DPolyPolygon& rPolyPolygon);
+ explicit B3DPolyPolygon(const B3DPolygon& rPolygon);
+ ~B3DPolyPolygon();
+
+ // assignment operator
+ B3DPolyPolygon& operator=(const B3DPolyPolygon& rPolyPolygon);
+
+ // compare operators
+ bool operator==(const B3DPolyPolygon& rPolyPolygon) const;
+ bool operator!=(const B3DPolyPolygon& rPolyPolygon) const;
+
+ // polygon interface
+ sal_uInt32 count() const;
+
+ // B3DPolygon interface
+ B3DPolygon getB3DPolygon(sal_uInt32 nIndex) const;
+ void setB3DPolygon(sal_uInt32 nIndex, const B3DPolygon& rPolygon);
+
+ // BColor interface
+ bool areBColorsUsed() const;
+ void clearBColors();
+
+ // Normals interface
+ void transformNormals(const B3DHomMatrix& rMatrix);
+ bool areNormalsUsed() const;
+ void clearNormals();
+
+ // TextureCoordinate interface
+ void transformTextureCoordiantes(const B2DHomMatrix& rMatrix);
+ bool areTextureCoordinatesUsed() const;
+ void clearTextureCoordinates();
+
+ // append single polygon
+ void append(const B3DPolygon& rPolygon, sal_uInt32 nCount = 1);
+
+ // append multiple polygons
+ void append(const B3DPolyPolygon& rPolyPolygon);
+
+ // remove
+ void remove(sal_uInt32 nIndex, sal_uInt32 nCount = 1);
+
+ // reset to empty state
+ void clear();
+
+ // flip polygon direction
+ void flip();
+
+ // test if PolyPolygon has double points
+ bool hasDoublePoints() const;
+
+ // remove double points, at the begin/end and follow-ups, too
+ void removeDoublePoints();
+
+ // apply transformation given in matrix form to the polygon
+ void transform(const basegfx::B3DHomMatrix& rMatrix);
+
+ // polygon iterators (same iterator validity conditions as for vector)
+ const B3DPolygon* begin() const;
+ const B3DPolygon* end() const;
+ B3DPolygon* begin();
+ B3DPolygon* end();
+ };
+} // end of namespace basegfx
+
+#endif /* _BGFX_POLYGON_B3DPOLYPOLYGON_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b3dpolypolygontools.hxx b/include/basegfx/polygon/b3dpolypolygontools.hxx
new file mode 100644
index 000000000000..a50167f9b4de
--- /dev/null
+++ b/include/basegfx/polygon/b3dpolypolygontools.hxx
@@ -0,0 +1,133 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POLYPOLYGON_B3DPOLYGONTOOLS_HXX
+#define _BGFX_POLYPOLYGON_B3DPOLYGONTOOLS_HXX
+
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <vector>
+#include <basegfx/numeric/ftools.hxx>
+#include <basegfx/point/b3dpoint.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ // predefinitions
+ class B3DPolyPolygon;
+ class B3DRange;
+
+ namespace tools
+ {
+ // B3DPolyPolygon tools
+
+ // get size of PolyPolygon. Control vectors are included in that ranges.
+ BASEGFX_DLLPUBLIC B3DRange getRange(const B3DPolyPolygon& rCandidate);
+
+ /** Create a unit 3D line polyPolygon which defines a cube.
+ */
+ BASEGFX_DLLPUBLIC B3DPolyPolygon createUnitCubePolyPolygon();
+
+ /** Create a unit 3D fill polyPolygon which defines a cube.
+ */
+ BASEGFX_DLLPUBLIC B3DPolyPolygon createUnitCubeFillPolyPolygon();
+
+ /** Create a 3D line polyPolygon from a B3DRange which defines a cube.
+ */
+ BASEGFX_DLLPUBLIC B3DPolyPolygon createCubePolyPolygonFromB3DRange( const B3DRange& rRange);
+
+ /** Create a 3D fill polyPolygon from a B3DRange which defines a cube.
+ */
+ BASEGFX_DLLPUBLIC B3DPolyPolygon createCubeFillPolyPolygonFromB3DRange( const B3DRange& rRange);
+
+ /** Create a unit 3D line polyPolygon which defines a sphere with the given count of hor and ver segments.
+ Result will be centered at (0.0, 0.0, 0.0) and sized [-1.0 .. 1.0] in all dimensions.
+ If nHorSeg == 0 and/or nVerSeg == 0, a default will be calculated to have a step at least each 15 degrees.
+ With VerStart, VerStop and hor range in cartesian may be specified to create a partial sphere only.
+ */
+ BASEGFX_DLLPUBLIC B3DPolyPolygon createUnitSpherePolyPolygon(
+ sal_uInt32 nHorSeg = 0L, sal_uInt32 nVerSeg = 0L,
+ double fVerStart = F_PI2, double fVerStop = -F_PI2,
+ double fHorStart = 0.0, double fHorStop = F_2PI);
+
+ /** Create a 3D line polyPolygon from a B3DRange which defines a sphere with the given count of hor and ver segments.
+ If nHorSeg == 0 and/or nVerSeg == 0, a default will be calculated to have a step at least each 15 degrees.
+ With VerStart, VerStop and hor range in cartesian may be specified to create a partial sphere only.
+ */
+ BASEGFX_DLLPUBLIC B3DPolyPolygon createSpherePolyPolygonFromB3DRange(
+ const B3DRange& rRange,
+ sal_uInt32 nHorSeg = 0L, sal_uInt32 nVerSeg = 0L,
+ double fVerStart = F_PI2, double fVerStop = -F_PI2,
+ double fHorStart = 0.0, double fHorStop = F_2PI);
+
+ /** same as createUnitSpherePolyPolygon, but creates filled polygons (closed and oriented)
+ There is one extra, the bool bNormals defines if normals will be set, default is false
+ */
+ BASEGFX_DLLPUBLIC B3DPolyPolygon createUnitSphereFillPolyPolygon(
+ sal_uInt32 nHorSeg = 0L, sal_uInt32 nVerSeg = 0L,
+ bool bNormals = false,
+ double fVerStart = F_PI2, double fVerStop = -F_PI2,
+ double fHorStart = 0.0, double fHorStop = F_2PI);
+
+ /** same as createSpherePolyPolygonFromB3DRange, but creates filled polygons (closed and oriented)
+ There is one extra, the bool bNormals defines if normals will be set, default is false
+ */
+ BASEGFX_DLLPUBLIC B3DPolyPolygon createSphereFillPolyPolygonFromB3DRange(
+ const B3DRange& rRange,
+ sal_uInt32 nHorSeg = 0L, sal_uInt32 nVerSeg = 0L,
+ bool bNormals = false,
+ double fVerStart = F_PI2, double fVerStop = -F_PI2,
+ double fHorStart = 0.0, double fHorStop = F_2PI);
+
+ /** Create/replace normals for given 3d geometry with default normals from given center to outside.
+ rCandidate: the 3d geometry to change
+ rCenter: the center of the 3d geometry
+ */
+ BASEGFX_DLLPUBLIC B3DPolyPolygon applyDefaultNormalsSphere( const B3DPolyPolygon& rCandidate, const B3DPoint& rCenter);
+
+ /** invert normals for given 3d geometry.
+ */
+ BASEGFX_DLLPUBLIC B3DPolyPolygon invertNormals( const B3DPolyPolygon& rCandidate);
+
+ /** Create/replace texture coordinates for given 3d geometry with parallel projected one
+ rRange: the full range of the 3d geometry
+ If bChangeX, x texture coordinate will be recalculated.
+ If bChangeY, y texture coordinate will be recalculated.
+ */
+ BASEGFX_DLLPUBLIC B3DPolyPolygon applyDefaultTextureCoordinatesParallel( const B3DPolyPolygon& rCandidate, const B3DRange& rRange, bool bChangeX = true, bool bChangeY = true);
+
+ /** Create/replace texture coordinates for given 3d geometry with spherical one
+ rCenter: the centre of the used 3d geometry
+ If bChangeX, x texture coordinate will be recalculated.
+ If bChangeY, y texture coordinate will be recalculated.
+ */
+ BASEGFX_DLLPUBLIC B3DPolyPolygon applyDefaultTextureCoordinatesSphere( const B3DPolyPolygon& rCandidate, const B3DPoint& rCenter, bool bChangeX = true, bool bChangeY = true);
+
+ // isInside test for B3DPoint. On border is not inside as long as not true is given
+ // in bWithBorder flag. It is assumed that the orientations of the given polygon are correct.
+ BASEGFX_DLLPUBLIC bool isInside(const B3DPolyPolygon& rCandidate, const B3DPoint& rPoint, bool bWithBorder = false);
+
+ } // end of namespace tools
+} // end of namespace basegfx
+
+#endif /* _BGFX_POLYPOLYGON_B3DPOLYGONTOOLS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b1drange.hxx b/include/basegfx/range/b1drange.hxx
new file mode 100644
index 000000000000..ffe704a1b845
--- /dev/null
+++ b/include/basegfx/range/b1drange.hxx
@@ -0,0 +1,174 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RANGE_B1DRANGE_HXX
+#define _BGFX_RANGE_B1DRANGE_HXX
+
+#include <basegfx/range/basicrange.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+
+namespace basegfx
+{
+ class B1IRange;
+
+ /** A one-dimensional interval over doubles
+
+ This is a set of real numbers, bounded by a lower and an upper
+ value. All inbetween values are included in the set (see also
+ http://en.wikipedia.org/wiki/Interval_%28mathematics%29).
+
+ The set is closed, i.e. the upper and the lower bound are
+ included (if you're used to the notation - we're talking about
+ [a,b] here, compared to half-open [a,b) or open intervals
+ (a,b)).
+
+ That means, isInside(val) will return true also for values of
+ val=a or val=b.
+ */
+ class B1DRange
+ {
+ ::basegfx::BasicRange< double, DoubleTraits > maRange;
+
+ public:
+ B1DRange() {}
+
+ /// Create degenerate interval consisting of a single double number
+ explicit B1DRange(double fStartValue)
+ : maRange(fStartValue)
+ {
+ }
+
+ /// Create proper interval between the two given double values
+ B1DRange(double fStartValue1, double fStartValue2)
+ : maRange(fStartValue1)
+ {
+ expand(fStartValue2);
+ }
+
+ /** Check if the interval set is empty
+
+ @return false, if no value is in this set - having a
+ single value included will already return true.
+ */
+ bool isEmpty() const
+ {
+ return maRange.isEmpty();
+ }
+
+ /// reset the object to empty state again, clearing all values
+ void reset()
+ {
+ maRange.reset();
+ }
+
+ bool operator==( const B1DRange& rRange ) const
+ {
+ return (maRange == rRange.maRange);
+ }
+
+ bool operator!=( const B1DRange& rRange ) const
+ {
+ return (maRange != rRange.maRange);
+ }
+
+ bool equal(const B1DRange& rRange) const
+ {
+ return (maRange.equal(rRange.maRange));
+ }
+
+ /// get lower bound of the set. returns arbitrary values for empty sets.
+ double getMinimum() const
+ {
+ return maRange.getMinimum();
+ }
+
+ /// get upper bound of the set. returns arbitrary values for empty sets.
+ double getMaximum() const
+ {
+ return maRange.getMaximum();
+ }
+
+ /// return difference between upper and lower value. returns 0 for empty sets.
+ double getRange() const
+ {
+ return maRange.getRange();
+ }
+
+ /// return middle of upper and lower value. returns 0 for empty sets.
+ double getCenter() const
+ {
+ return maRange.getCenter();
+ }
+
+ /// yields true if value is contained in set
+ bool isInside(double fValue) const
+ {
+ return maRange.isInside(fValue);
+ }
+
+ /// yields true if rRange is inside, or equal to set
+ bool isInside(const B1DRange& rRange) const
+ {
+ return maRange.isInside(rRange.maRange);
+ }
+
+ /// yields true if rRange at least partly inside set
+ bool overlaps(const B1DRange& rRange) const
+ {
+ return maRange.overlaps(rRange.maRange);
+ }
+
+ /// yields true if overlaps(rRange) does, and the overlap is larger than infinitesimal
+ bool overlapsMore(const B1DRange& rRange) const
+ {
+ return maRange.overlapsMore(rRange.maRange);
+ }
+
+ /// add fValue to the set, expanding as necessary
+ void expand(double fValue)
+ {
+ maRange.expand(fValue);
+ }
+
+ /// add rRange to the set, expanding as necessary
+ void expand(const B1DRange& rRange)
+ {
+ maRange.expand(rRange.maRange);
+ }
+
+ /// calc set intersection
+ void intersect(const B1DRange& rRange)
+ {
+ maRange.intersect(rRange.maRange);
+ }
+
+ /// grow set by fValue on both sides
+ void grow(double fValue)
+ {
+ maRange.grow(fValue);
+ }
+ };
+
+} // end of namespace basegfx
+
+
+#endif /* _BGFX_RANGE_B1DRANGE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b1ibox.hxx b/include/basegfx/range/b1ibox.hxx
new file mode 100644
index 000000000000..7c81e37c1288
--- /dev/null
+++ b/include/basegfx/range/b1ibox.hxx
@@ -0,0 +1,164 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RANGE_B1IBOX_HXX
+#define _BGFX_RANGE_B1IBOX_HXX
+
+#include <basegfx/range/basicbox.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+
+namespace basegfx
+{
+ /** A one-dimensional interval over integers
+
+ This is most easily depicted as a set of integers, bounded by
+ a lower and an upper value - but excluding the upper
+ value. All inbetween values are included in the set (see also
+ http://en.wikipedia.org/wiki/Interval_%28mathematics%29).
+
+ The set is half-open, i.e. the lower bound is included, the
+ upper bound not (if you're used to the notation - we're
+ talking about [a,b) here, compared to closed [a,b] or fully
+ open intervals (a,b)).
+
+ If you don't need a half-open interval, check B1IRange.
+
+ That means, isInside(val) will return true also for values of
+ val=a, but not for val=b.
+
+ @see B1IRange
+ */
+ class B1IBox
+ {
+ ::basegfx::BasicBox maRange;
+
+ public:
+ B1IBox() {}
+
+ /// Create degenerate interval that's still empty
+ explicit B1IBox(sal_Int32 nStartValue)
+ : maRange(nStartValue)
+ {
+ }
+
+ /// Create proper interval between the two given values
+ B1IBox(sal_Int32 nStartValue1, sal_Int32 nStartValue2)
+ : maRange(nStartValue1)
+ {
+ expand(nStartValue2);
+ }
+
+ /** Check if the interval set is empty
+
+ @return false, if no value is in this set - having a
+ single value included will still return false.
+ */
+ bool isEmpty() const
+ {
+ return maRange.isEmpty();
+ }
+
+ /// reset the object to empty state again, clearing all values
+ void reset()
+ {
+ maRange.reset();
+ }
+
+ bool operator==( const B1IBox& rBox ) const
+ {
+ return (maRange == rBox.maRange);
+ }
+
+ bool operator!=( const B1IBox& rBox ) const
+ {
+ return (maRange != rBox.maRange);
+ }
+
+ /// get lower bound of the set. returns arbitrary values for empty sets.
+ sal_Int32 getMinimum() const
+ {
+ return maRange.getMinimum();
+ }
+
+ /// get upper bound of the set. returns arbitrary values for empty sets.
+ sal_Int32 getMaximum() const
+ {
+ return maRange.getMaximum();
+ }
+
+ /// return difference between upper and lower value. returns 0 for empty sets.
+ Int32Traits::DifferenceType getRange() const
+ {
+ return maRange.getRange();
+ }
+
+ /// return middle of upper and lower value. returns 0 for empty sets.
+ double getCenter() const
+ {
+ return maRange.getCenter();
+ }
+
+ /// yields true if value is contained in set
+ bool isInside(sal_Int32 nValue) const
+ {
+ return maRange.isInside(nValue);
+ }
+
+ /// yields true if rRange is inside, or equal to set
+ bool isInside(const B1IBox& rBox) const
+ {
+ return maRange.isInside(rBox.maRange);
+ }
+
+ /// yields true if rRange at least partly inside set
+ bool overlaps(const B1IBox& rBox) const
+ {
+ return maRange.overlaps(rBox.maRange);
+ }
+
+ /// add nValue to the set, expanding as necessary
+ void expand(sal_Int32 nValue)
+ {
+ maRange.expand(nValue);
+ }
+
+ /// add rBox to the set, expanding as necessary
+ void expand(const B1IBox& rBox)
+ {
+ maRange.expand(rBox.maRange);
+ }
+
+ /// calc set intersection
+ void intersect(const B1IBox& rBox)
+ {
+ maRange.intersect(rBox.maRange);
+ }
+
+ /// grow set by nValue on both sides
+ void grow(sal_Int32 nValue)
+ {
+ maRange.grow(nValue);
+ }
+ };
+} // end of namespace basegfx
+
+#endif /* _BGFX_RANGE_B1IBOX_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b1irange.hxx b/include/basegfx/range/b1irange.hxx
new file mode 100644
index 000000000000..0ba5878fb0c8
--- /dev/null
+++ b/include/basegfx/range/b1irange.hxx
@@ -0,0 +1,169 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RANGE_B1IRANGE_HXX
+#define _BGFX_RANGE_B1IRANGE_HXX
+
+#include <basegfx/range/basicrange.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+
+namespace basegfx
+{
+ /** A one-dimensional interval over integers
+
+ This is a set of real numbers, bounded by a lower and an upper
+ value. All inbetween values are included in the set (see also
+ http://en.wikipedia.org/wiki/Interval_%28mathematics%29).
+
+ Probably you rather want B1IBox for integers.
+
+ The set is closed, i.e. the upper and the lower bound are
+ included (if you're used to the notation - we're talking about
+ [a,b] here, compared to half-open [a,b) or open intervals
+ (a,b)).
+
+ That means, isInside(val) will return true also for values of
+ val=a or val=b.
+
+ @see B1IBox
+ */
+ class B1IRange
+ {
+ ::basegfx::BasicRange< sal_Int32, Int32Traits > maRange;
+
+ public:
+ B1IRange() {}
+
+ /// Create degenerate interval consisting of a single double number
+ explicit B1IRange(sal_Int32 nStartValue)
+ : maRange(nStartValue)
+ {
+ }
+
+ /// Create proper interval between the two given values
+ B1IRange(sal_Int32 nStartValue1, sal_Int32 nStartValue2)
+ : maRange(nStartValue1)
+ {
+ expand(nStartValue2);
+ }
+
+ /** Check if the interval set is empty
+
+ @return false, if no value is in this set - having a
+ single value included will already return true.
+ */
+ bool isEmpty() const
+ {
+ return maRange.isEmpty();
+ }
+
+ /// reset the object to empty state again, clearing all values
+ void reset()
+ {
+ maRange.reset();
+ }
+
+ bool operator==( const B1IRange& rRange ) const
+ {
+ return (maRange == rRange.maRange);
+ }
+
+ bool operator!=( const B1IRange& rRange ) const
+ {
+ return (maRange != rRange.maRange);
+ }
+
+ /// get lower bound of the set. returns arbitrary values for empty sets.
+ sal_Int32 getMinimum() const
+ {
+ return maRange.getMinimum();
+ }
+
+ /// get upper bound of the set. returns arbitrary values for empty sets.
+ sal_Int32 getMaximum() const
+ {
+ return maRange.getMaximum();
+ }
+
+ /// return difference between upper and lower value. returns 0 for empty sets.
+ Int32Traits::DifferenceType getRange() const
+ {
+ return maRange.getRange();
+ }
+
+ /// return middle of upper and lower value. returns 0 for empty sets.
+ double getCenter() const
+ {
+ return maRange.getCenter();
+ }
+
+ /// yields true if value is contained in set
+ bool isInside(sal_Int32 nValue) const
+ {
+ return maRange.isInside(nValue);
+ }
+
+ /// yields true if rRange is inside, or equal to set
+ bool isInside(const B1IRange& rRange) const
+ {
+ return maRange.isInside(rRange.maRange);
+ }
+
+ /// yields true if rRange at least partly inside set
+ bool overlaps(const B1IRange& rRange) const
+ {
+ return maRange.overlaps(rRange.maRange);
+ }
+
+ /// yields true if overlaps(rRange) does, and the overlap is larger than infinitesimal
+ bool overlapsMore(const B1IRange& rRange) const
+ {
+ return maRange.overlapsMore(rRange.maRange);
+ }
+
+ /// add nValue to the set, expanding as necessary
+ void expand(sal_Int32 nValue)
+ {
+ maRange.expand(nValue);
+ }
+
+ /// add rRange to the set, expanding as necessary
+ void expand(const B1IRange& rRange)
+ {
+ maRange.expand(rRange.maRange);
+ }
+
+ /// calc set intersection
+ void intersect(const B1IRange& rRange)
+ {
+ maRange.intersect(rRange.maRange);
+ }
+
+ /// grow set by nValue on both sides
+ void grow(sal_Int32 nValue)
+ {
+ maRange.grow(nValue);
+ }
+ };
+} // end of namespace basegfx
+
+#endif /* _BGFX_RANGE_B1IRANGE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b2dconnectedranges.hxx b/include/basegfx/range/b2dconnectedranges.hxx
new file mode 100644
index 000000000000..f1d65196bd8f
--- /dev/null
+++ b/include/basegfx/range/b2dconnectedranges.hxx
@@ -0,0 +1,257 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RANGE_B2DCONNECTEDRANGES_HXX
+#define _BGFX_RANGE_B2DCONNECTEDRANGES_HXX
+
+#include <osl/diagnose.h>
+#include <basegfx/range/b2drange.hxx>
+#include <list>
+#include <utility>
+#include <algorithm>
+
+
+namespace basegfx
+{
+ /** Calculate connected ranges from input ranges.
+
+ This template constructs a list of connected ranges from the
+ given input ranges. That is, the output will contain a set of
+ ranges, itself containing a number of input ranges, which will
+ be mutually non-intersecting.
+
+ Example:
+ <code>
+ -------------------
+ | -------|
+ | | ||
+ | --- | ||
+ | | | -------| --------
+ | | +--------- | | |
+ | --+ | | | |
+ | | | | --------
+ | ---------- |
+ -------------------
+ </code
+
+ Here, the outer rectangles represent the output
+ ranges. Contained are the input rectangles that comprise these
+ output ranges.
+
+ @tpl UserData
+ User data to be stored along with the range, to later identify
+ which range went into which connected component. Must be
+ assignable, default- and copy-constructible.
+ */
+ template< typename UserData > class B2DConnectedRanges
+ {
+ public:
+ /// Type of the basic entity (rect + user data)
+ typedef ::std::pair< B2DRange, UserData > ComponentType;
+ typedef ::std::list< ComponentType > ComponentListType;
+
+ /// List of (intersecting) components, plus overall bounds
+ struct ConnectedComponents
+ {
+ ComponentListType maComponentList;
+ B2DRange maTotalBounds;
+ };
+
+ typedef ::std::list< ConnectedComponents > ConnectedComponentsType;
+
+
+ /// Create the range calculator
+ B2DConnectedRanges() :
+ maDisjunctAggregatesList(),
+ maTotalBounds()
+ {
+ }
+
+ /** Query total bounds of all added ranges.
+
+ @return the union bound rect over all added ranges.
+ */
+ B2DRange getBounds() const
+ {
+ return maTotalBounds;
+ }
+
+ /** Add an additional range.
+
+ This method integrates a new range into the connected
+ ranges lists. The method has a worst-case time complexity
+ of O(n^2), with n denoting the number of already added
+ ranges (typically, for well-behaved input, it is O(n)
+ though).
+ */
+ void addRange( const B2DRange& rRange,
+ const UserData& rUserData )
+ {
+ // check whether fast path is possible: if new range is
+ // outside accumulated total range, can add it as a
+ // separate component right away.
+ const bool bNotOutsideEverything(
+ maTotalBounds.overlaps( rRange ) );
+
+ // update own global bounds range
+ maTotalBounds.expand( rRange );
+
+ // assemble anything intersecting with rRange into
+ // this new connected component
+ ConnectedComponents aNewConnectedComponent;
+
+ // as at least rRange will be a member of
+ // aNewConnectedComponent (will be added below), can
+ // preset the overall bounds here.
+ aNewConnectedComponent.maTotalBounds = rRange;
+
+
+ //
+ // STAGE 1: Search for intersecting maDisjunctAggregatesList entries
+ // =================================================================
+ //
+
+ // if rRange is empty, it will intersect with no
+ // maDisjunctAggregatesList member. Thus, we can safe us
+ // the check.
+ // if rRange is outside all other rectangle, skip here,
+ // too
+ if( bNotOutsideEverything &&
+ !rRange.isEmpty() )
+ {
+ typename ConnectedComponentsType::iterator aCurrAggregate;
+ typename ConnectedComponentsType::iterator aLastAggregate;
+
+ // flag, determining whether we touched one or more of
+ // the maDisjunctAggregatesList entries. _If_ we did,
+ // we have to repeat the intersection process, because
+ // these changes might have generated new
+ // intersections.
+ bool bSomeAggregatesChanged;
+
+ // loop, until bSomeAggregatesChanged stays false
+ do
+ {
+ // only continue loop if 'intersects' branch below was hit
+ bSomeAggregatesChanged = false;
+
+ // iterate over all current members of maDisjunctAggregatesList
+ for( aCurrAggregate=maDisjunctAggregatesList.begin(),
+ aLastAggregate=maDisjunctAggregatesList.end();
+ aCurrAggregate != aLastAggregate; )
+ {
+ // first check if current component's bounds
+ // are empty. This ensures that distinct empty
+ // components are not merged into one
+ // aggregate. As a matter of fact, they have
+ // no position and size.
+
+ if( !aCurrAggregate->maTotalBounds.isEmpty() &&
+ aCurrAggregate->maTotalBounds.overlaps(
+ aNewConnectedComponent.maTotalBounds ) )
+ {
+ // union the intersecting
+ // maDisjunctAggregatesList element into
+ // aNewConnectedComponent
+
+ // calc union bounding box
+ aNewConnectedComponent.maTotalBounds.expand( aCurrAggregate->maTotalBounds );
+
+ // extract all aCurrAggregate components
+ // to aNewConnectedComponent
+ aNewConnectedComponent.maComponentList.splice(
+ aNewConnectedComponent.maComponentList.end(),
+ aCurrAggregate->maComponentList );
+
+ // remove and delete aCurrAggregate entry
+ // from list (we've gutted it's content
+ // above). list::erase() will update our
+ // iterator with the predecessor here.
+ aCurrAggregate = maDisjunctAggregatesList.erase( aCurrAggregate );
+
+ // at least one aggregate changed, need to rescan everything
+ bSomeAggregatesChanged = true;
+ }
+ else
+ {
+ aCurrAggregate++;
+ }
+ }
+ }
+ while( bSomeAggregatesChanged );
+ }
+
+ //
+ // STAGE 2: Add newly generated connected component list element
+ // =============================================================
+ //
+
+ // add new component to the end of the component list
+ aNewConnectedComponent.maComponentList.push_back(
+ ComponentType( rRange, rUserData ) );
+
+ // do some consistency checks (aka post conditions)
+ OSL_ENSURE( !aNewConnectedComponent.maComponentList.empty(),
+ "B2DConnectedRanges::addRange(): empty aggregate list" );
+ OSL_ENSURE( !aNewConnectedComponent.maTotalBounds.isEmpty() ||
+ (aNewConnectedComponent.maTotalBounds.isEmpty() &&
+ aNewConnectedComponent.maComponentList.size() == 1),
+ "B2DConnectedRanges::addRange(): empty ranges must be solitary");
+
+ // add aNewConnectedComponent as a new entry to
+ // maDisjunctAggregatesList
+ maDisjunctAggregatesList.push_back( aNewConnectedComponent );
+ }
+
+ /** Apply a functor to each of the disjunct component
+ aggregates.
+
+ @param aFunctor
+ Functor to apply. Must provide an operator( const ConnectedComponents& ).
+
+ @return a copy of the functor, as applied to all aggregates.
+ */
+ template< typename UnaryFunctor > UnaryFunctor forEachAggregate( UnaryFunctor aFunctor ) const
+ {
+ return ::std::for_each( maDisjunctAggregatesList.begin(),
+ maDisjunctAggregatesList.end(),
+ aFunctor );
+ }
+
+ private:
+ // default: disabled copy/assignment
+ B2DConnectedRanges(const B2DConnectedRanges&);
+ B2DConnectedRanges& operator=( const B2DConnectedRanges& );
+
+ /** Current list of disjunct sets of connected components
+
+ Each entry corresponds to one of the top-level rectangles
+ in the drawing above.
+ */
+ ConnectedComponentsType maDisjunctAggregatesList;
+
+ /** Global bound rect over all added ranges.
+ */
+ B2DRange maTotalBounds;
+ };
+}
+
+#endif /* _BGFX_RANGE_B2DCONNECTEDRANGES_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b2dpolyrange.hxx b/include/basegfx/range/b2dpolyrange.hxx
new file mode 100644
index 000000000000..b910062d11a3
--- /dev/null
+++ b/include/basegfx/range/b2dpolyrange.hxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RANGE_B2DPOLYRANGE_HXX
+#define _BGFX_RANGE_B2DPOLYRANGE_HXX
+
+#include <o3tl/cow_wrapper.hxx>
+#include <boost/tuple/tuple.hpp>
+#include <basegfx/vector/b2enums.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ class B2DTuple;
+ class B2DRange;
+ class B2DPolyPolygon;
+ class ImplB2DPolyRange;
+
+ /** Multiple ranges in one object.
+
+ This class combines multiple ranges in one object, providing a
+ total, enclosing range for it.
+
+ You can use this class e.g. when updating views containing
+ rectangular objects. Add each modified object to a
+ B2DMultiRange, then test each viewable object against
+ intersection with the multi range.
+
+ Similar in spirit to the poly-polygon vs. polygon relationship.
+
+ Note that comparable to polygons, a poly-range can also
+ contain 'holes' - this is encoded via polygon orientation at
+ the poly-polygon, and via explicit flags for the poly-range.
+ */
+ class BASEGFX_DLLPUBLIC B2DPolyRange
+ {
+ public:
+ typedef boost::tuple<B2DRange,B2VectorOrientation> ElementType ;
+
+ B2DPolyRange();
+ ~B2DPolyRange();
+
+ /** Create a multi range with exactly one containing range
+ */
+ B2DPolyRange( const B2DPolyRange& );
+ B2DPolyRange& operator=( const B2DPolyRange& );
+
+ bool operator==(const B2DPolyRange&) const;
+ bool operator!=(const B2DPolyRange&) const;
+
+ /// Number of included ranges
+ sal_uInt32 count() const;
+
+ ElementType getElement(sal_uInt32 nIndex) const;
+
+ // insert/append a single range
+ void appendElement(const B2DRange& rRange, B2VectorOrientation eOrient, sal_uInt32 nCount = 1);
+
+ void clear();
+
+ /** Test whether given range overlaps one or more of the
+ included ranges. Does *not* use overall range, but checks
+ individually.
+ */
+ bool overlaps( const B2DRange& rRange ) const;
+
+ /** Request a poly-polygon with solved cross-overs
+ */
+ B2DPolyPolygon solveCrossovers() const;
+
+ private:
+ o3tl::cow_wrapper< ImplB2DPolyRange > mpImpl;
+ };
+}
+
+#endif /* _BGFX_RANGE_B2DPOLYRANGE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b2drange.hxx b/include/basegfx/range/b2drange.hxx
new file mode 100644
index 000000000000..1f3884c1c9ce
--- /dev/null
+++ b/include/basegfx/range/b2drange.hxx
@@ -0,0 +1,320 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RANGE_B2DRANGE_HXX
+#define _BGFX_RANGE_B2DRANGE_HXX
+
+#include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/tuple/b2dtuple.hxx>
+#include <basegfx/range/basicrange.hxx>
+#include <vector>
+#include <basegfx/basegfxdllapi.h>
+
+
+namespace basegfx
+{
+ // predeclarations
+ class B2IRange;
+ class B2DHomMatrix;
+
+ /** A two-dimensional interval over doubles
+
+ This is a set of real numbers, bounded by a lower and an upper
+ pair. All inbetween values are included in the set (see also
+ http://en.wikipedia.org/wiki/Interval_%28mathematics%29).
+
+ The set is closed, i.e. the upper and the lower bound are
+ included (if you're used to the notation - we're talking about
+ [a,b] here, compared to half-open [a,b) or open intervals
+ (a,b)).
+
+ That means, isInside(val) will return true also for values of
+ val=a or val=b.
+
+ @see B1DRange
+ */
+ class B2DRange
+ {
+ public:
+ typedef double ValueType;
+ typedef DoubleTraits TraitsType;
+
+ B2DRange() {}
+
+ /// Create degenerate interval consisting of a single point
+ explicit B2DRange(const B2DTuple& rTuple)
+ : maRangeX(rTuple.getX()),
+ maRangeY(rTuple.getY())
+ {
+ }
+
+ /// Create proper interval between the two given double pairs
+ B2DRange(double x1,
+ double y1,
+ double x2,
+ double y2)
+ : maRangeX(x1),
+ maRangeY(y1)
+ {
+ maRangeX.expand(x2);
+ maRangeY.expand(y2);
+ }
+
+ /// Create proper interval between the two given points
+ B2DRange(const B2DTuple& rTuple1,
+ const B2DTuple& rTuple2)
+ : maRangeX(rTuple1.getX()),
+ maRangeY(rTuple1.getY())
+ {
+ expand( rTuple2 );
+ }
+
+ BASEGFX_DLLPUBLIC explicit B2DRange(const B2IRange& rRange);
+
+ /** Check if the interval set is empty
+
+ @return false, if no value is in this set - having a
+ single point included will already return true.
+ */
+ bool isEmpty() const
+ {
+ return (
+ maRangeX.isEmpty()
+ || maRangeY.isEmpty()
+ );
+ }
+
+ /// reset the object to empty state again, clearing all values
+ void reset()
+ {
+ maRangeX.reset();
+ maRangeY.reset();
+ }
+
+ bool operator==( const B2DRange& rRange ) const
+ {
+ return (maRangeX == rRange.maRangeX
+ && maRangeY == rRange.maRangeY);
+ }
+
+ bool operator!=( const B2DRange& rRange ) const
+ {
+ return (maRangeX != rRange.maRangeX
+ || maRangeY != rRange.maRangeY);
+ }
+
+ bool equal(const B2DRange& rRange) const
+ {
+ return (maRangeX.equal(rRange.maRangeX)
+ && maRangeY.equal(rRange.maRangeY));
+ }
+
+ /// get lower bound of the set. returns arbitrary values for empty sets.
+ double getMinX() const
+ {
+ return maRangeX.getMinimum();
+ }
+
+ /// get lower bound of the set. returns arbitrary values for empty sets.
+ double getMinY() const
+ {
+ return maRangeY.getMinimum();
+ }
+
+ /// get upper bound of the set. returns arbitrary values for empty sets.
+ double getMaxX() const
+ {
+ return maRangeX.getMaximum();
+ }
+
+ /// get upper bound of the set. returns arbitrary values for empty sets.
+ double getMaxY() const
+ {
+ return maRangeY.getMaximum();
+ }
+
+ /// return difference between upper and lower X value. returns 0 for empty sets.
+ double getWidth() const
+ {
+ return maRangeX.getRange();
+ }
+
+ /// return difference between upper and lower Y value. returns 0 for empty sets.
+ double getHeight() const
+ {
+ return maRangeY.getRange();
+ }
+
+ /// get lower bound of the set. returns arbitrary values for empty sets.
+ B2DPoint getMinimum() const
+ {
+ return B2DPoint(
+ maRangeX.getMinimum(),
+ maRangeY.getMinimum()
+ );
+ }
+
+ /// get upper bound of the set. returns arbitrary values for empty sets.
+ B2DPoint getMaximum() const
+ {
+ return B2DPoint(
+ maRangeX.getMaximum(),
+ maRangeY.getMaximum()
+ );
+ }
+
+ /// return difference between upper and lower point. returns (0,0) for empty sets.
+ B2DVector getRange() const
+ {
+ return B2DVector(
+ maRangeX.getRange(),
+ maRangeY.getRange()
+ );
+ }
+
+ /// return center point of set. returns (0,0) for empty sets.
+ B2DPoint getCenter() const
+ {
+ return B2DPoint(
+ maRangeX.getCenter(),
+ maRangeY.getCenter()
+ );
+ }
+
+ /// return center X value of set. returns 0 for empty sets.
+ double getCenterX() const
+ {
+ return maRangeX.getCenter();
+ }
+
+ /// return center Y value of set. returns 0 for empty sets.
+ double getCenterY() const
+ {
+ return maRangeY.getCenter();
+ }
+
+ /// yields true if given point is contained in set
+ bool isInside(const B2DTuple& rTuple) const
+ {
+ return (
+ maRangeX.isInside(rTuple.getX())
+ && maRangeY.isInside(rTuple.getY())
+ );
+ }
+
+ /// yields true if rRange is inside, or equal to set
+ bool isInside(const B2DRange& rRange) const
+ {
+ return (
+ maRangeX.isInside(rRange.maRangeX)
+ && maRangeY.isInside(rRange.maRangeY)
+ );
+ }
+
+ /// yields true if rRange at least partly inside set
+ bool overlaps(const B2DRange& rRange) const
+ {
+ return (
+ maRangeX.overlaps(rRange.maRangeX)
+ && maRangeY.overlaps(rRange.maRangeY)
+ );
+ }
+
+ /// yields true if overlaps(rRange) does, and the overlap is larger than infinitesimal
+ bool overlapsMore(const B2DRange& rRange) const
+ {
+ return (
+ maRangeX.overlapsMore(rRange.maRangeX)
+ && maRangeY.overlapsMore(rRange.maRangeY)
+ );
+ }
+
+ /// add point to the set, expanding as necessary
+ void expand(const B2DTuple& rTuple)
+ {
+ maRangeX.expand(rTuple.getX());
+ maRangeY.expand(rTuple.getY());
+ }
+
+ /// add rRange to the set, expanding as necessary
+ void expand(const B2DRange& rRange)
+ {
+ maRangeX.expand(rRange.maRangeX);
+ maRangeY.expand(rRange.maRangeY);
+ }
+
+ /// calc set intersection
+ void intersect(const B2DRange& rRange)
+ {
+ maRangeX.intersect(rRange.maRangeX);
+ maRangeY.intersect(rRange.maRangeY);
+ }
+
+ /// grow set by fValue on all sides
+ void grow(double fValue)
+ {
+ maRangeX.grow(fValue);
+ maRangeY.grow(fValue);
+ }
+
+ BASEGFX_DLLPUBLIC void transform(const B2DHomMatrix& rMatrix);
+
+ private:
+ typedef ::basegfx::BasicRange< ValueType, TraitsType > MyBasicRange;
+
+ MyBasicRange maRangeX;
+ MyBasicRange maRangeY;
+ };
+
+ /** Round double to nearest integer for 2D range
+
+ @return the nearest integer for this range
+ */
+ BASEGFX_DLLPUBLIC B2IRange fround(const B2DRange& rRange);
+
+ /** Compute the set difference of the two given ranges
+
+ This method calculates the symmetric difference (aka XOR)
+ between the two given ranges, and returning the resulting
+ ranges. Thus, the result will contain all areas where one, but
+ not both ranges lie.
+
+ @param o_rResult
+ Result vector. The up to four difference ranges are returned
+ within this vector
+
+ @param rFirst
+ The first range
+
+ @param rSecond
+ The second range
+
+ @return the input vector
+ */
+ BASEGFX_DLLPUBLIC ::std::vector< B2DRange >& computeSetDifference( ::std::vector< B2DRange >& o_rResult,
+ const B2DRange& rFirst,
+ const B2DRange& rSecond );
+
+} // end of namespace basegfx
+
+
+#endif /* _BGFX_RANGE_B2DRANGE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b2drangeclipper.hxx b/include/basegfx/range/b2drangeclipper.hxx
new file mode 100644
index 000000000000..99bc8763369d
--- /dev/null
+++ b/include/basegfx/range/b2drangeclipper.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RANGE_B2DRANGECLIPPER_HXX
+#define _BGFX_RANGE_B2DRANGECLIPPER_HXX
+
+#include <basegfx/range/b2dpolyrange.hxx>
+#include <vector>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ namespace tools
+ {
+ /** Extract poly-polygon w/o self-intersections from poly-range
+
+ Similar to the solveCrossovers(const B2DPolyPolygon&)
+ method, this one calculates a self-intersection-free
+ poly-polygon with the same topology, and encoding
+ inside/outsidedness via polygon orientation and layering.
+ */
+ BASEGFX_DLLPUBLIC B2DPolyPolygon solveCrossovers(const std::vector<B2DRange>& rRanges,
+ const std::vector<B2VectorOrientation>& rOrientations);
+ }
+}
+
+#endif /* _BGFX_RANGE_B2DRANGECLIPPER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b2drectangle.hxx b/include/basegfx/range/b2drectangle.hxx
new file mode 100644
index 000000000000..8d4715d64410
--- /dev/null
+++ b/include/basegfx/range/b2drectangle.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RANGE_B2DRECTANGLE_HXX
+#define _BGFX_RANGE_B2DRECTANGLE_HXX
+
+#include <basegfx/range/b2drange.hxx>
+
+namespace basegfx
+{
+ // syntactic sugar: a B2DRange exactly models a Rectangle, thus,
+ // for interface clarity, we provide an alias name
+
+ /// Alias name for interface clarity (not everybody is aware of the identity)
+ typedef B2DRange B2DRectangle;
+}
+
+#endif /* _BGFX_RANGE_B2DRECTANGLE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b2ibox.hxx b/include/basegfx/range/b2ibox.hxx
new file mode 100644
index 000000000000..7c182a4ab327
--- /dev/null
+++ b/include/basegfx/range/b2ibox.hxx
@@ -0,0 +1,261 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RANGE_B2IBOX_HXX
+#define _BGFX_RANGE_B2IBOX_HXX
+
+#include <basegfx/point/b2ipoint.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/tuple/b2ituple.hxx>
+#include <basegfx/tuple/b2i64tuple.hxx>
+#include <basegfx/range/basicbox.hxx>
+#include <vector>
+#include <basegfx/basegfxdllapi.h>
+
+
+namespace basegfx
+{
+ /** A two-dimensional interval over integers
+
+ This is most easily depicted as a set of integers, bounded by
+ a lower and an upper value - but excluding the upper
+ value. All inbetween values are included in the set (see also
+ http://en.wikipedia.org/wiki/Interval_%28mathematics%29).
+
+ The set is half-open, i.e. the lower bound is included, the
+ upper bound not (if you're used to the notation - we're
+ talking about [a,b) here, compared to closed [a,b] or fully
+ open intervals (a,b)).
+
+ If you don't need a half-open interval, check B2IRange.
+
+ That means, isInside(val) will return true also for values of
+ val=a, but not for val=b.
+
+ Alternatively, consider this a rectangle, where the rightmost
+ pixel column and the bottommost pixel row are excluded - this
+ is much like polygon filling. As a result, filling a given
+ rectangle with basebmp::BitmapDevice::fillPolyPolygon(), will
+ affect exactly the same set of pixel as isInside() would
+ return true for.
+
+ @see B2IRange
+ */
+ class B2IBox
+ {
+ public:
+ typedef sal_Int32 ValueType;
+ typedef Int32Traits TraitsType;
+
+ B2IBox() {}
+
+ /// Create degenerate interval that's still empty
+ explicit B2IBox(const B2ITuple& rTuple)
+ : maRangeX(rTuple.getX()),
+ maRangeY(rTuple.getY())
+ {
+ }
+
+ /// Create proper interval between the two given points
+ B2IBox(sal_Int32 x1,
+ sal_Int32 y1,
+ sal_Int32 x2,
+ sal_Int32 y2) :
+ maRangeX(x1),
+ maRangeY(y1)
+ {
+ maRangeX.expand(x2);
+ maRangeY.expand(y2);
+ }
+
+ /// Create proper interval between the two given points
+ B2IBox(const B2ITuple& rTuple1,
+ const B2ITuple& rTuple2) :
+ maRangeX(rTuple1.getX()),
+ maRangeY(rTuple1.getY())
+ {
+ expand( rTuple2 );
+ }
+
+ /** Check if the interval set is empty
+
+ @return false, if no value is in this set - having a
+ single value included will still return false.
+ */
+ bool isEmpty() const
+ {
+ return maRangeX.isEmpty() || maRangeY.isEmpty();
+ }
+
+ /// reset the object to empty state again, clearing all values
+ void reset()
+ {
+ maRangeX.reset();
+ maRangeY.reset();
+ }
+
+ bool operator==( const B2IBox& rBox ) const
+ {
+ return (maRangeX == rBox.maRangeX
+ && maRangeY == rBox.maRangeY);
+ }
+
+ bool operator!=( const B2IBox& rBox ) const
+ {
+ return (maRangeX != rBox.maRangeX
+ || maRangeY != rBox.maRangeY);
+ }
+
+ /// get lower bound of the set. returns arbitrary values for empty sets.
+ sal_Int32 getMinX() const
+ {
+ return maRangeX.getMinimum();
+ }
+
+ /// get lower bound of the set. returns arbitrary values for empty sets.
+ sal_Int32 getMinY() const
+ {
+ return maRangeY.getMinimum();
+ }
+
+ /// get upper bound of the set. returns arbitrary values for empty sets.
+ sal_Int32 getMaxX() const
+ {
+ return maRangeX.getMaximum();
+ }
+
+ /// get upper bound of the set. returns arbitrary values for empty sets.
+ sal_Int32 getMaxY() const
+ {
+ return maRangeY.getMaximum();
+ }
+
+ /// return difference between upper and lower X value. returns 0 for empty sets.
+ sal_Int64 getWidth() const
+ {
+ return maRangeX.getRange();
+ }
+
+ /// return difference between upper and lower Y value. returns 0 for empty sets.
+ sal_Int64 getHeight() const
+ {
+ return maRangeY.getRange();
+ }
+
+ /// get lower bound of the set. returns arbitrary values for empty sets.
+ B2IPoint getMinimum() const
+ {
+ return B2IPoint(
+ maRangeX.getMinimum(),
+ maRangeY.getMinimum()
+ );
+ }
+
+ /// get upper bound of the set. returns arbitrary values for empty sets.
+ B2IPoint getMaximum() const
+ {
+ return B2IPoint(
+ maRangeX.getMaximum(),
+ maRangeY.getMaximum()
+ );
+ }
+
+ /// return difference between upper and lower value. returns (0,0) for empty sets.
+ B2I64Tuple getRange() const
+ {
+ return B2I64Tuple(
+ maRangeX.getRange(),
+ maRangeY.getRange()
+ );
+ }
+
+ /// return center point of set. returns (0,0) for empty sets.
+ B2DPoint getCenter() const
+ {
+ return B2DPoint(
+ maRangeX.getCenter(),
+ maRangeY.getCenter()
+ );
+ }
+
+ /// yields true if point is contained in set
+ bool isInside(const B2ITuple& rTuple) const
+ {
+ return (
+ maRangeX.isInside(rTuple.getX())
+ && maRangeY.isInside(rTuple.getY())
+ );
+ }
+
+ /// yields true if rBox is inside, or equal to set
+ bool isInside(const B2IBox& rBox) const
+ {
+ return (
+ maRangeX.isInside(rBox.maRangeX)
+ && maRangeY.isInside(rBox.maRangeY)
+ );
+ }
+
+ /// yields true if rBox at least partly inside set
+ bool overlaps(const B2IBox& rBox) const
+ {
+ return (
+ maRangeX.overlaps(rBox.maRangeX)
+ && maRangeY.overlaps(rBox.maRangeY)
+ );
+ }
+
+ /// add point to the set, expanding as necessary
+ void expand(const B2ITuple& rTuple)
+ {
+ maRangeX.expand(rTuple.getX());
+ maRangeY.expand(rTuple.getY());
+ }
+
+ /// add rBox to the set, expanding as necessary
+ void expand(const B2IBox& rBox)
+ {
+ maRangeX.expand(rBox.maRangeX);
+ maRangeY.expand(rBox.maRangeY);
+ }
+
+ /// calc set intersection
+ void intersect(const B2IBox& rBox)
+ {
+ maRangeX.intersect(rBox.maRangeX);
+ maRangeY.intersect(rBox.maRangeY);
+ }
+
+ /// grow set by nValue on all sides
+ void grow(sal_Int32 nValue)
+ {
+ maRangeX.grow(nValue);
+ maRangeY.grow(nValue);
+ }
+
+ private:
+ BasicBox maRangeX;
+ BasicBox maRangeY;
+ };
+
+} // end of namespace basegfx
+
+#endif /* _BGFX_RANGE_B2IBOX_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b2irange.hxx b/include/basegfx/range/b2irange.hxx
new file mode 100644
index 000000000000..60f9fc79fa67
--- /dev/null
+++ b/include/basegfx/range/b2irange.hxx
@@ -0,0 +1,287 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RANGE_B2IRANGE_HXX
+#define _BGFX_RANGE_B2IRANGE_HXX
+
+#include <basegfx/point/b2ipoint.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/tuple/b2ituple.hxx>
+#include <basegfx/tuple/b2i64tuple.hxx>
+#include <basegfx/range/basicrange.hxx>
+#include <vector>
+#include <basegfx/basegfxdllapi.h>
+
+
+namespace basegfx
+{
+ /** A two-dimensional interval over integers
+
+ This is a set of real numbers, bounded by a lower and an upper
+ pair. All inbetween values are included in the set (see also
+ http://en.wikipedia.org/wiki/Interval_%28mathematics%29).
+
+ Probably you rather want B2IBox for integers.
+
+ The set is closed, i.e. the upper and the lower bound are
+ included (if you're used to the notation - we're talking about
+ [a,b] here, compared to half-open [a,b) or open intervals
+ (a,b)).
+
+ That means, isInside(val) will return true also for values of
+ val=a or val=b.
+
+ @see B2IBox
+ */
+ class B2IRange
+ {
+ public:
+ typedef sal_Int32 ValueType;
+ typedef Int32Traits TraitsType;
+
+ B2IRange() {}
+
+ /// Create degenerate interval consisting of a single point
+ explicit B2IRange(const B2ITuple& rTuple)
+ : maRangeX(rTuple.getX()),
+ maRangeY(rTuple.getY())
+ {
+ }
+
+ /// Create proper interval between the two given integer pairs
+ B2IRange(sal_Int32 x1,
+ sal_Int32 y1,
+ sal_Int32 x2,
+ sal_Int32 y2)
+ : maRangeX(x1),
+ maRangeY(y1)
+ {
+ maRangeX.expand(x2);
+ maRangeY.expand(y2);
+ }
+
+ /// Create proper interval between the two given points
+ B2IRange(const B2ITuple& rTuple1,
+ const B2ITuple& rTuple2)
+ : maRangeX(rTuple1.getX()),
+ maRangeY(rTuple1.getY())
+ {
+ expand( rTuple2 );
+ }
+
+ /** Check if the interval set is empty
+
+ @return false, if no value is in this set - having a
+ single point included will already return true.
+ */
+ bool isEmpty() const
+ {
+ return maRangeX.isEmpty() || maRangeY.isEmpty();
+ }
+
+ /// reset the object to empty state again, clearing all values
+ void reset()
+ {
+ maRangeX.reset();
+ maRangeY.reset();
+ }
+
+ bool operator==( const B2IRange& rRange ) const
+ {
+ return (maRangeX == rRange.maRangeX
+ && maRangeY == rRange.maRangeY);
+ }
+
+ bool operator!=( const B2IRange& rRange ) const
+ {
+ return (maRangeX != rRange.maRangeX
+ || maRangeY != rRange.maRangeY);
+ }
+
+ /// get lower bound of the set. returns arbitrary values for empty sets.
+ sal_Int32 getMinX() const
+ {
+ return maRangeX.getMinimum();
+ }
+
+ /// get lower bound of the set. returns arbitrary values for empty sets.
+ sal_Int32 getMinY() const
+ {
+ return maRangeY.getMinimum();
+ }
+
+ /// get upper bound of the set. returns arbitrary values for empty sets.
+ sal_Int32 getMaxX() const
+ {
+ return maRangeX.getMaximum();
+ }
+
+ /// get upper bound of the set. returns arbitrary values for empty sets.
+ sal_Int32 getMaxY() const
+ {
+ return maRangeY.getMaximum();
+ }
+
+ /// return difference between upper and lower X value. returns 0 for empty sets.
+ sal_Int64 getWidth() const
+ {
+ return maRangeX.getRange();
+ }
+
+ /// return difference between upper and lower Y value. returns 0 for empty sets.
+ sal_Int64 getHeight() const
+ {
+ return maRangeY.getRange();
+ }
+
+ /// get lower bound of the set. returns arbitrary values for empty sets.
+ B2IPoint getMinimum() const
+ {
+ return B2IPoint(
+ maRangeX.getMinimum(),
+ maRangeY.getMinimum()
+ );
+ }
+
+ /// get upper bound of the set. returns arbitrary values for empty sets.
+ B2IPoint getMaximum() const
+ {
+ return B2IPoint(
+ maRangeX.getMaximum(),
+ maRangeY.getMaximum()
+ );
+ }
+
+ /// return difference between upper and lower point. returns (0,0) for empty sets.
+ B2I64Tuple getRange() const
+ {
+ return B2I64Tuple(
+ maRangeX.getRange(),
+ maRangeY.getRange()
+ );
+ }
+
+ /// return center point of set. returns (0,0) for empty sets.
+ B2DPoint getCenter() const
+ {
+ return B2DPoint(
+ maRangeX.getCenter(),
+ maRangeY.getCenter()
+ );
+ }
+
+ /// yields true if given point is contained in set
+ bool isInside(const B2ITuple& rTuple) const
+ {
+ return (
+ maRangeX.isInside(rTuple.getX())
+ && maRangeY.isInside(rTuple.getY())
+ );
+ }
+
+ /// yields true if rRange is inside, or equal to set
+ bool isInside(const B2IRange& rRange) const
+ {
+ return (
+ maRangeX.isInside(rRange.maRangeX)
+ && maRangeY.isInside(rRange.maRangeY)
+ );
+ }
+
+ /// yields true if rRange at least partly inside set
+ bool overlaps(const B2IRange& rRange) const
+ {
+ return (
+ maRangeX.overlaps(rRange.maRangeX)
+ && maRangeY.overlaps(rRange.maRangeY)
+ );
+ }
+
+ /// yields true if overlaps(rRange) does, and the overlap is larger than infinitesimal
+ bool overlapsMore(const B2IRange& rRange) const
+ {
+ return (
+ maRangeX.overlapsMore(rRange.maRangeX)
+ && maRangeY.overlapsMore(rRange.maRangeY)
+ );
+ }
+
+ /// add point to the set, expanding as necessary
+ void expand(const B2ITuple& rTuple)
+ {
+ maRangeX.expand(rTuple.getX());
+ maRangeY.expand(rTuple.getY());
+ }
+
+ /// add rRange to the set, expanding as necessary
+ void expand(const B2IRange& rRange)
+ {
+ maRangeX.expand(rRange.maRangeX);
+ maRangeY.expand(rRange.maRangeY);
+ }
+
+ /// calc set intersection
+ void intersect(const B2IRange& rRange)
+ {
+ maRangeX.intersect(rRange.maRangeX);
+ maRangeY.intersect(rRange.maRangeY);
+ }
+
+ /// grow set by nValue on all sides
+ void grow(sal_Int32 nValue)
+ {
+ maRangeX.grow(nValue);
+ maRangeY.grow(nValue);
+ }
+
+ private:
+ typedef ::basegfx::BasicRange< ValueType, TraitsType > MyBasicRange;
+
+ MyBasicRange maRangeX;
+ MyBasicRange maRangeY;
+ };
+
+ /** Compute the set difference of the two given ranges
+
+ This method calculates the symmetric difference (aka XOR)
+ between the two given ranges, and returning the resulting
+ ranges. Thus, the result will contain all areas where one, but
+ not both ranges lie.
+
+ @param o_rResult
+ Result vector. The up to four difference ranges are returned
+ within this vector
+
+ @param rFirst
+ The first range
+
+ @param rSecond
+ The second range
+
+ @return the input vector
+ */
+ BASEGFX_DLLPUBLIC ::std::vector< B2IRange >& computeSetDifference( ::std::vector< B2IRange >& o_rResult,
+ const B2IRange& rFirst,
+ const B2IRange& rSecond );
+
+} // end of namespace basegfx
+
+#endif /* _BGFX_RANGE_B2IRANGE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b2irectangle.hxx b/include/basegfx/range/b2irectangle.hxx
new file mode 100644
index 000000000000..40792732ab1d
--- /dev/null
+++ b/include/basegfx/range/b2irectangle.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RANGE_B2IRECTANGLE_HXX
+#define _BGFX_RANGE_B2IRECTANGLE_HXX
+
+#include <basegfx/range/b2irange.hxx>
+
+namespace basegfx
+{
+ // syntactic sugar: a B2IRange exactly models a Rectangle, thus,
+ // for interface clarity, we provide an alias name
+
+ /// Alias name for interface clarity (not everybody is aware of the identity)
+ typedef B2IRange B2IRectangle;
+}
+
+#endif /* _BGFX_RANGE_B2IRECTANGLE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b3drange.hxx b/include/basegfx/range/b3drange.hxx
new file mode 100644
index 000000000000..7b17f04e4964
--- /dev/null
+++ b/include/basegfx/range/b3drange.hxx
@@ -0,0 +1,273 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RANGE_B3DRANGE_HXX
+#define _BGFX_RANGE_B3DRANGE_HXX
+
+#include <basegfx/vector/b3dvector.hxx>
+#include <basegfx/point/b3dpoint.hxx>
+#include <basegfx/tuple/b3dtuple.hxx>
+#include <basegfx/range/basicrange.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ // predeclarations
+ class B3IRange;
+ class B3DHomMatrix;
+
+ class B3DRange
+ {
+ typedef ::basegfx::BasicRange< double, DoubleTraits > MyBasicRange;
+
+ MyBasicRange maRangeX;
+ MyBasicRange maRangeY;
+ MyBasicRange maRangeZ;
+
+ public:
+ B3DRange() {}
+
+ explicit B3DRange(const B3DTuple& rTuple)
+ : maRangeX(rTuple.getX()),
+ maRangeY(rTuple.getY()),
+ maRangeZ(rTuple.getZ())
+ {
+ }
+
+ B3DRange(double x1,
+ double y1,
+ double z1,
+ double x2,
+ double y2,
+ double z2)
+ : maRangeX(x1),
+ maRangeY(y1),
+ maRangeZ(z1)
+ {
+ maRangeX.expand(x2);
+ maRangeY.expand(y2);
+ maRangeZ.expand(z2);
+ }
+
+ B3DRange(const B3DTuple& rTuple1,
+ const B3DTuple& rTuple2)
+ : maRangeX(rTuple1.getX()),
+ maRangeY(rTuple1.getY()),
+ maRangeZ(rTuple1.getZ())
+ {
+ expand(rTuple2);
+ }
+
+ bool isEmpty() const
+ {
+ return (
+ maRangeX.isEmpty()
+ || maRangeY.isEmpty()
+ || maRangeZ.isEmpty()
+ );
+ }
+
+ void reset()
+ {
+ maRangeX.reset();
+ maRangeY.reset();
+ maRangeZ.reset();
+ }
+
+ bool operator==( const B3DRange& rRange ) const
+ {
+ return (maRangeX == rRange.maRangeX
+ && maRangeY == rRange.maRangeY
+ && maRangeZ == rRange.maRangeZ);
+ }
+
+ bool operator!=( const B3DRange& rRange ) const
+ {
+ return (maRangeX != rRange.maRangeX
+ || maRangeY != rRange.maRangeY
+ || maRangeZ != rRange.maRangeZ);
+ }
+
+ bool equal(const B3DRange& rRange) const
+ {
+ return (maRangeX.equal(rRange.maRangeX)
+ && maRangeY.equal(rRange.maRangeY)
+ && maRangeZ.equal(rRange.maRangeZ));
+ }
+
+ double getMinX() const
+ {
+ return maRangeX.getMinimum();
+ }
+
+ double getMinY() const
+ {
+ return maRangeY.getMinimum();
+ }
+
+ double getMinZ() const
+ {
+ return maRangeZ.getMinimum();
+ }
+
+ double getMaxX() const
+ {
+ return maRangeX.getMaximum();
+ }
+
+ double getMaxY() const
+ {
+ return maRangeY.getMaximum();
+ }
+
+ double getMaxZ() const
+ {
+ return maRangeZ.getMaximum();
+ }
+
+ double getWidth() const
+ {
+ return maRangeX.getRange();
+ }
+
+ double getHeight() const
+ {
+ return maRangeY.getRange();
+ }
+
+ double getDepth() const
+ {
+ return maRangeZ.getRange();
+ }
+
+ B3DPoint getMinimum() const
+ {
+ return B3DPoint(
+ maRangeX.getMinimum(),
+ maRangeY.getMinimum(),
+ maRangeZ.getMinimum()
+ );
+ }
+
+ B3DPoint getMaximum() const
+ {
+ return B3DPoint(
+ maRangeX.getMaximum(),
+ maRangeY.getMaximum(),
+ maRangeZ.getMaximum()
+ );
+ }
+
+ B3DVector getRange() const
+ {
+ return B3DVector(
+ maRangeX.getRange(),
+ maRangeY.getRange(),
+ maRangeZ.getRange()
+ );
+ }
+
+ B3DPoint getCenter() const
+ {
+ return B3DPoint(
+ maRangeX.getCenter(),
+ maRangeY.getCenter(),
+ maRangeZ.getCenter()
+ );
+ }
+
+ double getCenterX() const
+ {
+ return maRangeX.getCenter();
+ }
+
+ double getCenterY() const
+ {
+ return maRangeY.getCenter();
+ }
+
+ double getCenterZ() const
+ {
+ return maRangeZ.getCenter();
+ }
+
+ bool isInside(const B3DTuple& rTuple) const
+ {
+ return (
+ maRangeX.isInside(rTuple.getX())
+ && maRangeY.isInside(rTuple.getY())
+ && maRangeZ.isInside(rTuple.getZ())
+ );
+ }
+
+ bool isInside(const B3DRange& rRange) const
+ {
+ return (
+ maRangeX.isInside(rRange.maRangeX)
+ && maRangeY.isInside(rRange.maRangeY)
+ && maRangeZ.isInside(rRange.maRangeZ)
+ );
+ }
+
+ bool overlaps(const B3DRange& rRange) const
+ {
+ return (
+ maRangeX.overlaps(rRange.maRangeX)
+ && maRangeY.overlaps(rRange.maRangeY)
+ && maRangeZ.overlaps(rRange.maRangeZ)
+ );
+ }
+
+ void expand(const B3DTuple& rTuple)
+ {
+ maRangeX.expand(rTuple.getX());
+ maRangeY.expand(rTuple.getY());
+ maRangeZ.expand(rTuple.getZ());
+ }
+
+ void expand(const B3DRange& rRange)
+ {
+ maRangeX.expand(rRange.maRangeX);
+ maRangeY.expand(rRange.maRangeY);
+ maRangeZ.expand(rRange.maRangeZ);
+ }
+
+ void intersect(const B3DRange& rRange)
+ {
+ maRangeX.intersect(rRange.maRangeX);
+ maRangeY.intersect(rRange.maRangeY);
+ maRangeZ.intersect(rRange.maRangeZ);
+ }
+
+ void grow(double fValue)
+ {
+ maRangeX.grow(fValue);
+ maRangeY.grow(fValue);
+ maRangeZ.grow(fValue);
+ }
+
+ BASEGFX_DLLPUBLIC void transform(const B3DHomMatrix& rMatrix);
+ };
+
+} // end of namespace basegfx
+
+
+#endif /* _BGFX_RANGE_B3DRANGE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b3irange.hxx b/include/basegfx/range/b3irange.hxx
new file mode 100644
index 000000000000..558c2abb4d62
--- /dev/null
+++ b/include/basegfx/range/b3irange.hxx
@@ -0,0 +1,240 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RANGE_B3IRANGE_HXX
+#define _BGFX_RANGE_B3IRANGE_HXX
+
+#include <basegfx/point/b3ipoint.hxx>
+#include <basegfx/point/b3dpoint.hxx>
+#include <basegfx/tuple/b3ituple.hxx>
+#include <basegfx/tuple/b3i64tuple.hxx>
+#include <basegfx/range/basicrange.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ class B3IRange
+ {
+ typedef ::basegfx::BasicRange< sal_Int32, Int32Traits > MyBasicRange;
+
+ MyBasicRange maRangeX;
+ MyBasicRange maRangeY;
+ MyBasicRange maRangeZ;
+
+ public:
+ B3IRange() {}
+
+ explicit B3IRange(const B3ITuple& rTuple)
+ : maRangeX(rTuple.getX()),
+ maRangeY(rTuple.getY()),
+ maRangeZ(rTuple.getZ())
+ {
+ }
+
+ B3IRange(sal_Int32 x1,
+ sal_Int32 y1,
+ sal_Int32 z1,
+ sal_Int32 x2,
+ sal_Int32 y2,
+ sal_Int32 z2)
+ : maRangeX(x1),
+ maRangeY(y1),
+ maRangeZ(z1)
+ {
+ maRangeX.expand(x2);
+ maRangeY.expand(y2);
+ maRangeZ.expand(z2);
+ }
+
+ B3IRange(const B3ITuple& rTuple1,
+ const B3ITuple& rTuple2)
+ : maRangeX(rTuple1.getX()),
+ maRangeY(rTuple1.getY()),
+ maRangeZ(rTuple1.getZ())
+ {
+ expand(rTuple2);
+ }
+
+ bool isEmpty() const
+ {
+ return maRangeX.isEmpty() || maRangeY.isEmpty() || maRangeZ.isEmpty();
+ }
+
+ void reset()
+ {
+ maRangeX.reset();
+ maRangeY.reset();
+ maRangeZ.reset();
+ }
+
+ bool operator==( const B3IRange& rRange ) const
+ {
+ return (maRangeX == rRange.maRangeX
+ && maRangeY == rRange.maRangeY
+ && maRangeZ == rRange.maRangeZ);
+ }
+
+ bool operator!=( const B3IRange& rRange ) const
+ {
+ return (maRangeX != rRange.maRangeX
+ || maRangeY != rRange.maRangeY
+ || maRangeZ != rRange.maRangeZ);
+ }
+
+ sal_Int32 getMinX() const
+ {
+ return maRangeX.getMinimum();
+ }
+
+ sal_Int32 getMinY() const
+ {
+ return maRangeY.getMinimum();
+ }
+
+ sal_Int32 getMinZ() const
+ {
+ return maRangeZ.getMinimum();
+ }
+
+ sal_Int32 getMaxX() const
+ {
+ return maRangeX.getMaximum();
+ }
+
+ sal_Int32 getMaxY() const
+ {
+ return maRangeY.getMaximum();
+ }
+
+ sal_Int32 getMaxZ() const
+ {
+ return maRangeZ.getMaximum();
+ }
+
+ sal_Int64 getWidth() const
+ {
+ return maRangeX.getRange();
+ }
+
+ sal_Int64 getHeight() const
+ {
+ return maRangeY.getRange();
+ }
+
+ sal_Int64 getDepth() const
+ {
+ return maRangeZ.getRange();
+ }
+
+ B3IPoint getMinimum() const
+ {
+ return B3IPoint(
+ maRangeX.getMinimum(),
+ maRangeY.getMinimum(),
+ maRangeZ.getMinimum()
+ );
+ }
+
+ B3IPoint getMaximum() const
+ {
+ return B3IPoint(
+ maRangeX.getMaximum(),
+ maRangeY.getMaximum(),
+ maRangeZ.getMaximum()
+ );
+ }
+
+ B3I64Tuple getRange() const
+ {
+ return B3I64Tuple(
+ maRangeX.getRange(),
+ maRangeY.getRange(),
+ maRangeZ.getRange()
+ );
+ }
+
+ B3DPoint getCenter() const
+ {
+ return B3DPoint(
+ maRangeX.getCenter(),
+ maRangeY.getCenter(),
+ maRangeZ.getCenter()
+ );
+ }
+
+ bool isInside(const B3ITuple& rTuple) const
+ {
+ return (
+ maRangeX.isInside(rTuple.getX())
+ && maRangeY.isInside(rTuple.getY())
+ && maRangeZ.isInside(rTuple.getZ())
+ );
+ }
+
+ bool isInside(const B3IRange& rRange) const
+ {
+ return (
+ maRangeX.isInside(rRange.maRangeX)
+ && maRangeY.isInside(rRange.maRangeY)
+ && maRangeZ.isInside(rRange.maRangeZ)
+ );
+ }
+
+ bool overlaps(const B3IRange& rRange) const
+ {
+ return (
+ maRangeX.overlaps(rRange.maRangeX)
+ && maRangeY.overlaps(rRange.maRangeY)
+ && maRangeZ.overlaps(rRange.maRangeZ)
+ );
+ }
+
+ void expand(const B3ITuple& rTuple)
+ {
+ maRangeX.expand(rTuple.getX());
+ maRangeY.expand(rTuple.getY());
+ maRangeZ.expand(rTuple.getZ());
+ }
+
+ void expand(const B3IRange& rRange)
+ {
+ maRangeX.expand(rRange.maRangeX);
+ maRangeY.expand(rRange.maRangeY);
+ maRangeZ.expand(rRange.maRangeZ);
+ }
+
+ void intersect(const B3IRange& rRange)
+ {
+ maRangeX.intersect(rRange.maRangeX);
+ maRangeY.intersect(rRange.maRangeY);
+ maRangeZ.intersect(rRange.maRangeZ);
+ }
+
+ void grow(sal_Int32 nValue)
+ {
+ maRangeX.grow(nValue);
+ maRangeY.grow(nValue);
+ maRangeZ.grow(nValue);
+ }
+ };
+} // end of namespace basegfx
+
+#endif /* _BGFX_RANGE_B3IRANGE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/basicbox.hxx b/include/basegfx/range/basicbox.hxx
new file mode 100644
index 000000000000..bab84c17f89a
--- /dev/null
+++ b/include/basegfx/range/basicbox.hxx
@@ -0,0 +1,127 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RANGE_BASICBOX_HXX
+#define _BGFX_RANGE_BASICBOX_HXX
+
+#include <basegfx/range/basicrange.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+
+namespace basegfx
+{
+ /** Explicitely different from BasicRange, handling the inside predicates
+ differently.
+
+ This is modelled after how polygon fill algorithms set pixel -
+ typically excluding rightmost and bottommost ones.
+ */
+ class BasicBox : public BasicRange< sal_Int32, Int32Traits >
+ {
+ typedef BasicRange< sal_Int32, Int32Traits > Base;
+ public:
+ BasicBox() {}
+
+ explicit BasicBox( sal_Int32 nValue ) :
+ Base( nValue )
+ {
+ }
+
+ bool isEmpty() const
+ {
+ return mnMinimum >= mnMaximum;
+ }
+
+ double getCenter() const
+ {
+ if(isEmpty())
+ {
+ return 0.0;
+ }
+ else
+ {
+ return ((mnMaximum + mnMinimum - 1.0) / 2.0);
+ }
+ }
+
+ using Base::isInside;
+
+ bool isInside(sal_Int32 nValue) const
+ {
+ if(isEmpty())
+ {
+ return false;
+ }
+ else
+ {
+ return (nValue >= mnMinimum) && (nValue < mnMaximum);
+ }
+ }
+
+ using Base::overlaps;
+
+ bool overlaps(const BasicBox& rBox) const
+ {
+ if(isEmpty())
+ {
+ return false;
+ }
+ else
+ {
+ if(rBox.isEmpty())
+ {
+ return false;
+ }
+ else
+ {
+ return !((rBox.mnMaximum <= mnMinimum) || (rBox.mnMinimum >= mnMaximum));
+ }
+ }
+ }
+
+ void grow(sal_Int32 nValue)
+ {
+ if(!isEmpty())
+ {
+ bool bLessThanZero(nValue < 0);
+
+ if(nValue > 0 || bLessThanZero)
+ {
+ mnMinimum -= nValue;
+ mnMaximum += nValue;
+
+ if(bLessThanZero)
+ {
+ // test if range did collapse
+ if(mnMinimum > mnMaximum)
+ {
+ // if yes, collapse to center
+ mnMinimum = mnMaximum = ((mnMaximum + mnMinimum - 1) / 2);
+ }
+ }
+ }
+ }
+ }
+ };
+
+} // end of namespace basegfx
+
+#endif /* _BGFX_RANGE_BASICBOX_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/basicrange.hxx b/include/basegfx/range/basicrange.hxx
new file mode 100644
index 000000000000..51b5593ae61d
--- /dev/null
+++ b/include/basegfx/range/basicrange.hxx
@@ -0,0 +1,278 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RANGE_BASICRANGE_HXX
+#define _BGFX_RANGE_BASICRANGE_HXX
+
+#include <sal/types.h>
+#include <float.h>
+#include <basegfx/numeric/ftools.hxx>
+
+
+namespace basegfx
+{
+ template< typename T, typename Traits > class BasicRange
+ {
+ protected:
+ T mnMinimum;
+ T mnMaximum;
+
+ public:
+ typedef T ValueType;
+ typedef Traits TraitsType;
+
+ BasicRange() :
+ mnMinimum(Traits::maxVal()),
+ mnMaximum(Traits::minVal())
+ {
+ }
+
+ explicit BasicRange( T nValue ) :
+ mnMinimum(nValue),
+ mnMaximum(nValue)
+ {
+ }
+
+ void reset()
+ {
+ mnMinimum = Traits::maxVal();
+ mnMaximum = Traits::minVal();
+ }
+
+ bool isEmpty() const
+ {
+ return Traits::maxVal() == mnMinimum;
+ }
+
+ T getMinimum() const { return mnMinimum; }
+ T getMaximum() const { return mnMaximum; }
+
+ double getCenter() const
+ {
+ if(isEmpty())
+ {
+ return 0.0;
+ }
+ else
+ {
+ return ((mnMaximum + mnMinimum) / 2.0);
+ }
+ }
+
+ bool isInside(T nValue) const
+ {
+ if(isEmpty())
+ {
+ return false;
+ }
+ else
+ {
+ return (nValue >= mnMinimum) && (nValue <= mnMaximum);
+ }
+ }
+
+ bool isInside(const BasicRange& rRange) const
+ {
+ if(isEmpty())
+ {
+ return false;
+ }
+ else
+ {
+ if(rRange.isEmpty())
+ {
+ return false;
+ }
+ else
+ {
+ return (rRange.mnMinimum >= mnMinimum) && (rRange.mnMaximum <= mnMaximum);
+ }
+ }
+ }
+
+ bool overlaps(const BasicRange& rRange) const
+ {
+ if(isEmpty())
+ {
+ return false;
+ }
+ else
+ {
+ if(rRange.isEmpty())
+ {
+ return false;
+ }
+ else
+ {
+ return !((rRange.mnMaximum < mnMinimum) || (rRange.mnMinimum > mnMaximum));
+ }
+ }
+ }
+
+ bool overlapsMore(const BasicRange& rRange) const
+ {
+ if(isEmpty() || rRange.isEmpty())
+ return false;
+ // returns true if the overlap is more than just a touching at the limits
+ return ((rRange.mnMaximum > mnMinimum) && (rRange.mnMinimum < mnMaximum));
+ }
+
+ bool operator==( const BasicRange& rRange ) const
+ {
+ return (mnMinimum == rRange.mnMinimum && mnMaximum == rRange.mnMaximum);
+ }
+
+ bool operator!=( const BasicRange& rRange ) const
+ {
+ return (mnMinimum != rRange.mnMinimum || mnMaximum != rRange.mnMaximum);
+ }
+
+ bool equal(const BasicRange& rRange) const
+ {
+ return (
+ fTools::equal(mnMinimum, rRange.mnMinimum) &&
+ fTools::equal(mnMaximum, rRange.mnMaximum));
+ }
+
+ void expand(T nValue)
+ {
+ if(isEmpty())
+ {
+ mnMinimum = mnMaximum = nValue;
+ }
+ else
+ {
+ if(nValue < mnMinimum)
+ {
+ mnMinimum = nValue;
+ }
+
+ if(nValue > mnMaximum)
+ {
+ mnMaximum = nValue;
+ }
+ }
+ }
+
+ void expand(const BasicRange& rRange)
+ {
+ if(isEmpty())
+ {
+ mnMinimum = rRange.mnMinimum;
+ mnMaximum = rRange.mnMaximum;
+ }
+ else
+ {
+ if(!rRange.isEmpty())
+ {
+ if(rRange.mnMinimum < mnMinimum)
+ {
+ mnMinimum = rRange.mnMinimum;
+ }
+
+ if(rRange.mnMaximum > mnMaximum)
+ {
+ mnMaximum = rRange.mnMaximum;
+ }
+ }
+ }
+ }
+
+ void intersect(const BasicRange& rRange)
+ {
+ // here, overlaps also tests all isEmpty() conditions already.
+ if( !overlaps( rRange ) )
+ {
+ reset();
+ }
+ else
+ {
+ if(rRange.mnMinimum > mnMinimum)
+ {
+ mnMinimum = rRange.mnMinimum;
+ }
+
+ if(rRange.mnMaximum < mnMaximum)
+ {
+ mnMaximum = rRange.mnMaximum;
+ }
+ }
+ }
+
+ void grow(T nValue)
+ {
+ if(!isEmpty())
+ {
+ bool bLessThanZero(nValue < 0);
+
+ if(nValue > 0 || bLessThanZero)
+ {
+ mnMinimum -= nValue;
+ mnMaximum += nValue;
+
+ if(bLessThanZero)
+ {
+ // test if range did collapse
+ if(mnMinimum > mnMaximum)
+ {
+ // if yes, collapse to center
+ mnMinimum = mnMaximum = (mnMinimum + mnMaximum) / 2;
+ }
+ }
+ }
+ }
+ }
+
+ typename Traits::DifferenceType getRange() const
+ {
+ if(isEmpty())
+ {
+ return Traits::neutral();
+ }
+ else
+ {
+ return (mnMaximum - mnMinimum);
+ }
+ }
+ };
+
+ // some pre-fabricated traits
+ struct DoubleTraits
+ {
+ static double minVal() { return DBL_MIN; };
+ static double maxVal() { return DBL_MAX; };
+ static double neutral() { return 0.0; };
+
+ typedef double DifferenceType;
+ };
+
+ struct Int32Traits
+ {
+ static sal_Int32 minVal() { return SAL_MIN_INT32; };
+ static sal_Int32 maxVal() { return SAL_MAX_INT32; };
+ static sal_Int32 neutral() { return 0L; };
+
+ typedef sal_Int64 DifferenceType;
+ };
+
+} // end of namespace basegfx
+
+#endif /* _BGFX_RANGE_BASICRANGE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/raster/bpixelraster.hxx b/include/basegfx/raster/bpixelraster.hxx
new file mode 100644
index 000000000000..ed7ac931d805
--- /dev/null
+++ b/include/basegfx/raster/bpixelraster.hxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RASTER_BPIXELRASTER_HXX
+#define _BGFX_RASTER_BPIXELRASTER_HXX
+
+#include <algorithm>
+#include <string.h>
+#include <sal/types.h>
+#include <basegfx/pixel/bpixel.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ class BPixelRaster
+ {
+ private:
+ // do not allow copy constructor and assignment operator
+ BPixelRaster(const BPixelRaster&);
+ BPixelRaster& operator=(const BPixelRaster&);
+
+ protected:
+ sal_uInt32 mnWidth;
+ sal_uInt32 mnHeight;
+ sal_uInt32 mnCount;
+ BPixel* mpContent;
+
+ public:
+ // reset
+ void reset()
+ {
+ memset(mpContent, 0, sizeof(BPixel) * mnCount);
+ }
+
+ // constructor/destructor
+ BPixelRaster(sal_uInt32 nWidth, sal_uInt32 nHeight)
+ : mnWidth(nWidth),
+ mnHeight(nHeight),
+ mnCount(nWidth * nHeight),
+ mpContent(new BPixel[mnCount])
+ {
+ reset();
+ }
+
+ ~BPixelRaster()
+ {
+ delete [] mpContent;
+ }
+
+ // coordinate calcs between X/Y and span
+ sal_uInt32 getIndexFromXY(sal_uInt32 nX, sal_uInt32 nY) const { return (nX + (nY * mnWidth)); }
+ sal_uInt32 getXFromIndex(sal_uInt32 nIndex) const { return (nIndex % mnWidth); }
+ sal_uInt32 getYFromIndex(sal_uInt32 nIndex) const { return (nIndex / mnWidth); }
+
+ // data access read
+ sal_uInt32 getWidth() const { return mnWidth; }
+ sal_uInt32 getHeight() const { return mnHeight; }
+ sal_uInt32 getCount() const { return mnCount; }
+
+ // data access read only
+ const BPixel& getBPixel(sal_uInt32 nIndex) const
+ {
+ assert(nIndex < mnCount); //Access out of range
+ return mpContent[nIndex];
+ }
+
+ // data access read/write
+ BPixel& getBPixel(sal_uInt32 nIndex)
+ {
+ assert(nIndex < mnCount); //Access out of range
+ return mpContent[nIndex];
+ }
+ };
+} // end of namespace basegfx
+
+#endif /* _BGFX_RASTER_BPIXELRASTER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/raster/bzpixelraster.hxx b/include/basegfx/raster/bzpixelraster.hxx
new file mode 100644
index 000000000000..ddd4f1e56cb0
--- /dev/null
+++ b/include/basegfx/raster/bzpixelraster.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RASTER_BZPIXELRASTER_HXX
+#define _BGFX_RASTER_BZPIXELRASTER_HXX
+
+#include <basegfx/raster/bpixelraster.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ class BZPixelRaster : public BPixelRaster
+ {
+ protected:
+ // additionally, host a ZBuffer
+ sal_uInt16* mpZBuffer;
+
+ public:
+ // reset
+ void resetZ()
+ {
+ reset();
+ memset(mpZBuffer, 0, sizeof(sal_uInt16) * mnCount);
+ }
+
+ // constructor/destructor
+ BZPixelRaster(sal_uInt32 nWidth, sal_uInt32 nHeight)
+ : BPixelRaster(nWidth, nHeight),
+ mpZBuffer(new sal_uInt16[mnCount])
+ {
+ memset(mpZBuffer, 0, sizeof(sal_uInt16) * mnCount);
+ }
+
+ ~BZPixelRaster()
+ {
+ delete [] mpZBuffer;
+ }
+
+ // data access read only
+ const sal_uInt16& getZ(sal_uInt32 nIndex) const
+ {
+#ifdef DBG_UTIL
+ if(nIndex >= mnCount)
+ {
+ OSL_FAIL("getZ: Access out of range (!)");
+ return mpZBuffer[0L];
+ }
+#endif
+ return mpZBuffer[nIndex];
+ }
+
+ // data access read/write
+ sal_uInt16& getZ(sal_uInt32 nIndex)
+ {
+#ifdef DBG_UTIL
+ if(nIndex >= mnCount)
+ {
+ OSL_FAIL("getZ: Access out of range (!)");
+ return mpZBuffer[0L];
+ }
+#endif
+ return mpZBuffer[nIndex];
+ }
+ };
+} // end of namespace basegfx
+
+#endif /* _BGFX_RASTER_BZPIXELRASTER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/raster/rasterconvert3d.hxx b/include/basegfx/raster/rasterconvert3d.hxx
new file mode 100644
index 000000000000..1bfbe20b1cf0
--- /dev/null
+++ b/include/basegfx/raster/rasterconvert3d.hxx
@@ -0,0 +1,340 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RASTER_RASTERCONVERT3D_HXX
+#define _BGFX_RASTER_RASTERCONVERT3D_HXX
+
+#include <sal/types.h>
+#include <vector>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/vector/b3dvector.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+namespace basegfx
+{
+ class B3DPolygon;
+ class B3DPolyPolygon;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// interpolators for double precision
+
+namespace basegfx
+{
+ class ip_single
+ {
+ private:
+ double mfVal;
+ double mfInc;
+
+ public:
+ ip_single()
+ : mfVal(0.0),
+ mfInc(0.0)
+ {}
+
+ ip_single(double fVal, double fInc)
+ : mfVal(fVal),
+ mfInc(fInc)
+ {}
+
+ double getVal() const { return mfVal; }
+ double getInc() const { return mfInc; }
+
+ void increment(double fStep) { mfVal += fStep * mfInc; }
+ };
+} // end of namespace basegfx
+
+namespace basegfx
+{
+ class ip_double
+ {
+ private:
+ ip_single maX;
+ ip_single maY;
+
+ public:
+ ip_double()
+ : maX(),
+ maY()
+ {}
+
+ ip_double(double fXVal, double fXInc, double fYVal, double fYInc)
+ : maX(fXVal, fXInc),
+ maY(fYVal, fYInc)
+ {}
+
+ const ip_single& getX() const { return maX; }
+ const ip_single& getY() const { return maY; }
+
+ void increment(double fStep) { maX.increment(fStep); maY.increment(fStep); }
+ };
+} // end of namespace basegfx
+
+namespace basegfx
+{
+ class ip_triple
+ {
+ private:
+ ip_single maX;
+ ip_single maY;
+ ip_single maZ;
+
+ public:
+ ip_triple()
+ : maX(),
+ maY(),
+ maZ()
+ {}
+
+ ip_triple(double fXVal, double fXInc, double fYVal, double fYInc, double fZVal, double fZInc)
+ : maX(fXVal, fXInc),
+ maY(fYVal, fYInc),
+ maZ(fZVal, fZInc)
+ {}
+
+ const ip_single& getX() const { return maX; }
+ const ip_single& getY() const { return maY; }
+ const ip_single& getZ() const { return maZ; }
+
+ void increment(double fStep) { maX.increment(fStep); maY.increment(fStep); maZ.increment(fStep); }
+ };
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+// InterpolatorProvider3D to have a common source for allocating interpolators
+// which may then be addressed using the index to the vectors
+
+namespace basegfx
+{
+ #define SCANLINE_EMPTY_INDEX (0xffffffff)
+
+ class InterpolatorProvider3D
+ {
+ private:
+ ::std::vector< ip_triple > maColorInterpolators;
+ ::std::vector< ip_triple > maNormalInterpolators;
+ ::std::vector< ip_double > maTextureInterpolators;
+ ::std::vector< ip_triple > maInverseTextureInterpolators;
+
+ protected:
+ sal_uInt32 addColorInterpolator(const BColor& rA, const BColor& rB, double fInvYDelta)
+ {
+ B3DVector aDelta(rB.getRed() - rA.getRed(), rB.getGreen() - rA.getGreen(), rB.getBlue() - rA.getBlue());
+ aDelta *= fInvYDelta;
+ maColorInterpolators.push_back(ip_triple(rA.getRed(), aDelta.getX(), rA.getGreen(), aDelta.getY(), rA.getBlue(), aDelta.getZ()));
+ return (maColorInterpolators.size() - 1L);
+ }
+
+ sal_uInt32 addNormalInterpolator(const B3DVector& rA, const B3DVector& rB, double fInvYDelta)
+ {
+ B3DVector aDelta(rB.getX() - rA.getX(), rB.getY() - rA.getY(), rB.getZ() - rA.getZ());
+ aDelta *= fInvYDelta;
+ maNormalInterpolators.push_back(ip_triple(rA.getX(), aDelta.getX(), rA.getY(), aDelta.getY(), rA.getZ(), aDelta.getZ()));
+ return (maNormalInterpolators.size() - 1L);
+ }
+
+ sal_uInt32 addTextureInterpolator(const B2DPoint& rA, const B2DPoint& rB, double fInvYDelta)
+ {
+ B2DVector aDelta(rB.getX() - rA.getX(), rB.getY() - rA.getY());
+ aDelta *= fInvYDelta;
+ maTextureInterpolators.push_back(ip_double(rA.getX(), aDelta.getX(), rA.getY(), aDelta.getY()));
+ return (maTextureInterpolators.size() - 1L);
+ }
+
+ sal_uInt32 addInverseTextureInterpolator(const B2DPoint& rA, const B2DPoint& rB, double fZEyeA, double fZEyeB, double fInvYDelta)
+ {
+ const double fInvZEyeA(fTools::equalZero(fZEyeA) ? fZEyeA : 1.0 / fZEyeA);
+ const double fInvZEyeB(fTools::equalZero(fZEyeB) ? fZEyeB : 1.0 / fZEyeB);
+ const B2DPoint aInvA(rA * fInvZEyeA);
+ const B2DPoint aInvB(rB * fInvZEyeB);
+ double fZDelta(fInvZEyeB - fInvZEyeA);
+ B2DVector aDelta(aInvB.getX() - aInvA.getX(), aInvB.getY() - aInvA.getY());
+
+ fZDelta *= fInvYDelta;
+ aDelta *= fInvYDelta;
+
+ maInverseTextureInterpolators.push_back(ip_triple(aInvA.getX(), aDelta.getX(), aInvA.getY(), aDelta.getY(), fInvZEyeA, fZDelta));
+ return (maInverseTextureInterpolators.size() - 1L);
+ }
+
+ void reset()
+ {
+ maColorInterpolators.clear();
+ maNormalInterpolators.clear();
+ maTextureInterpolators.clear();
+ maInverseTextureInterpolators.clear();
+ }
+
+ public:
+ InterpolatorProvider3D() {}
+
+ ::std::vector< ip_triple >& getColorInterpolators() { return maColorInterpolators; }
+ ::std::vector< ip_triple >& getNormalInterpolators() { return maNormalInterpolators; }
+ ::std::vector< ip_double >& getTextureInterpolators() { return maTextureInterpolators; }
+ ::std::vector< ip_triple >& getInverseTextureInterpolators() { return maInverseTextureInterpolators; }
+ };
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+// RasterConversionLineEntry3D for Raterconversion of 3D PolyPolygons
+
+namespace basegfx
+{
+ class RasterConversionLineEntry3D
+ {
+ private:
+ ip_single maX;
+ ip_single maZ;
+ sal_Int32 mnY;
+ sal_uInt32 mnCount;
+
+ sal_uInt32 mnColorIndex;
+ sal_uInt32 mnNormalIndex;
+ sal_uInt32 mnTextureIndex;
+ sal_uInt32 mnInverseTextureIndex;
+
+ public:
+ RasterConversionLineEntry3D(const double& rfX, const double& rfDeltaX, const double& rfZ, const double& rfDeltaZ, sal_Int32 nY, sal_uInt32 nCount)
+ : maX(rfX, rfDeltaX),
+ maZ(rfZ, rfDeltaZ),
+ mnY(nY),
+ mnCount(nCount),
+ mnColorIndex(SCANLINE_EMPTY_INDEX),
+ mnNormalIndex(SCANLINE_EMPTY_INDEX),
+ mnTextureIndex(SCANLINE_EMPTY_INDEX),
+ mnInverseTextureIndex(SCANLINE_EMPTY_INDEX)
+ {}
+
+ void setColorIndex(sal_uInt32 nIndex) { mnColorIndex = nIndex; }
+ void setNormalIndex(sal_uInt32 nIndex) { mnNormalIndex = nIndex; }
+ void setTextureIndex(sal_uInt32 nIndex) { mnTextureIndex = nIndex; }
+ void setInverseTextureIndex(sal_uInt32 nIndex) { mnInverseTextureIndex = nIndex; }
+
+ bool operator<(const RasterConversionLineEntry3D& rComp) const
+ {
+ if(mnY == rComp.mnY)
+ {
+ return maX.getVal() < rComp.maX.getVal();
+ }
+
+ return mnY < rComp.mnY;
+ }
+
+ bool decrementRasterConversionLineEntry3D(sal_uInt32 nStep)
+ {
+ if(nStep >= mnCount)
+ {
+ return false;
+ }
+ else
+ {
+ mnCount -= nStep;
+ return true;
+ }
+ }
+
+ void incrementRasterConversionLineEntry3D(sal_uInt32 nStep, InterpolatorProvider3D& rProvider)
+ {
+ const double fStep((double)nStep);
+ maX.increment(fStep);
+ maZ.increment(fStep);
+ mnY += nStep;
+
+ if(SCANLINE_EMPTY_INDEX != mnColorIndex)
+ {
+ rProvider.getColorInterpolators()[mnColorIndex].increment(fStep);
+ }
+
+ if(SCANLINE_EMPTY_INDEX != mnNormalIndex)
+ {
+ rProvider.getNormalInterpolators()[mnNormalIndex].increment(fStep);
+ }
+
+ if(SCANLINE_EMPTY_INDEX != mnTextureIndex)
+ {
+ rProvider.getTextureInterpolators()[mnTextureIndex].increment(fStep);
+ }
+
+ if(SCANLINE_EMPTY_INDEX != mnInverseTextureIndex)
+ {
+ rProvider.getInverseTextureInterpolators()[mnInverseTextureIndex].increment(fStep);
+ }
+ }
+
+ // data read access
+ const ip_single& getX() const { return maX; }
+ sal_Int32 getY() const { return mnY; }
+ const ip_single& getZ() const { return maZ; }
+ sal_uInt32 getColorIndex() const { return mnColorIndex; }
+ sal_uInt32 getNormalIndex() const { return mnNormalIndex; }
+ sal_uInt32 getTextureIndex() const { return mnTextureIndex; }
+ sal_uInt32 getInverseTextureIndex() const { return mnInverseTextureIndex; }
+ };
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+// the basic RaterConverter itself. Only one method needs to be overloaded. The
+// class itself is strictly virtual
+
+namespace basegfx
+{
+ class BASEGFX_DLLPUBLIC RasterConverter3D : public InterpolatorProvider3D
+ {
+ private:
+ // the line entries for an area conversion run
+ ::std::vector< RasterConversionLineEntry3D > maLineEntries;
+
+ struct lineComparator
+ {
+ bool operator()(const RasterConversionLineEntry3D* pA, const RasterConversionLineEntry3D* pB)
+ {
+ OSL_ENSURE(pA && pB, "lineComparator: empty pointer (!)");
+ return pA->getX().getVal() < pB->getX().getVal();
+ }
+ };
+
+ void addArea(const B3DPolygon& rFill, const B3DHomMatrix* pViewToEye);
+ void addArea(const B3DPolyPolygon& rFill, const B3DHomMatrix* pViewToEye);
+ void addEdge(const B3DPolygon& rFill, sal_uInt32 a, sal_uInt32 b, const B3DHomMatrix* pViewToEye);
+
+ void rasterconvertB3DArea(sal_Int32 nStartLine, sal_Int32 nStopLine);
+ void rasterconvertB3DEdge(const B3DPolygon& rLine, sal_uInt32 nA, sal_uInt32 nB, sal_Int32 nStartLine, sal_Int32 nStopLine, sal_uInt16 nLineWidth);
+
+ virtual void processLineSpan(const RasterConversionLineEntry3D& rA, const RasterConversionLineEntry3D& rB, sal_Int32 nLine, sal_uInt32 nSpanCount) = 0;
+
+ public:
+ RasterConverter3D();
+ virtual ~RasterConverter3D();
+
+ void rasterconvertB3DPolyPolygon(const B3DPolyPolygon& rFill, const B3DHomMatrix* pViewToEye, sal_Int32 nStartLine, sal_Int32 nStopLine);
+ void rasterconvertB3DPolygon(const B3DPolygon& rLine, sal_Int32 nStartLine, sal_Int32 nStopLine, sal_uInt16 nLineWidth);
+ };
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif /* _BGFX_RASTER_RASTERCONVERT3D_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tools/b2dclipstate.hxx b/include/basegfx/tools/b2dclipstate.hxx
new file mode 100644
index 000000000000..f1d750ae636b
--- /dev/null
+++ b/include/basegfx/tools/b2dclipstate.hxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_TOOLS_CLIPSTATE_HXX
+#define _BGFX_TOOLS_CLIPSTATE_HXX
+
+#include <sal/types.h>
+#include <o3tl/cow_wrapper.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ class B2DRange;
+ class B2DPolyRange;
+ class B2DPolygon;
+ class B2DPolyPolygon;
+
+ namespace tools
+ {
+ class ImplB2DClipState;
+
+ /** This class provides an optimized, symbolic clip state for graphical output
+
+ Having a current 'clip' state is a common attribute of
+ almost all graphic output APIs, most of which internally
+ represent it via a list of rectangular bands. In contrast,
+ this implementation purely uses symbolic clips, but in a
+ quite efficient manner, deferring actual evaluation until
+ a clip representation is requested, and using faster code
+ paths for common special cases (like all-rectangle clips)
+ */
+ class BASEGFX_DLLPUBLIC B2DClipState
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImplB2DClipState > ImplType;
+
+ private:
+ ImplType mpImpl;
+
+ public:
+ /// Init clip, in 'cleared' state - everything is visible
+ B2DClipState();
+ ~B2DClipState();
+ B2DClipState( const B2DClipState& );
+ explicit B2DClipState( const B2DPolyPolygon& );
+ B2DClipState& operator=( const B2DClipState& );
+
+ /// Set clip to 'null' - nothing is visible
+ void makeNull();
+
+ /// returns true when clip is 'cleared' - everything is visible
+ bool isCleared() const;
+
+ bool operator==(const B2DClipState&) const;
+ bool operator!=(const B2DClipState&) const;
+
+ void unionRange(const B2DRange& );
+ void unionPolyPolygon(const B2DPolyPolygon& );
+
+ void intersectRange(const B2DRange& );
+ void intersectPolyPolygon(const B2DPolyPolygon& );
+
+ void subtractRange(const B2DRange& );
+ void subtractPolyPolygon(const B2DPolyPolygon& );
+
+ void xorRange(const B2DRange& );
+ void xorPolyPolygon(const B2DPolyPolygon& );
+
+ B2DPolyPolygon getClipPoly() const;
+ };
+ }
+}
+
+#endif // _BGFX_TOOLS_CLIPSTATE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tools/canvastools.hxx b/include/basegfx/tools/canvastools.hxx
new file mode 100644
index 000000000000..819a62e47b28
--- /dev/null
+++ b/include/basegfx/tools/canvastools.hxx
@@ -0,0 +1,205 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_TOOLS_CANVASTOOLS_HXX
+#define _BGFX_TOOLS_CANVASTOOLS_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+
+namespace com { namespace sun { namespace star { namespace geometry
+{
+ struct AffineMatrix2D;
+ struct AffineMatrix3D;
+ struct Matrix2D;
+ struct RealPoint2D;
+ struct RealSize2D;
+ struct RealRectangle2D;
+ struct RealRectangle3D;
+ struct IntegerPoint2D;
+ struct IntegerSize2D;
+ struct IntegerRectangle2D;
+ struct RealBezierSegment2D;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace rendering
+{
+ class XGraphicDevice;
+ class XPolyPolygon2D;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace awt
+{
+ struct Point;
+ struct Size;
+ struct Rectangle;
+} } } }
+
+namespace basegfx
+{
+ class B2DHomMatrix;
+ class B3DHomMatrix;
+ class B2DVector;
+ class B2DPoint;
+ class B2DRange;
+ class B3DRange;
+ class B2IBox;
+ class B2IVector;
+ class B2IPoint;
+ class B2IRange;
+ class B2DPolygon;
+ class B2DPolyPolygon;
+
+ namespace unotools
+ {
+ // Polygon conversions
+ // ===================================================================
+
+ BASEGFX_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >
+ xPolyPolygonFromB2DPolygon( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XGraphicDevice >& xGraphicDevice,
+ const ::basegfx::B2DPolygon& rPoly );
+
+ BASEGFX_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >
+ xPolyPolygonFromB2DPolyPolygon( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XGraphicDevice >& xGraphicDevice,
+ const ::basegfx::B2DPolyPolygon& rPolyPoly );
+
+
+ BASEGFX_DLLPUBLIC ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::geometry::RealBezierSegment2D > >
+ bezierSequenceSequenceFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly );
+
+ BASEGFX_DLLPUBLIC ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::geometry::RealPoint2D > >
+ pointSequenceSequenceFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly );
+
+ BASEGFX_DLLPUBLIC ::basegfx::B2DPolygon polygonFromPoint2DSequence(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::geometry::RealPoint2D >& rPoints );
+
+ BASEGFX_DLLPUBLIC ::basegfx::B2DPolyPolygon polyPolygonFromPoint2DSequenceSequence(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > >& rPoints );
+
+ BASEGFX_DLLPUBLIC ::basegfx::B2DPolygon polygonFromBezier2DSequence(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::geometry::RealBezierSegment2D >& rPoints );
+
+ BASEGFX_DLLPUBLIC ::basegfx::B2DPolyPolygon polyPolygonFromBezier2DSequenceSequence(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealBezierSegment2D > >& rPoints );
+
+ BASEGFX_DLLPUBLIC ::basegfx::B2DPolyPolygon b2DPolyPolygonFromXPolyPolygon2D(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XPolyPolygon2D >& rPoly );
+
+ // Matrix conversions
+ // ===================================================================
+
+ BASEGFX_DLLPUBLIC ::com::sun::star::geometry::AffineMatrix2D&
+ affineMatrixFromHomMatrix( ::com::sun::star::geometry::AffineMatrix2D& matrix,
+ const ::basegfx::B2DHomMatrix& transform);
+
+ BASEGFX_DLLPUBLIC ::com::sun::star::geometry::AffineMatrix3D& affineMatrixFromHomMatrix3D(
+ ::com::sun::star::geometry::AffineMatrix3D& matrix,
+ const ::basegfx::B3DHomMatrix& transform);
+
+ BASEGFX_DLLPUBLIC ::basegfx::B2DHomMatrix&
+ homMatrixFromAffineMatrix( ::basegfx::B2DHomMatrix& transform,
+ const ::com::sun::star::geometry::AffineMatrix2D& matrix );
+
+ BASEGFX_DLLPUBLIC ::basegfx::B3DHomMatrix homMatrixFromAffineMatrix3D( const ::com::sun::star::geometry::AffineMatrix3D& matrix );
+
+ BASEGFX_DLLPUBLIC ::com::sun::star::geometry::Matrix2D&
+ matrixFromHomMatrix( ::com::sun::star::geometry::Matrix2D& matrix,
+ const ::basegfx::B2DHomMatrix& transform);
+
+ BASEGFX_DLLPUBLIC ::basegfx::B2DHomMatrix&
+ homMatrixFromMatrix( ::basegfx::B2DHomMatrix& transform,
+ const ::com::sun::star::geometry::Matrix2D& matrix );
+
+ // Geometry conversions
+ // ===================================================================
+
+ BASEGFX_DLLPUBLIC ::com::sun::star::geometry::RealSize2D size2DFromB2DSize( const ::basegfx::B2DVector& );
+ BASEGFX_DLLPUBLIC ::com::sun::star::geometry::RealPoint2D point2DFromB2DPoint( const ::basegfx::B2DPoint& );
+ BASEGFX_DLLPUBLIC ::com::sun::star::geometry::RealRectangle2D rectangle2DFromB2DRectangle( const ::basegfx::B2DRange& );
+ BASEGFX_DLLPUBLIC ::com::sun::star::geometry::RealRectangle3D rectangle3DFromB3DRectangle( const ::basegfx::B3DRange& );
+
+ BASEGFX_DLLPUBLIC ::basegfx::B2DPoint b2DPointFromRealPoint2D( const ::com::sun::star::geometry::RealPoint2D& );
+ BASEGFX_DLLPUBLIC ::basegfx::B2DRange b2DRectangleFromRealRectangle2D( const ::com::sun::star::geometry::RealRectangle2D& );
+ BASEGFX_DLLPUBLIC ::basegfx::B3DRange b3DRectangleFromRealRectangle3D( const ::com::sun::star::geometry::RealRectangle3D& );
+
+ BASEGFX_DLLPUBLIC ::com::sun::star::geometry::IntegerSize2D integerSize2DFromB2ISize( const ::basegfx::B2IVector& );
+
+ BASEGFX_DLLPUBLIC ::basegfx::B2IVector b2ISizeFromIntegerSize2D( const ::com::sun::star::geometry::IntegerSize2D& );
+ BASEGFX_DLLPUBLIC ::basegfx::B2IRange b2IRectangleFromIntegerRectangle2D( const ::com::sun::star::geometry::IntegerRectangle2D& );
+
+ BASEGFX_DLLPUBLIC ::basegfx::B2IRange b2IRectangleFromAwtRectangle( const ::com::sun::star::awt::Rectangle& );
+
+ // Geometry comparisons
+ // ===================================================================
+
+ /** Return smalltest integer range, which completely contains
+ given floating point range.
+
+ @param rRange
+ Input range. Values must be within the representable
+ bounds of sal_Int32
+
+ @return the closest integer range, which completely
+ contains rRange.
+ */
+ BASEGFX_DLLPUBLIC ::basegfx::B2IRange b2ISurroundingRangeFromB2DRange( const ::basegfx::B2DRange& rRange );
+
+ /** Return smalltest integer box, which completely contains
+ given floating point range.
+
+ @param rRange
+ Input range. Values must be within the representable
+ bounds of sal_Int32
+
+ @return the closest integer box, which completely contains
+ rRange. Note that this box will contain all pixel affected
+ by a polygon fill operation over the input range.
+ */
+ BASEGFX_DLLPUBLIC ::basegfx::B2IBox b2ISurroundingBoxFromB2DRange( const ::basegfx::B2DRange& rRange );
+
+ /** Return smalltest B2DRange with integer values, which
+ completely contains given floating point range.
+
+ @param rRange
+ Input range.
+
+ @return the closest B2DRange with integer coordinates,
+ which completely contains rRange.
+ */
+ BASEGFX_DLLPUBLIC ::basegfx::B2DRange b2DSurroundingIntegerRangeFromB2DRange( const ::basegfx::B2DRange& rRange );
+
+ }
+}
+
+#endif /* _BGFX_TOOLS_CANVASTOOLS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tools/gradienttools.hxx b/include/basegfx/tools/gradienttools.hxx
new file mode 100644
index 000000000000..aa7479d2c369
--- /dev/null
+++ b/include/basegfx/tools/gradienttools.hxx
@@ -0,0 +1,405 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_TOOLS_GRADIENTTOOLS_HXX
+#define _BGFX_TOOLS_GRADIENTTOOLS_HXX
+
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/numeric/ftools.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+#include <vector>
+#include <algorithm>
+
+namespace basegfx
+{
+ /** Gradient definition as used in ODF 1.2
+
+ This struct collects all data necessary for rendering ODF
+ 1.2-compatible gradients. Use the createXXXODFGradientInfo()
+ methods below for initializing from ODF attributes.
+ */
+ struct BASEGFX_DLLPUBLIC ODFGradientInfo
+ {
+ /** transformation mapping from [0,1]^2 texture coordinate
+ space to [0,1]^2 shape coordinate space
+ */
+ B2DHomMatrix maTextureTransform;
+
+ /** transformation mapping from [0,1]^2 shape coordinate space
+ to [0,1]^2 texture coordinate space. This is the
+ transformation commonly used to create gradients from a
+ scanline rasterizer (put shape u/v coordinates into it, get
+ texture s/t coordinates out of it)
+ */
+ B2DHomMatrix maBackTextureTransform;
+
+ /** Aspect ratio of the gradient. Only used in drawinglayer
+ for generating nested gradient polygons currently. Already
+ catered for in the transformations above.
+ */
+ double mfAspectRatio;
+
+ /** Requested gradient steps to render. See the
+ implementations of the getXXXGradientAlpha() methods below,
+ the semantic differs slightly for the different gradient
+ types.
+ */
+ sal_uInt32 mnSteps;
+ };
+
+ namespace tools
+ {
+ /** Create matrix for ODF's linear gradient definition
+
+ Note that odf linear gradients are varying in y direction.
+
+ @param o_rGradientInfo
+ Receives the calculated texture transformation matrix (for
+ use with standard [0,1]x[0,1] texture coordinates)
+
+ @param rTargetArea
+ Output area, needed for aspect ratio calculations and
+ texture transformation
+
+ @param nSteps
+ Number of gradient steps (from ODF)
+
+ @param fBorder
+ Width of gradient border (from ODF)
+
+ @param fAngle
+ Gradient angle (from ODF)
+ */
+ BASEGFX_DLLPUBLIC ODFGradientInfo& createLinearODFGradientInfo(ODFGradientInfo& o_rGradientInfo,
+ const B2DRange& rTargetArea,
+ sal_uInt32 nSteps,
+ double fBorder,
+ double fAngle);
+
+ /** Calculate linear gradient blend value
+
+ This method generates you the lerp alpha value for
+ blending linearly between gradient start and end color,
+ according to the formula (startCol*(1.0-alpha) + endCol*alpha)
+
+ @param rUV
+ Current uv coordinate. Values outside [0,1] will be
+ clamped. Assumes gradient color varies along the y axis.
+
+ @param rGradInfo
+ Gradient info, for transformation and number of steps
+ */
+ inline double getLinearGradientAlpha(const B2DPoint& rUV,
+ const ODFGradientInfo& rGradInfo )
+ {
+ const B2DPoint aCoor(rGradInfo.maBackTextureTransform * rUV);
+ const double t(clamp(aCoor.getY(), 0.0, 1.0));
+ const sal_uInt32 nSteps(rGradInfo.mnSteps);
+
+ if(nSteps > 2L && nSteps < 128L)
+ return floor(t * nSteps) / double(nSteps + 1L);
+
+ return t;
+ }
+
+ /** Create matrix for ODF's axial gradient definition
+
+ Note that odf axial gradients are varying in y
+ direction. Note further that you can map the axial
+ gradient to a linear gradient (in case you want or need to
+ avoid an extra gradient renderer), by using
+ createLinearODFGradientInfo() instead, shifting the
+ resulting texture transformation by 0.5 to the top and
+ appending the same stop colors again, but mirrored.
+
+ @param o_rGradientInfo
+ Receives the calculated texture transformation matrix (for
+ use with standard [0,1]x[0,1] texture coordinates)
+
+ @param rTargetArea
+ Output area, needed for aspect ratio calculations and
+ texture transformation
+
+ @param nSteps
+ Number of gradient steps (from ODF)
+
+ @param fBorder
+ Width of gradient border (from ODF)
+
+ @param fAngle
+ Gradient angle (from ODF)
+ */
+ BASEGFX_DLLPUBLIC ODFGradientInfo& createAxialODFGradientInfo(ODFGradientInfo& o_rGradientInfo,
+ const B2DRange& rTargetArea,
+ sal_uInt32 nSteps,
+ double fBorder,
+ double fAngle);
+
+ /** Calculate axial gradient blend value
+
+ This method generates you the lerp alpha value for
+ blending linearly between gradient start and end color,
+ according to the formula (startCol*(1.0-alpha) + endCol*alpha)
+
+ @param rUV
+ Current uv coordinate. Values outside [0,1] will be
+ clamped. Assumes gradient color varies along the y axis.
+
+ @param rGradInfo
+ Gradient info, for transformation and number of steps
+ */
+ inline double getAxialGradientAlpha(const B2DPoint& rUV,
+ const ODFGradientInfo& rGradInfo )
+ {
+ const B2DPoint aCoor(rGradInfo.maBackTextureTransform * rUV);
+ const double t(clamp(fabs(aCoor.getY()), 0.0, 1.0));
+ const sal_uInt32 nSteps(rGradInfo.mnSteps);
+ const double fInternalSteps((nSteps * 2L) - 1L);
+
+ if(nSteps > 2L && nSteps < 128L)
+ return floor(((t * fInternalSteps) + 1.0) / 2.0) / double(nSteps - 1L);
+
+ return t;
+ }
+
+ /** Create matrix for ODF's radial gradient definition
+
+ @param o_rGradientInfo
+ Receives the calculated texture transformation matrix (for
+ use with standard [0,1]x[0,1] texture coordinates)
+
+ @param rTargetArea
+ Output area, needed for aspect ratio calculations and
+ texture transformation
+
+ @param rOffset
+ Gradient offset value (from ODF)
+
+ @param nSteps
+ Number of gradient steps (from ODF)
+
+ @param fBorder
+ Width of gradient border (from ODF)
+
+ @param fAngle
+ Gradient angle (from ODF)
+ */
+ BASEGFX_DLLPUBLIC ODFGradientInfo& createRadialODFGradientInfo(ODFGradientInfo& o_rGradientInfo,
+ const B2DRange& rTargetArea,
+ const B2DVector& rOffset,
+ sal_uInt32 nSteps,
+ double fBorder);
+
+ /** Calculate radial gradient blend value
+
+ This method generates you the lerp alpha value for
+ blending linearly between gradient start and end color,
+ according to the formula (startCol*(1.0-alpha) + endCol*alpha)
+
+ @param rUV
+ Current uv coordinate. Values outside [0,1] will be
+ clamped.
+
+ @param rGradInfo
+ Gradient info, for transformation and number of steps
+ */
+ inline double getRadialGradientAlpha(const B2DPoint& rUV,
+ const ODFGradientInfo& rGradInfo )
+ {
+ const B2DPoint aCoor(rGradInfo.maBackTextureTransform * rUV);
+ const double fDist(
+ clamp(aCoor.getX() * aCoor.getX() + aCoor.getY() * aCoor.getY(),
+ 0.0,
+ 1.0));
+
+ const double t(1.0 - sqrt(fDist));
+ const sal_uInt32 nSteps(rGradInfo.mnSteps);
+
+ if(nSteps > 2L && nSteps < 128L)
+ return floor(t * nSteps) / double(nSteps - 1L);
+
+ return t;
+ }
+
+ /** Create matrix for ODF's elliptical gradient definition
+
+ @param o_rGradientInfo
+ Receives the calculated texture transformation matrix (for
+ use with standard [0,1]x[0,1] texture coordinates)
+
+ @param rTargetArea
+ Output area, needed for aspect ratio calculations and
+ texture transformation
+
+ @param rOffset
+ Gradient offset value (from ODF)
+
+ @param nSteps
+ Number of gradient steps (from ODF)
+
+ @param fBorder
+ Width of gradient border (from ODF)
+
+ @param fAngle
+ Gradient angle (from ODF)
+ */
+ BASEGFX_DLLPUBLIC ODFGradientInfo& createEllipticalODFGradientInfo(ODFGradientInfo& o_rGradientInfo,
+ const B2DRange& rTargetArea,
+ const B2DVector& rOffset,
+ sal_uInt32 nSteps,
+ double fBorder,
+ double fAngle);
+
+ /** Calculate elliptical gradient blend value
+
+ This method generates you the lerp alpha value for
+ blending linearly between gradient start and end color,
+ according to the formula (startCol*(1.0-alpha) + endCol*alpha)
+
+ @param rUV
+ Current uv coordinate. Values outside [0,1] will be
+ clamped.
+
+ @param rGradInfo
+ Gradient info, for transformation and number of steps
+ */
+ inline double getEllipticalGradientAlpha(const B2DPoint& rUV,
+ const ODFGradientInfo& rGradInfo )
+ {
+ return getRadialGradientAlpha(rUV,rGradInfo); // only matrix setup differs
+ }
+
+ /** Create matrix for ODF's square gradient definition
+
+ @param o_rGradientInfo
+ Receives the calculated texture transformation matrix (for
+ use with standard [0,1]x[0,1] texture coordinates)
+
+ @param rTargetArea
+ Output area, needed for aspect ratio calculations and
+ texture transformation
+
+ @param rOffset
+ Gradient offset value (from ODF)
+
+ @param nSteps
+ Number of gradient steps (from ODF)
+
+ @param fBorder
+ Width of gradient border (from ODF)
+
+ @param fAngle
+ Gradient angle (from ODF)
+ */
+ BASEGFX_DLLPUBLIC ODFGradientInfo& createSquareODFGradientInfo(ODFGradientInfo& o_rGradientInfo,
+ const B2DRange& rTargetArea,
+ const B2DVector& rOffset,
+ sal_uInt32 nSteps,
+ double fBorder,
+ double fAngle);
+
+ /** Calculate square gradient blend value
+
+ This method generates you the lerp alpha value for
+ blending linearly between gradient start and end color,
+ according to the formula (startCol*(1.0-alpha) + endCol*alpha)
+
+ @param rUV
+ Current uv coordinate. Values outside [0,1] will be
+ clamped.
+
+ @param rGradInfo
+ Gradient info, for transformation and number of steps
+ */
+ inline double getSquareGradientAlpha(const B2DPoint& rUV,
+ const ODFGradientInfo& rGradInfo )
+ {
+ const B2DPoint aCoor(rGradInfo.maBackTextureTransform * rUV);
+ const double fAbsX(fabs(aCoor.getX()));
+ const double fAbsY(fabs(aCoor.getY()));
+
+ if(fTools::moreOrEqual(fAbsX, 1.0) || fTools::moreOrEqual(fAbsY, 1.0))
+ return 0.0;
+
+ const double t(1.0 - (fAbsX > fAbsY ? fAbsX : fAbsY));
+ const sal_uInt32 nSteps(rGradInfo.mnSteps);
+
+ if(nSteps > 2L && nSteps < 128L)
+ return floor(t * nSteps) / double(nSteps - 1L);
+
+ return t;
+ }
+
+ /** Create matrix for ODF's rectangular gradient definition
+
+ @param o_rGradientInfo
+ Receives the calculated texture transformation matrix (for
+ use with standard [0,1]x[0,1] texture coordinates)
+
+ @param rTargetArea
+ Output area, needed for aspect ratio calculations and
+ texture transformation
+
+ @param rOffset
+ Gradient offset value (from ODF)
+
+ @param nSteps
+ Number of gradient steps (from ODF)
+
+ @param fBorder
+ Width of gradient border (from ODF)
+
+ @param fAngle
+ Gradient angle (from ODF)
+ */
+ BASEGFX_DLLPUBLIC ODFGradientInfo& createRectangularODFGradientInfo(ODFGradientInfo& o_rGradientInfo,
+ const B2DRange& rTargetArea,
+ const B2DVector& rOffset,
+ sal_uInt32 nSteps,
+ double fBorder,
+ double fAngle);
+
+ /** Calculate rectangular gradient blend value
+
+ This method generates you the lerp alpha value for
+ blending linearly between gradient start and end color,
+ according to the formula (startCol*(1.0-alpha) + endCol*alpha)
+
+ @param rUV
+ Current uv coordinate. Values outside [0,1] will be
+ clamped.
+
+ @param rGradInfo
+ Gradient info, for transformation and number of steps
+ */
+ inline double getRectangularGradientAlpha(const B2DPoint& rUV,
+ const ODFGradientInfo& rGradInfo )
+ {
+ return getSquareGradientAlpha(rUV, rGradInfo); // only matrix setup differs
+ }
+ }
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tools/keystoplerp.hxx b/include/basegfx/tools/keystoplerp.hxx
new file mode 100644
index 000000000000..8d6d41af63d9
--- /dev/null
+++ b/include/basegfx/tools/keystoplerp.hxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_TOOLS_KEYSTOPLERP_HXX
+#define _BGFX_TOOLS_KEYSTOPLERP_HXX
+
+#include <basegfx/numeric/ftools.hxx>
+#include <vector>
+#include <basegfx/basegfxdllapi.h>
+
+namespace com{ namespace sun{ namespace star{ namespace uno {
+ template<typename T> class Sequence;
+}}}}
+
+namespace basegfx
+{
+ namespace tools
+ {
+ /** Lerp in a vector of key stops
+
+ This class holds a key stop vector and provides the
+ functionality to lerp inside it. Useful e.g. for
+ multi-stop gradients, or the SMIL key time activity.
+
+ For those, given a global [0,1] lerp alpha, one need to
+ find the suitable bucket index from key stop vector, and
+ then calculate the relative alpha between the two buckets
+ found.
+ */
+ class BASEGFX_DLLPUBLIC KeyStopLerp
+ {
+ public:
+ typedef std::pair<std::ptrdiff_t,double> ResultType;
+
+ /** Create lerper with given vector of stops
+
+ @param rKeyStops
+
+ Vector of stops, must contain at least two elements
+ (though preferrably more, otherwise you probably don't
+ need key stop lerping in the first place). All
+ elements must be of monotonically increasing value.
+ */
+ explicit KeyStopLerp( const std::vector<double>& rKeyStops );
+
+ /** Create lerper with given sequence of stops
+
+ @param rKeyStops
+
+ Sequence of stops, must contain at least two elements
+ (though preferrably more, otherwise you probably don't
+ need key stop lerping in the first place). All
+ elements must be of monotonically increasing value.
+ */
+ explicit KeyStopLerp( const ::com::sun::star::uno::Sequence<double>& rKeyStops );
+
+ /** Find two nearest bucket index & interpolate
+
+ @param fAlpha
+ Find bucket index i, with keyStops[i] < fAlpha <=
+ keyStops[i+1]. Return new alpha value in [0,1),
+ proportional to fAlpha's position between keyStops[i]
+ and keyStops[i+1]
+ */
+ ResultType lerp(double fAlpha) const;
+
+ private:
+ std::vector<double> maKeyStops;
+ mutable std::ptrdiff_t mnLastIndex;
+ };
+ }
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tools/lerp.hxx b/include/basegfx/tools/lerp.hxx
new file mode 100644
index 000000000000..a0c0d714a295
--- /dev/null
+++ b/include/basegfx/tools/lerp.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_TOOLS_LERP_HXX
+#define _BGFX_TOOLS_LERP_HXX
+
+#include <sal/types.h>
+
+namespace basegfx
+{
+ namespace tools
+ {
+ /** Generic linear interpolator
+
+ @tpl ValueType
+ Must have operator+ and operator* defined, and should
+ have value semantics.
+
+ @param t
+ As usual, t must be in the [0,1] range
+ */
+ template< typename ValueType > ValueType lerp( const ValueType& rFrom,
+ const ValueType& rTo,
+ double t )
+ {
+ // This is only to suppress a double->int warning. All other
+ // types should be okay here.
+ return static_cast<ValueType>( (1.0-t)*rFrom + t*rTo );
+ }
+ }
+}
+
+#endif /* _BGFX_TOOLS_LERP_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tools/rectcliptools.hxx b/include/basegfx/tools/rectcliptools.hxx
new file mode 100644
index 000000000000..3d5f77e18e0e
--- /dev/null
+++ b/include/basegfx/tools/rectcliptools.hxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_TOOLS_RECTCLIPTOOLS_HXX
+#define _BGFX_TOOLS_RECTCLIPTOOLS_HXX
+
+#include <sal/types.h>
+#include <basegfx/range/b2ibox.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ namespace tools
+ {
+ namespace RectClipFlags
+ {
+ static const sal_uInt32 LEFT = (sal_Int32)0x01;
+ static const sal_uInt32 RIGHT = (sal_Int32)0x02;
+ static const sal_uInt32 TOP = (sal_Int32)0x04;
+ static const sal_uInt32 BOTTOM = (sal_Int32)0x08;
+ }
+
+ /** Calc clip mask for Cohen-Sutherland rectangle clip
+
+ This function returns a clip mask used for the
+ Cohen-Sutherland rectangle clip method, where one or more
+ of the lower four bits are set, if the given point is
+ outside one or more of the four half planes defining the
+ rectangle (see RectClipFlags for possible values)
+ */
+ template< class Point, class Rect > inline
+ sal_uInt32 getCohenSutherlandClipFlags( const Point& rP,
+ const Rect& rR )
+ {
+ // maxY | minY | maxX | minX
+ sal_uInt32 clip = (rP.getX() < rR.getMinX()) << 0;
+ clip |= (rP.getX() > rR.getMaxX()) << 1;
+ clip |= (rP.getY() < rR.getMinY()) << 2;
+ clip |= (rP.getY() > rR.getMaxY()) << 3;
+ return clip;
+ }
+
+ /// Cohen-Sutherland mask calculation - overload for boxes.
+ template< class Point > inline
+ sal_uInt32 getCohenSutherlandClipFlags( const Point& rP,
+ const B2IBox& rB )
+ {
+ // maxY | minY | maxX | minX
+ sal_uInt32 clip = (rP.getX() < rB.getMinX()) << 0;
+ clip |= (rP.getX() >= rB.getMaxX()) << 1;
+ clip |= (rP.getY() < rB.getMinY()) << 2;
+ clip |= (rP.getY() >= rB.getMaxY()) << 3;
+ return clip;
+ }
+
+ /** Determine number of clip planes hit by given clip mask
+
+ This method returns the number of one bits in the four
+ least significant bits of the argument, which amounts to
+ the number of clip planes hit within the
+ getCohenSutherlandClipFlags() method.
+ */
+ inline sal_uInt32 getNumberOfClipPlanes( sal_uInt32 nFlags )
+ {
+ // classic bit count algo, see e.g. Reingold, Nievergelt,
+ // Deo: Combinatorial Algorithms, Theory and Practice,
+ // Prentice-Hall 1977
+ nFlags = (nFlags & 0x05) + ((nFlags >> 1) & 0x05);
+ nFlags = (nFlags & 0x03) + (nFlags >> 2); // no need for &
+ // 0x03, can't
+ // overflow
+ return nFlags;
+ }
+ }
+}
+
+#endif // _BGFX_TOOLS_RECTCLIPTOOLS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tools/tools.hxx b/include/basegfx/tools/tools.hxx
new file mode 100644
index 000000000000..c1fa0940ae35
--- /dev/null
+++ b/include/basegfx/tools/tools.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_TOOLS_TOOLS_HXX
+#define _BGFX_TOOLS_TOOLS_HXX
+
+#include <sal/types.h>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ class B2DPoint;
+ class B2DRange;
+
+ namespace tools
+ {
+ /** Expand given parallelogram, such that it extends beyond
+ bound rect in a given direction.
+
+ This method is useful when e.g. generating one-dimensional
+ gradients, such as linear or axial gradients: those
+ gradients vary only in one direction, the other has
+ constant color. Most of the time, those gradients extends
+ infinitely in the direction with the constant color, but
+ practically, one always has a limiting bound rect into
+ which the gradient is painted. The method at hand now
+ extends a given parallelogram (e.g. the transformed
+ bounding box of a gradient) virtually into infinity to the
+ top and to the bottom (i.e. normal to the line io_rLeftTop
+ io_rRightTop), such that the given rectangle is guaranteed
+ to be covered in that direction.
+
+ @attention There might be some peculiarities with this
+ method, that might limit its usage to the described
+ gradients. One of them is the fact that when determining
+ how far the parallelogram has to be extended to the top or
+ the bottom, the upper and lower border are assumed to be
+ infinite lines.
+
+ @param io_rLeftTop
+ Left, top edge of the parallelogramm. Note that this need
+ not be the left, top edge geometrically, it's just used
+ when determining the extension direction. Thus, it's
+ perfectly legal to affine-transform a rectangle, and given
+ the transformed point here. On method return, this
+ parameter will contain the adapted output.
+
+ @param io_rLeftBottom
+ Left, bottom edge of the parallelogramm. Note that this need
+ not be the left, bottom edge geometrically, it's just used
+ when determining the extension direction. Thus, it's
+ perfectly legal to affine-transform a rectangle, and given
+ the transformed point here. On method return, this
+ parameter will contain the adapted output.
+
+ @param io_rRightTop
+ Right, top edge of the parallelogramm. Note that this need
+ not be the right, top edge geometrically, it's just used
+ when determining the extension direction. Thus, it's
+ perfectly legal to affine-transform a rectangle, and given
+ the transformed point here. On method return, this
+ parameter will contain the adapted output.
+
+ @param io_rRightBottom
+ Right, bottom edge of the parallelogramm. Note that this need
+ not be the right, bottom edge geometrically, it's just used
+ when determining the extension direction. Thus, it's
+ perfectly legal to affine-transform a rectangle, and given
+ the transformed point here. On method return, this
+ parameter will contain the adapted output.
+
+ @param rFitTarget
+ The rectangle to fit the parallelogram into.
+ */
+ BASEGFX_DLLPUBLIC void infiniteLineFromParallelogram( ::basegfx::B2DPoint& io_rLeftTop,
+ ::basegfx::B2DPoint& io_rLeftBottom,
+ ::basegfx::B2DPoint& io_rRightTop,
+ ::basegfx::B2DPoint& io_rRightBottom,
+ const ::basegfx::B2DRange& rFitTarget );
+
+ }
+}
+
+#endif /* _BGFX_TOOLS_TOOLS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tools/unopolypolygon.hxx b/include/basegfx/tools/unopolypolygon.hxx
new file mode 100644
index 000000000000..72ed9418663a
--- /dev/null
+++ b/include/basegfx/tools/unopolypolygon.hxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEGFX_UNOPOLYPOLYGON_HXX
+#define INCLUDED_BASEGFX_UNOPOLYPOLYGON_HXX
+
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/compbase3.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/rendering/FillRule.hpp>
+#include <com/sun/star/rendering/XLinePolyPolygon2D.hpp>
+#include <com/sun/star/rendering/XBezierPolyPolygon2D.hpp>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/basegfxdllapi.h>
+#include <boost/utility.hpp>
+
+
+namespace basegfx
+{
+namespace unotools
+{
+ typedef ::cppu::WeakComponentImplHelper3<
+ ::com::sun::star::rendering::XLinePolyPolygon2D,
+ ::com::sun::star::rendering::XBezierPolyPolygon2D,
+ ::com::sun::star::lang::XServiceInfo > UnoPolyPolygonBase;
+
+ class BASEGFX_DLLPUBLIC UnoPolyPolygon
+ : private cppu::BaseMutex
+ , private boost::noncopyable
+ , public UnoPolyPolygonBase
+ {
+ public:
+ explicit UnoPolyPolygon( const B2DPolyPolygon& );
+
+ // XPolyPolygon2D
+ virtual void SAL_CALL addPolyPolygon( const ::com::sun::star::geometry::RealPoint2D& position, const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& polyPolygon ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getNumberOfPolygons( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getNumberOfPolygonPoints( ::sal_Int32 polygon ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::rendering::FillRule SAL_CALL getFillRule( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setFillRule( ::com::sun::star::rendering::FillRule fillRule ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isClosed( ::sal_Int32 index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setClosed( ::sal_Int32 index, ::sal_Bool closedState ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XLinePolyPolygon2D
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > > SAL_CALL getPoints( ::sal_Int32 nPolygonIndex, ::sal_Int32 nNumberOfPolygons, ::sal_Int32 nPointIndex, ::sal_Int32 nNumberOfPoints ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPoints( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > >& points, ::sal_Int32 nPolygonIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::geometry::RealPoint2D SAL_CALL getPoint( ::sal_Int32 nPolygonIndex, ::sal_Int32 nPointIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPoint( const ::com::sun::star::geometry::RealPoint2D& point, ::sal_Int32 nPolygonIndex, ::sal_Int32 nPointIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XBezierPolyPolygon2D
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealBezierSegment2D > > SAL_CALL getBezierSegments( ::sal_Int32 nPolygonIndex, ::sal_Int32 nNumberOfPolygons, ::sal_Int32 nPointIndex, ::sal_Int32 nNumberOfPoints ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setBezierSegments( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealBezierSegment2D > >& points, ::sal_Int32 nPolygonIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::geometry::RealBezierSegment2D SAL_CALL getBezierSegment( ::sal_Int32 nPolygonIndex, ::sal_Int32 nPointIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setBezierSegment( const ::com::sun::star::geometry::RealBezierSegment2D& point, ::sal_Int32 nPolygonIndex, ::sal_Int32 nPointIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
+
+ B2DPolyPolygon getPolyPolygon() const;
+
+ protected:
+ /// Check whether index is a valid polygon index
+ void checkIndex( sal_Int32 nIndex ) const // throw (::com::sun::star::lang::IndexOutOfBoundsException);
+ {
+ if( nIndex < 0 || nIndex >= static_cast<sal_Int32>(maPolyPoly.count()) )
+ throw ::com::sun::star::lang::IndexOutOfBoundsException();
+ }
+
+ B2DPolyPolygon getSubsetPolyPolygon( sal_Int32 nPolygonIndex,
+ sal_Int32 nNumberOfPolygons,
+ sal_Int32 nPointIndex,
+ sal_Int32 nNumberOfPoints ) const;
+
+ /// Get cow copy of internal polygon. not thread-safe outside this object.
+ B2DPolyPolygon getPolyPolygonUnsafe() const
+ {
+ return maPolyPoly;
+ }
+
+ /// Called whenever internal polypolygon gets modified
+ virtual void modifying() const {}
+
+ private:
+ B2DPolyPolygon maPolyPoly;
+ ::com::sun::star::rendering::FillRule meFillRule;
+ };
+}
+}
+
+#endif /* INCLUDED_BASEGFX_UNOPOLYPOLYGON_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tools/unotools.hxx b/include/basegfx/tools/unotools.hxx
new file mode 100644
index 000000000000..c95eb5361f5c
--- /dev/null
+++ b/include/basegfx/tools/unotools.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_BASEGFX_UNOTOOLS_HXX
+#define INCLUDED_BASEGFX_UNOTOOLS_HXX
+
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/compbase3.hxx>
+#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/rendering/FillRule.hpp>
+#include <com/sun/star/rendering/XLinePolyPolygon2D.hpp>
+#include <com/sun/star/rendering/XBezierPolyPolygon2D.hpp>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+
+namespace basegfx
+{
+class B2DPolyPolygon;
+
+namespace unotools
+{
+
+ BASEGFX_DLLPUBLIC B2DPolyPolygon polyPolygonBezierToB2DPolyPolygon(const ::com::sun::star::drawing::PolyPolygonBezierCoords& rSourcePolyPolygon)
+ throw( ::com::sun::star::lang::IllegalArgumentException );
+
+ BASEGFX_DLLPUBLIC void b2DPolyPolygonToPolyPolygonBezier( const B2DPolyPolygon& rPolyPoly,
+ ::com::sun::star::drawing::PolyPolygonBezierCoords& rRetval );
+}
+}
+
+#endif /* INCLUDED_BASEGFX_UNOTOOLS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tools/zoomtools.hxx b/include/basegfx/tools/zoomtools.hxx
new file mode 100644
index 000000000000..44d9052a2552
--- /dev/null
+++ b/include/basegfx/tools/zoomtools.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Tim Hardeck <thardeck@suse.com>
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#ifndef _BGFX_TOOLS_ZOOMTOOLS_HXX
+#define _BGFX_TOOLS_ZOOMTOOLS_HXX
+
+#include <sal/types.h>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ /** This namespace provides functions for optimized geometric zooming
+ */
+ namespace zoomtools
+ {
+ BASEGFX_DLLPUBLIC long zoomOut(long nCurrent);
+ BASEGFX_DLLPUBLIC long zoomIn(long nCurrent);
+ }
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tuple/b2dtuple.hxx b/include/basegfx/tuple/b2dtuple.hxx
new file mode 100644
index 000000000000..380ba8adf493
--- /dev/null
+++ b/include/basegfx/tuple/b2dtuple.hxx
@@ -0,0 +1,352 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_TUPLE_B2DTUPLE_HXX
+#define _BGFX_TUPLE_B2DTUPLE_HXX
+
+#include <sal/types.h>
+#include <basegfx/numeric/ftools.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ // predeclarations
+ class B2ITuple;
+
+ /** Base class for all Points/Vectors with two double values
+
+ This class provides all methods common to Point
+ avd Vector classes which are derived from here.
+
+ @derive Use this class to implement Points or Vectors
+ which are based on two double values
+ */
+ class SAL_WARN_UNUSED B2DTuple
+ {
+ protected:
+ double mfX;
+ double mfY;
+
+ public:
+ /** Create a 2D Tuple
+
+ The tuple is initialized to (0.0, 0.0)
+ */
+ B2DTuple()
+ : mfX(0.0),
+ mfY(0.0)
+ {}
+
+ /** Create a 2D Tuple
+
+ @param fX
+ This parameter is used to initialize the X-coordinate
+ of the 2D Tuple.
+
+ @param fY
+ This parameter is used to initialize the Y-coordinate
+ of the 2D Tuple.
+ */
+ B2DTuple(double fX, double fY)
+ : mfX( fX ),
+ mfY( fY )
+ {}
+
+ /** Create a copy of a 2D Tuple
+
+ @param rTup
+ The 2D Tuple which will be copied.
+ */
+ B2DTuple(const B2DTuple& rTup)
+ : mfX( rTup.mfX ),
+ mfY( rTup.mfY )
+ {}
+
+ /** Create a copy of a 2D integer Tuple
+
+ @param rTup
+ The 2D Tuple which will be copied.
+ */
+ BASEGFX_DLLPUBLIC explicit B2DTuple(const B2ITuple& rTup);
+
+ ~B2DTuple()
+ {}
+
+ /// Get X-Coordinate of 2D Tuple
+ double getX() const
+ {
+ return mfX;
+ }
+
+ /// Get Y-Coordinate of 2D Tuple
+ double getY() const
+ {
+ return mfY;
+ }
+
+ /// Set X-Coordinate of 2D Tuple
+ void setX(double fX)
+ {
+ mfX = fX;
+ }
+
+ /// Set Y-Coordinate of 2D Tuple
+ void setY(double fY)
+ {
+ mfY = fY;
+ }
+
+ /// Array-access to 2D Tuple
+ const double& operator[] (int nPos) const
+ {
+ // Here, normally one if(...) should be used. In the assumption that
+ // both double members can be accessed as an array a shortcut is used here.
+ // if(0 == nPos) return mfX; return mfY;
+ return *((&mfX) + nPos);
+ }
+
+ /// Array-access to 2D Tuple
+ double& operator[] (int nPos)
+ {
+ // Here, normally one if(...) should be used. In the assumption that
+ // both double members can be accessed as an array a shortcut is used here.
+ // if(0 == nPos) return mfX; return mfY;
+ return *((&mfX) + nPos);
+ }
+
+ // comparators with tolerance
+ //////////////////////////////////////////////////////////////////////
+
+ bool equalZero() const
+ {
+ return (this == &getEmptyTuple() ||
+ (fTools::equalZero(mfX) && fTools::equalZero(mfY)));
+ }
+
+ bool equalZero(const double& rfSmallValue) const
+ {
+ return (this == &getEmptyTuple() ||
+ (fTools::equalZero(mfX, rfSmallValue) && fTools::equalZero(mfY, rfSmallValue)));
+ }
+
+ bool equal(const B2DTuple& rTup) const
+ {
+ return (
+ this == &rTup ||
+ (fTools::equal(mfX, rTup.mfX) &&
+ fTools::equal(mfY, rTup.mfY)));
+ }
+
+ bool equal(const B2DTuple& rTup, const double& rfSmallValue) const
+ {
+ return (
+ this == &rTup ||
+ (fTools::equal(mfX, rTup.mfX, rfSmallValue) &&
+ fTools::equal(mfY, rTup.mfY, rfSmallValue)));
+ }
+
+ // operators
+ //////////////////////////////////////////////////////////////////////
+
+ B2DTuple& operator+=( const B2DTuple& rTup )
+ {
+ mfX += rTup.mfX;
+ mfY += rTup.mfY;
+ return *this;
+ }
+
+ B2DTuple& operator-=( const B2DTuple& rTup )
+ {
+ mfX -= rTup.mfX;
+ mfY -= rTup.mfY;
+ return *this;
+ }
+
+ B2DTuple& operator/=( const B2DTuple& rTup )
+ {
+ mfX /= rTup.mfX;
+ mfY /= rTup.mfY;
+ return *this;
+ }
+
+ B2DTuple& operator*=( const B2DTuple& rTup )
+ {
+ mfX *= rTup.mfX;
+ mfY *= rTup.mfY;
+ return *this;
+ }
+
+ B2DTuple& operator*=(double t)
+ {
+ mfX *= t;
+ mfY *= t;
+ return *this;
+ }
+
+ B2DTuple& operator/=(double t)
+ {
+ const double fVal(1.0 / t);
+ mfX *= fVal;
+ mfY *= fVal;
+ return *this;
+ }
+
+ B2DTuple operator-(void) const
+ {
+ return B2DTuple(-mfX, -mfY);
+ }
+
+ bool operator==( const B2DTuple& rTup ) const
+ {
+ return equal(rTup);
+ }
+
+ bool operator!=( const B2DTuple& rTup ) const
+ {
+ return !equal(rTup);
+ }
+
+ B2DTuple& operator=( const B2DTuple& rTup )
+ {
+ mfX = rTup.mfX;
+ mfY = rTup.mfY;
+ return *this;
+ }
+
+ BASEGFX_DLLPUBLIC static const B2DTuple& getEmptyTuple();
+ };
+
+ // external operators
+ //////////////////////////////////////////////////////////////////////////
+
+ inline B2DTuple minimum(const B2DTuple& rTupA, const B2DTuple& rTupB)
+ {
+ B2DTuple aMin(
+ (rTupB.getX() < rTupA.getX()) ? rTupB.getX() : rTupA.getX(),
+ (rTupB.getY() < rTupA.getY()) ? rTupB.getY() : rTupA.getY());
+ return aMin;
+ }
+
+ inline B2DTuple maximum(const B2DTuple& rTupA, const B2DTuple& rTupB)
+ {
+ B2DTuple aMax(
+ (rTupB.getX() > rTupA.getX()) ? rTupB.getX() : rTupA.getX(),
+ (rTupB.getY() > rTupA.getY()) ? rTupB.getY() : rTupA.getY());
+ return aMax;
+ }
+
+ inline B2DTuple absolute(const B2DTuple& rTup)
+ {
+ B2DTuple aAbs(
+ (0.0 > rTup.getX()) ? -rTup.getX() : rTup.getX(),
+ (0.0 > rTup.getY()) ? -rTup.getY() : rTup.getY());
+ return aAbs;
+ }
+
+ inline B2DTuple interpolate(const B2DTuple& rOld1, const B2DTuple& rOld2, double t)
+ {
+ B2DTuple aInt(
+ ((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX(),
+ ((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY());
+ return aInt;
+ }
+
+ inline B2DTuple average(const B2DTuple& rOld1, const B2DTuple& rOld2)
+ {
+ B2DTuple aAvg(
+ (rOld1.getX() + rOld2.getX()) * 0.5,
+ (rOld1.getY() + rOld2.getY()) * 0.5);
+ return aAvg;
+ }
+
+ inline B2DTuple average(const B2DTuple& rOld1, const B2DTuple& rOld2, const B2DTuple& rOld3)
+ {
+ B2DTuple aAvg(
+ (rOld1.getX() + rOld2.getX() + rOld3.getX()) * (1.0 / 3.0),
+ (rOld1.getY() + rOld2.getY() + rOld3.getY()) * (1.0 / 3.0));
+ return aAvg;
+ }
+
+ inline B2DTuple operator+(const B2DTuple& rTupA, const B2DTuple& rTupB)
+ {
+ B2DTuple aSum(rTupA);
+ aSum += rTupB;
+ return aSum;
+ }
+
+ inline B2DTuple operator-(const B2DTuple& rTupA, const B2DTuple& rTupB)
+ {
+ B2DTuple aSub(rTupA);
+ aSub -= rTupB;
+ return aSub;
+ }
+
+ inline B2DTuple operator/(const B2DTuple& rTupA, const B2DTuple& rTupB)
+ {
+ B2DTuple aDiv(rTupA);
+ aDiv /= rTupB;
+ return aDiv;
+ }
+
+ inline B2DTuple operator*(const B2DTuple& rTupA, const B2DTuple& rTupB)
+ {
+ B2DTuple aMul(rTupA);
+ aMul *= rTupB;
+ return aMul;
+ }
+
+ inline B2DTuple operator*(const B2DTuple& rTup, double t)
+ {
+ B2DTuple aNew(rTup);
+ aNew *= t;
+ return aNew;
+ }
+
+ inline B2DTuple operator*(double t, const B2DTuple& rTup)
+ {
+ B2DTuple aNew(rTup);
+ aNew *= t;
+ return aNew;
+ }
+
+ inline B2DTuple operator/(const B2DTuple& rTup, double t)
+ {
+ B2DTuple aNew(rTup);
+ aNew /= t;
+ return aNew;
+ }
+
+ inline B2DTuple operator/(double t, const B2DTuple& rTup)
+ {
+ B2DTuple aNew(t, t);
+ B2DTuple aTmp(rTup);
+ aNew /= aTmp;
+ return aNew;
+ }
+
+ /** Round double to nearest integer for 2D tuple
+
+ @return the nearest integer for this tuple
+ */
+ BASEGFX_DLLPUBLIC B2ITuple fround(const B2DTuple& rTup);
+} // end of namespace basegfx
+
+#endif /* _BGFX_TUPLE_B2DTUPLE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tuple/b2i64tuple.hxx b/include/basegfx/tuple/b2i64tuple.hxx
new file mode 100644
index 000000000000..debb4cabe578
--- /dev/null
+++ b/include/basegfx/tuple/b2i64tuple.hxx
@@ -0,0 +1,305 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_TUPLE_B2I64TUPLE_HXX
+#define _BGFX_TUPLE_B2I64TUPLE_HXX
+
+#include <sal/types.h>
+#include <basegfx/tuple/b2dtuple.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+
+namespace basegfx
+{
+ /** Base class for all Points/Vectors with two sal_Int64 values
+
+ This class provides all methods common to Point
+ avd Vector classes which are derived from here.
+
+ @derive Use this class to implement Points or Vectors
+ which are based on two sal_Int64 values
+ */
+ class BASEGFX_DLLPUBLIC SAL_WARN_UNUSED B2I64Tuple
+ {
+ protected:
+ sal_Int64 mnX;
+ sal_Int64 mnY;
+
+ public:
+ /** Create a 2D Tuple
+
+ The tuple is initialized to (0, 0)
+ */
+ B2I64Tuple()
+ : mnX(0),
+ mnY(0)
+ {}
+
+ /** Create a 2D Tuple
+
+ @param fX
+ This parameter is used to initialize the X-coordinate
+ of the 2D Tuple.
+
+ @param fY
+ This parameter is used to initialize the Y-coordinate
+ of the 2D Tuple.
+ */
+ B2I64Tuple(sal_Int64 fX, sal_Int64 fY)
+ : mnX( fX ),
+ mnY( fY )
+ {}
+
+ /** Create a copy of a 2D Tuple
+
+ @param rTup
+ The 2D Tuple which will be copied.
+ */
+ B2I64Tuple(const B2I64Tuple& rTup)
+ : mnX( rTup.mnX ),
+ mnY( rTup.mnY )
+ {}
+
+ ~B2I64Tuple()
+ {}
+
+ /// Get X-Coordinate of 2D Tuple
+ sal_Int64 getX() const
+ {
+ return mnX;
+ }
+
+ /// Get Y-Coordinate of 2D Tuple
+ sal_Int64 getY() const
+ {
+ return mnY;
+ }
+
+ /// Set X-Coordinate of 2D Tuple
+ void setX(sal_Int64 fX)
+ {
+ mnX = fX;
+ }
+
+ /// Set Y-Coordinate of 2D Tuple
+ void setY(sal_Int64 fY)
+ {
+ mnY = fY;
+ }
+
+ /// Array-access to 2D Tuple
+ const sal_Int64& operator[] (int nPos) const
+ {
+ // Here, normally one if(...) should be used. In the assumption that
+ // both sal_Int64 members can be accessed as an array a shortcut is used here.
+ // if(0 == nPos) return mnX; return mnY;
+ return *((&mnX) + nPos);
+ }
+
+ /// Array-access to 2D Tuple
+ sal_Int64& operator[] (int nPos)
+ {
+ // Here, normally one if(...) should be used. In the assumption that
+ // both sal_Int64 members can be accessed as an array a shortcut is used here.
+ // if(0 == nPos) return mnX; return mnY;
+ return *((&mnX) + nPos);
+ }
+
+ // operators
+ //////////////////////////////////////////////////////////////////////
+
+ B2I64Tuple& operator+=( const B2I64Tuple& rTup )
+ {
+ mnX += rTup.mnX;
+ mnY += rTup.mnY;
+ return *this;
+ }
+
+ B2I64Tuple& operator-=( const B2I64Tuple& rTup )
+ {
+ mnX -= rTup.mnX;
+ mnY -= rTup.mnY;
+ return *this;
+ }
+
+ B2I64Tuple& operator/=( const B2I64Tuple& rTup )
+ {
+ mnX /= rTup.mnX;
+ mnY /= rTup.mnY;
+ return *this;
+ }
+
+ B2I64Tuple& operator*=( const B2I64Tuple& rTup )
+ {
+ mnX *= rTup.mnX;
+ mnY *= rTup.mnY;
+ return *this;
+ }
+
+ B2I64Tuple& operator*=(sal_Int64 t)
+ {
+ mnX *= t;
+ mnY *= t;
+ return *this;
+ }
+
+ B2I64Tuple& operator/=(sal_Int64 t)
+ {
+ mnX /= t;
+ mnY /= t;
+ return *this;
+ }
+
+ B2I64Tuple operator-(void) const
+ {
+ return B2I64Tuple(-mnX, -mnY);
+ }
+
+ bool equalZero() const { return mnX == 0 && mnY == 0; }
+
+ bool operator==( const B2I64Tuple& rTup ) const
+ {
+ return this == &rTup || (rTup.mnX == mnX && rTup.mnY == mnY);
+ }
+
+ bool operator!=( const B2I64Tuple& rTup ) const
+ {
+ return !(*this == rTup);
+ }
+
+ B2I64Tuple& operator=( const B2I64Tuple& rTup )
+ {
+ mnX = rTup.mnX;
+ mnY = rTup.mnY;
+ return *this;
+ }
+ };
+
+ // external operators
+ //////////////////////////////////////////////////////////////////////////
+
+ inline B2I64Tuple minimum(const B2I64Tuple& rTupA, const B2I64Tuple& rTupB)
+ {
+ B2I64Tuple aMin(
+ (rTupB.getX() < rTupA.getX()) ? rTupB.getX() : rTupA.getX(),
+ (rTupB.getY() < rTupA.getY()) ? rTupB.getY() : rTupA.getY());
+ return aMin;
+ }
+
+ inline B2I64Tuple maximum(const B2I64Tuple& rTupA, const B2I64Tuple& rTupB)
+ {
+ B2I64Tuple aMax(
+ (rTupB.getX() > rTupA.getX()) ? rTupB.getX() : rTupA.getX(),
+ (rTupB.getY() > rTupA.getY()) ? rTupB.getY() : rTupA.getY());
+ return aMax;
+ }
+
+ inline B2I64Tuple absolute(const B2I64Tuple& rTup)
+ {
+ B2I64Tuple aAbs(
+ (0 > rTup.getX()) ? -rTup.getX() : rTup.getX(),
+ (0 > rTup.getY()) ? -rTup.getY() : rTup.getY());
+ return aAbs;
+ }
+
+ inline B2DTuple interpolate(const B2I64Tuple& rOld1, const B2I64Tuple& rOld2, double t)
+ {
+ B2DTuple aInt(
+ ((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX(),
+ ((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY());
+ return aInt;
+ }
+
+ inline B2DTuple average(const B2I64Tuple& rOld1, const B2I64Tuple& rOld2)
+ {
+ B2DTuple aAvg(
+ (rOld1.getX() + rOld2.getX()) * 0.5,
+ (rOld1.getY() + rOld2.getY()) * 0.5);
+ return aAvg;
+ }
+
+ inline B2DTuple average(const B2I64Tuple& rOld1, const B2I64Tuple& rOld2, const B2I64Tuple& rOld3)
+ {
+ B2DTuple aAvg(
+ (rOld1.getX() + rOld2.getX() + rOld3.getX()) * (1.0 / 3.0),
+ (rOld1.getY() + rOld2.getY() + rOld3.getY()) * (1.0 / 3.0));
+ return aAvg;
+ }
+
+ inline B2I64Tuple operator+(const B2I64Tuple& rTupA, const B2I64Tuple& rTupB)
+ {
+ B2I64Tuple aSum(rTupA);
+ aSum += rTupB;
+ return aSum;
+ }
+
+ inline B2I64Tuple operator-(const B2I64Tuple& rTupA, const B2I64Tuple& rTupB)
+ {
+ B2I64Tuple aSub(rTupA);
+ aSub -= rTupB;
+ return aSub;
+ }
+
+ inline B2I64Tuple operator/(const B2I64Tuple& rTupA, const B2I64Tuple& rTupB)
+ {
+ B2I64Tuple aDiv(rTupA);
+ aDiv /= rTupB;
+ return aDiv;
+ }
+
+ inline B2I64Tuple operator*(const B2I64Tuple& rTupA, const B2I64Tuple& rTupB)
+ {
+ B2I64Tuple aMul(rTupA);
+ aMul *= rTupB;
+ return aMul;
+ }
+
+ inline B2I64Tuple operator*(const B2I64Tuple& rTup, sal_Int64 t)
+ {
+ B2I64Tuple aNew(rTup);
+ aNew *= t;
+ return aNew;
+ }
+
+ inline B2I64Tuple operator*(sal_Int64 t, const B2I64Tuple& rTup)
+ {
+ B2I64Tuple aNew(rTup);
+ aNew *= t;
+ return aNew;
+ }
+
+ inline B2I64Tuple operator/(const B2I64Tuple& rTup, sal_Int64 t)
+ {
+ B2I64Tuple aNew(rTup);
+ aNew /= t;
+ return aNew;
+ }
+
+ inline B2I64Tuple operator/(sal_Int64 t, const B2I64Tuple& rTup)
+ {
+ B2I64Tuple aNew(t, t);
+ B2I64Tuple aTmp(rTup);
+ aNew /= aTmp;
+ return aNew;
+ }
+} // end of namespace basegfx
+
+#endif /* _BGFX_TUPLE_B2I64TUPLE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tuple/b2ituple.hxx b/include/basegfx/tuple/b2ituple.hxx
new file mode 100644
index 000000000000..41203a0c58c4
--- /dev/null
+++ b/include/basegfx/tuple/b2ituple.hxx
@@ -0,0 +1,208 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_TUPLE_B2ITUPLE_HXX
+#define _BGFX_TUPLE_B2ITUPLE_HXX
+
+#include <sal/types.h>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ /** Base class for all Points/Vectors with two sal_Int32 values
+
+ This class provides all methods common to Point
+ avd Vector classes which are derived from here.
+
+ @derive Use this class to implement Points or Vectors
+ which are based on two sal_Int32 values
+ */
+ class BASEGFX_DLLPUBLIC SAL_WARN_UNUSED B2ITuple
+ {
+ protected:
+ sal_Int32 mnX;
+ sal_Int32 mnY;
+
+ public:
+ /** Create a 2D Tuple
+
+ The tuple is initialized to (0, 0)
+ */
+ B2ITuple()
+ : mnX(0),
+ mnY(0)
+ {}
+
+ /** Create a 2D Tuple
+
+ @param fX
+ This parameter is used to initialize the X-coordinate
+ of the 2D Tuple.
+
+ @param fY
+ This parameter is used to initialize the Y-coordinate
+ of the 2D Tuple.
+ */
+ B2ITuple(sal_Int32 fX, sal_Int32 fY)
+ : mnX( fX ),
+ mnY( fY )
+ {}
+
+ /** Create a copy of a 2D Tuple
+
+ @param rTup
+ The 2D Tuple which will be copied.
+ */
+ B2ITuple(const B2ITuple& rTup)
+ : mnX( rTup.mnX ),
+ mnY( rTup.mnY )
+ {}
+
+ ~B2ITuple()
+ {}
+
+ /// Get X-Coordinate of 2D Tuple
+ sal_Int32 getX() const
+ {
+ return mnX;
+ }
+
+ /// Get Y-Coordinate of 2D Tuple
+ sal_Int32 getY() const
+ {
+ return mnY;
+ }
+
+ /// Set X-Coordinate of 2D Tuple
+ void setX(sal_Int32 fX)
+ {
+ mnX = fX;
+ }
+
+ /// Set Y-Coordinate of 2D Tuple
+ void setY(sal_Int32 fY)
+ {
+ mnY = fY;
+ }
+
+ /// Array-access to 2D Tuple
+ const sal_Int32& operator[] (int nPos) const
+ {
+ // Here, normally one if(...) should be used. In the assumption that
+ // both sal_Int32 members can be accessed as an array a shortcut is used here.
+ // if(0 == nPos) return mnX; return mnY;
+ return *((&mnX) + nPos);
+ }
+
+ /// Array-access to 2D Tuple
+ sal_Int32& operator[] (int nPos)
+ {
+ // Here, normally one if(...) should be used. In the assumption that
+ // both sal_Int32 members can be accessed as an array a shortcut is used here.
+ // if(0 == nPos) return mnX; return mnY;
+ return *((&mnX) + nPos);
+ }
+
+ // operators
+ //////////////////////////////////////////////////////////////////////
+
+ B2ITuple& operator+=( const B2ITuple& rTup )
+ {
+ mnX += rTup.mnX;
+ mnY += rTup.mnY;
+ return *this;
+ }
+
+ B2ITuple& operator-=( const B2ITuple& rTup )
+ {
+ mnX -= rTup.mnX;
+ mnY -= rTup.mnY;
+ return *this;
+ }
+
+ B2ITuple& operator/=( const B2ITuple& rTup )
+ {
+ mnX /= rTup.mnX;
+ mnY /= rTup.mnY;
+ return *this;
+ }
+
+ B2ITuple& operator*=( const B2ITuple& rTup )
+ {
+ mnX *= rTup.mnX;
+ mnY *= rTup.mnY;
+ return *this;
+ }
+
+ B2ITuple& operator*=(sal_Int32 t)
+ {
+ mnX *= t;
+ mnY *= t;
+ return *this;
+ }
+
+ B2ITuple& operator/=(sal_Int32 t)
+ {
+ mnX /= t;
+ mnY /= t;
+ return *this;
+ }
+
+ B2ITuple operator-(void) const
+ {
+ return B2ITuple(-mnX, -mnY);
+ }
+
+ bool equalZero() const { return mnX == 0 && mnY == 0; }
+
+ bool operator==( const B2ITuple& rTup ) const
+ {
+ return this == &rTup || (rTup.mnX == mnX && rTup.mnY == mnY);
+ }
+
+ bool operator!=( const B2ITuple& rTup ) const
+ {
+ return !(*this == rTup);
+ }
+
+ B2ITuple& operator=( const B2ITuple& rTup )
+ {
+ mnX = rTup.mnX;
+ mnY = rTup.mnY;
+ return *this;
+ }
+ };
+
+ // external operators
+ //////////////////////////////////////////////////////////////////////////
+ class B2DTuple;
+
+ BASEGFX_DLLPUBLIC B2ITuple operator+(const B2ITuple& rTupA, const B2ITuple& rTupB);
+ BASEGFX_DLLPUBLIC B2ITuple operator-(const B2ITuple& rTupA, const B2ITuple& rTupB);
+ BASEGFX_DLLPUBLIC B2ITuple operator/(const B2ITuple& rTupA, const B2ITuple& rTupB);
+ BASEGFX_DLLPUBLIC B2ITuple operator*(const B2ITuple& rTupA, const B2ITuple& rTupB);
+ BASEGFX_DLLPUBLIC B2ITuple operator*(const B2ITuple& rTup, sal_Int32 t);
+ BASEGFX_DLLPUBLIC B2ITuple operator*(sal_Int32 t, const B2ITuple& rTup);
+ BASEGFX_DLLPUBLIC B2ITuple operator/(const B2ITuple& rTup, sal_Int32 t);
+ BASEGFX_DLLPUBLIC B2ITuple operator/(sal_Int32 t, const B2ITuple& rTup);
+} // end of namespace basegfx
+
+#endif /* _BGFX_TUPLE_B2ITUPLE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tuple/b3dtuple.hxx b/include/basegfx/tuple/b3dtuple.hxx
new file mode 100644
index 000000000000..1eb4dd38de09
--- /dev/null
+++ b/include/basegfx/tuple/b3dtuple.hxx
@@ -0,0 +1,421 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_TUPLE_B3DTUPLE_HXX
+#define _BGFX_TUPLE_B3DTUPLE_HXX
+
+#include <sal/types.h>
+#include <basegfx/numeric/ftools.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ // predeclarations
+ class B3ITuple;
+
+ /** Base class for all Points/Vectors with three double values
+
+ This class provides all methods common to Point
+ avd Vector classes which are derived from here.
+
+ @derive Use this class to implement Points or Vectors
+ which are based on three double values
+ */
+ class BASEGFX_DLLPUBLIC SAL_WARN_UNUSED B3DTuple
+ {
+ protected:
+ double mfX;
+ double mfY;
+ double mfZ;
+
+ public:
+ /** Create a 3D Tuple
+
+ The tuple is initialized to (0.0, 0.0, 0.0)
+ */
+ B3DTuple()
+ : mfX(0.0),
+ mfY(0.0),
+ mfZ(0.0)
+ {}
+
+ /** Create a 3D Tuple
+
+ @param fX
+ This parameter is used to initialize the X-coordinate
+ of the 3D Tuple.
+
+ @param fY
+ This parameter is used to initialize the Y-coordinate
+ of the 3D Tuple.
+
+ @param fZ
+ This parameter is used to initialize the Z-coordinate
+ of the 3D Tuple.
+ */
+ B3DTuple(double fX, double fY, double fZ)
+ : mfX(fX),
+ mfY(fY),
+ mfZ(fZ)
+ {}
+
+ /** Create a copy of a 3D Tuple
+
+ @param rTup
+ The 3D Tuple which will be copied.
+ */
+ B3DTuple(const B3DTuple& rTup)
+ : mfX( rTup.mfX ),
+ mfY( rTup.mfY ),
+ mfZ( rTup.mfZ )
+ {}
+
+ ~B3DTuple()
+ {}
+
+ /// get X-Coordinate of 3D Tuple
+ double getX() const
+ {
+ return mfX;
+ }
+
+ /// get Y-Coordinate of 3D Tuple
+ double getY() const
+ {
+ return mfY;
+ }
+
+ /// get Z-Coordinate of 3D Tuple
+ double getZ() const
+ {
+ return mfZ;
+ }
+
+ /// set X-Coordinate of 3D Tuple
+ void setX(double fX)
+ {
+ mfX = fX;
+ }
+
+ /// set Y-Coordinate of 3D Tuple
+ void setY(double fY)
+ {
+ mfY = fY;
+ }
+
+ /// set Z-Coordinate of 3D Tuple
+ void setZ(double fZ)
+ {
+ mfZ = fZ;
+ }
+
+ /// Array-access to 3D Tuple
+ const double& operator[] (int nPos) const
+ {
+ // Here, normally two if(...)'s should be used. In the assumption that
+ // both double members can be accessed as an array a shortcut is used here.
+ // if(0 == nPos) return mfX; if(1 == nPos) return mfY; return mfZ;
+ return *((&mfX) + nPos);
+ }
+
+ /// Array-access to 3D Tuple
+ double& operator[] (int nPos)
+ {
+ // Here, normally two if(...)'s should be used. In the assumption that
+ // both double members can be accessed as an array a shortcut is used here.
+ // if(0 == nPos) return mfX; if(1 == nPos) return mfY; return mfZ;
+ return *((&mfX) + nPos);
+ }
+
+ // comparators with tolerance
+ //////////////////////////////////////////////////////////////////////
+
+ bool equalZero() const
+ {
+ return (this == &getEmptyTuple() ||
+ (::basegfx::fTools::equalZero(mfX)
+ && ::basegfx::fTools::equalZero(mfY)
+ && ::basegfx::fTools::equalZero(mfZ)));
+ }
+
+ bool equalZero(const double& rfSmallValue) const
+ {
+ return (this == &getEmptyTuple() ||
+ (::basegfx::fTools::equalZero(mfX, rfSmallValue)
+ && ::basegfx::fTools::equalZero(mfY, rfSmallValue)
+ && ::basegfx::fTools::equalZero(mfZ, rfSmallValue)));
+ }
+
+ bool equal(const B3DTuple& rTup) const
+ {
+ return (
+ this == &rTup ||
+ (::basegfx::fTools::equal(mfX, rTup.mfX) &&
+ ::basegfx::fTools::equal(mfY, rTup.mfY) &&
+ ::basegfx::fTools::equal(mfZ, rTup.mfZ)));
+ }
+
+ bool equal(const B3DTuple& rTup, const double& rfSmallValue) const
+ {
+ return (
+ this == &rTup ||
+ (::basegfx::fTools::equal(mfX, rTup.mfX, rfSmallValue) &&
+ ::basegfx::fTools::equal(mfY, rTup.mfY, rfSmallValue) &&
+ ::basegfx::fTools::equal(mfZ, rTup.mfZ, rfSmallValue)));
+ }
+
+ // operators
+ //////////////////////////////////////////////////////////////////////
+
+ B3DTuple& operator+=( const B3DTuple& rTup )
+ {
+ mfX += rTup.mfX;
+ mfY += rTup.mfY;
+ mfZ += rTup.mfZ;
+ return *this;
+ }
+
+ B3DTuple& operator-=( const B3DTuple& rTup )
+ {
+ mfX -= rTup.mfX;
+ mfY -= rTup.mfY;
+ mfZ -= rTup.mfZ;
+ return *this;
+ }
+
+ B3DTuple& operator/=( const B3DTuple& rTup )
+ {
+ mfX /= rTup.mfX;
+ mfY /= rTup.mfY;
+ mfZ /= rTup.mfZ;
+ return *this;
+ }
+
+ B3DTuple& operator*=( const B3DTuple& rTup )
+ {
+ mfX *= rTup.mfX;
+ mfY *= rTup.mfY;
+ mfZ *= rTup.mfZ;
+ return *this;
+ }
+
+ B3DTuple& operator*=(double t)
+ {
+ mfX *= t;
+ mfY *= t;
+ mfZ *= t;
+ return *this;
+ }
+
+ B3DTuple& operator/=(double t)
+ {
+ const double fVal(1.0 / t);
+ mfX *= fVal;
+ mfY *= fVal;
+ mfZ *= fVal;
+ return *this;
+ }
+
+ B3DTuple operator-(void) const
+ {
+ return B3DTuple(-mfX, -mfY, -mfZ);
+ }
+
+ bool operator==( const B3DTuple& rTup ) const
+ {
+ return equal(rTup);
+ }
+
+ bool operator!=( const B3DTuple& rTup ) const
+ {
+ return !equal(rTup);
+ }
+
+ B3DTuple& operator=( const B3DTuple& rTup )
+ {
+ mfX = rTup.mfX;
+ mfY = rTup.mfY;
+ mfZ = rTup.mfZ;
+ return *this;
+ }
+
+ void correctValues(const double fCompareValue = 0.0)
+ {
+ if(0.0 == fCompareValue)
+ {
+ if(::basegfx::fTools::equalZero(mfX))
+ {
+ mfX = 0.0;
+ }
+
+ if(::basegfx::fTools::equalZero(mfY))
+ {
+ mfY = 0.0;
+ }
+
+ if(::basegfx::fTools::equalZero(mfZ))
+ {
+ mfZ = 0.0;
+ }
+ }
+ else
+ {
+ if(::basegfx::fTools::equal(mfX, fCompareValue))
+ {
+ mfX = fCompareValue;
+ }
+
+ if(::basegfx::fTools::equal(mfY, fCompareValue))
+ {
+ mfY = fCompareValue;
+ }
+
+ if(::basegfx::fTools::equal(mfZ, fCompareValue))
+ {
+ mfZ = fCompareValue;
+ }
+ }
+ }
+
+ static const B3DTuple& getEmptyTuple();
+ };
+
+ // external operators
+ //////////////////////////////////////////////////////////////////////////
+
+ inline B3DTuple minimum(const B3DTuple& rTupA, const B3DTuple& rTupB)
+ {
+ B3DTuple aMin(
+ (rTupB.getX() < rTupA.getX()) ? rTupB.getX() : rTupA.getX(),
+ (rTupB.getY() < rTupA.getY()) ? rTupB.getY() : rTupA.getY(),
+ (rTupB.getZ() < rTupA.getZ()) ? rTupB.getZ() : rTupA.getZ());
+ return aMin;
+ }
+
+ inline B3DTuple maximum(const B3DTuple& rTupA, const B3DTuple& rTupB)
+ {
+ B3DTuple aMax(
+ (rTupB.getX() > rTupA.getX()) ? rTupB.getX() : rTupA.getX(),
+ (rTupB.getY() > rTupA.getY()) ? rTupB.getY() : rTupA.getY(),
+ (rTupB.getZ() > rTupA.getZ()) ? rTupB.getZ() : rTupA.getZ());
+ return aMax;
+ }
+
+ inline B3DTuple absolute(const B3DTuple& rTup)
+ {
+ B3DTuple aAbs(
+ (0.0 > rTup.getX()) ? -rTup.getX() : rTup.getX(),
+ (0.0 > rTup.getY()) ? -rTup.getY() : rTup.getY(),
+ (0.0 > rTup.getZ()) ? -rTup.getZ() : rTup.getZ());
+ return aAbs;
+ }
+
+ inline B3DTuple interpolate(const B3DTuple& rOld1, const B3DTuple& rOld2, double t)
+ {
+ B3DTuple aInt(
+ ((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX(),
+ ((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY(),
+ ((rOld2.getZ() - rOld1.getZ()) * t) + rOld1.getZ());
+ return aInt;
+ }
+
+ inline B3DTuple average(const B3DTuple& rOld1, const B3DTuple& rOld2)
+ {
+ B3DTuple aAvg(
+ (rOld1.getX() + rOld2.getX()) * 0.5,
+ (rOld1.getY() + rOld2.getY()) * 0.5,
+ (rOld1.getZ() + rOld2.getZ()) * 0.5);
+ return aAvg;
+ }
+
+ inline B3DTuple average(const B3DTuple& rOld1, const B3DTuple& rOld2, const B3DTuple& rOld3)
+ {
+ B3DTuple aAvg(
+ (rOld1.getX() + rOld2.getX() + rOld3.getX()) * (1.0 / 3.0),
+ (rOld1.getY() + rOld2.getY() + rOld3.getY()) * (1.0 / 3.0),
+ (rOld1.getZ() + rOld2.getZ() + rOld3.getZ()) * (1.0 / 3.0));
+ return aAvg;
+ }
+
+ inline B3DTuple operator+(const B3DTuple& rTupA, const B3DTuple& rTupB)
+ {
+ B3DTuple aSum(rTupA);
+ aSum += rTupB;
+ return aSum;
+ }
+
+ inline B3DTuple operator-(const B3DTuple& rTupA, const B3DTuple& rTupB)
+ {
+ B3DTuple aSub(rTupA);
+ aSub -= rTupB;
+ return aSub;
+ }
+
+ inline B3DTuple operator/(const B3DTuple& rTupA, const B3DTuple& rTupB)
+ {
+ B3DTuple aDiv(rTupA);
+ aDiv /= rTupB;
+ return aDiv;
+ }
+
+ inline B3DTuple operator*(const B3DTuple& rTupA, const B3DTuple& rTupB)
+ {
+ B3DTuple aMul(rTupA);
+ aMul *= rTupB;
+ return aMul;
+ }
+
+ inline B3DTuple operator*(const B3DTuple& rTup, double t)
+ {
+ B3DTuple aNew(rTup);
+ aNew *= t;
+ return aNew;
+ }
+
+ inline B3DTuple operator*(double t, const B3DTuple& rTup)
+ {
+ B3DTuple aNew(rTup);
+ aNew *= t;
+ return aNew;
+ }
+
+ inline B3DTuple operator/(const B3DTuple& rTup, double t)
+ {
+ B3DTuple aNew(rTup);
+ aNew /= t;
+ return aNew;
+ }
+
+ inline B3DTuple operator/(double t, const B3DTuple& rTup)
+ {
+ B3DTuple aNew(rTup);
+ aNew /= t;
+ return aNew;
+ }
+
+ /** Round double to nearest integer for 3D tuple
+
+ @return the nearest integer for this tuple
+ */
+ BASEGFX_DLLPUBLIC B3ITuple fround(const B3DTuple& rTup);
+} // end of namespace basegfx
+
+#endif /* _BGFX_TUPLE_B3DTUPLE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tuple/b3i64tuple.hxx b/include/basegfx/tuple/b3i64tuple.hxx
new file mode 100644
index 000000000000..bcc1acaee6b1
--- /dev/null
+++ b/include/basegfx/tuple/b3i64tuple.hxx
@@ -0,0 +1,336 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_TUPLE_B3I64TUPLE_HXX
+#define _BGFX_TUPLE_B3I64TUPLE_HXX
+
+#include <sal/types.h>
+#include <basegfx/tuple/b3dtuple.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+
+namespace basegfx
+{
+ /** Base class for all Points/Vectors with three sal_Int64 values
+
+ This class provides all methods common to Point
+ avd Vector classes which are derived from here.
+
+ @derive Use this class to implement Points or Vectors
+ which are based on three sal_Int64 values
+ */
+ class BASEGFX_DLLPUBLIC SAL_WARN_UNUSED B3I64Tuple
+ {
+ protected:
+ sal_Int64 mnX;
+ sal_Int64 mnY;
+ sal_Int64 mnZ;
+
+ public:
+ /** Create a 3D Tuple
+
+ The tuple is initialized to (0, 0, 0)
+ */
+ B3I64Tuple()
+ : mnX(0),
+ mnY(0),
+ mnZ(0)
+ {}
+
+ /** Create a 3D Tuple
+
+ @param nX
+ This parameter is used to initialize the X-coordinate
+ of the 3D Tuple.
+
+ @param nY
+ This parameter is used to initialize the Y-coordinate
+ of the 3D Tuple.
+
+ @param nZ
+ This parameter is used to initialize the Z-coordinate
+ of the 3D Tuple.
+ */
+ B3I64Tuple(sal_Int64 nX, sal_Int64 nY, sal_Int64 nZ)
+ : mnX(nX),
+ mnY(nY),
+ mnZ(nZ)
+ {}
+
+ /** Create a copy of a 3D Tuple
+
+ @param rTup
+ The 3D Tuple which will be copied.
+ */
+ B3I64Tuple(const B3I64Tuple& rTup)
+ : mnX( rTup.mnX ),
+ mnY( rTup.mnY ),
+ mnZ( rTup.mnZ )
+ {}
+
+ ~B3I64Tuple()
+ {}
+
+ /// get X-Coordinate of 3D Tuple
+ sal_Int64 getX() const
+ {
+ return mnX;
+ }
+
+ /// get Y-Coordinate of 3D Tuple
+ sal_Int64 getY() const
+ {
+ return mnY;
+ }
+
+ /// get Z-Coordinate of 3D Tuple
+ sal_Int64 getZ() const
+ {
+ return mnZ;
+ }
+
+ /// set X-Coordinate of 3D Tuple
+ void setX(sal_Int64 nX)
+ {
+ mnX = nX;
+ }
+
+ /// set Y-Coordinate of 3D Tuple
+ void setY(sal_Int64 nY)
+ {
+ mnY = nY;
+ }
+
+ /// set Z-Coordinate of 3D Tuple
+ void setZ(sal_Int64 nZ)
+ {
+ mnZ = nZ;
+ }
+
+ /// Array-access to 3D Tuple
+ const sal_Int64& operator[] (int nPos) const
+ {
+ // Here, normally two if(...)'s should be used. In the assumption that
+ // both sal_Int64 members can be accessed as an array a shortcut is used here.
+ // if(0 == nPos) return mnX; if(1 == nPos) return mnY; return mnZ;
+ return *((&mnX) + nPos);
+ }
+
+ /// Array-access to 3D Tuple
+ sal_Int64& operator[] (int nPos)
+ {
+ // Here, normally two if(...)'s should be used. In the assumption that
+ // both sal_Int64 members can be accessed as an array a shortcut is used here.
+ // if(0 == nPos) return mnX; if(1 == nPos) return mnY; return mnZ;
+ return *((&mnX) + nPos);
+ }
+
+ // operators
+ //////////////////////////////////////////////////////////////////////
+
+ B3I64Tuple& operator+=( const B3I64Tuple& rTup )
+ {
+ mnX += rTup.mnX;
+ mnY += rTup.mnY;
+ mnZ += rTup.mnZ;
+ return *this;
+ }
+
+ B3I64Tuple& operator-=( const B3I64Tuple& rTup )
+ {
+ mnX -= rTup.mnX;
+ mnY -= rTup.mnY;
+ mnZ -= rTup.mnZ;
+ return *this;
+ }
+
+ B3I64Tuple& operator/=( const B3I64Tuple& rTup )
+ {
+ mnX /= rTup.mnX;
+ mnY /= rTup.mnY;
+ mnZ /= rTup.mnZ;
+ return *this;
+ }
+
+ B3I64Tuple& operator*=( const B3I64Tuple& rTup )
+ {
+ mnX *= rTup.mnX;
+ mnY *= rTup.mnY;
+ mnZ *= rTup.mnZ;
+ return *this;
+ }
+
+ B3I64Tuple& operator*=(sal_Int64 t)
+ {
+ mnX *= t;
+ mnY *= t;
+ mnZ *= t;
+ return *this;
+ }
+
+ B3I64Tuple& operator/=(sal_Int64 t)
+ {
+ mnX /= t;
+ mnY /= t;
+ mnZ /= t;
+ return *this;
+ }
+
+ B3I64Tuple operator-(void) const
+ {
+ return B3I64Tuple(-mnX, -mnY, -mnZ);
+ }
+
+ bool operator==( const B3I64Tuple& rTup ) const
+ {
+ return this == &rTup || (rTup.mnX == mnX && rTup.mnY == mnY && rTup.mnZ == mnZ);
+ }
+
+ bool operator!=( const B3I64Tuple& rTup ) const
+ {
+ return !(*this == rTup);
+ }
+
+ B3I64Tuple& operator=( const B3I64Tuple& rTup )
+ {
+ mnX = rTup.mnX;
+ mnY = rTup.mnY;
+ mnZ = rTup.mnZ;
+ return *this;
+ }
+ };
+
+ // external operators
+ //////////////////////////////////////////////////////////////////////////
+
+ inline B3I64Tuple minimum(const B3I64Tuple& rTupA, const B3I64Tuple& rTupB)
+ {
+ B3I64Tuple aMin(
+ (rTupB.getX() < rTupA.getX()) ? rTupB.getX() : rTupA.getX(),
+ (rTupB.getY() < rTupA.getY()) ? rTupB.getY() : rTupA.getY(),
+ (rTupB.getZ() < rTupA.getZ()) ? rTupB.getZ() : rTupA.getZ());
+ return aMin;
+ }
+
+ inline B3I64Tuple maximum(const B3I64Tuple& rTupA, const B3I64Tuple& rTupB)
+ {
+ B3I64Tuple aMax(
+ (rTupB.getX() > rTupA.getX()) ? rTupB.getX() : rTupA.getX(),
+ (rTupB.getY() > rTupA.getY()) ? rTupB.getY() : rTupA.getY(),
+ (rTupB.getZ() > rTupA.getZ()) ? rTupB.getZ() : rTupA.getZ());
+ return aMax;
+ }
+
+ inline B3I64Tuple absolute(const B3I64Tuple& rTup)
+ {
+ B3I64Tuple aAbs(
+ (0 > rTup.getX()) ? -rTup.getX() : rTup.getX(),
+ (0 > rTup.getY()) ? -rTup.getY() : rTup.getY(),
+ (0 > rTup.getZ()) ? -rTup.getZ() : rTup.getZ());
+ return aAbs;
+ }
+
+ inline B3DTuple interpolate(const B3I64Tuple& rOld1, const B3I64Tuple& rOld2, double t)
+ {
+ B3DTuple aInt(
+ ((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX(),
+ ((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY(),
+ ((rOld2.getZ() - rOld1.getZ()) * t) + rOld1.getZ());
+ return aInt;
+ }
+
+ inline B3DTuple average(const B3I64Tuple& rOld1, const B3I64Tuple& rOld2)
+ {
+ B3DTuple aAvg(
+ (rOld1.getX() + rOld2.getX()) * 0.5,
+ (rOld1.getY() + rOld2.getY()) * 0.5,
+ (rOld1.getZ() + rOld2.getZ()) * 0.5);
+ return aAvg;
+ }
+
+ inline B3DTuple average(const B3I64Tuple& rOld1, const B3I64Tuple& rOld2, const B3I64Tuple& rOld3)
+ {
+ B3DTuple aAvg(
+ (rOld1.getX() + rOld2.getX() + rOld3.getX()) * (1.0 / 3.0),
+ (rOld1.getY() + rOld2.getY() + rOld3.getY()) * (1.0 / 3.0),
+ (rOld1.getZ() + rOld2.getZ() + rOld3.getZ()) * (1.0 / 3.0));
+ return aAvg;
+ }
+
+ inline B3I64Tuple operator+(const B3I64Tuple& rTupA, const B3I64Tuple& rTupB)
+ {
+ B3I64Tuple aSum(rTupA);
+ aSum += rTupB;
+ return aSum;
+ }
+
+ inline B3I64Tuple operator-(const B3I64Tuple& rTupA, const B3I64Tuple& rTupB)
+ {
+ B3I64Tuple aSub(rTupA);
+ aSub -= rTupB;
+ return aSub;
+ }
+
+ inline B3I64Tuple operator/(const B3I64Tuple& rTupA, const B3I64Tuple& rTupB)
+ {
+ B3I64Tuple aDiv(rTupA);
+ aDiv /= rTupB;
+ return aDiv;
+ }
+
+ inline B3I64Tuple operator*(const B3I64Tuple& rTupA, const B3I64Tuple& rTupB)
+ {
+ B3I64Tuple aMul(rTupA);
+ aMul *= rTupB;
+ return aMul;
+ }
+
+ inline B3I64Tuple operator*(const B3I64Tuple& rTup, sal_Int64 t)
+ {
+ B3I64Tuple aNew(rTup);
+ aNew *= t;
+ return aNew;
+ }
+
+ inline B3I64Tuple operator*(sal_Int64 t, const B3I64Tuple& rTup)
+ {
+ B3I64Tuple aNew(rTup);
+ aNew *= t;
+ return aNew;
+ }
+
+ inline B3I64Tuple operator/(const B3I64Tuple& rTup, sal_Int64 t)
+ {
+ B3I64Tuple aNew(rTup);
+ aNew /= t;
+ return aNew;
+ }
+
+ inline B3I64Tuple operator/(sal_Int64 t, const B3I64Tuple& rTup)
+ {
+ B3I64Tuple aNew(t, t, t);
+ B3I64Tuple aTmp(rTup);
+ aNew /= aTmp;
+ return aNew;
+ }
+} // end of namespace basegfx
+
+#endif /* _BGFX_TUPLE_B3I64TUPLE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tuple/b3ituple.hxx b/include/basegfx/tuple/b3ituple.hxx
new file mode 100644
index 000000000000..49fb24634ed4
--- /dev/null
+++ b/include/basegfx/tuple/b3ituple.hxx
@@ -0,0 +1,335 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_TUPLE_B3ITUPLE_HXX
+#define _BGFX_TUPLE_B3ITUPLE_HXX
+
+#include <sal/types.h>
+#include <basegfx/tuple/b3dtuple.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ /** Base class for all Points/Vectors with three sal_Int32 values
+
+ This class provides all methods common to Point
+ avd Vector classes which are derived from here.
+
+ @derive Use this class to implement Points or Vectors
+ which are based on three sal_Int32 values
+ */
+ class BASEGFX_DLLPUBLIC SAL_WARN_UNUSED B3ITuple
+ {
+ protected:
+ sal_Int32 mnX;
+ sal_Int32 mnY;
+ sal_Int32 mnZ;
+
+ public:
+ /** Create a 3D Tuple
+
+ The tuple is initialized to (0, 0, 0)
+ */
+ B3ITuple()
+ : mnX(0),
+ mnY(0),
+ mnZ(0)
+ {}
+
+ /** Create a 3D Tuple
+
+ @param nX
+ This parameter is used to initialize the X-coordinate
+ of the 3D Tuple.
+
+ @param nY
+ This parameter is used to initialize the Y-coordinate
+ of the 3D Tuple.
+
+ @param nZ
+ This parameter is used to initialize the Z-coordinate
+ of the 3D Tuple.
+ */
+ B3ITuple(sal_Int32 nX, sal_Int32 nY, sal_Int32 nZ)
+ : mnX(nX),
+ mnY(nY),
+ mnZ(nZ)
+ {}
+
+ /** Create a copy of a 3D Tuple
+
+ @param rTup
+ The 3D Tuple which will be copied.
+ */
+ B3ITuple(const B3ITuple& rTup)
+ : mnX( rTup.mnX ),
+ mnY( rTup.mnY ),
+ mnZ( rTup.mnZ )
+ {}
+
+ ~B3ITuple()
+ {}
+
+ /// get X-Coordinate of 3D Tuple
+ sal_Int32 getX() const
+ {
+ return mnX;
+ }
+
+ /// get Y-Coordinate of 3D Tuple
+ sal_Int32 getY() const
+ {
+ return mnY;
+ }
+
+ /// get Z-Coordinate of 3D Tuple
+ sal_Int32 getZ() const
+ {
+ return mnZ;
+ }
+
+ /// set X-Coordinate of 3D Tuple
+ void setX(sal_Int32 nX)
+ {
+ mnX = nX;
+ }
+
+ /// set Y-Coordinate of 3D Tuple
+ void setY(sal_Int32 nY)
+ {
+ mnY = nY;
+ }
+
+ /// set Z-Coordinate of 3D Tuple
+ void setZ(sal_Int32 nZ)
+ {
+ mnZ = nZ;
+ }
+
+ /// Array-access to 3D Tuple
+ const sal_Int32& operator[] (int nPos) const
+ {
+ // Here, normally two if(...)'s should be used. In the assumption that
+ // both sal_Int32 members can be accessed as an array a shortcut is used here.
+ // if(0 == nPos) return mnX; if(1 == nPos) return mnY; return mnZ;
+ return *((&mnX) + nPos);
+ }
+
+ /// Array-access to 3D Tuple
+ sal_Int32& operator[] (int nPos)
+ {
+ // Here, normally two if(...)'s should be used. In the assumption that
+ // both sal_Int32 members can be accessed as an array a shortcut is used here.
+ // if(0 == nPos) return mnX; if(1 == nPos) return mnY; return mnZ;
+ return *((&mnX) + nPos);
+ }
+
+ // operators
+ //////////////////////////////////////////////////////////////////////
+
+ B3ITuple& operator+=( const B3ITuple& rTup )
+ {
+ mnX += rTup.mnX;
+ mnY += rTup.mnY;
+ mnZ += rTup.mnZ;
+ return *this;
+ }
+
+ B3ITuple& operator-=( const B3ITuple& rTup )
+ {
+ mnX -= rTup.mnX;
+ mnY -= rTup.mnY;
+ mnZ -= rTup.mnZ;
+ return *this;
+ }
+
+ B3ITuple& operator/=( const B3ITuple& rTup )
+ {
+ mnX /= rTup.mnX;
+ mnY /= rTup.mnY;
+ mnZ /= rTup.mnZ;
+ return *this;
+ }
+
+ B3ITuple& operator*=( const B3ITuple& rTup )
+ {
+ mnX *= rTup.mnX;
+ mnY *= rTup.mnY;
+ mnZ *= rTup.mnZ;
+ return *this;
+ }
+
+ B3ITuple& operator*=(sal_Int32 t)
+ {
+ mnX *= t;
+ mnY *= t;
+ mnZ *= t;
+ return *this;
+ }
+
+ B3ITuple& operator/=(sal_Int32 t)
+ {
+ mnX /= t;
+ mnY /= t;
+ mnZ /= t;
+ return *this;
+ }
+
+ B3ITuple operator-(void) const
+ {
+ return B3ITuple(-mnX, -mnY, -mnZ);
+ }
+
+ bool operator==( const B3ITuple& rTup ) const
+ {
+ return this == &rTup || (rTup.mnX == mnX && rTup.mnY == mnY && rTup.mnZ == mnZ);
+ }
+
+ bool operator!=( const B3ITuple& rTup ) const
+ {
+ return !(*this == rTup);
+ }
+
+ B3ITuple& operator=( const B3ITuple& rTup )
+ {
+ mnX = rTup.mnX;
+ mnY = rTup.mnY;
+ mnZ = rTup.mnZ;
+ return *this;
+ }
+ };
+
+ // external operators
+ //////////////////////////////////////////////////////////////////////////
+
+ inline B3ITuple minimum(const B3ITuple& rTupA, const B3ITuple& rTupB)
+ {
+ B3ITuple aMin(
+ (rTupB.getX() < rTupA.getX()) ? rTupB.getX() : rTupA.getX(),
+ (rTupB.getY() < rTupA.getY()) ? rTupB.getY() : rTupA.getY(),
+ (rTupB.getZ() < rTupA.getZ()) ? rTupB.getZ() : rTupA.getZ());
+ return aMin;
+ }
+
+ inline B3ITuple maximum(const B3ITuple& rTupA, const B3ITuple& rTupB)
+ {
+ B3ITuple aMax(
+ (rTupB.getX() > rTupA.getX()) ? rTupB.getX() : rTupA.getX(),
+ (rTupB.getY() > rTupA.getY()) ? rTupB.getY() : rTupA.getY(),
+ (rTupB.getZ() > rTupA.getZ()) ? rTupB.getZ() : rTupA.getZ());
+ return aMax;
+ }
+
+ inline B3ITuple absolute(const B3ITuple& rTup)
+ {
+ B3ITuple aAbs(
+ (0 > rTup.getX()) ? -rTup.getX() : rTup.getX(),
+ (0 > rTup.getY()) ? -rTup.getY() : rTup.getY(),
+ (0 > rTup.getZ()) ? -rTup.getZ() : rTup.getZ());
+ return aAbs;
+ }
+
+ inline B3DTuple interpolate(const B3ITuple& rOld1, const B3ITuple& rOld2, double t)
+ {
+ B3DTuple aInt(
+ ((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX(),
+ ((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY(),
+ ((rOld2.getZ() - rOld1.getZ()) * t) + rOld1.getZ());
+ return aInt;
+ }
+
+ inline B3DTuple average(const B3ITuple& rOld1, const B3ITuple& rOld2)
+ {
+ B3DTuple aAvg(
+ (rOld1.getX() + rOld2.getX()) * 0.5,
+ (rOld1.getY() + rOld2.getY()) * 0.5,
+ (rOld1.getZ() + rOld2.getZ()) * 0.5);
+ return aAvg;
+ }
+
+ inline B3DTuple average(const B3ITuple& rOld1, const B3ITuple& rOld2, const B3ITuple& rOld3)
+ {
+ B3DTuple aAvg(
+ (rOld1.getX() + rOld2.getX() + rOld3.getX()) * (1.0 / 3.0),
+ (rOld1.getY() + rOld2.getY() + rOld3.getY()) * (1.0 / 3.0),
+ (rOld1.getZ() + rOld2.getZ() + rOld3.getZ()) * (1.0 / 3.0));
+ return aAvg;
+ }
+
+ inline B3ITuple operator+(const B3ITuple& rTupA, const B3ITuple& rTupB)
+ {
+ B3ITuple aSum(rTupA);
+ aSum += rTupB;
+ return aSum;
+ }
+
+ inline B3ITuple operator-(const B3ITuple& rTupA, const B3ITuple& rTupB)
+ {
+ B3ITuple aSub(rTupA);
+ aSub -= rTupB;
+ return aSub;
+ }
+
+ inline B3ITuple operator/(const B3ITuple& rTupA, const B3ITuple& rTupB)
+ {
+ B3ITuple aDiv(rTupA);
+ aDiv /= rTupB;
+ return aDiv;
+ }
+
+ inline B3ITuple operator*(const B3ITuple& rTupA, const B3ITuple& rTupB)
+ {
+ B3ITuple aMul(rTupA);
+ aMul *= rTupB;
+ return aMul;
+ }
+
+ inline B3ITuple operator*(const B3ITuple& rTup, sal_Int32 t)
+ {
+ B3ITuple aNew(rTup);
+ aNew *= t;
+ return aNew;
+ }
+
+ inline B3ITuple operator*(sal_Int32 t, const B3ITuple& rTup)
+ {
+ B3ITuple aNew(rTup);
+ aNew *= t;
+ return aNew;
+ }
+
+ inline B3ITuple operator/(const B3ITuple& rTup, sal_Int32 t)
+ {
+ B3ITuple aNew(rTup);
+ aNew /= t;
+ return aNew;
+ }
+
+ inline B3ITuple operator/(sal_Int32 t, const B3ITuple& rTup)
+ {
+ B3ITuple aNew(t, t, t);
+ B3ITuple aTmp(rTup);
+ aNew /= aTmp;
+ return aNew;
+ }
+} // end of namespace basegfx
+
+#endif /* _BGFX_TUPLE_B3ITUPLE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/vector/b2dsize.hxx b/include/basegfx/vector/b2dsize.hxx
new file mode 100644
index 000000000000..bde343b46685
--- /dev/null
+++ b/include/basegfx/vector/b2dsize.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_VECTOR_B2DSIZE_HXX
+#define _BGFX_VECTOR_B2DSIZE_HXX
+
+#include <basegfx/vector/b2dvector.hxx>
+
+namespace basegfx
+{
+ // syntactic sugar: a B2DVector exactly models a Size object,
+ // thus, for interface clarity, we provide an alias name
+
+ /// Alias name for interface clarity (not everybody is aware of the identity)
+ typedef B2DVector B2DSize;
+}
+
+#endif /* _BGFX_VECTOR_B2DSIZE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/vector/b2dvector.hxx b/include/basegfx/vector/b2dvector.hxx
new file mode 100644
index 000000000000..99489eb7169c
--- /dev/null
+++ b/include/basegfx/vector/b2dvector.hxx
@@ -0,0 +1,254 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_VECTOR_B2DVECTOR_HXX
+#define _BGFX_VECTOR_B2DVECTOR_HXX
+
+#include <basegfx/tuple/b2dtuple.hxx>
+#include <basegfx/vector/b2ivector.hxx>
+#include <basegfx/vector/b2enums.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ // predeclaration
+ class B2DHomMatrix;
+
+ /** Base Point class with two double values
+
+ This class derives all operators and common handling for
+ a 2D data class from B2DTuple. All necessary extensions
+ which are special for 2D Vectors are added here.
+
+ @see B2DTuple
+ */
+ class BASEGFX_DLLPUBLIC B2DVector : public ::basegfx::B2DTuple
+ {
+ public:
+ /** Create a 2D Vector
+
+ The vector is initialized to (0.0, 0.0)
+ */
+ B2DVector()
+ : B2DTuple()
+ {}
+
+ /** Create a 2D Vector
+
+ @param fX
+ This parameter is used to initialize the X-coordinate
+ of the 2D Vector.
+
+ @param fY
+ This parameter is used to initialize the Y-coordinate
+ of the 2D Vector.
+ */
+ B2DVector(double fX, double fY)
+ : B2DTuple(fX, fY)
+ {}
+
+ /** Create a copy of a 2D Vector
+
+ @param rVec
+ The 2D Vector which will be copied.
+ */
+ B2DVector(const B2DVector& rVec)
+ : B2DTuple(rVec)
+ {}
+
+ /** Create a copy of a 2D Vector
+
+ @param rVec
+ The 2D Vector which will be copied.
+ */
+ explicit B2DVector(const ::basegfx::B2IVector& rVec)
+ : B2DTuple(rVec)
+ {}
+
+ /** constructor with tuple to allow copy-constructing
+ from B2DTuple-based classes
+ */
+ B2DVector(const ::basegfx::B2DTuple& rTuple)
+ : B2DTuple(rTuple)
+ {}
+
+ ~B2DVector()
+ {}
+
+ /** *=operator to allow usage from B2DVector, too
+ */
+ B2DVector& operator*=( const B2DVector& rPnt )
+ {
+ mfX *= rPnt.mfX;
+ mfY *= rPnt.mfY;
+ return *this;
+ }
+
+ /** *=operator to allow usage from B2DVector, too
+ */
+ B2DVector& operator*=(double t)
+ {
+ mfX *= t;
+ mfY *= t;
+ return *this;
+ }
+
+ /** assignment operator to allow assigning the results
+ of B2DTuple calculations
+ */
+ B2DVector& operator=( const ::basegfx::B2DTuple& rVec );
+
+ /** Calculate the length of this 2D Vector
+
+ @return The Length of the 2D Vector
+ */
+ double getLength() const;
+
+ /** Set the length of this 2D Vector
+
+ @param fLen
+ The to be achieved length of the 2D Vector
+ */
+ B2DVector& setLength(double fLen);
+
+ /** Normalize this 2D Vector
+
+ The length of the 2D Vector is set to 1.0
+ */
+ B2DVector& normalize();
+
+ /** Calculate the Scalar with another 2D Vector
+
+ @param rVec
+ The second 2D Vector
+
+ @return
+ The Scalar value of the two involved 2D Vectors
+ */
+ double scalar( const B2DVector& rVec ) const;
+
+ /** Calculate the length of the cross product with another 2D Vector
+
+ In 2D, returning an actual vector does not make much
+ sense here. The magnitude, although, can be readily
+ used for tasks such as angle calculations, since for
+ the returned value, the following equation holds:
+ retVal = getLength(this)*getLength(rVec)*sin(theta),
+ with theta being the angle between the two vectors.
+
+ @param rVec
+ The second 2D Vector
+
+ @return
+ The length of the cross product of the two involved 2D Vectors
+ */
+ double cross( const B2DVector& rVec ) const;
+
+ /** Calculate the Angle with another 2D Vector
+
+ @param rVec
+ The second 2D Vector
+
+ @return
+ The Angle value of the two involved 2D Vectors in -pi/2 < return < pi/2
+ */
+ double angle( const B2DVector& rVec ) const;
+
+ /** Transform vector by given transformation matrix.
+
+ Since this is a vector, translational components of the
+ matrix are disregarded.
+ */
+ B2DVector& operator*=( const B2DHomMatrix& rMat );
+
+ static const B2DVector& getEmptyVector();
+ };
+
+ // external operators
+ //////////////////////////////////////////////////////////////////////////
+
+ /** Calculate the orientation to another 2D Vector
+
+ @param rVecA
+ The first 2D Vector
+
+ @param rVecB
+ The second 2D Vector
+
+ @return
+ The mathematical Orientation of the two involved 2D Vectors
+ */
+ BASEGFX_DLLPUBLIC B2VectorOrientation getOrientation( const B2DVector& rVecA, const B2DVector& rVecB );
+
+ /** Calculate a perpendicular 2D Vector to the given one
+
+ @param rVec
+ The source 2D Vector
+
+ @attention This only works if the given 2D Vector is normalized.
+
+ @return
+ A 2D Vector perpendicular to the one given in parameter rVec
+ */
+ BASEGFX_DLLPUBLIC B2DVector getPerpendicular( const B2DVector& rNormalizedVec );
+
+ /** Calculate a perpendicular 2D Vector to the given one,
+ normalize the given one as preparation
+
+ @param rVec
+ The source 2D Vector
+
+ @return
+ A normalized 2D Vector perpendicular to the one given in parameter rVec
+ */
+ BASEGFX_DLLPUBLIC B2DVector getNormalizedPerpendicular( const B2DVector& rVec );
+
+ /** Test two vectors which need not to be normalized for parallelism
+
+ @param rVecA
+ The first 2D Vector
+
+ @param rVecB
+ The second 2D Vector
+
+ @return
+ bool if the two values are parallel. Also true if
+ one of the vectors is empty.
+ */
+ BASEGFX_DLLPUBLIC bool areParallel( const B2DVector& rVecA, const B2DVector& rVecB );
+
+ /** Transform vector by given transformation matrix.
+
+ Since this is a vector, translational components of the
+ matrix are disregarded.
+ */
+ BASEGFX_DLLPUBLIC B2DVector operator*( const B2DHomMatrix& rMat, const B2DVector& rVec );
+
+ /** Test continuity between given vectors.
+
+ The two given vectors are assumed to describe control points on a
+ common point. Calculate if there is a continuity between them.
+ */
+ BASEGFX_DLLPUBLIC B2VectorContinuity getContinuity( const B2DVector& rBackVector, const B2DVector& rForwardVector );
+
+} // end of namespace basegfx
+
+#endif /* _BGFX_VECTOR_B2DVECTOR_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/vector/b2enums.hxx b/include/basegfx/vector/b2enums.hxx
new file mode 100644
index 000000000000..abbf4cfaf546
--- /dev/null
+++ b/include/basegfx/vector/b2enums.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_VECTOR_B2ENUMS_HXX
+#define _BGFX_VECTOR_B2ENUMS_HXX
+
+#include <sal/types.h>
+
+namespace basegfx
+{
+ /** Descriptor for the mathematical orientations of two 2D Vectors
+ */
+ enum B2VectorOrientation
+ {
+ /// mathematically positive oriented
+ ORIENTATION_POSITIVE = 0,
+
+ /// mathematically negative oriented
+ ORIENTATION_NEGATIVE,
+
+ /// mathematically neutral, thus parallel
+ ORIENTATION_NEUTRAL
+ };
+
+ /** Descriptor for the mathematical continuity of two 2D Vectors
+ */
+ enum B2VectorContinuity
+ {
+ /// none
+ CONTINUITY_NONE = 0,
+
+ /// mathematically negative oriented
+ CONTINUITY_C1,
+
+ /// mathematically neutral, thus parallel
+ CONTINUITY_C2
+ };
+
+ /** Descriptor for possible line joins between two line segments
+ */
+ enum B2DLineJoin
+ {
+ B2DLINEJOIN_NONE, // no rounding
+ B2DLINEJOIN_MIDDLE, // calc middle value between joints
+ B2DLINEJOIN_BEVEL, // join edges with line
+ B2DLINEJOIN_MITER, // extend till cut
+ B2DLINEJOIN_ROUND // create arc
+ };
+
+} // end of namespace basegfx
+
+#endif /* _BGFX_VECTOR_B2ENUMS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/vector/b2isize.hxx b/include/basegfx/vector/b2isize.hxx
new file mode 100644
index 000000000000..4a2fe2228661
--- /dev/null
+++ b/include/basegfx/vector/b2isize.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_VECTOR_B2ISIZE_HXX
+#define _BGFX_VECTOR_B2ISIZE_HXX
+
+#include <basegfx/vector/b2ivector.hxx>
+
+namespace basegfx
+{
+ // syntactic sugar: a B2IVector exactly models a Size object,
+ // thus, for interface clarity, we provide an alias name
+
+ /// Alias name for interface clarity (not everybody is aware of the identity)
+ typedef B2IVector B2ISize;
+}
+
+#endif /* _BGFX_VECTOR_B2ISIZE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/vector/b2ivector.hxx b/include/basegfx/vector/b2ivector.hxx
new file mode 100644
index 000000000000..63ce2ae28fba
--- /dev/null
+++ b/include/basegfx/vector/b2ivector.hxx
@@ -0,0 +1,146 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_VECTOR_B2IVECTOR_HXX
+#define _BGFX_VECTOR_B2IVECTOR_HXX
+
+#include <basegfx/tuple/b2ituple.hxx>
+#include <basegfx/vector/b2enums.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ // predeclaration
+ class B2DHomMatrix;
+
+ /** Base Point class with two sal_Int32 values
+
+ This class derives all operators and common handling for
+ a 2D data class from B2ITuple. All necessary extensions
+ which are special for 2D Vectors are added here.
+
+ @see B2ITuple
+ */
+ class BASEGFX_DLLPUBLIC B2IVector : public ::basegfx::B2ITuple
+ {
+ public:
+ /** Create a 2D Vector
+
+ The vector is initialized to (0, 0)
+ */
+ B2IVector()
+ : B2ITuple()
+ {}
+
+ /** Create a 2D Vector
+
+ @param nX
+ This parameter is used to initialize the X-coordinate
+ of the 2D Vector.
+
+ @param nY
+ This parameter is used to initialize the Y-coordinate
+ of the 2D Vector.
+ */
+ B2IVector(sal_Int32 nX, sal_Int32 nY)
+ : B2ITuple(nX, nY)
+ {}
+
+ /** Create a copy of a 2D Vector
+
+ @param rVec
+ The 2D Vector which will be copied.
+ */
+ B2IVector(const B2IVector& rVec)
+ : B2ITuple(rVec)
+ {}
+
+ /** constructor with tuple to allow copy-constructing
+ from B2ITuple-based classes
+ */
+ B2IVector(const ::basegfx::B2ITuple& rTuple)
+ : B2ITuple(rTuple)
+ {}
+
+ ~B2IVector()
+ {}
+
+ /** *=operator to allow usage from B2IVector, too
+ */
+ B2IVector& operator*=( const B2IVector& rPnt )
+ {
+ mnX *= rPnt.mnX;
+ mnY *= rPnt.mnY;
+ return *this;
+ }
+
+ /** *=operator to allow usage from B2IVector, too
+ */
+ B2IVector& operator*=(sal_Int32 t)
+ {
+ mnX *= t;
+ mnY *= t;
+ return *this;
+ }
+
+ /** assignment operator to allow assigning the results
+ of B2ITuple calculations
+ */
+ B2IVector& operator=( const ::basegfx::B2ITuple& rVec );
+
+ /** Set the length of this 2D Vector
+
+ @param fLen
+ The to be achieved length of the 2D Vector
+ */
+ B2IVector& setLength(double fLen);
+
+ /** Calculate the Scalar with another 2D Vector
+
+ @param rVec
+ The second 2D Vector
+
+ @return
+ The Scalar value of the two involved 2D Vectors
+ */
+ double scalar( const B2IVector& rVec ) const;
+
+ /** Transform vector by given transformation matrix.
+
+ Since this is a vector, translational components of the
+ matrix are disregarded.
+ */
+ B2IVector& operator*=( const B2DHomMatrix& rMat );
+ };
+
+ // external operators
+ //////////////////////////////////////////////////////////////////////////
+
+ /** Transform vector by given transformation matrix.
+
+ Since this is a vector, translational components of the
+ matrix are disregarded.
+ */
+ BASEGFX_DLLPUBLIC B2IVector operator*( const B2DHomMatrix& rMat, const B2IVector& rVec );
+
+} // end of namespace basegfx
+
+#endif /* _BGFX_VECTOR_B2IVECTOR_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/vector/b3dvector.hxx b/include/basegfx/vector/b3dvector.hxx
new file mode 100644
index 000000000000..99f23bc7b6d3
--- /dev/null
+++ b/include/basegfx/vector/b3dvector.hxx
@@ -0,0 +1,322 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_VECTOR_B3DVECTOR_HXX
+#define _BGFX_VECTOR_B3DVECTOR_HXX
+
+#include <basegfx/tuple/b3dtuple.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ // predeclaration
+ class B3DHomMatrix;
+
+ /** Base Point class with three double values
+
+ This class derives all operators and common handling for
+ a 3D data class from B3DTuple. All necessary extensions
+ which are special for 3D Vectors are added here.
+
+ @see B3DTuple
+ */
+ class BASEGFX_DLLPUBLIC B3DVector : public ::basegfx::B3DTuple
+ {
+ public:
+ /** Create a 3D Vector
+
+ The vector is initialized to (0.0, 0.0, 0.0)
+ */
+ B3DVector()
+ : B3DTuple()
+ {}
+
+ /** Create a 3D Vector
+
+ @param fX
+ This parameter is used to initialize the X-coordinate
+ of the 3D Vector.
+
+ @param fY
+ This parameter is used to initialize the Y-coordinate
+ of the 3D Vector.
+
+ @param fZ
+ This parameter is used to initialize the Z-coordinate
+ of the 3D Vector.
+ */
+ B3DVector(double fX, double fY, double fZ)
+ : B3DTuple(fX, fY, fZ)
+ {}
+
+ /** Create a copy of a 3D Vector
+
+ @param rVec
+ The 3D Vector which will be copied.
+ */
+ B3DVector(const B3DVector& rVec)
+ : B3DTuple(rVec)
+ {}
+
+ /** constructor with tuple to allow copy-constructing
+ from B3DTuple-based classes
+ */
+ B3DVector(const ::basegfx::B3DTuple& rTuple)
+ : B3DTuple(rTuple)
+ {}
+
+ ~B3DVector()
+ {}
+
+ /** *=operator to allow usage from B3DVector, too
+ */
+ B3DVector& operator*=( const B3DVector& rPnt )
+ {
+ mfX *= rPnt.mfX;
+ mfY *= rPnt.mfY;
+ mfZ *= rPnt.mfZ;
+ return *this;
+ }
+
+ /** *=operator to allow usage from B3DVector, too
+ */
+ B3DVector& operator*=(double t)
+ {
+ mfX *= t;
+ mfY *= t;
+ mfZ *= t;
+ return *this;
+ }
+
+ /** assignment operator to allow assigning the results
+ of B3DTuple calculations
+ */
+ B3DVector& operator=( const ::basegfx::B3DTuple& rVec )
+ {
+ mfX = rVec.getX();
+ mfY = rVec.getY();
+ mfZ = rVec.getZ();
+ return *this;
+ }
+
+ /** Calculate the length of this 3D Vector
+
+ @return The Length of the 3D Vector
+ */
+ double getLength(void) const
+ {
+ double fLen(scalar(*this));
+ if((0.0 == fLen) || (1.0 == fLen))
+ return fLen;
+ return sqrt(fLen);
+ }
+
+ /** Calculate the length in the XY-Plane for this 3D Vector
+
+ @return The XY-Plane Length of the 3D Vector
+ */
+ double getXYLength(void) const
+ {
+ double fLen((mfX * mfX) + (mfY * mfY));
+ if((0.0 == fLen) || (1.0 == fLen))
+ return fLen;
+ return sqrt(fLen);
+ }
+
+ /** Calculate the length in the XZ-Plane for this 3D Vector
+
+ @return The XZ-Plane Length of the 3D Vector
+ */
+ double getXZLength(void) const
+ {
+ double fLen((mfX * mfX) + (mfZ * mfZ)); // #i73040#
+ if((0.0 == fLen) || (1.0 == fLen))
+ return fLen;
+ return sqrt(fLen);
+ }
+
+ /** Calculate the length in the YZ-Plane for this 3D Vector
+
+ @return The YZ-Plane Length of the 3D Vector
+ */
+ double getYZLength(void) const
+ {
+ double fLen((mfY * mfY) + (mfZ * mfZ));
+ if((0.0 == fLen) || (1.0 == fLen))
+ return fLen;
+ return sqrt(fLen);
+ }
+
+ /** Set the length of this 3D Vector
+
+ @param fLen
+ The to be achieved length of the 3D Vector
+ */
+ B3DVector& setLength(double fLen)
+ {
+ double fLenNow(scalar(*this));
+
+ if(!::basegfx::fTools::equalZero(fLenNow))
+ {
+ const double fOne(1.0);
+
+ if(!::basegfx::fTools::equal(fOne, fLenNow))
+ {
+ fLen /= sqrt(fLenNow);
+ }
+
+ mfX *= fLen;
+ mfY *= fLen;
+ mfZ *= fLen;
+ }
+
+ return *this;
+ }
+
+ /** Normalize this 3D Vector
+
+ The length of the 3D Vector is set to 1.0
+ */
+ B3DVector& normalize();
+
+ /** Test if this 3D Vector is normalized
+
+ @return
+ true if lenth of vector is equal to 1.0
+ false else
+ */
+ bool isNormalized() const
+ {
+ const double fOne(1.0);
+ const double fScalar(scalar(*this));
+
+ return (::basegfx::fTools::equal(fOne, fScalar));
+ }
+
+ /** get a 3D Vector which is perpendicular to this and a given 3D Vector
+
+ @attention This only works if this and the given 3D Vector are
+ both normalized.
+
+ @param rNormalizedVec
+ A normalized 3D Vector.
+
+ @return
+ A 3D Vector perpendicular to this and the given one
+ */
+ B3DVector getPerpendicular(const B3DVector& rNormalizedVec) const;
+
+ /** Calculate the Scalar product
+
+ This method calculates the Scalar product between this
+ and the given 3D Vector.
+
+ @param rVec
+ A second 3D Vector.
+
+ @return
+ The Scalar Product of two 3D Vectors
+ */
+ double scalar(const B3DVector& rVec) const
+ {
+ return ((mfX * rVec.mfX) + (mfY * rVec.mfY) + (mfZ * rVec.mfZ));
+ }
+
+ /** Transform vector by given transformation matrix.
+
+ Since this is a vector, translational components of the
+ matrix are disregarded.
+ */
+ B3DVector& operator*=( const B3DHomMatrix& rMat );
+
+ static const B3DVector& getEmptyVector()
+ {
+ return (const B3DVector&) ::basegfx::B3DTuple::getEmptyTuple();
+ }
+ };
+
+ // external operators
+ //////////////////////////////////////////////////////////////////////////
+
+ /** get a 3D Vector which is in 2D (ignoring
+ the Z-Coordinate) perpendicular to a given 3D Vector
+
+ @attention This only works if the given 3D Vector is normalized.
+
+ @param rNormalizedVec
+ A normalized 3D Vector.
+
+ @return
+ A 3D Vector perpendicular to the given one in X,Y (2D).
+ */
+ inline B3DVector getPerpendicular2D( const B3DVector& rNormalizedVec )
+ {
+ B3DVector aPerpendicular(-rNormalizedVec.getY(), rNormalizedVec.getX(), rNormalizedVec.getZ());
+ return aPerpendicular;
+ }
+
+ /** Test two vectors which need not to be normalized for parallelism
+
+ @param rVecA
+ The first 3D Vector
+
+ @param rVecB
+ The second 3D Vector
+
+ @return
+ bool if the two values are parallel. Also true if
+ one of the vectors is empty.
+ */
+ BASEGFX_DLLPUBLIC bool areParallel( const B3DVector& rVecA, const B3DVector& rVecB );
+
+ /** Transform vector by given transformation matrix.
+
+ Since this is a vector, translational components of the
+ matrix are disregarded.
+ */
+ BASEGFX_DLLPUBLIC B3DVector operator*( const B3DHomMatrix& rMat, const B3DVector& rVec );
+
+ /** Calculate the Cross Product of two 3D Vectors
+
+ @param rVecA
+ A first 3D Vector.
+
+ @param rVecB
+ A second 3D Vector.
+
+ @return
+ The Cross Product of both 3D Vectors
+ */
+ inline B3DVector cross(const B3DVector& rVecA, const B3DVector& rVecB)
+ {
+ B3DVector aVec(
+ rVecA.getY() * rVecB.getZ() - rVecA.getZ() * rVecB.getY(),
+ rVecA.getZ() * rVecB.getX() - rVecA.getX() * rVecB.getZ(),
+ rVecA.getX() * rVecB.getY() - rVecA.getY() * rVecB.getX());
+ return aVec;
+ }
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif /* _BGFX_VECTOR_B3DVECTOR_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/vector/b3ivector.hxx b/include/basegfx/vector/b3ivector.hxx
new file mode 100644
index 000000000000..8248ade15cb0
--- /dev/null
+++ b/include/basegfx/vector/b3ivector.hxx
@@ -0,0 +1,249 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_VECTOR_B3IVECTOR_HXX
+#define _BGFX_VECTOR_B3IVECTOR_HXX
+
+#include <basegfx/tuple/b3ituple.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ // predeclaration
+ class B3DHomMatrix;
+
+ /** Base Point class with three sal_Int32 values
+
+ This class derives all operators and common handling for
+ a 3D data class from B3ITuple. All necessary extensions
+ which are special for 3D Vectors are added here.
+
+ @see B3ITuple
+ */
+ class BASEGFX_DLLPUBLIC B3IVector : public ::basegfx::B3ITuple
+ {
+ public:
+ /** Create a 3D Vector
+
+ The vector is initialized to (0, 0, 0)
+ */
+ B3IVector()
+ : B3ITuple()
+ {}
+
+ /** Create a 3D Vector
+
+ @param nX
+ This parameter is used to initialize the X-coordinate
+ of the 3D Vector.
+
+ @param nY
+ This parameter is used to initialize the Y-coordinate
+ of the 3D Vector.
+
+ @param nZ
+ This parameter is used to initialize the Z-coordinate
+ of the 3D Vector.
+ */
+ B3IVector(sal_Int32 nX, sal_Int32 nY, sal_Int32 nZ)
+ : B3ITuple(nX, nY, nZ)
+ {}
+
+ /** Create a copy of a 3D Vector
+
+ @param rVec
+ The 3D Vector which will be copied.
+ */
+ B3IVector(const B3IVector& rVec)
+ : B3ITuple(rVec)
+ {}
+
+ /** constructor with tuple to allow copy-constructing
+ from B3ITuple-based classes
+ */
+ B3IVector(const ::basegfx::B3ITuple& rTuple)
+ : B3ITuple(rTuple)
+ {}
+
+ ~B3IVector()
+ {}
+
+ /** *=operator to allow usage from B3IVector, too
+ */
+ B3IVector& operator*=( const B3IVector& rPnt )
+ {
+ mnX *= rPnt.mnX;
+ mnY *= rPnt.mnY;
+ mnZ *= rPnt.mnZ;
+ return *this;
+ }
+
+ /** *=operator to allow usage from B3IVector, too
+ */
+ B3IVector& operator*=(sal_Int32 t)
+ {
+ mnX *= t;
+ mnY *= t;
+ mnZ *= t;
+ return *this;
+ }
+
+ /** assignment operator to allow assigning the results
+ of B3ITuple calculations
+ */
+ B3IVector& operator=( const ::basegfx::B3ITuple& rVec )
+ {
+ mnX = rVec.getX();
+ mnY = rVec.getY();
+ mnZ = rVec.getZ();
+ return *this;
+ }
+
+ /** Calculate the length of this 3D Vector
+
+ @return The Length of the 3D Vector
+ */
+ double getLength(void) const
+ {
+ double fLen(scalar(*this));
+ if((0 == fLen) || (1.0 == fLen))
+ return fLen;
+ return sqrt(fLen);
+ }
+
+ /** Calculate the length in the XY-Plane for this 3D Vector
+
+ @return The XY-Plane Length of the 3D Vector
+ */
+ double getXYLength(void) const
+ {
+ double fLen((mnX * mnX) + (mnY * mnY));
+ if((0 == fLen) || (1.0 == fLen))
+ return fLen;
+ return sqrt(fLen);
+ }
+
+ /** Calculate the length in the XZ-Plane for this 3D Vector
+
+ @return The XZ-Plane Length of the 3D Vector
+ */
+ double getXZLength(void) const
+ {
+ double fLen((mnX * mnZ) + (mnY * mnZ));
+ if((0 == fLen) || (1.0 == fLen))
+ return fLen;
+ return sqrt(fLen);
+ }
+
+ /** Calculate the length in the YZ-Plane for this 3D Vector
+
+ @return The YZ-Plane Length of the 3D Vector
+ */
+ double getYZLength(void) const
+ {
+ double fLen((mnY * mnY) + (mnZ * mnZ));
+ if((0 == fLen) || (1.0 == fLen))
+ return fLen;
+ return sqrt(fLen);
+ }
+
+ /** Set the length of this 3D Vector
+
+ @param fLen
+ The to be achieved length of the 3D Vector
+ */
+ B3IVector& setLength(double fLen)
+ {
+ double fLenNow(scalar(*this));
+
+ if(!::basegfx::fTools::equalZero(fLenNow))
+ {
+ const double fOne(1.0);
+
+ if(!::basegfx::fTools::equal(fOne, fLenNow))
+ {
+ fLen /= sqrt(fLenNow);
+ }
+
+ mnX = fround(mnX*fLen);
+ mnY = fround(mnY*fLen);
+ mnZ = fround(mnZ*fLen);
+ }
+
+ return *this;
+ }
+
+ /** Calculate the Scalar product
+
+ This method calculates the Scalar product between this
+ and the given 3D Vector.
+
+ @param rVec
+ A second 3D Vector.
+
+ @return
+ The Scalar Product of two 3D Vectors
+ */
+ double scalar(const B3IVector& rVec) const
+ {
+ return ((mnX * rVec.mnX) + (mnY * rVec.mnY) + (mnZ * rVec.mnZ));
+ }
+
+ /** Transform vector by given transformation matrix.
+
+ Since this is a vector, translational components of the
+ matrix are disregarded.
+ */
+ B3IVector& operator*=( const B3DHomMatrix& rMat );
+ };
+
+ // external operators
+ //////////////////////////////////////////////////////////////////////////
+
+ /** Transform vector by given transformation matrix.
+
+ Since this is a vector, translational components of the
+ matrix are disregarded.
+ */
+ BASEGFX_DLLPUBLIC B3IVector operator*( const B3DHomMatrix& rMat, const B3IVector& rVec );
+
+ /** Calculate the Cross Product of two 3D Vectors
+
+ @param rVecA
+ A first 3D Vector.
+
+ @param rVecB
+ A second 3D Vector.
+
+ @return
+ The Cross Product of both 3D Vectors
+ */
+ inline B3IVector cross(const B3IVector& rVecA, const B3IVector& rVecB)
+ {
+ B3IVector aVec(
+ rVecA.getY() * rVecB.getZ() - rVecA.getZ() * rVecB.getY(),
+ rVecA.getZ() * rVecB.getX() - rVecA.getX() * rVecB.getZ(),
+ rVecA.getX() * rVecB.getY() - rVecA.getY() * rVecB.getX());
+ return aVec;
+ }
+} // end of namespace basegfx
+
+#endif /* _BGFX_VECTOR_B3DVECTOR_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/basicdllapi.h b/include/basic/basicdllapi.h
new file mode 100644
index 000000000000..5c5c4647cd4c
--- /dev/null
+++ b/include/basic/basicdllapi.h
@@ -0,0 +1,23 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef INCLUDED_BASICDLLAPI_H
+#define INCLUDED_BASICDLLAPI_H
+
+#include "sal/types.h"
+
+#if defined(BASIC_DLLIMPLEMENTATION)
+#define BASIC_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define BASIC_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define BASIC_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif /* INCLUDED_BASICDLLAPI_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/basicmanagerrepository.hxx b/include/basic/basicmanagerrepository.hxx
new file mode 100644
index 000000000000..411aeadb8545
--- /dev/null
+++ b/include/basic/basicmanagerrepository.hxx
@@ -0,0 +1,142 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef BASICMANAGERREPOSITORY_HXX
+#define BASICMANAGERREPOSITORY_HXX
+
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/embed/XStorage.hpp>
+#include "basicdllapi.h"
+
+class BasicManager;
+
+//........................................................................
+namespace basic
+{
+//........................................................................
+
+ //====================================================================
+ //= BasicManagerRepository
+ //====================================================================
+ /** specifies a callback for instances which are interested in BasicManagers
+ created by the BasicManagerRepository.
+ */
+ class BASIC_DLLPUBLIC SAL_NO_VTABLE BasicManagerCreationListener
+ {
+ public:
+ /** is called when a BasicManager has been created
+
+ @param _rxForDocument
+ denotes the document for which the BasicManager has been created. If this is <NULL/>,
+ then the BasicManager is the application-wide BasicManager.
+
+ @param _pBasicManager
+ denotes the BasicManager which has been created. The listener might for instance
+ decide to add global variables to it, or otherwise initialize it.
+ */
+ virtual void onBasicManagerCreated(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxForDocument,
+ BasicManager& _rBasicManager
+ ) = 0;
+
+ protected:
+ ~BasicManagerCreationListener() {}
+ };
+
+ //====================================================================
+ //= BasicManagerRepository
+ //====================================================================
+ class BASIC_DLLPUBLIC BasicManagerRepository
+ {
+ public:
+ /** returns the BasicManager belonging to the given document
+
+ If the BasicManager does not yet exist, it is created. In this case, if the application's
+ BasicManager does not yet exist, it is also created. This is necessary since
+ the application's BasicManager acts as parent for all document's BasicManagers.
+
+ If you're interested in this case - the implicit creation of the application's BasicManager -,
+ then you need to register as BasicManagerCreationListener.
+
+ @param _rxDocumentModel
+ denotes the document model whose BasicManager is to be retrieved. Must not be <NULL/>.
+ The document should support the XDocumentPropertiesSupplier
+ interface, for retrieving
+ its title, which is needed in some error conditions.
+ Also it <em>must</em> support the XStorageBasedDocument interface, since we
+ must be able to retrieve the document's storage. If this interface is <em>not</em>
+ supported, creating a new BasicManager will certainly fail.
+
+ @return
+ the BasicManager for this model.
+
+ @attention
+ The returned BasicManager instances is owned by the repository. In particular,
+ you are not allowed to delete it. Instead, the given model is observed: As soon
+ as it's closed, the associated BasicManager is deleted.
+ */
+ static BasicManager* getDocumentBasicManager(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxDocumentModel
+ );
+
+ /** returns the application-wide BasicManager
+
+ @param _bCreate
+ determines whether the BasicManager should be created (<TRUE/>) if it
+ does not yet exist.
+
+ @attention
+ If the BasicManager is newly created, then it is still owned by the repository.
+ In particular, you are not allowed to delete it. Instead, call resetApplicationBasicManager
+ to release the BasicManager.
+ */
+ static BasicManager* getApplicationBasicManager( bool _bCreate );
+
+ /** resets the application-wide BasicManager to <NULL/>
+ */
+ static void resetApplicationBasicManager();
+
+ /** registers a BasicManagerCreationListener instance which is notified whenever
+ the repository creates a BasicManager instance.
+
+ Note that this listener is <em>not</em> called when somebody else
+ creates BasicManager instances.
+
+ If the same listener is registered multiple times, it is also notified
+ multiple times, and needs to be revoked once for each registration.
+ */
+ static void registerCreationListener(
+ BasicManagerCreationListener& _rListener
+ );
+
+ /** reveokes a BasicManagerCreationListener instance which has previously
+ been registered to be notified about created BasicManager instances.
+ */
+ static void revokeCreationListener(
+ BasicManagerCreationListener& _rListener
+ );
+ };
+
+//........................................................................
+} // namespace basic
+//........................................................................
+
+#endif // BASICMANAGERREPOSITORY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/basmgr.hxx b/include/basic/basmgr.hxx
new file mode 100644
index 000000000000..12bca4779565
--- /dev/null
+++ b/include/basic/basmgr.hxx
@@ -0,0 +1,238 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _BASMGR_HXX
+#define _BASMGR_HXX
+
+#include <svl/brdcst.hxx>
+#include <basic/sbstar.hxx>
+#include <com/sun/star/script/XStorageBasedLibraryContainer.hpp>
+#include <com/sun/star/script/XStarBasicAccess.hpp>
+#include "basicdllapi.h"
+#include <vector>
+
+// Basic XML Import/Export
+BASIC_DLLPUBLIC com::sun::star::uno::Reference< com::sun::star::script::XStarBasicAccess >
+ getStarBasicAccess( BasicManager* pMgr );
+
+class SotStorage;
+
+#define BASERR_REASON_OPENSTORAGE 0x0001
+#define BASERR_REASON_OPENLIBSTORAGE 0x0002
+#define BASERR_REASON_OPENMGRSTREAM 0x0004
+#define BASERR_REASON_OPENLIBSTREAM 0x0008
+#define BASERR_REASON_LIBNOTFOUND 0x0010
+#define BASERR_REASON_STORAGENOTFOUND 0x0020
+#define BASERR_REASON_BASICLOADERROR 0x0040
+#define BASERR_REASON_NOSTORAGENAME 0x0080
+
+#define BASERR_REASON_STDLIB 0x0100
+
+class BASIC_DLLPUBLIC BasicError
+{
+private:
+ sal_uIntPtr nErrorId;
+ sal_uInt16 nReason;
+ OUString aErrStr;
+
+public:
+ BasicError( const BasicError& rErr );
+ BasicError( sal_uIntPtr nId, sal_uInt16 nR, const OUString& rErrStr );
+
+ sal_uIntPtr GetErrorId() const { return nErrorId; }
+ sal_uInt16 GetReason() const { return nReason; }
+ OUString GetErrorStr() { return aErrStr; }
+
+ void SetErrorId( sal_uIntPtr n ) { nErrorId = n; }
+ void SetReason( sal_uInt16 n ) { nReason = n; }
+ void SetErrorStr( const OUString& rStr) { aErrStr = rStr; }
+};
+
+class BasicLibs;
+class ErrorManager;
+class BasicLibInfo;
+
+namespace basic { class BasicManagerCleaner; }
+
+// Library password handling for 5.0 documents
+class BASIC_DLLPUBLIC OldBasicPassword
+{
+public:
+ virtual void setLibraryPassword( const OUString& rLibraryName, const OUString& rPassword ) = 0;
+ virtual OUString getLibraryPassword( const OUString& rLibraryName ) = 0;
+ virtual void clearLibraryPassword( const OUString& rLibraryName ) = 0;
+ virtual sal_Bool hasLibraryPassword( const OUString& rLibraryName ) = 0;
+
+protected:
+ ~OldBasicPassword() {}
+};
+
+struct LibraryContainerInfo
+{
+ ::com::sun::star::uno::Reference< com::sun::star::script::XPersistentLibraryContainer > mxScriptCont;
+ ::com::sun::star::uno::Reference< com::sun::star::script::XPersistentLibraryContainer > mxDialogCont;
+ OldBasicPassword* mpOldBasicPassword;
+
+ LibraryContainerInfo()
+ :mpOldBasicPassword( NULL )
+ {
+ }
+
+ LibraryContainerInfo
+ (
+ com::sun::star::uno::Reference< com::sun::star::script::XPersistentLibraryContainer > xScriptCont,
+ com::sun::star::uno::Reference< com::sun::star::script::XPersistentLibraryContainer > xDialogCont,
+ OldBasicPassword* pOldBasicPassword
+ )
+ : mxScriptCont( xScriptCont )
+ , mxDialogCont( xDialogCont )
+ , mpOldBasicPassword( pOldBasicPassword )
+ {}
+};
+
+struct BasicManagerImpl;
+
+
+#define LIB_NOTFOUND 0xFFFF
+
+class BASIC_DLLPUBLIC BasicManager : public SfxBroadcaster
+{
+ friend class LibraryContainer_Impl;
+ friend class StarBasicAccess_Impl;
+ friend class BasMgrContainerListenerImpl;
+ friend class ::basic::BasicManagerCleaner;
+
+private:
+ BasicLibs* pLibs;
+ std::vector<BasicError> aErrors;
+
+ OUString aName;
+ OUString maStorageName;
+ bool mbDocMgr;
+
+ BasicManagerImpl* mpImpl;
+
+ BASIC_DLLPRIVATE void Init();
+
+protected:
+ sal_Bool ImpLoadLibrary( BasicLibInfo* pLibInfo ) const;
+ sal_Bool ImpLoadLibrary( BasicLibInfo* pLibInfo, SotStorage* pCurStorage, sal_Bool bInfosOnly = sal_False );
+ void ImpCreateStdLib( StarBASIC* pParentFromStdLib );
+ void ImpMgrNotLoaded( const OUString& rStorageName );
+ BasicLibInfo* CreateLibInfo();
+ void LoadBasicManager( SotStorage& rStorage, const OUString& rBaseURL, sal_Bool bLoadBasics = sal_True );
+ void LoadOldBasicManager( SotStorage& rStorage );
+ sal_Bool ImplLoadBasic( SvStream& rStrm, StarBASICRef& rOldBasic ) const;
+ sal_Bool ImplEncryptStream( SvStream& rStream ) const;
+ BasicLibInfo* FindLibInfo( StarBASIC* pBasic ) const;
+ void CheckModules( StarBASIC* pBasic, sal_Bool bReference ) const;
+ ~BasicManager();
+
+public:
+ TYPEINFO();
+ BasicManager( SotStorage& rStorage, const OUString& rBaseURL, StarBASIC* pParentFromStdLib = NULL, OUString* pLibPath = NULL, bool bDocMgr = false );
+ BasicManager( StarBASIC* pStdLib, OUString* pLibPath = NULL, bool bDocMgr = false );
+
+ /** deletes the given BasicManager instance
+
+ This method is necessary since normally, BasicManager instances are owned by the BasicManagerRepository,
+ and expected to be deleted by the repository only. However, there exists quite some legacy code,
+ which needs to explicitly delete a BasicManager itself. This code must not use the (protected)
+ destructor, but LegacyDeleteBasicManager.
+ */
+ static void LegacyDeleteBasicManager( BasicManager*& _rpManager );
+
+ void SetStorageName( const OUString& rName ) { maStorageName = rName; }
+ OUString GetStorageName() const { return maStorageName; }
+ void SetName( const OUString& rName ) { aName = rName; }
+ OUString GetName() const { return aName; }
+
+
+ sal_uInt16 GetLibCount() const;
+ StarBASIC* GetLib( sal_uInt16 nLib ) const;
+ StarBASIC* GetLib( const OUString& rName ) const;
+ sal_uInt16 GetLibId( const OUString& rName ) const;
+
+ OUString GetLibName( sal_uInt16 nLib );
+
+ /** announces the library containers which belong to this BasicManager
+
+ The method will automatically add two global constants, BasicLibraries and DialogLibraries,
+ to the BasicManager.
+ */
+ void SetLibraryContainerInfo( const LibraryContainerInfo& rInfo );
+
+ const ::com::sun::star::uno::Reference< com::sun::star::script::XPersistentLibraryContainer >&
+ GetDialogLibraryContainer() const;
+ const ::com::sun::star::uno::Reference< com::sun::star::script::XPersistentLibraryContainer >&
+ GetScriptLibraryContainer() const;
+
+ sal_Bool LoadLib( sal_uInt16 nLib );
+ sal_Bool RemoveLib( sal_uInt16 nLib, sal_Bool bDelBasicFromStorage );
+
+ // Modify-Flag will be reset only during save.
+ sal_Bool IsBasicModified() const;
+
+ std::vector<BasicError>& GetErrors();
+
+ /** sets a global constant in the basic library, referring to some UNO object, to a new value.
+
+ If a constant with this name already existed before, its value is changed, and the old constant is
+ returned. If it does not yet exist, it is newly created, and inserted into the basic library.
+ */
+ ::com::sun::star::uno::Any
+ SetGlobalUNOConstant( const sal_Char* _pAsciiName, const ::com::sun::star::uno::Any& _rValue );
+
+ /** retrieves a global constant in the basic library, referring to some UNO object, returns true if a value is found ( value is in aOut ) false otherwise. */
+ bool GetGlobalUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::uno::Any& aOut );
+ /** determines whether there are password-protected modules whose size exceedes the
+ legacy module size
+ @param _out_rModuleNames
+ takes the names of modules whose size exceeds the legacy limit
+ */
+ bool LegacyPsswdBinaryLimitExceeded( ::com::sun::star::uno::Sequence< OUString >& _out_rModuleNames );
+ bool HasExeCode( const OUString& );
+ /// determines whether the Basic Manager has a given macro, given by fully qualified name
+ bool HasMacro( OUString const& i_fullyQualifiedName ) const;
+ /// executes a given macro
+ ErrCode ExecuteMacro( OUString const& i_fullyQualifiedName, SbxArray* i_arguments, SbxValue* i_retValue );
+ /// executes a given macro
+ ErrCode ExecuteMacro( OUString const& i_fullyQualifiedName, OUString const& i_commaSeparatedArgs, SbxValue* i_retValue );
+
+private:
+ BASIC_DLLPRIVATE sal_Bool IsReference( sal_uInt16 nLib );
+
+ BASIC_DLLPRIVATE sal_Bool SetLibName( sal_uInt16 nLib, const OUString& rName );
+
+ BASIC_DLLPRIVATE StarBASIC* GetStdLib() const;
+ BASIC_DLLPRIVATE StarBASIC* AddLib( SotStorage& rStorage, const OUString& rLibName, sal_Bool bReference );
+ BASIC_DLLPRIVATE sal_Bool RemoveLib( sal_uInt16 nLib );
+ BASIC_DLLPRIVATE sal_Bool HasLib( const OUString& rName ) const;
+
+ BASIC_DLLPRIVATE StarBASIC* CreateLibForLibContainer( const OUString& rLibName,
+ const com::sun::star::uno::Reference< com::sun::star::script::XLibraryContainer >&
+ xScriptCont );
+ // For XML import/export:
+ BASIC_DLLPRIVATE StarBASIC* CreateLib( const OUString& rLibName );
+ BASIC_DLLPRIVATE StarBASIC* CreateLib( const OUString& rLibName, const OUString& Password,
+ const OUString& LinkTargetURL );
+};
+
+#endif //_BASMGR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/basrdll.hxx b/include/basic/basrdll.hxx
new file mode 100644
index 000000000000..20edde65b9cd
--- /dev/null
+++ b/include/basic/basrdll.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BASRDLL_HXX
+#define _BASRDLL_HXX
+
+class ResMgr;
+
+#include <vcl/accel.hxx>
+#include "basicdllapi.h"
+
+class BASIC_DLLPUBLIC BasicDLL
+{
+private:
+ ResMgr* pBasResMgr;
+
+ bool bDebugMode;
+ bool bBreakEnabled;
+
+public:
+ BasicDLL();
+ ~BasicDLL();
+
+ ResMgr* GetBasResMgr() const { return pBasResMgr; }
+
+ static void BasicBreak();
+
+ static void EnableBreak( bool bEnable );
+ static void SetDebugMode( bool bDebugMode );
+};
+
+#define BASIC_DLL() (*(BasicDLL**)GetAppData( SHL_BASIC ) )
+
+#endif //_BASRDLL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/global.hxx b/include/basic/global.hxx
new file mode 100644
index 000000000000..e63029da5785
--- /dev/null
+++ b/include/basic/global.hxx
@@ -0,0 +1,28 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ */
+
+#ifndef BASIC_SBGLOBAL_HXX
+#define BASIC_SBGLOBAL_HXX
+
+namespace utl {
+ class TransliterationWrapper;
+}
+
+class SbGlobal
+{
+public:
+ static utl::TransliterationWrapper& GetTransliteration();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/modsizeexceeded.hxx b/include/basic/modsizeexceeded.hxx
new file mode 100644
index 000000000000..05dd70b4b66d
--- /dev/null
+++ b/include/basic/modsizeexceeded.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BASIC_MODSIZEEXCEEDED_HXX
+#define _BASIC_MODSIZEEXCEEDED_HXX
+
+#include <com/sun/star/task/XInteractionHandler.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include "basicdllapi.h"
+
+class BASIC_DLLPUBLIC ModuleSizeExceeded : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionRequest >
+{
+ // C++ interface
+ public:
+ ModuleSizeExceeded( const com::sun::star::uno::Sequence<OUString>& sModules );
+
+ sal_Bool isAbort() const;
+ sal_Bool isApprove() const;
+
+ // UNO interface
+ public:
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< com::sun::star::task::XInteractionContinuation > > SAL_CALL getContinuations() throw( ::com::sun::star::uno::RuntimeException ) { return m_lContinuations; }
+ com::sun::star::uno::Any SAL_CALL getRequest() throw( com::sun::star::uno::RuntimeException )
+ {
+ return m_aRequest;
+ }
+
+ // member
+ private:
+ OUString m_sMods;
+ com::sun::star::uno::Any m_aRequest;
+ com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::task::XInteractionContinuation > > m_lContinuations;
+ com::sun::star::uno::Reference< com::sun::star::task::XInteractionContinuation > m_xAbort;
+ com::sun::star::uno::Reference< com::sun::star::task::XInteractionContinuation> m_xApprove;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbdef.hxx b/include/basic/sbdef.hxx
new file mode 100644
index 000000000000..2bc29cbb08c3
--- /dev/null
+++ b/include/basic/sbdef.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SB_SBDEF_HXX
+#define _SB_SBDEF_HXX
+
+#include <basic/sbxdef.hxx>
+#include <rtl/ustring.hxx>
+#include "basicdllapi.h"
+
+// Returns type name for Basic type, array flag is ignored
+// implementation: basic/source/runtime/methods.cxx
+BASIC_DLLPUBLIC OUString getBasicTypeName( SbxDataType eType );
+
+// Returns type name for Basic objects, especially
+// important for SbUnoObj instances
+// implementation: basic/source/classes/sbunoobj.cxx
+class SbxObject;
+BASIC_DLLPUBLIC OUString getBasicObjectTypeName( SbxObject* pObj );
+
+// Allows Basic IDE to set watch mode to suppress errors
+// implementation: basic/source/runtime/runtime.cxx
+BASIC_DLLPUBLIC void setBasicWatchMode( bool bOn );
+
+// Debug Flags:
+#define SbDEBUG_BREAK 0x0001 // Break-Callback
+#define SbDEBUG_STEPINTO 0x0002 // Single Step-Callback
+#define SbDEBUG_STEPOVER 0x0004 // Additional flag Step Over
+#define SbDEBUG_CONTINUE 0x0008 // Do not change flags
+#define SbDEBUG_STEPOUT 0x0010 // Leave Sub
+
+#define SBXID_BASIC 0x6273 // sb: StarBASIC
+#define SBXID_BASICMOD 0x6d62 // bm: StarBASIC Module
+#define SBXID_BASICPROP 0x7262 // pr: StarBASIC Property
+#define SBXID_BASICMETHOD 0x6d65 // me: StarBASIC Method
+#define SBXID_JSCRIPTMOD 0x6a62 // jm: JavaScript Module
+#define SBXID_JSCRIPTMETH 0x6a64 // jm: JavaScript Module
+
+#define SBX_HINT_BASICSTART SFX_HINT_USER04
+#define SBX_HINT_BASICSTOP SFX_HINT_USER05
+
+enum PropertyMode
+{
+ PROPERTY_MODE_NONE,
+ PROPERTY_MODE_GET,
+ PROPERTY_MODE_LET,
+ PROPERTY_MODE_SET
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sberrors.hxx b/include/basic/sberrors.hxx
new file mode 100644
index 000000000000..f287f3afca88
--- /dev/null
+++ b/include/basic/sberrors.hxx
@@ -0,0 +1,418 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SB_SBERRORS_HXX
+#define _SB_SBERRORS_HXX
+
+#include <basic/sbxdef.hxx>
+
+#ifndef __RSC
+typedef sal_uIntPtr SbError;
+#endif
+
+// Mapping to SbxError
+#define ERRCODE_BASIC_SYNTAX ERRCODE_SBX_SYNTAX // unspecified syntax error
+#define ERRCODE_BASIC_BAD_ARGUMENT ERRCODE_SBX_NOTIMP // Invalid procedure call
+#define ERRCODE_BASIC_MATH_OVERFLOW ERRCODE_SBX_OVERFLOW // Overflow
+#define ERRCODE_BASIC_OUT_OF_RANGE ERRCODE_SBX_BOUNDS // Subscript out of range
+#define ERRCODE_BASIC_ZERODIV ERRCODE_SBX_ZERODIV // Division by zero
+#define ERRCODE_BASIC_CONVERSION ERRCODE_SBX_CONVERSION // Type mismatch
+#define ERRCODE_BASIC_BAD_PARAMETER ERRCODE_SBX_BAD_PARAMETER // Invalid Parameter
+#define ERRCODE_BASIC_PROC_UNDEFINED ERRCODE_SBX_PROC_UNDEFINED // Sub or Function not defined
+#define ERRCODE_BASIC_INTERNAL_ERROR ERRCODE_SBX_ERROR // internal error
+#define ERRCODE_BASIC_NO_OBJECT ERRCODE_SBX_NO_OBJECT // Object variable not set
+#define ERRCODE_BASIC_CANNOT_LOAD ERRCODE_SBX_CANNOT_LOAD // Can't load module
+#define ERRCODE_BASIC_BAD_INDEX ERRCODE_SBX_BAD_INDEX // Invalid object index
+#define ERRCODE_BASIC_NO_ACTIVE_OBJECT ERRCODE_SBX_NO_ACTIVE_OBJECT // No active view or document
+#define ERRCODE_BASIC_BAD_PROP_VALUE ERRCODE_SBX_BAD_PROP_VALUE // Bad property value
+#define ERRCODE_BASIC_PROP_READONLY ERRCODE_SBX_PROP_READONLY // Property is read only
+#define ERRCODE_BASIC_PROP_WRITEONLY ERRCODE_SBX_PROP_WRITEONLY // Property is write only
+#define ERRCODE_BASIC_INVALID_OBJECT ERRCODE_SBX_INVALID_OBJECT // Invalid object reference
+#define ERRCODE_BASIC_NO_METHOD ERRCODE_SBX_NO_METHOD // Property or method not found
+#define ERRCODE_BASIC_INVALID_USAGE_OBJECT ERRCODE_SBX_INVALID_USAGE_OBJECT // Invalid usee of object
+#define ERRCODE_BASIC_NO_OLE ERRCODE_SBX_NO_OLE // Class does not support OLE
+#define ERRCODE_BASIC_BAD_METHOD ERRCODE_SBX_BAD_METHOD // Object doesn't support method
+#define ERRCODE_BASIC_OLE_ERROR ERRCODE_SBX_OLE_ERROR // OLE Automation error
+#define ERRCODE_BASIC_BAD_ACTION ERRCODE_SBX_BAD_ACTION // Object doesn't support this action
+#define ERRCODE_BASIC_NO_NAMED_ARGS ERRCODE_SBX_NO_NAMED_ARGS // Object doesn't support named args
+#define ERRCODE_BASIC_BAD_LOCALE ERRCODE_SBX_BAD_LOCALE // Object doesn't support current locale setting
+#define ERRCODE_BASIC_NAMED_NOT_FOUND ERRCODE_SBX_NAMED_NOT_FOUND // Named argument not found
+#define ERRCODE_BASIC_NOT_OPTIONAL ERRCODE_SBX_NOT_OPTIONAL // Argument not optional
+#define ERRCODE_BASIC_WRONG_ARGS ERRCODE_SBX_WRONG_ARGS // Wrong number of arguments
+#define ERRCODE_BASIC_NOT_A_COLL ERRCODE_SBX_NOT_A_COLL // Object not a collection
+
+// Append Basic specific error messages to ERRCODE_AREA_SBX
+#define ERRCODE_BASIC_NO_GOSUB ((LAST_SBX_ERROR_ID+1UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Return without Gosub
+#define ERRCODE_BASIC_REDO_FROM_START ((LAST_SBX_ERROR_ID+2UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Redo form start (SB internal)
+#define ERRCODE_BASIC_NO_MEMORY ((LAST_SBX_ERROR_ID+3UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Out of memory
+#define ERRCODE_BASIC_ALREADY_DIM ((LAST_SBX_ERROR_ID+4UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Array already dimensioned
+#define ERRCODE_BASIC_DUPLICATE_DEF ((LAST_SBX_ERROR_ID+5UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Duplicate definition
+#define ERRCODE_BASIC_VAR_UNDEFINED ((LAST_SBX_ERROR_ID+6UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Variable undefined (SB)
+#define ERRCODE_BASIC_USER_ABORT ((LAST_SBX_ERROR_ID+7UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // User interrupt occurred
+#define ERRCODE_BASIC_BAD_RESUME ((LAST_SBX_ERROR_ID+8UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Resume without error
+#define ERRCODE_BASIC_STACK_OVERFLOW ((LAST_SBX_ERROR_ID+9UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Out of stack space
+#define ERRCODE_BASIC_BAD_DLL_LOAD ((LAST_SBX_ERROR_ID+10UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Error in loading DLL
+#define ERRCODE_BASIC_BAD_DLL_CALL ((LAST_SBX_ERROR_ID+11UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Bad DLL calling convention
+#define ERRCODE_BASIC_BAD_CHANNEL ((LAST_SBX_ERROR_ID+12UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Bad file name or number
+#define ERRCODE_BASIC_FILE_NOT_FOUND ((LAST_SBX_ERROR_ID+13UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // File not found
+#define ERRCODE_BASIC_BAD_FILE_MODE ((LAST_SBX_ERROR_ID+14UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Bad file mode
+#define ERRCODE_BASIC_FILE_ALREADY_OPEN ((LAST_SBX_ERROR_ID+15UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // File already open
+#define ERRCODE_BASIC_IO_ERROR ((LAST_SBX_ERROR_ID+16UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Device I/O error
+#define ERRCODE_BASIC_FILE_EXISTS ((LAST_SBX_ERROR_ID+17UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // File already exists
+#define ERRCODE_BASIC_BAD_RECORD_LENGTH ((LAST_SBX_ERROR_ID+18UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // bad record length
+#define ERRCODE_BASIC_DISK_FULL ((LAST_SBX_ERROR_ID+19UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // disk full
+#define ERRCODE_BASIC_READ_PAST_EOF ((LAST_SBX_ERROR_ID+20UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Input past end of file
+#define ERRCODE_BASIC_BAD_RECORD_NUMBER ((LAST_SBX_ERROR_ID+21UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Bad record number
+#define ERRCODE_BASIC_TOO_MANY_FILES ((LAST_SBX_ERROR_ID+22UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Too many files
+#define ERRCODE_BASIC_NO_DEVICE ((LAST_SBX_ERROR_ID+23UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Device not available
+#define ERRCODE_BASIC_ACCESS_DENIED ((LAST_SBX_ERROR_ID+24UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Permission denied
+#define ERRCODE_BASIC_NOT_READY ((LAST_SBX_ERROR_ID+25UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Disk not ready
+#define ERRCODE_BASIC_NOT_IMPLEMENTED ((LAST_SBX_ERROR_ID+26UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Feature not implemented
+#define ERRCODE_BASIC_DIFFERENT_DRIVE ((LAST_SBX_ERROR_ID+27UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // No rename with different drive
+#define ERRCODE_BASIC_ACCESS_ERROR ((LAST_SBX_ERROR_ID+28UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Path/File access error
+#define ERRCODE_BASIC_PATH_NOT_FOUND ((LAST_SBX_ERROR_ID+29UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Path not found
+#define ERRCODE_BASIC_BAD_PATTERN ((LAST_SBX_ERROR_ID+30UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Invalid pattern string
+#define ERRCODE_BASIC_IS_NULL ((LAST_SBX_ERROR_ID+31UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Invalid use of Null
+
+// DDE messages from 250-299
+#define ERRCODE_BASIC_DDE_ERROR ((LAST_SBX_ERROR_ID+32UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_WAITINGACK ((LAST_SBX_ERROR_ID+33UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_OUTOFCHANNELS ((LAST_SBX_ERROR_ID+34UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_NO_RESPONSE ((LAST_SBX_ERROR_ID+35UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_MULT_RESPONSES ((LAST_SBX_ERROR_ID+36UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_CHANNEL_LOCKED ((LAST_SBX_ERROR_ID+37UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_NOTPROCESSED ((LAST_SBX_ERROR_ID+38UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_TIMEOUT ((LAST_SBX_ERROR_ID+39UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_USER_INTERRUPT ((LAST_SBX_ERROR_ID+40UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_BUSY ((LAST_SBX_ERROR_ID+41UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_NO_DATA ((LAST_SBX_ERROR_ID+42UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_WRONG_DATA_FORMAT ((LAST_SBX_ERROR_ID+43UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_PARTNER_QUIT ((LAST_SBX_ERROR_ID+44UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_CONV_CLOSED ((LAST_SBX_ERROR_ID+45UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_NO_CHANNEL ((LAST_SBX_ERROR_ID+46UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_INVALID_LINK ((LAST_SBX_ERROR_ID+47UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_QUEUE_OVERFLOW ((LAST_SBX_ERROR_ID+48UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_LINK_ALREADY_EST ((LAST_SBX_ERROR_ID+49UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_LINK_INV_TOPIC ((LAST_SBX_ERROR_ID+50UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_DLL_NOT_FOUND ((LAST_SBX_ERROR_ID+51UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+
+#define ERRCODE_BASIC_NEEDS_OBJECT ((LAST_SBX_ERROR_ID+52UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Object required
+#define ERRCODE_BASIC_BAD_ORDINAL ((LAST_SBX_ERROR_ID+53UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Invalid ordinal
+#define ERRCODE_BASIC_DLLPROC_NOT_FOUND ((LAST_SBX_ERROR_ID+54UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Specified DLL function not found
+#define ERRCODE_BASIC_BAD_CLIPBD_FORMAT ((LAST_SBX_ERROR_ID+55UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Invalid clipboard format
+
+// Debugger messages from 700-799
+
+#define ERRCODE_BASIC_PROPERTY_NOT_FOUND ((LAST_SBX_ERROR_ID+56UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Class not have property
+#define ERRCODE_BASIC_METHOD_NOT_FOUND ((LAST_SBX_ERROR_ID+57UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Class does not have method
+#define ERRCODE_BASIC_ARG_MISSING ((LAST_SBX_ERROR_ID+58UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Missing required argument
+#define ERRCODE_BASIC_BAD_NUMBER_OF_ARGS ((LAST_SBX_ERROR_ID+59UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Bad number of arguments
+#define ERRCODE_BASIC_METHOD_FAILED ((LAST_SBX_ERROR_ID+60UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Method failed
+#define ERRCODE_BASIC_SETPROP_FAILED ((LAST_SBX_ERROR_ID+61UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Unable to set property
+#define ERRCODE_BASIC_GETPROP_FAILED ((LAST_SBX_ERROR_ID+62UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Unable to get property
+
+// Compiler Errors (do not occure at runtime)
+// These IDs can shift at any time
+
+#define ERRCODE_BASIC_UNEXPECTED ((LAST_SBX_ERROR_ID+63UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Unexpected symbol: xx
+#define ERRCODE_BASIC_EXPECTED ((LAST_SBX_ERROR_ID+64UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Expected: xx
+#define ERRCODE_BASIC_SYMBOL_EXPECTED ((LAST_SBX_ERROR_ID+65UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Symbol expected
+#define ERRCODE_BASIC_VAR_EXPECTED ((LAST_SBX_ERROR_ID+66UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Variable expected
+#define ERRCODE_BASIC_LABEL_EXPECTED ((LAST_SBX_ERROR_ID+67UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Label expected
+#define ERRCODE_BASIC_LVALUE_EXPECTED ((LAST_SBX_ERROR_ID+68UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Lvalue expected
+#define ERRCODE_BASIC_VAR_DEFINED ((LAST_SBX_ERROR_ID+69UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Variable xxx already defined
+#define ERRCODE_BASIC_PROC_DEFINED ((LAST_SBX_ERROR_ID+70UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Procedure xx already defined
+#define ERRCODE_BASIC_LABEL_DEFINED ((LAST_SBX_ERROR_ID+71UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Label xxx already defined
+#define ERRCODE_BASIC_UNDEF_VAR ((LAST_SBX_ERROR_ID+72UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Variable xx undefined
+#define ERRCODE_BASIC_UNDEF_ARRAY ((LAST_SBX_ERROR_ID+73UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Array or function xx undefined
+#define ERRCODE_BASIC_UNDEF_PROC ((LAST_SBX_ERROR_ID+74UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Procedure xxx undefined
+#define ERRCODE_BASIC_UNDEF_LABEL ((LAST_SBX_ERROR_ID+75UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Label xxx undefined
+#define ERRCODE_BASIC_UNDEF_TYPE ((LAST_SBX_ERROR_ID+76UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Unknown user defined type xxx
+#define ERRCODE_BASIC_BAD_EXIT ((LAST_SBX_ERROR_ID+77UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Exit XXX expected
+#define ERRCODE_BASIC_BAD_BLOCK ((LAST_SBX_ERROR_ID+78UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Unterminated statement block: missing XX
+#define ERRCODE_BASIC_BAD_BRACKETS ((LAST_SBX_ERROR_ID+79UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Parentheses do not match
+#define ERRCODE_BASIC_BAD_DECLARATION ((LAST_SBX_ERROR_ID+80UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Symbol xx defined differently
+#define ERRCODE_BASIC_BAD_PARAMETERS ((LAST_SBX_ERROR_ID+81UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Parameters do not match
+#define ERRCODE_BASIC_BAD_CHAR_IN_NUMBER ((LAST_SBX_ERROR_ID+82UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Bad character in number
+#define ERRCODE_BASIC_MUST_HAVE_DIMS ((LAST_SBX_ERROR_ID+83UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Array needs dimensioning
+#define ERRCODE_BASIC_NO_IF ((LAST_SBX_ERROR_ID+84UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Else/Endif without If
+#define ERRCODE_BASIC_NOT_IN_SUBR ((LAST_SBX_ERROR_ID+85UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // xxx not allowed within a sub
+#define ERRCODE_BASIC_NOT_IN_MAIN ((LAST_SBX_ERROR_ID+86UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // xxx not allowed outside a sub
+#define ERRCODE_BASIC_WRONG_DIMS ((LAST_SBX_ERROR_ID+87UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Dimensions do not match
+#define ERRCODE_BASIC_BAD_OPTION ((LAST_SBX_ERROR_ID+88UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Unknown option: xxx
+#define ERRCODE_BASIC_CONSTANT_REDECLARED ((LAST_SBX_ERROR_ID+89UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Constant xx redeclared
+#define ERRCODE_BASIC_PROG_TOO_LARGE ((LAST_SBX_ERROR_ID+90UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Program is too large
+#define ERRCODE_BASIC_NO_STRINGS_ARRAYS ((LAST_SBX_ERROR_ID+91UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER)
+
+#define ERRCODE_BASIC_EXCEPTION ((LAST_SBX_ERROR_ID+92UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+
+#define ERRCODE_BASMGR_STDLIBOPEN (LAST_SBX_ERROR_ID+93UL) | ERRCODE_AREA_SBX
+#define ERRCODE_BASMGR_STDLIBSAVE (LAST_SBX_ERROR_ID+94UL) | ERRCODE_AREA_SBX
+#define ERRCODE_BASMGR_LIBLOAD (LAST_SBX_ERROR_ID+95UL) | ERRCODE_AREA_SBX
+#define ERRCODE_BASMGR_LIBCREATE (LAST_SBX_ERROR_ID+96UL) | ERRCODE_AREA_SBX
+#define ERRCODE_BASMGR_LIBSAVE (LAST_SBX_ERROR_ID+97UL) | ERRCODE_AREA_SBX
+#define ERRCODE_BASMGR_LIBDEL (LAST_SBX_ERROR_ID+98UL) | ERRCODE_AREA_SBX
+#define ERRCODE_BASMGR_MGROPEN (LAST_SBX_ERROR_ID+99UL) | ERRCODE_AREA_SBX
+#define ERRCODE_BASMGR_MGRSAVE (LAST_SBX_ERROR_ID+100UL) | ERRCODE_AREA_SBX
+#define ERRCODE_BASMGR_REMOVELIB (LAST_SBX_ERROR_ID+101UL) | ERRCODE_AREA_SBX
+#define ERRCODE_BASMGR_UNLOADLIB (LAST_SBX_ERROR_ID+102UL) | ERRCODE_AREA_SBX
+
+#define ERRCODE_BASIC_ARRAY_FIX ((LAST_SBX_ERROR_ID+104UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // This array is fixed
+#define ERRCODE_BASIC_STRING_OVERFLOW ((LAST_SBX_ERROR_ID+105UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Out of string space
+#define ERRCODE_BASIC_EXPR_TOO_COMPLEX ((LAST_SBX_ERROR_ID+106UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Expression too complex
+#define ERRCODE_BASIC_OPER_NOT_PERFORM ((LAST_SBX_ERROR_ID+107UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Can't perform requested operation
+#define ERRCODE_BASIC_TOO_MANY_DLL ((LAST_SBX_ERROR_ID+108UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Too many dll application clients
+#define ERRCODE_BASIC_LOOP_NOT_INIT ((LAST_SBX_ERROR_ID+109UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // For loop not initialized
+
+#define ERRCODE_BASIC_COMPAT ((LAST_SBX_ERROR_ID+103UL)| ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME)
+
+// Map old codes to new codes
+#define SbERR_SYNTAX ERRCODE_BASIC_SYNTAX
+#define SbERR_NO_GOSUB ERRCODE_BASIC_NO_GOSUB
+#define SbERR_REDO_FROM_START ERRCODE_BASIC_REDO_FROM_START
+#define SbERR_BAD_ARGUMENT ERRCODE_BASIC_BAD_ARGUMENT
+#define SbERR_MATH_OVERFLOW ERRCODE_BASIC_MATH_OVERFLOW
+#define SbERR_NO_MEMORY ERRCODE_BASIC_NO_MEMORY
+#define SbERR_ALREADY_DIM ERRCODE_BASIC_ALREADY_DIM
+#define SbERR_OUT_OF_RANGE ERRCODE_BASIC_OUT_OF_RANGE
+#define SbERR_DUPLICATE_DEF ERRCODE_BASIC_DUPLICATE_DEF
+#define SbERR_ZERODIV ERRCODE_BASIC_ZERODIV
+#define SbERR_VAR_UNDEFINED ERRCODE_BASIC_VAR_UNDEFINED
+#define SbERR_CONVERSION ERRCODE_BASIC_CONVERSION
+#define SbERR_BAD_PARAMETER ERRCODE_BASIC_BAD_PARAMETER
+#define SbERR_USER_ABORT ERRCODE_BASIC_USER_ABORT
+#define SbERR_BAD_RESUME ERRCODE_BASIC_BAD_RESUME
+#define SbERR_STACK_OVERFLOW ERRCODE_BASIC_STACK_OVERFLOW
+#define SbERR_PROC_UNDEFINED ERRCODE_BASIC_PROC_UNDEFINED
+#define SbERR_BAD_DLL_LOAD ERRCODE_BASIC_BAD_DLL_LOAD
+#define SbERR_BAD_DLL_CALL ERRCODE_BASIC_BAD_DLL_CALL
+#define SbERR_INTERNAL_ERROR ERRCODE_BASIC_INTERNAL_ERROR
+#define SbERR_BAD_CHANNEL ERRCODE_BASIC_BAD_CHANNEL
+#define SbERR_FILE_NOT_FOUND ERRCODE_BASIC_FILE_NOT_FOUND
+#define SbERR_BAD_FILE_MODE ERRCODE_BASIC_BAD_FILE_MODE
+#define SbERR_FILE_ALREADY_OPEN ERRCODE_BASIC_FILE_ALREADY_OPEN
+#define SbERR_IO_ERROR ERRCODE_BASIC_IO_ERROR
+#define SbERR_FILE_EXISTS ERRCODE_BASIC_FILE_EXISTS
+#define SbERR_BAD_RECORD_LENGTH ERRCODE_BASIC_BAD_RECORD_LENGTH
+#define SbERR_DISK_FULL ERRCODE_BASIC_DISK_FULL
+#define SbERR_READ_PAST_EOF ERRCODE_BASIC_READ_PAST_EOF
+#define SbERR_BAD_RECORD_NUMBER ERRCODE_BASIC_BAD_RECORD_NUMBER
+#define SbERR_TOO_MANY_FILES ERRCODE_BASIC_TOO_MANY_FILES
+#define SbERR_NO_DEVICE ERRCODE_BASIC_NO_DEVICE
+#define SbERR_ACCESS_DENIED ERRCODE_BASIC_ACCESS_DENIED
+#define SbERR_NOT_READY ERRCODE_BASIC_NOT_READY
+#define SbERR_NOT_IMPLEMENTED ERRCODE_BASIC_NOT_IMPLEMENTED
+#define SbERR_DIFFERENT_DRIVE ERRCODE_BASIC_DIFFERENT_DRIVE
+#define SbERR_ACCESS_ERROR ERRCODE_BASIC_ACCESS_ERROR
+#define SbERR_PATH_NOT_FOUND ERRCODE_BASIC_PATH_NOT_FOUND
+#define SbERR_NO_OBJECT ERRCODE_BASIC_NO_OBJECT
+#define SbERR_BAD_PATTERN ERRCODE_BASIC_BAD_PATTERN
+#define SBERR_IS_NULL ERRCODE_BASIC_IS_NULL
+#define SbERR_DDE_ERROR ERRCODE_BASIC_DDE_ERROR
+#define SbERR_DDE_WAITINGACK ERRCODE_BASIC_DDE_WAITINGACK
+#define SbERR_DDE_OUTOFCHANNELS ERRCODE_BASIC_DDE_OUTOFCHANNELS
+#define SbERR_DDE_NO_RESPONSE ERRCODE_BASIC_DDE_NO_RESPONSE
+#define SbERR_DDE_MULT_RESPONSES ERRCODE_BASIC_DDE_MULT_RESPONSES
+#define SbERR_DDE_CHANNEL_LOCKED ERRCODE_BASIC_DDE_CHANNEL_LOCKED
+#define SbERR_DDE_NOTPROCESSED ERRCODE_BASIC_DDE_NOTPROCESSED
+#define SbERR_DDE_TIMEOUT ERRCODE_BASIC_DDE_TIMEOUT
+#define SbERR_DDE_USER_INTERRUPT ERRCODE_BASIC_DDE_USER_INTERRUPT
+#define SbERR_DDE_BUSY ERRCODE_BASIC_DDE_BUSY
+#define SbERR_DDE_NO_DATA ERRCODE_BASIC_DDE_NO_DATA
+#define SbERR_DDE_WRONG_DATA_FORMAT ERRCODE_BASIC_DDE_WRONG_DATA_FORMAT
+#define SbERR_DDE_PARTNER_QUIT ERRCODE_BASIC_DDE_PARTNER_QUIT
+#define SbERR_DDE_CONV_CLOSED ERRCODE_BASIC_DDE_CONV_CLOSED
+#define SbERR_DDE_NO_CHANNEL ERRCODE_BASIC_DDE_NO_CHANNEL
+#define SbERR_DDE_INVALID_LINK ERRCODE_BASIC_DDE_INVALID_LINK
+#define SbERR_DDE_QUEUE_OVERFLOW ERRCODE_BASIC_DDE_QUEUE_OVERFLOW
+#define SbERR_DDE_LINK_ALREADY_EST ERRCODE_BASIC_DDE_LINK_ALREADY_EST
+#define SbERR_DDE_LINK_INV_TOPIC ERRCODE_BASIC_DDE_LINK_INV_TOPIC
+#define SbERR_DDE_DLL_NOT_FOUND ERRCODE_BASIC_DDE_DLL_NOT_FOUND
+#define SbERR_CANNOT_LOAD ERRCODE_BASIC_CANNOT_LOAD
+#define SbERR_BAD_INDEX ERRCODE_BASIC_BAD_INDEX
+#define SbERR_NO_ACTIVE_OBJECT ERRCODE_BASIC_NO_ACTIVE_OBJECT
+#define SbERR_BAD_PROP_VALUE ERRCODE_BASIC_BAD_PROP_VALUE
+#define SbERR_PROP_READONLY ERRCODE_BASIC_PROP_READONLY
+#define SbERR_PROP_WRITEONLY ERRCODE_BASIC_PROP_WRITEONLY
+#define SbERR_INVALID_OBJECT ERRCODE_BASIC_INVALID_OBJECT
+#define SbERR_NO_METHOD ERRCODE_BASIC_NO_METHOD
+#define SbERR_NEEDS_OBJECT ERRCODE_BASIC_NEEDS_OBJECT
+#define SbERR_INVALID_USAGE_OBJECT ERRCODE_BASIC_INVALID_USAGE_OBJECT
+#define SbERR_NO_OLE ERRCODE_BASIC_NO_OLE
+#define SbERR_BAD_METHOD ERRCODE_BASIC_BAD_METHOD
+#define SbERR_OLE_ERROR ERRCODE_BASIC_OLE_ERROR
+#define SbERR_BAD_ACTION ERRCODE_BASIC_BAD_ACTION
+#define SbERR_NO_NAMED_ARGS ERRCODE_BASIC_NO_NAMED_ARGS
+#define SbERR_BAD_LOCALE ERRCODE_BASIC_BAD_LOCALE
+#define SbERR_NAMED_NOT_FOUND ERRCODE_BASIC_NAMED_NOT_FOUND
+#define SbERR_NOT_OPTIONAL ERRCODE_BASIC_NOT_OPTIONAL
+#define SbERR_WRONG_ARGS ERRCODE_BASIC_WRONG_ARGS
+#define SbERR_NOT_A_COLL ERRCODE_BASIC_NOT_A_COLL
+#define SbERR_BAD_ORDINAL ERRCODE_BASIC_BAD_ORDINAL
+#define SbERR_DLLPROC_NOT_FOUND ERRCODE_BASIC_DLLPROC_NOT_FOUND
+#define SbERR_BAD_CLIPBD_FORMAT ERRCODE_BASIC_BAD_CLIPBD_FORMAT
+#define SbERR_PROPERTY_NOT_FOUND ERRCODE_BASIC_PROPERTY_NOT_FOUND
+#define SbERR_METHOD_NOT_FOUND ERRCODE_BASIC_METHOD_NOT_FOUND
+#define SbERR_ARG_MISSING ERRCODE_BASIC_ARG_MISSING
+#define SbERR_BAD_NUMBER_OF_ARGS ERRCODE_BASIC_BAD_NUMBER_OF_ARGS
+#define SbERR_METHOD_FAILED ERRCODE_BASIC_METHOD_FAILED
+#define SbERR_SETPROP_FAILED ERRCODE_BASIC_SETPROP_FAILED
+#define SbERR_GETPROP_FAILED ERRCODE_BASIC_GETPROP_FAILED
+#define SbERR_UNEXPECTED ERRCODE_BASIC_UNEXPECTED
+#define SbERR_EXPECTED ERRCODE_BASIC_EXPECTED
+#define SbERR_SYMBOL_EXPECTED ERRCODE_BASIC_SYMBOL_EXPECTED
+#define SbERR_VAR_EXPECTED ERRCODE_BASIC_VAR_EXPECTED
+#define SbERR_LABEL_EXPECTED ERRCODE_BASIC_LABEL_EXPECTED
+#define SbERR_LVALUE_EXPECTED ERRCODE_BASIC_LVALUE_EXPECTED
+#define SbERR_VAR_DEFINED ERRCODE_BASIC_VAR_DEFINED
+#define SbERR_PROC_DEFINED ERRCODE_BASIC_PROC_DEFINED
+#define SbERR_LABEL_DEFINED ERRCODE_BASIC_LABEL_DEFINED
+#define SbERR_UNDEF_VAR ERRCODE_BASIC_UNDEF_VAR
+#define SbERR_UNDEF_ARRAY ERRCODE_BASIC_UNDEF_ARRAY
+#define SbERR_UNDEF_PROC ERRCODE_BASIC_UNDEF_PROC
+#define SbERR_UNDEF_LABEL ERRCODE_BASIC_UNDEF_LABEL
+#define SbERR_UNDEF_TYPE ERRCODE_BASIC_UNDEF_TYPE
+#define SbERR_BAD_EXIT ERRCODE_BASIC_BAD_EXIT
+#define SbERR_BAD_BLOCK ERRCODE_BASIC_BAD_BLOCK
+#define SbERR_BAD_BRACKETS ERRCODE_BASIC_BAD_BRACKETS
+#define SbERR_BAD_DECLARATION ERRCODE_BASIC_BAD_DECLARATION
+#define SbERR_BAD_PARAMETERS ERRCODE_BASIC_BAD_PARAMETERS
+#define SbERR_BAD_CHAR_IN_NUMBER ERRCODE_BASIC_BAD_CHAR_IN_NUMBER
+#define SbERR_MUST_HAVE_DIMS ERRCODE_BASIC_MUST_HAVE_DIMS
+#define SbERR_NO_IF ERRCODE_BASIC_NO_IF
+#define SbERR_NOT_IN_SUBR ERRCODE_BASIC_NOT_IN_SUBR
+#define SbERR_NOT_IN_MAIN ERRCODE_BASIC_NOT_IN_MAIN
+#define SbERR_WRONG_DIMS ERRCODE_BASIC_WRONG_DIMS
+#define SbERR_BAD_OPTION ERRCODE_BASIC_BAD_OPTION
+#define SbERR_CONSTANT_REDECLARED ERRCODE_BASIC_CONSTANT_REDECLARED
+#define SbERR_PROG_TOO_LARGE ERRCODE_BASIC_PROG_TOO_LARGE
+#define SbERR_NO_STRINGS_ARRAYS ERRCODE_BASIC_NO_STRINGS_ARRAYS
+#define SbERR_BASIC_EXCEPTION ERRCODE_BASIC_EXCEPTION
+#define SbERR_BASIC_COMPAT ERRCODE_BASIC_COMPAT
+#define SbERR_BASIC_ARRAY_FIX ERRCODE_BASIC_ARRAY_FIX
+#define SbERR_BASIC_STRING_OVERFLOW ERRCODE_BASIC_STRING_OVERFLOW
+#define SbERR_BASIC_EXPR_TOO_COMPLEX ERRCODE_BASIC_EXPR_TOO_COMPLEX
+#define SbERR_BASIC_OPER_NOT_PERFORM ERRCODE_BASIC_OPER_NOT_PERFORM
+#define SbERR_BASIC_TOO_MANY_DLL ERRCODE_BASIC_TOO_MANY_DLL
+#define SbERR_BASIC_LOOP_NOT_INIT ERRCODE_BASIC_LOOP_NOT_INIT
+
+// Grid messages from 30000-30999
+// OLE messages from 31000-31999
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbmeth.hxx b/include/basic/sbmeth.hxx
new file mode 100644
index 000000000000..9d4afbc37a24
--- /dev/null
+++ b/include/basic/sbmeth.hxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SB_SBMETH_HXX
+#define _SB_SBMETH_HXX
+
+#include <tools/errcode.hxx>
+#include <basic/sbxmeth.hxx>
+#include <basic/sbdef.hxx>
+#include "basicdllapi.h"
+
+class SbModule;
+
+class BASIC_DLLPUBLIC SbMethod : public SbxMethod
+{
+ friend class SbiRuntime;
+ friend class SbiFactory;
+ friend class SbModule;
+ friend class SbClassModuleObject;
+ friend class SbiCodeGen;
+ friend class SbJScriptMethod;
+ friend class SbIfaceMapperMethod;
+
+ SbxVariable* mCaller; // caller
+ SbModule* pMod;
+ sal_uInt16 nDebugFlags;
+ sal_uInt16 nLine1, nLine2;
+ sal_uInt32 nStart;
+ sal_Bool bInvalid;
+ SbxArrayRef refStatics;
+ BASIC_DLLPRIVATE SbMethod( const OUString&, SbxDataType, SbModule* );
+ BASIC_DLLPRIVATE SbMethod( const SbMethod& );
+ virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
+ virtual sal_Bool StoreData( SvStream& ) const;
+ virtual ~SbMethod();
+
+public:
+ SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_BASICMETHOD,2);
+ TYPEINFO();
+ virtual SbxInfo* GetInfo();
+ SbxArray* GetStatics();
+ void ClearStatics();
+ SbModule* GetModule() { return pMod; }
+ sal_uInt32 GetId() const { return nStart; }
+ sal_uInt16 GetDebugFlags() { return nDebugFlags; }
+ void SetDebugFlags( sal_uInt16 n ) { nDebugFlags = n; }
+ void GetLineRange( sal_uInt16&, sal_uInt16& );
+
+ // Interface to execute a method from the applications
+ virtual ErrCode Call( SbxValue* pRet = NULL, SbxVariable* pCaller = NULL );
+ virtual void Broadcast( sal_uIntPtr nHintId );
+};
+
+SV_DECL_IMPL_REF(SbMethod)
+
+class BASIC_DLLPUBLIC SbIfaceMapperMethod : public SbMethod
+{
+ friend class SbiRuntime;
+
+ SbMethodRef mxImplMeth;
+
+public:
+ TYPEINFO();
+ SbIfaceMapperMethod( const OUString& rName, SbMethod* pImplMeth )
+ : SbMethod( rName, pImplMeth->GetType(), NULL )
+ , mxImplMeth( pImplMeth )
+ {}
+ virtual ~SbIfaceMapperMethod();
+ SbMethod* getImplMethod( void )
+ { return mxImplMeth; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbmod.hxx b/include/basic/sbmod.hxx
new file mode 100644
index 000000000000..f94e2c9e8a36
--- /dev/null
+++ b/include/basic/sbmod.hxx
@@ -0,0 +1,164 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SB_SBMOD_HXX
+#define _SB_SBMOD_HXX
+
+#include <com/sun/star/script/XInvocation.hpp>
+#include <basic/sbdef.hxx>
+#include <basic/sbxobj.hxx>
+#include <basic/sbxdef.hxx>
+#include <rtl/ustring.hxx>
+#include <vector>
+#include <deque>
+#include <boost/utility.hpp>
+#include "basicdllapi.h"
+
+class SbMethod;
+class SbProperty;
+class SbiRuntime;
+typedef std::deque< sal_uInt16 > SbiBreakpoints;
+class SbiImage;
+class SbProcedureProperty;
+class SbIfaceMapperMethod;
+class SbClassModuleObject;
+
+class ModuleInitDependencyMap;
+struct ClassModuleRunInitItem;
+struct SbClassData;
+
+class BASIC_DLLPUBLIC SbModule : public SbxObject, private ::boost::noncopyable
+{
+ friend class SbiCodeGen;
+ friend class SbMethod;
+ friend class SbiRuntime;
+ friend class StarBASIC;
+ friend class SbClassModuleObject;
+
+ std::vector< OUString > mModuleVariableNames;
+
+ BASIC_DLLPRIVATE void implClearIfVarDependsOnDeletedBasic( SbxVariable* pVar, StarBASIC* pDeletedBasic );
+
+protected:
+ com::sun::star::uno::Reference< com::sun::star::script::XInvocation > mxWrapper;
+ OUString aOUSource;
+ OUString aComment;
+ SbiImage* pImage; // the Image
+ SbiBreakpoints* pBreaks; // Breakpoints
+ SbClassData* pClassData;
+ bool mbVBACompat;
+ sal_Int32 mnType;
+ SbxObjectRef pDocObject; // an impl object ( used by Document Modules )
+ bool bIsProxyModule;
+
+ static void implProcessModuleRunInit( ModuleInitDependencyMap& rMap, ClassModuleRunInitItem& rItem );
+ void StartDefinitions();
+ SbMethod* GetMethod( const OUString&, SbxDataType );
+ SbProperty* GetProperty( const OUString&, SbxDataType );
+ SbProcedureProperty* GetProcedureProperty( const OUString&, SbxDataType );
+ SbIfaceMapperMethod* GetIfaceMapperMethod( const OUString&, SbMethod* );
+ void EndDefinitions( sal_Bool=sal_False );
+ sal_uInt16 Run( SbMethod* );
+ void RunInit();
+ void ClearPrivateVars();
+ void ClearVarsDependingOnDeletedBasic( StarBASIC* pDeletedBasic );
+ void GlobalRunInit( bool bBasicStart ); // for all modules
+ void GlobalRunDeInit( void );
+ const sal_uInt8* FindNextStmnt( const sal_uInt8*, sal_uInt16&, sal_uInt16& ) const;
+ const sal_uInt8* FindNextStmnt( const sal_uInt8*, sal_uInt16&, sal_uInt16&,
+ sal_Bool bFollowJumps, const SbiImage* pImg=NULL ) const;
+ virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
+ virtual sal_Bool StoreData( SvStream& ) const;
+ virtual sal_Bool LoadCompleted();
+ virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
+ const SfxHint& rHint, const TypeId& rHintType );
+ void handleProcedureProperties( SfxBroadcaster& rBC, const SfxHint& rHint );
+ virtual ~SbModule();
+public:
+ SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_BASICMOD,2);
+ TYPEINFO();
+ SbModule( const OUString&, sal_Bool bCompat = sal_False );
+ virtual void SetParent( SbxObject* );
+ virtual void Clear();
+
+ virtual SbxVariable* Find( const OUString&, SbxClassType );
+
+ virtual const OUString& GetSource() const;
+ const OUString& GetSource32() const;
+ const OUString& GetComment() const { return aComment; }
+ virtual void SetSource( const OUString& r );
+ void SetSource32( const OUString& r );
+
+ virtual sal_Bool Compile();
+ virtual sal_Bool IsCompiled() const;
+ const SbxObject* FindType( OUString aTypeName ) const;
+
+ virtual sal_Bool IsBreakable( sal_uInt16 nLine ) const;
+ virtual sal_Bool IsBP( sal_uInt16 nLine ) const;
+ virtual sal_Bool SetBP( sal_uInt16 nLine );
+ virtual sal_Bool ClearBP( sal_uInt16 nLine );
+ virtual void ClearAllBP();
+
+ // Store only image, no source (needed for new password protection)
+ sal_Bool StoreBinaryData( SvStream& );
+ sal_Bool StoreBinaryData( SvStream&, sal_uInt16 nVer );
+ sal_Bool LoadBinaryData( SvStream&, sal_uInt16 nVer );
+ sal_Bool LoadBinaryData( SvStream& );
+ sal_Bool ExceedsLegacyModuleSize();
+ void fixUpMethodStart( bool bCvtToLegacy, SbiImage* pImg = NULL ) const;
+ bool HasExeCode();
+ bool IsVBACompat() const;
+ void SetVBACompat( bool bCompat );
+ sal_Int32 GetModuleType() { return mnType; }
+ void SetModuleType( sal_Int32 nType ) { mnType = nType; }
+ bool isProxyModule() { return bIsProxyModule; }
+ void AddVarName( const OUString& aName );
+ void RemoveVars();
+ ::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation > GetUnoModule();
+ bool createCOMWrapperForIface( ::com::sun::star::uno::Any& o_rRetAny, SbClassModuleObject* pProxyClassModuleObject );
+};
+
+SV_DECL_IMPL_REF(SbModule)
+
+// Object class for instances of class modules
+class BASIC_DLLPUBLIC SbClassModuleObject : public SbModule
+{
+ SbModule* mpClassModule;
+ bool mbInitializeEventDone;
+
+public:
+ TYPEINFO();
+ SbClassModuleObject( SbModule* pClassModule );
+ ~SbClassModuleObject();
+
+ // Overridden to support NameAccess etc.
+ virtual SbxVariable* Find( const OUString&, SbxClassType );
+
+ virtual void SFX_NOTIFY( SfxBroadcaster&, const TypeId&, const SfxHint& rHint, const TypeId& );
+
+ SbModule* getClassModule( void )
+ { return mpClassModule; }
+
+ void triggerInitializeEvent( void );
+ void triggerTerminateEvent( void );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbobjmod.hxx b/include/basic/sbobjmod.hxx
new file mode 100644
index 000000000000..14ca48681688
--- /dev/null
+++ b/include/basic/sbobjmod.hxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SB_OBJMOD_HXX
+#define _SB_OBJMOD_HXX
+
+#include <rtl/ref.hxx>
+#include <basic/sbmod.hxx>
+#include <basic/sbstar.hxx>
+#include <com/sun/star/script/ModuleInfo.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/awt/XDialog.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include "basicdllapi.h"
+
+// Basic-Module for excel object.
+
+class BASIC_DLLPUBLIC SbObjModule : public SbModule
+{
+protected:
+ virtual ~SbObjModule();
+
+public:
+ TYPEINFO();
+ SbObjModule( const OUString& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsVbaCompatible );
+ virtual SbxVariable* Find( const OUString& rName, SbxClassType t );
+
+ virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
+ const SfxHint& rHint, const TypeId& rHintType );
+
+ using SbxValue::GetObject;
+ SbxVariable* GetObject();
+ void SetUnoObject( const com::sun::star::uno::Any& aObj )throw ( com::sun::star::uno::RuntimeException ) ;
+};
+
+class FormObjEventListenerImpl;
+
+class BASIC_DLLPUBLIC SbUserFormModule : public SbObjModule
+{
+ com::sun::star::script::ModuleInfo m_mInfo;
+ ::rtl::Reference< FormObjEventListenerImpl > m_DialogListener;
+ css::uno::Reference<css::awt::XDialog> m_xDialog;
+ css::uno::Reference<css::frame::XModel> m_xModel;
+ OUString sFormName;
+ bool mbInit;
+
+//protected:
+ virtual void InitObject();
+public:
+ TYPEINFO();
+ SbUserFormModule( const OUString& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsVBACompat );
+ virtual ~SbUserFormModule();
+ virtual SbxVariable* Find( const OUString& rName, SbxClassType t );
+ void ResetApiObj( bool bTriggerTerminateEvent = true );
+ void Unload();
+ void Load();
+ void triggerMethod( const OUString& );
+ void triggerMethod( const OUString&, css::uno::Sequence< css::uno::Any >& );
+ void triggerActivateEvent();
+ void triggerDeactivateEvent();
+ void triggerInitializeEvent();
+ void triggerTerminateEvent();
+ void triggerLayoutEvent();
+ void triggerResizeEvent();
+
+ bool getInitState( void )
+ { return mbInit; }
+ void setInitState( bool bInit )
+ { mbInit = bInit; }
+
+ class SbUserFormModuleInstance* CreateInstance();
+};
+
+class BASIC_DLLPUBLIC SbUserFormModuleInstance : public SbUserFormModule
+{
+ SbUserFormModule* m_pParentModule;
+
+public:
+ SbUserFormModuleInstance( SbUserFormModule* pParentModule, const OUString& rName,
+ const com::sun::star::script::ModuleInfo& mInfo, bool bIsVBACompat );
+
+ virtual sal_Bool IsClass( const OUString& ) const;
+ virtual SbxVariable* Find( const OUString& rName, SbxClassType t );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbprop.hxx b/include/basic/sbprop.hxx
new file mode 100644
index 000000000000..463fd5d41c73
--- /dev/null
+++ b/include/basic/sbprop.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SB_SBPROPERTY_HXX
+#define _SB_SBPROPERTY_HXX
+
+#include <basic/sbxprop.hxx>
+#include <basic/sbdef.hxx>
+#include "basicdllapi.h"
+
+class SbModule;
+
+class BASIC_DLLPUBLIC SbProperty : public SbxProperty
+{
+ friend class SbiFactory;
+ friend class SbModule;
+ friend class SbProcedureProperty;
+ SbModule* pMod;
+ sal_Bool bInvalid;
+ BASIC_DLLPRIVATE SbProperty( const OUString&, SbxDataType, SbModule* );
+ virtual ~SbProperty();
+public:
+ SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_BASICPROP,1);
+ TYPEINFO();
+ SbModule* GetModule() { return pMod; }
+};
+
+SV_DECL_IMPL_REF(SbProperty)
+
+class BASIC_DLLPUBLIC SbProcedureProperty : public SbxProperty
+{
+ bool mbSet; // Flag for set command
+
+ virtual ~SbProcedureProperty();
+
+public:
+ SbProcedureProperty( const OUString& r, SbxDataType t )
+ : SbxProperty( r, t ) // , pMod( p )
+ , mbSet( false )
+ {}
+ TYPEINFO();
+
+ bool isSet( void )
+ { return mbSet; }
+ void setSet( bool bSet )
+ { mbSet = bSet; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbstar.hxx b/include/basic/sbstar.hxx
new file mode 100644
index 000000000000..c84b62494169
--- /dev/null
+++ b/include/basic/sbstar.hxx
@@ -0,0 +1,183 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SB_SBSTAR_HXX
+#define _SB_SBSTAR_HXX
+
+#include <basic/sbx.hxx>
+#include <basic/sbxobj.hxx>
+#include <rtl/ustring.hxx>
+#include <osl/mutex.hxx>
+#include <tools/link.hxx>
+
+#include <basic/sbdef.hxx>
+#include <basic/sberrors.hxx>
+#include <com/sun/star/script/ModuleInfo.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include "basicdllapi.h"
+
+class SbModule; // completed module
+class SbiInstance; // runtime instance
+class SbiRuntime; // currently running procedure
+class SbiImage; // compiled image
+class BasicLibInfo; // info block for basic manager
+class SbMethod;
+class BasicManager;
+class DocBasicItem;
+
+class BASIC_DLLPUBLIC StarBASIC : public SbxObject
+{
+ friend class SbiScanner;
+ friend class SbiExpression; // Access to RTL
+ friend class SbiInstance;
+ friend class SbiRuntime;
+ friend class DocBasicItem;
+
+ SbxArrayRef pModules; // List of all modules
+ SbxObjectRef pRtl; // Runtime Library
+ SbxArrayRef xUnoListeners; // Listener handled by CreateUnoListener
+
+ // Handler-Support:
+ Link aErrorHdl; // Error handler
+ Link aBreakHdl; // Breakpoint handler
+ bool bNoRtl; // if true: do not search RTL
+ bool bBreak; // if true: Break, otherwise Step
+ bool bDocBasic;
+ bool bVBAEnabled;
+ BasicLibInfo* pLibInfo; // Info block for basic manager
+ bool bQuit;
+
+ SbxObjectRef pVBAGlobals;
+ BASIC_DLLPRIVATE SbxObject* getVBAGlobals( );
+
+ BASIC_DLLPRIVATE void implClearDependingVarsOnDelete( StarBASIC* pDeletedBasic );
+
+protected:
+ sal_Bool CError( SbError, const OUString&, sal_Int32, sal_Int32, sal_Int32 );
+private:
+ BASIC_DLLPRIVATE sal_Bool RTError( SbError, sal_Int32, sal_Int32, sal_Int32 );
+ BASIC_DLLPRIVATE sal_Bool RTError( SbError, const OUString& rMsg, sal_Int32, sal_Int32, sal_Int32 );
+ BASIC_DLLPRIVATE sal_uInt16 BreakPoint( sal_Int32 nLine, sal_Int32 nCol1, sal_Int32 nCol2 );
+ BASIC_DLLPRIVATE sal_uInt16 StepPoint( sal_Int32 nLine, sal_Int32 nCol1, sal_Int32 nCol2 );
+ virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
+ virtual sal_Bool StoreData( SvStream& ) const;
+
+protected:
+ virtual sal_Bool ErrorHdl();
+ virtual sal_uInt16 BreakHdl();
+ virtual ~StarBASIC();
+
+public:
+
+ SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_BASIC,1);
+ TYPEINFO();
+
+ StarBASIC( StarBASIC* pParent = NULL, bool bIsDocBasic = false );
+
+ // #51727 SetModified overridden so that the Modfied-State is
+ // not delivered to Parent.
+ virtual void SetModified( sal_Bool );
+
+ void* operator new( size_t );
+ void operator delete( void* );
+
+ virtual void Insert( SbxVariable* );
+ using SbxObject::Remove;
+ virtual void Remove( SbxVariable* );
+ virtual void Clear();
+
+ BasicLibInfo* GetLibInfo() { return pLibInfo; }
+ void SetLibInfo( BasicLibInfo* p ) { pLibInfo = p; }
+
+ // Compiler-Interface
+ SbModule* MakeModule( const OUString& rName, const OUString& rSrc );
+ SbModule* MakeModule32( const OUString& rName, const OUString& rSrc );
+ SbModule* MakeModule32( const OUString& rName, const com::sun::star::script::ModuleInfo& mInfo, const OUString& rSrc );
+ sal_Bool Compile( SbModule* );
+ static void Stop();
+ static void Error( SbError );
+ static void Error( SbError, const OUString& rMsg );
+ static void FatalError( SbError );
+ static void FatalError( SbError, const OUString& rMsg );
+ static bool IsRunning();
+ static SbError GetErrBasic();
+ // #66536 make additional message accessible by RTL function Error
+ static OUString GetErrorMsg();
+ static sal_Int32 GetErl();
+
+ virtual SbxVariable* Find( const OUString&, SbxClassType );
+ virtual sal_Bool Call( const OUString&, SbxArray* = NULL );
+
+ SbxArray* GetModules() { return pModules; }
+ SbxObject* GetRtl() { return pRtl; }
+ SbModule* FindModule( const OUString& );
+ // Run init code of all modules (including the inserted Doc-Basics)
+ void InitAllModules( StarBASIC* pBasicNotToInit = NULL );
+ void DeInitAllModules( void );
+ void ClearAllModuleVars( void );
+
+ // Calls for error and break handler
+ static sal_uInt16 GetLine();
+ static sal_uInt16 GetCol1();
+ static sal_uInt16 GetCol2();
+ static void SetErrorData( SbError nCode, sal_uInt16 nLine,
+ sal_uInt16 nCol1, sal_uInt16 nCol2 );
+
+ // Specific to error handler
+ static void MakeErrorText( SbError, const OUString& aMsg );
+ static const OUString& GetErrorText();
+ static SbError GetErrorCode();
+ static bool IsCompilerError();
+ static sal_uInt16 GetVBErrorCode( SbError nError );
+ static SbError GetSfxFromVBError( sal_uInt16 nError );
+ bool IsBreak() const { return bBreak; }
+
+ static Link GetGlobalErrorHdl();
+ static void SetGlobalErrorHdl( const Link& rNewHdl );
+ Link GetErrorHdl() const { return aErrorHdl; }
+ void SetErrorHdl( const Link& r ) { aErrorHdl = r; }
+
+ static void SetGlobalBreakHdl( const Link& rNewHdl );
+ Link GetBreakHdl() const { return aBreakHdl; }
+ void SetBreakHdl( const Link& r ) { aBreakHdl = r; }
+
+ SbxArrayRef getUnoListeners( void );
+
+ static SbxBase* FindSBXInCurrentScope( const OUString& rName );
+ static SbMethod* GetActiveMethod( sal_uInt16 nLevel = 0 );
+ static SbModule* GetActiveModule();
+ void SetVBAEnabled( bool bEnabled );
+ bool isVBAEnabled();
+
+ SbxObjectRef getRTL( void ) { return pRtl; }
+ bool IsDocBasic() { return bDocBasic; }
+ SbxVariable* VBAFind( const OUString& rName, SbxClassType t );
+ bool GetUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::uno::Any& aOut );
+ void QuitAndExitApplication();
+ bool IsQuitApplication() { return bQuit; };
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
+ GetModelFromBasic( SbxObject* pBasic );
+};
+
+SV_DECL_IMPL_REF(StarBASIC)
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbstdobj.hxx b/include/basic/sbstdobj.hxx
new file mode 100644
index 000000000000..75a5a6ecb452
--- /dev/null
+++ b/include/basic/sbstdobj.hxx
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SBSTDOBJ1_HXX
+#define _SBSTDOBJ1_HXX
+
+#include <basic/sbxobj.hxx>
+#include <vcl/graph.hxx>
+#include <basic/sbxfac.hxx>
+#include "basicdllapi.h"
+
+//--------------------
+// class SbStdFactory
+//--------------------
+class BASIC_DLLPUBLIC SbStdFactory : public SbxFactory
+{
+public:
+ SbStdFactory();
+
+ virtual SbxObject* CreateObject( const OUString& rClassName );
+};
+
+//--------------------
+// class SbStdPicture
+//--------------------
+class BASIC_DLLPUBLIC SbStdPicture : public SbxObject
+{
+protected:
+ Graphic aGraphic;
+
+ ~SbStdPicture();
+ virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
+ const SfxHint& rHint, const TypeId& rHintType );
+
+ void PropType( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite );
+ void PropWidth( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite );
+ void PropHeight( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite );
+
+public:
+ TYPEINFO();
+
+ SbStdPicture();
+ virtual SbxVariable* Find( const OUString&, SbxClassType );
+
+ Graphic GetGraphic() const { return aGraphic; }
+ void SetGraphic( const Graphic& rGrf ) { aGraphic = rGrf; }
+};
+
+//-----------------
+// class SbStdFont
+//-----------------
+class BASIC_DLLPUBLIC SbStdFont : public SbxObject
+{
+protected:
+ sal_Bool bBold;
+ sal_Bool bItalic;
+ sal_Bool bStrikeThrough;
+ sal_Bool bUnderline;
+ sal_uInt16 nSize;
+ OUString aName;
+
+ ~SbStdFont();
+ virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
+ const SfxHint& rHint, const TypeId& rHintType );
+
+ void PropBold( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite );
+ void PropItalic( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite );
+ void PropStrikeThrough( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite );
+ void PropUnderline( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite );
+ void PropSize( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite );
+ void PropName( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite );
+
+public:
+ TYPEINFO();
+
+ SbStdFont();
+ virtual SbxVariable* Find( const OUString&, SbxClassType );
+
+ void SetBold( sal_Bool bB ) { bBold = bB; }
+ sal_Bool IsBold() const { return bBold; }
+ void SetItalic( sal_Bool bI ) { bItalic = bI; }
+ sal_Bool IsItalic() const { return bItalic; }
+ void SetStrikeThrough( sal_Bool bS ) { bStrikeThrough = bS; }
+ sal_Bool IsStrikeThrough() const { return bStrikeThrough; }
+ void SetUnderline( sal_Bool bU ) { bUnderline = bU; }
+ sal_Bool IsUnderline() const { return bUnderline; }
+ void SetSize( sal_uInt16 nS ) { nSize = nS; }
+ sal_uInt16 GetSize() const { return nSize; }
+ void SetFontName( const OUString& rName ) { aName = rName; }
+ OUString GetFontName() const { return aName; }
+};
+
+//----------------------
+// class SbStdClipboard
+//----------------------
+class BASIC_DLLPUBLIC SbStdClipboard : public SbxObject
+{
+protected:
+
+ ~SbStdClipboard();
+ virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
+ const SfxHint& rHint, const TypeId& rHintType );
+
+ void MethClear( SbxVariable* pVar, SbxArray* pPar_, sal_Bool bWrite );
+ void MethGetData( SbxVariable* pVar, SbxArray* pPar_, sal_Bool bWrite );
+ void MethGetFormat( SbxVariable* pVar, SbxArray* pPar_, sal_Bool bWrite );
+ void MethGetText( SbxVariable* pVar, SbxArray* pPar_, sal_Bool bWrite );
+ void MethSetData( SbxVariable* pVar, SbxArray* pPar_, sal_Bool bWrite );
+ void MethSetText( SbxVariable* pVar, SbxArray* pPar_, sal_Bool bWrite );
+
+public:
+ TYPEINFO();
+
+ SbStdClipboard();
+ virtual SbxVariable* Find( const OUString&, SbxClassType );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbuno.hxx b/include/basic/sbuno.hxx
new file mode 100644
index 000000000000..55d487a48b75
--- /dev/null
+++ b/include/basic/sbuno.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SB_SBUNO_HXX
+#define _SB_SBUNO_HXX
+
+#include <basic/sbxobj.hxx>
+#include "basicdllapi.h"
+
+namespace com { namespace sun { namespace star { namespace uno { class Any; }}}}
+
+// Returns a SbxObject that wrapps an Uno Interface
+// Implementation in basic/source/classes/sbunoobj.cxx
+BASIC_DLLPUBLIC SbxObjectRef GetSbUnoObject( const OUString& aName, const com::sun::star::uno::Any& aUnoObj_ );
+
+// Force creation of all properties for debugging
+BASIC_DLLPUBLIC void createAllObjectProperties( SbxObject* pObj );
+BASIC_DLLPUBLIC void SetSbUnoObjectDfltPropName( SbxObject* pObj );
+
+BASIC_DLLPUBLIC ::com::sun::star::uno::Any sbxToUnoValue( SbxVariable* pVar );
+
+BASIC_DLLPUBLIC void unoToSbxValue( SbxVariable* pVar, const ::com::sun::star::uno::Any& aValue );
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbx.hxx b/include/basic/sbx.hxx
new file mode 100644
index 000000000000..d5fba159e510
--- /dev/null
+++ b/include/basic/sbx.hxx
@@ -0,0 +1,280 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SBXCLASS_HXX
+#define _SBXCLASS_HXX
+
+#include "tools/ref.hxx"
+#include "svl/smplhint.hxx"
+#include "svl/lstner.hxx"
+
+#include <basic/sbxdef.hxx>
+#include <basic/sbxform.hxx>
+#include <basic/sbxobj.hxx>
+#include <basic/sbxprop.hxx>
+#include <basic/sbxmeth.hxx>
+#include "basicdllapi.h"
+
+#include <boost/ptr_container/ptr_vector.hpp>
+
+class SvStream;
+class SbxBase;
+class SbxVariable;
+class SbxProperty;
+class SbxMethod;
+class SbxObject;
+class SbxArray;
+class SbxDimArray;
+class SbxFactory;
+
+class SfxBroadcaster;
+
+// Parameter information
+struct SbxParamInfo
+{
+ const OUString aName; // Name of the parameter
+ SbxBaseRef aTypeRef; // Object, if object type
+ SbxDataType eType; // Data type
+ sal_uInt16 nFlags; // Flag-Bits
+ sal_uInt32 nUserData; // IDs etc.
+ SbxParamInfo( const OUString& s, SbxDataType t, sal_uInt16 n, SbxBase* b = NULL )
+ : aName( s ), aTypeRef( b ), eType( t ), nFlags( n ), nUserData( 0 ) {}
+ ~SbxParamInfo() {}
+};
+
+typedef boost::ptr_vector<SbxParamInfo> SbxParams;
+
+class BASIC_DLLPUBLIC SbxInfo : public SvRefBase
+{
+ friend class SbxVariable;
+ friend class SbMethod;
+
+ OUString aComment;
+ OUString aHelpFile;
+ sal_uInt32 nHelpId;
+ SbxParams aParams;
+
+protected:
+ sal_Bool LoadData( SvStream&, sal_uInt16 );
+ sal_Bool StoreData( SvStream& ) const;
+ virtual ~SbxInfo();
+public:
+ SbxInfo();
+ SbxInfo( const OUString&, sal_uInt32 );
+
+ void AddParam( const OUString&, SbxDataType, sal_uInt16=SBX_READ );
+ const SbxParamInfo* GetParam( sal_uInt16 n ) const; // index starts with 1!
+ const OUString& GetComment() const { return aComment; }
+ const OUString& GetHelpFile() const { return aHelpFile; }
+ sal_uInt32 GetHelpId() const { return nHelpId; }
+
+ void SetComment( const OUString& r ) { aComment = r; }
+ void SetHelpFile( const OUString& r ) { aHelpFile = r; }
+ void SetHelpId( sal_uInt32 nId ) { nHelpId = nId; }
+};
+
+class BASIC_DLLPUBLIC SbxHint : public SfxSimpleHint
+{
+ SbxVariable* pVar;
+public:
+ TYPEINFO();
+ SbxHint( sal_uIntPtr n, SbxVariable* v ) : SfxSimpleHint( n ), pVar( v ) {}
+ SbxVariable* GetVar() const { return pVar; }
+};
+
+// SbxAlias is an alias for a var or object
+class BASIC_DLLPUBLIC SbxAlias : public SbxVariable, public SfxListener
+{
+ SbxVariableRef xAlias;
+ virtual ~SbxAlias();
+ virtual void Broadcast( sal_uIntPtr );
+ virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
+ const SfxHint& rHint, const TypeId& rHintType );
+public:
+ SbxAlias( const SbxAlias& );
+ SbxAlias& operator=( const SbxAlias& );
+};
+
+// SbxArray is an unidimensional, dynamic Array
+// The variables convert from SbxVariablen. Put()/Insert() into the
+// declared datatype, if they are not SbxVARIANT.
+
+class SbxVarRefs;
+class SbxVariableRef;
+
+class BASIC_DLLPUBLIC SbxArray : public SbxBase
+{
+// #100883 Method to set method directly to parameter array
+ friend class SbMethod;
+ friend class SbClassModuleObject;
+ friend SbxObject* cloneTypeObjectImpl( const SbxObject& rTypeObj );
+ BASIC_DLLPRIVATE void PutDirect( SbxVariable* pVar, sal_uInt32 nIdx );
+
+ SbxVarRefs* pData; // The variables
+
+protected:
+ SbxDataType eType; // Data type of the array
+ virtual ~SbxArray();
+ virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
+ virtual sal_Bool StoreData( SvStream& ) const;
+
+public:
+ SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_ARRAY,1);
+ TYPEINFO();
+ SbxArray( SbxDataType=SbxVARIANT );
+ SbxArray( const SbxArray& );
+ SbxArray& operator=( const SbxArray& );
+ virtual void Clear();
+ sal_uInt16 Count() const;
+ virtual SbxDataType GetType() const;
+ virtual SbxClassType GetClass() const;
+ SbxVariableRef& GetRef( sal_uInt16 );
+ SbxVariable* Get( sal_uInt16 );
+ void Put( SbxVariable*, sal_uInt16 );
+ void Insert( SbxVariable*, sal_uInt16 );
+ void Remove( sal_uInt16 );
+ void Remove( SbxVariable* );
+ void Merge( SbxArray* );
+ const OUString& GetAlias( sal_uInt16 );
+ void PutAlias( const OUString&, sal_uInt16 );
+ SbxVariable* FindUserData( sal_uInt32 nUserData );
+ virtual SbxVariable* Find( const OUString&, SbxClassType );
+
+ // Additional methods for 32-bit indices
+ sal_uInt32 Count32() const;
+ SbxVariableRef& GetRef32( sal_uInt32 );
+ SbxVariable* Get32( sal_uInt32 );
+ void Put32( SbxVariable*, sal_uInt32 );
+ void Insert32( SbxVariable*, sal_uInt32 );
+ void Remove32( sal_uInt32 );
+};
+
+// SbxDimArray is an array that can dimensioned using BASIC conventions.
+struct SbxDim;
+
+class BASIC_DLLPUBLIC SbxDimArray : public SbxArray
+{
+ SbxDim* pFirst, *pLast; // Links to Dimension table
+ short nDim; // Number of dimensions
+ BASIC_DLLPRIVATE void AddDimImpl32( sal_Int32, sal_Int32, sal_Bool bAllowSize0 );
+ bool mbHasFixedSize;
+protected:
+ sal_uInt16 Offset( const short* );
+ sal_uInt32 Offset32( const sal_Int32* );
+ sal_uInt32 Offset32( SbxArray* );
+ virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
+ virtual sal_Bool StoreData( SvStream& ) const;
+ virtual ~SbxDimArray();
+public:
+ SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_DIMARRAY,1);
+ TYPEINFO();
+ SbxDimArray( SbxDataType=SbxVARIANT );
+ SbxDimArray( const SbxDimArray& );
+ SbxDimArray& operator=( const SbxDimArray& );
+ virtual void Clear();
+ using SbxArray::GetRef;
+ using SbxArray::Get;
+ SbxVariable* Get( const short* );
+ using SbxArray::Put;
+ void Put( SbxVariable*, const short* );
+ SbxVariable* Get( SbxArray* );
+
+ short GetDims() const;
+ void AddDim( short, short );
+ void unoAddDim( short, short );
+ sal_Bool GetDim( short, short&, short& ) const;
+
+ using SbxArray::GetRef32;
+ using SbxArray::Get32;
+ SbxVariable* Get32( const sal_Int32* );
+ using SbxArray::Put32;
+ void Put32( SbxVariable*, const sal_Int32* );
+ void AddDim32( sal_Int32, sal_Int32 );
+ void unoAddDim32( sal_Int32, sal_Int32 );
+ sal_Bool GetDim32( sal_Int32, sal_Int32&, sal_Int32& ) const;
+ bool hasFixedSize() { return mbHasFixedSize; };
+ void setHasFixedSize( bool bHasFixedSize ) {mbHasFixedSize = bHasFixedSize; };
+};
+
+class BASIC_DLLPUBLIC SbxCollection : public SbxObject
+{
+ BASIC_DLLPRIVATE void Initialize();
+protected:
+ virtual ~SbxCollection();
+ virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
+ virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
+ const SfxHint& rHint, const TypeId& rHintType );
+ // Overridable methods (why not pure virtual?):
+ virtual void CollAdd( SbxArray* pPar );
+ virtual void CollItem( SbxArray* pPar );
+ virtual void CollRemove( SbxArray* pPar );
+
+public:
+ SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_COLLECTION,1);
+ TYPEINFO();
+ SbxCollection( const OUString& rClassname );
+ SbxCollection( const SbxCollection& );
+ SbxCollection& operator=( const SbxCollection& );
+ virtual SbxVariable* FindUserData( sal_uInt32 nUserData );
+ virtual SbxVariable* Find( const OUString&, SbxClassType );
+ virtual void Clear();
+};
+
+class BASIC_DLLPUBLIC SbxStdCollection : public SbxCollection
+{
+protected:
+ OUString aElemClass;
+ sal_Bool bAddRemoveOk;
+ virtual ~SbxStdCollection();
+ virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
+ virtual sal_Bool StoreData( SvStream& ) const;
+ virtual void CollAdd( SbxArray* pPar );
+ virtual void CollRemove( SbxArray* pPar );
+public:
+ SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_FIXCOLLECTION,1);
+ TYPEINFO();
+ SbxStdCollection( const OUString& rClassname, const OUString& rElemClass, sal_Bool=sal_True );
+ SbxStdCollection( const SbxStdCollection& );
+ SbxStdCollection& operator=( const SbxStdCollection& );
+ virtual void Insert( SbxVariable* );
+ const OUString& GetElementClass() const { return aElemClass; }
+};
+
+SV_IMPL_REF(SbxBase)
+
+SV_IMPL_REF(SbxVariable)
+
+#ifndef SBX_ARRAY_DECL_DEFINED
+#define SBX_ARRAY_DECL_DEFINED
+SV_DECL_REF(SbxArray)
+#endif
+SV_IMPL_REF(SbxArray)
+
+#ifndef SBX_INFO_DECL_DEFINED
+#define SBX_INFO_DECL_DEFINED
+SV_DECL_REF(SbxInfo)
+#endif
+SV_IMPL_REF(SbxInfo)
+
+SV_DECL_REF(SbxDimArray)
+SV_IMPL_REF(SbxDimArray)
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbxbase.hxx b/include/basic/sbxbase.hxx
new file mode 100644
index 000000000000..16484ee929d8
--- /dev/null
+++ b/include/basic/sbxbase.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SBXBASE_HXX
+#define _SBXBASE_HXX
+
+#include <i18nlangtag/lang.h>
+#include <basic/sbxdef.hxx>
+#include "basicdllapi.h"
+#include <boost/ptr_container/ptr_vector.hpp>
+
+class SbxFactory;
+class SbxVariable;
+class SbxBasicFormater;
+
+typedef boost::ptr_vector<SbxFactory> SbxFacs;
+
+// AppData structure for SBX:
+struct SbxAppData
+{
+ SbxError eSbxError; // Error code
+ SbxFacs aFacs; // Factories
+ SbxBasicFormater *pBasicFormater; // Pointer to Format()-Command helper class
+
+ LanguageType eBasicFormaterLangType;
+ // It might be useful to store this class 'global' because some string reosurces are saved here
+
+ SbxAppData() : eSbxError( SbxERR_OK ), aFacs(), pBasicFormater( NULL ) {}
+ ~SbxAppData();
+};
+
+BASIC_DLLPUBLIC SbxAppData& GetSbxData_Impl();
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbxcore.hxx b/include/basic/sbxcore.hxx
new file mode 100644
index 000000000000..4c71d1a5b977
--- /dev/null
+++ b/include/basic/sbxcore.hxx
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SBXCORE_HXX
+#define _SBXCORE_HXX
+
+#include <tools/rtti.hxx>
+#include <tools/ref.hxx>
+#include <tools/debug.hxx>
+
+#include <basic/sbxdef.hxx>
+#include "basicdllapi.h"
+
+class SvStream;
+
+// The following Macro defines four (five) necessary methods within a
+// SBX object. LoadPrivateData() and StorePrivateData() must be implemented.
+// They are necessary for loading/storing the data of derived classes.
+// Load() and Store() must not be overridden.
+
+// This version of the Macros does not define Load/StorePrivateData()-methods
+#define SBX_DECL_PERSIST_NODATA( nCre, nSbxId, nVer ) \
+ virtual sal_uInt32 GetCreator() const { return nCre; } \
+ virtual sal_uInt16 GetVersion() const { return nVer; } \
+ virtual sal_uInt16 GetSbxId() const { return nSbxId; }
+
+// This version of the macro defines Load/StorePrivateData()-methods
+#define SBX_DECL_PERSIST( nCre, nSbxId, nVer ) \
+ virtual sal_Bool LoadPrivateData( SvStream&, sal_uInt16 ); \
+ virtual sal_Bool StorePrivateData( SvStream& ) const; \
+ SBX_DECL_PERSIST_NODATA( nCre, nSbxId, nVer )
+
+class SbxBase;
+class SbxFactory;
+class SbxObject;
+
+DBG_NAMEEX_VISIBILITY(SbxBase, BASIC_DLLPUBLIC)
+
+class BASIC_DLLPUBLIC SbxBase : virtual public SvRefBase
+{
+ virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
+ virtual sal_Bool StoreData( SvStream& ) const;
+protected:
+ sal_uInt16 nFlags; // Flag-Bits
+
+ SbxBase();
+ SbxBase( const SbxBase& );
+ SbxBase& operator=( const SbxBase& );
+ virtual ~SbxBase();
+ SBX_DECL_PERSIST(0,0,0);
+public:
+ TYPEINFO();
+ inline void SetFlags( sal_uInt16 n );
+ inline sal_uInt16 GetFlags() const;
+ inline void SetFlag( sal_uInt16 n );
+ inline void ResetFlag( sal_uInt16 n );
+ inline sal_Bool IsSet( sal_uInt16 n ) const;
+ inline sal_Bool IsReset( sal_uInt16 n ) const;
+ inline sal_Bool CanRead() const;
+ inline sal_Bool CanWrite() const;
+ inline sal_Bool IsModified() const;
+ inline sal_Bool IsConst() const;
+ inline sal_Bool IsHidden() const;
+ inline sal_Bool IsVisible() const;
+
+ virtual sal_Bool IsFixed() const;
+ virtual void SetModified( sal_Bool );
+
+ virtual SbxDataType GetType() const;
+ virtual SbxClassType GetClass() const;
+
+ virtual void Clear();
+
+ static SbxBase* Load( SvStream& );
+ static void Skip( SvStream& );
+ sal_Bool Store( SvStream& );
+ virtual sal_Bool LoadCompleted();
+ virtual sal_Bool StoreCompleted();
+
+ static SbxError GetError();
+ static void SetError( SbxError );
+ static sal_Bool IsError();
+ static void ResetError();
+
+ // Set the factory for Load/Store/Create
+ static void AddFactory( SbxFactory* );
+ static void RemoveFactory( SbxFactory* );
+
+ static SbxBase* Create( sal_uInt16, sal_uInt32=SBXCR_SBX );
+ static SbxObject* CreateObject( const OUString& );
+};
+
+SV_DECL_REF(SbxBase)
+
+inline void SbxBase::SetFlags( sal_uInt16 n )
+{ //DBG_CHKTHIS( SbxBase, 0 );
+ nFlags = n; }
+
+inline sal_uInt16 SbxBase::GetFlags() const
+{ DBG_CHKTHIS( SbxBase, 0 ); return nFlags; }
+
+inline void SbxBase::SetFlag( sal_uInt16 n )
+{ //DBG_CHKTHIS( SbxBase, 0 );
+ nFlags |= n; }
+
+inline void SbxBase::ResetFlag( sal_uInt16 n )
+{ //DBG_CHKTHIS( SbxBase, 0 );
+ nFlags &= ~n; }
+
+inline sal_Bool SbxBase::IsSet( sal_uInt16 n ) const
+{ DBG_CHKTHIS( SbxBase, 0 ); return sal_Bool( ( nFlags & n ) != 0 ); }
+
+inline sal_Bool SbxBase::IsReset( sal_uInt16 n ) const
+{ DBG_CHKTHIS( SbxBase, 0 ); return sal_Bool( ( nFlags & n ) == 0 ); }
+
+inline sal_Bool SbxBase::CanRead() const
+{ DBG_CHKTHIS( SbxBase, 0 ); return IsSet( SBX_READ ); }
+
+inline sal_Bool SbxBase::CanWrite() const
+{ DBG_CHKTHIS( SbxBase, 0 ); return IsSet( SBX_WRITE ); }
+
+inline sal_Bool SbxBase::IsModified() const
+{ DBG_CHKTHIS( SbxBase, 0 ); return IsSet( SBX_MODIFIED ); }
+
+inline sal_Bool SbxBase::IsConst() const
+{ DBG_CHKTHIS( SbxBase, 0 ); return IsSet( SBX_CONST ); }
+
+inline sal_Bool SbxBase::IsHidden() const
+{ DBG_CHKTHIS( SbxBase, 0 ); return IsSet( SBX_HIDDEN ); }
+
+inline sal_Bool SbxBase::IsVisible() const
+{ DBG_CHKTHIS( SbxBase, 0 ); return IsReset( SBX_INVISIBLE ); }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbxdef.hxx b/include/basic/sbxdef.hxx
new file mode 100644
index 000000000000..781a71b3b430
--- /dev/null
+++ b/include/basic/sbxdef.hxx
@@ -0,0 +1,311 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef _SBXDEF_HXX
+#define _SBXDEF_HXX
+
+
+#ifndef __RSC
+#include <tools/solar.h>
+#include "tools/errcode.hxx"
+
+enum SbxClassType { // SBX-class-IDs (order is important!)
+ SbxCLASS_DONTCARE = 1, // don't care (search, not 0 due to StarBASIC)
+ SbxCLASS_ARRAY, // Array of SbxVariables
+ SbxCLASS_VALUE, // simple value
+ SbxCLASS_VARIABLE, // Variable (from here there is Broadcaster)
+ SbxCLASS_METHOD, // Method (Function or Sub)
+ SbxCLASS_PROPERTY, // Property
+ SbxCLASS_OBJECT // Object
+};
+
+enum SbxDataType {
+ SbxEMPTY = 0, // * Uninitialized
+ SbxNULL = 1, // * Contains no valid data
+ SbxINTEGER = 2, // * Integer (sal_Int16)
+ SbxLONG = 3, // * Long integer (sal_Int32)
+ SbxSINGLE = 4, // * Single-precision floating point number (float)
+ SbxDOUBLE = 5, // * Double-precision floating point number (double)
+ SbxCURRENCY = 6, // Currency (sal_Int64)
+ SbxDATE = 7, // * Date (double)
+ SbxSTRING = 8, // * String (StarView)
+ SbxOBJECT = 9, // * SbxBase object pointer
+ SbxERROR = 10, // * Error (sal_uInt16)
+ SbxBOOL = 11, // * Boolean (0 or -1)
+
+ SbxVARIANT = 12, // * Display for variant datatype
+ SbxDATAOBJECT = 13, // * Common data object w/o ref count
+
+ SbxCHAR = 16, // * signed char
+ SbxBYTE = 17, // * unsigned char
+ SbxUSHORT = 18, // * unsigned short (sal_uInt16)
+ SbxULONG = 19, // * unsigned long (sal_uInt32)
+
+//deprecated: // old 64bit types kept for backward compatibility in file I/O
+ SbxLONG64 = 20, // moved to SbxSALINT64 as 64bit int
+ SbxULONG64 = 21, // moved to SbxSALUINT64 as 64bit int
+
+ SbxINT = 22, // * signed machine-dependent int
+ SbxUINT = 23, // * unsigned machine-dependent int
+
+ SbxVOID = 24, // * no value (= SbxEMPTY)
+ SbxHRESULT = 25, // HRESULT
+ SbxPOINTER = 26, // generic pointer
+ SbxDIMARRAY = 27, // dimensioned array
+ SbxCARRAY = 28, // C style array
+ SbxUSERDEF = 29, // user defined
+ SbxLPSTR = 30, // * null terminated string
+
+ SbxLPWSTR = 31, // wide null terminated string
+ SbxCoreSTRING = 32, // from 1997-4-10 for GetCoreString(), only for converting<
+
+ SbxWSTRING = 33, // from 2000-10-4 Reimplemented for backwards compatibility (#78919)
+ SbxWCHAR = 34, // from 2000-10-4 Reimplemented for backwards compatibility (#78919)
+ SbxSALINT64 = 35, // for currency internal, signed 64-bit int and UNO hyper
+ SbxSALUINT64= 36, // for currency internal, unsigned 64-bit int and UNO unsigned hyper
+ SbxDECIMAL = 37, // for UNO/automation Decimal
+
+ SbxVECTOR = 0x1000, // simple counted array
+ SbxARRAY = 0x2000, // array
+ SbxBYREF = 0x4000, // access by reference
+
+ SbxSV1 = 128, // first defined data type for StarView
+ SbxMEMORYSTREAM, // SvMemoryStream
+ SbxSTORAGE, // SvStorage
+
+ SbxUSER1 = 256, // first user defined data type
+ SbxUSERn = 2047 // last user defined data type
+};
+
+const sal_uInt32 SBX_TYPE_WITH_EVENTS_FLAG = 0x10000;
+const sal_uInt32 SBX_TYPE_DIM_AS_NEW_FLAG = 0x20000;
+const sal_uInt32 SBX_FIXED_LEN_STRING_FLAG = 0x10000; // same value as above as no conflict possible
+const sal_uInt32 SBX_TYPE_VAR_TO_DIM_FLAG = 0x40000;
+
+enum SbxOperator {
+ // Arithmetical:
+ SbxEXP, // this ^ var
+ SbxMUL, // this * var
+ SbxDIV, // this / var
+ SbxMOD, // this MOD var (max INT32!)
+ SbxPLUS, // this + var
+ SbxMINUS, // this - var
+ SbxNEG, // -this (var is ignored)
+ SbxIDIV, // this / var (both operands max. sal_Int32!)
+ // Boolean operators (max sal_Int32!):
+ // Boolean operators (TODO deprecate this limit: max INT32!)
+ SbxAND, // this & var
+ SbxOR, // this | var
+ SbxXOR, // this ^ var
+ SbxEQV, // ~this ^ var
+ SbxIMP, // ~this | var
+ SbxNOT, // ~this (var is ignored)
+
+ // String concatenation:
+ SbxCAT, // this & var (VBA: this + var)
+
+ // Comparisons:
+ SbxEQ, // this = var
+ SbxNE, // this <> var
+ SbxLT, // this < var
+ SbxGT, // this > var
+ SbxLE, // this <= var
+ SbxGE // this >= var
+};
+
+enum SbxNameType { // Type of the questioned name of a variable
+ SbxNAME_NONE, // plain name
+ SbxNAME_SHORT, // Name(A,B)
+ SbxNAME_SHORT_TYPES, // Name%(A%,B$)
+ SbxNAME_LONG_TYPES // Name(A As Integer, B As String) As Integer
+};
+
+// from 1996/3/20: New error messages
+typedef sal_uIntPtr SbxError; // Preserve old type
+
+#endif
+
+
+// New error codes per define
+#define ERRCODE_SBX_OK ERRCODE_NONE // processed
+
+#define ERRCODE_SBX_SYNTAX (1UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_COMPILER)
+#define ERRCODE_SBX_NOTIMP (2UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_NOTSUPPORTED)
+#define ERRCODE_SBX_OVERFLOW (3UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // overflow
+#define ERRCODE_SBX_BOUNDS (4UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // Invalid array index
+#define ERRCODE_SBX_ZERODIV (5UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // Division by zero
+#define ERRCODE_SBX_CONVERSION (6UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // wrong data type
+#define ERRCODE_SBX_BAD_PARAMETER (7UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // invalid Parameter
+#define ERRCODE_SBX_PROC_UNDEFINED (8UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Sub or Func not def
+#define ERRCODE_SBX_ERROR (9UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_UNKNOWN) // generic object error
+#define ERRCODE_SBX_NO_OBJECT (10UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Object var not object
+#define ERRCODE_SBX_CANNOT_LOAD (11UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_CREATE) // Object init/load fail
+#define ERRCODE_SBX_BAD_INDEX (12UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // Invalid object index
+#define ERRCODE_SBX_NO_ACTIVE_OBJECT (13UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_ACCESS) // Object not active
+#define ERRCODE_SBX_BAD_PROP_VALUE (14UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Bad property value
+#define ERRCODE_SBX_PROP_READONLY (15UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_READ) // Property is read only
+#define ERRCODE_SBX_PROP_WRITEONLY (16UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_WRITE) // Property is write only
+#define ERRCODE_SBX_INVALID_OBJECT (17UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_ACCESS) // Invalid object reference
+#define ERRCODE_SBX_NO_METHOD (18UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Property oder Methode unbekannt
+#define ERRCODE_SBX_INVALID_USAGE_OBJECT (19UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_ACCESS) // Invalid object usage
+#define ERRCODE_SBX_NO_OLE (20UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_ACCESS) // No OLE-Object
+#define ERRCODE_SBX_BAD_METHOD (21UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Method not supported
+#define ERRCODE_SBX_OLE_ERROR (22UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // OLE Automation Error
+#define ERRCODE_SBX_BAD_ACTION (23UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_NOTSUPPORTED) // Action not supported
+#define ERRCODE_SBX_NO_NAMED_ARGS (24UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // No named arguments
+#define ERRCODE_SBX_BAD_LOCALE (25UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_NOTSUPPORTED) // Locale not supported
+#define ERRCODE_SBX_NAMED_NOT_FOUND (26UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Unknown named argument
+#define ERRCODE_SBX_NOT_OPTIONAL (27UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Argument not optional
+#define ERRCODE_SBX_WRONG_ARGS (28UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // Invalid number of arguments
+#define ERRCODE_SBX_NOT_A_COLL (29UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Object contains no elements
+#define LAST_SBX_ERROR_ID 29UL
+
+#ifndef __RSC
+
+// Map old codes to new ones
+#define SbxERR_OK ERRCODE_SBX_OK
+#define SbxERR_SYNTAX ERRCODE_SBX_SYNTAX
+#define SbxERR_NOTIMP ERRCODE_SBX_NOTIMP
+#define SbxERR_OVERFLOW ERRCODE_SBX_OVERFLOW
+#define SbxERR_BOUNDS ERRCODE_SBX_BOUNDS
+#define SbxERR_ZERODIV ERRCODE_SBX_ZERODIV
+#define SbxERR_CONVERSION ERRCODE_SBX_CONVERSION
+#define SbxERR_BAD_PARAMETER ERRCODE_SBX_BAD_PARAMETER
+#define SbxERR_PROC_UNDEFINED ERRCODE_SBX_PROC_UNDEFINED
+#define SbxERR_ERROR ERRCODE_SBX_ERROR
+#define SbxERR_NO_OBJECT ERRCODE_SBX_NO_OBJECT
+#define SbxERR_CANNOT_LOAD ERRCODE_SBX_CANNOT_LOAD
+#define SbxERR_BAD_INDEX ERRCODE_SBX_BAD_INDEX
+#define SbxERR_NO_ACTIVE_OBJECT ERRCODE_SBX_NO_ACTIVE_OBJECT
+#define SbxERR_BAD_PROP_VALUE ERRCODE_SBX_BAD_PROP_VALUE
+#define SbxERR_PROP_READONLY ERRCODE_SBX_PROP_READONLY
+#define SbxERR_PROP_WRITEONLY ERRCODE_SBX_PROP_WRITEONLY
+#define SbxERR_INVALID_OBJECT ERRCODE_SBX_INVALID_OBJECT
+#define SbxERR_NO_METHOD ERRCODE_SBX_NO_METHOD
+#define SbxERR_INVALID_USAGE_OBJECT ERRCODE_SBX_INVALID_USAGE_OBJECT
+#define SbxERR_NO_OLE ERRCODE_SBX_NO_OLE
+#define SbxERR_BAD_METHOD ERRCODE_SBX_BAD_METHOD
+#define SbxERR_OLE_ERROR ERRCODE_SBX_OLE_ERROR
+#define SbxERR_BAD_ACTION ERRCODE_SBX_BAD_ACTION
+#define SbxERR_NO_NAMED_ARGS ERRCODE_SBX_NO_NAMED_ARGS
+#define SbxERR_BAD_LOCALE ERRCODE_SBX_BAD_LOCALE
+#define SbxERR_NAMED_NOT_FOUND ERRCODE_SBX_NAMED_NOT_FOUND
+#define SbxERR_NOT_OPTIONAL ERRCODE_SBX_NOT_OPTIONAL
+#define SbxERR_WRONG_ARGS ERRCODE_SBX_WRONG_ARGS
+#define SbxERR_NOT_A_COLL ERRCODE_SBX_NOT_A_COLL
+
+
+// Flag-Bits:
+#define SBX_READ 0x0001 // Read permission
+#define SBX_WRITE 0x0002 // Write permission
+#define SBX_READWRITE 0x0003 // Read/Write permission
+#define SBX_DONTSTORE 0x0004 // Don't store object
+#define SBX_MODIFIED 0x0008 // Object was changed
+#define SBX_FIXED 0x0010 // Fixed data type (SbxVariable)
+#define SBX_CONST 0x0020 // Definition of const value
+#define SBX_OPTIONAL 0x0040 // Parameter is optional
+#define SBX_HIDDEN 0x0080 // Element is invisible
+#define SBX_INVISIBLE 0x0100 // Element is not found by Find()
+#define SBX_EXTSEARCH 0x0200 // Object is searched completely
+#define SBX_EXTFOUND 0x0400 // Variable was found through extended search
+#define SBX_GBLSEARCH 0x0800 // Global search via Parents
+#define SBX_RESERVED 0x1000 // reserved
+#define SBX_PRIVATE 0x1000 // #110004, #112015, cannot conflict with SBX_RESERVED
+#define SBX_NO_BROADCAST 0x2000 // No broadcast on Get/Put
+#define SBX_REFERENCE 0x4000 // Parameter is Reference (DLL-call)
+#define SBX_NO_MODIFY 0x8000 // SetModified is suppressed
+#define SBX_WITH_EVENTS 0x0080 // Same value as unused SBX_HIDDEN
+#define SBX_DIM_AS_NEW 0x0800 // Same value as SBX_GBLSEARCH, cannot conflict as one
+ // is used for objects, the other for variables only
+#define SBX_VAR_TO_DIM 0x2000 // Same value as SBX_NO_BROADCAST, cannot conflict as
+ // used for variables without broadcaster only
+
+// Broadcaster-IDs:
+#define SBX_HINT_DYING SFX_HINT_DYING
+#define SBX_HINT_DATAWANTED SFX_HINT_USER00
+#define SBX_HINT_DATACHANGED SFX_HINT_DATACHANGED
+#define SBX_HINT_CONVERTED SFX_HINT_USER01
+#define SBX_HINT_INFOWANTED SFX_HINT_USER02
+#define SBX_HINT_OBJECTCHANGED SFX_HINT_USER03
+
+// List of all creators for Load/Store
+
+#define SBXCR_SBX 0x20584253 // SBX(blank)
+
+// List of predefined SBX-IDs. New SBX-IDs must be precisly defined so that
+// they are unique within the Stream and appropriate Factory.
+
+#define SBXID_VALUE 0x4E4E // NN: SbxValue
+#define SBXID_VARIABLE 0x4156 // VA: SbxVariable
+#define SBXID_ARRAY 0x5241 // AR: SbxArray
+#define SBXID_DIMARRAY 0x4944 // DI: SbxDimArray
+#define SBXID_OBJECT 0x424F // OB: SbxObject
+#define SBXID_COLLECTION 0x4F43 // CO: SbxCollection
+#define SBXID_FIXCOLLECTION 0x4346 // FC: SbxStdCollection
+#define SBXID_METHOD 0x454D // ME: SbxMethod
+#define SBXID_PROPERTY 0x5250 // PR: SbxProperty
+
+// StarBASIC restricts the base data type to different intervals.
+// These intervals are fixed to create 'portability and independent
+// of the implementation. Only type double is greedy and takes
+// what it gets.
+
+#define SbxMAXCHAR ((sal_Unicode)65535)
+#define SbxMINCHAR (0)
+#define SbxMAXBYTE ( 255)
+#define SbxMAXINT ( 32767)
+#define SbxMININT (-32768)
+#define SbxMAXUINT ((sal_uInt16) 65535)
+#define SbxMAXLNG ( 2147483647)
+#define SbxMINLNG ((sal_Int32)(-2147483647-1))
+#define SbxMAXULNG ((sal_uInt32) 0xffffffff)
+
+#define SbxMAXSALUINT64 SAL_MAX_UINT64
+#define SbxMAXSALINT64 SAL_MAX_INT64
+#define SbxMINSALINT64 SAL_MIN_INT64
+
+ // Currency stored as SbxSALINT64 == sal_Int64
+ // value range limits are ~(2^63 - 1)/10000
+ // fixed precision has 4 digits right of decimal pt
+#define CURRENCY_FACTOR (10000)
+#define CURRENCY_FACTOR_SQUARE (100000000)
+
+// TODO effective MAX/MINCURR limits:
+// true value ( 922337203685477.5807) is too precise for correct comparison to 64bit double
+#define SbxMAXCURR ( 922337203685477.5807)
+#define SbxMINCURR (-922337203685477.5808)
+
+#define SbxMAXSNG ( 3.402823e+38)
+#define SbxMINSNG (-3.402823e+38)
+#define SbxMAXSNG2 ( 1.175494351e-38)
+#define SbxMINSNG2 (-1.175494351e-38)
+
+// Max valid offset index of a Sbx-Array (due to 64K limit)
+#define SBX_MAXINDEX 0x3FF0
+#define SBX_MAXINDEX32 SbxMAXLNG
+
+// The numeric values of sal_True and FALSE
+enum SbxBOOL { SbxFALSE = 0, SbxTRUE = -1 };
+
+#endif //ifndef __RSC
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbxfac.hxx b/include/basic/sbxfac.hxx
new file mode 100644
index 000000000000..33035cf45c9b
--- /dev/null
+++ b/include/basic/sbxfac.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __SBX_SBX_FACTORY_HXX
+#define __SBX_SBX_FACTORY_HXX
+
+#include <basic/sbxdef.hxx>
+#include <rtl/ustring.hxx>
+#include "basicdllapi.h"
+
+class SbxBase;
+class SbxObject;
+
+class BASIC_DLLPUBLIC SbxFactory
+{
+ bool bHandleLast; // true: Factory is asked at last because of its expensiveness
+public:
+ virtual ~SbxFactory();
+ SbxFactory( bool bLast=false ) { bHandleLast = bLast; }
+ bool IsHandleLast( void ) { return bHandleLast; }
+ virtual SbxBase* Create( sal_uInt16 nSbxId, sal_uInt32 = SBXCR_SBX );
+ virtual SbxObject* CreateObject( const OUString& );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbxform.hxx b/include/basic/sbxform.hxx
new file mode 100644
index 000000000000..589f3ec24fd0
--- /dev/null
+++ b/include/basic/sbxform.hxx
@@ -0,0 +1,173 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SBXFORM_HXX
+#define _SBXFORM_HXX
+
+//====================================================================
+// Implementation class for Basic command: Format$( d,formatStr )
+//====================================================================
+/*
+ Grammar of format string (a try):
+ -----------------------------------------------
+
+ format_string := {\special_char} general_format | scientific_format {\special_char} {;format_string}
+ general_format := {#[,]}{0[,]}[.{0}{#}]
+ scientific_format := {0}[.{0}{#}](e | E)(+ | -){#}{0}
+
+ percent_char := '%'
+ special_char := \char | + | - | ( | ) | $ | space_char
+ char := all_ascii_chars
+ space_char := ' '
+
+ {} repeated multiple times (incl. zero times)
+ [] exactly one or zero times
+ () parenthesis, e.g. (e | E) means e or E times
+
+ Additional predefined formats for the format string:
+ "General Number"
+ "Currency"
+ "Fixed"
+ "Standard"
+ "Percent"
+ "Scientific"
+ "Yes/No"
+ "True/False"
+ "On/Off"
+
+ Note: invalid format string are ignored just as in VisualBasic, the output is
+ probably 'undefined'. ASCII letters are outputted directly.
+
+ Constraints in VisualBasic:
+ - the exponent (scientific syntax) has a maximum of three digits!
+
+ Constraints of new implementation:
+ - the '+' sign is not allowed as wildcard in the mantissa
+
+ TODO:
+ - Date formatting
+ Wildcards are: 'h', 'm', 's', 'y'
+ predefined String-Constants/Commands:
+ "AMPM", "Long Date", "Long Time"
+*/
+
+/*
+ There are two possibilities to get the number of digits of a number:
+
+ a) use sprintf()
+ b) use log10() and pow() digit
+*/
+#define _with_sprintf // use a)
+
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+#include "basicdllapi.h"
+
+class BASIC_DLLPUBLIC SbxBasicFormater {
+ public:
+ // Constructor takes signs for decimal point, thousand separation sign
+ // and necessary resource strings.
+ SbxBasicFormater( sal_Unicode _cDecPoint, sal_Unicode _cThousandSep,
+ OUString _sOnStrg,
+ OUString _sOffStrg,
+ OUString _sYesStrg,
+ OUString _sNoStrg,
+ OUString _sTrueStrg,
+ OUString _sFalseStrg,
+ OUString _sCurrencyStrg,
+ OUString _sCurrencyFormatStrg );
+
+ /* Basic command: Format$( number,format-string )
+
+ Parameter:
+ dNumber : number to be formated
+ sFormatStrg : the Format-String, e.g. ###0.0###
+
+ Return value:
+ String containing the formatted output
+ */
+ OUString BasicFormat( double dNumber, OUString sFormatStrg );
+ OUString BasicFormatNull( OUString sFormatStrg );
+
+ static sal_Bool isBasicFormat( OUString sFormatStrg );
+
+ private:
+ BASIC_DLLPRIVATE inline void ShiftString( OUStringBuffer& sStrg, sal_uInt16 nStartPos );
+ BASIC_DLLPRIVATE void AppendDigit( OUStringBuffer& sStrg, short nDigit );
+ BASIC_DLLPRIVATE void LeftShiftDecimalPoint( OUStringBuffer& sStrg );
+ BASIC_DLLPRIVATE void StrRoundDigit( OUStringBuffer& sStrg, short nPos, sal_Bool& bOverflow );
+ BASIC_DLLPRIVATE void StrRoundDigit( OUStringBuffer& sStrg, short nPos );
+ BASIC_DLLPRIVATE void ParseBack( OUStringBuffer& sStrg, const OUString& sFormatStrg,
+ short nFormatPos );
+#ifdef _with_sprintf
+ // Methods for string conversion with sprintf():
+ BASIC_DLLPRIVATE void InitScan( double _dNum );
+ BASIC_DLLPRIVATE void InitExp( double _dNewExp );
+ BASIC_DLLPRIVATE short GetDigitAtPosScan( short nPos, sal_Bool& bFoundFirstDigit );
+ BASIC_DLLPRIVATE short GetDigitAtPosExpScan( double dNewExponent, short nPos,
+ sal_Bool& bFoundFirstDigit );
+ BASIC_DLLPRIVATE short GetDigitAtPosExpScan( short nPos, sal_Bool& bFoundFirstDigit );
+#else
+ // Methods for direct 'calculation' with log10() and pow():
+ BASIC_DLLPRIVATE short GetDigitAtPos( double dNumber, short nPos, double& dNextNumber,
+ sal_Bool& bFoundFirstDigit );
+ BASIC_DLLPRIVATE short RoundDigit( double dNumber );
+#endif
+ BASIC_DLLPRIVATE OUString GetPosFormatString( const OUString& sFormatStrg, sal_Bool & bFound );
+ BASIC_DLLPRIVATE OUString GetNegFormatString( const OUString& sFormatStrg, sal_Bool & bFound );
+ BASIC_DLLPRIVATE OUString Get0FormatString( const OUString& sFormatStrg, sal_Bool & bFound );
+ BASIC_DLLPRIVATE OUString GetNullFormatString( const OUString& sFormatStrg, sal_Bool & bFound );
+ BASIC_DLLPRIVATE short AnalyseFormatString( const OUString& sFormatStrg,
+ short& nNoOfDigitsLeft, short& nNoOfDigitsRight,
+ short& nNoOfOptionalDigitsLeft,
+ short& nNoOfExponentDigits,
+ short& nNoOfOptionalExponentDigits,
+ sal_Bool& bPercent, sal_Bool& bCurrency, sal_Bool& bScientific,
+ sal_Bool& bGenerateThousandSeparator,
+ short& nMultipleThousandSeparators );
+ BASIC_DLLPRIVATE void ScanFormatString( double dNumber, const OUString& sFormatStrg,
+ OUString& sReturnStrg, sal_Bool bCreateSign );
+
+ //*** Data ***
+ sal_Unicode cDecPoint; // sign for the decimal point
+ sal_Unicode cThousandSep; // sign for thousand delimiter
+ // Text for output:
+ OUString sOnStrg;
+ OUString sOffStrg;
+ OUString sYesStrg;
+ OUString sNoStrg;
+ OUString sTrueStrg;
+ OUString sFalseStrg;
+ OUString sCurrencyStrg;
+ OUString sCurrencyFormatStrg;
+
+ //*** temporary data for scan loop ***
+ //-----------------------------------------------
+ // String containing the number in scientific format
+ OUString sSciNumStrg;
+ // String containing the exponent of the number
+ OUString sNumExpStrg;
+ double dNum; // the number that is scanned
+ short nNumExp; // the exponent of the number
+ short nExpExp; // the number of digits in the exponent
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbxmeth.hxx b/include/basic/sbxmeth.hxx
new file mode 100644
index 000000000000..227c00cbad88
--- /dev/null
+++ b/include/basic/sbxmeth.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __SBX_SBXMETHOD_HXX
+#define __SBX_SBXMETHOD_HXX
+
+#include <basic/sbxvar.hxx>
+#include "basicdllapi.h"
+
+class BASIC_DLLPUBLIC SbxMethod : public SbxVariable
+{
+public:
+ SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_METHOD,1);
+ TYPEINFO();
+ SbxMethod( const OUString& r, SbxDataType t );
+ SbxMethod( const SbxMethod& r );
+ ~SbxMethod();
+ SbxMethod& operator=( const SbxMethod& r ) { SbxVariable::operator=( r ); return *this; }
+ virtual SbxClassType GetClass() const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbxobj.hxx b/include/basic/sbxobj.hxx
new file mode 100644
index 000000000000..2dc4aa735513
--- /dev/null
+++ b/include/basic/sbxobj.hxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SBX_SBXOBJECT_HXX
+#define _SBX_SBXOBJECT_HXX
+
+#include <svl/lstner.hxx>
+#include <basic/sbxvar.hxx>
+#include "basicdllapi.h"
+
+
+class SbxProperty;
+
+class BASIC_DLLPUBLIC SbxObject : public SbxVariable, public SfxListener
+{
+ BASIC_DLLPRIVATE SbxArray* FindVar( SbxVariable*, sal_uInt16& );
+protected:
+ SbxArrayRef pMethods; // Methods
+ SbxArrayRef pProps; // Properties
+ SbxArrayRef pObjs; // Objects
+ SbxProperty* pDfltProp; // Default-Property
+ OUString aClassName; // Classname
+ OUString aDfltPropName;
+ virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
+ virtual sal_Bool StoreData( SvStream& ) const;
+ virtual ~SbxObject();
+ virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
+ const SfxHint& rHint, const TypeId& rHintType );
+public:
+ SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_OBJECT,1);
+ TYPEINFO();
+ SbxObject( const OUString& rClassname );
+ SbxObject( const SbxObject& );
+ SbxObject& operator=( const SbxObject& );
+ virtual SbxDataType GetType() const;
+ virtual SbxClassType GetClass() const;
+ virtual void Clear();
+
+ virtual sal_Bool IsClass( const OUString& ) const;
+ const OUString& GetClassName() const { return aClassName; }
+ void SetClassName( const OUString &rNew ) { aClassName = rNew; }
+ // Default-Property
+ SbxProperty* GetDfltProperty();
+ void SetDfltProperty( const OUString& r );
+ // Search for an element
+ virtual SbxVariable* FindUserData( sal_uInt32 nUserData );
+ virtual SbxVariable* Find( const OUString&, SbxClassType );
+ SbxVariable* FindQualified( const OUString&, SbxClassType );
+ // Quick-Call-Interface for Methods
+ virtual sal_Bool Call( const OUString&, SbxArray* = NULL );
+ // Execution of DDE-Commands
+ SbxVariable* Execute( const OUString& );
+ // Manage elements
+ virtual sal_Bool GetAll( SbxClassType ) { return sal_True; }
+ SbxVariable* Make( const OUString&, SbxClassType, SbxDataType );
+ virtual SbxObject* MakeObject( const OUString&, const OUString& );
+ virtual void Insert( SbxVariable* );
+ // AB 23.4.1997, Optimization, Insertion without check for duplicate Entries and
+ // without Broadcasts, only used in SO2/auto.cxx
+ void QuickInsert( SbxVariable* );
+ virtual void Remove( const OUString&, SbxClassType );
+ virtual void Remove( SbxVariable* );
+
+ // Macro-Recording
+ virtual OUString GenerateSource( const OUString &rLinePrefix,
+ const SbxObject *pRelativeTo );
+ // Direct access on arrays
+ SbxArray* GetMethods() { return pMethods; }
+ SbxArray* GetProperties() { return pProps; }
+ SbxArray* GetObjects() { return pObjs; }
+ // Debugging
+ void Dump( SvStream&, sal_Bool bDumpAll=sal_False );
+};
+
+SV_DECL_REF(SbxObject)
+SV_IMPL_REF(SbxObject)
+
+#endif /* _SBX_SBXOBJECT_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbxprop.hxx b/include/basic/sbxprop.hxx
new file mode 100644
index 000000000000..89d774d4967f
--- /dev/null
+++ b/include/basic/sbxprop.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __SBX_SBXPROPERTY_HXX
+#define __SBX_SBXPROPERTY_HXX
+
+#include <basic/sbxvar.hxx>
+#include "basicdllapi.h"
+
+class BASIC_DLLPUBLIC SbxProperty : public SbxVariable
+{
+public:
+ SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_PROPERTY,1);
+ TYPEINFO();
+ SbxProperty( const OUString& r, SbxDataType t );
+ SbxProperty( const SbxProperty& r ) : SvRefBase( r ), SbxVariable( r ) {}
+ virtual ~SbxProperty();
+ SbxProperty& operator=( const SbxProperty& r )
+ { SbxVariable::operator=( r ); return *this; }
+ virtual SbxClassType GetClass() const;
+};
+
+SV_DECL_REF(SbxProperty)
+SV_IMPL_REF(SbxProperty)
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbxvar.hxx b/include/basic/sbxvar.hxx
new file mode 100644
index 000000000000..4d4a8b625bc3
--- /dev/null
+++ b/include/basic/sbxvar.hxx
@@ -0,0 +1,356 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SBXVAR_HXX
+#define SBXVAR_HXX
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/bridge/oleautomation/Decimal.hpp>
+#include <basic/sbxcore.hxx>
+#include "basicdllapi.h"
+
+
+class SbxDecimal;
+
+struct SbxValues
+{
+ union {
+ sal_uInt8 nByte;
+ sal_uInt16 nUShort;
+ sal_Unicode nChar;
+ sal_Int16 nInteger;
+ sal_uInt32 nULong;
+ sal_Int32 nLong;
+ unsigned int nUInt;
+ int nInt;
+ sal_uInt64 uInt64;
+ sal_Int64 nInt64;
+
+ float nSingle;
+ double nDouble;
+
+ OUString* pOUString;
+ SbxDecimal* pDecimal;
+
+ SbxBase* pObj;
+
+ sal_uInt8* pByte;
+ sal_uInt16* pUShort;
+ sal_Unicode* pChar;
+ sal_Int16* pInteger;
+ sal_uInt32* pULong;
+ sal_Int32* pLong;
+ unsigned int* pUInt;
+ int* pInt;
+ sal_uInt64* puInt64;
+ sal_Int64* pnInt64;
+
+ float* pSingle;
+ double* pDouble;
+
+ void* pData;
+ };
+ SbxDataType eType;
+
+ SbxValues(): pData( NULL ), eType(SbxEMPTY) {}
+ SbxValues( SbxDataType e ): eType(e) {}
+ SbxValues( char _nChar ): nChar( _nChar ), eType(SbxCHAR) {}
+ SbxValues( sal_uInt8 _nByte ): nByte( _nByte ), eType(SbxBYTE) {}
+ SbxValues( short _nInteger ): nInteger( _nInteger ), eType(SbxINTEGER ) {}
+ SbxValues( long _nLong ): nLong( _nLong ), eType(SbxLONG) {}
+ SbxValues( sal_uInt16 _nUShort ): nUShort( _nUShort ), eType(SbxUSHORT) {}
+ SbxValues( sal_uIntPtr _nULong ): nULong( _nULong ), eType(SbxULONG) {}
+ SbxValues( int _nInt ): nInt( _nInt ), eType(SbxINT) {}
+ SbxValues( unsigned int _nUInt ): nUInt( _nUInt ), eType(SbxUINT) {}
+ SbxValues( float _nSingle ): nSingle( _nSingle ), eType(SbxSINGLE) {}
+ SbxValues( double _nDouble ): nDouble( _nDouble ), eType(SbxDOUBLE) {}
+ SbxValues( const OUString* _pString ): pOUString( (OUString*)_pString ), eType(SbxSTRING) {}
+ SbxValues( SbxBase* _pObj ): pObj( _pObj ), eType(SbxOBJECT) {}
+ SbxValues( sal_Unicode* _pChar ): pChar( _pChar ), eType(SbxLPSTR) {}
+ SbxValues( void* _pData ): pData( _pData ), eType(SbxPOINTER) {}
+
+};
+
+class BASIC_DLLPUBLIC SbxValue : public SbxBase
+{
+ // #55226 Transport additional infos
+ BASIC_DLLPRIVATE SbxValue* TheRealValue( sal_Bool bObjInObjError ) const;
+ BASIC_DLLPRIVATE SbxValue* TheRealValue() const;
+protected:
+ SbxValues aData; // Data
+ OUString aPic; // Picture-String
+ OUString aToolString; // tool string copy
+
+ virtual void Broadcast( sal_uIntPtr ); // Broadcast-Call
+ virtual ~SbxValue();
+ virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
+ virtual sal_Bool StoreData( SvStream& ) const;
+public:
+ SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_VALUE,1);
+ TYPEINFO();
+ SbxValue();
+ SbxValue( SbxDataType, void* = NULL );
+ SbxValue( const SbxValue& );
+ SbxValue& operator=( const SbxValue& );
+ virtual void Clear();
+ virtual sal_Bool IsFixed() const;
+
+ sal_Bool IsInteger() const { return sal_Bool( GetType() == SbxINTEGER ); }
+ sal_Bool IsLong() const { return sal_Bool( GetType() == SbxLONG ); }
+ sal_Bool IsSingle() const { return sal_Bool( GetType() == SbxSINGLE ); }
+ sal_Bool IsDouble() const { return sal_Bool( GetType() == SbxDOUBLE ); }
+ sal_Bool IsString() const { return sal_Bool( GetType() == SbxSTRING ); }
+ sal_Bool IsDate() const { return sal_Bool( GetType() == SbxDATE ); }
+ sal_Bool IsCurrency()const { return sal_Bool( GetType() == SbxCURRENCY ); }
+ sal_Bool IsObject() const { return sal_Bool( GetType() == SbxOBJECT ); }
+ sal_Bool IsDataObject()const{return sal_Bool( GetType() == SbxDATAOBJECT);}
+ sal_Bool IsBool() const { return sal_Bool( GetType() == SbxBOOL ); }
+ sal_Bool IsErr() const { return sal_Bool( GetType() == SbxERROR ); }
+ sal_Bool IsEmpty() const { return sal_Bool( GetType() == SbxEMPTY ); }
+ sal_Bool IsNull() const { return sal_Bool( GetType() == SbxNULL ); }
+ sal_Bool IsChar() const { return sal_Bool( GetType() == SbxCHAR ); }
+ sal_Bool IsByte() const { return sal_Bool( GetType() == SbxBYTE ); }
+ sal_Bool IsUShort() const { return sal_Bool( GetType() == SbxUSHORT ); }
+ sal_Bool IsULong() const { return sal_Bool( GetType() == SbxULONG ); }
+ sal_Bool IsInt() const { return sal_Bool( GetType() == SbxINT ); }
+ sal_Bool IsUInt() const { return sal_Bool( GetType() == SbxUINT ); }
+ sal_Bool IspChar() const { return sal_Bool( GetType() == SbxLPSTR ); }
+ sal_Bool IsNumeric() const;
+ sal_Bool IsNumericRTL() const; // #41692 Interface for Basic
+ sal_Bool ImpIsNumeric( bool bOnlyIntntl ) const; // Implementation
+
+ virtual SbxClassType GetClass() const;
+ virtual SbxDataType GetType() const;
+ SbxDataType GetFullType() const;
+ sal_Bool SetType( SbxDataType );
+
+ virtual sal_Bool Get( SbxValues& ) const;
+ const SbxValues& GetValues_Impl() const { return aData; }
+ virtual sal_Bool Put( const SbxValues& );
+
+ inline SbxValues * data() { return &aData; }
+
+ sal_Unicode GetChar() const;
+ sal_Int16 GetInteger() const;
+ sal_Int32 GetLong() const;
+ sal_Int64 GetInt64() const;
+ sal_uInt64 GetUInt64() const;
+
+ sal_Int64 GetCurrency() const;
+ SbxDecimal* GetDecimal() const;
+
+ float GetSingle() const;
+ double GetDouble() const;
+ double GetDate() const;
+
+ sal_Bool GetBool() const;
+ const OUString& GetCoreString() const;
+ OUString GetOUString() const;
+
+ SbxBase* GetObject() const;
+ sal_uInt8 GetByte() const;
+ sal_uInt16 GetUShort() const;
+ sal_uInt32 GetULong() const;
+
+ sal_Bool PutInteger( sal_Int16 );
+ sal_Bool PutLong( sal_Int32 );
+ sal_Bool PutSingle( float );
+ sal_Bool PutDouble( double );
+ sal_Bool PutDate( double );
+ sal_Bool PutBool( sal_Bool );
+ sal_Bool PutErr( sal_uInt16 );
+ sal_Bool PutStringExt( const OUString& ); // with extended analysis (International, "sal_True"/"sal_False")
+ sal_Bool PutInt64( sal_Int64 );
+ sal_Bool PutUInt64( sal_uInt64 );
+ sal_Bool PutString( const OUString& );
+ sal_Bool PutChar( sal_Unicode );
+ sal_Bool PutByte( sal_uInt8 );
+ sal_Bool PutUShort( sal_uInt16 );
+ sal_Bool PutULong( sal_uInt32 );
+ sal_Bool PutEmpty();
+ sal_Bool PutNull();
+
+ // Special methods
+ sal_Bool PutDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec );
+ sal_Bool PutDecimal( SbxDecimal* pDecimal ); // This function is needed for Windows build, don't remove
+ sal_Bool fillAutomationDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec );
+ sal_Bool PutCurrency( const sal_Int64& );
+ // Interface for CDbl in Basic
+ static SbxError ScanNumIntnl( const OUString& rSrc, double& nVal, bool bSingle = false );
+
+ sal_Bool PutObject( SbxBase* );
+
+ virtual sal_Bool Convert( SbxDataType );
+ virtual sal_Bool Compute( SbxOperator, const SbxValue& );
+ virtual sal_Bool Compare( SbxOperator, const SbxValue& ) const;
+ sal_Bool Scan( const OUString&, sal_uInt16* = NULL );
+ void Format( OUString&, const OUString* = NULL ) const;
+
+ // The following operators are definied for easier handling.
+ // TODO: Ensure error conditions (overflow, conversions)
+ // are taken into consideration in Compute and Compare
+
+ inline int operator ==( const SbxValue& ) const;
+ inline int operator !=( const SbxValue& ) const;
+ inline int operator <( const SbxValue& ) const;
+ inline int operator >( const SbxValue& ) const;
+ inline int operator <=( const SbxValue& ) const;
+ inline int operator >=( const SbxValue& ) const;
+
+ inline SbxValue& operator *=( const SbxValue& );
+ inline SbxValue& operator /=( const SbxValue& );
+ inline SbxValue& operator %=( const SbxValue& );
+ inline SbxValue& operator +=( const SbxValue& );
+ inline SbxValue& operator -=( const SbxValue& );
+ inline SbxValue& operator &=( const SbxValue& );
+ inline SbxValue& operator |=( const SbxValue& );
+ inline SbxValue& operator ^=( const SbxValue& );
+};
+
+inline int SbxValue::operator==( const SbxValue& r ) const
+{ return Compare( SbxEQ, r ); }
+
+inline int SbxValue::operator!=( const SbxValue& r ) const
+{ return Compare( SbxNE, r ); }
+
+inline int SbxValue::operator<( const SbxValue& r ) const
+{ return Compare( SbxLT, r ); }
+
+inline int SbxValue::operator>( const SbxValue& r ) const
+{ return Compare( SbxGT, r ); }
+
+inline int SbxValue::operator<=( const SbxValue& r ) const
+{ return Compare( SbxLE, r ); }
+
+inline int SbxValue::operator>=( const SbxValue& r ) const
+{ return Compare( SbxGE, r ); }
+
+inline SbxValue& SbxValue::operator*=( const SbxValue& r )
+{ Compute( SbxMUL, r ); return *this; }
+
+inline SbxValue& SbxValue::operator/=( const SbxValue& r )
+{ Compute( SbxDIV, r ); return *this; }
+
+inline SbxValue& SbxValue::operator%=( const SbxValue& r )
+{ Compute( SbxMOD, r ); return *this; }
+
+inline SbxValue& SbxValue::operator+=( const SbxValue& r )
+{ Compute( SbxPLUS, r ); return *this; }
+
+inline SbxValue& SbxValue::operator-=( const SbxValue& r )
+{ Compute( SbxMINUS, r ); return *this; }
+
+inline SbxValue& SbxValue::operator&=( const SbxValue& r )
+{ Compute( SbxAND, r ); return *this; }
+
+inline SbxValue& SbxValue::operator|=( const SbxValue& r )
+{ Compute( SbxOR, r ); return *this; }
+
+inline SbxValue& SbxValue::operator^=( const SbxValue& r )
+{ Compute( SbxXOR, r ); return *this; }
+
+class SbxArray;
+class SbxInfo;
+
+#ifndef SBX_ARRAY_DECL_DEFINED
+#define SBX_ARRAY_DECL_DEFINED
+SV_DECL_REF(SbxArray)
+#endif
+
+#ifndef SBX_INFO_DECL_DEFINED
+#define SBX_INFO_DECL_DEFINED
+SV_DECL_REF(SbxInfo)
+#endif
+
+class SfxBroadcaster;
+
+class SbxVariableImpl;
+class StarBASIC;
+
+class BASIC_DLLPUBLIC SbxVariable : public SbxValue
+{
+ friend class SbMethod;
+
+ SbxVariableImpl* mpSbxVariableImpl; // Impl data
+ SfxBroadcaster* pCst; // Broadcaster, if needed
+ OUString maName; // Name, if available
+ SbxArrayRef mpPar; // Parameter-Array, if set
+ sal_uInt16 nHash; // Hash-ID for search
+
+ BASIC_DLLPRIVATE SbxVariableImpl* getImpl( void );
+
+protected:
+ SbxInfoRef pInfo; // Probably called information
+ sal_uIntPtr nUserData; // User data for Call()
+ SbxObject* pParent; // Currently attached object
+ virtual ~SbxVariable();
+ virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
+ virtual sal_Bool StoreData( SvStream& ) const;
+public:
+ SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_VARIABLE,2);
+ TYPEINFO();
+ SbxVariable();
+ SbxVariable( SbxDataType, void* = NULL );
+ SbxVariable( const SbxVariable& );
+ SbxVariable& operator=( const SbxVariable& );
+
+ void Dump( SvStream&, sal_Bool bDumpAll=sal_False );
+
+ virtual void SetName( const OUString& );
+ virtual const OUString& GetName( SbxNameType = SbxNAME_NONE ) const;
+ sal_uInt16 GetHashCode() const { return nHash; }
+
+ virtual void SetModified( sal_Bool );
+
+ sal_uIntPtr GetUserData() const { return nUserData; }
+ void SetUserData( sal_uIntPtr n ) { nUserData = n; }
+
+ virtual SbxDataType GetType() const;
+ virtual SbxClassType GetClass() const;
+
+ // Parameter-Interface
+ virtual SbxInfo* GetInfo();
+ void SetInfo( SbxInfo* p );
+ void SetParameters( SbxArray* p );
+ SbxArray* GetParameters() const;
+
+ // Sfx-Broadcasting-Support:
+ // Due to data reduction and better DLL-hierarchie currently via casting
+ SfxBroadcaster& GetBroadcaster();
+ sal_Bool IsBroadcaster() const { return sal_Bool( pCst != NULL ); }
+ virtual void Broadcast( sal_uIntPtr nHintId );
+
+ inline const SbxObject* GetParent() const { return pParent; }
+ SbxObject* GetParent();
+ virtual void SetParent( SbxObject* );
+
+ const OUString& GetDeclareClassName( void );
+ void SetDeclareClassName( const OUString& );
+ void SetComListener( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xComListener,
+ StarBASIC* pParentBasic );
+ void ClearComListener( void );
+
+ static sal_uInt16 MakeHashCode( const OUString& rName );
+};
+
+SV_DECL_REF(SbxVariable)
+
+#endif // SBXVAR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/vbahelper.hxx b/include/basic/vbahelper.hxx
new file mode 100644
index 000000000000..c18b67b63cd1
--- /dev/null
+++ b/include/basic/vbahelper.hxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef BASIC_VBAHELPR_HXX
+#define BASIC_VBAHELPR_HXX
+
+#include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <rtl/ustring.hxx>
+#include "basicdllapi.h"
+
+namespace basic {
+namespace vba {
+
+/* This header contains public helper functions for VBA used from this module
+ and from other VBA implementation modules such as vbahelper.
+ */
+
+// ============================================================================
+
+/** Locks or unlocks the controllers of all documents that have the same type
+ as the specified document.
+
+ First, the global module manager (com.sun.star.frame.ModuleManager) is
+ asked for the type of the passed model, and all open documents with the
+ same type will be locked or unlocked.
+
+ @param rxModel
+ A document model determining the type of the documents to be locked or
+ unlocked.
+
+ @param bLockControllers
+ Passing true will lock all controllers, passing false will unlock them.
+ */
+BASIC_DLLPUBLIC void lockControllersOfAllDocuments(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel,
+ sal_Bool bLockControllers );
+
+// ============================================================================
+
+/** Enables or disables the container windows of all controllers of all
+ documents that have the same type as the specified document.
+
+ First, the global module manager (com.sun.star.frame.ModuleManager) is
+ asked for the type of the passed model, and the container windows of all
+ open documents with the same type will be enabled or disabled.
+
+ @param rxModel
+ A document model determining the type of the documents to be enabled or
+ disabled.
+
+ @param bEnableWindows
+ Passing true will enable all container windows of all controllers,
+ passing false will disable them.
+ */
+BASIC_DLLPUBLIC void enableContainerWindowsOfAllDocuments(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel,
+ sal_Bool bEnableWindows );
+
+// ============================================================================
+
+/** Registers the passed path as working directory for the application the
+ passed document belongs to.
+
+ @param rxModel
+ A document model determining the type of the application whose working
+ directory has been changed.
+
+ @param rPath
+ The new working directory.
+ */
+BASIC_DLLPUBLIC void registerCurrentDirectory(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel,
+ const OUString& rPath );
+
+// ============================================================================
+
+} // namespace vba
+} // namespace basic
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/base/bitmapcanvasbase.hxx b/include/canvas/base/bitmapcanvasbase.hxx
new file mode 100644
index 000000000000..5c1376b0632b
--- /dev/null
+++ b/include/canvas/base/bitmapcanvasbase.hxx
@@ -0,0 +1,128 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_BITMAPCANVASBASE_HXX
+#define INCLUDED_CANVAS_BITMAPCANVASBASE_HXX
+
+#include <canvas/base/canvasbase.hxx>
+#include <com/sun/star/rendering/XBitmapCanvas.hpp>
+
+namespace canvas
+{
+ /** Helper template to handle XBitmapCanvas method forwarding to
+ BitmapCanvasHelper
+
+ Use this helper to handle the XBitmapCanvas part of your
+ implementation.
+
+ @tpl Base
+ Base class to use, most probably one of the
+ WeakComponentImplHelperN templates with the appropriate
+ interfaces. At least XBitmapCanvas should be among them (why
+ else would you use this template, then?). Base class must have
+ an Base( const Mutex& ) constructor (like the
+ WeakComponentImplHelperN templates have).
+
+ @tpl CanvasHelper
+ Canvas helper implementation for the backend in question
+
+ @tpl Mutex
+ Lock strategy to use. Defaults to using the
+ OBaseMutex-provided lock. Everytime one of the methods is
+ entered, an object of type Mutex is created with m_aMutex as
+ the sole parameter, and destroyed again when the method scope
+ is left.
+
+ @tpl UnambiguousBase
+ Optional unambiguous base class for XInterface of Base. It's
+ sometimes necessary to specify this parameter, e.g. if Base
+ derives from multiple UNO interface (were each provides its
+ own version of XInterface, making the conversion ambiguous)
+
+ @see CanvasBase for further contractual requirements towards
+ the CanvasHelper type, and some examples.
+ */
+ template< class Base,
+ class CanvasHelper,
+ class Mutex=::osl::MutexGuard,
+ class UnambiguousBase=::com::sun::star::uno::XInterface > class BitmapCanvasBase :
+ public CanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase >
+ {
+ public:
+ typedef CanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase > BaseType;
+
+ // XBitmapCanvas
+ virtual void SAL_CALL copyRect( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas >& sourceCanvas,
+ const ::com::sun::star::geometry::RealRectangle2D& sourceRect,
+ const ::com::sun::star::rendering::ViewState& sourceViewState,
+ const ::com::sun::star::rendering::RenderState& sourceRenderState,
+ const ::com::sun::star::geometry::RealRectangle2D& destRect,
+ const ::com::sun::star::rendering::ViewState& destViewState,
+ const ::com::sun::star::rendering::RenderState& destRenderState ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(sourceCanvas, sourceRect, sourceViewState, sourceRenderState,
+ destRect, destViewState, destRenderState,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< typename BaseType::UnambiguousBaseType* >(this));
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ BaseType::mbSurfaceDirty = true;
+ BaseType::maCanvasHelper.modifying();
+
+ BaseType::maCanvasHelper.copyRect( this,
+ sourceCanvas,
+ sourceRect,
+ sourceViewState,
+ sourceRenderState,
+ destRect,
+ destViewState,
+ destRenderState );
+ }
+
+ // XBitmap
+ virtual ::com::sun::star::geometry::IntegerSize2D SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::maCanvasHelper.getSize();
+ }
+
+ virtual ::sal_Bool SAL_CALL hasAlpha( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::maCanvasHelper.hasAlpha();
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > SAL_CALL getScaledBitmap( const ::com::sun::star::geometry::RealSize2D& newSize,
+ sal_Bool beFast ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::maCanvasHelper.getScaledBitmap( newSize, beFast );
+ }
+
+ };
+}
+
+#endif /* INCLUDED_CANVAS_BITMAPCANVASBASE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/base/bufferedgraphicdevicebase.hxx b/include/canvas/base/bufferedgraphicdevicebase.hxx
new file mode 100644
index 000000000000..2713e0ea11bb
--- /dev/null
+++ b/include/canvas/base/bufferedgraphicdevicebase.hxx
@@ -0,0 +1,276 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_BUFFEREDGRAPHICDEVICEBASE_HXX
+#define INCLUDED_CANVAS_BUFFEREDGRAPHICDEVICEBASE_HXX
+
+#include <com/sun/star/awt/XWindow2.hpp>
+#include <com/sun/star/awt/XTopWindow.hpp>
+#include <com/sun/star/awt/XWindowListener.hpp>
+
+#include <canvas/canvastools.hxx>
+#include <canvas/base/graphicdevicebase.hxx>
+
+
+/* Definition of BufferedGraphicDeviceBase class */
+
+namespace canvas
+{
+ /** Helper template base class for XGraphicDevice implementations
+ on windows.
+
+ Use this base class if your target device is a
+ window. Additionally to GraphicDeviceBase, this template
+ provides an implementation of the awt::XWindowListener
+ interface, to receive notifications about state changes of the
+ associated window.
+
+ @tpl Base
+ Base class to use, most probably one of the
+ WeakComponentImplHelperN templates with the appropriate
+ interfaces. At least XGraphicDevice should be among them (why else
+ would you use this template, then?). Base class must have an
+ Base( const Mutex& ) constructor (like the
+ WeakComponentImplHelperN templates have). As the very least,
+ the base class must be derived from uno::XInterface, as some
+ error reporting mechanisms rely on that.
+
+ @tpl DeviceHelper
+ Device helper implementation for the backend in question. This
+ object will be held as a member of this template class, and
+ basically gets forwarded all XGraphicDevice API calls that
+ could not be handled generically.
+
+ @tpl Mutex
+ Lock strategy to use. Defaults to using the
+ OBaseMutex-provided lock. Everytime one of the methods is
+ entered, an object of type Mutex is created with m_aMutex as
+ the sole parameter, and destroyed again when the method scope
+ is left.
+
+ @tpl UnambiguousBase
+ Optional unambiguous base class for XInterface of Base. It's
+ sometimes necessary to specify this parameter, e.g. if Base
+ derives from multiple UNO interface (were each provides its
+ own version of XInterface, making the conversion ambiguous)
+ */
+ template< class Base,
+ class DeviceHelper,
+ class Mutex=::osl::MutexGuard,
+ class UnambiguousBase=::com::sun::star::uno::XInterface > class BufferedGraphicDeviceBase :
+ public GraphicDeviceBase< Base, DeviceHelper, Mutex, UnambiguousBase >
+ {
+ public:
+ typedef GraphicDeviceBase< Base, DeviceHelper, Mutex, UnambiguousBase > BaseType;
+ typedef BufferedGraphicDeviceBase OurType;
+ typedef Mutex MutexType;
+
+ BufferedGraphicDeviceBase() :
+ mxWindow(),
+ maBounds(),
+ mbIsVisible( false ),
+ mbIsTopLevel( false )
+ {
+ BaseType::maPropHelper.addProperties( PropertySetHelper::MakeMap
+ ("Window",
+ boost::bind(&OurType::getXWindow,
+ this)));
+ }
+
+ // XGraphicDevice
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBufferController > SAL_CALL getBufferController( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ return this;
+ }
+
+ // XBufferController
+ virtual ::sal_Int32 SAL_CALL createBuffers( ::sal_Int32 nBuffers ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyRange( nBuffers, (sal_Int32)1 );
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::maDeviceHelper.createBuffers( nBuffers );
+ }
+
+ virtual void SAL_CALL destroyBuffers( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ BaseType::maDeviceHelper.destroyBuffers();
+ }
+
+ virtual ::sal_Bool SAL_CALL showBuffer( ::sal_Bool bUpdateAll ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::maDeviceHelper.showBuffer( mbIsVisible, bUpdateAll );
+ }
+
+ virtual ::sal_Bool SAL_CALL switchBuffer( ::sal_Bool bUpdateAll ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::maDeviceHelper.switchBuffer( mbIsVisible, bUpdateAll );
+ }
+
+
+ /** Set corresponding canvas window
+
+ Use this method to set the window this canvas displays
+ on. Comes in handy when the canvas needs to adapt size or
+ output position to the changing window.
+
+ Whenever the bounds of the window change, <code>void
+ notifySizeUpdate( const awt::Rectangle& rBounds )</code>
+ is called, with rBounds the window bound rect relative to
+ the frame window.
+ */
+ void setWindow( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XWindow2 >& rWindow )
+ {
+ if( mxWindow.is() )
+ mxWindow->removeWindowListener( this );
+
+ mxWindow = rWindow;
+
+ if( mxWindow.is() )
+ {
+ mbIsVisible = mxWindow->isVisible();
+ mbIsTopLevel =
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindow >(
+ mxWindow,
+ ::com::sun::star::uno::UNO_QUERY ).is();
+
+ maBounds = transformBounds( mxWindow->getPosSize() );
+ mxWindow->addWindowListener( this );
+ }
+ }
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow2 > getWindow() const
+ {
+ return mxWindow;
+ }
+
+ ::com::sun::star::uno::Any getXWindow() const
+ {
+ return ::com::sun::star::uno::makeAny(mxWindow);
+ }
+
+ virtual void disposeThis()
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ if( mxWindow.is() )
+ {
+ mxWindow->removeWindowListener(this);
+ mxWindow.clear();
+ }
+
+ // pass on to base class
+ BaseType::disposeThis();
+ }
+
+ ::com::sun::star::awt::Rectangle transformBounds( const ::com::sun::star::awt::Rectangle& rBounds )
+ {
+ // notifySizeUpdate's bounds are relative to the toplevel
+ // window
+ if( !mbIsTopLevel )
+ return tools::getAbsoluteWindowRect(
+ rBounds,
+ mxWindow );
+ else
+ return ::com::sun::star::awt::Rectangle( 0,0,rBounds.Width,rBounds.Height );
+ }
+
+ void boundsChanged( const ::com::sun::star::awt::WindowEvent& e )
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ const ::com::sun::star::awt::Rectangle& rNewBounds(
+ transformBounds(
+ ::com::sun::star::awt::Rectangle( e.X,
+ e.Y,
+ e.Width,
+ e.Height )));
+
+ if( rNewBounds.X != maBounds.X ||
+ rNewBounds.Y != maBounds.Y ||
+ rNewBounds.Width != maBounds.Width ||
+ rNewBounds.Height != maBounds.Height )
+ {
+ maBounds = rNewBounds;
+ BaseType::maDeviceHelper.notifySizeUpdate( maBounds );
+ }
+ }
+
+ // XWindowListener
+ virtual void disposeEventSource( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ if( Source.Source == mxWindow )
+ mxWindow.clear();
+
+ BaseType::disposeEventSource(Source);
+ }
+
+ virtual void SAL_CALL windowResized( const ::com::sun::star::awt::WindowEvent& e ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ boundsChanged( e );
+ }
+
+ virtual void SAL_CALL windowMoved( const ::com::sun::star::awt::WindowEvent& e ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ boundsChanged( e );
+ }
+
+ virtual void SAL_CALL windowShown( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ mbIsVisible = true;
+ }
+
+ virtual void SAL_CALL windowHidden( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ mbIsVisible = false;
+ }
+
+ protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow2 > mxWindow;
+
+ /// Current bounds of the owning Window
+ ::com::sun::star::awt::Rectangle maBounds;
+
+ /// True, if the window this canvas is contained in, is visible
+ bool mbIsVisible;
+
+ private:
+ /// True, if the window this canvas is contained in, is a toplevel window
+ bool mbIsTopLevel;
+ };
+}
+
+#endif /* INCLUDED_CANVAS_BUFFEREDGRAPHICDEVICEBASE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/base/cachedprimitivebase.hxx b/include/canvas/base/cachedprimitivebase.hxx
new file mode 100644
index 000000000000..8c7e1579f1e2
--- /dev/null
+++ b/include/canvas/base/cachedprimitivebase.hxx
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_CACHEDPRIMITIVEBASE_HXX
+#define INCLUDED_CANVAS_CACHEDPRIMITIVEBASE_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/rendering/XCanvas.hpp>
+#include <com/sun/star/rendering/XCachedPrimitive.hpp>
+#include <com/sun/star/rendering/ViewState.hpp>
+#include <cppuhelper/compbase2.hxx>
+#include <comphelper/broadcasthelper.hxx>
+
+#include <canvas/canvastoolsdllapi.h>
+
+/* Definition of CachedPrimitiveBase class */
+
+namespace canvas
+{
+ typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::rendering::XCachedPrimitive,
+ ::com::sun::star::lang::XServiceInfo > CachedPrimitiveBase_Base;
+
+ /** Base class, providing common functionality for implementers of
+ the XCachedPrimitive interface.
+ */
+ class CANVASTOOLS_DLLPUBLIC CachedPrimitiveBase : public CachedPrimitiveBase_Base,
+ public ::comphelper::OBaseMutex
+ {
+ public:
+
+ /** Create an XCachedPrimitive for given target canvas
+
+ @param rUsedViewState
+ The viewstate the original object was rendered with
+
+ @param rTarget
+ The target canvas the repaint should happen on.
+
+ @param bFailForChangedViewTransform
+ When true, derived classes will never receive doRedraw()
+ calls with dissimilar view transformations and
+ bSameViewTransform set to false. This is useful for cached
+ objects where re-transforming the generated output is not
+ desirable, e.g. for hinted font output.
+ */
+ CachedPrimitiveBase( const ::com::sun::star::rendering::ViewState& rUsedViewState,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XCanvas >& rTarget,
+ bool bFailForChangedViewTransform );
+
+ /// Dispose all internal references
+ virtual void SAL_CALL disposing();
+
+ // XCachedPrimitive
+ virtual ::sal_Int8 SAL_CALL redraw( const ::com::sun::star::rendering::ViewState& aState ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
+
+ protected:
+ ~CachedPrimitiveBase(); // we're a ref-counted UNO class. _We_ destroy ourselves.
+
+ private:
+ CachedPrimitiveBase( const CachedPrimitiveBase& );
+ CachedPrimitiveBase& operator=( const CachedPrimitiveBase& );
+
+ /** Actually perform the requested redraw.
+
+ Clients must override this method, instead of the public
+ redraw() one.
+
+ @param rNewState
+ The viewstate to redraw with
+
+ @param rOldState
+ The viewstate this cache object was created with.
+
+ @param rTargetCanvas
+ Target canvas to render to.
+
+ @param bSameViewTransform
+ When true, rNewState and rOldState have the same transformation.
+ */
+ virtual ::sal_Int8 doRedraw( const ::com::sun::star::rendering::ViewState& rNewState,
+ const ::com::sun::star::rendering::ViewState& rOldState,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XCanvas >& rTargetCanvas,
+ bool bSameViewTransform ) = 0;
+
+ ::com::sun::star::rendering::ViewState maUsedViewState;
+ ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvas > mxTarget;
+ const bool mbFailForChangedViewTransform;
+ };
+}
+
+#endif /* INCLUDED_CANVAS_CACHEDPRIMITIVEBASE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/base/canvasbase.hxx b/include/canvas/base/canvasbase.hxx
new file mode 100644
index 000000000000..f7844fd219de
--- /dev/null
+++ b/include/canvas/base/canvasbase.hxx
@@ -0,0 +1,474 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_CANVASBASE_HXX
+#define INCLUDED_CANVAS_CANVASBASE_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/rendering/XCanvas.hpp>
+#include <com/sun/star/rendering/TextDirection.hpp>
+#include <osl/mutex.hxx>
+#include <canvas/verifyinput.hxx>
+
+
+namespace canvas
+{
+ /** Helper template to handle XCanvas method forwarding to CanvasHelper
+
+ Use this helper to handle the XCanvas part of your
+ implementation. In theory, we could have provided CanvasHelper
+ and CanvasBase as a single template, but that would duplicate
+ a lot of code now residing in CanvasHelper only.
+
+ This template basically interposes itself between the full
+ interface you implement (i.e. not restricted to XCanvas. The
+ problem with UNO partial interface implementation actually is,
+ that you cannot do it the plain way, since deriving from a
+ common base subclass always introduces the whole set of pure
+ virtuals, that your baseclass helper just overrided) and your
+ implementation class. You then only have to implement the
+ functionality <em>besides</em> XCanvas.
+
+ <pre>
+ Example:
+ typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::rendering::XSpriteCanvas,
+ ::com::sun::star::lang::XInitialization,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::lang::XServiceName > CanvasBase_Base;
+ typedef ::canvas::internal::CanvasBase< CanvasBase_Base, CanvasHelper > ExampleCanvas_Base;
+
+ class ExampleCanvas : public ExampleCanvas_Base,
+ public SpriteSurface,
+ public RepaintTarget
+ {
+ };
+ </pre>
+
+ @tpl Base
+ Base class to use, most probably one of the
+ WeakComponentImplHelperN templates with the appropriate
+ interfaces. At least XCanvas should be among them (why else
+ would you use this template, then?). Base class must have an
+ Base( const Mutex& ) constructor (like the
+ WeakComponentImplHelperN templates have). As the very least,
+ the base class must be derived from uno::XInterface, as some
+ error reporting mechanisms rely on that.
+
+ @tpl CanvasHelper
+ Canvas helper implementation for the backend in question. This
+ object will be held as a member of this template class, and
+ basically gets forwarded all XCanvas API calls. Furthermore,
+ everytime the canvas API semantically changes the content of
+ the canvas, CanvasHelper::modifying() will get called
+ (<em>before</em> the actual modification takes place).
+
+ @tpl Mutex
+ Lock strategy to use. Defaults to using the
+ OBaseMutex-provided lock. Everytime one of the methods is
+ entered, an object of type Mutex is created with m_aMutex as
+ the sole parameter, and destroyed again when the method scope
+ is left.
+
+ @tpl UnambiguousBase
+ Optional unambiguous base class for XInterface of Base. It's
+ sometimes necessary to specify this parameter, e.g. if Base
+ derives from multiple UNO interface (were each provides its
+ own version of XInterface, making the conversion ambiguous)
+ */
+ template< class Base,
+ class CanvasHelper,
+ class Mutex=::osl::MutexGuard,
+ class UnambiguousBase=::com::sun::star::uno::XInterface > class CanvasBase :
+ public Base
+ {
+ public:
+ typedef Base BaseType;
+ typedef CanvasHelper HelperType;
+ typedef Mutex MutexType;
+ typedef UnambiguousBase UnambiguousBaseType;
+
+ /** Create CanvasBase
+ */
+ CanvasBase() :
+ maCanvasHelper(),
+ mbSurfaceDirty( true )
+ {
+ }
+
+ virtual void disposeThis()
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ maCanvasHelper.disposing();
+
+ // pass on to base class
+ BaseType::disposeThis();
+ }
+
+ // XCanvas
+ virtual void SAL_CALL clear() throw (::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+ maCanvasHelper.modifying();
+
+ maCanvasHelper.clear();
+ }
+
+ virtual void SAL_CALL drawPoint( const ::com::sun::star::geometry::RealPoint2D& aPoint,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(aPoint, viewState, renderState,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+ maCanvasHelper.modifying();
+
+ maCanvasHelper.drawPoint( this, aPoint, viewState, renderState );
+ }
+
+ virtual void SAL_CALL drawLine( const ::com::sun::star::geometry::RealPoint2D& aStartPoint,
+ const ::com::sun::star::geometry::RealPoint2D& aEndPoint,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(aStartPoint, aEndPoint, viewState, renderState,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+ maCanvasHelper.modifying();
+
+ maCanvasHelper.drawLine( this, aStartPoint, aEndPoint, viewState, renderState );
+ }
+
+ virtual void SAL_CALL drawBezier( const ::com::sun::star::geometry::RealBezierSegment2D& aBezierSegment,
+ const ::com::sun::star::geometry::RealPoint2D& aEndPoint,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(aBezierSegment, aEndPoint, viewState, renderState,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+ maCanvasHelper.modifying();
+
+ maCanvasHelper.drawBezier( this, aBezierSegment, aEndPoint, viewState, renderState );
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
+ drawPolyPolygon( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(xPolyPolygon, viewState, renderState,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+ maCanvasHelper.modifying();
+
+ return maCanvasHelper.drawPolyPolygon( this, xPolyPolygon, viewState, renderState );
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
+ strokePolyPolygon( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState,
+ const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(xPolyPolygon, viewState, renderState, strokeAttributes,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+ maCanvasHelper.modifying();
+
+ return maCanvasHelper.strokePolyPolygon( this, xPolyPolygon, viewState, renderState, strokeAttributes );
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
+ strokeTexturedPolyPolygon( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::Texture >& textures,
+ const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(xPolyPolygon, viewState, renderState, strokeAttributes,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+ maCanvasHelper.modifying();
+
+ return maCanvasHelper.strokeTexturedPolyPolygon( this, xPolyPolygon, viewState, renderState, textures, strokeAttributes );
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
+ strokeTextureMappedPolyPolygon( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::Texture >& textures,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::geometry::XMapping2D >& xMapping,
+ const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(xPolyPolygon, viewState, renderState, textures, xMapping, strokeAttributes,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+ maCanvasHelper.modifying();
+
+ return maCanvasHelper.strokeTextureMappedPolyPolygon( this, xPolyPolygon, viewState, renderState, textures, xMapping, strokeAttributes );
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D > SAL_CALL
+ queryStrokeShapes( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState,
+ const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(xPolyPolygon, viewState, renderState, strokeAttributes,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+ maCanvasHelper.modifying();
+
+ return maCanvasHelper.queryStrokeShapes( this, xPolyPolygon, viewState, renderState, strokeAttributes );
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
+ fillPolyPolygon( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(xPolyPolygon, viewState, renderState,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+ maCanvasHelper.modifying();
+
+ return maCanvasHelper.fillPolyPolygon( this, xPolyPolygon, viewState, renderState );
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
+ fillTexturedPolyPolygon( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::Texture >& textures ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(xPolyPolygon, viewState, renderState, textures,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+ maCanvasHelper.modifying();
+
+ return maCanvasHelper.fillTexturedPolyPolygon( this, xPolyPolygon, viewState, renderState, textures );
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
+ fillTextureMappedPolyPolygon( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::Texture >& textures,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::geometry::XMapping2D >& xMapping ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(xPolyPolygon, viewState, renderState, textures, xMapping,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+ maCanvasHelper.modifying();
+
+ return maCanvasHelper.fillTextureMappedPolyPolygon( this, xPolyPolygon, viewState, renderState, textures, xMapping );
+ }
+
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvasFont > SAL_CALL
+ createFont( const ::com::sun::star::rendering::FontRequest& fontRequest,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& extraFontProperties,
+ const ::com::sun::star::geometry::Matrix2D& fontMatrix ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(fontRequest,
+ // dummy, to keep argPos in sync
+ fontRequest,
+ fontMatrix,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maCanvasHelper.createFont( this, fontRequest, extraFontProperties, fontMatrix );
+ }
+
+
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::FontInfo > SAL_CALL
+ queryAvailableFonts( const ::com::sun::star::rendering::FontInfo& aFilter,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aFontProperties ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(aFilter,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maCanvasHelper.queryAvailableFonts( this, aFilter, aFontProperties );
+ }
+
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
+ drawText( const ::com::sun::star::rendering::StringContext& text,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvasFont >& xFont,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState,
+ sal_Int8 textDirection ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(xFont, viewState, renderState,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+ tools::verifyRange( textDirection,
+ ::com::sun::star::rendering::TextDirection::WEAK_LEFT_TO_RIGHT,
+ ::com::sun::star::rendering::TextDirection::STRONG_RIGHT_TO_LEFT );
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+ maCanvasHelper.modifying();
+
+ return maCanvasHelper.drawText( this, text, xFont, viewState, renderState, textDirection );
+ }
+
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
+ drawTextLayout( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XTextLayout >& layoutetText,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(layoutetText, viewState, renderState,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+ maCanvasHelper.modifying();
+
+ return maCanvasHelper.drawTextLayout( this, layoutetText, viewState, renderState );
+ }
+
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
+ drawBitmap( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap >& xBitmap,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(xBitmap, viewState, renderState,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+ maCanvasHelper.modifying();
+
+ return maCanvasHelper.drawBitmap( this, xBitmap, viewState, renderState );
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
+ drawBitmapModulated( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap >& xBitmap,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(xBitmap, viewState, renderState,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+ maCanvasHelper.modifying();
+
+ return maCanvasHelper.drawBitmapModulated( this, xBitmap, viewState, renderState );
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice > SAL_CALL
+ getDevice() throw (::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maCanvasHelper.getDevice();
+ }
+
+ protected:
+ ~CanvasBase() {} // we're a ref-counted UNO class. _We_ destroy ourselves.
+
+ HelperType maCanvasHelper;
+ mutable bool mbSurfaceDirty;
+
+ private:
+ CanvasBase( const CanvasBase& );
+ CanvasBase& operator=( const CanvasBase& );
+ };
+}
+
+#endif /* INCLUDED_CANVAS_CANVASBASE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/base/canvascustomspritebase.hxx b/include/canvas/base/canvascustomspritebase.hxx
new file mode 100644
index 000000000000..7c1b5508bb4e
--- /dev/null
+++ b/include/canvas/base/canvascustomspritebase.hxx
@@ -0,0 +1,271 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_CANVASCUSTOMSPRITEBASE_HXX
+#define INCLUDED_CANVAS_CANVASCUSTOMSPRITEBASE_HXX
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/rendering/XCustomSprite.hpp>
+#include <com/sun/star/rendering/XPolyPolygon2D.hpp>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <canvas/base/integerbitmapbase.hxx>
+#include <canvas/base/sprite.hxx>
+
+#include <boost/utility.hpp>
+
+
+namespace canvas
+{
+ /** Helper template to handle XCustomSprite method forwarding to
+ CanvasCustomSpriteHelper
+
+ Use this helper to handle the XCustomSprite part of your
+ implementation.
+
+ @tpl Base
+ Base class to use, most probably one of the
+ WeakComponentImplHelperN templates with the appropriate
+ interfaces. At least XCustomSprite and Sprite should be among
+ them (why else would you use this template, then?). Base class
+ must have an Base( const Mutex& ) constructor (like the
+ WeakComponentImplHelperN templates have).
+
+ @tpl SpriteHelper
+ Sprite helper implementation for the backend in question
+
+ @tpl CanvasHelper
+ Canvas helper implementation for the backend in question
+
+ @tpl Mutex
+ Lock strategy to use. Defaults to using the
+ OBaseMutex-provided lock. Everytime one of the methods is
+ entered, an object of type Mutex is created with m_aMutex as
+ the sole parameter, and destroyed again when the method scope
+ is left.
+
+ @tpl UnambiguousBase
+ Optional unambiguous base class for XInterface of Base. It's
+ sometimes necessary to specify this parameter, e.g. if Base
+ derives from multiple UNO interface (were each provides its
+ own version of XInterface, making the conversion ambiguous)
+
+ @see CanvasCustomSpriteHelper for further contractual
+ requirements towards the SpriteHelper type, and some examples.
+ */
+ template< class Base,
+ class SpriteHelper,
+ class CanvasHelper,
+ class Mutex=::osl::MutexGuard,
+ class UnambiguousBase=::com::sun::star::uno::XInterface > class CanvasCustomSpriteBase :
+ public IntegerBitmapBase< Base, CanvasHelper, Mutex, UnambiguousBase >
+ {
+ public:
+ typedef IntegerBitmapBase< Base, CanvasHelper, Mutex, UnambiguousBase > BaseType;
+ typedef SpriteHelper SpriteHelperType;
+
+ CanvasCustomSpriteBase() :
+ maSpriteHelper()
+ {
+ }
+
+ /** Object is being disposed.
+
+ Called from the cppu helper base, to notify disposal of
+ this object. Already releases all internal references.
+
+ @derive when overriding this method in derived classes,
+ <em>always</em> call the base class' method!
+ */
+ virtual void disposeThis()
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maSpriteHelper.disposing();
+
+ // pass on to base class
+ BaseType::disposeThis();
+ }
+
+ // XCanvas: selectively override base's methods here, for opacity tracking
+ virtual void SAL_CALL clear() throw (::com::sun::star::uno::RuntimeException)
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maSpriteHelper.clearingContent( this );
+
+ // and forward to base class, which handles the actual rendering
+ return BaseType::clear();
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
+ drawBitmap( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap >& xBitmap,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(xBitmap, viewState, renderState,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< typename BaseType::UnambiguousBaseType* >(this));
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maSpriteHelper.checkDrawBitmap( this, xBitmap, viewState, renderState );
+
+ // and forward to base class, which handles the actual rendering
+ return BaseType::drawBitmap( xBitmap,
+ viewState,
+ renderState );
+ }
+
+ // TODO(F3): If somebody uses the XIntegerBitmap methods to
+ // clear pixel (setting alpha != 1.0 there), or a compositing
+ // mode results in similar alpha, maSpriteHelper might
+ // errorneously report fully opaque sprites. Effectively, all
+ // render methods must be overridden here; or better,
+ // functionality provided at the baseclass.
+
+ // XSprite
+ virtual void SAL_CALL setAlpha( double alpha ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyRange( alpha, 0.0, 1.0 );
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maSpriteHelper.setAlpha( this, alpha );
+ }
+
+ virtual void SAL_CALL move( const ::com::sun::star::geometry::RealPoint2D& aNewPos,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(aNewPos, viewState, renderState,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< typename BaseType::UnambiguousBaseType* >(this));
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maSpriteHelper.move( this, aNewPos, viewState, renderState );
+ }
+
+ virtual void SAL_CALL transform( const ::com::sun::star::geometry::AffineMatrix2D& aTransformation ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(aTransformation,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< typename BaseType::UnambiguousBaseType* >(this));
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maSpriteHelper.transform( this, aTransformation );
+ }
+
+ virtual void SAL_CALL clip( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& aClip ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ // NULL xClip explicitly allowed here (to clear clipping)
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maSpriteHelper.clip( this, aClip );
+ }
+
+ virtual void SAL_CALL setPriority( double nPriority ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maSpriteHelper.setPriority( this, nPriority );
+ }
+
+ virtual void SAL_CALL show() throw (::com::sun::star::uno::RuntimeException)
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maSpriteHelper.show( this );
+ }
+
+ virtual void SAL_CALL hide() throw (::com::sun::star::uno::RuntimeException)
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maSpriteHelper.hide( this );
+ }
+
+ // XCustomSprite
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvas > SAL_CALL
+ getContentCanvas() throw (::com::sun::star::uno::RuntimeException)
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return this;
+ }
+
+ // Sprite
+ virtual bool isAreaUpdateOpaque( const ::basegfx::B2DRange& rUpdateArea ) const
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return maSpriteHelper.isAreaUpdateOpaque( rUpdateArea );
+ }
+
+ virtual bool isContentChanged() const
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::mbSurfaceDirty;
+ }
+
+ virtual ::basegfx::B2DPoint getPosPixel() const
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return maSpriteHelper.getPosPixel();
+ }
+
+ virtual ::basegfx::B2DVector getSizePixel() const
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return maSpriteHelper.getSizePixel();
+ }
+
+ virtual ::basegfx::B2DRange getUpdateArea() const
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return maSpriteHelper.getUpdateArea();
+ }
+
+ virtual double getPriority() const
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return maSpriteHelper.getPriority();
+ }
+
+ protected:
+ SpriteHelperType maSpriteHelper;
+ };
+}
+
+#endif /* INCLUDED_CANVAS_CANVASCUSTOMSPRITEBASE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/base/canvascustomspritehelper.hxx b/include/canvas/base/canvascustomspritehelper.hxx
new file mode 100644
index 000000000000..2b2fd2d774d8
--- /dev/null
+++ b/include/canvas/base/canvascustomspritehelper.hxx
@@ -0,0 +1,287 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_CANVASCUSTOMSPRITEHELPER_HXX
+#define INCLUDED_CANVAS_CANVASCUSTOMSPRITEHELPER_HXX
+
+#include <com/sun/star/rendering/XCustomSprite.hpp>
+#include <com/sun/star/rendering/XPolyPolygon2D.hpp>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <canvas/base/spritesurface.hxx>
+#include <canvas/canvastoolsdllapi.h>
+
+namespace canvas
+{
+ /* Definition of CanvasCustomSpriteHelper class */
+
+ /** Base class for an XSprite helper implementation - to be used
+ in concert with CanvasCustomSpriteBase
+ */
+ class CANVASTOOLS_DLLPUBLIC CanvasCustomSpriteHelper
+ {
+ public:
+ CanvasCustomSpriteHelper();
+ virtual ~CanvasCustomSpriteHelper() {}
+
+ /** Init helper
+
+ @param rSpriteSize
+ Requested size of the sprite, as passed to the
+ XSpriteCanvas::createCustomSprite() method
+
+ @param rOwningSpriteCanvas
+ The XSpriteCanvas this sprite is displayed on
+ */
+ void init( const ::com::sun::star::geometry::RealSize2D& rSpriteSize,
+ const SpriteSurface::Reference& rOwningSpriteCanvas );
+
+ /** Object is being disposed, release all internal references
+
+ @derive when overriding this method in derived classes,
+ <em>always</em> call the base class' method!
+ */
+ void disposing();
+
+ // XCanvas
+ /// need to call this method for XCanvas::clear(), for opacity tracking
+ void clearingContent( const Sprite::Reference& rSprite );
+
+ /// need to call this method for XCanvas::drawBitmap(), for opacity tracking
+ void checkDrawBitmap( const Sprite::Reference& rSprite,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap >& xBitmap,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+
+ // XSprite
+ void setAlpha( const Sprite::Reference& rSprite,
+ double alpha );
+ void move( const Sprite::Reference& rSprite,
+ const ::com::sun::star::geometry::RealPoint2D& aNewPos,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+ void transform( const Sprite::Reference& rSprite,
+ const ::com::sun::star::geometry::AffineMatrix2D& aTransformation );
+ void clip( const Sprite::Reference& rSprite,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& aClip );
+ void setPriority( const Sprite::Reference& rSprite,
+ double nPriority );
+ void show( const Sprite::Reference& rSprite );
+ void hide( const Sprite::Reference& rSprite );
+
+ // Sprite
+ bool isAreaUpdateOpaque( const ::basegfx::B2DRange& rUpdateArea ) const;
+ ::basegfx::B2DPoint getPosPixel() const;
+ ::basegfx::B2DVector getSizePixel() const;
+ ::basegfx::B2DRange getUpdateArea() const;
+ double getPriority() const;
+
+ // redraw must be implemented by derived - non sensible default implementation
+ // void redraw( const Sprite::Reference& rSprite,
+ // const ::basegfx::B2DPoint& rPos ) const;
+
+
+ // Helper methods for derived classes
+ // ----------------------------------
+
+ /// Calc sprite update area from given raw sprite bounds
+ ::basegfx::B2DRange getUpdateArea( const ::basegfx::B2DRange& rUntransformedSpriteBounds ) const;
+
+ /// Calc update area for unclipped sprite content
+ ::basegfx::B2DRange getFullSpriteRect() const;
+
+ /** Returns true, if sprite content bitmap is fully opaque.
+
+ This does not take clipping or transformation into
+ account, but only denotes that the sprite bitmap's alpha
+ channel is all 1.0
+ */
+ bool isContentFullyOpaque() const { return mbIsContentFullyOpaque; }
+
+ /// Returns true, if transformation has changed since last transformUpdated() call
+ bool hasAlphaChanged() const { return mbAlphaDirty; }
+
+ /// Returns true, if transformation has changed since last transformUpdated() call
+ bool hasPositionChanged() const { return mbPositionDirty; }
+
+ /// Returns true, if transformation has changed since last transformUpdated() call
+ bool hasTransformChanged() const { return mbTransformDirty; }
+
+ /// Returns true, if transformation has changed since last transformUpdated() call
+ bool hasClipChanged() const { return mbClipDirty; }
+
+ /// Returns true, if transformation has changed since last transformUpdated() call
+ bool hasPrioChanged() const { return mbPrioDirty; }
+
+ /// Returns true, if transformation has changed since last transformUpdated() call
+ bool hasVisibilityChanged() const { return mbVisibilityDirty; }
+
+ /// Retrieve current alpha value
+ double getAlpha() const { return mfAlpha; }
+
+ /// Retrieve current clip
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XPolyPolygon2D >& getClip() const { return mxClipPoly; }
+
+ const ::basegfx::B2DHomMatrix& getTransformation() const { return maTransform; }
+
+ /// Retrieve current activation state
+ bool isActive() const { return mbActive; }
+
+ protected:
+ /** Notifies that caller is again in sync with current alph
+
+ const, but modifies state visible to derived
+ classes. beware of passing this information to the
+ outside!
+ */
+ void alphaUpdated() const { mbAlphaDirty=false; }
+
+ /** Notifies that caller is again in sync with current position
+
+ const, but modifies state visible to derived
+ classes. beware of passing this information to the
+ outside!
+ */
+ void positionUpdated() const { mbPositionDirty=false; }
+
+ /** Notifies that caller is again in sync with current transformation
+
+ const, but modifies state visible to derived
+ classes. beware of passing this information to the
+ outside!
+ */
+ void transformUpdated() const { mbTransformDirty=false; }
+
+ /** Notifies that caller is again in sync with current clip
+
+ const, but modifies state visible to derived
+ classes. beware of passing this information to the
+ outside!
+ */
+ void clipUpdated() const { mbClipDirty=false; }
+
+ /** Notifies that caller is again in sync with current priority
+
+ const, but modifies state visible to derived
+ classes. beware of passing this information to the
+ outside!
+ */
+ void prioUpdated() const { mbPrioDirty=false; }
+
+ /** Notifies that caller is again in sync with current visibility
+
+ const, but modifies state visible to derived
+ classes. beware of passing this information to the
+ outside!
+ */
+ void visibilityUpdated() const { mbVisibilityDirty=false; }
+
+ private:
+ CanvasCustomSpriteHelper( const CanvasCustomSpriteHelper& );
+ CanvasCustomSpriteHelper& operator=( const CanvasCustomSpriteHelper& );
+
+ /** Called to convert an API polygon to a basegfx polygon
+
+ @derive Needs to be provided by backend-specific code
+ */
+ virtual ::basegfx::B2DPolyPolygon polyPolygonFromXPolyPolygon2D(
+ ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPoly ) const = 0;
+
+ /** Update clip information from current state
+
+ This method recomputes the maCurrClipBounds and
+ mbIsCurrClipRectangle members from the current clip and
+ transformation. IFF the clip changed from rectangular to
+ rectangular again, this method issues a sequence of
+ optimized SpriteSurface::updateSprite() calls.
+
+ @return true, if SpriteSurface::updateSprite() was already
+ called within this method.
+ */
+ bool updateClipState( const Sprite::Reference& rSprite );
+
+ // --------------------------------------------------------------------
+
+ /// Owning sprite canvas
+ SpriteSurface::Reference mpSpriteCanvas;
+
+ /** Currently active clip area.
+
+ This member is either empty, denoting that the current
+ clip shows the full sprite content, or contains a
+ rectangular subarea of the sprite, outside of which
+ the sprite content is fully clipped.
+
+ @see mbIsCurrClipRectangle
+ */
+ ::basegfx::B2DRange maCurrClipBounds;
+
+ // sprite state
+ ::basegfx::B2DPoint maPosition;
+ ::basegfx::B2DVector maSize;
+ ::basegfx::B2DHomMatrix maTransform;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XPolyPolygon2D > mxClipPoly;
+ double mfPriority;
+ double mfAlpha;
+ bool mbActive; // true, if not hidden
+
+ /** If true, denotes that the current sprite clip is a true
+ rectangle, i.e. maCurrClipBounds <em>exactly</em>
+ describes the visible area of the sprite.
+
+ @see maCurrClipBounds
+ */
+ bool mbIsCurrClipRectangle;
+
+ /** Redraw speedup.
+
+ When true, this flag denotes that the current sprite
+ content is fully opaque, thus, that blits to the screen do
+ neither have to take alpha into account, nor prepare any
+ background for the sprite area.
+ */
+ mutable bool mbIsContentFullyOpaque;
+
+ /// True, iff mfAlpha has changed
+ mutable bool mbAlphaDirty;
+
+ /// True, iff maPosition has changed
+ mutable bool mbPositionDirty;
+
+ /// True, iff maTransform has changed
+ mutable bool mbTransformDirty;
+
+ /// True, iff mxClipPoly has changed
+ mutable bool mbClipDirty;
+
+ /// True, iff mnPriority has changed
+ mutable bool mbPrioDirty;
+
+ /// True, iff mbActive has changed
+ mutable bool mbVisibilityDirty;
+ };
+}
+
+#endif /* INCLUDED_CANVAS_CANVASCUSTOMSPRITEHELPER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/base/disambiguationhelper.hxx b/include/canvas/base/disambiguationhelper.hxx
new file mode 100644
index 000000000000..f12a61472cd4
--- /dev/null
+++ b/include/canvas/base/disambiguationhelper.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_DISAMBIGUATIONHELPER_HXX
+#define INCLUDED_CANVAS_DISAMBIGUATIONHELPER_HXX
+
+#include <osl/mutex.hxx>
+
+
+/* Definition of the DisambiguationHelper class */
+
+namespace canvas
+{
+ /** Base class, initializing its own baseclass with m_aMutex.
+
+ This is necessary to make the CanvasBase, GraphicDeviceBase,
+ etc. classes freely combinable - letting them perform this
+ initialization would prohibit deriving e.g. CanvasBase from
+ GraphicDeviceBase.
+
+ On top of that, disambiguates XEventListener::disposing and
+ WeakComponentImplHelper::disposing.
+
+ Having two virtual methods with the same name, and not
+ overriding them in every derived class, will hide one of
+ them. Later trying to override the same method, will generate
+ a new vtable slot, and lead to very hard to spot errors.
+ */
+ template< class Base > class DisambiguationHelper : public Base
+ {
+ public:
+ typedef Base BaseType;
+
+ /** Construct DisambiguationHelper
+
+ This method is the whole purpose of this template:
+ initializing a base class with the provided m_aMutex
+ member (the WeakComponentImplHelper templates need that,
+ as they require the lifetime of the mutex to extend
+ theirs).
+ */
+ DisambiguationHelper() :
+ BaseType( m_aMutex )
+ {
+ }
+
+ virtual void SAL_CALL disposing()
+ { disposeThis(); }
+
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException)
+ { disposeEventSource(Source); }
+
+ virtual void disposeThis()
+ {}
+ virtual void disposeEventSource( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException)
+ {}
+
+protected:
+ mutable ::osl::Mutex m_aMutex;
+ };
+}
+
+#endif /* INCLUDED_CANVAS_DISAMBIGUATIONHELPER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/base/graphicdevicebase.hxx b/include/canvas/base/graphicdevicebase.hxx
new file mode 100644
index 000000000000..5c3372e3f76a
--- /dev/null
+++ b/include/canvas/base/graphicdevicebase.hxx
@@ -0,0 +1,382 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_GRAPHICDEVICEBASE_HXX
+#define INCLUDED_CANVAS_GRAPHICDEVICEBASE_HXX
+
+#include <rtl/ref.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/util/XUpdatable.hpp>
+#include <com/sun/star/rendering/XGraphicDevice.hpp>
+#include <com/sun/star/rendering/XColorSpace.hpp>
+
+#include <canvas/parametricpolypolygon.hxx>
+#include <canvas/propertysethelper.hxx>
+
+
+/* Definition of GraphicDeviceBase class */
+
+namespace canvas
+{
+ /** Helper template base class for XGraphicDevice implementations.
+
+ This base class provides partial implementations of the
+ XGraphicDevice-related interface, such as XColorSpace.
+
+ This template basically interposes itself between the full
+ interface you implement (i.e. not restricted to XGraphicDevice
+ etc.). The problem with UNO partial interface implementation
+ actually is, that you cannot do it the plain way, since
+ deriving from a common base subclass always introduces the
+ whole set of pure virtuals, that your baseclass helper just
+ overrided) and your implementation class. You then only have
+ to implement the functionality <em>besides</em>
+ XGraphicDevice. If you want to support the optional debug
+ XUpdatable interface, also add that to the base classes
+ (client code will call the corresponding update() method,
+ whenever a burst of animations is over).
+
+ <pre>
+ Example:
+ typedef ::cppu::WeakComponentImplHelper5< ::com::sun::star::rendering::XGraphicDevice,
+ ::com::sun::star::rendering::XColorSpace,
+ ::com::sun::star::rendering::XPropertySet,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::lang::XServiceName > GraphicDeviceBase_Base;
+ typedef ::canvas::internal::GraphicDeviceBase< GraphicDeviceBase, DeviceHelper > ExampleDevice_Base;
+
+ class ExampleDevice : public ExampleDevice_Base
+ {
+ };
+ </pre>
+
+ @tpl Base
+ Base class to use, most probably one of the
+ WeakComponentImplHelperN templates with the appropriate
+ interfaces. At least XGraphicDevice should be among them (why else
+ would you use this template, then?). Base class must have an
+ Base( const Mutex& ) constructor (like the
+ WeakComponentImplHelperN templates have). As the very least,
+ the base class must be derived from uno::XInterface, as some
+ error reporting mechanisms rely on that.
+
+ @tpl DeviceHelper
+ Device helper implementation for the backend in question. This
+ object will be held as a member of this template class, and
+ basically gets forwarded all XGraphicDevice API calls that
+ could not be handled generically.
+
+ @tpl Mutex
+ Lock strategy to use. Defaults to using the
+ DisambiguationHelper-provided lock. Everytime one of the methods is
+ entered, an object of type Mutex is created with m_aMutex as
+ the sole parameter, and destroyed again when the method scope
+ is left.
+
+ @tpl UnambiguousBase
+ Optional unambiguous base class for XInterface of Base. It's
+ sometimes necessary to specify this parameter, e.g. if Base
+ derives from multiple UNO interface (were each provides its
+ own version of XInterface, making the conversion ambiguous)
+ */
+ template< class Base,
+ class DeviceHelper,
+ class Mutex=::osl::MutexGuard,
+ class UnambiguousBase=::com::sun::star::uno::XInterface > class GraphicDeviceBase :
+ public Base
+ {
+ public:
+ typedef Base BaseType;
+ typedef DeviceHelper DeviceHelperType;
+ typedef Mutex MutexType;
+ typedef UnambiguousBase UnambiguousBaseType;
+ typedef GraphicDeviceBase ThisType;
+
+ typedef ::rtl::Reference< GraphicDeviceBase > Reference;
+
+ GraphicDeviceBase() :
+ maDeviceHelper(),
+ maPropHelper(),
+ mbDumpScreenContent(false)
+ {
+ maPropHelper.initProperties( PropertySetHelper::MakeMap
+ ("HardwareAcceleration",
+ boost::bind(&DeviceHelper::isAccelerated,
+ boost::ref(maDeviceHelper)))
+ ("DeviceHandle",
+ boost::bind(&DeviceHelper::getDeviceHandle,
+ boost::ref(maDeviceHelper)))
+ ("SurfaceHandle",
+ boost::bind(&DeviceHelper::getSurfaceHandle,
+ boost::ref(maDeviceHelper)))
+ ("DumpScreenContent",
+ boost::bind(&ThisType::getDumpScreenContent,
+ this),
+ boost::bind(&ThisType::setDumpScreenContent,
+ this,
+ _1)));
+ }
+
+ virtual void disposeThis()
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ maDeviceHelper.disposing();
+
+ // pass on to base class
+ BaseType::disposeThis();
+ }
+
+ // XGraphicDevice
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBufferController > SAL_CALL getBufferController( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBufferController >();
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XColorSpace > SAL_CALL getDeviceColorSpace( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maDeviceHelper.getColorSpace();
+ }
+
+ virtual ::com::sun::star::geometry::RealSize2D SAL_CALL getPhysicalResolution( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maDeviceHelper.getPhysicalResolution();
+ }
+
+ virtual ::com::sun::star::geometry::RealSize2D SAL_CALL getPhysicalSize( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maDeviceHelper.getPhysicalSize();
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XLinePolyPolygon2D > SAL_CALL createCompatibleLinePolyPolygon( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > >& points ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maDeviceHelper.createCompatibleLinePolyPolygon( this, points );
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBezierPolyPolygon2D > SAL_CALL createCompatibleBezierPolyPolygon( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealBezierSegment2D > >& points ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maDeviceHelper.createCompatibleBezierPolyPolygon( this, points );
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > SAL_CALL createCompatibleBitmap( const ::com::sun::star::geometry::IntegerSize2D& size ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyBitmapSize(size,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maDeviceHelper.createCompatibleBitmap( this, size );
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XVolatileBitmap > SAL_CALL createVolatileBitmap( const ::com::sun::star::geometry::IntegerSize2D& size ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyBitmapSize(size,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maDeviceHelper.createVolatileBitmap( this, size );
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > SAL_CALL createCompatibleAlphaBitmap( const ::com::sun::star::geometry::IntegerSize2D& size ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyBitmapSize(size,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maDeviceHelper.createCompatibleAlphaBitmap( this, size );
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XVolatileBitmap > SAL_CALL createVolatileAlphaBitmap( const ::com::sun::star::geometry::IntegerSize2D& size ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyBitmapSize(size,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maDeviceHelper.createVolatileAlphaBitmap( this, size );
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > SAL_CALL getParametricPolyPolygonFactory( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ return this;
+ }
+
+ virtual ::sal_Bool SAL_CALL hasFullScreenMode( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maDeviceHelper.hasFullScreenMode();
+ }
+
+ virtual ::sal_Bool SAL_CALL enterFullScreenMode( ::sal_Bool bEnter ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maDeviceHelper.enterFullScreenMode( bEnter );
+ }
+
+ // XMultiServiceFactory
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance( const OUString& aServiceSpecifier ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+ {
+ return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D >(
+ ParametricPolyPolygon::create(this,
+ aServiceSpecifier,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >()));
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments( const OUString& aServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+ {
+ return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D >(
+ ParametricPolyPolygon::create(this,
+ aServiceSpecifier,
+ Arguments));
+ }
+
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ return ParametricPolyPolygon::getAvailableServiceNames();
+ }
+
+
+ // XUpdatable
+ virtual void SAL_CALL update() throw (com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ if( mbDumpScreenContent )
+ maDeviceHelper.dumpScreenContent();
+ }
+
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw (::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+ return maPropHelper.getPropertySetInfo();
+ }
+
+ virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
+ const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+ maPropHelper.setPropertyValue( aPropertyName, aValue );
+ }
+
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+ return maPropHelper.getPropertyValue( aPropertyName );
+ }
+
+ virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+ maPropHelper.addPropertyChangeListener( aPropertyName,
+ xListener );
+ }
+
+ virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+ maPropHelper.removePropertyChangeListener( aPropertyName,
+ xListener );
+ }
+
+ virtual void SAL_CALL addVetoableChangeListener( const OUString& aPropertyName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+ maPropHelper.addVetoableChangeListener( aPropertyName,
+ xListener );
+ }
+
+ virtual void SAL_CALL removeVetoableChangeListener( const OUString& aPropertyName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+ maPropHelper.removeVetoableChangeListener( aPropertyName,
+ xListener );
+ }
+
+ protected:
+ ~GraphicDeviceBase() {} // we're a ref-counted UNO class. _We_ destroy ourselves.
+
+ ::com::sun::star::uno::Any getDumpScreenContent() const
+ {
+ return ::com::sun::star::uno::makeAny( mbDumpScreenContent );
+ }
+
+ void setDumpScreenContent( const ::com::sun::star::uno::Any& rAny )
+ {
+ // TODO(Q1): this was mbDumpScreenContent =
+ // rAny.get<bool>(), only that gcc3.3 wouldn't eat it
+ rAny >>= mbDumpScreenContent;
+ }
+
+ DeviceHelperType maDeviceHelper;
+ PropertySetHelper maPropHelper;
+ bool mbDumpScreenContent;
+
+ private:
+ GraphicDeviceBase( const GraphicDeviceBase& );
+ GraphicDeviceBase& operator=( const GraphicDeviceBase& );
+ };
+}
+
+#endif /* INCLUDED_CANVAS_GRAPHICDEVICEBASE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/base/integerbitmapbase.hxx b/include/canvas/base/integerbitmapbase.hxx
new file mode 100644
index 000000000000..602e18a09eb0
--- /dev/null
+++ b/include/canvas/base/integerbitmapbase.hxx
@@ -0,0 +1,145 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_INTEGERBITMAPBASE_HXX
+#define INCLUDED_CANVAS_INTEGERBITMAPBASE_HXX
+
+#include <com/sun/star/rendering/XIntegerBitmap.hpp>
+#include <canvas/base/bitmapcanvasbase.hxx>
+
+
+namespace canvas
+{
+ /** Helper template to handle XIntegerBitmap method forwarding to
+ BitmapCanvasHelper
+
+ Use this helper to handle the XIntegerBitmap part of your
+ implementation.
+
+ @tpl Base
+ Base class to use, most probably one of the
+ WeakComponentImplHelperN templates with the appropriate
+ interfaces. At least XIntegerBitmap should be among them (why
+ else would you use this template, then?). Base class must have
+ an Base( const Mutex& ) constructor (like the
+ WeakComponentImplHelperN templates have).
+
+ @tpl CanvasHelper
+ Canvas helper implementation for the backend in question
+
+ @tpl Mutex
+ Lock strategy to use. Defaults to using the
+ OBaseMutex-provided lock. Everytime one of the methods is
+ entered, an object of type Mutex is created with m_aMutex as
+ the sole parameter, and destroyed again when the method scope
+ is left.
+
+ @tpl UnambiguousBase
+ Optional unambiguous base class for XInterface of Base. It's
+ sometimes necessary to specify this parameter, e.g. if Base
+ derives from multiple UNO interface (were each provides its
+ own version of XInterface, making the conversion ambiguous)
+
+ @see CanvasBase for further contractual requirements towards
+ the CanvasHelper type, and some examples.
+ */
+ template< class Base,
+ class CanvasHelper,
+ class Mutex=::osl::MutexGuard,
+ class UnambiguousBase=::com::sun::star::uno::XInterface > class IntegerBitmapBase :
+ public BitmapCanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase >
+ {
+ public:
+ typedef BitmapCanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase > BaseType;
+
+ // XIntegerBitmap
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getData( ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
+ const ::com::sun::star::geometry::IntegerRectangle2D& rect ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::rendering::VolatileContentDestroyedException, ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(rect,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< typename BaseType::UnambiguousBaseType* >(this));
+ tools::verifyIndexRange(rect, BaseType::getSize() );
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::maCanvasHelper.getData( bitmapLayout,
+ rect );
+ }
+
+ virtual void SAL_CALL setData( const ::com::sun::star::uno::Sequence< sal_Int8 >& data,
+ const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
+ const ::com::sun::star::geometry::IntegerRectangle2D& rect ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(bitmapLayout, rect,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< typename BaseType::UnambiguousBaseType* >(this));
+ tools::verifyIndexRange(rect, BaseType::getSize() );
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ BaseType::mbSurfaceDirty = true;
+ BaseType::maCanvasHelper.modifying();
+
+ BaseType::maCanvasHelper.setData( data, bitmapLayout, rect );
+ }
+
+ virtual void SAL_CALL setPixel( const ::com::sun::star::uno::Sequence< sal_Int8 >& color,
+ const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
+ const ::com::sun::star::geometry::IntegerPoint2D& pos ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(bitmapLayout, pos,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< typename BaseType::UnambiguousBaseType* >(this));
+ tools::verifyIndexRange(pos, BaseType::getSize() );
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ BaseType::mbSurfaceDirty = true;
+ BaseType::maCanvasHelper.modifying();
+
+ BaseType::maCanvasHelper.setPixel( color, bitmapLayout, pos );
+ }
+
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getPixel( ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
+ const ::com::sun::star::geometry::IntegerPoint2D& pos ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::rendering::VolatileContentDestroyedException, ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(pos,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< typename BaseType::UnambiguousBaseType* >(this));
+ tools::verifyIndexRange(pos, BaseType::getSize() );
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::maCanvasHelper.getPixel( bitmapLayout,
+ pos );
+ }
+
+ virtual ::com::sun::star::rendering::IntegerBitmapLayout SAL_CALL getMemoryLayout( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::maCanvasHelper.getMemoryLayout();
+ }
+ };
+}
+
+#endif /* INCLUDED_CANVAS_INTEGERBITMAPBASE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/base/sprite.hxx b/include/canvas/base/sprite.hxx
new file mode 100644
index 000000000000..4ebafd57f998
--- /dev/null
+++ b/include/canvas/base/sprite.hxx
@@ -0,0 +1,116 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_SPRITE_HXX
+#define INCLUDED_CANVAS_SPRITE_HXX
+
+#include <rtl/ref.hxx>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/rendering/XCanvas.hpp>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/vector/b2dsize.hxx>
+
+namespace basegfx
+{
+ class B2DPoint;
+ class B2DVector;
+ class B2DRange;
+}
+
+namespace canvas
+{
+ /* Definition of Sprite interface (as we mix with UNO here, has to
+ be XInterface - reference holders to a Sprite must be able to
+ control lifetime of reference target)
+ */
+
+ /** Helper interface to connect SpriteCanvas with various
+ sprite implementations.
+
+ This interface should be implemented from every sprite class,
+ as it provides essential repaint and update area facilitates.
+
+ @derive typically, each canvas implementation will derive
+ another interface from this one, that adds rendering
+ functionality (which, of course, is impossible here in a
+ generic way)
+ */
+ class Sprite : public ::com::sun::star::lang::XComponent
+ {
+ public:
+ typedef ::rtl::Reference< Sprite > Reference;
+
+ /** Query whether sprite update will fully cover the given area.
+
+ Use this method to determine whether any background
+ content (regardless of static or sprite) needs an update
+ before rendering this sprite.
+
+ @return true, if sprite redraw will fully overwrite given
+ area (and thus, the background need not be redrawn
+ beforehand).
+ */
+ virtual bool isAreaUpdateOpaque( const ::basegfx::B2DRange& rUpdateArea ) const = 0;
+
+ /** Query whether content has changed
+ */
+ virtual bool isContentChanged() const = 0;
+
+ /** Query position of the left, top pixel of the sprite
+ */
+ virtual ::basegfx::B2DPoint getPosPixel() const = 0;
+
+ /** Query size of the sprite in pixel.
+ */
+ virtual ::basegfx::B2DVector getSizePixel() const = 0;
+
+ /** Get area that is currently covered by the sprite
+
+ This area is already adapted to clipping, alpha and
+ transformation state of this sprite.
+ */
+ virtual ::basegfx::B2DRange getUpdateArea() const = 0;
+
+ /** Query sprite priority
+ */
+ virtual double getPriority() const = 0;
+
+ protected:
+ ~Sprite() {}
+ };
+
+ /** Functor providing a StrictWeakOrdering for sprite references
+ */
+ struct SpriteWeakOrder
+ {
+ bool operator()( const Sprite::Reference& rLHS,
+ const Sprite::Reference& rRHS )
+ {
+ const double nPrioL( rLHS->getPriority() );
+ const double nPrioR( rRHS->getPriority() );
+
+ // if prios are equal, tie-break on ptr value
+ return nPrioL == nPrioR ? rLHS.get() < rRHS.get() : nPrioL < nPrioR;
+ }
+ };
+}
+
+#endif /* INCLUDED_CANVAS_SPRITE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/base/spritecanvasbase.hxx b/include/canvas/base/spritecanvasbase.hxx
new file mode 100644
index 000000000000..f892bf4170a7
--- /dev/null
+++ b/include/canvas/base/spritecanvasbase.hxx
@@ -0,0 +1,193 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_SPRITECANVASBASE_HXX
+#define INCLUDED_CANVAS_SPRITECANVASBASE_HXX
+
+#include <rtl/ref.hxx>
+#include <com/sun/star/rendering/XSpriteCanvas.hpp>
+#include <com/sun/star/rendering/InterpolationMode.hpp>
+#include <canvas/base/integerbitmapbase.hxx>
+#include <canvas/spriteredrawmanager.hxx>
+
+
+namespace canvas
+{
+ /** Helper template to handle XIntegerBitmap method forwarding to
+ BitmapCanvasHelper
+
+ Use this helper to handle the XIntegerBitmap part of your
+ implementation.
+
+ @tpl Base
+ Base class to use, most probably one of the
+ WeakComponentImplHelperN templates with the appropriate
+ interfaces. At least XSpriteCanvas and SpriteSurface should be
+ among them (why else would you use this template, then?). Base
+ class must have an Base( const Mutex& ) constructor (like the
+ WeakComponentImplHelperN templates have).
+
+ @tpl CanvasHelper
+ Canvas helper implementation for the backend in question
+
+ @tpl Mutex
+ Lock strategy to use. Defaults to using the
+ OBaseMutex-provided lock. Everytime one of the methods is
+ entered, an object of type Mutex is created with m_aMutex as
+ the sole parameter, and destroyed again when the method scope
+ is left.
+
+ @tpl UnambiguousBase
+ Optional unambiguous base class for XInterface of Base. It's
+ sometimes necessary to specify this parameter, e.g. if Base
+ derives from multiple UNO interface (were each provides its
+ own version of XInterface, making the conversion ambiguous)
+
+ @see CanvasBase for further contractual requirements towards
+ the CanvasHelper type, and some examples.
+ */
+ template< class Base,
+ class CanvasHelper,
+ class Mutex=::osl::MutexGuard,
+ class UnambiguousBase=::com::sun::star::uno::XInterface > class SpriteCanvasBase :
+ public IntegerBitmapBase< Base, CanvasHelper, Mutex, UnambiguousBase >
+ {
+ public:
+ typedef IntegerBitmapBase< Base, CanvasHelper, Mutex, UnambiguousBase > BaseType;
+ typedef ::rtl::Reference< SpriteCanvasBase > Reference;
+
+ SpriteCanvasBase() :
+ maRedrawManager()
+ {
+ }
+
+ virtual void disposeThis()
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maRedrawManager.disposing();
+
+ // pass on to base class
+ BaseType::disposeThis();
+ }
+
+ // XSpriteCanvas
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XAnimatedSprite > SAL_CALL createSpriteFromAnimation( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XAnimation >& animation ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(animation,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< typename BaseType::UnambiguousBaseType* >(this));
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::maCanvasHelper.createSpriteFromAnimation(animation);
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XAnimatedSprite > SAL_CALL createSpriteFromBitmaps( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > >& animationBitmaps,
+ sal_Int8 interpolationMode ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::rendering::VolatileContentDestroyedException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(animationBitmaps,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< typename BaseType::UnambiguousBaseType* >(this));
+ tools::verifyRange( interpolationMode,
+ ::com::sun::star::rendering::InterpolationMode::NEAREST_NEIGHBOR,
+ ::com::sun::star::rendering::InterpolationMode::BEZIERSPLINE4 );
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::maCanvasHelper.createSpriteFromBitmaps(animationBitmaps, interpolationMode);
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCustomSprite > SAL_CALL createCustomSprite( const ::com::sun::star::geometry::RealSize2D& spriteSize ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifySpriteSize(spriteSize,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< typename BaseType::UnambiguousBaseType* >(this));
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::maCanvasHelper.createCustomSprite(spriteSize);
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XSprite > SAL_CALL createClonedSprite( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XSprite >& original ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(original,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< typename BaseType::UnambiguousBaseType* >(this));
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::maCanvasHelper.createClonedSprite(original);
+ }
+
+ // SpriteSurface
+ virtual void showSprite( const Sprite::Reference& rSprite )
+ {
+ OSL_ASSERT( rSprite.is() );
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maRedrawManager.showSprite( rSprite );
+ }
+
+ virtual void hideSprite( const Sprite::Reference& rSprite )
+ {
+ OSL_ASSERT( rSprite.is() );
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maRedrawManager.hideSprite( rSprite );
+ }
+
+ virtual void moveSprite( const Sprite::Reference& rSprite,
+ const ::basegfx::B2DPoint& rOldPos,
+ const ::basegfx::B2DPoint& rNewPos,
+ const ::basegfx::B2DVector& rSpriteSize )
+ {
+ OSL_ASSERT( rSprite.is() );
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maRedrawManager.moveSprite( rSprite, rOldPos, rNewPos, rSpriteSize );
+ }
+
+ virtual void updateSprite( const Sprite::Reference& rSprite,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DRange& rUpdateArea )
+ {
+ OSL_ASSERT( rSprite.is() );
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maRedrawManager.updateSprite( rSprite, rPos, rUpdateArea );
+ }
+
+ protected:
+ SpriteRedrawManager maRedrawManager;
+ };
+}
+
+#endif /* INCLUDED_CANVAS_SPRITECANVASBASE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/base/spritesurface.hxx b/include/canvas/base/spritesurface.hxx
new file mode 100644
index 000000000000..47a0fb24a67d
--- /dev/null
+++ b/include/canvas/base/spritesurface.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_SPRITESURFACE_HXX
+#define INCLUDED_CANVAS_SPRITESURFACE_HXX
+
+#include <canvas/base/sprite.hxx>
+
+namespace canvas
+{
+ /* Definition of the SpriteSurface interface */
+
+ /** Canvas surface containing sprites
+
+ Every canvas surface that contains sprites must implement this
+ interface, when employing the canvas base framework. The
+ methods provided here are used from the individual sprites to
+ notify the canvas about necessary screen updates.
+ */
+ class SpriteSurface : public ::com::sun::star::uno::XInterface
+ {
+ public:
+ typedef ::rtl::Reference< SpriteSurface > Reference;
+
+ /// Sprites should call this from XSprite::show()
+ virtual void showSprite( const Sprite::Reference& rSprite ) = 0;
+
+ /// Sprites should call this from XSprite::hide()
+ virtual void hideSprite( const Sprite::Reference& rSprite ) = 0;
+
+ /// Sprites should call this from XSprite::move()
+ virtual void moveSprite( const Sprite::Reference& rSprite,
+ const ::basegfx::B2DPoint& rOldPos,
+ const ::basegfx::B2DPoint& rNewPos,
+ const ::basegfx::B2DVector& rSpriteSize ) = 0;
+
+ /** Sprites should call this when some part of the content has
+ changed.
+
+ That includes show/hide, i.e. for show, both showSprite()
+ and updateSprite() must be called.
+ */
+ virtual void updateSprite( const Sprite::Reference& rSprite,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DRange& rUpdateArea ) = 0;
+
+ protected:
+ ~SpriteSurface() {}
+ };
+}
+
+#endif /* INCLUDED_CANVAS_SPRITESURFACE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/canvastools.hxx b/include/canvas/canvastools.hxx
new file mode 100644
index 000000000000..fd6dadd0a791
--- /dev/null
+++ b/include/canvas/canvastools.hxx
@@ -0,0 +1,587 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_CANVASTOOLS_HXX
+#define INCLUDED_CANVAS_CANVASTOOLS_HXX
+
+#include <rtl/math.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <osl/diagnose.h>
+#include <rtl/ustring.hxx>
+
+#include <string.h> // for strcmp
+#include <vector>
+#include <limits>
+#include <algorithm>
+
+#include <canvas/canvastoolsdllapi.h>
+
+namespace basegfx
+{
+ class B2DHomMatrix;
+ class B2DRange;
+ class B2IRange;
+ class B2IPoint;
+ class B2DPolyPolygon;
+}
+
+namespace com { namespace sun { namespace star { namespace geometry
+{
+ struct RealSize2D;
+ struct IntegerSize2D;
+ struct AffineMatrix2D;
+ struct Matrix2D;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace rendering
+{
+ struct RenderState;
+ struct ViewState;
+ struct IntegerBitmapLayout;
+ class XCanvas;
+ struct Texture;
+ class XIntegerBitmapColorSpace;
+ class XPolyPolygon2D;
+
+ bool operator==( const RenderState& rLHS,
+ const RenderState& rRHS );
+
+ bool operator==( const ViewState& rLHS,
+ const ViewState& rRHS );
+} } } }
+
+namespace com { namespace sun { namespace star { namespace awt
+{
+ struct Rectangle;
+ class XWindow2;
+} } } }
+
+class Color;
+
+namespace canvas
+{
+ namespace tools
+ {
+ /** Compute the next highest power of 2 of a 32-bit value
+
+ Code devised by Sean Anderson, in good ole HAKMEM
+ tradition.
+
+ @return 1 << (lg(x - 1) + 1)
+ */
+ inline sal_uInt32 nextPow2( sal_uInt32 x )
+ {
+ --x;
+ x |= x >> 1;
+ x |= x >> 2;
+ x |= x >> 4;
+ x |= x >> 8;
+ x |= x >> 16;
+
+ return ++x;
+ }
+
+ /**
+ *
+ * Count the number of 1-bits of an n-bit value
+ *
+ */
+
+ // mickey's math tricks...
+ inline unsigned int pow2( unsigned int c ) { return 0x1 << c; }
+ inline unsigned int mask( unsigned int c ) { return ((unsigned int)(-1)) / (pow2(pow2(c)) + 1); }
+ inline unsigned int count( unsigned int x, unsigned int c ) { return ((x) & mask(c)) + (((x) >> (pow2(c))) & mask(c)); }
+ template<typename T>
+ inline unsigned int bitcount( T c ) {
+ unsigned int nByteIndex = 0;
+ unsigned int nNumBytes = sizeof(T)<<2;
+ do {
+ c=count(c,nByteIndex++);
+ nNumBytes >>= 1;
+ } while(nNumBytes);
+ return c;
+ }
+ inline sal_uInt32 bitcount32( sal_uInt32 c ) {
+ c=count(c,0);
+ c=count(c,1);
+ c=count(c,2);
+ c=count(c,3);
+ c=count(c,4);
+ return c;
+ }
+
+ /** Round given floating point value down to next integer
+ */
+ inline sal_Int32 roundDown( const double& rVal )
+ {
+ return static_cast< sal_Int32 >( floor( rVal ) );
+ }
+
+ /** Round given floating point value up to next integer
+ */
+ inline sal_Int32 roundUp( const double& rVal )
+ {
+ return static_cast< sal_Int32 >( ceil( rVal ) );
+ }
+
+ /** Create a RealSize2D with both coordinate values set to +infinity
+ */
+ CANVASTOOLS_DLLPUBLIC ::com::sun::star::geometry::RealSize2D createInfiniteSize2D();
+
+
+ // View- and RenderState utilities
+ // ===================================================================
+
+ CANVASTOOLS_DLLPUBLIC ::com::sun::star::rendering::RenderState&
+ initRenderState( ::com::sun::star::rendering::RenderState& renderState );
+
+ CANVASTOOLS_DLLPUBLIC ::com::sun::star::rendering::ViewState&
+ initViewState( ::com::sun::star::rendering::ViewState& viewState );
+
+ CANVASTOOLS_DLLPUBLIC ::basegfx::B2DHomMatrix&
+ getViewStateTransform( ::basegfx::B2DHomMatrix& transform,
+ const ::com::sun::star::rendering::ViewState& viewState );
+
+ CANVASTOOLS_DLLPUBLIC ::com::sun::star::rendering::ViewState&
+ setViewStateTransform( ::com::sun::star::rendering::ViewState& viewState,
+ const ::basegfx::B2DHomMatrix& transform );
+
+ CANVASTOOLS_DLLPUBLIC ::basegfx::B2DHomMatrix&
+ getRenderStateTransform( ::basegfx::B2DHomMatrix& transform,
+ const ::com::sun::star::rendering::RenderState& renderState );
+
+ CANVASTOOLS_DLLPUBLIC ::com::sun::star::rendering::RenderState&
+ setRenderStateTransform( ::com::sun::star::rendering::RenderState& renderState,
+ const ::basegfx::B2DHomMatrix& transform );
+
+ CANVASTOOLS_DLLPUBLIC ::com::sun::star::rendering::RenderState&
+ appendToRenderState( ::com::sun::star::rendering::RenderState& renderState,
+ const ::basegfx::B2DHomMatrix& transform );
+
+ CANVASTOOLS_DLLPUBLIC ::com::sun::star::rendering::RenderState&
+ prependToRenderState( ::com::sun::star::rendering::RenderState& renderState,
+ const ::basegfx::B2DHomMatrix& transform );
+
+ CANVASTOOLS_DLLPUBLIC ::basegfx::B2DHomMatrix&
+ mergeViewAndRenderTransform( ::basegfx::B2DHomMatrix& transform,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+
+
+ // Matrix utilities
+ // ===================================================================
+
+ CANVASTOOLS_DLLPUBLIC ::com::sun::star::geometry::AffineMatrix2D&
+ setIdentityAffineMatrix2D( ::com::sun::star::geometry::AffineMatrix2D& matrix );
+
+ CANVASTOOLS_DLLPUBLIC ::com::sun::star::geometry::Matrix2D&
+ setIdentityMatrix2D( ::com::sun::star::geometry::Matrix2D& matrix );
+
+
+ // Special utilities
+ // ===================================================================
+
+ /** Calc the bounding rectangle of a transformed rectangle.
+
+ The method applies the given transformation to the
+ specified input rectangle, and returns the bounding box of
+ the resulting output area.
+
+ @param o_Rect
+ Output rectangle
+
+ @param i_Rect
+ Input rectangle
+
+ @param i_Transformation
+ Transformation to apply to the input rectangle
+
+ @return a reference to the resulting rectangle
+ */
+ CANVASTOOLS_DLLPUBLIC ::basegfx::B2DRange& calcTransformedRectBounds( ::basegfx::B2DRange& o_Rect,
+ const ::basegfx::B2DRange& i_Rect,
+ const ::basegfx::B2DHomMatrix& i_Transformation );
+
+ /** Calc a transform that maps the upper, left corner of a
+ rectangle to the origin.
+
+ The method is a specialized version of
+ calcRectToRectTransform() (Removed now), mapping the input rectangle's
+ the upper, left corner to the origin, and leaving the size
+ untouched.
+
+ @param o_transform
+ Output parameter, to receive the resulting transformation
+ matrix.
+
+ @param i_srcRect
+ Input parameter, specifies the original source
+ rectangle. The resulting transformation will exactly map
+ the source rectangle's upper, left corner to the origin.
+
+ @param i_transformation
+ The original transformation matrix. This is changed with
+ translations (if necessary), to exactly map the source
+ rectangle to the origin.
+
+ @return a reference to the resulting transformation matrix
+
+ @see calcRectToRectTransform()
+ @see calcTransformedRectBounds()
+ */
+ CANVASTOOLS_DLLPUBLIC ::basegfx::B2DHomMatrix& calcRectToOriginTransform( ::basegfx::B2DHomMatrix& o_transform,
+ const ::basegfx::B2DRange& i_srcRect,
+ const ::basegfx::B2DHomMatrix& i_transformation );
+
+ /** Check whether a given rectangle is within another
+ transformed rectangle.
+
+ This method checks for polygonal containedness, i.e. the
+ transformed rectangle is not represented as an axis-alignd
+ rectangle anymore (like calcTransformedRectBounds()), but
+ polygonal. Thus, the insideness test is based on tight
+ bounds.
+
+ @param rContainedRect
+ This rectangle is checked, whether it is fully within the
+ transformed rTransformRect.
+
+ @param rTransformRect
+ This rectangle is transformed, and then checked whether it
+ fully contains rContainedRect.
+
+ @param rTransformation
+ This transformation is applied to rTransformRect
+ */
+ CANVASTOOLS_DLLPUBLIC bool isInside( const ::basegfx::B2DRange& rContainedRect,
+ const ::basegfx::B2DRange& rTransformRect,
+ const ::basegfx::B2DHomMatrix& rTransformation );
+
+ /** Clip a scroll to the given bound rect
+
+ @param io_rSourceArea
+ Source area to scroll. The resulting clipped source area
+ is returned therein.
+
+ @param io_rDestPoint
+ Destination point of the scroll (upper, left corner of
+ rSourceArea after the scroll). The new, resulting
+ destination point is returned therein.q
+
+ @param o_ClippedAreas
+ Vector of rectangles in the <em>destination</em> area
+ coordinate system, which are clipped away from the source
+ area, and thus need extra updates (i.e. they are not
+ correctly copy from the scroll operation, since there was
+ no information about them in the source).
+
+ @param rBounds
+ Bounds to clip against.
+
+ @return false, if the resulting scroll area is empty
+ */
+ CANVASTOOLS_DLLPUBLIC bool clipScrollArea( ::basegfx::B2IRange& io_rSourceArea,
+ ::basegfx::B2IPoint& io_rDestPoint,
+ ::std::vector< ::basegfx::B2IRange >& o_ClippedAreas,
+ const ::basegfx::B2IRange& rBounds );
+
+ /** Clip a blit between two differently surfaces.
+
+ This method clips source and dest rect for a clip between
+ two differently clipped surfaces, such that the resulting
+ blit rects are fully within both clip areas.
+
+ @param io_rSourceArea
+ Source area of the blit. Returned therein is the computed
+ clipped source area.
+
+ @param io_rDestPoint
+ Dest area of the blit. Returned therein is the computed
+ clipped dest area.
+
+ @param rSourceBounds
+ Clip bounds of the source surface
+
+ @param rDestBounds
+ Clip bounds of the dest surface
+
+ @return false, if the resulting blit is empty, i.e. fully
+ clipped away.
+ */
+ CANVASTOOLS_DLLPUBLIC ::basegfx::B2IRange spritePixelAreaFromB2DRange( const ::basegfx::B2DRange& rRange );
+
+ /** Retrieve various internal properties of the actual canvas implementation.
+
+ This method retrieves a bunch of internal, implementation-
+ and platform-dependent values from the canvas
+ implementation. Among them are for example operating
+ system window handles. The actual layout and content of
+ the returned sequence is dependent on the component
+ implementation, undocumented and subject to change.
+
+ @param i_rxCanvas
+ Input parameter, the canvas representation for which the device information
+ is to be retrieveds
+
+ @param o_rxParams
+ Output parameter, the sequence of Anys that hold the device parameters. Layout is as described above
+
+ @return A reference to the resulting sequence of parameters
+ */
+ CANVASTOOLS_DLLPUBLIC ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& getDeviceInfo(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvas >& i_rxCanvas,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& o_rxParams );
+
+ /** Return a color space for a default RGBA integer format
+
+ Use this method for dead-simple bitmap implementations,
+ that map all their formats to 8888 RGBA color.
+ */
+ CANVASTOOLS_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XIntegerBitmapColorSpace> getStdColorSpace();
+
+ /** Return a color space for a default RGB integer format
+
+ Use this method for dead-simple bitmap implementations,
+ that map all their formats to 8888 RGB color (the last byte
+ is unused).
+ */
+ CANVASTOOLS_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XIntegerBitmapColorSpace> getStdColorSpaceWithoutAlpha();
+
+ /** Return a memory layout for a default RGBA integer format
+
+ Use this method for dead-simple bitmap implementations,
+ that map all their formats to 8888 RGBA color.
+ */
+ CANVASTOOLS_DLLPUBLIC ::com::sun::star::rendering::IntegerBitmapLayout getStdMemoryLayout(
+ const ::com::sun::star::geometry::IntegerSize2D& rBitmapSize );
+
+ /// Convert standard 8888 RGBA color to vcl color
+ CANVASTOOLS_DLLPUBLIC ::Color stdIntSequenceToColor( const ::com::sun::star::uno::Sequence<sal_Int8>& rColor );
+
+ /// Convert standard 8888 RGBA color to vcl color
+ CANVASTOOLS_DLLPUBLIC ::com::sun::star::uno::Sequence<sal_Int8> colorToStdIntSequence( const ::Color& rColor );
+
+ // Modeled closely after boost::numeric_cast, only that we
+ // issue some trace output here and throw a RuntimeException
+
+ /** Cast numeric value into another (numeric) data type
+
+ Apart from converting the numeric value, this template
+ also checks if any overflow, underflow, or sign
+ information is lost (if yes, it throws an
+ uno::RuntimeException.
+ */
+ template< typename Target, typename Source > inline Target numeric_cast( Source arg )
+ {
+ // typedefs abbreviating respective trait classes
+ typedef ::std::numeric_limits< Source > SourceLimits;
+ typedef ::std::numeric_limits< Target > TargetLimits;
+
+#undef min
+#undef max
+
+ if( ( arg<0 && !TargetLimits::is_signed) || // loosing the sign here
+ ( SourceLimits::is_signed && arg<TargetLimits::min()) || // underflow will happen
+ ( arg>TargetLimits::max() ) ) // overflow will happen
+ {
+# if OSL_DEBUG_LEVEL > 2
+ OSL_TRACE("numeric_cast detected data loss");
+#endif
+ throw ::com::sun::star::uno::RuntimeException(
+ "numeric_cast detected data loss",
+ NULL );
+ }
+
+ return static_cast<Target>(arg);
+ }
+
+ CANVASTOOLS_DLLPUBLIC ::com::sun::star::awt::Rectangle getAbsoluteWindowRect(
+ const ::com::sun::star::awt::Rectangle& rRect,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow2 >& xWin );
+
+ /** Retrieve for small bound marks around each corner of the given rectangle
+ */
+ CANVASTOOLS_DLLPUBLIC ::basegfx::B2DPolyPolygon getBoundMarksPolyPolygon( const ::basegfx::B2DRange& rRange );
+
+ /** Calculate number of gradient "strips" to generate (takes
+ into account device resolution)
+
+ @param nColorSteps
+ Maximal integer difference between all color stops, needed
+ for smooth gradient color differences
+ */
+ CANVASTOOLS_DLLPUBLIC int calcGradientStepCount( ::basegfx::B2DHomMatrix& rTotalTransform,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState,
+ const ::com::sun::star::rendering::Texture& texture,
+ int nColorSteps );
+
+ /** A very simplistic map for ASCII strings and arbitrary value
+ types.
+
+ This class internally references a constant, static array of
+ sorted MapEntries, and performs a binary search to look up
+ values for a given query string. Note that this map is static,
+ i.e. not meant to be extented at runtime.
+
+ @tpl ValueType
+ The value type this map should store, associated with an ASCII
+ string.
+ */
+ template< typename ValueType > class ValueMap
+ {
+ public:
+ struct MapEntry
+ {
+ const char* maKey;
+ ValueType maValue;
+ };
+
+ /** Create a ValueMap for the given array of MapEntries.
+
+ @param pMap
+ Pointer to a <em>static</em> array of MapEntries. Must
+ live longer than this object! Make absolutely sure that
+ the string entries passed via pMap are ASCII-only -
+ everything else might not yield correct string
+ comparisons, and thus will result in undefined behaviour.
+
+ @param nEntries
+ Number of entries for pMap
+
+ @param bCaseSensitive
+ Whether the map query should be performed case sensitive
+ or not. When bCaseSensitive is false, all MapEntry strings
+ must be lowercase!
+ */
+ ValueMap( const MapEntry* pMap,
+ ::std::size_t nEntries,
+ bool bCaseSensitive ) :
+ mpMap( pMap ),
+ mnEntries( nEntries ),
+ mbCaseSensitive( bCaseSensitive )
+ {
+#ifdef DBG_UTIL
+ // Ensure that map entries are sorted (and all lowercase, if this
+ // map is case insensitive)
+ const OString aStr( pMap->maKey );
+ if( !mbCaseSensitive &&
+ aStr != aStr.toAsciiLowerCase() )
+ {
+ OSL_TRACE("ValueMap::ValueMap(): Key %s is not lowercase",
+ pMap->maKey);
+ OSL_FAIL( "ValueMap::ValueMap(): Key is not lowercase" );
+ }
+
+ if( mnEntries > 1 )
+ {
+ for( ::std::size_t i=0; i<mnEntries-1; ++i, ++pMap )
+ {
+ if( !mapComparator(pMap[0], pMap[1]) &&
+ mapComparator(pMap[1], pMap[0]) )
+ {
+ OSL_TRACE("ValueMap::ValueMap(): Map is not sorted, keys %s and %s are wrong",
+ pMap[0].maKey,
+ pMap[1].maKey);
+ OSL_FAIL( "ValueMap::ValueMap(): Map is not sorted" );
+ }
+
+ const OString aStr2( pMap[1].maKey );
+ if( !mbCaseSensitive &&
+ aStr2 != aStr2.toAsciiLowerCase() )
+ {
+ OSL_TRACE("ValueMap::ValueMap(): Key %s is not lowercase",
+ pMap[1].maKey);
+ OSL_FAIL( "ValueMap::ValueMap(): Key is not lowercase" );
+ }
+ }
+ }
+#endif
+ }
+
+ /** Lookup a value for the given query string
+
+ @param rName
+ The string to lookup. If the map was created with the case
+ insensitive flag, the lookup is performed
+ case-insensitive, otherwise, case-sensitive.
+
+ @param o_rResult
+ Output parameter, which receives the value associated with
+ the query string. If no value was found, the referenced
+ object is kept unmodified.
+
+ @return true, if a matching entry was found.
+ */
+ bool lookup( const OUString& rName,
+ ValueType& o_rResult ) const
+ {
+ // rName is required to contain only ASCII characters.
+ // TODO(Q1): Enforce this at upper layers
+ OString aKey( OUStringToOString( mbCaseSensitive ? rName : rName.toAsciiLowerCase(),
+ RTL_TEXTENCODING_ASCII_US ) );
+ MapEntry aSearchKey =
+ {
+ aKey.getStr(),
+ ValueType()
+ };
+
+ const MapEntry* pRes;
+ const MapEntry* pEnd = mpMap+mnEntries;
+ if( (pRes=::std::lower_bound( mpMap,
+ pEnd,
+ aSearchKey,
+ &mapComparator )) != pEnd )
+ {
+ // place to _insert before_ found - is it equal to
+ // the search key?
+ if( strcmp( pRes->maKey, aSearchKey.maKey ) == 0 )
+ {
+ // yep, correct entry found
+ o_rResult = pRes->maValue;
+ return true;
+ }
+ }
+
+ // not found
+ return false;
+ }
+
+ private:
+ static bool mapComparator( const MapEntry& rLHS,
+ const MapEntry& rRHS )
+ {
+ return strcmp( rLHS.maKey,
+ rRHS.maKey ) < 0;
+ }
+
+ const MapEntry* mpMap;
+ ::std::size_t mnEntries;
+ bool mbCaseSensitive;
+ };
+ }
+}
+
+#endif /* INCLUDED_CANVAS_CANVASTOOLS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/canvastoolsdllapi.h b/include/canvas/canvastoolsdllapi.h
new file mode 100644
index 000000000000..ad96dec3ea7c
--- /dev/null
+++ b/include/canvas/canvastoolsdllapi.h
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CANVAS_DLLAPI_H
+#define _CANVAS_DLLAPI_H
+
+#include "sal/config.h"
+#include "sal/types.h"
+
+#if defined(CANVASTOOLS_DLLIMPLEMENTATION)
+#define CANVASTOOLS_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define CANVASTOOLS_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define CANVASTOOLS_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/debug.hxx b/include/canvas/debug.hxx
new file mode 100644
index 000000000000..9fc5ad31711f
--- /dev/null
+++ b/include/canvas/debug.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_DEBUG_HXX
+#define INCLUDED_CANVAS_DEBUG_HXX
+
+// shared_ptr debugging
+// --------------------
+
+#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+
+# include <sal/config.h>
+# include <boost/shared_ptr.hpp>
+
+::std::size_t find_unreachable_objects( bool );
+
+# if OSL_DEBUG_LEVEL > 2
+# include <osl/diagnose.h>
+# define SHARED_PTR_LEFTOVERS(a) OSL_TRACE("%s\n%s: Unreachable objects still use %d bytes\n", \
+ BOOST_CURRENT_FUNCTION, a, \
+ find_unreachable_objects(true) )
+# else
+/** This macro shows how much memory is still used by shared_ptrs
+
+ Use this macro at places in the code where normally all shared_ptr
+ objects should have been deleted. You'll get the number of bytes
+ still contained in those objects, which quite possibly are prevented
+ from deletion by circular references.
+ */
+# define SHARED_PTR_LEFTOVERS(a) OSL_TRACE("%s\n%s: Unreachable objects still use %d bytes\n", \
+ BOOST_CURRENT_FUNCTION, a, \
+ find_unreachable_objects(false) )
+# endif
+
+#else
+
+# define SHARED_PTR_LEFTOVERS(a) ((void)0)
+
+#endif
+
+#endif // ! defined(INCLUDED_CANVAS_DEBUG_HXX)
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/elapsedtime.hxx b/include/canvas/elapsedtime.hxx
new file mode 100644
index 000000000000..8248e3408785
--- /dev/null
+++ b/include/canvas/elapsedtime.hxx
@@ -0,0 +1,173 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_ELAPSEDTIME_HXX
+#define INCLUDED_CANVAS_ELAPSEDTIME_HXX
+
+#include <sal/types.h>
+
+#include "boost/shared_ptr.hpp"
+#include <canvas/canvastoolsdllapi.h>
+
+namespace canvas
+{
+ namespace tools
+ {
+ /** Calculate elapsed time.
+
+ This class provides several time-measurement and
+ -management functions. In its simplest use-case, it
+ measures the time from its creation.
+ */
+ class CANVASTOOLS_DLLPUBLIC ElapsedTime
+ {
+ public:
+ /** Create a new ElapsedTime object
+
+ The moment of construction starts the time
+ measurement. That means, a subsequent getElapsedTime()
+ call will return the time difference between object
+ creation and getElapsedTime() call.
+ */
+ ElapsedTime();
+
+ /** Creates a new ElapsedTime object based on another
+ timer.
+
+ The moment of construction starts the time
+ measurement. That means, a subsequent getElapsedTime()
+ call will return the time difference between object
+ creation and getElapsedTime() call. All time values
+ are not taken from the system's time base, but from
+ the provided timer.
+ */
+ ElapsedTime( ::boost::shared_ptr<ElapsedTime> const & pTimeBase );
+
+ /** Reset the time
+
+ The instance of the reset() call starts the time
+ measurement from scratch. That means, a subsequent
+ getElapsedTime() call will return the time difference
+ between reset() and getElapsedTime() call.
+ */
+ void reset();
+
+ /** Query the elapsed time
+
+ This method returns the elapsed time in seconds
+ between either the construction of this object, or the
+ last reset() call, if any (but see the time modulation
+ methods below, for means to modify the otherwise
+ continuous flow of time).
+
+ @return the elapsed time in seconds.
+ */
+ double getElapsedTime() const;
+
+ /** Pauses the running timer.
+
+ This method stops the time, as returned by this
+ object, until continueTimer() is called. During this
+ period, getElapsedTime() will always return the same
+ time value (i.e. the instant when pauseTimer() was
+ called).
+ */
+ void pauseTimer();
+
+ /** Continues the paused timer.
+
+ This method re-enables the time flow, that is, time
+ starts running again for clients calling
+ getElapsedTime(). The (subtle) difference to the
+ holdTimer/releaseTimer() methods below is, that there
+ is no perceived time 'jump' between the pauseTimer()
+ call and the continueTimer() call, i.e. the time
+ starts over with the same value it has stopped on
+ pauseTimer().
+ */
+ void continueTimer();
+
+ /** Adjusts the timer, hold and pause times.
+
+ This method modifies the time as returned by this
+ object by the specified amount. This affects the time
+ as returned by getElapsedTime(), regardless of the
+ mode (e.g. paused, or on hold).
+
+ @param fOffset
+ This value will be added to the current time, i.e. the
+ next call to getElapsedTime() (when performed
+ immediately) will be adjusted by fOffset.
+
+ @param bLimitToLastQueriedTime
+ Limits the given offset to the time that has been
+ taken via getElapsedTime()
+ */
+ void adjustTimer( double fOffset,
+ bool bLimitToLastQueriedTime = true );
+
+ /** Holds the current time.
+
+ This call makes the timer hold the current time
+ (e.g. getElapsedTime() will return the time when
+ holdTimer() was called), while the underlying time is
+ running on. When releaseTimer() is called, the time
+ will 'jump' to the then-current, underlying time. This
+ is equivalent to pressing the "interim time" button on
+ a stop watch, which shows this stopped time, while the
+ clock keeps running internally.
+ */
+ void holdTimer();
+
+ /** Releases a held timer.
+
+ After this call, the timer again returns the running
+ time on getElapsedTime().
+ */
+ void releaseTimer();
+
+ private:
+ static double getSystemTime();
+ double getCurrentTime() const;
+ double getElapsedTimeImpl() const; // does not set m_fLastQueriedTime
+
+ const ::boost::shared_ptr<ElapsedTime> m_pTimeBase;
+
+ /// To validate adjustTimer() calls with bLimitToLastQueriedTime=true
+ mutable double m_fLastQueriedTime;
+
+ /// Start time, from which the difference to the time base is returned
+ double m_fStartTime;
+
+ /// Instant, when last pause or hold started, relative to m_fStartTime
+ double m_fFrozenTime;
+
+ /// True, when in pause mode
+ bool m_bInPauseMode;
+
+ /// True, when in hold mode
+ bool m_bInHoldMode;
+ };
+
+ }
+}
+
+#endif /* INCLUDED_CANVAS_ELAPSEDTIME_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/parametricpolypolygon.hxx b/include/canvas/parametricpolypolygon.hxx
new file mode 100644
index 000000000000..2e8cb7af45fb
--- /dev/null
+++ b/include/canvas/parametricpolypolygon.hxx
@@ -0,0 +1,161 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_PARAMETRICPOLYPOLYGON_HXX
+#define INCLUDED_CANVAS_PARAMETRICPOLYPOLYGON_HXX
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/rendering/XGraphicDevice.hpp>
+#include <com/sun/star/rendering/XParametricPolyPolygon2D.hpp>
+#include <cppuhelper/compbase2.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+#include <boost/utility.hpp>
+#include <canvas/canvastoolsdllapi.h>
+
+namespace basegfx
+{
+ class B2DPolygon;
+ class B2DHomMatrix;
+}
+
+
+/* Definition of ParametricPolyPolygon class */
+
+namespace canvas
+{
+ typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::rendering::XParametricPolyPolygon2D,
+ ::com::sun::star::lang::XServiceInfo > ParametricPolyPolygon_Base;
+
+ class CANVASTOOLS_DLLPUBLIC ParametricPolyPolygon : public ::comphelper::OBaseMutex,
+ public ParametricPolyPolygon_Base,
+ private ::boost::noncopyable
+ {
+ public:
+ enum GradientType
+ {
+ GRADIENT_LINEAR,
+ GRADIENT_ELLIPTICAL,
+ GRADIENT_RECTANGULAR
+ };
+
+ /** Structure of defining values for the ParametricPolyPolygon
+
+ This is used to copy the state of the
+ ParametricPolyPolygon atomically.
+ */
+ struct Values
+ {
+ Values( const ::basegfx::B2DPolygon& rGradientPoly,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& rColors,
+ const ::com::sun::star::uno::Sequence< double >& rStops,
+ double nAspectRatio,
+ GradientType eType ) :
+ maGradientPoly( rGradientPoly ),
+ mnAspectRatio( nAspectRatio ),
+ maColors( rColors ),
+ maStops( rStops ),
+ meType( eType )
+ {
+ }
+
+ /// Polygonal gradient shape (ignored for linear and axial gradient)
+ const ::basegfx::B2DPolygon maGradientPoly;
+
+ /// Aspect ratio of gradient, affects scaling of innermost gradient polygon
+ const double mnAspectRatio;
+
+ /// Gradient colors
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > > maColors;
+
+ /// Gradient color stops
+ const ::com::sun::star::uno::Sequence< double > maStops;
+
+ /// Type of gradient to render (as e.g. linear grads are not represented by maGradientPoly)
+ const GradientType meType;
+ };
+
+ static ::com::sun::star::uno::Sequence< OUString > getAvailableServiceNames();
+ static ParametricPolyPolygon* create(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice,
+ const OUString& rServiceName,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rArgs );
+
+ /// Dispose all internal references
+ virtual void SAL_CALL disposing();
+
+ // XParametricPolyPolygon2D
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D > SAL_CALL getOutline( double t ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< double > SAL_CALL getColor( double t ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< double > SAL_CALL getPointColor( const ::com::sun::star::geometry::RealPoint2D& point ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XColorSpace > SAL_CALL getColorSpace() throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
+
+ /// Query all defining values of this object atomically
+ Values getValues() const;
+
+ protected:
+ ~ParametricPolyPolygon(); // we're a ref-counted UNO class. _We_ destroy ourselves.
+
+ private:
+ static ParametricPolyPolygon* createLinearHorizontalGradient( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XGraphicDevice >& rDevice,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors,
+ const ::com::sun::star::uno::Sequence< double >& stops );
+ static ParametricPolyPolygon* createEllipticalGradient( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XGraphicDevice >& rDevice,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors,
+ const ::com::sun::star::uno::Sequence< double >& stops,
+ double fAspect );
+ static ParametricPolyPolygon* createRectangularGradient( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XGraphicDevice >& rDevice,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors,
+ const ::com::sun::star::uno::Sequence< double >& stops,
+ double fAspect );
+
+ /// Private, because objects can only be created from the static factories
+ ParametricPolyPolygon( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XGraphicDevice >& rDevice,
+ const ::basegfx::B2DPolygon& rGradientPoly,
+ GradientType eType,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors,
+ const ::com::sun::star::uno::Sequence< double >& stops,
+ double nAspectRatio );
+ ParametricPolyPolygon( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XGraphicDevice >& rDevice,
+ GradientType eType,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors,
+ const ::com::sun::star::uno::Sequence< double >& stops );
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XGraphicDevice > mxDevice;
+
+ /// All defining values of this object
+ const Values maValues;
+ };
+}
+
+#endif /* INCLUDED_CANVAS_PARAMETRICPOLYPOLYGON_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/propertysethelper.hxx b/include/canvas/propertysethelper.hxx
new file mode 100644
index 000000000000..b90d9ef344e5
--- /dev/null
+++ b/include/canvas/propertysethelper.hxx
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_PROPERTYSETHELPER_HXX
+#define INCLUDED_CANVAS_PROPERTYSETHELPER_HXX
+
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <canvas/canvastools.hxx>
+
+#include <boost/function.hpp>
+#include <vector>
+#include <memory>
+
+#include <canvas/canvastoolsdllapi.h>
+
+namespace canvas
+{
+ /** Really simplistic XPropertySet helper for properties.
+
+ This class provides easy access to properties, referenced via
+ ASCII strings. The name/property modification callbacks pairs
+ are passed into this class via a vector. Each time a property
+ is set or queried, the corresponding getter or setter callback
+ is called.
+
+ Use this class as a delegate for the corresponding
+ XPropertySet methods, and take care of UNO XInterface and lock
+ handling by yourself.
+
+ The core responsibility of this this class is the name/value
+ mapping for property sets.
+ */
+ class CANVASTOOLS_DLLPUBLIC PropertySetHelper
+ {
+ public:
+ typedef boost::function0< ::com::sun::star::uno::Any > GetterType;
+ typedef boost::function1<void, const ::com::sun::star::uno::Any&> SetterType;
+ struct Callbacks
+ {
+ GetterType getter;
+ SetterType setter;
+ };
+ typedef tools::ValueMap< Callbacks > MapType;
+ typedef std::vector< MapType::MapEntry > InputMap;
+
+ class MakeMap : public InputMap
+ {
+ public:
+ MakeMap(const char* name,
+ const GetterType& getter,
+ const SetterType& setter)
+ {
+ MapType::MapEntry aEntry={name, {getter, setter}};
+ this->push_back(aEntry);
+ }
+ MakeMap(const char* name,
+ const GetterType& getter)
+ {
+ MapType::MapEntry aEntry={name, {getter, SetterType()}};
+ this->push_back(aEntry);
+ }
+ MakeMap& operator()(const char* name,
+ const GetterType& getter,
+ const SetterType& setter)
+ {
+ MapType::MapEntry aEntry={name, {getter, setter}};
+ this->push_back(aEntry);
+ return *this;
+ }
+ MakeMap& operator()(const char* name,
+ const GetterType& getter)
+ {
+ MapType::MapEntry aEntry={name, {getter, SetterType()}};
+ this->push_back(aEntry);
+ return *this;
+ }
+ };
+
+ /** Create helper with zero properties
+ */
+ PropertySetHelper();
+
+ /** Init helper with new name/value map
+
+ @param rMap
+ Vector of name/function pointers. Each name is offered as
+ a property, and reading/writing to this property is passed
+ on to the given function pointer.
+ */
+ void initProperties( const InputMap& rMap );
+
+ /** Add given properties to helper
+
+ @param rMap
+ Vector of name/function pointers. Each name is offered as
+ a property, and reading/writing to this property is passed
+ on to the given function pointer. These name/function
+ pairs are added to the already existing ones.
+ */
+ void addProperties( const InputMap& rMap );
+
+ /** Checks whether the given string corresponds to a valid
+ property name.
+
+ @return true, if the given name maps to a known property.
+ */
+ bool isPropertyName( const OUString& aPropertyName ) const;
+
+ /** Request the currently active map
+ */
+ const InputMap& getPropertyMap() const { return maMapEntries; }
+
+ // XPropertySet implementation
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > getPropertySetInfo() const;
+ void setPropertyValue( const OUString& aPropertyName,
+ const ::com::sun::star::uno::Any& aValue );
+ ::com::sun::star::uno::Any getPropertyValue( const OUString& PropertyName ) const;
+ void addPropertyChangeListener( const OUString& aPropertyName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener );
+ void removePropertyChangeListener( const OUString& aPropertyName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener );
+ void addVetoableChangeListener( const OUString& aPropertyName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& xListener );
+ void removeVetoableChangeListener( const OUString& aPropertyName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& xListener );
+
+ private:
+ std::auto_ptr<MapType> mpMap;
+ InputMap maMapEntries;
+ };
+}
+
+#endif /* INCLUDED_CANVAS_PROPERTYSETHELPER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/rendering/bitmap.hxx b/include/canvas/rendering/bitmap.hxx
new file mode 100644
index 000000000000..295057bd832b
--- /dev/null
+++ b/include/canvas/rendering/bitmap.hxx
@@ -0,0 +1,314 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_BITMAP_HXX
+#define INCLUDED_CANVAS_BITMAP_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/rendering/XCanvas.hpp>
+#include <com/sun/star/rendering/IntegerBitmapLayout.hpp>
+#include <com/sun/star/geometry/IntegerRectangle2D.hpp>
+#include <com/sun/star/geometry/IntegerPoint2D.hpp>
+#include <canvas/rendering/icolorbuffer.hxx>
+#include <canvas/rendering/icachedprimitive.hxx>
+#include <canvas/rendering/isurfaceproxymanager.hxx>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/scoped_ptr.hpp>
+#include <vector>
+
+namespace basegfx
+{
+ class B2IVector;
+ class B2DPoint;
+ class B2DHomMatrix;
+ class B2DPolyPolygon;
+}
+
+namespace canvas
+{
+ class ImplBitmap;
+
+ /** Bitmap class, with XCanvas-like render interface.
+
+ This class provides a bitmap, that can be rendered into,
+ with an interface compatible to XCanvas. Furthermore, the
+ bitmaps held here can optionally be backed by (possibly
+ hw-accelerated) textures.
+ */
+ class Bitmap
+ {
+ public:
+ /** Create bitmap with given size
+
+ @param rSize
+ Size of the bitmap, in pixel
+
+ @param rMgr
+ SurfaceProxyManager, to use for HW acceleration
+
+ @param bWithAlpha
+ When true, the created bitmap will have an alpha channel,
+ false otherwise
+ */
+ Bitmap( const ::basegfx::B2IVector& rSize,
+ const ISurfaceProxyManagerSharedPtr& rMgr,
+ bool bWithAlpha );
+ ~Bitmap();
+
+ /// Query whether this bitmap contains alpha channel information
+ bool hasAlpha() const;
+
+ /// Query size of the bitmap in pixel
+ ::basegfx::B2IVector getSize() const;
+
+ ::com::sun::star::uno::Sequence< sal_Int8 > getData(
+ ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
+ const ::com::sun::star::geometry::IntegerRectangle2D& rect );
+
+ void setData(
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& data,
+ const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
+ const ::com::sun::star::geometry::IntegerRectangle2D& rect );
+
+ void setPixel(
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& color,
+ const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
+ const ::com::sun::star::geometry::IntegerPoint2D& pos );
+
+ ::com::sun::star::uno::Sequence< sal_Int8 > getPixel(
+ ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
+ const ::com::sun::star::geometry::IntegerPoint2D& pos );
+
+ /** Render the bitmap content to associated
+ SurfaceProxyManager's screen.
+
+ @param fAlpha
+ Overall alpha for content
+
+ @param rPos
+ Output position
+
+ @param rTransform
+ Output transformation (does not affect output position)
+ */
+ bool draw( double fAlpha,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DHomMatrix& rTransform );
+
+ /** Render the bitmap content to associated
+ SurfaceProxyManager's screen.
+
+ @param fAlpha
+ Overall alpha for content
+
+ @param rPos
+ Output position
+
+ @param rArea
+ Subset of the surface to render. Coordinate system are
+ surface area pixel, given area will be clipped to the
+ surface bounds.
+
+ @param rTransform
+ Output transformation (does not affect output position)
+ */
+ bool draw( double fAlpha,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DRange& rArea,
+ const ::basegfx::B2DHomMatrix& rTransform );
+
+ /** Render the bitmap content to associated
+ SurfaceProxyManager's screen.
+
+ @param fAlpha
+ Overall alpha for content
+
+ @param rPos
+ Output position
+
+ @param rClipPoly
+ Clip polygon for the surface. The clip polygon is also
+ subject to the output transformation.
+
+ @param rTransform
+ Output transformation (does not affect output position)
+ */
+ bool draw( double fAlpha,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DPolyPolygon& rClipPoly,
+ const ::basegfx::B2DHomMatrix& rTransform );
+
+ /** Clear whole bitmap with given color.
+
+ This method sets every single pixel of the bitmap to the
+ specified color value.
+ */
+ void clear( const ::com::sun::star::uno::Sequence< double >& color );
+
+ void fillB2DPolyPolygon(
+ const ::basegfx::B2DPolyPolygon& rPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+
+
+ // High-level drawing operations (from the XCanvas interface)
+ // ==========================================================
+
+ /// See XCanvas interface
+ void drawPoint( const ::com::sun::star::geometry::RealPoint2D& aPoint,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+ /// See XCanvas interface
+ void drawLine( const ::com::sun::star::geometry::RealPoint2D& aStartPoint,
+ const ::com::sun::star::geometry::RealPoint2D& aEndPoint,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+ /// See XCanvas interface
+ void drawBezier( const ::com::sun::star::geometry::RealBezierSegment2D& aBezierSegment,
+ const ::com::sun::star::geometry::RealPoint2D& aEndPoint,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+ /// See XCanvas interface
+ ICachedPrimitiveSharedPtr drawPolyPolygon(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+
+ /// See XCanvas interface
+ ICachedPrimitiveSharedPtr strokePolyPolygon(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState,
+ const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes );
+ /** See XCanvas interface
+
+ @param textureAnnotations
+ Vector of shared pointers to bitmap textures,
+ <em>corresponding</em> in indices to the textures
+ sequence. This is to decouple this interface from the
+ client's XBitmap-implementation class.
+ */
+ ICachedPrimitiveSharedPtr strokeTexturedPolyPolygon(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::rendering::Texture >& textures,
+ const ::std::vector< ::boost::shared_ptr<Bitmap> >& textureAnnotations,
+ const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes );
+ /** See XCanvas interface
+
+ @param textureAnnotations
+ Vector of shared pointers to bitmap textures,
+ <em>corresponding</em> in indices to the textures
+ sequence. This is to decouple this interface from the
+ client's XBitmap-implementation class.
+ */
+ ICachedPrimitiveSharedPtr strokeTextureMappedPolyPolygon(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::rendering::Texture >& textures,
+ const ::std::vector< ::boost::shared_ptr<Bitmap> >& textureAnnotations,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::geometry::XMapping2D >& xMapping,
+ const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes );
+ /// See XCanvas interface
+ ICachedPrimitiveSharedPtr fillPolyPolygon(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+ /** See XCanvas interface
+
+ @param textureAnnotations
+ Vector of shared pointers to bitmap textures,
+ <em>corresponding</em> in indices to the textures
+ sequence. This is to decouple this interface from the
+ client's XBitmap-implementation class.
+ */
+ ICachedPrimitiveSharedPtr fillTexturedPolyPolygon(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::rendering::Texture >& textures,
+ const ::std::vector< ::boost::shared_ptr<Bitmap> >& textureAnnotations );
+ /** See XCanvas interface
+
+ @param textureAnnotations
+ Vector of shared pointers to bitmap textures,
+ <em>corresponding</em> in indices to the textures
+ sequence. This is to decouple this interface from the
+ client's XBitmap-implementation class.
+ */
+ ICachedPrimitiveSharedPtr fillTextureMappedPolyPolygon(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::rendering::Texture >& textures,
+ const ::std::vector< ::boost::shared_ptr<Bitmap> >& textureAnnotations,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::geometry::XMapping2D >& xMapping );
+
+ /// See XCanvas interface
+ ICachedPrimitiveSharedPtr drawBitmap(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XBitmap >& xBitmap,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+ /// See XCanvas interface
+ ICachedPrimitiveSharedPtr drawBitmap(
+ const ::boost::shared_ptr<Bitmap>& rImage,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+
+ /// See XCanvas interface
+ ICachedPrimitiveSharedPtr drawBitmapModulated(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XBitmap >& xBitmap,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+ /// See XCanvas interface
+ ICachedPrimitiveSharedPtr drawBitmapModulated(
+ const ::boost::shared_ptr<Bitmap>& rImage,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+
+ private:
+ friend class ImplBitmap;
+
+ const ::boost::scoped_ptr< ImplBitmap > mpImpl;
+ };
+
+ typedef ::boost::shared_ptr< Bitmap > BitmapSharedPtr;
+}
+
+#endif /* INCLUDED_CANVAS_BITMAP_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/rendering/icachedprimitive.hxx b/include/canvas/rendering/icachedprimitive.hxx
new file mode 100644
index 000000000000..f15fed3e72e8
--- /dev/null
+++ b/include/canvas/rendering/icachedprimitive.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_ICACHEDPRIMITIVE_HXX
+#define INCLUDED_CANVAS_ICACHEDPRIMITIVE_HXX
+
+#include <sal/types.h>
+
+#include <boost/shared_ptr.hpp>
+
+
+namespace basegfx
+{
+ class B2IRange;
+ class B2IPoint;
+}
+
+namespace canvas
+{
+ /** Objects with this interface are returned from every Bitmap
+ render operation.
+
+ These objects can be used to implement the
+ rendering::XCachedPrimitive interface, which in turn caches
+ render state and objects to facilitate quick redraws.
+ */
+ struct ICachedPrimitive
+ {
+ virtual ~ICachedPrimitive() {}
+
+ /** Redraw the primitive with the given view state
+
+ Note that the primitive will <em>always</em> be redrawn on
+ the bitmap it was created from.
+ */
+ virtual sal_Int8 redraw( const ::com::sun::star::rendering::ViewState& aState ) const = 0;
+ };
+
+ typedef ::boost::shared_ptr< ICachedPrimitive > ICachedPrimitiveSharedPtr;
+}
+
+#endif /* INCLUDED_CANVAS_ICACHEDPRIMITIVE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/rendering/icolorbuffer.hxx b/include/canvas/rendering/icolorbuffer.hxx
new file mode 100644
index 000000000000..4226a9a6d759
--- /dev/null
+++ b/include/canvas/rendering/icolorbuffer.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_ICOLORBUFFER_HXX
+#define INCLUDED_CANVAS_ICOLORBUFFER_HXX
+
+#include <sal/types.h>
+
+#include <boost/shared_ptr.hpp>
+
+
+namespace canvas
+{
+ /** Interface for a raw memory pixel container
+
+ Use this interface to represent a surface of raw pixel (e.g. a
+ bitmap) to the canvas rendering framework.
+ */
+ struct IColorBuffer
+ {
+ /// The underlying pixel format for this buffer
+ enum Format
+ {
+ // 24-bit RGB pixel format, 8 bits per channel.
+ FMT_R8G8B8,
+
+ // 32-bit ARGB pixel format with alpha, 8 bits per channel.
+ FMT_A8R8G8B8,
+
+ // 32-bit RGB pixel format, 8 bits per channel.
+ FMT_X8R8G8B8,
+
+ // for enum to 32bit
+ FMT_UNKNOWN = static_cast<sal_uInt32>(-1)
+ };
+
+ virtual ~IColorBuffer() {}
+
+ /** Get a pointer to the raw memory bits of the pixel
+ */
+ virtual sal_uInt8* lock() const = 0;
+
+ /** unlock previous locked buffer
+ */
+ virtual void unlock() const = 0;
+
+ /** Get width in pixel
+ */
+ virtual sal_uInt32 getWidth() const = 0;
+
+ /** Get height in pixel
+ */
+ virtual sal_uInt32 getHeight() const = 0;
+
+ /** Offset, in bytes, between consecutive scan lines of the bitmap.
+ If the stride is positive, the bitmap is top-down.
+ If the stride is negative, the bitmap is bottom-up.
+ The returned value is only valid while the buffer is locked.
+ */
+ virtual sal_uInt32 getStride() const = 0;
+
+ /** Get format of the color buffer
+ */
+ virtual Format getFormat() const = 0;
+ };
+
+ typedef ::boost::shared_ptr< IColorBuffer > IColorBufferSharedPtr;
+}
+
+#endif /* INCLUDED_CANVAS_ICOLORBUFFER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/rendering/irendermodule.hxx b/include/canvas/rendering/irendermodule.hxx
new file mode 100644
index 000000000000..413320eb85e9
--- /dev/null
+++ b/include/canvas/rendering/irendermodule.hxx
@@ -0,0 +1,143 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_IRENDERMODULE_HXX
+#define INCLUDED_CANVAS_IRENDERMODULE_HXX
+
+#include <sal/types.h>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/utility.hpp>
+
+
+namespace basegfx
+{
+ class B2DRange;
+ class B2IRange;
+ class B2IVector;
+ class B2IPoint;
+}
+
+namespace canvas
+{
+ struct ISurface;
+
+ struct Vertex
+ {
+ float r,g,b,a;
+ float u,v;
+ float x,y,z;
+ };
+
+ /** Output module interface for backend render implementations.
+
+ Implement this interface for each operating system- or
+ library-specific rendering backend, which needs coupling with
+ the canvas rendering framework (which can be shared between
+ all backend implementations).
+ */
+ struct IRenderModule
+ {
+ /** Type of primitive passed to the render module via
+ pushVertex()
+ */
+ enum PrimitiveType
+ {
+ PRIMITIVE_TYPE_UNKNOWN,
+ PRIMITIVE_TYPE_TRIANGLE,
+ PRIMITIVE_TYPE_QUAD
+ };
+
+ virtual ~IRenderModule() {}
+
+ /// Lock rendermodule against concurrent access
+ virtual void lock() const = 0;
+
+ /// Unlock rendermodule for concurrent access
+ virtual void unlock() const = 0;
+
+ /** Maximal size of VRAM pages available
+
+ This is typically the maximum texture size of the
+ hardware, or some arbitrary limit if the backend is
+ software.
+ */
+ virtual ::basegfx::B2IVector getPageSize() = 0;
+
+ /** Create a (possibly hardware-accelerated) surface
+
+ @return a pointer to a surface, which is an abstraction of
+ a piece of (possibly hardware-accelerated) texture memory.
+ */
+ virtual ::boost::shared_ptr<ISurface> createSurface( const ::basegfx::B2IVector& surfaceSize ) = 0;
+
+ /** Begin rendering the given primitive.
+
+ Each beginPrimitive() call must be matched with an
+ endPrimitive() call.
+ */
+ virtual void beginPrimitive( PrimitiveType eType ) = 0;
+
+ /** Finish rendering a primitive.
+
+ Each beginPrimitive() call must be matched with an
+ endPrimitive() call.
+ */
+ virtual void endPrimitive() = 0;
+
+ /** Add given vertex to current primitive
+
+ After issuing a beginPrimitive(), each pushVertex() adds a
+ vertex to the active primitive.
+ */
+ virtual void pushVertex( const Vertex& vertex ) = 0;
+
+ /** Query error status
+
+ @returns true, if an error occurred during primitive
+ construction.
+ */
+ virtual bool isError() = 0;
+ };
+
+ typedef ::boost::shared_ptr< IRenderModule > IRenderModuleSharedPtr;
+
+ /// Little RAII wrapper for guarding access to IRenderModule interface
+ class RenderModuleGuard : private ::boost::noncopyable
+ {
+ public:
+ explicit RenderModuleGuard( const IRenderModuleSharedPtr& rRenderModule ) :
+ mpRenderModule( rRenderModule )
+ {
+ mpRenderModule->lock();
+ }
+
+ ~RenderModuleGuard()
+ {
+ mpRenderModule->unlock();
+ }
+
+ private:
+ const IRenderModuleSharedPtr mpRenderModule;
+ };
+}
+
+#endif /* INCLUDED_CANVAS_IRENDERMODULE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/rendering/isurface.hxx b/include/canvas/rendering/isurface.hxx
new file mode 100644
index 000000000000..a79faf96a8c8
--- /dev/null
+++ b/include/canvas/rendering/isurface.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_ISURFACE_HXX
+#define INCLUDED_CANVAS_ISURFACE_HXX
+
+#include <sal/types.h>
+
+#include <boost/shared_ptr.hpp>
+
+
+namespace basegfx
+{
+ class B2IRange;
+ class B2IPoint;
+ class B2IVector;
+}
+
+namespace canvas
+{
+ struct IColorBuffer;
+
+ struct ISurface
+ {
+ virtual ~ISurface() {}
+
+ /** Select texture behind this interface to be the current one
+ for primitive output.
+ */
+ virtual bool selectTexture() = 0;
+
+ /** Tells whether the surface is valid or not
+ */
+ virtual bool isValid() = 0;
+
+ /** Update surface content from given IColorBuffer
+
+ This method updates the given subarea of the surface from
+ the given color buffer bits.
+
+ @param rDestPos
+ Position in the surface, where the subset update should
+ have its left, top edge
+
+ @param rSourceRect
+ Size and position of the rectangular subset update in the
+ source color buffer
+
+ @param rSource
+ Source bits to use for the update
+
+ @return true, if the update was successful
+ */
+ virtual bool update( const ::basegfx::B2IPoint& rDestPos,
+ const ::basegfx::B2IRange& rSourceRect,
+ IColorBuffer& rSource ) = 0;
+
+ virtual ::basegfx::B2IVector getSize() = 0;
+ };
+
+ typedef ::boost::shared_ptr< ISurface > ISurfaceSharedPtr;
+}
+
+#endif /* INCLUDED_CANVAS_ISURFACE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/rendering/isurfaceproxy.hxx b/include/canvas/rendering/isurfaceproxy.hxx
new file mode 100644
index 000000000000..f8db605a38d3
--- /dev/null
+++ b/include/canvas/rendering/isurfaceproxy.hxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_ISURFACEPROXY_HXX
+#define INCLUDED_CANVAS_ISURFACEPROXY_HXX
+
+#include <canvas/rendering/irendermodule.hxx>
+
+#include <boost/shared_ptr.hpp>
+
+namespace basegfx
+{
+ class B2DRange;
+ class B2DPoint;
+ class B2DPolyPolygon;
+ class B2DHomMatrix;
+}
+
+namespace canvas
+{
+ struct ISurfaceProxy
+ {
+ virtual ~ISurfaceProxy() {}
+
+ /** Notify the proxy that the color buffer has changed
+ */
+ virtual void setColorBufferDirty() = 0;
+
+ /** Render the surface content to screen.
+
+ @param fAlpha
+ Overall alpha for content
+
+ @param rPos
+ Output position
+
+ @param rTransform
+ Output transformation (does not affect output position)
+ */
+ virtual bool draw( double fAlpha,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DHomMatrix& rTransform ) = 0;
+
+ /** Render the surface content to screen.
+
+ @param fAlpha
+ Overall alpha for content
+
+ @param rPos
+ Output position
+
+ @param rArea
+ Subset of the surface to render. Coordinate system are
+ surface area pixel, given area will be clipped to the
+ surface bounds.
+
+ @param rTransform
+ Output transformation (does not affect output position)
+ */
+ virtual bool draw( double fAlpha,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DRange& rArea,
+ const ::basegfx::B2DHomMatrix& rTransform ) = 0;
+
+ /** Render the surface content to screen.
+
+ @param fAlpha
+ Overall alpha for content
+
+ @param rPos
+ Output position
+
+ @param rClipPoly
+ Clip polygon for the surface. The clip polygon is also
+ subject to the output transformation.
+
+ @param rTransform
+ Output transformation (does not affect output position)
+ */
+ virtual bool draw( double fAlpha,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DPolyPolygon& rClipPoly,
+ const ::basegfx::B2DHomMatrix& rTransform ) = 0;
+ };
+
+ typedef ::boost::shared_ptr< ISurfaceProxy > ISurfaceProxySharedPtr;
+}
+
+#endif /* INCLUDED_CANVAS_ISURFACEPROXY_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/rendering/isurfaceproxymanager.hxx b/include/canvas/rendering/isurfaceproxymanager.hxx
new file mode 100644
index 000000000000..98c7795a293e
--- /dev/null
+++ b/include/canvas/rendering/isurfaceproxymanager.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_ISURFACEPROXYMANAGER_HXX
+#define INCLUDED_CANVAS_ISURFACEPROXYMANAGER_HXX
+
+#include <canvas/rendering/irendermodule.hxx>
+#include <canvas/rendering/icolorbuffer.hxx>
+
+#include <boost/shared_ptr.hpp>
+
+#include <canvas/canvastoolsdllapi.h>
+
+namespace canvas
+{
+ struct ISurfaceProxy;
+
+ /** Manager interface, which handles surface proxy objects.
+
+ Typically, each canvas instantiation has one
+ SurfaceProxyManager object, to handle their surfaces. Surfaces
+ itself are opaque objects, which encapsulate a framebuffer to
+ render upon, plus an optional (possibly accelerated) texture.
+ */
+ struct ISurfaceProxyManager
+ {
+ virtual ~ISurfaceProxyManager() {}
+
+ /** Create a surface proxy for a color buffer.
+
+ The whole idea is build around the concept that you create
+ some arbitrary buffer which contains the image data and
+ tell the texture manager about it. From there on you can
+ draw into this image using any kind of graphics api you
+ want. In the technical sense we allocate some space in
+ local videomemory or AGP memory which will be filled on
+ demand, which means if there exists any rendering
+ operation that needs to read from this memory location.
+ This method creates a logical hardware surface object
+ which uses the given color buffer as the image source.
+ Internally this texture may even be distributed to several
+ real hardware surfaces.
+ */
+ virtual ::boost::shared_ptr< ISurfaceProxy > createSurfaceProxy(
+ const IColorBufferSharedPtr& pBuffer ) const = 0;
+ };
+
+ typedef ::boost::shared_ptr< ISurfaceProxyManager > ISurfaceProxyManagerSharedPtr;
+
+
+ /** Create a surface proxy for the given render module.
+ */
+ CANVASTOOLS_DLLPUBLIC ISurfaceProxyManagerSharedPtr createSurfaceProxyManager( const IRenderModuleSharedPtr& rRenderModule );
+}
+
+#endif /* INCLUDED_CANVAS_ISURFACEPROXYMANAGER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/spriteredrawmanager.hxx b/include/canvas/spriteredrawmanager.hxx
new file mode 100644
index 000000000000..7609b4f8f4a6
--- /dev/null
+++ b/include/canvas/spriteredrawmanager.hxx
@@ -0,0 +1,429 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_SPRITEREDRAWMANAGER_HXX
+#define INCLUDED_CANVAS_SPRITEREDRAWMANAGER_HXX
+
+#include <basegfx/range/b2dconnectedranges.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/range/b2irange.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <canvas/base/spritesurface.hxx>
+
+#include <list>
+#include <vector>
+#include <algorithm>
+
+#include <boost/utility.hpp>
+#include <boost/bind.hpp>
+
+#include <canvas/canvastoolsdllapi.h>
+
+/* Definition of SpriteRedrawManager class */
+
+namespace canvas
+{
+ /** This class manages smooth SpriteCanvas updates
+
+ Use this class to handle the ::canvas::SpriteSurface methods,
+ that track and process sprite update events. Recorded update
+ events are later grouped by connected areas (i.e. all sprites
+ that somehow overlap over a rectangular area are grouped
+ together); the forEachSpriteArea() method calls the passed
+ functor for each of those connected areas.
+
+ Note that, although this class generally works with IEEE
+ doubles, the calculation of connected areas happens in the
+ integer domain - it is generally expected that repaints can
+ only be divided at pixel boundaries, without causing visible
+ artifacts. Therefore, sprites that touch the same pixel (but
+ don't necessarily have the same floating point coordinates
+ there) will reside in a common sprite area and handled
+ together in the forEachSpriteArea functor call.
+ */
+ class CANVASTOOLS_DLLPUBLIC SpriteRedrawManager : private ::boost::noncopyable
+ {
+ public:
+ /** Data container for the connected components list
+ */
+ class SpriteInfo
+ {
+ public:
+ ~SpriteInfo() {}
+
+ /** Create sprite info
+
+ @param rRef
+ Sprite this info represents (might be the NULL ref)
+
+ @param rTrueUpdateArea
+ True (un-rounded) update area this sprite has recorded
+
+ @param bNeedsUpdate
+ When false, this sprite is not a member of the change
+ record list. Thus, it only needs redraw if within the
+ update area of other, changed sprites.
+
+ @internal
+ */
+ SpriteInfo( const Sprite::Reference& rRef,
+ const ::basegfx::B2DRange& rTrueUpdateArea,
+ bool bNeedsUpdate ) :
+ mpSprite( rRef ),
+ maTrueUpdateArea( rTrueUpdateArea ),
+ mbNeedsUpdate( bNeedsUpdate ),
+ mbIsPureMove( false )
+ {
+ }
+
+ /** Create sprite info, specify move type
+
+ @param rRef
+ Sprite this info represents (might be the NULL ref)
+
+ @param rTrueUpdateArea
+ True (un-rounded) update area this sprite has recorded
+
+ @param bNeedsUpdate
+ When false, this sprite is not a member of the change
+ record list. Thus, it only needs redraw if within the
+ update area of other, changed sprites.
+
+ @param bIsPureMove
+ When true, this sprite is _only_ moved, no other
+ changes happened.
+
+ @internal
+ */
+ SpriteInfo( const Sprite::Reference& rRef,
+ const ::basegfx::B2DRange& rTrueUpdateArea,
+ bool bNeedsUpdate,
+ bool bIsPureMove ) :
+ mpSprite( rRef ),
+ maTrueUpdateArea( rTrueUpdateArea ),
+ mbNeedsUpdate( bNeedsUpdate ),
+ mbIsPureMove( bIsPureMove )
+ {
+ }
+
+ const Sprite::Reference& getSprite() const { return mpSprite; }
+
+ // #i61843# need to return by value here, to be used safely from bind
+ ::basegfx::B2DRange getUpdateArea() const { return maTrueUpdateArea; }
+ bool needsUpdate() const { return mbNeedsUpdate; }
+ bool isPureMove() const { return mbIsPureMove; }
+
+ private:
+ Sprite::Reference mpSprite;
+ ::basegfx::B2DRange maTrueUpdateArea;
+ bool mbNeedsUpdate;
+ bool mbIsPureMove;
+ };
+
+
+ /** Helper struct for SpriteTracer template
+
+ This struct stores change information to a sprite's visual
+ appearance (move, content updated, and the like).
+ */
+ struct SpriteChangeRecord
+ {
+ typedef enum{ none=0, move, update } ChangeType;
+
+ SpriteChangeRecord() :
+ meChangeType( none ),
+ mpAffectedSprite(),
+ maOldPos(),
+ maUpdateArea()
+ {
+ }
+
+ SpriteChangeRecord( const Sprite::Reference& rSprite,
+ const ::basegfx::B2DPoint& rOldPos,
+ const ::basegfx::B2DPoint& rNewPos,
+ const ::basegfx::B2DVector& rSpriteSize ) :
+ meChangeType( move ),
+ mpAffectedSprite( rSprite ),
+ maOldPos( rOldPos ),
+ maUpdateArea( rNewPos.getX(),
+ rNewPos.getY(),
+ rNewPos.getX() + rSpriteSize.getX(),
+ rNewPos.getY() + rSpriteSize.getY() )
+ {
+ }
+
+ SpriteChangeRecord( const Sprite::Reference& rSprite,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DRange& rUpdateArea ) :
+ meChangeType( update ),
+ mpAffectedSprite( rSprite ),
+ maOldPos( rPos ),
+ maUpdateArea( rUpdateArea )
+ {
+ }
+
+ Sprite::Reference getSprite() const { return mpAffectedSprite; }
+
+ ChangeType meChangeType;
+ Sprite::Reference mpAffectedSprite;
+ ::basegfx::B2DPoint maOldPos;
+ ::basegfx::B2DRange maUpdateArea;
+ };
+
+ typedef ::std::vector< SpriteChangeRecord > VectorOfChangeRecords;
+ typedef ::std::list< Sprite::Reference > ListOfSprites;
+ typedef ::basegfx::B2DConnectedRanges< SpriteInfo > SpriteConnectedRanges;
+ typedef SpriteConnectedRanges::ComponentType AreaComponent;
+ typedef SpriteConnectedRanges::ConnectedComponents UpdateArea;
+ typedef ::std::vector< Sprite::Reference > VectorOfSprites;
+
+ SpriteRedrawManager();
+
+ /** Must be called when user of this object gets
+ disposed. Frees all internal references.
+ */
+ void disposing();
+
+ /** Functor, to be used from forEachSpriteArea
+ */
+ template< typename Functor > struct AreaUpdateCaller
+ {
+ AreaUpdateCaller( Functor& rFunc,
+ const SpriteRedrawManager& rManager ) :
+ mrFunc( rFunc ),
+ mrManager( rManager )
+ {
+ }
+
+ void operator()( const UpdateArea& rUpdateArea )
+ {
+ mrManager.handleArea( mrFunc, rUpdateArea );
+ }
+
+ Functor& mrFunc;
+ const SpriteRedrawManager& mrManager;
+ };
+
+ /** Call given functor for each sprite area that needs an
+ update.
+
+ This method calls the given functor for each update area
+ (calculated from the sprite change records).
+
+ @tpl Functor
+ Must provide the following four methods:
+ <pre>
+ void backgroundPaint( ::basegfx::B2DRange aUpdateRect );
+ void scrollUpdate( ::basegfx::B2DRange& o_rMoveStart,
+ ::basegfx::B2DRange& o_rMoveEnd,
+ UpdateArea aUpdateArea );
+ void opaqueUpdate( const ::basegfx::B2DRange& rTotalArea,
+ const ::std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites );
+ void genericUpdate( const ::basegfx::B2DRange& rTotalArea,
+ const ::std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites );
+ </pre>
+ The backgroundPaint() method is called to simply repaint
+ background content, the scrollUpdate() method is used to
+ scroll a given area, and paint background in the uncovered
+ areas, the opaqueUpdate() method is called when a sprite
+ can be painted in the given area without taking background
+ content into account, and finally, genericUpdate() is
+ called for complex updates, where first the background and
+ then all sprites consecutively have to be repainted.
+ */
+ template< typename Functor > void forEachSpriteArea( Functor& rFunc ) const
+ {
+ SpriteConnectedRanges aUpdateAreas;
+
+ setupUpdateAreas( aUpdateAreas );
+
+ aUpdateAreas.forEachAggregate(
+ AreaUpdateCaller< Functor >( rFunc, *this ) );
+ }
+
+ /** Call given functor for each active sprite.
+
+ This method calls the given functor for each active
+ sprite, in the order of sprite priority.
+
+ @tpl Functor
+ Must provide a Functor::operator( Sprite::Reference& )
+ method.
+ */
+ template< typename Functor > void forEachSprite( const Functor& rFunc ) const
+ {
+ ::std::for_each( maSprites.begin(),
+ maSprites.end(),
+ rFunc );
+ }
+
+ /// Clear sprite change records (typically directly after a screen update)
+ void clearChangeRecords();
+
+ // SpriteSurface interface, is delegated to e.g. from SpriteCanvas
+ void showSprite( const Sprite::Reference& rSprite );
+ void hideSprite( const Sprite::Reference& rSprite );
+ void moveSprite( const Sprite::Reference& rSprite,
+ const ::basegfx::B2DPoint& rOldPos,
+ const ::basegfx::B2DPoint& rNewPos,
+ const ::basegfx::B2DVector& rSpriteSize );
+ void updateSprite( const Sprite::Reference& rSprite,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DRange& rUpdateArea );
+
+ /** Internal, handles each distinct component for forEachAggregate()
+
+ The reason why this must be public is that it needs to be
+ accessible from the AreaUpdateCaller functor.
+
+ @internal
+ */
+ template< typename Functor > void handleArea( Functor& rFunc,
+ const UpdateArea& rUpdateArea ) const
+ {
+ // check whether this area contains changed sprites at all
+ // (if not, just ignore it)
+ if( areSpritesChanged( rUpdateArea ) )
+ {
+ // at least one of the sprites actually needs an
+ // update - process whole area.
+
+ // check whether this area could be handled special
+ // (background paint, direct update, scroll, etc.)
+ ::basegfx::B2DRange aMoveStart;
+ ::basegfx::B2DRange aMoveEnd;
+ if( rUpdateArea.maComponentList.empty() )
+ {
+ rFunc.backgroundPaint( rUpdateArea.maTotalBounds );
+ }
+ else
+ {
+ // cache number of sprites in this area (it's a
+ // list, and both isAreaUpdateScroll() and
+ // isAreaUpdateOpaque() need it).
+ const ::std::size_t nNumSprites(
+ rUpdateArea.maComponentList.size() );
+
+ if( isAreaUpdateScroll( aMoveStart,
+ aMoveEnd,
+ rUpdateArea,
+ nNumSprites ) )
+ {
+ rFunc.scrollUpdate( aMoveStart,
+ aMoveEnd,
+ rUpdateArea );
+ }
+ else
+ {
+ // potentially, more than a single sprite
+ // involved. Have to sort component lists for
+ // sprite prio.
+ VectorOfSprites aSortedUpdateSprites;
+ SpriteConnectedRanges::ComponentListType::const_iterator aCurr(
+ rUpdateArea.maComponentList.begin() );
+ const SpriteConnectedRanges::ComponentListType::const_iterator aEnd(
+ rUpdateArea.maComponentList.end() );
+ while( aCurr != aEnd )
+ {
+ const Sprite::Reference& rSprite( aCurr->second.getSprite() );
+ if( rSprite.is() )
+ aSortedUpdateSprites.push_back( rSprite );
+
+ ++aCurr;
+ }
+
+ ::std::sort( aSortedUpdateSprites.begin(),
+ aSortedUpdateSprites.end(),
+ SpriteWeakOrder() );
+
+ if( isAreaUpdateOpaque( rUpdateArea,
+ nNumSprites ) )
+ {
+ rFunc.opaqueUpdate( rUpdateArea.maTotalBounds,
+ aSortedUpdateSprites );
+ }
+ else
+ {
+ rFunc.genericUpdate( rUpdateArea.maTotalBounds,
+ aSortedUpdateSprites );
+ }
+ }
+ }
+ }
+ }
+
+ private:
+ /** Central method of this class. Calculates the set of
+ disjunct components that need an update.
+ */
+ void setupUpdateAreas( SpriteConnectedRanges& rUpdateAreas ) const;
+
+ bool areSpritesChanged( const UpdateArea& rUpdateArea ) const;
+
+ bool isAreaUpdateNotOpaque( const ::basegfx::B2DRange& rUpdateRect,
+ const AreaComponent& rComponent ) const;
+
+ bool isAreaUpdateOpaque( const UpdateArea& rUpdateArea,
+ ::std::size_t nNumSprites ) const;
+
+ /** Check whether given update area can be handled by a simple
+ scroll
+
+ @param o_rMoveStart
+ Start rect of the move
+
+ @param o_rMoveEnd
+ End rect of the move. The content must be moved from start
+ to end rect
+
+ @param rUpdateArea
+ Area to check for scroll update optimization
+ */
+ bool isAreaUpdateScroll( ::basegfx::B2DRange& o_rMoveStart,
+ ::basegfx::B2DRange& o_rMoveEnd,
+ const UpdateArea& rUpdateArea,
+ ::std::size_t nNumSprites ) const;
+
+
+ ListOfSprites maSprites; // list of active
+ // sprite
+ // objects. this
+ // list is only
+ // used for full
+ // repaints,
+ // otherwise, we
+ // rely on the
+ // active sprites
+ // itself to notify
+ // us.
+
+ VectorOfChangeRecords maChangeRecords; // vector of
+ // sprites
+ // changes
+ // since last
+ // updateScreen()
+ // call
+ };
+}
+
+#endif /* INCLUDED_CANVAS_SPRITEREDRAWMANAGER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/vclwrapper.hxx b/include/canvas/vclwrapper.hxx
new file mode 100644
index 000000000000..330e88cb88ad
--- /dev/null
+++ b/include/canvas/vclwrapper.hxx
@@ -0,0 +1,141 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_VCLWRAPPER_HXX
+#define INCLUDED_CANVAS_VCLWRAPPER_HXX
+
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+namespace canvas
+{
+ namespace vcltools
+ {
+ /** This helper template wraps VCL objects, and protects
+ object deletion with the Solar mutex. All other operations
+ are unprotected, this must be handled by client code.
+
+ The reason for this template is the fact that VCL objects
+ hold by value in uno::Reference-handled classes are
+ deleted without having the chance to get inbetween and
+ lock the solar mutex.
+
+ This template handles that problem transparently, the only
+ inconvenience is the fact that object member access now
+ has to be performed via operator->, since . is not
+ overloadable.
+
+ Otherwise, the template preserves the value semantics of
+ the wrapped object, that is, copy operations are performed
+ not by copying pointers, but by copying the underlying
+ object. This includes constness, i.e. on a const
+ VCLObject, only const methods of the wrapped object can be
+ called. Simply imagine this to be a value object of type
+ "template argument", with the only peculiarity that
+ member/method access is performed by operator-> instead of
+ the non-existing "operator.".
+ */
+ template< class _Wrappee > class VCLObject
+ {
+ public:
+ typedef _Wrappee Wrappee;
+
+ VCLObject() :
+ mpWrappee( new Wrappee() )
+ {
+ }
+
+ // no explicit here. VCLObjects should be freely
+ // constructible with Wrappees, and AFAIK there is no other
+ // implicit conversion path that could cause harm here
+ VCLObject( Wrappee* pWrappee ) :
+ mpWrappee( pWrappee )
+ {
+ }
+
+ // This object has value semantics, thus, forward copy
+ // to wrappee
+ VCLObject( const VCLObject& rOrig )
+ {
+ if( rOrig.mpWrappee )
+ mpWrappee = new Wrappee( *rOrig.mpWrappee );
+ else
+ mpWrappee = NULL;
+ }
+
+ // This object has value semantics, thus, forward copy
+ // to wrappee
+ VCLObject( const Wrappee& rOrig ) :
+ mpWrappee( new Wrappee( rOrig ) )
+ {
+ }
+
+ // This object has value semantics, thus, forward
+ // assignment to wrappee
+ VCLObject& operator=( const VCLObject& rhs )
+ {
+ if( mpWrappee )
+ {
+ if( rhs.mpWrappee )
+ *mpWrappee = *rhs.mpWrappee;
+ }
+ else
+ {
+ if( rhs.mpWrappee )
+ mpWrappee = new Wrappee( *rhs.mpWrappee );
+ }
+
+ return *this;
+ }
+
+ ~VCLObject()
+ {
+ // This here is the whole purpose of the template:
+ // protecting object deletion with the solar mutex
+ SolarMutexGuard aGuard;
+
+ if( mpWrappee )
+ delete mpWrappee;
+ }
+
+ Wrappee* operator->() { return mpWrappee; }
+ const Wrappee* operator->() const { return mpWrappee; }
+
+ Wrappee& operator*() { return *mpWrappee; }
+ const Wrappee& operator*() const { return *mpWrappee; }
+
+ Wrappee& get() { return *mpWrappee; }
+ const Wrappee& get() const { return *mpWrappee; }
+
+ void swap( VCLObject& rOther )
+ {
+ ::std::swap( mpWrappee, rOther.mpWrappee );
+ }
+
+ private:
+
+ Wrappee* mpWrappee;
+ };
+
+ }
+}
+
+#endif /* INCLUDED_CANVAS_VCLWRAPPER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/verbosetrace.hxx b/include/canvas/verbosetrace.hxx
new file mode 100644
index 000000000000..d3810c4deaad
--- /dev/null
+++ b/include/canvas/verbosetrace.hxx
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_VERBOSETRACE_HXX
+#define INCLUDED_CANVAS_VERBOSETRACE_HXX
+
+#include "sal/config.h"
+
+#include "sal/detail/log.h"
+
+#define VERBOSE_TRACE(...) \
+ SAL_DETAIL_INFO_IF_FORMAT(true, "canvas.level2", __VA_ARGS__)
+
+#endif /* INCLUDED_CANVAS_VERBOSETRACE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/verifyinput.hxx b/include/canvas/verifyinput.hxx
new file mode 100644
index 000000000000..07d72b32ff6c
--- /dev/null
+++ b/include/canvas/verifyinput.hxx
@@ -0,0 +1,667 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_VERIFYINPUT_HXX
+#define INCLUDED_CANVAS_VERIFYINPUT_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+
+#include <algorithm>
+#include <boost/bind.hpp>
+#include <boost/current_function.hpp>
+
+#include <canvas/canvastoolsdllapi.h>
+
+namespace com { namespace sun { namespace star { namespace geometry
+{
+ struct RealPoint2D;
+ struct RealSize2D;
+ struct RealBezierSegment2D;
+ struct RealRectangle2D;
+ struct AffineMatrix2D;
+ struct Matrix2D;
+ struct IntegerPoint2D;
+ struct IntegerSize2D;
+ struct IntegerRectangle2D;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace rendering
+{
+ struct RenderState;
+ struct StrokeAttributes;
+ struct Texture;
+ struct ViewState;
+ struct IntegerBitmapLayout;
+ struct FontRequest;
+ struct FontInfo;
+ class XCanvas;
+} } } }
+
+
+namespace canvas
+{
+ namespace tools
+ {
+
+ // Input checking facilities
+ // ===================================================================
+
+ // This header provides methods to check all common
+ // css::rendering::* method input parameters against
+ // compliance to the API specification.
+
+ /** Verify that the given transformation contains valid floating point
+ values.
+
+ @param rMatrix
+ Matrix to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws an lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::geometry::AffineMatrix2D& rMatrix,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos );
+
+ /** Verify that the given transformation contains valid floating point
+ values.
+
+ @param rMatrix
+ Matrix to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws an lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::geometry::Matrix2D& rMatrix,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos );
+
+ /** Verify that the given point contains valid floating point
+ values.
+
+ @param rPoint
+ Point to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws an lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::geometry::RealPoint2D& rPoint,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos );
+
+ /** Verify that the given bezier segment contains valid
+ floating point values.
+
+ @param rSegment
+ Segment to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws an lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::geometry::RealBezierSegment2D& rSegment,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos );
+
+ /** Verify that the given point contains valid floating point
+ values.
+
+ @param rPoint
+ Point to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws an lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::geometry::RealPoint2D& rPoint,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos );
+
+ /** Verify that the given rectangle contains valid floating
+ point values.
+
+ @param rRect
+ Rect to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws an lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::geometry::RealRectangle2D& rRect,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos );
+
+ /** Basic check for view state validity.
+
+ @param viewState
+ Viewstate to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws an lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::rendering::ViewState& viewState,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos );
+
+ /** Basic check for render state validity.
+
+ @param renderState
+ Renderstate to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @param nMinColorComponents
+ Minimal number of color components available in
+ RenderState::DeviceColor
+
+ @throws an lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::rendering::RenderState& renderState,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos,
+ sal_Int32 nMinColorComponents=0 );
+
+ /** Basic check for stroke attributes validity.
+
+ @param strokeAttributes
+ Attributes to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws an lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos );
+
+ /** Basic check for texture validity.
+
+ @param texture
+ Texture to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws an lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::rendering::Texture& texture,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos );
+
+ /** Basic check for bitmap layout validity.
+
+ @param bitmapLayout
+ Bitmap layout to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws an lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos );
+
+ /** Basic check for font info validity.
+
+ @param fontInfo
+ Font info to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws an lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::rendering::FontInfo& fontInfo,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos );
+
+ /** Basic check for font request validity.
+
+ @param fontRequest
+ Font request to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws an lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::rendering::FontRequest& fontRequest,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos );
+
+ /** Templatized check for uno::Reference validity.
+
+ @param rRef
+ Reference to check against non-NILness
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws an lang::IllegalArgumentException, if anything is wrong
+ */
+ template< class Interface > void verifyInput(
+ const ::com::sun::star::uno::Reference< Interface >& rRef,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos )
+ {
+ (void)pStr; (void)xIf; (void)nArgPos;
+
+ if( !rRef.is() )
+ {
+#if OSL_DEBUG_LEVEL > 0
+ throw ::com::sun::star::lang::IllegalArgumentException(
+ OUString::createFromAscii(pStr) + ": reference is NULL",
+ xIf,
+ nArgPos );
+#else
+ throw ::com::sun::star::lang::IllegalArgumentException();
+#endif
+ }
+ }
+
+ /** Templatized check for content-of-sequence validity.
+
+ @param rSequence
+ Sequence of things to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws an lang::IllegalArgumentException, if anything is wrong
+ */
+ template< typename SequenceContent > void verifyInput(
+ const ::com::sun::star::uno::Sequence< SequenceContent >& rSequence,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos )
+ {
+ const SequenceContent* pCurr = rSequence.getConstArray();
+ const SequenceContent* pEnd = pCurr + rSequence.getLength();
+ while( pCurr != pEnd )
+ verifyInput( *pCurr++, pStr, xIf, nArgPos );
+ }
+
+ /// Catch-all, to handle cases that DON'T need input checking (i.e. the Integer geometry ones)
+ template< typename T > void verifyInput( const T& /*rDummy*/,
+ const char* /*pStr*/,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& /*xIf*/,
+ ::sal_Int16 /*nArgPos*/ )
+ {
+ }
+
+ // TODO(Q2): Employ some template arglist magic here, to avoid
+ // this duplication of code...
+
+ template< typename Arg0 > void verifyArgs( const Arg0& rArg0,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf )
+ {
+ verifyInput( rArg0, pStr, xIf, 0 );
+ }
+
+ template< typename Arg0,
+ typename Arg1 > void verifyArgs( const Arg0& rArg0,
+ const Arg1& rArg1,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf )
+ {
+ verifyInput( rArg0, pStr, xIf, 0 );
+ verifyInput( rArg1, pStr, xIf, 1 );
+ }
+
+ template< typename Arg0,
+ typename Arg1,
+ typename Arg2 > void verifyArgs( const Arg0& rArg0,
+ const Arg1& rArg1,
+ const Arg2& rArg2,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf )
+ {
+ verifyInput( rArg0, pStr, xIf, 0 );
+ verifyInput( rArg1, pStr, xIf, 1 );
+ verifyInput( rArg2, pStr, xIf, 2 );
+ }
+
+ template< typename Arg0,
+ typename Arg1,
+ typename Arg2,
+ typename Arg3 > void verifyArgs( const Arg0& rArg0,
+ const Arg1& rArg1,
+ const Arg2& rArg2,
+ const Arg3& rArg3,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf )
+ {
+ verifyInput( rArg0, pStr, xIf, 0 );
+ verifyInput( rArg1, pStr, xIf, 1 );
+ verifyInput( rArg2, pStr, xIf, 2 );
+ verifyInput( rArg3, pStr, xIf, 3 );
+ }
+
+ template< typename Arg0,
+ typename Arg1,
+ typename Arg2,
+ typename Arg3,
+ typename Arg4 > void verifyArgs( const Arg0& rArg0,
+ const Arg1& rArg1,
+ const Arg2& rArg2,
+ const Arg3& rArg3,
+ const Arg4& rArg4,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf )
+ {
+ verifyInput( rArg0, pStr, xIf, 0 );
+ verifyInput( rArg1, pStr, xIf, 1 );
+ verifyInput( rArg2, pStr, xIf, 2 );
+ verifyInput( rArg3, pStr, xIf, 3 );
+ verifyInput( rArg4, pStr, xIf, 4 );
+ }
+
+ template< typename Arg0,
+ typename Arg1,
+ typename Arg2,
+ typename Arg3,
+ typename Arg4,
+ typename Arg5 > void verifyArgs( const Arg0& rArg0,
+ const Arg1& rArg1,
+ const Arg2& rArg2,
+ const Arg3& rArg3,
+ const Arg4& rArg4,
+ const Arg5& rArg5,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf )
+ {
+ verifyInput( rArg0, pStr, xIf, 0 );
+ verifyInput( rArg1, pStr, xIf, 1 );
+ verifyInput( rArg2, pStr, xIf, 2 );
+ verifyInput( rArg3, pStr, xIf, 3 );
+ verifyInput( rArg4, pStr, xIf, 4 );
+ verifyInput( rArg5, pStr, xIf, 5 );
+ }
+
+ template< typename Arg0,
+ typename Arg1,
+ typename Arg2,
+ typename Arg3,
+ typename Arg4,
+ typename Arg5,
+ typename Arg6 > void verifyArgs( const Arg0& rArg0,
+ const Arg1& rArg1,
+ const Arg2& rArg2,
+ const Arg3& rArg3,
+ const Arg4& rArg4,
+ const Arg5& rArg5,
+ const Arg6& rArg6,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf )
+ {
+ verifyInput( rArg0, pStr, xIf, 0 );
+ verifyInput( rArg1, pStr, xIf, 1 );
+ verifyInput( rArg2, pStr, xIf, 2 );
+ verifyInput( rArg3, pStr, xIf, 3 );
+ verifyInput( rArg4, pStr, xIf, 4 );
+ verifyInput( rArg5, pStr, xIf, 5 );
+ verifyInput( rArg6, pStr, xIf, 6 );
+ }
+
+
+ /** Range checker, which throws ::com::sun::star::lang::IllegalArgument exception, when
+ range is violated
+ */
+ template< typename NumType > inline void verifyRange( NumType arg, NumType lowerBound, NumType upperBound )
+ {
+ if( arg < lowerBound ||
+ arg > upperBound )
+ {
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ }
+ }
+
+ /** Range checker, which throws ::com::sun::star::lang::IllegalArgument exception, when
+ range is violated
+
+ The checked range is half open, i.e. only bound by the specified value.
+
+ @param arg
+ Arg to check
+
+ @param bound
+ Bound to check against
+
+ @param bLowerBound
+ When true, given bound is the lower bound. When false,
+ given bound is the upper bound.
+ */
+ template< typename NumType > inline void verifyRange( NumType arg, NumType bound, bool bLowerBound=true )
+ {
+ if( (bLowerBound && arg < bound) ||
+ (!bLowerBound && arg > bound) )
+ {
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ }
+ }
+
+ /** Range checker, which throws ::com::sun::star::lang::IndexOutOfBounds exception, when
+ index range is violated
+ */
+ template< typename NumType > inline void verifyIndexRange( NumType arg, NumType lowerBound, NumType upperBound )
+ {
+ if( arg < lowerBound ||
+ arg > upperBound )
+ {
+ throw ::com::sun::star::lang::IndexOutOfBoundsException();
+ }
+ }
+
+ /** Range checker, which throws ::com::sun::star::lang::IndexOutOfBounds exception, when
+ index range is violated
+
+ @param rect
+ Rect to verify
+
+ @param size
+ Given rectangle must be within ((0,0), (size.Width, size.Height))
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyIndexRange( const ::com::sun::star::geometry::IntegerRectangle2D& rect,
+ const ::com::sun::star::geometry::IntegerSize2D& size );
+
+ /** Range checker, which throws ::com::sun::star::lang::IndexOutOfBounds exception, when
+ index range is violated
+
+ @param pos
+ Position to verify
+
+ @param size
+ Given position must be within ((0,0), (size.Width, size.Height))
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyIndexRange( const ::com::sun::star::geometry::IntegerPoint2D& pos,
+ const ::com::sun::star::geometry::IntegerSize2D& size );
+
+ /** Range checker, which throws ::com::sun::star::lang::IndexOutOfBounds exception, when
+ the size is negative or null
+
+ @param size
+ Size to verify
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyBitmapSize( const ::com::sun::star::geometry::IntegerSize2D& size,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf );
+
+ /** Range checker, which throws ::com::sun::star::lang::IndexOutOfBounds exception, when
+ the size is negative or null
+
+ @param size
+ Size to verify
+ */
+ CANVASTOOLS_DLLPUBLIC void verifySpriteSize( const ::com::sun::star::geometry::RealSize2D& size,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf );
+ }
+}
+
+#endif /* INCLUDED_CANVAS_VERIFYINPUT_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/codemaker/codemaker.hxx b/include/codemaker/codemaker.hxx
new file mode 100644
index 000000000000..49d1d4b9cea8
--- /dev/null
+++ b/include/codemaker/codemaker.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CODEMAKER_CODEMAKER_HXX
+#define INCLUDED_CODEMAKER_CODEMAKER_HXX
+
+#include "sal/config.h"
+
+namespace rtl {
+ class OString;
+ class OUString;
+}
+
+namespace codemaker {
+
+rtl::OString convertString(rtl::OUString const & string);
+
+}
+
+#endif // INCLUDED_CODEMAKER_CODEMAKER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/codemaker/commoncpp.hxx b/include/codemaker/commoncpp.hxx
new file mode 100644
index 000000000000..8bff48fc0809
--- /dev/null
+++ b/include/codemaker/commoncpp.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CODEMAKER_COMMONCPP_HXX
+#define INCLUDED_CODEMAKER_COMMONCPP_HXX
+
+#include "sal/config.h"
+
+#include "codemaker/unotype.hxx"
+
+namespace rtl {
+ class OString;
+ class OUString;
+}
+
+namespace codemaker { namespace cpp {
+
+/** Stick a namespace scope to c++ type
+
+ @param type
+ Undecorated type
+
+ @param ns_alias
+ Use common namespace aliases instead of fully specified (nested)
+ namespace. currently replaces com::sun::star with css.
+ */
+rtl::OString scopedCppName(rtl::OString const & type, bool ns_alias=true);
+
+rtl::OString translateUnoToCppType(
+ codemaker::UnoType::Sort sort, rtl::OUString const & nucleus);
+
+enum IdentifierTranslationMode {
+ ITM_GLOBAL,
+ ITM_NONGLOBAL,
+ ITM_KEYWORDSONLY
+};
+
+rtl::OString translateUnoToCppIdentifier(
+ rtl::OString const & identifier, rtl::OString const & prefix,
+ IdentifierTranslationMode transmode = ITM_GLOBAL,
+ rtl::OString const * forbidden = 0);
+
+} }
+
+#endif // INCLUDED_CODEMAKER_COMMONCPP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/codemaker/commonjava.hxx b/include/codemaker/commonjava.hxx
new file mode 100644
index 000000000000..54d9403cda57
--- /dev/null
+++ b/include/codemaker/commonjava.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CODEMAKER_COMMONJAVA_HXX
+#define INCLUDED_CODEMAKER_COMMONJAVA_HXX
+
+#include "sal/config.h"
+
+#include "codemaker/unotype.hxx"
+
+namespace rtl { class OString; }
+
+namespace codemaker { namespace java {
+
+rtl::OString translateUnoToJavaType(
+ codemaker::UnoType::Sort sort, rtl::OString const & nucleus,
+ bool referenceType);
+
+rtl::OString translateUnoToJavaIdentifier(
+ rtl::OString const & identifier, rtl::OString const & prefix);
+
+} }
+
+#endif // INCLUDED_CODEMAKER_COMMONJAVA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/codemaker/exceptiontree.hxx b/include/codemaker/exceptiontree.hxx
new file mode 100644
index 000000000000..5392386a3c07
--- /dev/null
+++ b/include/codemaker/exceptiontree.hxx
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CODEMAKER_EXCEPTIONTREE_HXX
+#define INCLUDED_CODEMAKER_EXCEPTIONTREE_HXX
+
+#include "codemaker/global.hxx"
+#include "rtl/ref.hxx"
+#include "rtl/string.hxx"
+
+#include <vector>
+
+class TypeManager;
+
+namespace codemaker {
+
+/**
+ Represents a node of the hierarchy from the ExceptionTree class.
+ */
+struct ExceptionTreeNode {
+ typedef std::vector< ExceptionTreeNode * > Children;
+
+ // Internally used by ExceptionTree:
+ ExceptionTreeNode(rtl::OString const & theName):
+ name(theName), present(false) {}
+
+ // Internally used by ExceptionTree:
+ ~ExceptionTreeNode() { clearChildren(); }
+
+ // Internally used by ExceptionTree:
+ void setPresent() { present = true; clearChildren(); }
+
+ // Internally used by ExceptionTree:
+ ExceptionTreeNode * add(rtl::OString const & theName);
+
+ rtl::OString name;
+ bool present;
+ Children children;
+
+private:
+ ExceptionTreeNode(ExceptionTreeNode &); // not implemented
+ void operator =(ExceptionTreeNode); // not implemented
+
+ void clearChildren();
+};
+
+/**
+ Represents the hierarchy formed by a set of UNO exception types.
+
+ The hierarchy is rooted at com.sun.star.uno.Exception. For each exception E
+ from the given set S, the hierarchy from com.sun.star.uno.Exception to the
+ first supertype E' of E which is itself a member of S is represented (i.e.,
+ subtypes that are hidden by supertypes are pruned from the hierarchy). The
+ exception com.sun.star.uno.RuntimeException and its subtypes are pruned
+ completely from the hierarchy. Each node of the hierarchy is represented by
+ an instance of ExceptionTreeNode, where name gives the name of the UNO
+ exception type, present is true iff the given exception type is a member of
+ the set S, and children contains all the relevant direct subtypes of the
+ given exception type, in no particular order (for nodes other than the root
+ node it holds that children is non-empty iff present is false).
+ */
+class ExceptionTree {
+public:
+ ExceptionTree(): m_root("com.sun.star.uno.Exception") {}
+
+ ~ExceptionTree() {}
+
+ /**
+ Builds the exception hierarchy, by adding one exception type at a time.
+
+ This function can be called more than once for the same exception name.
+
+ @param name the name of a UNO exception type; it is an error if the given
+ name does not represent a UNO exception type
+
+ @param manager a type manager, used to resolve type names; it is an error
+ if different calls to this member function use different, incompatible
+ type managers
+ */
+ void add(
+ rtl::OString const & name,
+ rtl::Reference< TypeManager > const & manager);
+
+ /**
+ Gives access to the resultant exception hierarchy.
+
+ @return a non-null pointer to the root of the exception hierarchy, as
+ formed by all previous calls to add; it is an error if any calls to add
+ follow the first call to getRoot
+ */
+ ExceptionTreeNode const * getRoot() const { return &m_root; }
+
+private:
+ ExceptionTree(ExceptionTree &); // not implemented
+ void operator =(ExceptionTree); // not implemented
+
+ ExceptionTreeNode m_root;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/codemaker/generatedtypeset.hxx b/include/codemaker/generatedtypeset.hxx
new file mode 100644
index 000000000000..3d1a5615b0b1
--- /dev/null
+++ b/include/codemaker/generatedtypeset.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CODEMAKER_GENERATEDTYPESET_HXX
+#define INCLUDED_CODEMAKER_GENERATEDTYPESET_HXX
+
+#include "rtl/string.hxx"
+
+#include <boost/unordered_set.hpp>
+
+/// @HTML
+
+namespace codemaker {
+
+/**
+ A simple class to track which types have already been processed by a code
+ maker.
+
+ <p>This class is not multi-thread&ndash;safe.</p>
+ */
+class GeneratedTypeSet {
+public:
+ GeneratedTypeSet() {}
+
+ ~GeneratedTypeSet() {}
+
+ /**
+ Add a type to the set of generated types.
+
+ <p>If the type was already present, nothing happens.</p>
+
+ @param type a UNO type registry name
+ */
+ void add(OString const & type) { m_set.insert(type); }
+
+ /**
+ Checks whether a given type has already been generated.
+
+ @param type a UNO type registry name
+
+ @return true iff the given type has already been generated
+ */
+ bool contains(OString const & type) const
+ { return m_set.find(type) != m_set.end(); }
+
+private:
+ GeneratedTypeSet(GeneratedTypeSet &); // not implemented
+ void operator =(GeneratedTypeSet); // not implemented
+
+ boost::unordered_set< OString, OStringHash > m_set;
+};
+
+}
+
+#endif // INCLUDED_CODEMAKER_GENERATEDTYPESET_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/codemaker/global.hxx b/include/codemaker/global.hxx
new file mode 100644
index 000000000000..2c61ce88ec51
--- /dev/null
+++ b/include/codemaker/global.hxx
@@ -0,0 +1,135 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CODEMAKER_GLOBAL_HXX
+#define INCLUDED_CODEMAKER_GLOBAL_HXX
+
+#include <list>
+#include <vector>
+#include <set>
+
+#include <stdio.h>
+
+#include "osl/file.hxx"
+#include "rtl/ustring.hxx"
+#include "rtl/strbuf.hxx"
+
+struct EqualString
+{
+ sal_Bool operator()(const ::rtl::OString& str1, const ::rtl::OString& str2) const
+ {
+ return (str1 == str2);
+ }
+};
+
+struct HashString
+{
+ size_t operator()(const ::rtl::OString& str) const
+ {
+ return str.hashCode();
+ }
+};
+
+struct LessString
+{
+ sal_Bool operator()(const ::rtl::OString& str1, const ::rtl::OString& str2) const
+ {
+ return (str1 < str2);
+ }
+};
+
+typedef ::std::list< ::rtl::OString > StringList;
+typedef ::std::vector< ::rtl::OString > StringVector;
+typedef ::std::set< ::rtl::OString, LessString > StringSet;
+
+//*************************************************************************
+// FileStream
+//*************************************************************************
+enum FileAccessMode
+{
+ FAM_READ, // "r"
+ FAM_WRITE, // "w"
+ FAM_READWRITE_EXIST, // "r+"
+ FAM_READWRITE // "w+"
+};
+
+class FileStream
+{
+public:
+ FileStream();
+ virtual ~FileStream();
+
+ sal_Bool isValid();
+
+ void createTempFile(const ::rtl::OString& sPath);
+ void close();
+
+ ::rtl::OString getName() { return m_name; }
+
+ bool write(void const * buffer, sal_uInt64 size);
+
+ // friend functions
+ friend FileStream &operator<<(FileStream& o, sal_uInt32 i);
+ friend FileStream &operator<<(FileStream& o, char const * s);
+ friend FileStream &operator<<(FileStream& o, ::rtl::OString* s);
+ friend FileStream &operator<<(FileStream& o, const ::rtl::OString& s);
+ friend FileStream &operator<<(FileStream& o, ::rtl::OStringBuffer* s);
+ friend FileStream &operator<<(FileStream& o, const ::rtl::OStringBuffer& s);
+ friend FileStream & operator <<(FileStream & out, rtl::OUString const & s);
+
+private:
+ oslFileHandle m_file;
+ ::rtl::OString m_name;
+};
+
+
+//*************************************************************************
+// Helper functions
+//*************************************************************************
+::rtl::OString getTempDir(const ::rtl::OString& sFileName);
+
+::rtl::OString createFileNameFromType(const ::rtl::OString& destination,
+ const ::rtl::OString type,
+ const ::rtl::OString postfix,
+ sal_Bool bLowerCase=sal_False,
+ const ::rtl::OString prefix="");
+
+sal_Bool fileExists(const ::rtl::OString& fileName);
+sal_Bool makeValidTypeFile(const ::rtl::OString& targetFileName,
+ const ::rtl::OString& tmpFileName,
+ sal_Bool bFileCheck);
+sal_Bool removeTypeFile(const ::rtl::OString& fileName);
+
+::rtl::OUString convertToFileUrl(const ::rtl::OString& fileName);
+
+class CannotDumpException {
+public:
+ CannotDumpException(OUString const & message): message_(message) {}
+
+ virtual ~CannotDumpException() throw ();
+
+ OUString getMessage() const { return message_; }
+
+private:
+ OUString message_;
+};
+
+#endif // INCLUDED_CODEMAKER_GLOBAL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/codemaker/options.hxx b/include/codemaker/options.hxx
new file mode 100644
index 000000000000..4a33e280ca69
--- /dev/null
+++ b/include/codemaker/options.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CODEMAKER_OPTIONS_HXX
+#define INCLUDED_CODEMAKER_OPTIONS_HXX
+
+#include <boost/unordered_map.hpp>
+
+#include <codemaker/global.hxx>
+
+typedef ::boost::unordered_map
+<
+ ::rtl::OString,
+ ::rtl::OString,
+ HashString,
+ EqualString
+> OptionMap;
+
+class IllegalArgument
+{
+public:
+ IllegalArgument(const ::rtl::OString& msg)
+ : m_message(msg) {}
+
+ ::rtl::OString m_message;
+};
+
+class Options
+{
+public:
+ Options();
+ virtual ~Options();
+
+ virtual sal_Bool initOptions(int ac, char* av[], sal_Bool bCmdFile=sal_False)
+ throw( IllegalArgument ) = 0;
+
+ virtual ::rtl::OString prepareHelp() = 0;
+
+ const ::rtl::OString& getProgramName() const;
+ sal_Bool isValid(const ::rtl::OString& option) const;
+ const ::rtl::OString getOption(const ::rtl::OString& option) const
+ throw( IllegalArgument );
+
+ const StringVector& getInputFiles();
+
+ inline sal_uInt16 getNumberOfExtraInputFiles() const
+ { return (sal_uInt16)m_extra_input_files.size(); }
+ inline const StringVector& getExtraInputFiles() const
+ { return m_extra_input_files; }
+protected:
+ ::rtl::OString m_program;
+ StringVector m_inputFiles;
+ StringVector m_extra_input_files;
+ OptionMap m_options;
+};
+
+#endif // INCLUDED_CODEMAKER_OPTIONS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/codemaker/typemanager.hxx b/include/codemaker/typemanager.hxx
new file mode 100644
index 000000000000..fc6aba69ab1d
--- /dev/null
+++ b/include/codemaker/typemanager.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CODEMAKER_TYPEMANAGER_HXX
+#define INCLUDED_CODEMAKER_TYPEMANAGER_HXX
+
+#include "sal/config.h"
+
+#include <vector>
+
+#include "codemaker/unotype.hxx"
+#include "rtl/ref.hxx"
+#include "rtl/string.hxx"
+#include "rtl/textenc.h"
+#include "rtl/ustring.hxx"
+#include "salhelper/simplereferenceobject.hxx"
+
+namespace unoidl {
+ class Entity;
+ class Manager;
+ class MapCursor;
+ class Provider;
+}
+
+class TypeManager: public salhelper::SimpleReferenceObject {
+public:
+ TypeManager();
+
+ void loadProvider(OUString const & uri, bool primary);
+
+ bool foundAtPrimaryProvider(OUString const & name) const;
+
+ codemaker::UnoType::Sort getSort(
+ OUString const & name, rtl::Reference< unoidl::Entity > * entity = 0,
+ rtl::Reference< unoidl::MapCursor > * cursor = 0) const;
+
+ codemaker::UnoType::Sort decompose(
+ OUString const & name, bool resolveTypedefs, OUString * nucleus,
+ sal_Int32 * rank, std::vector< OUString > * arguments,
+ rtl::Reference< unoidl::Entity > * entity) const;
+
+private:
+ virtual ~TypeManager();
+
+ rtl::Reference< unoidl::Manager > manager_;
+ std::vector< rtl::Reference< unoidl::Provider > > primaryProviders_;
+};
+
+
+inline OString u2b(OUString const & s) {
+ return OUStringToOString(s, RTL_TEXTENCODING_UTF8);
+}
+
+inline OUString b2u(OString const & s) {
+ return OStringToOUString(s, RTL_TEXTENCODING_UTF8);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/codemaker/unotype.hxx b/include/codemaker/unotype.hxx
new file mode 100644
index 000000000000..b00de6658a99
--- /dev/null
+++ b/include/codemaker/unotype.hxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CODEMAKER_UNOTYPE_HXX
+#define INCLUDED_CODEMAKER_UNOTYPE_HXX
+
+#include "sal/types.h"
+
+#include <vector>
+
+namespace rtl { class OString; }
+
+namespace codemaker {
+
+namespace UnoType {
+ /**
+ An enumeration of all the sorts of relevant UNOIDL entities.
+ */
+ enum Sort {
+ SORT_VOID,
+ SORT_BOOLEAN,
+ SORT_BYTE,
+ SORT_SHORT,
+ SORT_UNSIGNED_SHORT,
+ SORT_LONG,
+ SORT_UNSIGNED_LONG,
+ SORT_HYPER,
+ SORT_UNSIGNED_HYPER,
+ SORT_FLOAT,
+ SORT_DOUBLE,
+ SORT_CHAR,
+ SORT_STRING,
+ SORT_TYPE,
+ SORT_ANY,
+ SORT_SEQUENCE_TYPE,
+ SORT_MODULE,
+ SORT_ENUM_TYPE,
+ SORT_PLAIN_STRUCT_TYPE,
+ SORT_POLYMORPHIC_STRUCT_TYPE_TEMPLATE,
+ SORT_INSTANTIATED_POLYMORPHIC_STRUCT_TYPE,
+ SORT_EXCEPTION_TYPE,
+ SORT_INTERFACE_TYPE,
+ SORT_TYPEDEF,
+ SORT_CONSTANT_GROUP,
+ SORT_SINGLE_INTERFACE_BASED_SERVICE,
+ SORT_ACCUMULATION_BASED_SERVICE,
+ SORT_INTERFACE_BASED_SINGLETON,
+ SORT_SERVICE_BASED_SINGLETON
+ };
+
+ /**
+ Decomposes a UNO type name or UNO type registry name.
+
+ @param type a binary UNO type name or UNO type registry name
+
+ @param rank if non-null, returns the rank of the denoted UNO type (which
+ is zero for any given type that does not denote a UNO sequence type)
+
+ @param arguments if non-null, the type arguments are stripped from an
+ instantiated polymorphic struct type and returned via this parameter (in
+ the correct order); if null, type arguments are not stripped from
+ instantiated polymorphic struct types
+
+ @return the base part of the given type
+ */
+ rtl::OString decompose(
+ rtl::OString const & type, sal_Int32 * rank = 0,
+ std::vector< rtl::OString > * arguments = 0);
+}
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/ChainablePropertySet.hxx b/include/comphelper/ChainablePropertySet.hxx
new file mode 100644
index 000000000000..2dfe5f3ca256
--- /dev/null
+++ b/include/comphelper/ChainablePropertySet.hxx
@@ -0,0 +1,138 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_CHAINABLEPROPERTYSET_HXX_
+#define _COMPHELPER_CHAINABLEPROPERTYSET_HXX_
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <comphelper/PropertyInfoHash.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+namespace comphelper
+{
+ class ChainablePropertySetInfo;
+}
+
+/*
+ * A ChainablePropertySet has the following features:
+ *
+ * 1. It implements both the PropertySet and MultiPropertySet interfaces.
+ * 2. It can be 'included' in a MasterPropertySet to seamlessly appear as if
+ * if it's properties were in the master.
+ *
+ * To be used as a base class for PropertySets, the subclass must implement
+ * the 6 protected pure virtual functions. If a mutex is passed to the
+ * constructor, this is locked before any call to _getSingleValue or
+ * _setSingleValue and released after all processing has completed
+ * (including _postSetValues or _postGetValues )
+ *
+ * Any MasterPropertySet implementations that can include an
+ * implementation of a given ChainablePropertySet must be
+ * declared as a 'friend' in the implementation of the ChainablePropertySet.
+ *
+ */
+
+namespace comphelper
+{
+ class COMPHELPER_DLLPUBLIC ChainablePropertySet : public ::com::sun::star::beans::XPropertySet,
+ public ::com::sun::star::beans::XPropertyState,
+ public ::com::sun::star::beans::XMultiPropertySet
+ {
+ friend class MasterPropertySet;
+ protected:
+ ChainablePropertySetInfo *mpInfo;
+ osl::SolarMutex* mpMutex;
+ ::com::sun::star::uno::Reference < com::sun::star::beans::XPropertySetInfo > mxInfo;
+
+ virtual void _preSetValues ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) = 0;
+ virtual void _setSingleValue( const comphelper::PropertyInfo & rInfo, const ::com::sun::star::uno::Any &rValue )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) = 0;
+ virtual void _postSetValues ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) = 0;
+
+ virtual void _preGetValues ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) = 0;
+ virtual void _getSingleValue( const comphelper::PropertyInfo & rInfo, ::com::sun::star::uno::Any & rValue )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException ) = 0;
+ virtual void _postGetValues ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) = 0;
+
+ virtual void _preGetPropertyState ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
+ virtual void _getPropertyState( const comphelper::PropertyInfo& rInfo, ::com::sun::star::beans::PropertyState& rState )
+ throw(::com::sun::star::beans::UnknownPropertyException );
+ virtual void _postGetPropertyState ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
+
+ virtual void _setPropertyToDefault( const comphelper::PropertyInfo& rEntry )
+ throw(::com::sun::star::beans::UnknownPropertyException );
+ virtual ::com::sun::star::uno::Any _getPropertyDefault( const comphelper::PropertyInfo& rEntry )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException );
+
+ public:
+ ChainablePropertySet( comphelper::ChainablePropertySetInfo* pInfo, osl::SolarMutex* pMutex = NULL )
+ throw();
+ virtual ~ChainablePropertySet()
+ throw();
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XMultiPropertySet
+ virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues )
+ throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< OUString >& aPropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ };
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/ChainablePropertySetInfo.hxx b/include/comphelper/ChainablePropertySetInfo.hxx
new file mode 100644
index 000000000000..ce28803036d5
--- /dev/null
+++ b/include/comphelper/ChainablePropertySetInfo.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_CHAINABLEPROPERTYSETINFO_HXX_
+#define _COMPHELPER_CHAINABLEPROPERTYSETINFO_HXX_
+
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <comphelper/PropertyInfoHash.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/TypeGeneration.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+/*
+ * A ChainablePropertySetInfo is usually initialised with a pointer to the first element
+ * of a null-terminated static table of PropertyInfo structs. This is placed in a hash_map
+ * for fast access
+ *
+ */
+namespace comphelper
+{
+ class COMPHELPER_DLLPUBLIC ChainablePropertySetInfo:
+ public ::cppu::WeakImplHelper1<
+ ::com::sun::star::beans::XPropertySetInfo >
+ {
+ friend class ChainablePropertySet;
+ friend class MasterPropertySet;
+ protected:
+ PropertyInfoHash maMap;
+ com::sun::star::uno::Sequence < com::sun::star::beans::Property > maProperties;
+ public:
+ ChainablePropertySetInfo( PropertyInfo * pMap )
+ throw();
+
+ virtual ~ChainablePropertySetInfo()
+ throw();
+
+ void add( PropertyInfo* pMap, sal_Int32 nCount = -1 )
+ throw();
+ void remove( const OUString& aName )
+ throw();
+
+ // XPropertySetInfo
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties()
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::beans::Property SAL_CALL getPropertyByName( const OUString& aName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name )
+ throw(::com::sun::star::uno::RuntimeException);
+ };
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/IdPropArrayHelper.hxx b/include/comphelper/IdPropArrayHelper.hxx
new file mode 100644
index 000000000000..497a39fd500d
--- /dev/null
+++ b/include/comphelper/IdPropArrayHelper.hxx
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef COMPHELPER_IDPROPERTYARRAYUSAGEHELPER_HXX
+#define COMPHELPER_IDPROPERTYARRAYUSAGEHELPER_HXX
+
+#include <cppuhelper/component.hxx>
+#include <osl/mutex.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <osl/diagnose.h>
+#include <comphelper/stl_types.hxx>
+#include <rtl/instance.hxx>
+#include <cppuhelper/propshlp.hxx>
+
+namespace cppu { class IPropertyArrayHelper; }
+
+namespace comphelper
+{
+ //************************************************************
+ // OIdPropertyArrayUsageHelper
+ //************************************************************
+ template <typename TYPE> struct OIdPropertyArrayUsageHelperMutex
+ : public rtl::Static< ::osl::Mutex, OIdPropertyArrayUsageHelperMutex<TYPE> > {};
+
+ typedef std::map< sal_Int32, ::cppu::IPropertyArrayHelper*, std::less< sal_Int32 > > OIdPropertyArrayMap;
+ template <class TYPE>
+ class OIdPropertyArrayUsageHelper
+ {
+ protected:
+ static sal_Int32 s_nRefCount;
+ static OIdPropertyArrayMap* s_pMap;
+
+ public:
+ OIdPropertyArrayUsageHelper();
+ virtual ~OIdPropertyArrayUsageHelper()
+ {
+ ::osl::MutexGuard aGuard(OIdPropertyArrayUsageHelperMutex<TYPE>::get());
+ OSL_ENSURE(s_nRefCount > 0, "OIdPropertyArrayUsageHelper::~OIdPropertyArrayUsageHelper : suspicious call : have a refcount of 0 !");
+ if (!--s_nRefCount)
+ {
+ // delete the element
+ for (OIdPropertyArrayMap::iterator i = s_pMap->begin(); i != s_pMap->end(); ++i)
+ delete (*i).second;
+ delete s_pMap;
+ s_pMap = NULL;
+ }
+ }
+
+ /** call this in the getInfoHelper method of your derived class. The method returns the array helper of the
+ class, which is created if neccessary.
+ */
+ ::cppu::IPropertyArrayHelper* getArrayHelper(sal_Int32 nId);
+
+ protected:
+ /** used to implement the creation of the array helper which is shared amongst all instances of the class.
+ This method needs to be implemented in derived classes.
+ <BR>
+ The method gets called with Mutex acquired.
+ <BR>
+ as long as IPropertyArrayHelper has no virtual destructor, the implementation of ~OPropertyArrayUsageHelper
+ assumes that you created an ::cppu::OPropertyArrayHelper when deleting s_pProps.
+ @return an pointer to the newly created array helper. Must not be NULL.
+ */
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 nId) const = 0;
+ };
+
+ //------------------------------------------------------------------
+ template<class TYPE>
+ sal_Int32 OIdPropertyArrayUsageHelper< TYPE >::s_nRefCount = 0;
+
+ template<class TYPE>
+ OIdPropertyArrayMap* OIdPropertyArrayUsageHelper< TYPE >::s_pMap = NULL;
+
+ //------------------------------------------------------------------
+ template <class TYPE>
+ OIdPropertyArrayUsageHelper<TYPE>::OIdPropertyArrayUsageHelper()
+ {
+ ::osl::MutexGuard aGuard(OIdPropertyArrayUsageHelperMutex<TYPE>::get());
+ // create the map if necessary
+ if (s_pMap == NULL)
+ s_pMap = new OIdPropertyArrayMap();
+ ++s_nRefCount;
+ }
+
+ //------------------------------------------------------------------
+ template <class TYPE>
+ ::cppu::IPropertyArrayHelper* OIdPropertyArrayUsageHelper<TYPE>::getArrayHelper(sal_Int32 nId)
+ {
+ OSL_ENSURE(s_nRefCount, "OIdPropertyArrayUsageHelper::getArrayHelper : suspicious call : have a refcount of 0 !");
+ ::osl::MutexGuard aGuard(OIdPropertyArrayUsageHelperMutex<TYPE>::get());
+ // do we have the array already?
+ if (! (*s_pMap)[nId] )
+ {
+ (*s_pMap)[nId] = createArrayHelper(nId);
+ OSL_ENSURE((*s_pMap)[nId], "OIdPropertyArrayUsageHelper::getArrayHelper : createArrayHelper returned nonsense !");
+ }
+ return (*s_pMap)[nId];
+ }
+}
+#endif // COMPHELPER_IDPROPERTYARRAYUSAGEHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/InlineContainer.hxx b/include/comphelper/InlineContainer.hxx
new file mode 100644
index 000000000000..b23574bbad58
--- /dev/null
+++ b/include/comphelper/InlineContainer.hxx
@@ -0,0 +1,143 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_COMPHELPER_INLINE_CONTAINER_HXX
+#define INCLUDED_COMPHELPER_INLINE_CONTAINER_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <vector>
+#include <map>
+#include <set>
+
+namespace comphelper
+{
+
+/** Creates a UNO-Sequence which contains an arbitrary number of elements.
+ Notice, that every call of the operator() issues a realloc, so this is not
+ suitable to create very large sequences.
+
+ usage:
+
+ uno::Sequence< t >( MakeSequence< t >( t_1 )( t_2 )...( t_n ) );
+ */
+template < typename T >
+class MakeSequence : public ::com::sun::star::uno::Sequence< T >
+{
+public:
+ explicit MakeSequence(const T &a)
+ : ::com::sun::star::uno::Sequence< T >( 1 )
+ {
+ this->operator[](0) = a;
+ }
+ MakeSequence& operator()(const T &a)
+ {
+ this->realloc( this->getLength() + 1 );
+ this->operator[]( this->getLength() - 1 ) = a;
+ return *this;
+ }
+};
+
+// ----------------------------------------
+
+/** Creates a vector which contains an arbitrary number of elements.
+
+ usage:
+
+ vector< t > aVec( MakeVector< t >( t_1 )( t_2 )...( t_n ) );
+ */
+template < typename T >
+class MakeVector : public ::std::vector< T >
+{
+public:
+ explicit MakeVector(const T &a)
+ : ::std::vector< T >(1, a)
+ {
+ }
+ MakeVector &operator()(const T &a)
+ {
+ this->push_back(a);
+ return *this;
+ }
+};
+
+// ----------------------------------------
+
+/** Creates a set which contains an arbitrary number of elements.
+
+ usage:
+
+ set< t > aSet( MakeSet< t >( t_1 )( t_2 )...( t_n ) );
+ */
+template < typename T >
+class MakeSet : public ::std::set< T >
+{
+public:
+ explicit MakeSet(const T &a)
+ : ::std::set< T >()
+ {
+ this->insert(this->end(), a);
+ }
+ MakeSet &operator()(const T &a)
+ {
+ this->insert(this->end(), a);
+ return *this;
+ }
+};
+
+// ----------------------------------------
+
+/** usage:
+
+ map< k, v > aMap( MakeMap< k, v >
+ ( key_1, value_1 )
+ ( key_2, value_2 )
+ ( key_3, value_3 )
+ ...
+ ( key_n, value_n )
+ );
+ */
+template < typename Key, typename Value >
+class MakeMap : public ::std::map< Key, Value >
+{
+private:
+ typedef typename ::std::map< Key, Value >::value_type value_type;
+public:
+ explicit MakeMap( const Key &k, const Value &v )
+ {
+ this->insert( value_type( k, v ) );
+ }
+ MakeMap &operator()( const Key &k, const Value &v )
+ {
+ this->insert( value_type( k, v ) );
+ return *this;
+ }
+
+ MakeMap &operator()( const MakeMap& rSource )
+ {
+ this->insert(rSource.begin(),rSource.end());
+ return *this;
+ }
+};
+
+} // namespace comphelper
+
+#endif
+// INCLUDED_COMPHELPER_INLINE_CONTAINER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/MasterPropertySet.hxx b/include/comphelper/MasterPropertySet.hxx
new file mode 100644
index 000000000000..266137fdb9b4
--- /dev/null
+++ b/include/comphelper/MasterPropertySet.hxx
@@ -0,0 +1,143 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_MASTERPROPERTYSETHELPER_HXX_
+#define _COMPHELPER_MASTERPROPERTYSETHELPER_HXX_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <comphelper/PropertyInfoHash.hxx>
+#include "comphelper/comphelperdllapi.h"
+#include <map>
+
+namespace comphelper
+{
+ class MasterPropertySetInfo;
+ class ChainablePropertySet;
+ struct SlaveData
+ {
+ ChainablePropertySet * mpSlave;
+ ::com::sun::star::uno::Reference < com::sun::star::beans::XPropertySet > mxSlave;
+ sal_Bool mbInit;
+ SlaveData ( ChainablePropertySet *pSlave);
+ inline sal_Bool IsInit () { return mbInit;}
+ inline void SetInit ( sal_Bool bInit) { mbInit = bInit; }
+ };
+}
+typedef std::map < sal_uInt8, comphelper::SlaveData* > SlaveMap;
+
+/*
+ * A MasterPropertySet implements all of the features of a ChainablePropertySet
+ * (it is not inherited from ChainablePropertySet to prevent MasterPropertySets
+ * being chained to each other), but also allows properties implemented in
+ * other ChainablePropertySets to be included as 'native' properties in a
+ * given MasterPropertySet implementation. These are registered using the
+ * 'registerSlave' method, and require that the implementation of the
+ * ChainablePropertySet and the implementation of the ChainablePropertySetInfo
+ * both declare the implementation of the MasterPropertySet as a friend.
+ */
+namespace comphelper
+{
+ class COMPHELPER_DLLPUBLIC MasterPropertySet : public ::com::sun::star::beans::XPropertySet,
+ public ::com::sun::star::beans::XPropertyState,
+ public ::com::sun::star::beans::XMultiPropertySet
+ {
+ protected:
+ MasterPropertySetInfo *mpInfo;
+ osl::SolarMutex* mpMutex;
+ sal_uInt8 mnLastId;
+ SlaveMap maSlaveMap;
+ ::com::sun::star::uno::Reference < com::sun::star::beans::XPropertySetInfo > mxInfo;
+
+ virtual void _preSetValues ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) = 0;
+ virtual void _setSingleValue( const comphelper::PropertyInfo & rInfo, const ::com::sun::star::uno::Any &rValue )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) = 0;
+ virtual void _postSetValues ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) = 0;
+
+ virtual void _preGetValues ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) = 0;
+ virtual void _getSingleValue( const comphelper::PropertyInfo & rInfo, ::com::sun::star::uno::Any & rValue )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException ) = 0;
+ virtual void _postGetValues ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) = 0;
+
+ virtual void _preGetPropertyState ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
+ virtual void _getPropertyState( const comphelper::PropertyInfo& rInfo, ::com::sun::star::beans::PropertyState& rState )
+ throw(::com::sun::star::beans::UnknownPropertyException );
+ virtual void _postGetPropertyState ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
+
+ virtual void _setPropertyToDefault( const comphelper::PropertyInfo& rEntry )
+ throw(::com::sun::star::beans::UnknownPropertyException );
+ virtual ::com::sun::star::uno::Any _getPropertyDefault( const comphelper::PropertyInfo& rEntry )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException );
+
+ public:
+ MasterPropertySet( comphelper::MasterPropertySetInfo* pInfo, ::osl::SolarMutex* pMutex = NULL )
+ throw();
+ virtual ~MasterPropertySet()
+ throw();
+ void registerSlave ( ChainablePropertySet *pNewSet )
+ throw();
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XMultiPropertySet
+ virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues )
+ throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< OUString >& aPropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ };
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/MasterPropertySetInfo.hxx b/include/comphelper/MasterPropertySetInfo.hxx
new file mode 100644
index 000000000000..d2c772e2c5d5
--- /dev/null
+++ b/include/comphelper/MasterPropertySetInfo.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_MASTERPROPERTYSETINFO_HXX_
+#define _COMPHELPER_MASTERPROPERTYSETINFO_HXX_
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <comphelper/PropertyInfoHash.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/TypeGeneration.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+namespace comphelper
+{
+ class COMPHELPER_DLLPUBLIC MasterPropertySetInfo:
+ public ::cppu::WeakImplHelper1<
+ ::com::sun::star::beans::XPropertySetInfo >
+ {
+ friend class MasterPropertySet;
+ protected:
+ PropertyDataHash maMap;
+ com::sun::star::uno::Sequence < com::sun::star::beans::Property > maProperties;
+ public:
+ MasterPropertySetInfo( PropertyInfo * pMap )
+ throw();
+ virtual ~MasterPropertySetInfo()
+ throw();
+ void add( PropertyInfo* pMap, sal_Int32 nCount = -1, sal_uInt8 nMapId = 0 )
+ throw();
+ void add( PropertyInfoHash &rHash, sal_uInt8 nMapId )
+ throw();
+
+ // XPropertySetInfo
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties()
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::beans::Property SAL_CALL getPropertyByName( const OUString& aName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name )
+ throw(::com::sun::star::uno::RuntimeException);
+ };
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/PropertyInfoHash.hxx b/include/comphelper/PropertyInfoHash.hxx
new file mode 100644
index 000000000000..3241560b4a94
--- /dev/null
+++ b/include/comphelper/PropertyInfoHash.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_PROPERTYINFOHASH_HXX_
+#define _COMPHELPER_PROPERTYINFOHASH_HXX_
+
+#include <rtl/ustring.hxx>
+#include <comphelper/TypeGeneration.hxx>
+#include <boost/unordered_map.hpp>
+namespace comphelper
+{
+ struct PropertyInfo
+ {
+ const sal_Char* mpName;
+ sal_uInt16 mnNameLen;
+ sal_Int32 mnHandle;
+ CppuTypes meCppuType;
+ sal_Int16 mnAttributes;
+ sal_uInt8 mnMemberId;
+ };
+ struct PropertyData
+ {
+ sal_uInt8 mnMapId;
+ PropertyInfo *mpInfo;
+ PropertyData ( sal_uInt8 nMapId, PropertyInfo *pInfo )
+ : mnMapId ( nMapId )
+ , mpInfo ( pInfo ) {}
+ };
+ struct eqFunc
+ {
+ sal_Bool operator()( const OUString &r1,
+ const OUString &r2) const
+ {
+ return r1 == r2;
+ }
+ };
+}
+
+typedef boost::unordered_map < OUString,
+ ::comphelper::PropertyInfo*,
+ OUStringHash,
+ ::comphelper::eqFunc > PropertyInfoHash;
+typedef boost::unordered_map < OUString,
+ ::comphelper::PropertyData*,
+ OUStringHash,
+ ::comphelper::eqFunc > PropertyDataHash;
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/SelectionMultiplex.hxx b/include/comphelper/SelectionMultiplex.hxx
new file mode 100644
index 000000000000..56e8375fd215
--- /dev/null
+++ b/include/comphelper/SelectionMultiplex.hxx
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_SELECTION_MULTIPLEX_HXX
+#define INCLUDED_COMPHELPER_SELECTION_MULTIPLEX_HXX
+
+#include <com/sun/star/view/XSelectionChangeListener.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+//=========================================================================
+//= selection helper classes
+//=========================================================================
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+ class OSelectionChangeMultiplexer;
+
+ //==================================================================
+ //= OSelectionChangeListener
+ //==================================================================
+ /// simple listener adapter for selections
+ class COMPHELPER_DLLPUBLIC OSelectionChangeListener
+ {
+ friend class OSelectionChangeMultiplexer;
+
+ OSelectionChangeMultiplexer* m_pAdapter;
+ ::osl::Mutex& m_rMutex;
+
+ public:
+ OSelectionChangeListener(::osl::Mutex& _rMutex)
+ : m_pAdapter(NULL), m_rMutex(_rMutex) { }
+ virtual ~OSelectionChangeListener();
+
+ virtual void _selectionChanged( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException) = 0;
+ virtual void _disposing(const ::com::sun::star::lang::EventObject& _rSource) throw( ::com::sun::star::uno::RuntimeException);
+
+ protected:
+ // pseudo-private. Making it private now could break compatibility
+ void setAdapter( OSelectionChangeMultiplexer* _pAdapter );
+ };
+
+ //==================================================================
+ //= OSelectionChangeMultiplexer
+ //==================================================================
+ /// multiplexer for selection changes
+ class COMPHELPER_DLLPUBLIC OSelectionChangeMultiplexer :public cppu::WeakImplHelper1< ::com::sun::star::view::XSelectionChangeListener>
+ {
+ friend class OSelectionChangeListener;
+ ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionSupplier> m_xSet;
+ OSelectionChangeListener* m_pListener;
+ sal_Int32 m_nLockCount;
+ sal_Bool m_bListening : 1;
+ sal_Bool m_bAutoSetRelease : 1;
+
+ OSelectionChangeMultiplexer(const OSelectionChangeMultiplexer&);
+ OSelectionChangeMultiplexer& operator=(const OSelectionChangeMultiplexer&);
+ protected:
+ virtual ~OSelectionChangeMultiplexer();
+ public:
+ OSelectionChangeMultiplexer(OSelectionChangeListener* _pListener, const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionSupplier>& _rxSet, sal_Bool _bAutoReleaseSet = sal_True);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw( ::com::sun::star::uno::RuntimeException);
+
+ // XSelectionChangeListener
+ virtual void SAL_CALL selectionChanged( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+ /// incremental lock
+ void lock();
+ /// incremental unlock
+ void unlock();
+ /// get the lock count
+ sal_Int32 locked() const { return m_nLockCount; }
+
+ void dispose();
+ };
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // INCLUDED_COMPHELPER_SELECTION_MULTIPLEX_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/SettingsHelper.hxx b/include/comphelper/SettingsHelper.hxx
new file mode 100644
index 000000000000..d623fa3e5494
--- /dev/null
+++ b/include/comphelper/SettingsHelper.hxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_SETTINGSHELPER_HXX_
+#define _COMPHELPER_SETTINGSHELPER_HXX_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase3.hxx>
+
+namespace comphelper
+{
+ class MasterPropertySet;
+ class MasterPropertySetInfo;
+ class ChainablePropertySet;
+ class ChainablePropertySetInfo;
+
+ typedef cppu::WeakImplHelper3
+ <
+ ::com::sun::star::beans::XPropertySet,
+ ::com::sun::star::beans::XMultiPropertySet,
+ ::com::sun::star::lang::XServiceInfo
+ >
+ HelperBaseNoState;
+ template < class ComphelperBase, class ComphelperBaseInfo > class SettingsHelperNoState :
+ public HelperBaseNoState,
+ public ComphelperBase
+ {
+ public:
+ SettingsHelperNoState ( ComphelperBaseInfo *pInfo, ::osl::SolarMutex* pMutex = NULL)
+ : ComphelperBase ( pInfo, pMutex )
+ {}
+ virtual ~SettingsHelperNoState () throw( ) {}
+ com::sun::star::uno::Any SAL_CALL queryInterface( const com::sun::star::uno::Type& aType ) throw (com::sun::star::uno::RuntimeException)
+ { return HelperBaseNoState::queryInterface( aType ); }
+ void SAL_CALL acquire( ) throw ()
+ { HelperBaseNoState::acquire( ); }
+ void SAL_CALL release( ) throw ()
+ { HelperBaseNoState::release( ); }
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( )
+ throw(::com::sun::star::uno::RuntimeException)
+ { return ComphelperBase::getPropertySetInfo(); }
+ virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+ { ComphelperBase::setPropertyValue ( aPropertyName, aValue ); }
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+ { return ComphelperBase::getPropertyValue ( PropertyName ); }
+ virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+ { ComphelperBase::addPropertyChangeListener ( aPropertyName, xListener ); }
+ virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+ { ComphelperBase::removePropertyChangeListener ( aPropertyName, aListener ); }
+ virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+ { ComphelperBase::addVetoableChangeListener ( PropertyName, aListener ); }
+ virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+ { ComphelperBase::removeVetoableChangeListener ( PropertyName, aListener ); }
+
+ // XMultiPropertySet
+ virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues )
+ throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+ { ComphelperBase::setPropertyValues ( aPropertyNames, aValues ); }
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames )
+ throw(::com::sun::star::uno::RuntimeException)
+ { return ComphelperBase::getPropertyValues ( aPropertyNames ); }
+ virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
+ throw(::com::sun::star::uno::RuntimeException)
+ { ComphelperBase::addPropertiesChangeListener ( aPropertyNames, xListener ); }
+ virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
+ throw(::com::sun::star::uno::RuntimeException)
+ { ComphelperBase::removePropertiesChangeListener ( xListener ); }
+ virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
+ throw(::com::sun::star::uno::RuntimeException)
+ { ComphelperBase::firePropertiesChangeEvent ( aPropertyNames, xListener ); }
+ };
+ typedef comphelper::SettingsHelperNoState
+ <
+ ::comphelper::MasterPropertySet,
+ ::comphelper::MasterPropertySetInfo
+ >
+ MasterHelperNoState;
+ typedef comphelper::SettingsHelperNoState
+ <
+ ::comphelper::ChainablePropertySet,
+ ::comphelper::ChainablePropertySetInfo
+ >
+ ChainableHelperNoState;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/TypeGeneration.hxx b/include/comphelper/TypeGeneration.hxx
new file mode 100644
index 000000000000..0ced57b31714
--- /dev/null
+++ b/include/comphelper/TypeGeneration.hxx
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_TYPEGENERATION_HXX_
+#define _COMPHELPER_TYPEGENERATION_HXX_
+
+#include <sal/types.h>
+#include "comphelper/comphelperdllapi.h"
+
+#define CPPU_E2T(type) ((com::sun::star::uno::Type*)type)
+
+namespace com { namespace sun { namespace star { namespace uno {
+ class Type;
+} } } }
+namespace comphelper
+{
+ enum CppuTypes
+ {
+ CPPUTYPE_UNKNOWN, // 0 == unknown == error!!!!
+
+ CPPUTYPE_BOOLEAN, //getBooleanCppuType()
+ CPPUTYPE_INT8, //getCppuType( (sal_Int8*)0 )
+ CPPUTYPE_INT16, //getCppuType( (sal_Int16*)0 )
+ CPPUTYPE_INT32, //getCppuType( (sal_Int32*)0 )
+ CPPUTYPE_DOUBLE, //getCppuType( (double*)0 )
+ CPPUTYPE_FLOAT, //getCppuType( (float*)0 )
+ CPPUTYPE_OUSTRING, //getCppuType( (OUString*)0 )
+
+ CPPUTYPE_FONTSLANT, //getCppuType( (FontSlant*)0 )
+ CPPUTYPE_LOCALE, //getCppuType( (Locale*)0 )
+ CPPUTYPE_PROPERTYVALUE, //getCppuType( (Sequence<PropertyValue>*)0 )
+ CPPUTYPE_PROPERTYVALUES, //getCppuType( (Sequence<PropertyValues>*)0 )
+ CPPUTYPE_BORDERLINE, //getCppuType( (table::BorderLine*)0 )
+ CPPUTYPE_BREAK, //getCppuType( (style::BreakType*)0 )
+ CPPUTYPE_GRAPHICLOC, //getCppuType( (style::GraphicLocation*)0 )
+ CPPUTYPE_DROPCAPFMT, //getCppuType( (style::DropCapFormat*)0 )
+ CPPUTYPE_LINESPACE, //getCppuType( (style::LineSpacing*)0 )
+ CPPUTYPE_AWTSIZE, //getCppuType( (awt::Size*)0 )
+ CPPUTYPE_SHADOWFMT, //getCppuType( (table::ShadowFormat*)0 )
+ CPPUTYPE_TBLCOLSEP, //getCppuType( (Sequence<text::TableColumnSeparator>*)0 )
+ CPPUTYPE_PNTSEQSEQ, //getCppuType( (PointSequenceSequence*)0 )
+ CPPUTYPE_DOCIDXMRK, //getCppuType( (Sequence< Reference< XDocumentIndexMark > >*)0 )
+ CPPUTYPE_SEQINT8, //getCppuType( (Sequence<sal_Int8>*)0 )
+ CPPUTYPE_SEQTABSTOP, //getCppuType( (Sequence<style::TabStop>*)0 )
+ CPPUTYPE_SEQANCHORTYPE, //getCppuType( (Sequence<text::TextContentAnchorType>*)0 )
+ CPPUTYPE_SEQDEPTXTFLD, //getCppuType( (Sequence<Reference<XDependentTextField> >*)0 )
+ CPPUTYPE_TXTCNTANCHOR, //getCppuType( (text::TextContentAnchorType*)0 )
+ CPPUTYPE_WRAPTXTMODE, //getCppuType( (text::WrapTextMode*)0 )
+ CPPUTYPE_LINESTYLE, //getCppuType( (drawing::LineStyle*)0 )
+ CPPUTYPE_COLORMODE, //getCppuType( (drawing::ColorMode*)0 )
+ CPPUTYPE_PAGESTYLELAY, //getCppuType( (style::PageStyleLayout*)0 )
+ CPPUTYPE_VERTALIGN, //getCppuType( (style::VerticalAlignment*)0 )
+ CPPUTYPE_TABLEBORDER, //getCppuType( (table::TableBorder*)0 )
+ CPPUTYPE_TABLEBORDER2, //getCppuType( (table::TableBorder*)0 )
+ CPPUTYPE_GRFCROP, //getCppuType( (text::GraphicCrop*)0 )
+ CPPUTYPE_SECTFILELNK, //getCppuType( (text::SectionFileLink*)0 )
+ CPPUTYPE_PAGENUMTYPE, //getCppuType( (const PageNumberType*)0 )
+ CPPUTYPE_DATETIME, //getCppuType( (util::DateTime*)0 )
+ CPPUTYPE_DATE, //getCppuType( (util::Date*)0 )
+
+ CPPUTYPE_REFINTERFACE, //getCppuType( (Reference<XInterface>*)0 )
+ CPPUTYPE_REFIDXREPL, //getCppuType( (Reference<container::XIndexReplace>*)0 )
+ CPPUTYPE_REFNAMECNT, //getCppuType( (Reference<container::XNameContainer>*)0 )
+ CPPUTYPE_REFTEXTFRAME, //getCppuType( (Reference<text::XTextFrame>*)0 )
+ CPPUTYPE_REFTEXTSECTION, //getCppuType( (Reference<text::XTextSection>*)0 )
+ CPPUTYPE_REFFOOTNOTE, //getCppuType( (Reference<text::XFootnote>*)0 )
+ CPPUTYPE_REFTEXT, //getCppuType( (Reference<text::XText>*)0 )
+ CPPUTYPE_REFTEXTCOL, //getCppuType( (Reference<text::XTextColumns>*)0 )
+
+ CPPUTYPE_REFFORBCHARS, //getCppuType( (Reference<XForbiddenCharacters>*)0)
+ CPPUTYPE_REFIDXCNTNR, //getCppuType( (Reference<XIndexContainer>*)0)
+ CPPUTYPE_REFTEXTCNTNT, //getCppuType( (Reference<XTextContent>*)0)
+ CPPUTYPE_REFBITMAP, //getCppuType( (Reference<awt::XBitmap>*)0)
+ CPPUTYPE_REFNMREPLACE, //getCppuType( (Reference<container::XNameReplace>*)0)
+ CPPUTYPE_REFCELL, //getCppuType( (Reference<table::XCell>*)0)
+ CPPUTYPE_REFDOCINDEX, //getCppuType( (Reference<text::XDocumentIndex>*)0)
+ CPPUTYPE_REFDOCIDXMRK, //getCppuType( (Reference<text::XDocumentIndexMark>*)0)
+ CPPUTYPE_REFTXTFIELD, //getCppuType( (Reference<text::XTextField>*)0)
+ CPPUTYPE_REFTXTRANGE, //getCppuType( (Reference<text::XTextRange>*)0)
+ CPPUTYPE_REFTXTTABLE, //getCppuType( (Reference<text::XTextTable>*)0)
+ CPPUTYPE_AWTPOINT, //getCppuType( (awt::Point*)0 )
+ CPPUTYPE_REFLIBCONTAINER, //getCppuType( (Reference< script::XLibraryContainer >*)0)
+ CPPUTYPE_SEQANY, //getCppuType( (Sequence< uno::Any >*)0)
+ CPPUTYPE_REFRESULTSET, //getCppuType( (Reference< sdbc::XResultSet >*)0)
+ CPPUTYPE_REFCONNECTION, //getCppuType( (Reference< sdbc::XConnection >*)0)
+ CPPUTYPE_REFMODEL, //getCppuType( (Reference< frame::XModel >*)0)
+
+ CPPUTYPE_OUSTRINGS, //getCppuType( (Sequence<OUString>*)0 )
+ CPPUTYPE_REFCOMPONENT, //getCppuType( (Reference< lang::XComponent >*)0 )
+ // #i28749#
+ CPPUTYPE_TRANSFORMATIONINHORIL2R, //getCppuType( (drawing::HomogenMatrix3)* )
+ CPPUTYPE_SEQNAMEDVALUE, //getCppuType( (Sequence<beans::NamedValue>*)0 )
+ CPPUTYPE_REFXGRAPHIC, //getCppuType( Reference< graphic::XGraphic >*)0)
+ CPPUTYPE_TABLEBORDERDISTANCES, //getCppuType( (table::TableBorderDistances*)0 )
+ CPPUTPYE_REFEMBEDDEDOBJECT, // XEmbeddedObject::static_type
+ CPPUTYPE_FILLSTYLE, //getCppuType( (drawing::FillStyle*)0 )
+ CPPUTYPE_GRADIENT, //getCppuType( (awt::Gradient*)0 )
+
+ CPPUTYPE_END
+ };
+ COMPHELPER_DLLPUBLIC void GenerateCppuType (
+ CppuTypes eType, const com::sun::star::uno::Type*& pType );
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/accessiblecomponenthelper.hxx b/include/comphelper/accessiblecomponenthelper.hxx
new file mode 100644
index 000000000000..d0eabc27b807
--- /dev/null
+++ b/include/comphelper/accessiblecomponenthelper.hxx
@@ -0,0 +1,140 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_ACCESSIBLE_COMPONENT_HELPER_HXX
+#define COMPHELPER_ACCESSIBLE_COMPONENT_HELPER_HXX
+
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp>
+#include <comphelper/accessiblecontexthelper.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/uno3.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+ //=====================================================================
+ //= OCommonAccessibleComponent
+ //=====================================================================
+ /** base class encapsulating common functionality for the helper classes implementing
+ the XAccessibleComponent respectively XAccessibleExtendendComponent
+ */
+ class COMPHELPER_DLLPUBLIC OCommonAccessibleComponent : public OAccessibleContextHelper
+ {
+ protected:
+ OCommonAccessibleComponent();
+ /// see the respective base class ctor for an extensive comment on this, please
+ OCommonAccessibleComponent( IMutex* _pExternalLock );
+ ~OCommonAccessibleComponent();
+
+ protected:
+ /// implements the calculation of the bounding rectangle - still waiting to be overwritten
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException) = 0;
+
+ protected:
+ /** non-virtual versions of the methods which can be implemented using <method>implGetBounds</method>
+ note: getLocationOnScreen relies on a valid parent (XAccessibleContext::getParent()->getAccessibleContext()),
+ which itself implements XAccessibleComponent
+ */
+ sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException);
+ };
+
+ //=====================================================================
+ //= OAccessibleComponentHelper
+ //=====================================================================
+
+ struct OAccessibleComponentHelper_Base :
+ public ::cppu::ImplHelper1< ::com::sun::star::accessibility::XAccessibleComponent >
+ {
+ protected:
+ ~OAccessibleComponentHelper_Base() {}
+ };
+
+ /** a helper class for implementing an AccessibleContext which at the same time
+ supports an XAccessibleComponent interface.
+ */
+ class COMPHELPER_DLLPUBLIC OAccessibleComponentHelper
+ :public OCommonAccessibleComponent
+ ,public OAccessibleComponentHelper_Base
+ {
+ protected:
+ OAccessibleComponentHelper( );
+ /// see the respective base class ctor for an extensive comment on this, please
+ OAccessibleComponentHelper( IMutex* _pExternalLock );
+
+ public:
+ // XInterface
+ DECLARE_XINTERFACE( )
+ DECLARE_XTYPEPROVIDER( )
+
+ // XAccessibleComponent - default implementations
+ virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException);
+ };
+
+ //=====================================================================
+ //= OAccessibleExtendedComponentHelper
+ //=====================================================================
+
+ typedef ::cppu::ImplHelper1 < ::com::sun::star::accessibility::XAccessibleExtendedComponent
+ > OAccessibleExtendedComponentHelper_Base;
+
+ /** a helper class for implementing an AccessibleContext which at the same time
+ supports an XAccessibleExtendedComponent interface.
+ */
+ class COMPHELPER_DLLPUBLIC OAccessibleExtendedComponentHelper
+ :public OCommonAccessibleComponent
+ ,public OAccessibleExtendedComponentHelper_Base
+ {
+ protected:
+ OAccessibleExtendedComponentHelper( );
+ /// see the respective base class ctor for an extensive comment on this, please
+ OAccessibleExtendedComponentHelper( IMutex* _pExternalLock );
+
+ public:
+ // XInterface
+ DECLARE_XINTERFACE( )
+ DECLARE_XTYPEPROVIDER( )
+
+ // XAccessibleComponent - default implementations
+ virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException);
+ };
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // COMPHELPER_ACCESSIBLE_COMPONENT_HELPER_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/accessiblecontexthelper.hxx b/include/comphelper/accessiblecontexthelper.hxx
new file mode 100644
index 000000000000..e6c5c10ab20f
--- /dev/null
+++ b/include/comphelper/accessiblecontexthelper.hxx
@@ -0,0 +1,345 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_ACCESSIBLE_CONTEXT_HELPER_HXX
+#define COMPHELPER_ACCESSIBLE_CONTEXT_HELPER_HXX
+
+#include <cppuhelper/compbase2.hxx>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <comphelper/broadcasthelper.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+ //=====================================================================
+ //= IMutex
+ //=====================================================================
+
+ // This whole thingie here (own mutex classes and such) is a HACK. I hate the SolarMutex.
+ // See below for more explanations ....
+
+ /** abstract interface for implementing a mutex
+ */
+ class COMPHELPER_DLLPUBLIC IMutex
+ {
+ public:
+ virtual ~IMutex();
+ virtual void acquire() = 0;
+ virtual void release() = 0;
+ };
+
+ //=====================================================================
+ //= OMutexGuard
+ //=====================================================================
+
+ class OMutexGuard
+ {
+ IMutex* m_pMutex;
+ public:
+ inline OMutexGuard( IMutex* _pMutex )
+ :m_pMutex( _pMutex )
+ {
+ if ( m_pMutex )
+ m_pMutex->acquire();
+ }
+
+ inline ~OMutexGuard( )
+ {
+ if ( m_pMutex )
+ m_pMutex->release();
+ }
+ };
+
+ //=====================================================================
+ //= OAccessibleContextHelper
+ //=====================================================================
+
+ class OContextHelper_Impl;
+ typedef ::cppu::WeakAggComponentImplHelper2 < ::com::sun::star::accessibility::XAccessibleContext,
+ ::com::sun::star::accessibility::XAccessibleEventBroadcaster
+ > OAccessibleContextHelper_Base;
+
+ /** helper class for implementing an AccessibleContext
+ */
+ class COMPHELPER_DLLPUBLIC OAccessibleContextHelper
+ :public ::comphelper::OBaseMutex
+ ,public OAccessibleContextHelper_Base
+ {
+ private:
+ OContextHelper_Impl* m_pImpl;
+
+ protected:
+ OAccessibleContextHelper( );
+ ~OAccessibleContextHelper( );
+
+ /** ctor
+
+ <p>If you need additional object safety for your class, and want to ensure that your own
+ mutex is locked before the mutex this class provides is, than use this ctor.</p>
+
+ <p>Beware that this is a hack. Unfortunately, OpenOffice.org has two different mutex hierarchies,
+ which are not compatible. In addition, wide parts of the code (especially VCL) is not thread-safe,
+ but instead relies on a <em>single global mutex</em>. As a consequence, components using
+ directly or indirectly such code need to care for this global mutex. Yes, this is as ugly as
+ anything.</p>
+
+ <p>Note that the external lock is used as additional lock, not as the only one. The own mutex of the
+ instance is used for internal actions, and every action which potentially involves external code
+ (for instance every call to a virtual method overridden by derivees) is <em>additionally</em> and
+ <em>first</em> guarded by with the external lock.</p>
+
+ <p>Beware of the lifetime of the lock - you must ensure that the lock exists at least as long as
+ the context does. A good approach to implement the lock may be to derive you own context
+ not only from OAccessibleContextHelper, but also from IMutex.</p>
+
+ <p>One more note. This lock is definitely not used once the dtor is reached. Means whatever
+ the dtor implementation does, it does <em>not</em> guard the external lock. See this as a contract.
+ <br/>You should ensure the same thing for own derivees which do not supply the lock themself,
+ but get them from yet another derivee.</p>
+ @see forgetExternalLock
+ */
+ OAccessibleContextHelper( IMutex* _pExternalLock );
+
+ /** late construction
+ @param _rxAccessible
+ the Accessible object which created this context.
+ <p>If your derived implementation implements the XAccessible (and does not follow the proposed
+ separation of XAccessible from XAccessibleContext), you may pass <code>this</code> here.</p>
+
+ <p>The object is hold weak, so it's life time is not affected.</p>
+
+ <p>The object is needed for performance reasons: for <method>getAccessibleIndexInParent</method>,
+ all children (which are XAccessible's theirself) of our parent have to be asked. If we know our
+ XAccessible, we can compare it with all the children, instead of asking all children for their
+ context and comparing this context with ourself.</p>
+ */
+ void lateInit( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxAccessible );
+
+ /** retrieves the creator previously set with <method>lateInit</method>
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ getAccessibleCreator( ) const;
+
+ /** forgets the reference to the external lock, if present.
+
+ <p>This means any further locking will not be guard the external lock anymore, never.</p>
+
+ <p>To be used in derived classes which do not supply the external lock themself, but instead get
+ them passed from own derivees (or clients).</p>
+ */
+ void forgetExternalLock();
+
+ public:
+ // XAccessibleEventBroadcaster
+ virtual void SAL_CALL addAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext - still waiting to be overwritten
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException) = 0;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) = 0;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException) = 0;
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException) = 0;
+ virtual OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException) = 0;
+ virtual OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException) = 0;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException) = 0;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException) = 0;
+
+ // XAccessibleContext - default implementations
+ /** default implementation for retrieving the index of this object within the parent
+ <p>This basic implementation here returns the index <code>i</code> of the child for which
+ <code>&lt;parent&gt;.getAccessibleChild( i )</code> equals our creator.</p>
+ */
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException);
+ /** default implementation for retrieving the locale
+ <p>This basic implementation returns the locale of the parent context,
+ as retrieved via getAccessibleParent()->getAccessibleContext.</p>
+ */
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
+
+ public:
+ // helper struct for granting selective access rights
+ struct OAccessControl
+ {
+ friend class OContextEntryGuard;
+ friend class OContextHelper_Impl;
+ friend class OExternalLockGuard;
+ private:
+ OAccessControl() { }
+ };
+
+ // ensures that the object is alive
+ inline void ensureAlive( const OAccessControl& ) const SAL_THROW( ( ::com::sun::star::lang::DisposedException ) );
+ inline IMutex* getExternalLock( const OAccessControl& );
+ inline ::osl::Mutex& GetMutex( const OAccessControl& );
+
+ protected:
+ // OComponentHelper
+ virtual void SAL_CALL disposing();
+
+ protected:
+ // helper
+ /** notifies all AccessibleEventListeners of a certain event
+
+ @precond not too be called with our mutex locked
+ @param _nEventId
+ the id of the even. See AccessibleEventType
+ @param _rOldValue
+ the old value to be notified
+ @param _rNewValue
+ the new value to be notified
+ */
+ virtual void SAL_CALL NotifyAccessibleEvent(
+ const sal_Int16 _nEventId,
+ const ::com::sun::star::uno::Any& _rOldValue,
+ const ::com::sun::star::uno::Any& _rNewValue
+ );
+
+ // life time control
+ /// checks whether the object is alive (returns <TRUE/> then) or disposed
+ sal_Bool isAlive() const;
+ /// checks for beeing alive. If the object is already disposed (i.e. not alive), an exception is thrown.
+ void ensureAlive() const SAL_THROW( ( ::com::sun::star::lang::DisposedException ) );
+
+ /** ensures that the object is disposed.
+ @precond
+ to be called from within the destructor of your derived class only!
+ */
+ void ensureDisposed( );
+
+ /** shortcut for retrieving the context of the parent (returned by getAccessibleParent)
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ implGetParentContext() SAL_THROW( ( ::com::sun::star::uno::RuntimeException ) );
+
+ // access to the base class' broadcast helper/mutex
+ ::cppu::OBroadcastHelper& GetBroadcastHelper() { return rBHelper; }
+ const ::cppu::OBroadcastHelper& GetBroadcastHelper() const { return rBHelper; }
+ ::osl::Mutex& GetMutex() { return m_aMutex; }
+ IMutex* getExternalLock( );
+ };
+
+ //---------------------------------------------------------------------
+ inline void OAccessibleContextHelper::ensureAlive( const OAccessControl& ) const SAL_THROW( ( ::com::sun::star::lang::DisposedException ) )
+ {
+ ensureAlive();
+ }
+
+ //---------------------------------------------------------------------
+ inline IMutex* OAccessibleContextHelper::getExternalLock( const OAccessControl& )
+ {
+ return getExternalLock();
+ }
+
+ //---------------------------------------------------------------------
+ inline ::osl::Mutex& OAccessibleContextHelper::GetMutex( const OAccessControl& )
+ {
+ return GetMutex();
+ }
+
+ //=====================================================================
+ //= OContextEntryGuard
+ //=====================================================================
+ typedef ::osl::ClearableMutexGuard OContextEntryGuard_Base;
+ /** helper class for guarding the entry into OAccessibleContextHelper methods.
+
+ <p>The class has two responsibilities:
+ <ul><li>it locks the mutex of an OAccessibleContextHelper instance, as long as the guard lives</li>
+ <li>it checks if an given OAccessibleContextHelper instance is alive, else an exception is thrown
+ our of the constructor of the guard</li>
+ </ul>
+ <br/>
+ This makes it your first choice (hopefully :) for guarding any interface method implementations of
+ you derived class.
+ </p>
+ */
+ class OContextEntryGuard : public OContextEntryGuard_Base
+ {
+ public:
+ /** constructs the guard
+
+ <p>The given context (it's mutex, respectively) is locked, and an exception is thrown if the context
+ is not alive anymore. In the latter case, of course, the mutex is freed, again.</p>
+
+ @param _pContext
+ the context which shall be guarded
+ @precond <arg>_pContext</arg> != NULL
+ */
+ inline OContextEntryGuard( OAccessibleContextHelper* _pContext );
+
+ /** destructs the guard.
+ <p>The context (it's mutex, respectively) is unlocked.</p>
+ */
+ inline ~OContextEntryGuard();
+ };
+
+ //.....................................................................
+ inline OContextEntryGuard::OContextEntryGuard( OAccessibleContextHelper* _pContext )
+ :OContextEntryGuard_Base( _pContext->GetMutex( OAccessibleContextHelper::OAccessControl() ) )
+ {
+ _pContext->ensureAlive( OAccessibleContextHelper::OAccessControl() );
+ }
+
+ //.....................................................................
+ inline OContextEntryGuard::~OContextEntryGuard()
+ {
+ }
+
+ //=====================================================================
+ //= OExternalLockGuard
+ //=====================================================================
+ class OExternalLockGuard
+ :public OMutexGuard
+ ,public OContextEntryGuard
+ {
+ public:
+ inline OExternalLockGuard( OAccessibleContextHelper* _pContext );
+ inline ~OExternalLockGuard( );
+ };
+
+ //.....................................................................
+ inline OExternalLockGuard::OExternalLockGuard( OAccessibleContextHelper* _pContext )
+ :OMutexGuard( _pContext->getExternalLock( OAccessibleContextHelper::OAccessControl() ) )
+ ,OContextEntryGuard( _pContext )
+ {
+ // #102438#
+ // Only lock the external mutex,
+ // release the ::osl::Mutex of the OAccessibleContextHelper instance.
+ // If you call into another UNO object with locked ::osl::Mutex,
+ // this may lead to dead locks.
+ clear();
+ }
+
+ //.....................................................................
+ inline OExternalLockGuard::~OExternalLockGuard( )
+ {
+ }
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // COMPHELPER_ACCESSIBLE_CONTEXT_HELPER_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/accessibleeventnotifier.hxx b/include/comphelper/accessibleeventnotifier.hxx
new file mode 100644
index 000000000000..f0a745baa5a8
--- /dev/null
+++ b/include/comphelper/accessibleeventnotifier.hxx
@@ -0,0 +1,161 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_ACCESSIBLE_EVENT_NOTIFIER
+#define COMPHELPER_ACCESSIBLE_EVENT_NOTIFIER
+
+#include <com/sun/star/accessibility/AccessibleEventObject.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <osl/thread.hxx>
+#include <osl/conditn.hxx>
+#include <cppuhelper/interfacecontainer.h>
+#include "comphelper/comphelperdllapi.h"
+
+#include <map>
+#include <list>
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+ //=====================================================================
+ //= AccessibleEventNotifier
+ //=====================================================================
+ class COMPHELPER_DLLPUBLIC AccessibleEventNotifier
+ {
+ // typedefs
+ public:
+ typedef sal_uInt32 TClientId;
+
+ typedef ::std::pair< TClientId, ::com::sun::star::accessibility::AccessibleEventObject >
+ ClientEvent;
+
+ typedef ::cppu::OInterfaceContainerHelper EventListeners;
+ typedef ::std::map< TClientId, EventListeners*, ::std::less< TClientId > > ClientMap;
+
+ protected:
+ AccessibleEventNotifier( ); // never implemented
+ ~AccessibleEventNotifier( ); // never implemented
+
+ private:
+ COMPHELPER_DLLPRIVATE AccessibleEventNotifier( const AccessibleEventNotifier& ); // never implemented!
+ COMPHELPER_DLLPRIVATE AccessibleEventNotifier& operator=( const AccessibleEventNotifier& ); // never implemented!
+
+ public:
+ /** registers a client of this class, means a broadcaster of AccessibleEvents
+
+ <p>No precaution is taken to care for disposal of this component. When the component
+ dies, it <b>must</b> call <member>revokeClient</member> or <member>revokeClientNotifyDisposing</member>
+ explicitly itself.</p>
+ */
+ static TClientId registerClient( );
+
+ /** revokes a broadcaster of AccessibleEvents
+
+ <p>Note that no disposing event is fired when you use this method, the client is simply revoked.
+ You can for instance revoke a client if the last listener for it is revoked, but the client
+ itself is not disposed.<br/>
+ When the client is disposed, you should prefer <member>revokeClientNotifyDisposing</member></p>
+
+ <p>Any possibly pending events for this client are removed from the queue.</p>
+
+ @seealso revokeClientNotifyDisposing
+ */
+ static void revokeClient( const TClientId _nClient );
+
+ /** revokes a client, with additionally notifying a disposing event to all listeners registered for
+ this client
+
+ <p>Any other possibly pending events for this client are removed from the queue</p>
+
+ @param _nClient
+ the id of the client which should be revoked
+ @param _rxEventSource
+ the source to be notified together with the <member scope="com.sun.star.lang">XComponent::disposing</member>
+ call.
+ */
+ static void revokeClientNotifyDisposing(
+ const TClientId _nClient,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxEventSource
+ ) SAL_THROW( ( ) );
+
+ /** registers a listener for the given client
+
+ @param _nClient
+ the id of the client for which a listener should be registered
+ @return
+ the number of event listeners currently registered for this client
+ */
+ static sal_Int32 addEventListener(
+ const TClientId _nClient,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& _rxListener
+ ) SAL_THROW( ( ) );
+
+ /** revokes a listener for the given client
+
+ @param _nClient
+ the id of the client for which a listener should be revoked
+ @return
+ the number of event listeners currently registered for this client
+ */
+ static sal_Int32 removeEventListener(
+ const TClientId _nClient,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& _rxListener
+ ) SAL_THROW( ( ) );
+
+ /** adds an event, which is to be braodcasted, to the queue
+
+ @param _nClient
+ the id of the client which needs to broadcast the event
+ */
+ static void addEvent(
+ const TClientId _nClient,
+ const ::com::sun::star::accessibility::AccessibleEventObject& _rEvent
+ ) SAL_THROW( ( ) );
+
+ private:
+ /// generates a new client id
+ COMPHELPER_DLLPRIVATE static TClientId generateId();
+
+ /** looks up a client in our client map, asserts if it cannot find it or no event thread is present
+
+ @precond
+ to be called with our mutex locked
+
+ @param _nClient
+ the id of the client to loopup
+ @param _rPos
+ out-parameter for the position of the client in the client map
+
+ @return
+ <TRUE/> if and only if the client could be found and <arg>_rPos</arg> has been filled with
+ it's position
+ */
+ COMPHELPER_DLLPRIVATE static sal_Bool implLookupClient( const TClientId _nClient, ClientMap::iterator& _rPos );
+ };
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // COMPHELPER_ACCESSIBLE_EVENT_NOTIFIER
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/accessiblekeybindinghelper.hxx b/include/comphelper/accessiblekeybindinghelper.hxx
new file mode 100644
index 000000000000..4849b124cf87
--- /dev/null
+++ b/include/comphelper/accessiblekeybindinghelper.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_ACCESSIBLE_KEYBINDING_HELPER_HXX
+#define COMPHELPER_ACCESSIBLE_KEYBINDING_HELPER_HXX
+
+#include <com/sun/star/accessibility/XAccessibleKeyBinding.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <osl/mutex.hxx>
+
+#include <vector>
+
+#include "comphelper/comphelperdllapi.h"
+
+//..............................................................................
+namespace comphelper
+{
+//..............................................................................
+
+ //==============================================================================
+ // OAccessibleKeyBindingHelper
+ //==============================================================================
+
+ typedef ::cppu::WeakImplHelper1 < ::com::sun::star::accessibility::XAccessibleKeyBinding
+ > OAccessibleKeyBindingHelper_Base;
+
+ /** a helper class for implementing an accessible keybinding
+ */
+ class COMPHELPER_DLLPUBLIC OAccessibleKeyBindingHelper : public OAccessibleKeyBindingHelper_Base
+ {
+ private:
+ typedef ::std::vector< ::com::sun::star::uno::Sequence< ::com::sun::star::awt::KeyStroke > > KeyBindings;
+
+ KeyBindings m_aKeyBindings;
+
+ protected:
+ ::osl::Mutex m_aMutex;
+
+ virtual ~OAccessibleKeyBindingHelper();
+
+ public:
+ OAccessibleKeyBindingHelper();
+ OAccessibleKeyBindingHelper( const OAccessibleKeyBindingHelper& rHelper );
+
+ void AddKeyBinding( const ::com::sun::star::uno::Sequence< ::com::sun::star::awt::KeyStroke >& rKeyBinding ) throw (::com::sun::star::uno::RuntimeException);
+ void AddKeyBinding( const ::com::sun::star::awt::KeyStroke& rKeyStroke ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleKeyBinding
+ virtual sal_Int32 SAL_CALL getAccessibleKeyBindingCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::awt::KeyStroke > SAL_CALL getAccessibleKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ };
+
+//..............................................................................
+} // namespace comphelper
+//..............................................................................
+
+#endif // COMPHELPER_ACCESSIBLE_KEYBINDING_HELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/accessibleselectionhelper.hxx b/include/comphelper/accessibleselectionhelper.hxx
new file mode 100644
index 000000000000..e1bb5dd5f1ef
--- /dev/null
+++ b/include/comphelper/accessibleselectionhelper.hxx
@@ -0,0 +1,124 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_ACCESSIBLE_SELECTION_HELPER_HXX
+#define COMPHELPER_ACCESSIBLE_SELECTION_HELPER_HXX
+
+#include <comphelper/uno3.hxx>
+#include <comphelper/accessiblecomponenthelper.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include "comphelper/comphelperdllapi.h"
+
+#define ACCESSIBLE_SELECTION_CHILD_ALL ((sal_Int32)-1)
+#define ACCESSIBLE_SELECTION_CHILD_SELF ((sal_Int32)-2)
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+ //=====================================================================
+ //= OCommonAccessibleSelection
+ //=====================================================================
+ /** base class encapsulating common functionality for the helper classes implementing
+ the XAccessibleSelection
+ */
+ class COMPHELPER_DLLPUBLIC OCommonAccessibleSelection
+ {
+ protected:
+
+ OCommonAccessibleSelection();
+
+ ~OCommonAccessibleSelection();
+
+ protected:
+
+ // access to context - still waiting to be overwritten
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ implGetAccessibleContext()
+ throw ( ::com::sun::star::uno::RuntimeException ) = 0;
+
+ // return if the specified child is visible => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
+ virtual sal_Bool
+ implIsSelected( sal_Int32 nAccessibleChildIndex )
+ throw (::com::sun::star::uno::RuntimeException) = 0;
+
+ // select the specified child => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
+ virtual void
+ implSelect( sal_Int32 nAccessibleChildIndex, sal_Bool bSelect )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) = 0;
+
+ protected:
+
+ /** non-virtual versions of the methods which can be implemented using <method>implIsSelected</method> and <method>implSelect</method>
+ */
+ void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException);
+ void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ };
+
+ //=====================================================================
+ //= OAccessibleSelectionHelper
+ //=====================================================================
+
+ typedef ::cppu::ImplHelper1< ::com::sun::star::accessibility::XAccessibleSelection > OAccessibleSelectionHelper_Base;
+
+ /** a helper class for implementing an AccessibleSelection which at the same time
+ supports an XAccessibleSelection interface.
+ */
+ class COMPHELPER_DLLPUBLIC OAccessibleSelectionHelper : public OAccessibleComponentHelper,
+ public OCommonAccessibleSelection,
+ public OAccessibleSelectionHelper_Base
+ {
+ protected:
+
+ /// see the respective base class ctor for an extensive comment on this, please
+ OAccessibleSelectionHelper( IMutex* _pExternalLock );
+
+ // return ourself here by default
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > implGetAccessibleContext() throw ( ::com::sun::star::uno::RuntimeException );
+
+ public:
+
+ // XInterface
+ DECLARE_XINTERFACE( )
+ DECLARE_XTYPEPROVIDER( )
+
+ // XAccessibleSelection - default implementations
+ virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ };
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // COMPHELPER_ACCESSIBLE_SELECTION_HELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/accessibletexthelper.hxx b/include/comphelper/accessibletexthelper.hxx
new file mode 100644
index 000000000000..ea3f505ee7fe
--- /dev/null
+++ b/include/comphelper/accessibletexthelper.hxx
@@ -0,0 +1,178 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_ACCESSIBLE_TEXT_HELPER_HXX
+#define COMPHELPER_ACCESSIBLE_TEXT_HELPER_HXX
+
+#include <com/sun/star/accessibility/XAccessibleText.hpp>
+#include <com/sun/star/accessibility/TextSegment.hpp>
+#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <com/sun/star/i18n/XCharacterClassification.hpp>
+#include <comphelper/accessiblecomponenthelper.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+
+//..............................................................................
+namespace comphelper
+{
+//..............................................................................
+
+ //==============================================================================
+ // OCommonAccessibleText
+ //==============================================================================
+ /** base class encapsulating common functionality for the helper classes implementing
+ the XAccessibleText
+ */
+ class COMPHELPER_DLLPUBLIC OCommonAccessibleText
+ {
+ private:
+ ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XBreakIterator > m_xBreakIter;
+ ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XCharacterClassification > m_xCharClass;
+
+ protected:
+ OCommonAccessibleText();
+ virtual ~OCommonAccessibleText();
+
+ ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XBreakIterator > implGetBreakIterator();
+ ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XCharacterClassification > implGetCharacterClassification();
+ sal_Bool implIsValidBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nLength );
+ virtual sal_Bool implIsValidIndex( sal_Int32 nIndex, sal_Int32 nLength );
+ virtual sal_Bool implIsValidRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex, sal_Int32 nLength );
+ virtual OUString implGetText() = 0;
+ virtual ::com::sun::star::lang::Locale implGetLocale() = 0;
+ virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) = 0;
+ virtual void implGetGlyphBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nIndex );
+ virtual sal_Bool implGetWordBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nIndex );
+ virtual void implGetSentenceBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nIndex );
+ virtual void implGetParagraphBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nIndex );
+ virtual void implGetLineBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nIndex );
+
+ /** non-virtual versions of the methods
+ */
+ sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException);
+ OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException);
+ OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException);
+ OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ public:
+
+ /** Helper method, that detects the difference between
+ two strings and returns the deleted selection and
+ the inserted selection if available.
+
+ @returns true if there are differences between the
+ two strings and false if both are equal
+
+ @see ::com::sun::star::accessibility::AccessibleEventId
+ ::com::sun::star::accessibility::TextSegment
+ */
+ static bool implInitTextChangedEvent(
+ const OUString& rOldString,
+ const OUString& rNewString,
+ /*out*/ ::com::sun::star::uno::Any& rDeleted,
+ /*out*/ ::com::sun::star::uno::Any& rInserted); // throw()
+ };
+
+
+ //==============================================================================
+ // OAccessibleTextHelper
+ //==============================================================================
+
+ typedef ::cppu::ImplHelper1 < ::com::sun::star::accessibility::XAccessibleText
+ > OAccessibleTextHelper_Base;
+
+ /** a helper class for implementing an AccessibleExtendedComponent which at the same time
+ supports an XAccessibleText interface
+ */
+ class COMPHELPER_DLLPUBLIC OAccessibleTextHelper : public OAccessibleExtendedComponentHelper,
+ public OCommonAccessibleText,
+ public OAccessibleTextHelper_Base
+ {
+ protected:
+ // see the respective base class ctor for an extensive comment on this, please
+ OAccessibleTextHelper( IMutex* _pExternalLock );
+
+ public:
+ // XInterface
+ DECLARE_XINTERFACE( )
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER( )
+
+ // XAccessibleText
+ virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ };
+
+//..............................................................................
+} // namespace comphelper
+//..............................................................................
+
+#endif // COMPHELPER_ACCESSIBLE_TEXT_HELPER_HXX
+
+
+// -----------------------------------------------------------------------------
+//
+// OAccessibleTextHelper is a helper class for implementing the
+// XAccessibleText interface.
+//
+// The following methods have a default implementation:
+//
+// getCharacter
+// getCharacterCount
+// getSelectedText
+// getSelectionStart
+// getSelectionEnd
+// getText
+// getTextRange
+// getTextAtIndex
+// getTextBeforeIndex
+// getTextBehindIndex
+//
+// The following methods must be overriden by derived classes:
+//
+// implGetText
+// implGetLocale
+// implGetSelection
+// getCaretPosition
+// setCaretPosition
+// getCharacterAttributes
+// getCharacterBounds
+// getIndexAtPoint
+// setSelection
+// copyText
+//
+// -----------------------------------------------------------------------------
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/accessiblewrapper.hxx b/include/comphelper/accessiblewrapper.hxx
new file mode 100644
index 000000000000..fbd65d638899
--- /dev/null
+++ b/include/comphelper/accessiblewrapper.hxx
@@ -0,0 +1,410 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_ACCESSIBLE_WRAPPER_HXX
+#define COMPHELPER_ACCESSIBLE_WRAPPER_HXX
+
+#include <comphelper/proxyaggregation.hxx>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <cppuhelper/compbase3.hxx>
+#include <cppuhelper/compbase2.hxx>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/sequence.hxx>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <comphelper/accessibleeventnotifier.hxx>
+#include <comphelper/stl_types.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+//.............................................................................
+namespace comphelper
+{
+//.............................................................................
+
+ //=========================================================================
+ //= OAccessibleWrapper
+ //=========================================================================
+
+ class OAccessibleContextWrapper;
+ class OWrappedAccessibleChildrenManager;
+
+ struct OAccessibleWrapper_Base :
+ public ::cppu::ImplHelper1 < ::com::sun::star::accessibility::XAccessible >
+ {
+ protected:
+ ~OAccessibleWrapper_Base() {}
+ };
+
+ /** a class which aggregates a proxy for an XAccessible, and wrapping the context returned by this
+ XAccessible.
+ */
+ class COMPHELPER_DLLPUBLIC OAccessibleWrapper:public OAccessibleWrapper_Base
+ ,public OComponentProxyAggregation
+
+ {
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ m_xParentAccessible;
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessibleContext >
+ m_aContext;
+
+ protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ m_xInnerAccessible;
+
+ public:
+ /** ctor
+ @param _rxContext
+ a service factory
+
+ @param _rxInnerAccessible
+ the object to wrap
+
+ @param _rxParentAccessible
+ The XAccessible which is our parent
+ */
+ OAccessibleWrapper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxInnerAccessible,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParentAccessible
+ );
+ DECLARE_XINTERFACE()
+ DECLARE_XTYPEPROVIDER()
+
+ // returns the context without creating it
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ getContextNoCreate( ) const;
+
+ protected:
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL
+ getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ getParent() const { return m_xParentAccessible; }
+
+ // own overridables
+ virtual OAccessibleContextWrapper* createAccessibleContext(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >& _rxInnerContext
+ );
+
+ protected:
+ ~OAccessibleWrapper( );
+
+ private:
+ COMPHELPER_DLLPRIVATE OAccessibleWrapper( ); // never implemented
+ COMPHELPER_DLLPRIVATE OAccessibleWrapper( const OAccessibleWrapper& ); // never implemented
+ COMPHELPER_DLLPRIVATE OAccessibleWrapper& operator=( const OAccessibleWrapper& ); // never implemented
+ };
+
+ //=========================================================================
+ //= OAccessibleContextWrapperHelper
+ //=========================================================================
+
+ typedef ::cppu::ImplHelper1 < ::com::sun::star::accessibility::XAccessibleEventListener
+ > OAccessibleContextWrapperHelper_Base;
+
+ /** Helper for wrapping an XAccessibleContext by aggregating a proxy for it.
+
+ <p>This class does not have own ref counting. In addition, it does not implement
+ the XAccesibleContext interface, but provides all the methods from this interface
+ which must be implemented using the inner context (such as getAccessibleChild*).</p>
+
+ <p>Children of the aggregated XAccessibleContext are wrapped, too.</p>
+
+ <p>AccessibleEvents fired by the inner context are multiplexed, especially, any references to
+ children in such events are translated. This means that even in such events, no un-wrapped object
+ will ever leave this class - if the aggregated context notifies an child event, the child passed
+ to the event is wrapped</p>
+
+ @seealso OAccessibleContextWrapper
+ */
+ class COMPHELPER_DLLPUBLIC OAccessibleContextWrapperHelper
+ :private OComponentProxyAggregationHelper
+ ,public OAccessibleContextWrapperHelper_Base
+ {
+ protected:
+ /// the context we're wrapping (properly typed, in opposite to OComponentProxyAggregationHelper::m_xInner)
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ m_xInnerContext;
+ /// the XAccessible which created this context
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ m_xOwningAccessible;
+ /// the XAccessible which is to be returned in getAccessibleParent
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ m_xParentAccessible;
+
+ OWrappedAccessibleChildrenManager* m_pChildMapper; // for mapping children from our inner context to our callers
+
+ protected:
+ /** ctor
+
+ @param _rxContext
+ a service factory
+
+ @param _rxInnerAccessibleContext
+ the object to wrap
+
+ @param _rxOwningAccessible
+ The XAccessible which created this object. This is necessary because children
+ of our wrapped context meed to be wrapped, too, and if they're asked for a parent,
+ they of course should return the proper parent<br/>
+ The object will be held with a hard reference
+
+ @param _rxParentAccessible
+ The XAccessible to return in the getAccessibleParent call
+ */
+ OAccessibleContextWrapperHelper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext,
+ ::cppu::OBroadcastHelper& _rBHelper,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >& _rxInnerAccessibleContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxOwningAccessible,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParentAccessible
+ );
+
+ /// to be called from within your ctor - does the aggregation of a proxy for m_xInnerContext
+ void aggregateProxy(
+ oslInterlockedCount& _rRefCount,
+ ::cppu::OWeakObject& _rDelegator
+ );
+
+ protected:
+ // XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER( )
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleEventListener
+ virtual void SAL_CALL notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent/OComponentProxyAggregationHelper
+ virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException );
+
+ // own overridables
+ /** notify an accessible event which has been translated (if necessary)
+
+ <p>Usually, you derive your clas from both OAccessibleContextWrapperHelper and XAccessibleEventBroadcaster,
+ and simply call all your XAccessibleEventListener with the given event.</p>
+
+ <p>The mutex of the BroadcastHelper passed to the instance's ctor is <em>not</em> locked when calling
+ into this method</p>
+ */
+ virtual void notifyTranslatedEvent( const ::com::sun::star::accessibility::AccessibleEventObject& _rEvent ) throw (::com::sun::star::uno::RuntimeException) = 0;
+
+ protected:
+ ~OAccessibleContextWrapperHelper( );
+
+ OAccessibleContextWrapperHelper( ); // never implemented
+ OAccessibleContextWrapperHelper( const OAccessibleContextWrapperHelper& ); // never implemented
+ OAccessibleContextWrapperHelper& operator=( const OAccessibleContextWrapperHelper& ); // never implemented
+ };
+
+ //=========================================================================
+ //= OAccessibleContextWrapper
+ //=========================================================================
+ typedef ::cppu::PartialWeakComponentImplHelper2< ::com::sun::star::accessibility::XAccessibleEventBroadcaster
+ , ::com::sun::star::accessibility::XAccessibleContext
+ > OAccessibleContextWrapper_CBase;
+
+ class COMPHELPER_DLLPUBLIC OAccessibleContextWrapper
+ :public OBaseMutex
+ ,public OAccessibleContextWrapper_CBase
+ ,public OAccessibleContextWrapperHelper
+ {
+ private:
+ ::comphelper::AccessibleEventNotifier::TClientId m_nNotifierClient; // for notifying AccessibleEvents
+
+ public:
+ /** ctor
+
+ @param _rxContext
+ a service factory
+
+ @param _rxInnerAccessibleContext
+ the object to wrap
+
+ @param _rxOwningAccessible
+ The XAccessible which created this object. This is necessary because children
+ of our wrapped context meed to be wrapped, too, and if they're asked for a parent,
+ they of course should return the proper parent<br/>
+ The object will be held with a hard reference
+
+ @param _rxParentAccessible
+ The XAccessible to return in the getAccessibleParent call
+ */
+ OAccessibleContextWrapper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >& _rxInnerAccessibleContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxOwningAccessible,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParentAccessible
+ );
+
+ // XInterface
+ DECLARE_XINTERFACE( )
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER( )
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleEventBroadcaster
+ virtual void SAL_CALL addAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // OAccessibleContextWrapper
+ virtual void notifyTranslatedEvent( const ::com::sun::star::accessibility::AccessibleEventObject& _rEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener)throw (::com::sun::star::uno::RuntimeException)
+ { WeakComponentImplHelperBase::addEventListener(xListener); }
+ virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener)throw (::com::sun::star::uno::RuntimeException)
+ { WeakComponentImplHelperBase::removeEventListener(xListener); }
+
+ // OComponentHelper
+ using OAccessibleContextWrapperHelper::disposing;
+ virtual void SAL_CALL disposing() throw (::com::sun::star::uno::RuntimeException);
+
+ protected:
+ virtual ~OAccessibleContextWrapper();
+
+ private:
+ COMPHELPER_DLLPRIVATE OAccessibleContextWrapper(); // never implemented
+ COMPHELPER_DLLPRIVATE OAccessibleContextWrapper( const OAccessibleContextWrapper& ); // never implemented
+ COMPHELPER_DLLPRIVATE OAccessibleContextWrapper& operator=( const OAccessibleContextWrapper& ); // never implemented
+ };
+
+ //=========================================================================
+ //= OWrappedAccessibleChildrenManager
+ //=========================================================================
+
+ typedef ::std::map < ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ , ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ , OInterfaceCompare< ::com::sun::star::accessibility::XAccessible >
+ > AccessibleMap;
+ // TODO: think about if we should hold these objects weak
+
+ typedef ::cppu::WeakImplHelper1 < ::com::sun::star::lang::XEventListener
+ > OWrappedAccessibleChildrenManager_Base;
+ /** manages wrapping XAccessible's to XAccessible's
+ */
+ class COMPHELPER_DLLPUBLIC OWrappedAccessibleChildrenManager : public OWrappedAccessibleChildrenManager_Base
+ {
+ protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ m_xContext;
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessible >
+ m_aOwningAccessible; // the XAccessible which belongs to the XAccessibleContext which we work for
+ AccessibleMap m_aChildrenMap; // for caching children
+ sal_Bool m_bTransientChildren; // are we prohibited to cache our children?
+
+ public:
+ /// ctor
+ OWrappedAccessibleChildrenManager(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext
+ );
+
+ /** specifies if the children are to be consideren transient (i.e.: not cached)
+ <p>to be called only once per lifetime</p>
+ */
+ void setTransientChildren( sal_Bool _bSet = sal_True );
+
+ /** sets the XAccessible which belongs to the XAccessibleContext which we work for
+ <p>to be called only once per lifetime</p>
+ */
+ void setOwningAccessible( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxAcc );
+
+ /// retrieves a wrapper for the given accessible
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ getAccessibleWrapperFor(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxKey,
+ sal_Bool _bCreate = sal_True
+ );
+
+ /// erases the given key from the map (if it is present there)
+ void removeFromCache( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxKey );
+
+ /// invalidates (i.e. empties) the map
+ void invalidateAll( );
+
+ /** disposes (i.e. cleares) the manager
+
+ <p>Note that the XAccessibleContext's of the mapped XAccessible objects are disposed, too.</p>
+ */
+ void dispose();
+
+ /** handles a notification as got from the parent of the children we're managing
+ <p>This applies only to the notifications which have a direct impact on our map.</p>
+ */
+ void handleChildNotification( const ::com::sun::star::accessibility::AccessibleEventObject& _rEvent );
+
+ /** translates events as got from the parent of the children we're managing
+ <p>This applies only to the notifications which deal with child objects which we manage.</p>
+ */
+ void translateAccessibleEvent(
+ const ::com::sun::star::accessibility::AccessibleEventObject& _rEvent,
+ ::com::sun::star::accessibility::AccessibleEventObject& _rTranslatedEvent
+ );
+
+ protected:
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+
+ protected:
+ void implTranslateChildEventValue( const ::com::sun::star::uno::Any& _rInValue, ::com::sun::star::uno::Any& _rOutValue );
+
+ protected:
+ ~OWrappedAccessibleChildrenManager( );
+
+ private:
+ COMPHELPER_DLLPRIVATE OWrappedAccessibleChildrenManager( ); // never implemented
+ COMPHELPER_DLLPRIVATE OWrappedAccessibleChildrenManager( const OWrappedAccessibleChildrenManager& ); // never implemented
+ COMPHELPER_DLLPRIVATE OWrappedAccessibleChildrenManager& operator=( const OWrappedAccessibleChildrenManager& ); // never implemented
+ };
+
+//.............................................................................
+} // namespace accessibility
+//.............................................................................
+
+#endif // COMPHELPER_ACCESSIBLE_WRAPPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/accimplaccess.hxx b/include/comphelper/accimplaccess.hxx
new file mode 100644
index 000000000000..3407c5a7b8b4
--- /dev/null
+++ b/include/comphelper/accimplaccess.hxx
@@ -0,0 +1,141 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_ACCIMPLACCESS_HXX
+#define COMPHELPER_ACCIMPLACCESS_HXX
+
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include "comphelper/comphelperdllapi.h"
+
+// forward declaration
+namespace com { namespace sun { namespace star { namespace accessibility {
+ class XAccessible;
+ class XAccessibleContext;
+}}}}
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+ //=====================================================================
+ //= OAccessibleImplementationAccess
+ //=====================================================================
+ typedef ::cppu::ImplHelper1 < ::com::sun::star::lang::XUnoTunnel
+ > OAccImpl_Base;
+ struct OAccImpl_Impl;
+
+ /** This is a helper class which allows accessing several aspects of the implementation
+ of an AccessibleContext.
+
+ <p>For instance, when you want to implement a context which can be re-parented, you:
+ <ul><li>derive your class from <type>OAccessibleImplementationAccess</type></li>
+ <li>use <code>setAccessibleParent( <em>component</em>, <em>new_parent</em> )</code>
+ </ul>
+ </p>
+
+ <p>Another aspect which can be controlled from the outside are states. If you have a class which
+ has only partial control over it's states, you may consider deriving from OAccessibleImplementationAccess.<br/>
+ For instance, say you have an implementation (say component A) which is <em>unable</em> to know or to
+ determine if the represented object is selected, but another component (say B) which uses A (and integrates
+ it into a tree of accessibility components) is.<br/>
+ In this case, if A is derived from OAccessibleImplementationAccess, B can manipulate this
+ foreign-controlled state flag "SELECTED" by using the static helper methods on this class.</p>
+
+ <p>Please note that the support for foreign controlled states is rather restrictive: You can't have states
+ which <em>may be</em> controlled by a foreign instances. This is implied by the fact that a derived
+ class can ask for states which are <em>set</em> only, not for the ones which are <em>reset</em> currently.
+ </p>
+ */
+ class COMPHELPER_DLLPUBLIC OAccessibleImplementationAccess : public OAccImpl_Base
+ {
+ private:
+ OAccImpl_Impl* m_pImpl;
+
+ protected:
+ /// retrieves the parent previously set via <method>setAccessibleParent</method>
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ implGetForeignControlledParent( ) const;
+
+ /** retrieves the set of currently set states which are controlled by a foreign instance
+ @return
+ a bit mask, where a set bit 2^n means that the AccessibleStateType n has been set
+ */
+ sal_Int64 implGetForeignControlledStates( ) const;
+
+ /// sets the accessible parent component
+ virtual void setAccessibleParent(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxAccParent );
+
+ /// sets or resets a bit of the foreign controlled states
+ virtual void setStateBit( const sal_Int16 _nState, const sal_Bool _bSet );
+
+ protected:
+ OAccessibleImplementationAccess( );
+ virtual ~OAccessibleImplementationAccess( );
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& _rIdentifier ) throw (::com::sun::star::uno::RuntimeException);
+
+ public:
+ /** tries to access the implementation of an OAccessibleImplementationAccess derivee which is known as
+ interface only.
+
+ @param _rxComponent
+ is the component which should be examined.
+ @return
+ the pointer to the implementation, if successful. The only known error condition so far
+ is an invalid context (which means it is <NULL/>, or the implementation is not derived
+ from <type>OAccessibleImplementationAccess</type>, or retrieving the implementation failed).
+ */
+ static OAccessibleImplementationAccess* getImplementation(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >& _rxComponent
+ );
+
+
+ /** sets the parent for a derived implementation
+
+ @param _rxComponent
+ is the component which's new parent should be set
+ @param _rxNewParent
+ is the new parent of the component
+ @return
+ <TRUE/> in case of success, <FALSE/> otherwise. For error condition please look at
+ <method>getImplementation</method>.
+ */
+ static sal_Bool setAccessibleParent(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >& _rxComponent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxNewParent
+ );
+
+
+ private:
+ COMPHELPER_DLLPRIVATE static const ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
+ };
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+
+#endif // COMPHELPER_ACCIMPLACCESS_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/anycompare.hxx b/include/comphelper/anycompare.hxx
new file mode 100644
index 000000000000..fb17b7ca67ec
--- /dev/null
+++ b/include/comphelper/anycompare.hxx
@@ -0,0 +1,219 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_ANYCOMPARE_HXX
+#define COMPHELPER_ANYCOMPARE_HXX
+
+#include "comphelper/comphelperdllapi.h"
+
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/i18n/XCollator.hpp>
+
+#include <comphelper/extract.hxx>
+
+#include <functional>
+#include <memory>
+
+//......................................................................................................................
+namespace comphelper
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= IKeyPredicateLess
+ //==================================================================================================================
+ class SAL_NO_VTABLE IKeyPredicateLess
+ {
+ public:
+ virtual bool isLess( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _rhs ) const = 0;
+ virtual ~IKeyPredicateLess() {}
+ };
+
+ //==================================================================================================================
+ //= LessPredicateAdapter
+ //==================================================================================================================
+ struct LessPredicateAdapter : public ::std::binary_function< ::com::sun::star::uno::Any, ::com::sun::star::uno::Any, bool >
+ {
+ LessPredicateAdapter( const IKeyPredicateLess& _predicate )
+ :m_predicate( _predicate )
+ {
+ }
+
+ bool operator()( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _rhs ) const
+ {
+ return m_predicate.isLess( _lhs, _rhs );
+ }
+
+ private:
+ IKeyPredicateLess const & m_predicate;
+
+ private:
+ LessPredicateAdapter(); // never implemented
+ };
+
+ //==================================================================================================================
+ //= ScalarPredicateLess
+ //==================================================================================================================
+ template< typename SCALAR >
+ class ScalarPredicateLess : public IKeyPredicateLess
+ {
+ public:
+ virtual bool isLess( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _rhs ) const
+ {
+ SCALAR lhs(0), rhs(0);
+ if ( !( _lhs >>= lhs )
+ || !( _rhs >>= rhs )
+ )
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ return lhs < rhs;
+ }
+ };
+
+ //==================================================================================================================
+ //= StringPredicateLess
+ //==================================================================================================================
+ class StringPredicateLess : public IKeyPredicateLess
+ {
+ public:
+ virtual bool isLess( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _rhs ) const
+ {
+ OUString lhs, rhs;
+ if ( !( _lhs >>= lhs )
+ || !( _rhs >>= rhs )
+ )
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ return lhs < rhs;
+ }
+ };
+
+ //==================================================================================================================
+ //= StringCollationPredicateLess
+ //==================================================================================================================
+ class StringCollationPredicateLess : public IKeyPredicateLess
+ {
+ public:
+ StringCollationPredicateLess( ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCollator > const & i_collator )
+ :m_collator( i_collator )
+ {
+ }
+
+ virtual bool isLess( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _rhs ) const
+ {
+ OUString lhs, rhs;
+ if ( !( _lhs >>= lhs )
+ || !( _rhs >>= rhs )
+ )
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ return m_collator->compareString( lhs, rhs ) < 0;
+ }
+
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCollator > const m_collator;
+ };
+
+ //==================================================================================================================
+ //= TypePredicateLess
+ //==================================================================================================================
+ class TypePredicateLess : public IKeyPredicateLess
+ {
+ public:
+ virtual bool isLess( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _rhs ) const
+ {
+ ::com::sun::star::uno::Type lhs, rhs;
+ if ( !( _lhs >>= lhs )
+ || !( _rhs >>= rhs )
+ )
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ return lhs.getTypeName() < rhs.getTypeName();
+ }
+ };
+
+ //==================================================================================================================
+ //= EnumPredicateLess
+ //==================================================================================================================
+ class EnumPredicateLess : public IKeyPredicateLess
+ {
+ public:
+ EnumPredicateLess( ::com::sun::star::uno::Type const & _enumType )
+ :m_enumType( _enumType )
+ {
+ }
+
+ virtual bool isLess( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _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 ::com::sun::star::lang::IllegalArgumentException();
+ return lhs < rhs;
+ }
+
+ private:
+ ::com::sun::star::uno::Type const m_enumType;
+ };
+
+ //==================================================================================================================
+ //= InterfacePredicateLess
+ //==================================================================================================================
+ class InterfacePredicateLess : public IKeyPredicateLess
+ {
+ public:
+ virtual bool isLess( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _rhs ) const
+ {
+ if ( ( _lhs.getValueTypeClass() != ::com::sun::star::uno::TypeClass_INTERFACE )
+ || ( _rhs.getValueTypeClass() != ::com::sun::star::uno::TypeClass_INTERFACE )
+ )
+ throw ::com::sun::star::lang::IllegalArgumentException();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > lhs( _lhs, ::com::sun::star::uno::UNO_QUERY );
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > rhs( _rhs, ::com::sun::star::uno::UNO_QUERY );
+ return lhs.get() < rhs.get();
+ }
+ };
+
+ //==================================================================================================================
+ //= getStandardLessPredicate
+ //==================================================================================================================
+ /** creates a default IKeyPredicateLess instance for the given UNO type
+ @param i_type
+ the type for which a predicate instance should be created
+ @param i_collator
+ specifies a collator instance to use, or <NULL/>. If <NULL/>, strings will be compared using the <code>&lt</code>
+ operator, otherwise the collator will be used. The parameter is ignored if <arg>i_type</arg> does not specify
+ the string type.
+ @return
+ a default implementation of IKeyPredicateLess, which is able to compare values of the given type. If no
+ such default implementation is known for the given type, then <NULL/> is returned.
+ */
+ ::std::auto_ptr< IKeyPredicateLess > COMPHELPER_DLLPUBLIC
+ getStandardLessPredicate(
+ ::com::sun::star::uno::Type const & i_type,
+ ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCollator > const & i_collator
+ );
+
+//......................................................................................................................
+} // namespace comphelper
+//......................................................................................................................
+
+#endif // COMPHELPER_ANYCOMPARE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/anytostring.hxx b/include/comphelper/anytostring.hxx
new file mode 100644
index 000000000000..e68779854292
--- /dev/null
+++ b/include/comphelper/anytostring.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_ANYTOSTRING_HXX
+#define INCLUDED_COMPHELPER_ANYTOSTRING_HXX
+
+#include "rtl/ustring.hxx"
+#include "com/sun/star/uno/Any.hxx"
+#include "comphelper/comphelperdllapi.h"
+
+namespace comphelper
+{
+
+/** Creates a STRING representation out of an ANY value.
+
+ @param value
+ ANY value
+ @return
+ STRING representation of given ANY value
+*/
+COMPHELPER_DLLPUBLIC OUString anyToString( ::com::sun::star::uno::Any const & value );
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/asyncnotification.hxx b/include/comphelper/asyncnotification.hxx
new file mode 100644
index 000000000000..19c1910dbc8f
--- /dev/null
+++ b/include/comphelper/asyncnotification.hxx
@@ -0,0 +1,184 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_ASYNCNOTIFICATION_HXX
+#define COMPHELPER_ASYNCNOTIFICATION_HXX
+
+#include "sal/config.h"
+
+#include "boost/scoped_ptr.hpp"
+#include "comphelper/comphelperdllapi.h"
+#include "rtl/ref.hxx"
+#include "sal/types.h"
+#include "salhelper/thread.hxx"
+
+//........................................................................
+namespace comphelper
+{
+//........................................................................
+
+ //====================================================================
+ //= AnyEvent
+ //====================================================================
+ /** the very basic instance to hold a description of an event
+ */
+ class COMPHELPER_DLLPUBLIC AnyEvent : ::rtl::IReference
+ {
+ private:
+ oslInterlockedCount m_refCount;
+
+ public:
+ AnyEvent();
+
+ virtual oslInterlockedCount SAL_CALL acquire();
+ virtual oslInterlockedCount SAL_CALL release();
+
+ protected:
+ virtual ~AnyEvent();
+
+ private:
+ AnyEvent( AnyEvent& ); // not defined
+ void operator=( AnyEvent& ); // not defined
+ };
+
+ //====================================================================
+ //= typedefs
+ //====================================================================
+ typedef ::rtl::Reference< AnyEvent > AnyEventRef;
+
+ //====================================================================
+ //= IEventProcessor
+ //====================================================================
+ /** an event processor
+
+ @see AsyncEventNotifier
+ */
+ class SAL_NO_VTABLE IEventProcessor
+ {
+ public:
+ /** process a single event
+ */
+ virtual void processEvent( const AnyEvent& _rEvent ) = 0;
+
+ virtual void SAL_CALL acquire() = 0;
+ virtual void SAL_CALL release() = 0;
+
+ protected:
+ ~IEventProcessor() {}
+ };
+
+ //====================================================================
+ //= AsyncEventNotifier
+ //====================================================================
+ struct EventNotifierImpl;
+
+ /** a helper class for notifying events asynchronously
+
+ If you need to notify certain events to external components, you usually should
+ not do this while you have mutexes locked, to prevent multi-threading issues.
+
+ However, you do not always have complete control over all mutex guards on the stack.
+ If, in such a case, the listener notification is one-way, you can decide to do it
+ asynchronously.
+
+ The ->AsyncEventNotifier helps you to process such events asynchronously. Every
+ event is tied to an ->IEventProcessor which is responsible for processing it.
+
+ The AsyncEventNotifier is implemented as a thread itself, which sleeps as long as there are no
+ events in the queue. As soon as you add an event, the thread is woken up, processes the event,
+ and sleeps again.
+ */
+ class COMPHELPER_DLLPUBLIC AsyncEventNotifier: public salhelper::Thread
+ {
+ friend struct EventNotifierImpl;
+
+ private:
+ boost::scoped_ptr< EventNotifierImpl > m_pImpl;
+
+ SAL_DLLPRIVATE virtual ~AsyncEventNotifier();
+
+ // Thread
+ SAL_DLLPRIVATE virtual void execute();
+
+ public:
+ /** constructs a notifier thread
+
+ @param name the thread name, see ::osl_setThreadName; must not be
+ null
+ */
+ AsyncEventNotifier(char const * name);
+
+ /** terminates the thread
+
+ Note that this is a cooporative termination - if you call this from a thread different
+ from the notification thread itself, then it will block until the notification thread
+ finished processing the current event. If you call it from the notification thread
+ itself, it will return immediately, and the thread will be terminated as soon as
+ the current notification is finished.
+ */
+ virtual void SAL_CALL terminate();
+
+ /** adds an event to the queue, together with the instance which is responsible for
+ processing it
+
+ @param _rEvent
+ the event to add to the queue
+ @param _xProcessor
+ the processor for the event.<br/>
+ Beware of life time issues here. If your event processor dies or becomes otherwise
+ nonfunctional, you are responsible for removing all respective events from the queue.
+ You can do this by calling ->removeEventsForProcessor
+ */
+ void addEvent( const AnyEventRef& _rEvent, const ::rtl::Reference< IEventProcessor >& _xProcessor );
+
+ /** removes all events for the given event processor from the queue
+ */
+ void removeEventsForProcessor( const ::rtl::Reference< IEventProcessor >& _xProcessor );
+ };
+
+ //====================================================================
+ //= EventHolder
+ //====================================================================
+ /** AnyEvent derivee holding an foreign event instance
+ */
+ template < typename EVENT_OBJECT >
+ class EventHolder : public AnyEvent
+ {
+ public:
+ typedef EVENT_OBJECT EventObjectType;
+
+ private:
+ EventObjectType m_aEvent;
+
+ public:
+ inline EventHolder( const EventObjectType& _rEvent )
+ :m_aEvent( _rEvent )
+ {
+ }
+
+ inline const EventObjectType& getEventObject() const { return m_aEvent; }
+ };
+
+//........................................................................
+} // namespace comphelper
+//........................................................................
+
+#endif // COMPHELPER_ASYNCNOTIFICATION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/attributelist.hxx b/include/comphelper/attributelist.hxx
new file mode 100644
index 000000000000..dd10e13c70ab
--- /dev/null
+++ b/include/comphelper/attributelist.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_ATTRIBUTE_LIST_HXX
+#define _COMPHELPER_ATTRIBUTE_LIST_HXX
+
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/comphelperdllapi.h>
+
+
+namespace comphelper
+{
+
+struct AttributeList_Impl;
+
+class COMPHELPER_DLLPUBLIC AttributeList : public ::cppu::WeakImplHelper1
+<
+ ::com::sun::star::xml::sax::XAttributeList
+>
+{
+ AttributeList_Impl *m_pImpl;
+public:
+ AttributeList();
+ virtual ~AttributeList();
+
+ // methods that are not contained in any interface
+ void AddAttribute( const OUString &sName , const OUString &sType , const OUString &sValue );
+
+ // ::com::sun::star::xml::sax::XAttributeList
+ virtual sal_Int16 SAL_CALL getLength(void)
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual OUString SAL_CALL getNameByIndex(sal_Int16 i)
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual OUString SAL_CALL getTypeByIndex(sal_Int16 i)
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual OUString SAL_CALL getTypeByName(const OUString& aName)
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual OUString SAL_CALL getValueByIndex(sal_Int16 i)
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual OUString SAL_CALL getValueByName(const OUString& aName)
+ throw( ::com::sun::star::uno::RuntimeException );
+
+};
+
+} // namespace comphelper
+
+#endif // _COMPHELPER_ATTRIBUTE_LIST_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/basicio.hxx b/include/comphelper/basicio.hxx
new file mode 100644
index 000000000000..42eea8076e47
--- /dev/null
+++ b/include/comphelper/basicio.hxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_BASIC_IO_HXX_
+#define _COMPHELPER_BASIC_IO_HXX_
+
+#include <com/sun/star/io/XPersistObject.hpp>
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include "comphelper/comphelperdllapi.h"
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+namespace stario = ::com::sun::star::io;
+namespace staruno = ::com::sun::star::uno;
+namespace starawt = ::com::sun::star::awt;
+
+// sal_Bool
+COMPHELPER_DLLPUBLIC const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, sal_Bool& _rVal);
+COMPHELPER_DLLPUBLIC const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, sal_Bool _bVal);
+
+// OUString
+COMPHELPER_DLLPUBLIC const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, OUString& _rStr);
+COMPHELPER_DLLPUBLIC const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, const OUString& _rStr);
+
+// sal_Int16
+COMPHELPER_DLLPUBLIC const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, sal_Int16& _rValue);
+COMPHELPER_DLLPUBLIC const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, sal_Int16 _nValue);
+
+// sal_uInt16
+COMPHELPER_DLLPUBLIC const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, sal_uInt16& _rValue);
+COMPHELPER_DLLPUBLIC const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, sal_uInt16 _nValue);
+
+// sal_uInt32
+COMPHELPER_DLLPUBLIC const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, sal_uInt32& _rValue);
+COMPHELPER_DLLPUBLIC const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, sal_uInt32 _nValue);
+
+// sal_Int16
+COMPHELPER_DLLPUBLIC const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, sal_Int32& _rValue);
+COMPHELPER_DLLPUBLIC const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, sal_Int32 _nValue);
+
+// FontDescriptor
+COMPHELPER_DLLPUBLIC const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& InStream, starawt::FontDescriptor& rVal);
+COMPHELPER_DLLPUBLIC const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& OutStream, const starawt::FontDescriptor& rVal);
+
+// sequences
+template <class ELEMENT>
+const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, staruno::Sequence<ELEMENT>& _rSeq)
+{
+ sal_Int32 nLen = _rxInStream->readLong();
+ _rSeq.realloc(nLen);
+ if (nLen)
+ {
+ ELEMENT* pElement = _rSeq.getArray();
+ for (sal_Int32 i=0; i<nLen; ++i, ++pElement)
+ _rxInStream >> *pElement;
+ }
+ return _rxInStream;
+}
+
+template <class ELEMENT>
+const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, const staruno::Sequence<ELEMENT>& _rSeq)
+{
+ sal_Int32 nLen = _rSeq.getLength();
+ _rxOutStream->writeLong(nLen);
+ if (nLen)
+ {
+ const ELEMENT* pElement = _rSeq.getConstArray();
+ for (sal_Int32 i = 0; i < nLen; ++i, ++pElement)
+ _rxOutStream << *pElement;
+ }
+ return _rxOutStream;
+}
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // _COMPHELPER_BASIC_IO_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/broadcasthelper.hxx b/include/comphelper/broadcasthelper.hxx
new file mode 100644
index 000000000000..d8cf69eeb17b
--- /dev/null
+++ b/include/comphelper/broadcasthelper.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_BROADCASTHELPER_HXX_
+#define _COMPHELPER_BROADCASTHELPER_HXX_
+
+#include <osl/mutex.hxx>
+#include <cppuhelper/interfacecontainer.h>
+
+//... namespace comphelper .......................................................
+namespace comphelper
+{
+//.........................................................................
+
+ //==================================================================================
+ //= OMutexAndBroadcastHelper - a class which holds a Mutex and a OBroadcastHelper;
+ //= needed because when deriving from OPropertySetHelper,
+ //= the OBroadcastHelper has to be initialized before
+ //= the OPropertySetHelper
+ //==================================================================================
+ class OMutexAndBroadcastHelper
+ {
+ protected:
+ ::osl::Mutex m_aMutex;
+ ::cppu::OBroadcastHelper m_aBHelper;
+
+ public:
+ OMutexAndBroadcastHelper() : m_aBHelper( m_aMutex ) { }
+
+ ::osl::Mutex& GetMutex() { return m_aMutex; }
+ ::cppu::OBroadcastHelper& GetBroadcastHelper() { return m_aBHelper; }
+ const ::cppu::OBroadcastHelper& GetBroadcastHelper() const { return m_aBHelper; }
+
+ };
+
+ // base class for all classes who are derived from OPropertySet and from OComponent
+ // @deprecated, you should use cppu::BaseMutex instead (cppuhelper/basemutex.hxx)
+
+ class OBaseMutex
+ {
+ protected:
+ mutable ::osl::Mutex m_aMutex;
+ };
+}
+#endif // _COMPHELPER_BROADCASTHELPER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/classids.hxx b/include/comphelper/classids.hxx
new file mode 100644
index 000000000000..39ab6095802e
--- /dev/null
+++ b/include/comphelper/classids.hxx
@@ -0,0 +1,388 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _COMPHELPER_CLASSIDS_HXX
+#define _COMPHELPER_CLASSIDS_HXX
+
+/*
+ * StarWriter
+ */
+
+/* 3.0 */
+
+#define SO3_SW_CLASSID_30 \
+ 0xDC5C7E40L, 0xB35C, 0x101B, 0x99, 0x61, 0x04, \
+ 0x02, 0x1C, 0x00, 0x70, 0x02
+
+/* 4.0 */
+
+#define SO3_SW_CLASSID_40 \
+ 0x8b04e9b0, 0x420e, 0x11d0, 0xa4, 0x5e, 0x0, \
+ 0xa0, 0x24, 0x9d, 0x57, 0xb1
+
+/* 5.0 */
+
+#define SO3_SW_CLASSID_50 \
+ 0xc20cf9d1, 0x85ae, 0x11d1, 0xaa, 0xb4, 0x0, \
+ 0x60, 0x97, 0xda, 0x56, 0x1a
+
+ /* 6.0, 7, 8 */
+
+#define SO3_SW_CLASSID_60 \
+ 0x8BC6B165, 0xB1B2, 0x4EDD, 0xAA, 0x47, 0xDA, \
+ 0xE2, 0xEE, 0x68, 0x9D, 0xD6
+
+ /* ole embed 6.0, 7 */
+
+#define SO3_SW_OLE_EMBED_CLASSID_60 \
+ 0x30a2652a, 0xddf7, 0x45e7, 0xac, 0xa6, 0x3e, \
+ 0xab, 0x26, 0xfc, 0x8a, 0x4e
+
+ /* ole embed 8 */
+
+#define SO3_SW_OLE_EMBED_CLASSID_8 \
+ 0xf616b81f, 0x7bb8, 0x4f22, 0xb8, 0xa5, 0x47, \
+ 0x42, 0x8d, 0x59, 0xf8, 0xad
+
+/* aktuell */
+
+#define SO3_SW_CLASSID SO3_SW_CLASSID_60
+
+/*
+ * StarWriter/Web
+ */
+
+/* 4.0 */
+
+#define SO3_SWWEB_CLASSID_40 \
+ 0xf0caa840, 0x7821, 0x11d0, 0xa4, 0xa7, 0x0, \
+ 0xa0, 0x24, 0x9d, 0x57, 0xb1
+
+/* 5.0 */
+
+#define SO3_SWWEB_CLASSID_50 \
+ 0xc20cf9d2, 0x85ae, 0x11d1, 0xaa, 0xb4, 0x0, \
+ 0x60, 0x97, 0xda, 0x56, 0x1a
+
+/* 6.0, 7, 8 */
+
+#define SO3_SWWEB_CLASSID_60 \
+ 0xA8BBA60C, 0x7C60, 0x4550, 0x91, 0xCE, 0x39, \
+ 0xC3, 0x90, 0x3F, 0xAC, 0x5E
+
+/* aktuell */
+
+#define SO3_SWWEB_CLASSID SO3_SWWEB_CLASSID_60
+
+/*
+ * Globaldokument
+ */
+
+/* 4.0 */
+
+#define SO3_SWGLOB_CLASSID_40 \
+ 0x340ac970, 0xe30d, 0x11d0, 0xa5, 0x3f, 0x0, \
+ 0xa0, 0x24, 0x9d, 0x57, 0xb1
+
+/* 5.0 */
+
+#define SO3_SWGLOB_CLASSID_50 \
+ 0xc20cf9d3, 0x85ae, 0x11d1, 0xaa, 0xb4, 0x0, \
+ 0x60, 0x97, 0xda, 0x56, 0x1a
+
+/* 6.0, 7, 8 */
+
+#define SO3_SWGLOB_CLASSID_60 \
+ 0xB21A0A7C, 0xE403, 0x41FE, 0x95, 0x62, 0xBD, \
+ 0x13, 0xEA, 0x6F, 0x15, 0xA0
+
+/* aktuell */
+
+#define SO3_SWGLOB_CLASSID SO3_SWGLOB_CLASSID_60
+
+//---------------------------------------------------
+
+/*
+ * StarCalc
+ */
+
+/* 3.0 */
+
+#define SO3_SC_CLASSID_30 \
+ 0x3F543FA0L, 0xB6A6, 0x101B, 0x99, 0x61, 0x04, \
+ 0x02, 0x1C, 0x00, 0x70, 0x02
+
+/* 4.0 */
+
+#define SO3_SC_CLASSID_40 \
+ 0x6361d441L, 0x4235, 0x11d0, 0x89, 0xcb, 0x00, \
+ 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+/* 5.0 */
+
+#define SO3_SC_CLASSID_50 \
+ 0xc6a5b861L, 0x85d6, 0x11d1, 0x89, 0xcb, 0x00, \
+ 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+/* 6.0 */
+
+#define SO3_SC_CLASSID_60 \
+ 0x47BBB4CB, 0xCE4C, 0x4E80, 0xA5, 0x91, 0x42, \
+ 0xD9, 0xAE, 0x74, 0x95, 0x0F
+
+/* ole embed 6.0, 7 */
+
+#define SO3_SC_OLE_EMBED_CLASSID_60 \
+ 0x7b342dc4, 0x139a, 0x4a46, 0x8a, 0x93, 0xdb, \
+ 0x8, 0x27, 0xcc, 0xee, 0x9c
+
+/* ole embed 8 */
+
+#define SO3_SC_OLE_EMBED_CLASSID_8 \
+ 0x7fa8ae11, 0xb3e3, 0x4d88, 0xaa, 0xbf, 0x25, \
+ 0x55, 0x26, 0xcd, 0x1c, 0xe8
+
+/* aktuell */
+
+#define SO3_SC_CLASSID SO3_SC_CLASSID_60
+
+/****************************************************
+* StarImpress
+****************************************************/
+
+/* 3.0 */
+
+#define SO3_SIMPRESS_CLASSID_30 \
+ 0xAF10AAE0L, 0xB36D, 0x101B, 0x99, 0x61, 0x04, \
+ 0x02, 0x1C, 0x00, 0x70, 0x02
+
+/* 4.0 */
+
+#define SO3_SIMPRESS_CLASSID_40 \
+ 0x12d3cc0L, 0x4216, 0x11d0, 0x89, 0xcb, 0x0, \
+ 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+/* 5.0 */
+
+#define SO3_SIMPRESS_CLASSID_50 \
+ 0x565c7221L, 0x85bc, 0x11d1, 0x89, 0xd0, 0x0, \
+ 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+/* 6.0 */
+
+#define SO3_SIMPRESS_CLASSID_60 \
+ 0x9176E48A, 0x637A, 0x4D1F, 0x80, 0x3B, 0x99, \
+ 0xD9, 0xBF, 0xAC, 0x10, 0x47
+
+/* ole embed 6.0, 7 */
+
+#define SO3_SIMPRESS_OLE_EMBED_CLASSID_60 \
+ 0xe5a0b632, 0xdfba, 0x4549, 0x93, 0x46, 0xe4, \
+ 0x14, 0xda, 0x6, 0xe6, 0xf8
+
+/* ole embed 8 */
+
+#define SO3_SIMPRESS_OLE_EMBED_CLASSID_8 \
+ 0xee5d1ea4, 0xd445, 0x4289, 0xb2, 0xfc, 0x55, \
+ 0xfc, 0x93, 0x69, 0x39, 0x17
+
+/* aktuell */
+
+#define SO3_SIMPRESS_CLASSID SO3_SIMPRESS_CLASSID_60
+
+/****************************************************
+* StarDraw
+****************************************************/
+
+/* 5.0 */
+
+#define SO3_SDRAW_CLASSID_50 \
+ 0x2e8905a0L, 0x85bd, 0x11d1, 0x89, 0xd0, 0x0, \
+ 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+/* 6.0 */
+#define SO3_SDRAW_CLASSID_60 \
+ 0x4BAB8970, 0x8A3B, 0x45B3, 0x99, 0x1C, 0xCB, \
+ 0xEE, 0xAC, 0x6B, 0xD5, 0xE3
+
+/* ole embed 6.0, 7 */
+
+#define SO3_SDRAW_OLE_EMBED_CLASSID_60 \
+ 0x41662fc2, 0xd57, 0x4aff, 0xab, 0x27, 0xad, \
+ 0x2e, 0x12, 0xe7, 0xc2, 0x73
+
+/* ole embed 8 */
+
+#define SO3_SDRAW_OLE_EMBED_CLASSID_8 \
+ 0x448bb771, 0xcfe2, 0x47c4, 0xbc, 0xdf, 0x1f, \
+ 0xbf, 0x37, 0x8e, 0x20, 0x2c
+
+/* aktuell */
+
+#define SO3_SDRAW_CLASSID SO3_SDRAW_CLASSID_60
+
+/****************************************************
+* StarChart
+****************************************************/
+
+/* 3.0 */
+
+#define SO3_SCH_CLASSID_30 \
+ 0xFB9C99E0L, 0x2C6D, 0x101C, 0x8E, 0x2C, 0x00, \
+ 0x00, 0x1B, 0x4C, 0xC7, 0x11
+
+/* 4.0 */
+
+#define SO3_SCH_CLASSID_40 \
+ 0x2b3b7e0L, 0x4225, 0x11d0, 0x89, 0xca, 0x00, \
+ 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+/* 5.0 */
+
+#define SO3_SCH_CLASSID_50 \
+ 0xbf884321L, 0x85dd, 0x11d1, 0x89, 0xd0, 0x00, \
+ 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+/* 6.0 */
+
+#define SO3_SCH_CLASSID_60 \
+ 0x12DCAE26, 0x281F, 0x416F, 0xA2, 0x34, 0xC3, \
+ 0x08, 0x61, 0x27, 0x38, 0x2E
+
+/* ole embed 6.0, 7 */
+
+#define SO3_SCH_OLE_EMBED_CLASSID_60 \
+ 0xd415cd93, 0x35c4, 0x4c6f, 0x81, 0x9d, 0xa6, \
+ 0x64, 0xa1, 0xc8, 0x13, 0xae
+
+/* ole embed 8 */
+
+#define SO3_SCH_OLE_EMBED_CLASSID_8 \
+ 0xdd0a57f, 0xcf3b, 0x4fd2, 0xbd, 0xa4, 0x94, \
+ 0x42, 0x71, 0x9b, 0x2a, 0x73
+
+/* aktuell */
+
+#define SO3_SCH_CLASSID SO3_SCH_CLASSID_60
+
+/****************************************************
+* StarImage
+****************************************************/
+
+/* 3.0 */
+
+#define SO3_SIM_CLASSID_30 \
+ 0xEA60C941L, 0x2C6C, 0x101C, 0x8E, 0x2C, 0x00, \
+ 0x00, 0x1B, 0x4C, 0xC7, 0x11
+
+/* 4.0 */
+
+#define SO3_SIM_CLASSID_40 \
+ 0x447BB8A0L, 0x41FB, 0x11D0, 0x89, 0xCA, 0x00, \
+ 0x80, 0x29, 0xE4, 0xB0, 0xB1
+
+/* 5.0 */
+
+#define SO3_SIM_CLASSID_50 \
+ 0x65c68d00L, 0x85de, 0x11d1, 0x89, 0xd0, 0x00, \
+ 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+/* aktuell */
+
+#define SO3_SIM_CLASSID SO3_SIM_CLASSID_50
+
+/***************************************************
+* StarMath
+***************************************************/
+
+/* 3.0 */
+
+#define SO3_SM_CLASSID_30 \
+ 0xD4590460L, 0x35FD, 0x101C, 0xB1, 0x2A, 0x04, \
+ 0x02, 0x1C, 0x00, 0x70, 0x02
+
+/* 4.0 */
+
+#define SO3_SM_CLASSID_40 \
+ 0x2b3b7e1L, 0x4225, 0x11d0, 0x89, 0xca, 0x00, \
+ 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+/* 5.0 */
+
+#define SO3_SM_CLASSID_50 \
+ 0xffb5e640L, 0x85de, 0x11d1, 0x89, 0xd0, 0x00, \
+ 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+/* 6.0, 7, 8 */
+
+#define SO3_SM_CLASSID_60 \
+ 0x078B7ABA, 0x54FC, 0x457F, 0x85, 0x51, 0x61, \
+ 0x47, 0xE7, 0x76, 0xA9, 0x97
+
+/* ole embed 6.0, 7 */
+
+#define SO3_SM_OLE_EMBED_CLASSID_60 \
+ 0xd0484de6, 0xaaee, 0x468a, 0x99, 0x1f, 0x8d, \
+ 0x4b, 0x7, 0x37, 0xb5, 0x7a
+
+/* ole embed 8 */
+
+#define SO3_SM_OLE_EMBED_CLASSID_8 \
+ 0xd2d59cd1, 0xa6a, 0x4d36, 0xae, 0x20, 0x47, \
+ 0x81, 0x70, 0x77, 0xd5, 0x7c
+
+/* aktuell */
+
+#define SO3_SM_CLASSID SO3_SM_CLASSID_60
+
+#define SO3_OUT_CLASSID \
+ 0x970b1e82, 0xcf2d, 0x11cf, 0x89, 0xca, 0x00, \
+ 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+#define SO3_DUMMY_CLASSID \
+ 0x970b1fff, 0xcf2d, 0x11cf, \
+ 0x89,0xca,0x00,0x80,0x29,0xe4,0xb0,0xb1
+
+#define SO3_APPLET_CLASSID \
+ 0x970b1e81, 0xcf2d, 0x11cf, \
+ 0x89,0xca,0x00,0x80,0x29,0xe4,0xb0,0xb1
+
+#define SO3_PLUGIN_CLASSID \
+ 0x4caa7761, 0x6b8b, 0x11cf, \
+ 0x89,0xca,0x0,0x80,0x29,0xe4,0xb0,0xb1
+
+#define SO3_IFRAME_CLASSID \
+ 0x1a8a6701, 0xde58, 0x11cf, \
+ 0x89, 0xca, 0x0, 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+#define SO3_GLOBAL_CLASSID \
+ 0x475198a8, 0x694c, 0x4bd8, \
+ 0xb0, 0x2f, 0xd9, 0xb7, 0x6b, 0xcf, 0x31, 0x28
+
+#define SO3_RPT_CLASSID_90 \
+ 0xd7896d52, 0xb7af, 0x4820, \
+ 0x9d, 0xfe, 0xd4, 0x04, 0xd0, 0x15, 0x96, 0x0f
+
+#define SO3_RPT_SCH_CLASSID_90 \
+ 0x80243d39, 0x6741, 0x46c5, \
+ 0x92, 0x6e, 0x06, 0x91, 0x64, 0xff, 0x87, 0xbb
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/comphelperdllapi.h b/include/comphelper/comphelperdllapi.h
new file mode 100644
index 000000000000..88d35f61c359
--- /dev/null
+++ b/include/comphelper/comphelperdllapi.h
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_COMPHELPERDLLAPI_H
+#define INCLUDED_COMPHELPERDLLAPI_H
+
+#include "sal/types.h"
+
+#if defined(COMPHELPER_DLLIMPLEMENTATION)
+#define COMPHELPER_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define COMPHELPER_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define COMPHELPER_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif /* INCLUDED_COMPHELPERDLLAPI_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/componentbase.hxx b/include/comphelper/componentbase.hxx
new file mode 100644
index 000000000000..b4035a60f77b
--- /dev/null
+++ b/include/comphelper/componentbase.hxx
@@ -0,0 +1,154 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_COMPONENTBASE_HXX
+#define COMPHELPER_COMPONENTBASE_HXX
+
+#include "comphelper/comphelperdllapi.h"
+#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 )
+ {
+ }
+
+ ~ComponentBase() {}
+
+ /** 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
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/componentcontext.hxx b/include/comphelper/componentcontext.hxx
new file mode 100644
index 000000000000..d6461502be54
--- /dev/null
+++ b/include/comphelper/componentcontext.hxx
@@ -0,0 +1,243 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_COMPONENTCONTEXT_HXX
+#define COMPHELPER_COMPONENTCONTEXT_HXX
+
+#include <comphelper/comphelperdllapi.h>
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+//........................................................................
+namespace comphelper
+{
+//........................................................................
+
+ //====================================================================
+ //= ComponentContext
+ //====================================================================
+ /** a helper class for working with a component context
+ */
+ class COMPHELPER_DLLPUBLIC ComponentContext
+ {
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiComponentFactory > m_xORB;
+
+ public:
+ /** constructs an instance
+ @param _rxContext
+ the component context to manage
+ @throws ::com::sun::star::lang::NullPointerException
+ if the given context, or its component factory, are <NULL/>
+ */
+ ComponentContext( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext );
+
+ /** constructs an instance
+ @param _rxLegacyFactory
+ the legacy service factor to obtain the <type scope="com::sun::star::uno">XComponentContext</type> from
+ @throws ::com::sun::star::uno::RuntimeException
+ if the given factory or does not have a DefaultContext property to obtain
+ a component context
+ @throws ::com::sun::star::lang::NullPointerException
+ if the given factory is <NULL/>, or provides a component context being <NULL/>, or provides
+ a component context whose component factory is <NULL/>
+ */
+ ComponentContext( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxLegacyFactory );
+
+ /** returns the ->XComponentContext interface
+ */
+ inline ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ getUNOContext() const { return m_xContext; }
+
+ /** determines whether the context is not <NULL/>
+ */
+ inline sal_Bool is() const
+ {
+ return m_xContext.is();
+ }
+
+ /** creates a component using our component factory/context
+ @throws ::com::sun::star::uno::Exception
+ @return
+ <TRUE/> if and only if the component could be successfully created
+ */
+ template < typename INTERFACE >
+ bool createComponent( const OUString& _rServiceName, ::com::sun::star::uno::Reference< INTERFACE >& _out_rxComponent ) const
+ {
+ _out_rxComponent.clear();
+ _out_rxComponent = _out_rxComponent.query(
+ m_xORB->createInstanceWithContext( _rServiceName, m_xContext )
+ );
+ return _out_rxComponent.is();
+ }
+
+ /** creates a component using our component factory/context
+ @throws ::com::sun::star::uno::Exception
+ @return
+ <TRUE/> if and only if the component could be successfully created
+ */
+ template < typename INTERFACE >
+ bool createComponent( const sal_Char* _pAsciiServiceName, ::com::sun::star::uno::Reference< INTERFACE >& _out_rxComponent ) const
+ {
+ return createComponent( OUString::createFromAscii( _pAsciiServiceName ), _out_rxComponent );
+ }
+
+ /** creates a component using our component factory/context, passing creation arguments
+ @throws ::com::sun::star::uno::Exception
+ @return
+ <TRUE/> if and only if the component could be successfully created
+ */
+ template < typename INTERFACE >
+ bool createComponentWithArguments( const OUString& _rServiceName, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& _rArguments, ::com::sun::star::uno::Reference< INTERFACE >& _out_rxComponent ) const
+ {
+ _out_rxComponent.clear();
+ _out_rxComponent = _out_rxComponent.query(
+ m_xORB->createInstanceWithArgumentsAndContext( _rServiceName, _rArguments, m_xContext )
+ );
+ return _out_rxComponent.is();
+ }
+
+ /** creates a component using our component factory/context, passing creation arguments
+ @throws ::com::sun::star::uno::Exception
+ @return
+ <TRUE/> if and only if the component could be successfully created
+ */
+ template < typename INTERFACE >
+ bool createComponentWithArguments( const sal_Char* _pAsciiServiceName, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& _rArguments, ::com::sun::star::uno::Reference< INTERFACE >& _out_rxComponent ) const
+ {
+ return createComponentWithArguments( OUString::createFromAscii( _pAsciiServiceName ), _rArguments, _out_rxComponent );
+ }
+
+ /** creates a component using our component factory/context
+
+ @throws ::com::sun::star::lang::ServiceNotRegisteredException
+ if the given service is not registered
+ @throws Exception
+ if an exception occurred during creating the component
+ @return
+ the newly created component. Is never <NULL/>.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createComponent( const OUString& _rServiceName ) const;
+
+ /** creates a component using our component factory/context
+
+ @throws ::com::sun::star::lang::ServiceNotRegisteredException
+ if the given service is not registered
+ @throws Exception
+ if an exception occurred during creating the component
+ @return
+ the newly created component. Is never <NULL/>.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createComponent( const sal_Char* _pAsciiServiceName ) const
+ {
+ return createComponent( OUString::createFromAscii( _pAsciiServiceName ) );
+ }
+
+ /** creates a component using our component factory/context, passing creation arguments
+
+ @throws ::com::sun::star::lang::ServiceNotRegisteredException
+ if the given service is not registered
+ @throws Exception
+ if an exception occurred during creating the component
+ @return
+ the newly created component. Is never <NULL/>.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createComponentWithArguments(
+ const OUString& _rServiceName,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& _rArguments
+ ) const;
+
+ /** creates a component using our component factory/context, passing creation arguments
+
+ @throws ::com::sun::star::lang::ServiceNotRegisteredException
+ if the given service is not registered
+ @throws Exception
+ if an exception occurred during creating the component
+ @return
+ the newly created component. Is never <NULL/>.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createComponentWithArguments(
+ const sal_Char* _pAsciiServiceName,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& _rArguments
+ ) const
+ {
+ return createComponentWithArguments( OUString::createFromAscii( _pAsciiServiceName ), _rArguments );
+ }
+
+ /** retrieves a singleton instance from the context
+
+ Singletons are collected below the <code>/singletons</code> key in a component context,
+ so accessing them means retrieving the value under <code>/singletons/&lt;instance_name&gt;</code>.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getSingleton( const OUString& _rInstanceName ) const;
+
+ /** retrieves a singleton instance from the context
+
+ Singletons are collected below the <code>/singletons</code> key in a component context,
+ so accessing them means retrieving the value under <code>/singletons/&lt;instance_name&gt;</code>.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getSingleton( const sal_Char* _pAsciiInstanceName ) const
+ {
+ return getSingleton( OUString::createFromAscii( _pAsciiInstanceName ) );
+ }
+
+ /** returns the ->XMultiServiceFactory interface of ->m_xORB, for passing to
+ older code which does not yet support ->XMultiComponentFactory
+ @throws ::com::sun::star::uno::RuntimeException
+ if our our component factory does not support this interface
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
+ getLegacyServiceFactory() const;
+
+ /** retrieves a value from our component context
+ @param _rName
+ the name of the value to retrieve
+ @return
+ the context value with the given name
+ @seealso XComponentContext::getValueByName
+ @seealso getContextValueByAsciiName
+ */
+ ::com::sun::star::uno::Any
+ getContextValueByName( const OUString& _rName ) const;
+
+ /** retrieves a value from our component context, specified by 8-bit ASCII string
+ @param _rName
+ the name of the value to retrieve, as ASCII character string
+ @return
+ the context value with the given name
+ @seealso XComponentContext::getValueByName
+ @seealso getContextValueByName
+ */
+ inline ::com::sun::star::uno::Any
+ getContextValueByAsciiName( const sal_Char* _pAsciiName ) const
+ {
+ return getContextValueByName( OUString::createFromAscii( _pAsciiName ) );
+ }
+
+ };
+
+//........................................................................
+} // namespace comphelper
+//........................................................................
+
+#endif // COMPHELPER_COMPONENTCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/componentguard.hxx b/include/comphelper/componentguard.hxx
new file mode 100644
index 000000000000..eb1cfbcc24a8
--- /dev/null
+++ b/include/comphelper/componentguard.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_COMPONENTGUARD_HXX
+#define COMPHELPER_COMPONENTGUARD_HXX
+
+#include <com/sun/star/lang/DisposedException.hpp>
+
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+
+//......................................................................................................................
+namespace comphelper
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= ComponentGuard
+ //==================================================================================================================
+ class ComponentGuard
+ {
+ public:
+ ComponentGuard( ::cppu::OWeakObject& i_component, ::cppu::OBroadcastHelper & i_broadcastHelper )
+ :m_aGuard( i_broadcastHelper.rMutex )
+ {
+ if ( i_broadcastHelper.bDisposed )
+ throw ::com::sun::star::lang::DisposedException( OUString(), &i_component );
+ }
+
+ ~ComponentGuard()
+ {
+ }
+
+ void clear() { m_aGuard.clear(); }
+ void reset() { m_aGuard.reset(); }
+
+ private:
+ ::osl::ResettableMutexGuard m_aGuard;
+ };
+
+//......................................................................................................................
+} // namespace comphelper
+//......................................................................................................................
+
+#endif // COMPHELPER_COMPONENTGUARD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/componentmodule.hxx b/include/comphelper/componentmodule.hxx
new file mode 100644
index 000000000000..9ce8a137ede2
--- /dev/null
+++ b/include/comphelper/componentmodule.hxx
@@ -0,0 +1,261 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef COMPHELPER_INC_COMPHELPER_COMPONENTMODULE_HXX
+#define COMPHELPER_INC_COMPHELPER_COMPONENTMODULE_HXX
+
+#include <comphelper/comphelperdllapi.h>
+
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <cppuhelper/factory.hxx>
+
+#include <osl/mutex.hxx>
+
+#include <rtl/string.hxx>
+#include <rtl/instance.hxx>
+
+//........................................................................
+namespace comphelper
+{
+//........................................................................
+
+ /** factory factory declaration
+ */
+ typedef ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleComponentFactory > (SAL_CALL *FactoryInstantiation)
+ (
+ ::cppu::ComponentFactoryFunc _pFactoryFunc,
+ OUString const& _rComponentName,
+ ::com::sun::star::uno::Sequence< OUString > const & _rServiceNames,
+ rtl_ModuleCount*
+ ) SAL_THROW(());
+
+ //=========================================================================
+ //= ComponentDescription
+ //=========================================================================
+ struct COMPHELPER_DLLPUBLIC ComponentDescription
+ {
+ /// the implementation name of the component
+ OUString sImplementationName;
+ /// the services supported by the component implementation
+ ::com::sun::star::uno::Sequence< OUString > aSupportedServices;
+ /** the name under which the component implementation should be registered as singleton,
+ or empty if the component does not implement a singleton.
+ */
+ OUString sSingletonName;
+ /// the function to create an instance of the component
+ ::cppu::ComponentFactoryFunc pComponentCreationFunc;
+ /// the function to create a factory for the component (usually <code>::cppu::createSingleComponentFactory</code>)
+ FactoryInstantiation pFactoryCreationFunc;
+
+ ComponentDescription()
+ :sImplementationName()
+ ,aSupportedServices()
+ ,sSingletonName()
+ ,pComponentCreationFunc( NULL )
+ ,pFactoryCreationFunc( NULL )
+ {
+ }
+
+ ComponentDescription(
+ const OUString& _rImplementationName,
+ const ::com::sun::star::uno::Sequence< OUString >& _rSupportedServices,
+ const OUString& _rSingletonName,
+ ::cppu::ComponentFactoryFunc _pComponentCreationFunc,
+ FactoryInstantiation _pFactoryCreationFunc
+ )
+ :sImplementationName( _rImplementationName )
+ ,aSupportedServices( _rSupportedServices )
+ ,sSingletonName( _rSingletonName )
+ ,pComponentCreationFunc( _pComponentCreationFunc )
+ ,pFactoryCreationFunc( _pFactoryCreationFunc )
+ {
+ }
+ };
+
+ //=========================================================================
+ //= OModule
+ //=========================================================================
+ class OModuleImpl;
+ class COMPHELPER_DLLPUBLIC OModule
+ {
+ private:
+ oslInterlockedCount m_nClients; /// number of registered clients
+ OModuleImpl* m_pImpl; /// impl class. lives as long as at least one client for the module is registered
+
+ protected:
+ mutable ::osl::Mutex m_aMutex; /// access safety
+
+ public:
+ OModule();
+
+ virtual ~OModule();
+
+ /** register a component implementing a service with the given data.
+ @param _rImplementationName
+ the implementation name of the component
+ @param _rServiceNames
+ the services the component supports
+ @param _pCreateFunction
+ a function for creating an instance of the component
+ @param _pFactoryFunction
+ a function for creating a factory for that component
+ */
+ void registerImplementation(
+ const OUString& _rImplementationName,
+ const ::com::sun::star::uno::Sequence< OUString >& _rServiceNames,
+ ::cppu::ComponentFactoryFunc _pCreateFunction,
+ FactoryInstantiation _pFactoryFunction = ::cppu::createSingleComponentFactory );
+
+ /** registers a component given by <type>ComponentDescription</type>
+ */
+ void registerImplementation( const ComponentDescription& _rComp );
+
+ /** creates a Factory for the component with the given implementation name.
+ <p>Usually used from within component_getFactory.<p/>
+ @param _pImplementationName
+ the implementation name of the component
+ @return
+ the XInterface access to a factory for the component
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getComponentFactory(
+ const OUString& _rImplementationName );
+
+ /** version of getComponentFactory which directly takes the char argument you got in your component_getFactory call
+ */
+ void* getComponentFactory( const sal_Char* _pImplementationName );
+
+ public:
+ class ClientAccess { friend class OModuleClient; private: ClientAccess() { } };
+ /// register a client for the module
+ void registerClient( ClientAccess );
+ /// revoke a client for the module
+ void revokeClient( ClientAccess );
+
+ protected:
+ /** called when the first client has been registered
+ @precond
+ <member>m_aMutex</member> is locked
+ */
+ virtual void onFirstClient();
+
+ /** called when the last client has been revoked
+ @precond
+ <member>m_aMutex</member> is locked
+ */
+ virtual void onLastClient();
+
+ private:
+ OModule( const OModule& ); // never implemented
+ OModule& operator=( const OModule& ); // never implemented
+ };
+
+ //=========================================================================
+ //= OModuleClient
+ //=========================================================================
+ /** base class for objects which uses any global module-specific resources
+ */
+ class COMPHELPER_DLLPUBLIC OModuleClient
+ {
+ protected:
+ OModule& m_rModule;
+
+ public:
+ OModuleClient( OModule& _rModule ) :m_rModule( _rModule ) { m_rModule.registerClient( OModule::ClientAccess() ); }
+ ~OModuleClient() { m_rModule.revokeClient( OModule::ClientAccess() ); }
+ };
+
+ //==========================================================================
+ //= OAutoRegistration
+ //==========================================================================
+ template <class TYPE>
+ class OAutoRegistration
+ {
+ public:
+ /** automatically provides all component information to an OModule instance
+ <p>Assumed that the template argument has the three methods
+ <ul>
+ <li><code>static OUString getImplementationName_static()</code><li/>
+ <li><code>static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_static()</code><li/>
+ <li><code>static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+ Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&)</code>
+ </li>
+ <ul/>
+ the instantiation of this object will automatically register the class via <member>OModule::registerImplementation</member>.
+ <p/>
+ The factory creation function used is <code>::cppu::createSingleComponentFactory</code>.
+ */
+ OAutoRegistration( OModule& _rModule );
+ };
+
+ template <class TYPE>
+ OAutoRegistration<TYPE>::OAutoRegistration( OModule& _rModule )
+ {
+ _rModule.registerImplementation(
+ TYPE::getImplementationName_static(),
+ TYPE::getSupportedServiceNames_static(),
+ TYPE::Create
+ );
+ }
+
+ //==========================================================================
+ //= OSingletonRegistration
+ //==========================================================================
+ template <class TYPE>
+ class OSingletonRegistration
+ {
+ public:
+ /** automatically provides all component information to an OModule instance,
+ for a singleton component
+
+ <p>Assumed that the template argument has the three methods
+ <ul>
+ <li><code>static OUString getImplementationName_static()</code><li/>
+ <li><code>static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_static()</code><li/>
+ <li><code>static OUString getSingletonName_static()</code></li>
+ <li><code>static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+ Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&)</code>
+ </li>
+ <ul/>
+ the instantiation of this object will automatically register the class via <member>OModule::registerImplementation</member>.
+ </p>
+ */
+ OSingletonRegistration( OModule& _rModule );
+ };
+
+ template <class TYPE>
+ //--------------------------------------------------------------------------
+ OSingletonRegistration<TYPE>::OSingletonRegistration( OModule& _rModule )
+ {
+ _rModule.registerImplementation( ComponentDescription(
+ TYPE::getImplementationName_static(),
+ TYPE::getSupportedServiceNames_static(),
+ TYPE::getSingletonName_static(),
+ &TYPE::Create,
+ &::cppu::createSingleComponentFactory
+ ) );
+ }
+
+//........................................................................
+} // namespace comphelper
+//........................................................................
+
+#endif // COMPHELPER_INC_COMPHELPER_COMPONENTMODULE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/configuration.hxx b/include/comphelper/configuration.hxx
new file mode 100644
index 000000000000..8eecc7facd91
--- /dev/null
+++ b/include/comphelper/configuration.hxx
@@ -0,0 +1,331 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_COMPHELPER_CONFIGURATION_HXX
+#define INCLUDED_COMPHELPER_CONFIGURATION_HXX
+
+#include "sal/config.h"
+
+#include "boost/noncopyable.hpp"
+#include "boost/optional.hpp"
+#include "boost/shared_ptr.hpp"
+#include "com/sun/star/uno/Any.hxx"
+#include "com/sun/star/uno/Reference.hxx"
+#include "comphelper/comphelperdllapi.h"
+#include "comphelper/processfactory.hxx"
+#include "sal/types.h"
+
+namespace com { namespace sun { namespace star {
+ namespace configuration { class XReadWriteAccess; }
+ namespace container {
+ class XHierarchicalNameAccess;
+ class XHierarchicalNameReplace;
+ class XNameAccess;
+ class XNameContainer;
+ }
+ namespace uno { class XComponentContext; }
+} } }
+
+namespace comphelper {
+
+namespace detail { class ConfigurationWrapper; }
+
+/// A batch of configuration changes that is committed as a whole.
+///
+/// Client code needs to call commit explicitly; otherwise the changes are lost
+/// when the instance is destroyed.
+///
+/// This is the only class from this header file that client code should use
+/// directly.
+class COMPHELPER_DLLPUBLIC ConfigurationChanges: private boost::noncopyable {
+public:
+ static boost::shared_ptr< ConfigurationChanges > create(
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ const & context = comphelper::getProcessComponentContext());
+
+ ~ConfigurationChanges();
+
+ void commit() const;
+
+private:
+ SAL_DLLPRIVATE ConfigurationChanges(
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ const & context);
+
+ SAL_DLLPRIVATE void setPropertyValue(
+ OUString const & path, com::sun::star::uno::Any const & value)
+ const;
+
+ SAL_DLLPRIVATE com::sun::star::uno::Reference<
+ com::sun::star::container::XHierarchicalNameReplace >
+ getGroup(OUString const & path) const;
+
+ SAL_DLLPRIVATE
+ com::sun::star::uno::Reference< com::sun::star::container::XNameContainer >
+ getSet(OUString const & path) const;
+
+ com::sun::star::uno::Reference<
+ com::sun::star::configuration::XReadWriteAccess > access_;
+
+ friend class detail::ConfigurationWrapper;
+};
+
+namespace detail {
+
+/// @internal
+class COMPHELPER_DLLPUBLIC ConfigurationWrapper: private boost::noncopyable {
+public:
+ static ConfigurationWrapper const & get(
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ const & context);
+
+ SAL_DLLPRIVATE explicit ConfigurationWrapper(
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ const & context);
+
+ SAL_DLLPRIVATE ~ConfigurationWrapper();
+
+ com::sun::star::uno::Any getPropertyValue(OUString const & path) const;
+
+ void setPropertyValue(
+ boost::shared_ptr< ConfigurationChanges > const & batch,
+ OUString const & path, com::sun::star::uno::Any const & value)
+ const;
+
+ com::sun::star::uno::Any getLocalizedPropertyValue(
+ OUString const & path) const;
+
+ void setLocalizedPropertyValue(
+ boost::shared_ptr< ConfigurationChanges > const & batch,
+ OUString const & path, com::sun::star::uno::Any const & value)
+ const;
+
+ com::sun::star::uno::Reference<
+ com::sun::star::container::XHierarchicalNameAccess >
+ getGroupReadOnly(OUString const & path) const;
+
+ com::sun::star::uno::Reference<
+ com::sun::star::container::XHierarchicalNameReplace >
+ getGroupReadWrite(
+ boost::shared_ptr< ConfigurationChanges > const & batch,
+ OUString const & path) const;
+
+ com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >
+ getSetReadOnly(OUString const & path) const;
+
+ com::sun::star::uno::Reference< com::sun::star::container::XNameContainer >
+ getSetReadWrite(
+ boost::shared_ptr< ConfigurationChanges > const & batch,
+ OUString const & path) const;
+
+ boost::shared_ptr< ConfigurationChanges > createChanges() const;
+
+private:
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ context_;
+
+ com::sun::star::uno::Reference<
+ com::sun::star::container::XHierarchicalNameAccess > access_;
+};
+
+/// @internal
+template< typename T > struct Convert: private boost::noncopyable {
+ static com::sun::star::uno::Any toAny(T const & value)
+ { return com::sun::star::uno::makeAny(value); }
+
+ static T fromAny(com::sun::star::uno::Any const & value)
+ { return value.get< T >(); }
+
+private:
+ Convert(); // not defined
+ ~Convert(); // not defined
+};
+
+/// @internal
+template< typename T > struct Convert< boost::optional< T > >:
+ private boost::noncopyable
+{
+ static com::sun::star::uno::Any toAny(boost::optional< T > const & value) {
+ return value
+ ? com::sun::star::uno::makeAny(value.get())
+ : com::sun::star::uno::Any();
+ }
+
+ static boost::optional< T > fromAny(com::sun::star::uno::Any const & value)
+ {
+ return value.hasValue()
+ ? boost::optional< T >(value.get< T >()) : boost::optional< T >();
+ }
+
+private:
+ Convert(); // not defined
+ ~Convert(); // not defined
+};
+
+}
+
+/// A type-safe wrapper around a (non-localized) configuration property.
+///
+/// Automatically generated headers for the various configuration properties
+/// derive from this template and make available its member functions to access
+/// each given configuration property.
+template< typename T, typename U > struct ConfigurationProperty:
+ private boost::noncopyable
+{
+ /// Get the value of the given (non-localized) configuration property.
+ ///
+ /// For nillable properties, U is of type boost::optional<U'>.
+ static U get(
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ const & context = comphelper::getProcessComponentContext())
+ {
+ // Folding this into one statement causes a bogus error at least with
+ // Red Hat GCC 4.6.2-1:
+ com::sun::star::uno::Any a(
+ detail::ConfigurationWrapper::get(context).getPropertyValue(
+ T::path()));
+ return detail::Convert< U >::fromAny(a);
+ }
+
+ /// Set the value of the given (non-localized) configuration property, via a
+ /// given changes batch.
+ ///
+ /// For nillable properties, U is of type boost::optional<U'>.
+ static void set(
+ U const & value,
+ boost::shared_ptr< ConfigurationChanges > const & batch,
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ const & context = comphelper::getProcessComponentContext())
+ {
+ detail::ConfigurationWrapper::get(context).setPropertyValue(
+ batch, T::path(), detail::Convert< U >::toAny(value));
+ }
+
+private:
+ ConfigurationProperty(); // not defined
+ ~ConfigurationProperty(); // not defined
+};
+
+/// A type-safe wrapper around a localized configuration property.
+///
+/// Automatically generated headers for the various localized configuration
+/// properties derive from this template and make available its member functions
+/// to access each given localized configuration property.
+template< typename T, typename U > struct ConfigurationLocalizedProperty:
+ private boost::noncopyable
+{
+ /// Get the value of the given localized configuration property, for the
+ /// locale currently set at the
+ /// com.sun.star.configuration.theDefaultProvider.
+ ///
+ /// For nillable properties, U is of type boost::optional<U'>.
+ static U get(
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ const & context = comphelper::getProcessComponentContext())
+ {
+ // Folding this into one statement causes a bogus error at least with
+ // Red Hat GCC 4.6.2-1:
+ com::sun::star::uno::Any a(
+ detail::ConfigurationWrapper::get(context).
+ getLocalizedPropertyValue(T::path()));
+ return detail::Convert< U >::fromAny(a);
+ }
+
+ /// Set the value of the given localized configuration property, for the
+ /// locale currently set at the
+ /// com.sun.star.configuration.theDefaultProvider, via a given changes
+ /// batch.
+ ///
+ /// For nillable properties, U is of type boost::optional<U'>.
+ static void set(
+ U const & value,
+ boost::shared_ptr< ConfigurationChanges > const & batch,
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ const & context = comphelper::getProcessComponentContext())
+ {
+ detail::ConfigurationWrapper::get(context).setLocalizedPropertyValue(
+ batch, T::path(), detail::Convert< U >::toAny(value));
+ }
+
+private:
+ ConfigurationLocalizedProperty(); // not defined
+ ~ConfigurationLocalizedProperty(); // not defined
+};
+
+/// A type-safe wrapper around a configuration group.
+///
+/// Automatically generated headers for the various configuration groups derive
+/// from this template and make available its member functions to access each
+/// given configuration group.
+template< typename T > struct ConfigurationGroup: private boost::noncopyable {
+ /// Get read-only access to the given configuration group.
+ static com::sun::star::uno::Reference<
+ com::sun::star::container::XHierarchicalNameAccess >
+ get(com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ const & context = comphelper::getProcessComponentContext())
+ {
+ return detail::ConfigurationWrapper::get(context).getGroupReadOnly(
+ T::path());
+ }
+
+ /// Get read/write access to the given configuration group, storing any
+ /// modifications via the given changes batch.
+ static com::sun::star::uno::Reference<
+ com::sun::star::container::XHierarchicalNameReplace >
+ get(boost::shared_ptr< ConfigurationChanges > const & batch,
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ const & context = comphelper::getProcessComponentContext())
+ {
+ return detail::ConfigurationWrapper::get(context).getGroupReadWrite(
+ batch, T::path());
+ }
+
+private:
+ ConfigurationGroup(); // not defined
+ ~ConfigurationGroup(); // not defined
+};
+
+/// A type-safe wrapper around a configuration set.
+///
+/// Automatically generated headers for the various configuration sets derive
+/// from this template and make available its member functions to access each
+/// given configuration set.
+template< typename T > struct ConfigurationSet: private boost::noncopyable {
+ /// Get read-only access to the given configuration set.
+ static
+ com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >
+ get(com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ const & context = comphelper::getProcessComponentContext())
+ {
+ return detail::ConfigurationWrapper::get(context).getSetReadOnly(
+ T::path());
+ }
+
+ /// Get read/write access to the given configuration set, storing any
+ /// modifications via the given changes batch.
+ static
+ com::sun::star::uno::Reference< com::sun::star::container::XNameContainer >
+ get(boost::shared_ptr< ConfigurationChanges > const & batch,
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ const & context = comphelper::getProcessComponentContext())
+ {
+ return detail::ConfigurationWrapper::get(context).getSetReadWrite(
+ batch, T::path());
+ }
+
+private:
+ ConfigurationSet(); // not defined
+ ~ConfigurationSet(); // not defined
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/configurationhelper.hxx b/include/comphelper/configurationhelper.hxx
new file mode 100644
index 000000000000..b267e4c0c564
--- /dev/null
+++ b/include/comphelper/configurationhelper.hxx
@@ -0,0 +1,240 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_CONFIGURATIONHELPER_HXX_
+#define _COMPHELPER_CONFIGURATIONHELPER_HXX_
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+#include <com/sun/star/util/XChangesBatch.hpp>
+#include <comphelper/sequenceasvector.hxx>
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+//_______________________________________________
+// namespaces
+
+namespace comphelper{
+
+
+//-----------------------------------------------
+class COMPHELPER_DLLPUBLIC ConfigurationHelper
+{
+ public:
+
+ //-----------------------------------------------
+ /** specify all possible modes, which can be used to open a configuration access.
+ *
+ * @see openConfig()
+ * @see readDirectKey()
+ * @see writeDirectKey()
+ */
+ enum EConfigurationModes
+ {
+ /// opens configuration in read/write mode (without LAZY writing!)
+ E_STANDARD = 0,
+ /// configuration will be opened readonly
+ E_READONLY = 1,
+ /// all localized nodes will be interpreted as XInterface instead of interpreting it as atomic value nodes
+ E_ALL_LOCALES = 2,
+ /// enable lazy writing
+ E_LAZY_WRITE = 4
+ };
+
+ //-----------------------------------------------
+ /** returns access to the specified configuration package.
+ *
+ * This method should be used, if e.g. more then one request to the same
+ * configuration package is needed. The configuration access can be cached
+ * outside and used inbetween.
+ *
+ * @param rxContext
+ * the uno service manager, which should be used to create the
+ * configuration access.
+ *
+ * @param sPackage
+ * the name of the configuration package.
+ * e.g. <ul>
+ * <li>org.openoffice.Office.Common</li>
+ * <li>org.openoffice.Office.Common/Menu</li>
+ * </ul>
+ *
+ * @param eMode
+ * specify the open mode for the returned configuration access.
+ * It's interpreted as a flag field and can be any useful combination
+ * of values of EConfigurationModes.
+ *
+ * @throw Any exceptions the underlying configuration can throw.
+ * E.g. css::uno::Exception if the configuration could not be opened.
+ */
+ static css::uno::Reference< css::uno::XInterface > openConfig(const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const OUString& sPackage,
+ sal_Int32 eMode );
+
+ //-----------------------------------------------
+ /** reads the value of an existing(!) configuration key,
+ * which is searched relative to the specified configuration access.
+ *
+ * This method must be used in combination with openConfig().
+ * The cached configuration access must be provided here ... and
+ * all operations are made relativ to this access point.
+ *
+ * @param xCFG
+ * the configuration root, where sRelPath should be interpreted.
+ * as relativ path
+ *
+ * @param sRelPath
+ * path relative to xCFG parameter.
+ *
+ * @param sKey
+ * the configuration node, where we should read the value.
+ *
+ * @return [css.uno.Any]
+ * the value of sKey.
+ *
+ * @throw Any exceptions the underlying configuration can throw.
+ * E.g. css::container::NoSuchElementException if the specified
+ * key does not exists.
+ */
+ static css::uno::Any readRelativeKey(const css::uno::Reference< css::uno::XInterface > xCFG ,
+ const OUString& sRelPath,
+ const OUString& sKey );
+
+ //-----------------------------------------------
+ /** writes a new value for an existing(!) configuration key,
+ * which is searched relative to the specified configuration access.
+ *
+ * This method must be used in combination with openConfig().
+ * The cached configuration access must be provided here ... and
+ * all operations are made relativ to this access point.
+ *
+ * @param xCFG
+ * the configuration root, where sRelPath should be interpreted.
+ * as relativ path
+ *
+ * @param sRelPath
+ * path relative to xCFG parameter.
+ *
+ * @param sKey
+ * the configuration node, where we should write the new value.
+ *
+ * @param aValue
+ * the new value for sKey.
+ *
+ * @throw Any exceptions the underlying configuration can throw.
+ * E.g. css::container::NoSuchElementException if the specified
+ * key does not exists or css::uno::Exception if the provided configuration
+ * access does not allow writing for this key.
+ */
+ static void writeRelativeKey(const css::uno::Reference< css::uno::XInterface > xCFG ,
+ const OUString& sRelPath,
+ const OUString& sKey ,
+ const css::uno::Any& aValue );
+
+ //-----------------------------------------------
+ /** it checks if the specified set node exists ... or create an empty one
+ * otherwise.
+ *
+ * This method must be used in combination with openConfig().
+ * The cached configuration access must be provided here ... and
+ * all operations are made relativ to this access point.
+ *
+ * Further this method must be used only with configuration set's.
+ * Atomic keys can't be "created" ... they "exists everytimes".
+ *
+ * @param xCFG
+ * the configuration root, where sRelPathToSet should be interpreted
+ * as relativ path.
+ *
+ * @param sRelPathToSet
+ * path relative to xCFG parameter.
+ *
+ * @param sSetNode
+ * the set node, which should be checked if its exists ...
+ * or which should be created with default values.
+ *
+ * @return A reference to the found (or new created) set node.
+ * Cant be NULL .. in such case an exception occure !
+ *
+ * @throw Any exceptions the underlying configuration can throw.
+ * E.g. css::uno::Exception if the provided configuration
+ * access does not allow writing for this set.
+ */
+ static css::uno::Reference< css::uno::XInterface > makeSureSetNodeExists(const css::uno::Reference< css::uno::XInterface > xCFG ,
+ const OUString& sRelPathToSet,
+ const OUString& sSetNode );
+
+ //-----------------------------------------------
+ /** commit all changes made on the specified configuration access.
+ *
+ * This method must be used in combination with openConfig().
+ * The cached configuration access must be provided here.
+ *
+ * @param xCFG
+ * the configuration root, where changes should be commited.
+ *
+ * @throw Any exceptions the underlying configuration can throw.
+ * E.g. css::uno::Exception if the provided configuration
+ * access does not allow writing for this set.
+ */
+ static void flush(const css::uno::Reference< css::uno::XInterface >& xCFG);
+
+ //-----------------------------------------------
+ /** does the same then openConfig() & readRelativeKey() together.
+ *
+ * This method should be used for reading one key at one code place only.
+ * Because it opens the specified configuration package, reads the key and
+ * closes the configuration again.
+ *
+ * So its not very useful to use this method for reading multiple keys at the same time.
+ * (Excepting these keys exists inside different configuration packages ...))
+ */
+ static css::uno::Any readDirectKey(const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const OUString& sPackage,
+ const OUString& sRelPath,
+ const OUString& sKey ,
+ sal_Int32 eMode );
+
+ //-----------------------------------------------
+ /** does the same then openConfig() / writeRelativeKey() & flush() together.
+ *
+ * This method should be used for writing one key at one code place only.
+ * Because it opens the specified configuration package, writes the key, flush
+ * all changes and closes the configuration again.
+ *
+ * So its not very useful to use this method for writing multiple keys at the same time.
+ * (Excepting these keys exists inside different configuration packages ...))
+ */
+ static void writeDirectKey(const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const OUString& sPackage,
+ const OUString& sRelPath,
+ const OUString& sKey ,
+ const css::uno::Any& aValue ,
+ sal_Int32 eMode );
+};
+
+} // namespace comphelper
+
+#endif // _COMPHELPER_CONFIGURATIONHELPER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/container.hxx b/include/comphelper/container.hxx
new file mode 100644
index 000000000000..d6c5be927873
--- /dev/null
+++ b/include/comphelper/container.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_CONTAINER_HXX_
+#define _COMPHELPER_CONTAINER_HXX_
+
+#include <vector>
+#include "com/sun/star/uno/Reference.hxx"
+#include "comphelper/comphelperdllapi.h"
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+//========================================================================
+//= IndexAccessIterator
+//========================================================================
+/** an iterator that iterates through all elements, starting from an XIndexAccess (pre-order)
+*/
+class COMPHELPER_DLLPUBLIC IndexAccessIterator
+{
+protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> m_xStartingPoint;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> m_xCurrentObject;
+ // The current object
+ ::std::vector<sal_Int32> m_arrChildIndizies;
+
+ // I'm moving through a tree, but its elements have no GetNextSibling,
+ // so I have to remember where each child is in relation to its parent.
+ // That is the path from the root node to m_xCurrentObject
+
+ OUString m_ustrProperty;
+ // The Name of the requested property
+
+public:
+ IndexAccessIterator(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> xStartingPoint);
+
+ virtual ~IndexAccessIterator();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> Next();
+
+ virtual void Invalidate() { m_xCurrentObject = NULL; }
+
+protected:
+ virtual sal_Bool ShouldHandleElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& /*rElement*/) { return sal_True; }
+
+ // This can be used to exclude certain elements; elements for which
+ // this function returns sal_True will be simply skipped.
+ // If this element is returned from Next(), then one can get
+ // here get a little more information on the element.
+ // That's why this method is not const.
+ virtual sal_Bool ShouldStepInto(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& /*xContainer*/) const { return sal_True; }
+};
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // _COMPHELPER_CONTAINER_HXX_
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/containermultiplexer.hxx b/include/comphelper/containermultiplexer.hxx
new file mode 100644
index 000000000000..725265e493c6
--- /dev/null
+++ b/include/comphelper/containermultiplexer.hxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_CONTAINERMULTIPLEXER_HXX_
+#define _COMPHELPER_CONTAINERMULTIPLEXER_HXX_
+
+#include <com/sun/star/container/XContainer.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <osl/mutex.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+ class OContainerListenerAdapter;
+ //=====================================================================
+ //= OContainerListener
+ //=====================================================================
+ /** a non-UNO container listener
+ <p>Useful if you have a non-refcountable class which should act as container listener.<br/>
+ In this case, derive this class from OContainerListener, and create an adapter
+ <type>OContainerListenerAdapter</type> which multiplexes the changes.</p>
+ */
+ class COMPHELPER_DLLPUBLIC OContainerListener
+ {
+ friend class OContainerListenerAdapter;
+ protected:
+ OContainerListenerAdapter* m_pAdapter;
+ ::osl::Mutex& m_rMutex;
+
+ public:
+ OContainerListener(::osl::Mutex& _rMutex);
+ virtual ~OContainerListener();
+
+ virtual void _elementInserted( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void _elementRemoved( const ::com::sun::star::container::ContainerEvent& _Event ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void _elementReplaced( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void _disposing(const ::com::sun::star::lang::EventObject& _rSource) throw( ::com::sun::star::uno::RuntimeException);
+
+ protected:
+ void setAdapter(OContainerListenerAdapter* _pAdapter);
+ };
+
+ //=====================================================================
+ //= OContainerListenerAdapter
+ //=====================================================================
+ class COMPHELPER_DLLPUBLIC OContainerListenerAdapter
+ :public cppu::WeakImplHelper1< ::com::sun::star::container::XContainerListener >
+ {
+ friend class OContainerListener;
+
+ protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainer >
+ m_xContainer;
+ OContainerListener* m_pListener;
+ sal_Int32 m_nLockCount;
+
+ virtual ~OContainerListenerAdapter();
+
+ public:
+ OContainerListenerAdapter(OContainerListener* _pListener,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainer >& _rxContainer);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw( ::com::sun::star::uno::RuntimeException);
+
+ // XContainerListener
+ virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
+
+ // locking the multiplexer
+ sal_Int32 locked() const { return m_nLockCount; }
+
+ /// dispose the object. No multiplexing anymore
+ void dispose();
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainer >&
+ getContainer() const { return m_xContainer; }
+ };
+
+//.........................................................................
+} // namespace dbaui
+//.........................................................................
+
+#endif // _COMPHELPER_CONTAINERMULTIPLEXER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/docpasswordhelper.hxx b/include/comphelper/docpasswordhelper.hxx
new file mode 100644
index 000000000000..24fd868c0735
--- /dev/null
+++ b/include/comphelper/docpasswordhelper.hxx
@@ -0,0 +1,353 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_DOCPASSWORDHELPR_HXX
+#define COMPHELPER_DOCPASSWORDHELPR_HXX
+
+#include <com/sun/star/beans/NamedValue.hpp>
+#include "comphelper/comphelperdllapi.h"
+#include <vector>
+#include "comphelper/docpasswordrequest.hxx"
+
+namespace com { namespace sun { namespace star { namespace task { class XInteractionHandler; } } } }
+namespace com { namespace sun { namespace star { namespace beans { struct PropertyValue; } } } }
+
+namespace comphelper {
+
+class MediaDescriptor;
+
+// ============================================================================
+
+enum DocPasswordVerifierResult
+{
+ DocPasswordVerifierResult_OK,
+ DocPasswordVerifierResult_WRONG_PASSWORD,
+ DocPasswordVerifierResult_ABORT
+};
+
+// ============================================================================
+
+/** Base class for a password verifier used by the DocPasswordHelper class
+ below.
+
+ Users have to implement the virtual functions and pass an instance of the
+ verifier to one of the password request functions.
+ */
+class COMPHELPER_DLLPUBLIC IDocPasswordVerifier
+{
+public:
+ virtual ~IDocPasswordVerifier();
+
+ /** Will be called everytime a password needs to be verified.
+
+ @param rPassword
+ The password to be verified
+
+ @param o_rEncryptionData
+ Output parameter, that is filled with the EncryptionData generated
+ from the password. The data is filled only if the validation was
+ successful.
+
+ @return The result of the verification.
+ - DocPasswordVerifierResult_OK, if and only if the passed password
+ is valid and can be used to process the related document.
+ - DocPasswordVerifierResult_WRONG_PASSWORD, if the password is
+ wrong. The user may be asked again for a new password.
+ - DocPasswordVerifierResult_ABORT, if an unrecoverable error
+ occurred while password verification. The password request loop
+ will be aborted.
+ */
+ virtual DocPasswordVerifierResult verifyPassword( const OUString& rPassword, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& o_rEncryptionData ) = 0;
+
+ /** Will be called everytime an encryption data needs to be verified.
+
+ @param rEncryptionData
+ The data will be validated
+
+ @return The result of the verification.
+ - DocPasswordVerifierResult_OK, if and only if the passed encryption data
+ is valid and can be used to process the related document.
+ - DocPasswordVerifierResult_WRONG_PASSWORD, if the encryption data is
+ wrong.
+ - DocPasswordVerifierResult_ABORT, if an unrecoverable error
+ occured while data verification. The password request loop
+ will be aborted.
+ */
+ virtual DocPasswordVerifierResult verifyEncryptionData( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& o_rEncryptionData ) = 0;
+
+};
+
+// ============================================================================
+
+/** Helper that asks for a document password and checks its validity.
+ */
+class COMPHELPER_DLLPUBLIC DocPasswordHelper
+{
+public:
+ // ------------------------------------------------------------------------
+
+ /** This helper function generates the information related
+ to "Password to modify" provided by user. The result
+ sequence contains the hash and the algorithm-related
+ info.
+
+ @param aString
+ The string for which the info should be generated
+
+ @return
+ The sequence containing the hash and the algorithm-related info
+ */
+
+ static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
+ GenerateNewModifyPasswordInfo( const OUString& aPassword );
+
+ // ------------------------------------------------------------------------
+
+ /** This helper function allows to check whether
+ the "Password to modify" provided by user is the correct one.
+
+ @param aString
+ The string containing the provided password
+
+ @param aInfo
+ The sequence containing the hash and the algorithm-info
+
+ @return
+ <TRUE/> if the password is correct one
+ <FALSE/> otherwise
+ */
+
+ static sal_Bool IsModifyPasswordCorrect(
+ const OUString& aPassword,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aInfo );
+
+
+ // ------------------------------------------------------------------------
+
+ /** This helper function generates the hash code based on the algorithm
+ specified by MS for "Password to modify" feature of Word.
+
+ @param aString
+ The string for which the hash should be calculated
+
+ @return
+ The hash represented by sal_uInt32
+ */
+
+ static sal_uInt32 GetWordHashAsUINT32(
+ const OUString& aString );
+
+ // ------------------------------------------------------------------------
+
+ /** This helper function generates the hash code based on the algorithm
+ specified by MS for "Password to modify" and passwords related to
+ table protection of Excel.
+
+ @param aString
+ The string for which the hash should be calculated
+
+ @param nEnc
+ The encoding that should be used to generate the 8-bit string
+ before the hash is generated
+
+ @return
+ The hash represented by sal_uInt16
+ */
+
+ static sal_uInt16 GetXLHashAsUINT16(
+ const OUString& aString,
+ rtl_TextEncoding nEnc = RTL_TEXTENCODING_UTF8 );
+
+ // ------------------------------------------------------------------------
+
+ /** This helper function generates the hash code based on the algorithm
+ specified by MS for "Password to modify" and passwords related to
+ table protection.
+
+ @param aString
+ The string for which the hash should be calculated
+
+ @param nEnc
+ The encoding that should be used to generate the 8-bit string
+ before the hash is generated
+
+ @return
+ The hash represented by sequence of bytes in BigEndian form
+ */
+
+ static ::com::sun::star::uno::Sequence< sal_Int8 > GetXLHashAsSequence(
+ const OUString& aString,
+ rtl_TextEncoding nEnc = RTL_TEXTENCODING_UTF8 );
+
+ // ------------------------------------------------------------------------
+
+ /** This helper function generates a random sequence of bytes of
+ requested length.
+ */
+
+ static ::com::sun::star::uno::Sequence< sal_Int8 > GenerateRandomByteSequence(
+ sal_Int32 nLength );
+
+ // ------------------------------------------------------------------------
+
+ /** This helper function generates a byte sequence representing the
+ key digest value used by MSCodec_Std97 codec.
+ */
+
+ static ::com::sun::star::uno::Sequence< sal_Int8 > GenerateStd97Key(
+ const OUString& aPassword,
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& aDocId );
+
+ // ------------------------------------------------------------------------
+
+ /** This helper function generates a byte sequence representing the
+ key digest value used by MSCodec_Std97 codec.
+ */
+
+ static ::com::sun::star::uno::Sequence< sal_Int8 > GenerateStd97Key(
+ const sal_uInt16 pPassData[16],
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& aDocId );
+
+ // ------------------------------------------------------------------------
+
+ /** This helper function tries to request and verify a password to load a
+ protected document.
+
+ First, the list of default passwords will be tried if provided. This is
+ needed by import filters for external file formats that have to check a
+ predefined password in some cases without asking the user for a
+ password. Every password is checked using the passed password verifier.
+
+ If not successful, the passed password of a medium is tried, that has
+ been set e.g. by an API call to load a document. If existing, the
+ password is checked using the passed password verifier.
+
+ If still not successful, the passed interaction handler is used to
+ request a password from the user. This will be repeated until the
+ passed password verifier validates the entered password, or if the user
+ chooses to cancel password input.
+
+ @param rVerifier
+ The password verifier used to check every processed password.
+
+ @param rMediaPassword
+ If not empty, will be passed to the password validator before
+ requesting a password from the user. This password usually should
+ be querried from a media descriptor.
+
+ @param rxInteractHandler
+ The interaction handler that will be used to request a password
+ from the user, e.g. by showing a password input dialog.
+
+ @param rDocumentName
+ The name of the related document that will be shown in the password
+ input dialog.
+
+ @param eRequestType
+ The password request type that will be passed to the
+ DocPasswordRequest object created internally. See
+ docpasswordrequest.hxx for more details.
+
+ @param pDefaultPasswords
+ If not null, contains default passwords that will be tried before a
+ password will be requested from the media descriptor or the user.
+
+ @param pbIsDefaultPassword
+ (output parameter) If not null, the type of the found password will
+ be returned. True means the password has been found in the passed
+ list of default passwords. False means the password has been taken
+ from the rMediaPassword parameter or has been entered by the user.
+
+ @return
+ If not empty, contains the password that has been validated by the
+ passed password verifier. If empty, no valid password has been
+ found, or the user has chossen to cancel password input.
+ */
+ static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > requestAndVerifyDocPassword(
+ IDocPasswordVerifier& rVerifier,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rMediaEncData,
+ const OUString& rMediaPassword,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::task::XInteractionHandler >& rxInteractHandler,
+ const OUString& rDocumentName,
+ DocPasswordRequestType eRequestType,
+ const ::std::vector< OUString >* pDefaultPasswords = 0,
+ bool* pbIsDefaultPassword = 0 );
+
+ // ------------------------------------------------------------------------
+
+ /** This helper function tries to find a password for the document
+ described by the passed media descriptor.
+
+ First, the list of default passwords will be tried if provided. This is
+ needed by import filters for external file formats that have to check a
+ predefined password in some cases without asking the user for a
+ password. Every password is checked using the passed password verifier.
+
+ If not successful, the passed media descriptor is asked for a password,
+ that has been set e.g. by an API call to load a document. If existing,
+ the password is checked using the passed password verifier.
+
+ If still not successful, the interaction handler contained in the
+ passed nmedia descriptor is used to request a password from the user.
+ This will be repeated until the passed password verifier validates the
+ entered password, or if the user chooses to cancel password input.
+
+ @param rVerifier
+ The password verifier used to check every processed password.
+
+ @param rMediaDesc
+ The media descriptor of the document that needs to be opened with
+ a password. If a valid password (that is not contained in the
+ passed list of default passwords) was found, it will be inserted
+ into the "Password" property of this descriptor.
+
+ @param eRequestType
+ The password request type that will be passed to the
+ DocPasswordRequest object created internally. See
+ docpasswordrequest.hxx for more details.
+
+ @param pDefaultPasswords
+ If not null, contains default passwords that will be tried before a
+ password will be requested from the media descriptor or the user.
+
+ @return
+ If not empty, contains the password that has been validated by the
+ passed password verifier. If empty, no valid password has been
+ found, or the user has chossen to cancel password input.
+ */
+ static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > requestAndVerifyDocPassword(
+ IDocPasswordVerifier& rVerifier,
+ MediaDescriptor& rMediaDesc,
+ DocPasswordRequestType eRequestType,
+ const ::std::vector< OUString >* pDefaultPasswords = 0 );
+
+ // ------------------------------------------------------------------------
+
+private:
+ ~DocPasswordHelper();
+};
+
+// ============================================================================
+
+} // namespace comphelper
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/docpasswordrequest.hxx b/include/comphelper/docpasswordrequest.hxx
new file mode 100644
index 000000000000..54a32f522ae6
--- /dev/null
+++ b/include/comphelper/docpasswordrequest.hxx
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_DOCPASSWORDREQUEST_HXX
+#define COMPHELPER_DOCPASSWORDREQUEST_HXX
+
+#include "comphelper/comphelperdllapi.h"
+#include <com/sun/star/task/PasswordRequestMode.hpp>
+#include <com/sun/star/task/XInteractionRequest.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/weak.hxx>
+
+
+namespace comphelper {
+
+class AbortContinuation;
+class PasswordContinuation;
+
+// ============================================================================
+
+/** Selects which UNO document password request type to use. */
+enum DocPasswordRequestType
+{
+ DocPasswordRequestType_STANDARD, /// Uses the standard com.sun.star.task.DocumentPasswordRequest request.
+ DocPasswordRequestType_MS /// Uses the com.sun.star.task.DocumentMSPasswordRequest request.
+};
+
+// ============================================================================
+
+class COMPHELPER_DLLPUBLIC SimplePasswordRequest :
+ public ::com::sun::star::task::XInteractionRequest,
+ public ::cppu::OWeakObject
+{
+public:
+ explicit SimplePasswordRequest( com::sun::star::task::PasswordRequestMode eMode );
+ virtual ~SimplePasswordRequest();
+
+ // XInterface / OWeakObject
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire( ) throw ();
+ virtual void SAL_CALL release( ) throw ();
+
+ sal_Bool isPassword() const;
+
+ OUString getPassword() const;
+
+private:
+ // XInteractionRequest
+ virtual ::com::sun::star::uno::Any SAL_CALL getRequest() throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > SAL_CALL getContinuations() throw( ::com::sun::star::uno::RuntimeException );
+
+private:
+ ::com::sun::star::uno::Any maRequest;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > maContinuations;
+ AbortContinuation * mpAbort;
+ PasswordContinuation * mpPassword;
+};
+
+// ============================================================================
+
+/** Implements the task.XInteractionRequest interface for requesting a password
+ string for a document.
+ */
+class COMPHELPER_DLLPUBLIC DocPasswordRequest :
+ public ::com::sun::star::task::XInteractionRequest,
+ public ::cppu::OWeakObject
+{
+public:
+ explicit DocPasswordRequest(
+ DocPasswordRequestType eType,
+ ::com::sun::star::task::PasswordRequestMode eMode,
+ const OUString& rDocumentName,
+ sal_Bool bPasswordToModify = sal_False );
+ virtual ~DocPasswordRequest();
+
+ // XInterface / OWeakObject
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire( ) throw ();
+ virtual void SAL_CALL release( ) throw ();
+
+ sal_Bool isPassword() const;
+
+ OUString getPassword() const;
+
+ OUString getPasswordToModify() const;
+ sal_Bool getRecommendReadOnly() const;
+
+private:
+ // XInteractionRequest
+ virtual ::com::sun::star::uno::Any SAL_CALL getRequest() throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > SAL_CALL getContinuations() throw( ::com::sun::star::uno::RuntimeException );
+
+private:
+ ::com::sun::star::uno::Any maRequest;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > maContinuations;
+ AbortContinuation * mpAbort;
+ PasswordContinuation * mpPassword;
+};
+
+// ============================================================================
+
+} // namespace comphelper
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/documentconstants.hxx b/include/comphelper/documentconstants.hxx
new file mode 100644
index 000000000000..2bc00220995f
--- /dev/null
+++ b/include/comphelper/documentconstants.hxx
@@ -0,0 +1,171 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _COMPHELPER_DOCUMENTCONSTANTS_HXX
+#define _COMPHELPER_DOCUMENTCONSTANTS_HXX
+
+#include <rtl/ustring.hxx>
+
+// formats of SO6/7
+#define MIMETYPE_VND_SUN_XML_WRITER_ASCII "application/vnd.sun.xml.writer"
+#define MIMETYPE_VND_SUN_XML_WRITER_WEB_ASCII "application/vnd.sun.xml.writer.web"
+#define MIMETYPE_VND_SUN_XML_WRITER_GLOBAL_ASCII "application/vnd.sun.xml.writer.global"
+#define MIMETYPE_VND_SUN_XML_DRAW_ASCII "application/vnd.sun.xml.draw"
+#define MIMETYPE_VND_SUN_XML_IMPRESS_ASCII "application/vnd.sun.xml.impress"
+#define MIMETYPE_VND_SUN_XML_CALC_ASCII "application/vnd.sun.xml.calc"
+#define MIMETYPE_VND_SUN_XML_CHART_ASCII "application/vnd.sun.xml.chart"
+#define MIMETYPE_VND_SUN_XML_MATH_ASCII "application/vnd.sun.xml.math"
+#define MIMETYPE_VND_SUN_XML_BASE_ASCII "application/vnd.sun.xml.base"
+
+#define MIMETYPE_VND_SUN_XML_WRITER OUString( MIMETYPE_VND_SUN_XML_WRITER_ASCII )
+#define MIMETYPE_VND_SUN_XML_WRITER_WEB OUString( MIMETYPE_VND_SUN_XML_WRITER_WEB_ASCII )
+#define MIMETYPE_VND_SUN_XML_WRITER_GLOBAL OUString( MIMETYPE_VND_SUN_XML_WRITER_GLOBAL_ASCII )
+#define MIMETYPE_VND_SUN_XML_DRAW OUString( MIMETYPE_VND_SUN_XML_DRAW_ASCII )
+#define MIMETYPE_VND_SUN_XML_IMPRESS OUString( MIMETYPE_VND_SUN_XML_IMPRESS_ASCII )
+#define MIMETYPE_VND_SUN_XML_CALC OUString( MIMETYPE_VND_SUN_XML_CALC_ASCII )
+#define MIMETYPE_VND_SUN_XML_CHART OUString( MIMETYPE_VND_SUN_XML_CHART_ASCII )
+#define MIMETYPE_VND_SUN_XML_MATH OUString( MIMETYPE_VND_SUN_XML_MATH_ASCII )
+#define MIMETYPE_VND_SUN_XML_BASE OUString( MIMETYPE_VND_SUN_XML_BASE_ASCII )
+
+// template formats of SO6/7
+#define MIMETYPE_VND_SUN_XML_WRITER_TEMPLATE_ASCII "application/vnd.sun.xml.writer.template"
+#define MIMETYPE_VND_SUN_XML_DRAW_TEMPLATE_ASCII "application/vnd.sun.xml.draw.template"
+#define MIMETYPE_VND_SUN_XML_IMPRESS_TEMPLATE_ASCII "application/vnd.sun.xml.impress.template"
+#define MIMETYPE_VND_SUN_XML_CALC_TEMPLATE_ASCII "application/vnd.sun.xml.calc.template"
+
+#define MIMETYPE_VND_SUN_XML_WRITER_TEMPLATE OUString( MIMETYPE_VND_SUN_XML_WRITER_ASCII )
+#define MIMETYPE_VND_SUN_XML_DRAW_TEMPLATE OUString( MIMETYPE_VND_SUN_XML_DRAW_ASCII )
+#define MIMETYPE_VND_SUN_XML_IMPRESS_TEMPLATE OUString( MIMETYPE_VND_SUN_XML_IMPRESS_ASCII )
+#define MIMETYPE_VND_SUN_XML_CALC_TEMPLATE OUString( MIMETYPE_VND_SUN_XML_CALC_ASCII )
+
+// formats of SO8
+#define MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII "application/vnd.oasis.opendocument.text"
+#define MIMETYPE_OASIS_OPENDOCUMENT_TEXT_WEB_ASCII "application/vnd.oasis.opendocument.text-web"
+#define MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_ASCII "application/vnd.oasis.opendocument.text-master"
+#define MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_ASCII "application/vnd.oasis.opendocument.graphics"
+#define MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_ASCII "application/vnd.oasis.opendocument.presentation"
+#define MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII "application/vnd.oasis.opendocument.spreadsheet"
+#define MIMETYPE_OASIS_OPENDOCUMENT_CHART_ASCII "application/vnd.oasis.opendocument.chart"
+#define MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_ASCII "application/vnd.oasis.opendocument.formula"
+#define MIMETYPE_OASIS_OPENDOCUMENT_DATABASE_ASCII "application/vnd.oasis.opendocument.base"
+#define MIMETYPE_OASIS_OPENDOCUMENT_REPORT_ASCII "application/vnd.sun.xml.report"
+#define MIMETYPE_OASIS_OPENDOCUMENT_REPORT_CHART_ASCII "application/vnd.sun.xml.report.chart"
+
+#define MIMETYPE_OASIS_OPENDOCUMENT_TEXT OUString( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII )
+#define MIMETYPE_OASIS_OPENDOCUMENT_TEXT_WEB OUString( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_WEB_ASCII )
+#define MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL OUString( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_ASCII )
+#define MIMETYPE_OASIS_OPENDOCUMENT_DRAWING OUString( MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_ASCII )
+#define MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION OUString( MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_ASCII )
+#define MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET OUString( MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII )
+#define MIMETYPE_OASIS_OPENDOCUMENT_CHART OUString( MIMETYPE_OASIS_OPENDOCUMENT_CHART_ASCII )
+#define MIMETYPE_OASIS_OPENDOCUMENT_FORMULA OUString( MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_ASCII )
+#define MIMETYPE_OASIS_OPENDOCUMENT_DATABASE OUString( MIMETYPE_OASIS_OPENDOCUMENT_DATABASE_ASCII )
+#define MIMETYPE_OASIS_OPENDOCUMENT_REPORT OUString( MIMETYPE_OASIS_OPENDOCUMENT_REPORT_ASCII )
+#define MIMETYPE_OASIS_OPENDOCUMENT_REPORT_CHART OUString( MIMETYPE_OASIS_OPENDOCUMENT_REPORT_CHART_ASCII )
+
+// template formats of SO8
+#define MIMETYPE_OASIS_OPENDOCUMENT_TEXT_TEMPLATE_ASCII "application/vnd.oasis.opendocument.text-template"
+#define MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_TEMPLATE_ASCII "application/vnd.oasis.opendocument.graphics-template"
+#define MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE_ASCII "application/vnd.oasis.opendocument.presentation-template"
+#define MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_TEMPLATE_ASCII "application/vnd.oasis.opendocument.spreadsheet-template"
+#define MIMETYPE_OASIS_OPENDOCUMENT_CHART_TEMPLATE_ASCII "application/vnd.oasis.opendocument.chart-template"
+#define MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_TEMPLATE_ASCII "application/vnd.oasis.opendocument.formula-template"
+
+#define MIMETYPE_OASIS_OPENDOCUMENT_TEXT_TEMPLATE OUString( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_TEMPLATE_ASCII )
+#define MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_TEMPLATE OUString( MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_TEMPLATE_ASCII )
+#define MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE OUString( MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE_ASCII )
+#define MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_TEMPLATE OUString( MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_TEMPLATE_ASCII )
+#define MIMETYPE_OASIS_OPENDOCUMENT_CHART_TEMPLATE OUString( MIMETYPE_OASIS_OPENDOCUMENT_CHART_TEMPLATE_ASCII )
+#define MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_TEMPLATE OUString( MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_TEMPLATE_ASCII )
+
+// ODF versions
+#define ODFVER_010_TEXT_ASCII "1.0"
+#define ODFVER_011_TEXT_ASCII "1.1"
+#define ODFVER_012_TEXT_ASCII "1.2"
+
+#define ODFVER_010_TEXT OUString( ODFVER_010_TEXT_ASCII )
+#define ODFVER_011_TEXT OUString( ODFVER_011_TEXT_ASCII )
+#define ODFVER_012_TEXT OUString( ODFVER_012_TEXT_ASCII )
+#endif
+
+// filter flags
+// TODO/LATER: The flags should be part of the UNO specification
+
+// Note that these flag bits have parallel names in
+// filter/source/config/cache/constant.hxx. Some of the bits are
+// missing from there, and some have different names. But the meaning
+// is presumably the same, and the values are the same.
+
+// http://www.mail-archive.com/dev@openoffice.org/msg05047.html says:
+
+// I can just sum up what comes into my mind, hope I don't miss one:
+
+// Import - should be self explaining
+// Export - should be self explaining
+// Template - deprecated
+// TemplatePath - filter for a documenttemplate
+// Own - one of the OOo file formats
+// Alien - no zip container based format
+// Preferred - preferred filter for a particular type
+// Asynchron - deprecated, only HTML-filter isn't synchron
+// 3rdPartyFilter - implemented as a UNO component
+// Default - default filter for this document type
+// NotInFileDialog - should be self explaining
+// NotInChooser - as above
+
+// (The 3rdPartyFilter flag is here called StarONE)
+
+// At some point (4.0?) we should drop the duplicate set of names over
+// in filter, and rename the obscure ones to describe their meaning
+// using terms that are understandable.
+
+#define SFX_FILTER_IMPORT 0x00000001L
+#define SFX_FILTER_EXPORT 0x00000002L
+#define SFX_FILTER_TEMPLATE 0x00000004L
+#define SFX_FILTER_INTERNAL 0x00000008L
+#define SFX_FILTER_TEMPLATEPATH 0x00000010L
+#define SFX_FILTER_OWN 0x00000020L
+#define SFX_FILTER_ALIEN 0x00000040L
+#define SFX_FILTER_USESOPTIONS 0x00000080L
+
+#define SFX_FILTER_DEFAULT 0x00000100L
+#define SFX_FILTER_EXECUTABLE 0x00000200L
+#define SFX_FILTER_SUPPORTSSELECTION 0x00000400L
+#define SFX_FILTER_MAPTOAPPPLUG 0x00000800L
+#define SFX_FILTER_NOTINFILEDLG 0x00001000L
+#define SFX_FILTER_NOTINCHOOSER 0x00002000L
+#define SFX_FILTER_ASYNC 0x00004000L
+#define SFX_FILTER_CREATOR 0x00008000L
+#define SFX_FILTER_OPENREADONLY 0x00010000L
+#define SFX_FILTER_MUSTINSTALL 0x00020000L
+#define SFX_FILTER_CONSULTSERVICE 0x00040000L
+
+#define SFX_FILTER_STARONEFILTER 0x00080000L
+#define SFX_FILTER_PACKED 0x00100000L
+
+#define SFX_FILTER_BROWSERPREFERED 0x00400000L
+
+#define SFX_FILTER_ENCRYPTION 0x01000000L
+#define SFX_FILTER_PASSWORDTOMODIFY 0x02000000L
+
+#define SFX_FILTER_PREFERED 0x10000000L
+
+#define SFX_FILTER_VERSION_NONE 0
+#define SFX_FILTER_NOTINSTALLED SFX_FILTER_MUSTINSTALL | SFX_FILTER_CONSULTSERVICE
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/documentinfo.hxx b/include/comphelper/documentinfo.hxx
new file mode 100644
index 000000000000..48bc39a8cc00
--- /dev/null
+++ b/include/comphelper/documentinfo.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_DOCUMENTINFO_HXX
+#define COMPHELPER_DOCUMENTINFO_HXX
+
+#include "comphelper/comphelperdllapi.h"
+
+#include <com/sun/star/frame/XModel.hpp>
+
+//........................................................................
+namespace comphelper {
+//........................................................................
+
+ //====================================================================
+ //= DocumentInfo
+ //====================================================================
+ class COMPHELPER_DLLPUBLIC DocumentInfo
+ {
+ public:
+ /** retrieves the UI title of the given document
+ */
+ static OUString getDocumentTitle( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxDocument );
+
+ private:
+ DocumentInfo(); // never implemented
+ };
+
+//........................................................................
+} // namespace comphelper
+//........................................................................
+
+#endif // COMPHELPER_DOCUMENTINFO_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/embeddedobjectcontainer.hxx b/include/comphelper/embeddedobjectcontainer.hxx
new file mode 100644
index 000000000000..0347e12ba2c2
--- /dev/null
+++ b/include/comphelper/embeddedobjectcontainer.hxx
@@ -0,0 +1,181 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _COMPHELPER_OBJECTCONTAINER_HXX_
+#define _COMPHELPER_OBJECTCONTAINER_HXX_
+
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include <com/sun/star/task/XInteractionHandler.hpp>
+#include <com/sun/star/embed/XStorage.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include "comphelper/comphelperdllapi.h"
+
+#include <rtl/ustring.hxx>
+
+namespace comphelper
+{
+ class EmbeddedObjectContainer;
+ /** Helper interface to give access to some common object which replace the SfxObjectShell
+ */
+ class SAL_NO_VTABLE IEmbeddedHelper
+ {
+ public:
+ virtual EmbeddedObjectContainer& getEmbeddedObjectContainer() const = 0;
+ virtual com::sun::star::uno::Reference < com::sun::star::embed::XStorage > getStorage() const = 0;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > getInteractionHandler() const = 0;
+ virtual bool isEnableSetModified() const = 0;
+
+ protected:
+ ~IEmbeddedHelper() {}
+ };
+
+struct EmbedImpl;
+class COMPHELPER_DLLPUBLIC EmbeddedObjectContainer
+{
+ EmbedImpl* pImpl;
+
+ ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject > Get_Impl( const OUString&,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xCopy);
+
+public:
+ // add an embedded object to the container storage
+ sal_Bool StoreEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&, OUString&, sal_Bool );
+
+ // add an embedded object that has been imported from the container storage - should only be called by filters!
+ void AddEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&, const OUString& );
+
+ EmbeddedObjectContainer();
+ EmbeddedObjectContainer( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& );
+ EmbeddedObjectContainer( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&,
+ const com::sun::star::uno::Reference < com::sun::star::uno::XInterface >& );
+ ~EmbeddedObjectContainer();
+
+ void SwitchPersistence( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& );
+ sal_Bool CommitImageSubStorage();
+ void ReleaseImageSubStorage();
+
+ OUString CreateUniqueObjectName();
+
+ // get a list of object names that have been added so far
+ com::sun::star::uno::Sequence < OUString > GetObjectNames();
+
+ // check for existence of objects at all
+ sal_Bool HasEmbeddedObjects();
+
+ // check existence of an object - either by identity or by name
+ sal_Bool HasEmbeddedObject( const OUString& );
+ sal_Bool HasEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& );
+ sal_Bool HasInstantiatedEmbeddedObject( const OUString& );
+
+ // get the object name of an object - this is the persist name if the object has persistence
+ OUString GetEmbeddedObjectName( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& );
+
+ // retrieve an embedded object by name that either has been added already or is available in the container storage
+ ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject > GetEmbeddedObject( const OUString& );
+
+ // create an object from a ClassId
+ ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >
+ CreateEmbeddedObject( const com::sun::star::uno::Sequence < sal_Int8 >&, OUString& );
+
+ ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >
+ CreateEmbeddedObject( const com::sun::star::uno::Sequence < sal_Int8 >&,
+ const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >&, OUString& );
+
+ // insert an embedded object into the container - objects persistent representation will be added to the storage
+ sal_Bool InsertEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&, OUString& );
+
+ // load an embedded object from a MediaDescriptor and insert it into the container
+ // a new object will be created from the new content and returned
+ ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >
+ InsertEmbeddedObject( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, OUString& );
+
+ // create an embedded link based on a MediaDescriptor and insert it into the container
+ // a new object will be created from the new content and returned
+ ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >
+ InsertEmbeddedLink( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, OUString& );
+
+ // create an object from a stream that contains its persistent representation and insert it as usual (usually called from clipboard)
+ // a new object will be created from the new content and returned
+ ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >
+ InsertEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream >&, OUString& );
+
+ // copy an embedded object into the storage, open the new copy and return it
+ ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject > CopyAndGetEmbeddedObject( EmbeddedObjectContainer& rSrc, const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj, /* TODO const OUString& aOrigName,*/ OUString& rName );
+
+ // move an embedded object from one container to another one
+ sal_Bool MoveEmbeddedObject( EmbeddedObjectContainer& rSrc, const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&, OUString& );
+
+ // remove an embedded object from the container and from the storage; if object can't be closed
+ sal_Bool RemoveEmbeddedObject( const OUString& rName, sal_Bool bClose=sal_True );
+ sal_Bool RemoveEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&, sal_Bool bClose=sal_True );
+
+ // close and remove an embedded object from the container without removing it from the storage
+ sal_Bool CloseEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& );
+
+ // move an embedded object to another container (keep the persistent name)
+ sal_Bool MoveEmbeddedObject( const OUString& rName, EmbeddedObjectContainer& );
+
+ // get the stored graphical representation for the object
+ com::sun::star::uno::Reference < com::sun::star::io::XInputStream > GetGraphicStream( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&, OUString* pMediaType=0 );
+
+ // get the stored graphical representation by the object name
+ com::sun::star::uno::Reference < com::sun::star::io::XInputStream > GetGraphicStream( const OUString& aName, OUString* pMediaType=0 );
+
+ // add a graphical representation for an object
+ sal_Bool InsertGraphicStream( const com::sun::star::uno::Reference < com::sun::star::io::XInputStream >& rStream, const OUString& rObjectName, const OUString& rMediaType );
+
+ // try to add a graphical representation for an object in optimized way ( might fail )
+ sal_Bool InsertGraphicStreamDirectly( const com::sun::star::uno::Reference < com::sun::star::io::XInputStream >& rStream, const OUString& rObjectName, const OUString& rMediaType );
+
+ // remove a graphical representation for an object
+ sal_Bool RemoveGraphicStream( const OUString& rObjectName );
+
+ // copy the graphical representation from different container
+ sal_Bool TryToCopyGraphReplacement( EmbeddedObjectContainer& rSrc,
+ const OUString& aOrigName,
+ const OUString& aTargetName );
+
+ void CloseEmbeddedObjects();
+ sal_Bool StoreChildren(sal_Bool _bOasisFormat,sal_Bool _bObjectsOnly);
+ sal_Bool StoreAsChildren( sal_Bool _bOasisFormat
+ ,sal_Bool _bCreateEmbedded
+ ,const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& _xStorage);
+
+ static com::sun::star::uno::Reference< com::sun::star::io::XInputStream > GetGraphicReplacementStream(
+ sal_Int64 nViewAspect,
+ const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject >&,
+ OUString* pMediaType );
+
+ /** call setPersistentEntry for each embedded object in the container
+ *
+ * \param _xStorage The storeage where to store the objects.
+ * \param _bClearModifedFlag If <TRUE/> then the modifed flag will be set to <FALSE/> otherwise nothing happen.
+ * \return <FALSE/> if no error occurred, otherwise <TRUE/>.
+ */
+ sal_Bool SetPersistentEntries(const com::sun::star::uno::Reference< com::sun::star::embed::XStorage >& _xStorage,bool _bClearModifedFlag = true);
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/enumhelper.hxx b/include/comphelper/enumhelper.hxx
new file mode 100644
index 000000000000..9870291b22f5
--- /dev/null
+++ b/include/comphelper/enumhelper.hxx
@@ -0,0 +1,143 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_ENUMHELPER_HXX_
+#define _COMPHELPER_ENUMHELPER_HXX_
+
+#include <vector>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <osl/mutex.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+ namespace starcontainer = ::com::sun::star::container;
+ namespace staruno = ::com::sun::star::uno;
+ namespace starlang = ::com::sun::star::lang;
+
+//==================================================================
+//= OEnumerationLock
+//==================================================================
+struct OEnumerationLock
+{
+ public:
+ ::osl::Mutex m_aLock;
+};
+
+//==================================================================
+//= OEnumerationByName
+//==================================================================
+/** provides an <type scope="com.sun.star.container">XEnumeration</type> access based
+ on an object implementing the <type scope="com.sun.star.container">XNameAccess</type> interface
+*/
+class COMPHELPER_DLLPUBLIC OEnumerationByName : private OEnumerationLock
+ , public ::cppu::WeakImplHelper2< starcontainer::XEnumeration ,
+ starlang::XEventListener >
+{
+ staruno::Sequence< OUString > m_aNames;
+ sal_Int32 m_nPos;
+ staruno::Reference< starcontainer::XNameAccess > m_xAccess;
+ sal_Bool m_bListening;
+
+public:
+ OEnumerationByName(const staruno::Reference< starcontainer::XNameAccess >& _rxAccess);
+ OEnumerationByName(const staruno::Reference< starcontainer::XNameAccess >& _rxAccess,
+ const staruno::Sequence< OUString >& _aNames );
+ virtual ~OEnumerationByName();
+
+ virtual sal_Bool SAL_CALL hasMoreElements( ) throw(staruno::RuntimeException);
+ virtual staruno::Any SAL_CALL nextElement( )
+ throw(starcontainer::NoSuchElementException, starlang::WrappedTargetException, staruno::RuntimeException);
+
+ virtual void SAL_CALL disposing(const starlang::EventObject& aEvent) throw(staruno::RuntimeException);
+
+private:
+ COMPHELPER_DLLPRIVATE void impl_startDisposeListening();
+ COMPHELPER_DLLPRIVATE void impl_stopDisposeListening();
+};
+
+//==================================================================
+//= OEnumerationByIndex
+//==================================================================
+/** provides an <type scope="com.sun.star.container">XEnumeration</type> access based
+ on an object implementing the <type scope="com.sun.star.container">XNameAccess</type> interface
+*/
+class COMPHELPER_DLLPUBLIC OEnumerationByIndex : private OEnumerationLock
+ , public ::cppu::WeakImplHelper2< starcontainer::XEnumeration ,
+ starlang::XEventListener >
+{
+ sal_Int32 m_nPos;
+ staruno::Reference< starcontainer::XIndexAccess > m_xAccess;
+ sal_Bool m_bListening;
+
+public:
+ OEnumerationByIndex(const staruno::Reference< starcontainer::XIndexAccess >& _rxAccess);
+ virtual ~OEnumerationByIndex();
+
+ virtual sal_Bool SAL_CALL hasMoreElements( ) throw(staruno::RuntimeException);
+ virtual staruno::Any SAL_CALL nextElement( )
+ throw(starcontainer::NoSuchElementException, starlang::WrappedTargetException, staruno::RuntimeException);
+
+ virtual void SAL_CALL disposing(const starlang::EventObject& aEvent) throw(staruno::RuntimeException);
+
+private:
+ COMPHELPER_DLLPRIVATE void impl_startDisposeListening();
+ COMPHELPER_DLLPRIVATE void impl_stopDisposeListening();
+};
+
+//==================================================================
+//= OAnyEnumeration
+//==================================================================
+/** provides an <type scope="com.sun.star.container">XEnumeration</type>
+ for an outside set vector of Any's.
+
+*/
+class COMPHELPER_DLLPUBLIC OAnyEnumeration : private OEnumerationLock
+ , public ::cppu::WeakImplHelper1< starcontainer::XEnumeration >
+{
+ sal_Int32 m_nPos;
+ staruno::Sequence< staruno::Any > m_lItems;
+
+public:
+ OAnyEnumeration(const staruno::Sequence< staruno::Any >& lItems);
+ virtual ~OAnyEnumeration();
+
+ virtual sal_Bool SAL_CALL hasMoreElements( ) throw(staruno::RuntimeException);
+ virtual staruno::Any SAL_CALL nextElement( )
+ throw(starcontainer::NoSuchElementException, starlang::WrappedTargetException, staruno::RuntimeException);
+
+};
+
+//.........................................................................
+}
+//... namespace comphelper .......................................................
+
+#endif // _COMPHELPER_ENUMHELPER_HXX_
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/eventattachermgr.hxx b/include/comphelper/eventattachermgr.hxx
new file mode 100644
index 000000000000..a525e7c4ea54
--- /dev/null
+++ b/include/comphelper/eventattachermgr.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_EVENTATTACHERMGR_HXX_
+#define _COMPHELPER_EVENTATTACHERMGR_HXX_
+
+#include <com/sun/star/uno/Reference.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+namespace com { namespace sun { namespace star {
+namespace uno {
+ class Exception;
+ class XComponentContext;
+}
+namespace script {
+ class XEventAttacherManager;
+}
+namespace beans {
+ class XIntrospection;
+}
+} } }
+
+
+namespace comphelper
+{
+
+COMPHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::script::XEventAttacherManager >
+createEventAttacherManager(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & rxContext )
+ throw( ::com::sun::star::uno::Exception );
+
+}
+
+#endif // _COMPHELPER_EVENTATTACHERMGR_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/evtlistenerhlp.hxx b/include/comphelper/evtlistenerhlp.hxx
new file mode 100644
index 000000000000..c1bb01fa3aa4
--- /dev/null
+++ b/include/comphelper/evtlistenerhlp.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef COMPHELPER_EVENTLISTENERHELPER_HXX
+#define COMPHELPER_EVENTLISTENERHELPER_HXX
+
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <osl/diagnose.h>
+#include <cppuhelper/weakref.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+//........................................................................
+namespace comphelper
+{
+//........................................................................
+
+ //==========================================================================
+ //= OCommandsListener
+ // is helper class to avoid a cycle in refcount between the XEventListener
+ // and the member XEventBroadcaster
+ //==========================================================================
+ class COMPHELPER_DLLPUBLIC OEventListenerHelper : public ::cppu::WeakImplHelper1< ::com::sun::star::lang::XEventListener >
+ {
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::lang::XEventListener> m_xListener;
+ public:
+ OEventListenerHelper(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener>& _rxListener);
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
+ };
+//........................................................................
+} // namespace comphelper
+//........................................................................
+#endif // COMPHELPER_EVENTLISTENERHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/evtmethodhelper.hxx b/include/comphelper/evtmethodhelper.hxx
new file mode 100644
index 000000000000..7ecf08a0fc57
--- /dev/null
+++ b/include/comphelper/evtmethodhelper.hxx
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef COMPHELPER_EVENTMEHODHELPER_HXX
+#define COMPHELPER_EVENMETHODHELPER_HXX
+#include <comphelper/sequence.hxx>
+//........................................................................
+namespace comphelper
+{
+ COMPHELPER_DLLPUBLIC ::com::sun::star::uno::Sequence< OUString> getEventMethodsForType(const ::com::sun::star::uno::Type& type);
+//........................................................................
+
+} // namespace comphelper
+//........................................................................
+#endif // COMPHELPER_EVENTMEHODHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/extract.hxx b/include/comphelper/extract.hxx
new file mode 100644
index 000000000000..30cbaaefc6c9
--- /dev/null
+++ b/include/comphelper/extract.hxx
@@ -0,0 +1,158 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _COMPHELPER_EXTRACT_HXX_
+#define _COMPHELPER_EXTRACT_HXX_
+
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/TypeClass.hpp>
+#include <com/sun/star/uno/Type.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include "cppu/unotype.hxx"
+
+namespace cppu
+{
+
+/**
+ * Sets enum from int32 value. This function does NOT check for valid enum values!
+ *<BR>
+ * @param nEnum int32 enum value
+ * @param rType enum type
+ * @return enum or emoty any.
+ */
+inline ::com::sun::star::uno::Any SAL_CALL int2enum(
+ sal_Int32 nEnum, const ::com::sun::star::uno::Type & rType )
+{
+ if (rType.getTypeClass() == ::com::sun::star::uno::TypeClass_ENUM)
+ {
+ int nVal = nEnum;
+ return ::com::sun::star::uno::Any( &nVal, rType );
+ }
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Sets int32 from enum or int in any.
+ *<BR>
+ * @param rnEnum [out] int32 enum value
+ * @param rAny enum or int
+ * @param sal_True if enum or int value was set else sal_False.
+ */
+inline sal_Bool SAL_CALL enum2int( sal_Int32 & rnEnum, const ::com::sun::star::uno::Any & rAny )
+{
+ if (rAny.getValueTypeClass() == ::com::sun::star::uno::TypeClass_ENUM)
+ {
+ rnEnum = * reinterpret_cast< const int * >( rAny.getValue() );
+ return sal_True;
+ }
+
+ return rAny >>= rnEnum;
+}
+
+/**
+ * Sets int32 from enum or int in any with additional typecheck
+ * <BR>
+ * @param rAny enum or int
+ * @param eRet the enum value as int. If there is not enum of the given type or
+ * a ::com::sun::star::lang::IllegalArgumentException is thrown
+ */
+template< typename E >
+inline void SAL_CALL any2enum( E & eRet, const ::com::sun::star::uno::Any & rAny )
+ throw( ::com::sun::star::lang::IllegalArgumentException )
+{
+ // check for type save enum
+ if (! (rAny >>= eRet))
+ {
+ // if not enum, maybe integer?
+ sal_Int32 nValue = 0;
+ if (! (rAny >>= nValue))
+ throw ::com::sun::star::lang::IllegalArgumentException();
+
+ eRet = (E)nValue;
+ }
+}
+
+/**
+ * Template function to create an uno::Any from an enum
+ *
+ * @DEPRECATED : use makeAny< E >()
+ *
+ */
+template< typename E >
+inline ::com::sun::star::uno::Any SAL_CALL enum2any( E eEnum )
+{
+ return ::com::sun::star::uno::Any( &eEnum, ::cppu::UnoType< E >::get() );
+}
+
+/**
+ * Extracts interface from an any. If given any does not hold the demanded interface,
+ * it will be queried for it.
+ * If no interface is available, the out ref will be cleared.
+ *<BR>
+ * @param rxOut [out] demanded interface
+ * @param rAny interface
+ * @return sal_True if any reference (including the null ref) was retrieved from any else sal_False.
+ */
+template< class T >
+inline sal_Bool SAL_CALL extractInterface(
+ ::com::sun::star::uno::Reference< T > & rxOut,
+ const ::com::sun::star::uno::Any & rAny )
+{
+ rxOut.clear();
+ return (rAny >>= rxOut);
+}
+
+/**
+ * extracts a boolean either as a sal_Bool or an integer from
+ * an any. If there is no sal_Bool or integer inside the any
+ * a ::com::sun::star::lang::IllegalArgumentException is thrown
+ *
+ */
+inline sal_Bool SAL_CALL any2bool( const ::com::sun::star::uno::Any & rAny )
+ throw( ::com::sun::star::lang::IllegalArgumentException )
+{
+ if (rAny.getValueTypeClass() == ::com::sun::star::uno::TypeClass_BOOLEAN)
+ {
+ return *(sal_Bool *)rAny.getValue();
+ }
+ else
+ {
+ sal_Int32 nValue = 0;
+ if (! (rAny >>= nValue))
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ return nValue != 0;
+ }
+}
+
+/**
+ * Puts a boolean in an any.
+ *
+ * @DEPRECATED : use makeAny< sal_Bool >()
+ *
+ */
+inline ::com::sun::star::uno::Any SAL_CALL bool2any( sal_Bool bBool )
+{
+ return ::com::sun::star::uno::Any( &bBool, ::getCppuBooleanType() );
+}
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/fileformat.h b/include/comphelper/fileformat.h
new file mode 100644
index 000000000000..dbd3f32a1f9a
--- /dev/null
+++ b/include/comphelper/fileformat.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_FILEFORMAT_H_
+#define _COMPHELPER_FILEFORMAT_H_
+
+/* file format versions *************************************************/
+
+#define SOFFICE_FILEFORMAT_31 3450
+#define SOFFICE_FILEFORMAT_40 3580
+#define SOFFICE_FILEFORMAT_50 5050
+#define SOFFICE_FILEFORMAT_60 6200
+#define SOFFICE_FILEFORMAT_8 6800
+#define SOFFICE_FILEFORMAT_CURRENT SOFFICE_FILEFORMAT_8
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/flagguard.hxx b/include/comphelper/flagguard.hxx
new file mode 100644
index 000000000000..af1f1ea1e4fd
--- /dev/null
+++ b/include/comphelper/flagguard.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_FLAGGUARD_HXX
+#define COMPHELPER_FLAGGUARD_HXX
+
+#include "comphelper/scopeguard.hxx"
+
+//......................................................................................................................
+namespace comphelper
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= FlagRestorationGuard
+ //==================================================================================================================
+ class COMPHELPER_DLLPUBLIC FlagRestorationGuard : public ScopeGuard
+ {
+ public:
+ FlagRestorationGuard( bool& i_flagRef, bool i_temporaryValue, exc_handling i_excHandling = IGNORE_EXCEPTIONS )
+ :ScopeGuard( ::boost::bind( RestoreFlag, ::boost::ref( i_flagRef ), !!i_flagRef ), i_excHandling )
+ {
+ i_flagRef = i_temporaryValue;
+ }
+
+ ~FlagRestorationGuard();
+
+ private:
+ static void RestoreFlag( bool& i_flagRef, bool i_originalValue )
+ {
+ i_flagRef = i_originalValue;
+ }
+ };
+
+ //==================================================================================================================
+ //= FlagGuard
+ //==================================================================================================================
+ class COMPHELPER_DLLPUBLIC FlagGuard : public ScopeGuard
+ {
+ public:
+ explicit FlagGuard( bool& i_flagRef, exc_handling i_excHandling = IGNORE_EXCEPTIONS )
+ :ScopeGuard( ::boost::bind( ResetFlag, ::boost::ref( i_flagRef ) ), i_excHandling )
+ {
+ i_flagRef = true;
+ }
+
+ ~FlagGuard();
+
+ private:
+ static void ResetFlag( bool& i_flagRef )
+ {
+ i_flagRef = false;
+ }
+ };
+
+//......................................................................................................................
+} // namespace comphelper
+//......................................................................................................................
+
+#endif // COMPHELPER_FLAGGUARD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/genericpropertyset.hxx b/include/comphelper/genericpropertyset.hxx
new file mode 100644
index 000000000000..e46c30a4cad4
--- /dev/null
+++ b/include/comphelper/genericpropertyset.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_GENERICPROPERTYSET_HXX_
+#define _COMPHELPER_GENERICPROPERTYSET_HXX_
+
+#include <comphelper/propertysetinfo.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include "comphelper/comphelperdllapi.h"
+
+namespace comphelper
+{
+ COMPHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > GenericPropertySet_CreateInstance( PropertySetInfo* pInfo );
+}
+
+#endif // _COMPHELPER_GENERICPROPERTYSET_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/guarding.hxx b/include/comphelper/guarding.hxx
new file mode 100644
index 000000000000..3931c0284e31
--- /dev/null
+++ b/include/comphelper/guarding.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_GUARDING_HXX_
+#define _COMPHELPER_GUARDING_HXX_
+
+#include <osl/mutex.hxx>
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+// ===================================================================================================
+// = class MutexRelease -
+// ===================================================================================================
+
+/** opposite of OGuard :)
+ (a mutex is released within the constructor and acquired within the desctructor)
+ use only when you're sure the mutex is acquired !
+*/
+template <class MUTEX>
+class ORelease
+{
+ MUTEX& m_rMutex;
+
+public:
+ ORelease(MUTEX& _rMutex) : m_rMutex(_rMutex) { _rMutex.release(); }
+ ~ORelease() { m_rMutex.acquire(); }
+};
+
+typedef ORelease< ::osl::Mutex > MutexRelease;
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // _COMPHELPER_GUARDING_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/ihwrapnofilter.hxx b/include/comphelper/ihwrapnofilter.hxx
new file mode 100644
index 000000000000..eb0b13957874
--- /dev/null
+++ b/include/comphelper/ihwrapnofilter.hxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_INTERACTIONHANDLERWRAPPER_HXX_
+#define _COMPHELPER_INTERACTIONHANDLERWRAPPER_HXX_
+
+#include <com/sun/star/task/XInteractionHandler2.hpp>
+#ifndef _COM_SUN_STAR_TASK_XINTERACTIONHANDLER_
+#include <com/sun/star/task/XInteractionHandler.hpp>
+#endif
+#ifndef _COM_SUN_STAR_TASK_XINTERACITONREQUEST_
+#include <com/sun/star/task/XInteractionRequest.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XINITIALIZATION_
+#include <com/sun/star/lang/XInitialization.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FRAME_DOUBLEINITIALIZATIONEXCEPTION_
+#include <com/sun/star/frame/DoubleInitializationException.hpp>
+#endif
+
+#include <cppuhelper/implbase2.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+namespace comphelper {
+
+ class COMPHELPER_DLLPUBLIC OIHWrapNoFilterDialog : public ::cppu::WeakImplHelper2
+ < ::com::sun::star::task::XInteractionHandler2
+ , ::com::sun::star::lang::XServiceInfo >
+ {
+ com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler > m_xInter;
+
+ public:
+ OIHWrapNoFilterDialog( com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler > xInteraction );
+ ~OIHWrapNoFilterDialog();
+
+ static OUString SAL_CALL impl_staticGetImplementationName();
+ static ::com::sun::star::uno::Sequence< OUString > SAL_CALL impl_staticGetSupportedServiceNames();
+
+
+ //____________________________________________________________________________________________________
+ // XInteractionHandler
+ //____________________________________________________________________________________________________
+
+ virtual void SAL_CALL handle( const com::sun::star::uno::Reference< com::sun::star::task::XInteractionRequest >& xRequest)
+ throw( com::sun::star::uno::RuntimeException );
+
+ //____________________________________________________________________________________________________
+ // XInteractionHandler2
+ //____________________________________________________________________________________________________
+
+ virtual sal_Bool SAL_CALL handleInteractionRequest( const com::sun::star::uno::Reference< com::sun::star::task::XInteractionRequest >& xRequest)
+ 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,
+ ::com::sun::star::frame::DoubleInitializationException ) ;
+
+ //____________________________________________________________________________________________________
+ // XServiceInfo
+ //____________________________________________________________________________________________________
+
+ virtual OUString SAL_CALL getImplementationName()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ };
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/implbase_var.hxx b/include/comphelper/implbase_var.hxx
new file mode 100644
index 000000000000..fee9eb695c08
--- /dev/null
+++ b/include/comphelper/implbase_var.hxx
@@ -0,0 +1,436 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/** This header generates the following template classes with a variable number
+ of interfaces:
+
+ comphelper::ImplHelper<N> <typename Ifc1, ..., typename Ifc<N> >
+ comphelper::WeakImplHelper<N> <typename Ifc1, ..., typename Ifc<N> >
+ comphelper::WeakComponentImplHelper<N> <typename Ifc1, ...,
+ typename Ifc<N> >
+ comphelper::ImplInheritanceHelper<N> <typename BaseClass,
+ typename Ifc1, ..., typename Ifc<N> >
+
+ as already present in headers cppuhelper/implbase<1-12>.hxx and
+ cppuhelper/compbase<1-12>.hxx.
+ <N> denotes the number of interface types passed as template arguments.
+ Don't use this header for interface numbers up to 12;
+ always use the existing cppuhelper/(impl|comp)base<1-12>.hxx headers
+ for this purpose, which eases debugging.
+
+ Including this header requires a little discipline, because it has no
+ include guards. Please use the following external include guard rule
+ where <N> is the number of interface types:
+
+ #ifndef INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_<N>
+ #define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_<N>
+ #define COMPHELPER_IMPLBASE_INTERFACE_NUMBER <N>
+ #include "comphelper/implbase_var.hxx"
+ #endif
+
+ Additionally you can
+
+ #define COMPHELPER_IMPLBASE_MAX_CTOR_ARGS <N>
+
+ to control the maximum number of templated ctor arguments for the
+ ImplInheritanceHelper<N> classes.
+ The default is a maximum of 6 arguments.
+*/
+
+#ifndef COMPHELPER_IMPLBASE_INTERFACE_NUMBER
+#error "you have to define COMPHELPER_IMPLBASE_INTERFACE_NUMBER prior to including comphelper/implbase_var.hxx!"
+#endif // ! defined(COMPHELPER_IMPLBASE_INTERFACE_NUMBER)
+
+#if !defined(COMPHELPER_IMPLBASE_TEST_PHASE) && COMPHELPER_IMPLBASE_INTERFACE_NUMBER <= 12
+#error "include proper header file: cppuhelper/implbase<N>.hxx or cppuhelper/compbase<N>.hxx!"
+#endif
+
+#ifndef COMPHELPER_IMPLBASE_MAX_CTOR_ARGS
+#define COMPHELPER_IMPLBASE_MAX_CTOR_ARGS 6 // default
+#endif
+
+#include "cppuhelper/implbase_ex.hxx"
+#include "rtl/instance.hxx"
+#include "cppuhelper/compbase_ex.hxx"
+
+#include "boost/preprocessor/cat.hpp"
+#include "boost/preprocessor/repetition.hpp"
+#include "boost/preprocessor/arithmetic/add.hpp"
+
+namespace comphelper {
+
+// Suppress warnings about hidden functions in case any of the IfcN has
+// functions named dispose, addEventListener, or removeEventListener:
+#if defined __SUNPRO_CC
+#pragma disable_warn
+#endif
+
+namespace detail {
+
+struct BOOST_PP_CAT(class_data, COMPHELPER_IMPLBASE_INTERFACE_NUMBER)
+{
+ sal_Int16 m_nTypes;
+ sal_Bool m_storedTypeRefs;
+ sal_Bool m_storedId;
+ sal_Int8 m_id[16];
+ ::cppu::type_entry m_typeEntries[COMPHELPER_IMPLBASE_INTERFACE_NUMBER + 1];
+};
+
+/// @internal
+template < BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER,
+ typename Ifc), typename Impl >
+struct BOOST_PP_CAT(ImplClassData, COMPHELPER_IMPLBASE_INTERFACE_NUMBER)
+{
+ ::cppu::class_data * operator()() {
+ static BOOST_PP_CAT(class_data, COMPHELPER_IMPLBASE_INTERFACE_NUMBER)
+ s_cd = {
+ COMPHELPER_IMPLBASE_INTERFACE_NUMBER + 1, sal_False, sal_False,
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ {
+#define COMPHELPER_IMPLBASE_classdataList(z_, n_, unused_) \
+{ { BOOST_PP_CAT(Ifc, n_)::static_type }, \
+ reinterpret_cast<sal_IntPtr>( static_cast< BOOST_PP_CAT(Ifc, n_) * >( \
+ reinterpret_cast<Impl *>(16) ) ) - 16 },
+ BOOST_PP_REPEAT(COMPHELPER_IMPLBASE_INTERFACE_NUMBER,
+ COMPHELPER_IMPLBASE_classdataList, ~)
+#undef COMPHELPER_IMPLBASE_classdataList
+ { { ::com::sun::star::lang::XTypeProvider::static_type },
+ reinterpret_cast<sal_IntPtr>(
+ static_cast< ::com::sun::star::lang::XTypeProvider * >(
+ reinterpret_cast<Impl *>(16) ) ) - 16 }
+ }
+ };
+ return reinterpret_cast< ::cppu::class_data * >(&s_cd);
+ }
+};
+
+} // namespace detail
+
+/** Implementation helper implementing interface
+ ::com::sun::star::lang::XTypeProvider and method
+ XInterface::queryInterface(), but no reference counting.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as
+ template argument(s). Your sub class defines method implementations for
+ these interface(s) including acquire()/release() and delegates incoming
+ queryInterface() calls to this base class.
+*/
+template< BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER,
+ typename Ifc) >
+class SAL_NO_VTABLE BOOST_PP_CAT(ImplHelper,
+ COMPHELPER_IMPLBASE_INTERFACE_NUMBER)
+ : public ::com::sun::star::lang::XTypeProvider,
+ BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER, public Ifc)
+{
+ /// @internal
+ struct cd : public ::rtl::StaticAggregate<
+ ::cppu::class_data,
+ BOOST_PP_CAT(detail::ImplClassData,
+ COMPHELPER_IMPLBASE_INTERFACE_NUMBER)
+ <
+ BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER, Ifc),
+ BOOST_PP_CAT(ImplHelper, COMPHELPER_IMPLBASE_INTERFACE_NUMBER)<
+ BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER, Ifc)>
+ > > {};
+
+protected:
+ BOOST_PP_CAT(ImplHelper, COMPHELPER_IMPLBASE_INTERFACE_NUMBER)() {}
+ virtual ~BOOST_PP_CAT(ImplHelper, COMPHELPER_IMPLBASE_INTERFACE_NUMBER)() {}
+
+public:
+ virtual ::com::sun::star::uno::Any
+ SAL_CALL queryInterface( ::com::sun::star::uno::Type const& rType )
+ throw (::com::sun::star::uno::RuntimeException)
+ { return ::cppu::ImplHelper_query( rType, cd::get(), this ); }
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >
+ SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException)
+ { return ::cppu::ImplHelper_getTypes( cd::get() ); }
+ virtual ::com::sun::star::uno::Sequence<sal_Int8>
+ SAL_CALL getImplementationId()
+ throw (::com::sun::star::uno::RuntimeException)
+ { return ::cppu::ImplHelper_getImplementationId( cd::get() ); }
+};
+
+/** Implementation helper implementing interfaces
+ ::com::sun::star::lang::XTypeProvider and
+ ::com::sun::star::uno::XInterface
+ which supports weak mechanism to be held weakly
+ (supporting ::com::sun::star::uno::XWeak thru ::cppu::OWeakObject).
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as
+ template argument(s). Your sub class defines method implementations for
+ these interface(s).
+*/
+template< BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER,
+ typename Ifc) >
+class SAL_NO_VTABLE BOOST_PP_CAT(WeakImplHelper,
+ COMPHELPER_IMPLBASE_INTERFACE_NUMBER)
+ : public ::cppu::OWeakObject,
+ public ::com::sun::star::lang::XTypeProvider,
+ BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER, public Ifc)
+{
+ /// @internal
+ struct cd : public ::rtl::StaticAggregate<
+ ::cppu::class_data,
+ BOOST_PP_CAT(detail::ImplClassData,
+ COMPHELPER_IMPLBASE_INTERFACE_NUMBER)
+ <
+ BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER, Ifc),
+ BOOST_PP_CAT(WeakImplHelper, COMPHELPER_IMPLBASE_INTERFACE_NUMBER)<
+ BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER, Ifc)>
+ > > {};
+
+public:
+ virtual ::com::sun::star::uno::Any
+ SAL_CALL queryInterface( ::com::sun::star::uno::Type const& rType )
+ throw (::com::sun::star::uno::RuntimeException)
+ {
+ return ::cppu::WeakImplHelper_query(
+ rType, cd::get(), this, static_cast<OWeakObject *>(this) );
+ }
+ virtual void SAL_CALL acquire() throw ()
+ { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() throw ()
+ { OWeakObject::release(); }
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >
+ SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException)
+ { return ::cppu::WeakImplHelper_getTypes( cd::get() ); }
+ virtual ::com::sun::star::uno::Sequence<sal_Int8>
+ SAL_CALL getImplementationId()
+ throw (::com::sun::star::uno::RuntimeException)
+ { return ::cppu::ImplHelper_getImplementationId( cd::get() ); }
+};
+
+/** Implementation helper implementing interfaces
+ ::com::sun::star::lang::XTypeProvider and
+ ::com::sun::star::uno::XInterface inherting from a BaseClass.
+
+ All acquire() and release() calls are delegated to the BaseClass.
+ Upon queryInterface(), if a demanded interface is not supported by this
+ class directly, the request is delegated to the BaseClass.
+
+ @attention
+ The BaseClass has to be complete in a sense, that
+ ::com::sun::star::uno::XInterface and
+ ::com::sun::star::lang::XTypeProvider are implemented properly.
+ The BaseClass must have at least one ctor that can be called with
+ COMPHELPER_IMPLBASE_MAX_CTOR_ARGS or fewer arguments.
+
+ @derive
+ Inherit from this class giving your additional interface(s) to be
+ implemented as template argument(s). Your sub class defines method
+ implementations for these interface(s).
+*/
+template <typename BaseClass,
+ BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER,
+ typename Ifc) >
+class SAL_NO_VTABLE BOOST_PP_CAT(ImplInheritanceHelper,
+ COMPHELPER_IMPLBASE_INTERFACE_NUMBER)
+ : public BaseClass,
+ BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER, public Ifc)
+{
+ /// @internal
+ struct cd : public ::rtl::StaticAggregate<
+ ::cppu::class_data,
+ BOOST_PP_CAT(detail::ImplClassData,
+ COMPHELPER_IMPLBASE_INTERFACE_NUMBER)
+ <
+ BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER, Ifc),
+ BOOST_PP_CAT(ImplInheritanceHelper,
+ COMPHELPER_IMPLBASE_INTERFACE_NUMBER)<
+ BaseClass,
+ BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER, Ifc)>
+ > > {};
+
+protected:
+#define COMPHELPER_IMPLBASE_templctor_args(z_, n_, unused_) \
+ BOOST_PP_CAT(T, n_) const& BOOST_PP_CAT(arg, n_)
+#define COMPHELPER_IMPLBASE_templctor(z_, n_, classname_) \
+ template< BOOST_PP_ENUM_PARAMS( BOOST_PP_ADD(n_, 1), typename T) > \
+ explicit BOOST_PP_CAT(classname_, COMPHELPER_IMPLBASE_INTERFACE_NUMBER)( \
+ BOOST_PP_ENUM(BOOST_PP_ADD(n_, 1), \
+ COMPHELPER_IMPLBASE_templctor_args, ~) ) \
+ : BaseClass( BOOST_PP_ENUM_PARAMS(BOOST_PP_ADD(n_, 1), arg) ) {}
+
+ BOOST_PP_CAT(ImplInheritanceHelper, COMPHELPER_IMPLBASE_INTERFACE_NUMBER)()
+ : BaseClass() {}
+ BOOST_PP_REPEAT(COMPHELPER_IMPLBASE_MAX_CTOR_ARGS,
+ COMPHELPER_IMPLBASE_templctor, ImplInheritanceHelper)
+
+public:
+ virtual ::com::sun::star::uno::Any
+ SAL_CALL queryInterface( ::com::sun::star::uno::Type const& rType )
+ throw (::com::sun::star::uno::RuntimeException)
+ {
+ ::com::sun::star::uno::Any const aRet(
+ ::cppu::ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
+ if (aRet.hasValue())
+ return aRet;
+ return BaseClass::queryInterface( rType );
+ }
+ virtual void SAL_CALL acquire() throw ()
+ { BaseClass::acquire(); }
+ virtual void SAL_CALL release() throw ()
+ { BaseClass::release(); }
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >
+ SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException)
+ {
+ return ::cppu::ImplInhHelper_getTypes(
+ cd::get(), BaseClass::getTypes() );
+ }
+ virtual ::com::sun::star::uno::Sequence<sal_Int8>
+ SAL_CALL getImplementationId()
+ throw (::com::sun::star::uno::RuntimeException)
+ { return ::cppu::ImplHelper_getImplementationId( cd::get() ); }
+};
+
+// not needed anymore:
+#undef COMPHELPER_IMPLBASE_templctor_args
+#undef COMPHELPER_IMPLBASE_templctor
+
+/** Implementation helper supporting
+ ::com::sun::star::lang::XTypeProvider and
+ ::com::sun::star::lang::XComponent.
+
+ Upon disposing objects of this class, sub-classes receive a disposing()
+ call. Objects of this class can be held weakly, i.e. by a
+ ::com::sun::star::uno::WeakReference.
+
+ @attention
+ The life-cycle of the passed mutex reference has to be longer than objects
+ of this class.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as
+ template argument(s). Your sub class defines method implementations for
+ these interface(s).
+*/
+template < BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER,
+ typename Ifc) >
+class SAL_NO_VTABLE BOOST_PP_CAT(WeakComponentImplHelper,
+ COMPHELPER_IMPLBASE_INTERFACE_NUMBER)
+ : public ::cppu::WeakComponentImplHelperBase,
+ public ::com::sun::star::lang::XTypeProvider,
+ BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER, public Ifc)
+{
+ /// @internal
+ struct cd : public ::rtl::StaticAggregate<
+ ::cppu::class_data,
+ BOOST_PP_CAT(detail::ImplClassData,
+ COMPHELPER_IMPLBASE_INTERFACE_NUMBER)
+ <
+ BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER, Ifc),
+ BOOST_PP_CAT(WeakComponentImplHelper,
+ COMPHELPER_IMPLBASE_INTERFACE_NUMBER)<
+ BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER, Ifc)>
+ > > {};
+
+public:
+ BOOST_PP_CAT(WeakComponentImplHelper, COMPHELPER_IMPLBASE_INTERFACE_NUMBER)(
+ ::osl::Mutex & rMutex ) : WeakComponentImplHelperBase(rMutex) {}
+
+ virtual ::com::sun::star::uno::Any
+ SAL_CALL queryInterface( ::com::sun::star::uno::Type const& rType )
+ throw (::com::sun::star::uno::RuntimeException)
+ {
+ return ::cppu::WeakComponentImplHelper_query(
+ rType, cd::get(), this,
+ static_cast< ::cppu::WeakComponentImplHelperBase * >(this) );
+ }
+ virtual void SAL_CALL acquire() throw ()
+ { WeakComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() throw ()
+ { WeakComponentImplHelperBase::release(); }
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >
+ SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException)
+ { return ::cppu::WeakComponentImplHelper_getTypes( cd::get() ); }
+ virtual ::com::sun::star::uno::Sequence<sal_Int8>
+ SAL_CALL getImplementationId()
+ throw (::com::sun::star::uno::RuntimeException)
+ { return ::cppu::ImplHelper_getImplementationId( cd::get() ); }
+
+ // implement XComponent directly avoiding ambiguities:
+ virtual void SAL_CALL dispose()
+ throw (::com::sun::star::uno::RuntimeException)
+ { WeakComponentImplHelperBase::dispose(); }
+ virtual void SAL_CALL addEventListener(
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener>
+ const & xListener ) throw (::com::sun::star::uno::RuntimeException)
+ { WeakComponentImplHelperBase::addEventListener( xListener ); }
+ virtual void SAL_CALL removeEventListener(
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener>
+ const & xListener ) throw (::com::sun::star::uno::RuntimeException)
+ { WeakComponentImplHelperBase::removeEventListener( xListener ); }
+};
+
+template < BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER,
+ typename Ifc) >
+class SAL_NO_VTABLE BOOST_PP_CAT(PartialWeakComponentImplHelper,
+ COMPHELPER_IMPLBASE_INTERFACE_NUMBER)
+ : public ::cppu::WeakComponentImplHelperBase,
+ public ::com::sun::star::lang::XTypeProvider,
+ BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER, public Ifc)
+{
+ /// @internal
+ struct cd : public ::rtl::StaticAggregate<
+ ::cppu::class_data,
+ BOOST_PP_CAT(detail::ImplClassData,
+ COMPHELPER_IMPLBASE_INTERFACE_NUMBER)
+ <
+ BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER, Ifc),
+ BOOST_PP_CAT(PartialWeakComponentImplHelper,
+ COMPHELPER_IMPLBASE_INTERFACE_NUMBER)<
+ BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER, Ifc)>
+ > > {};
+
+public:
+ BOOST_PP_CAT(PartialWeakComponentImplHelper, COMPHELPER_IMPLBASE_INTERFACE_NUMBER)(
+ ::osl::Mutex & rMutex ) : WeakComponentImplHelperBase(rMutex) {}
+
+ virtual ::com::sun::star::uno::Any
+ SAL_CALL queryInterface( ::com::sun::star::uno::Type const& rType )
+ throw (::com::sun::star::uno::RuntimeException)
+ {
+ return ::cppu::WeakComponentImplHelper_query(
+ rType, cd::get(), this,
+ static_cast< ::cppu::WeakComponentImplHelperBase * >(this) );
+ }
+ virtual void SAL_CALL acquire() throw ()
+ { WeakComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() throw ()
+ { WeakComponentImplHelperBase::release(); }
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >
+ SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException)
+ { return ::cppu::WeakComponentImplHelper_getTypes( cd::get() ); }
+ virtual ::com::sun::star::uno::Sequence<sal_Int8>
+ SAL_CALL getImplementationId()
+ throw (::com::sun::star::uno::RuntimeException)
+ { return ::cppu::ImplHelper_getImplementationId( cd::get() ); }
+};
+
+
+} // namespace comphelper
+
+// undef for multiple use/inclusion of this header:
+#undef COMPHELPER_IMPLBASE_MAX_CTOR_ARGS
+#undef COMPHELPER_IMPLBASE_INTERFACE_NUMBER
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/implementationreference.hxx b/include/comphelper/implementationreference.hxx
new file mode 100644
index 000000000000..7957d6437ff5
--- /dev/null
+++ b/include/comphelper/implementationreference.hxx
@@ -0,0 +1,267 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_IMPLEMENTATIONREFERENCE_HXX
+#define _COMPHELPER_IMPLEMENTATIONREFERENCE_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/XInterface.hpp>
+
+namespace comphelper
+{
+
+ /** Holds a uno::Reference alongside a C++ implementation pointer
+
+ This template is useful to accomplish the following task: the
+ client needs an implementation pointer to an object providing
+ UNO interfaces. It is unsafe to simply store a C++ pointer,
+ because of the automatic UNO lifetime control. It is
+ inconvenient to always cast the UNO interface to the C++
+ implementation, and what's more, it's mostly unclear to the
+ casual code reader.
+
+ Thus, this template nicely encapsulate the stated intention,
+ by holding a uno::Reference internally, and providing simple
+ C++ pointer semantics to the outside. As a differentiator to
+ ::rtl::Reference, this template features a getRef() method,
+ giving you friction-less access to the internal UNO interface,
+ without extra querying.
+
+ By the way, the pointer semantic of this template include
+ transitive constness. That means, if this template's instance
+ is const (e.g. because it is a member of a class which is
+ accessed in a const method), the pointer returned is also
+ const.
+
+ As this template is geared towards fast, internal pointer
+ access, validity of the UNO reference is _not_ checked for
+ every pointer access. The client of this template is
+ responsible to check that, whereever necessary, via the is()
+ method.
+
+ @tpl CppType
+ The C++ type this class should mimick a pointer to (not the
+ pointer type itself!).
+
+ @tpl UnoType
+ The UNO interface type of the object (a uno::Reference to this
+ type is held internally).
+
+ @tpl XIfType
+ An unambiguous derivative of UnoType. This is defaulted to
+ the second template parameter (UnoType), which should normally
+ just work, since one typically has only single inheritance in
+ UNO.<p>
+ Alternatively, when using the
+ ImplementationReference::createFromQuery() method to create an
+ instance, this type can serve a different need: if the
+ provided CppType only derives from XInterface (generally
+ speaking, derives from a UNO interface above UnoType in the
+ class hierarchy), then the default XIfType constitutes a
+ possibly invalid downcast to UnoType. Setting XIfType equal to
+ CppTypes's most derived UNO interface type then solves this
+ problem (which is not as arcane as it seems to be. Just
+ imagine you're providing a C++ abstract interface, which must
+ provide UNO reference semantics. Naturally, you will derive
+ this C++ interface only from XInterface, to reduce the number
+ of ambiguous classes. Even more naturally, it is reasonable to
+ have UnoType be something different from XInterface, governed
+ by the usage of the C++ interface)
+
+ @sample ImplementationReference< MyCppType, XMyInterface >
+
+ @sample ImplementationReference< MyAbstractCppType, XMyInterface, XInterface >
+ for an abstract C++ class
+
+ @see ::rtl::Reference
+
+ */
+ template < class CppType,
+ class UnoType,
+ class XIfType=UnoType > class ImplementationReference
+ {
+ public:
+
+ typedef UnoType UnoInterfaceType;
+ typedef CppType ImplementationType;
+ typedef XIfType UnambiguousXInterfaceType;
+
+ /** Default-construct an ImplementationReference
+
+ Uno reference will be invalid, implementation pointer will
+ be NULL.
+ */
+ ImplementationReference() :
+ mxRef(),
+ mpImpl( NULL )
+ {
+ }
+
+ /** Create an ImplementationReference from C++ pointer.
+
+ This constructor does not perform an explicit
+ QueryInterface on the provided implementation object, but
+ constructs the UNO reference directly from the given
+ pointer. This is the fastest, and most often the best way
+ to create an ImplementationReference. If the conversion
+ between the implementation object and the required UNO
+ interface is ambiguous, provide the third template
+ parameter with a type that can be unambiguously upcasted
+ to the UNO interface (the second template parameter).
+
+ There are cases, however, where performing a
+ QueryInterface is the better, albeit slower choice. In
+ these cases, createFromQuery() should be used.
+
+ @param pImpl
+ Pointer to the C++ implementation type
+
+ @see createFromQuery()
+ */
+ explicit ImplementationReference( ImplementationType* pImpl ) :
+ mxRef( static_cast<UnambiguousXInterfaceType*>(pImpl) ),
+ mpImpl( pImpl )
+ {
+ }
+
+ struct CreateFromQuery { };
+ /** Create an ImplementationReference from C++ pointer
+
+ @param pImpl
+ The pointer to the C++ implementation type, which is
+ queried for the template-parameterized UNO type.
+
+ @param dummy
+ Dummy parameter, to distinguish this contructor from the
+ default unary one (which does not perform a
+ QueryInterface)
+ */
+ ImplementationReference( ImplementationType* pImpl, CreateFromQuery ) :
+ mxRef( static_cast<UnambiguousXInterfaceType*>(pImpl),
+ ::com::sun::star::uno::UNO_QUERY ),
+ mpImpl( pImpl )
+ {
+ }
+
+ /** Factory method to create an ImplementationReference from
+ C++ pointer.
+
+ This is a static version of the constructor which creates
+ an instance of an implementation type which is explicitly
+ queried for the ImplementationReference's
+ template-parameterized UNO type.
+
+ @sample
+ mpRef = mpRef.createFromQuery( new ImplementationType );
+ */
+ static ImplementationReference createFromQuery( ImplementationType* pImpl )
+ {
+ return ImplementationReference( pImpl, CreateFromQuery() );
+ }
+
+ /** Query whether the pointer is still valid.
+
+ Hands off also from the implementation pointer if this
+ returns false!
+ */
+ bool is() const { return mxRef.is(); }
+
+ /** Get a pointer to the implementation object
+
+ Compatibility method to get an auto_ptr-compatible
+ interface
+ */
+ ImplementationType* get() { return mpImpl; }
+ const ImplementationType* get() const { return mpImpl; }
+
+ /** Release all references
+
+ Compatibility method to get an auto_ptr-compatible
+ interface
+ */
+ void reset() { dispose(); }
+
+ /** Release all references
+
+ This method releases the UNO interface reference, and
+ clears the C++ pointer to NULL.
+ */
+ void dispose() { mxRef = NULL; mpImpl=NULL; }
+
+ ImplementationType* operator->() { return mpImpl; }
+ const ImplementationType* operator->() const { return mpImpl; }
+
+ ImplementationType& operator*() { return *mpImpl; }
+ const ImplementationType& operator*() const { return *mpImpl; }
+
+ /// Access to the underlying UNO reference, without extra querying
+ ::com::sun::star::uno::Reference< UnoInterfaceType > getRef() { return mxRef; }
+
+ /// Access to the underlying UNO reference, without extra querying
+ const ::com::sun::star::uno::Reference< UnoInterfaceType >& getRef() const { return mxRef; }
+
+ // default destructor, copy constructor and assignment will do
+ // ~ImplementationReference();
+ // ImplementationReference( const ImplementationReference& );
+ // ImplementationReference& operator= ( const ImplementationReference& );
+
+ /** Comparison operator
+
+ Object identity is defined to be identity of the
+ implementation pointers. This is in general invalid when
+ comparing pointers to UNO objects (ambiguous class
+ hierarchies, optimizations in the bridges, etc.), but okay
+ for raw C++ pointers (which is what's compared herein).
+ */
+ bool operator==( const ImplementationReference& rhs ) const
+ {
+ return mpImpl == rhs.mpImpl;
+ }
+
+ /** less-than operator
+
+ Object order is defined to be the ordering of the
+ implementation pointers. This is in general invalid when
+ comparing pointers to UNO objects (ambiguous class
+ hierarchies, optimizations in the bridges, etc.), but okay
+ for raw C++ pointers (which is what's used herein).
+
+ This ordering complies with STL's strict weak ordering
+ concept.
+ */
+ bool operator<( const ImplementationReference& rhs ) const
+ {
+ return mpImpl < rhs.mpImpl;
+ }
+
+ private:
+
+ // the interface, hard reference to prevent object from vanishing
+ ::com::sun::star::uno::Reference< UnoInterfaceType > mxRef;
+
+ // the c++ object, for our internal stuff
+ ImplementationType* mpImpl;
+
+ };
+
+}
+
+#endif // _COMPHELPER_IMPLEMENTATIONREFERENCE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/interaction.hxx b/include/comphelper/interaction.hxx
new file mode 100644
index 000000000000..bbd925efd3fa
--- /dev/null
+++ b/include/comphelper/interaction.hxx
@@ -0,0 +1,161 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_INTERACTION_HXX_
+#define _COMPHELPER_INTERACTION_HXX_
+
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/task/XInteractionApprove.hpp>
+#include <com/sun/star/task/XInteractionDisapprove.hpp>
+#include <com/sun/star/task/XInteractionAbort.hpp>
+#include <com/sun/star/task/XInteractionRetry.hpp>
+#include <com/sun/star/task/XInteractionPassword.hpp>
+#include <com/sun/star/task/XInteractionRequest.hpp>
+#include "comphelper/comphelperdllapi.h"
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+ //=========================================================================
+ //= OInteractionSelect
+ //=========================================================================
+ /** base class for concrete XInteractionContinuation implementations.<p/>
+ Instances of the classes maintain a flag indicating if the handler was called.
+ */
+ class OInteractionSelect
+ {
+ sal_Bool m_bSelected : 1; /// indicates if the select event occurred
+
+ protected:
+ OInteractionSelect() : m_bSelected(sal_False) { }
+
+ public:
+ /// determines whether or not this handler was selected
+ sal_Bool wasSelected() const { return m_bSelected; }
+ /// resets the state to "not selected", so you may reuse the handler
+ void reset() { m_bSelected = sal_False; }
+
+ protected:
+ void implSelected() { m_bSelected = sal_True; }
+ };
+
+ //=========================================================================
+ //= OInteraction
+ //=========================================================================
+ /** template for instantiating concret interaction handlers<p/>
+ the template argument must eb an interface derived from XInteractionContinuation
+ */
+ template <class INTERACTION>
+ class OInteraction
+ :public ::cppu::WeakImplHelper1< INTERACTION >
+ ,public OInteractionSelect
+ {
+ public:
+ OInteraction() { }
+
+ // XInteractionContinuation
+ virtual void SAL_CALL select( ) throw(::com::sun::star::uno::RuntimeException);
+ };
+
+ //.........................................................................
+ template <class INTERACTION>
+ void SAL_CALL OInteraction< INTERACTION >::select( ) throw(::com::sun::star::uno::RuntimeException)
+ {
+ implSelected();
+ }
+
+ //=========================================================================
+ //= OInteractionApprove
+ //=========================================================================
+ typedef OInteraction< ::com::sun::star::task::XInteractionApprove > OInteractionApprove;
+
+ //=========================================================================
+ //= OInteractionDispprove
+ //=========================================================================
+ typedef OInteraction< ::com::sun::star::task::XInteractionDisapprove > OInteractionDisapprove;
+
+ //=========================================================================
+ //= OInteractionAbort
+ //=========================================================================
+ typedef OInteraction< ::com::sun::star::task::XInteractionAbort > OInteractionAbort;
+
+ //=========================================================================
+ //= OInteractionRetry
+ //=========================================================================
+ typedef OInteraction< ::com::sun::star::task::XInteractionRetry > OInteractionRetry;
+
+ //=========================================================================
+ //= OInteractionPassword
+ //=========================================================================
+ class COMPHELPER_DLLPUBLIC OInteractionPassword : public OInteraction< ::com::sun::star::task::XInteractionPassword >
+ {
+ public:
+ OInteractionPassword()
+ {
+ }
+
+ OInteractionPassword( const OUString& _rInitialPassword )
+ :m_sPassword( _rInitialPassword )
+ {
+ }
+
+ // XInteractionPassword
+ virtual void SAL_CALL setPassword( const OUString& _Password ) throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getPassword( ) throw (::com::sun::star::uno::RuntimeException);
+
+ private:
+ OUString m_sPassword;
+ };
+
+ //=========================================================================
+ //= OInteractionRequest
+ //=========================================================================
+ typedef ::cppu::WeakImplHelper1 < ::com::sun::star::task::XInteractionRequest
+ > OInteractionRequest_Base;
+ /** implements an interaction request (<type scope="com.sun.star.task">XInteractionRequest</type>)<p/>
+ at run time, you can freely add any interaction continuation objects
+ */
+ class COMPHELPER_DLLPUBLIC OInteractionRequest : public OInteractionRequest_Base
+ {
+ ::com::sun::star::uno::Any
+ m_aRequest; /// the request we represent
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > >
+ m_aContinuations; /// all registered continuations
+
+ public:
+ OInteractionRequest(const ::com::sun::star::uno::Any& _rRequestDescription);
+
+ /// add a new continuation
+ void addContinuation(const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >& _rxContinuation);
+
+ // XInteractionRequest
+ virtual ::com::sun::star::uno::Any SAL_CALL getRequest( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > SAL_CALL getContinuations( ) throw(::com::sun::star::uno::RuntimeException);
+ };
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // _COMPHELPER_INTERACTION_HXX_
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/listenernotification.hxx b/include/comphelper/listenernotification.hxx
new file mode 100644
index 000000000000..21e2ea74723b
--- /dev/null
+++ b/include/comphelper/listenernotification.hxx
@@ -0,0 +1,298 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_INC_COMPHELPER_LISTENERNOTIFICATION_HXX
+#define COMPHELPER_INC_COMPHELPER_LISTENERNOTIFICATION_HXX
+
+#include <cppuhelper/interfacecontainer.hxx>
+
+#include <com/sun/star/lang/XEventListener.hpp>
+#include "comphelper/comphelperdllapi.h"
+
+#include <memory>
+
+//........................................................................
+namespace comphelper
+{
+//........................................................................
+
+ //====================================================================
+ //= OListenerContainer
+ //====================================================================
+ /** abstract base class which manages a listener container, including
+ THB's listener notification pattern which cares for removing listeners
+ which throw an DisposedException upon notification
+
+ Using this class is pretty easy:
+ <ul>
+ <li>Derive from it, and overwrite implNotify.</li>
+ <li>Use <member>impl_addListener</member> and <member>impl_removeListener</member> in your
+ XFoo::addFooListener and XFoo::removeFooListener methods.</li>
+ <li>call <member>impl_notify</member> whenever the event you want to notify happened</li>
+ <li>call <member>disposing</member> upon the disposal of your broadcaster.</li>
+ </ul>
+
+ See <type>OListenerContainerBase</type> for an implementation which even saves
+ you some more work, by doing the casts for you.
+
+ @see http://www.openoffice.org/servlets/ReadMsg?list=interface-announce&msgId=494345
+ @see OListenerContainerBase
+ */
+ class COMPHELPER_DLLPUBLIC OListenerContainer
+ {
+ private:
+ ::cppu::OInterfaceContainerHelper m_aListeners;
+
+ public:
+ /** sends a XEventObject::disposing notification to all listeners, and clears the
+ listener container
+
+ You'll usually call this from within your own dispose/disposing method
+ */
+ void disposing( const ::com::sun::star::lang::EventObject& _rEventSource );
+
+ /** clears the container without calling <member scope="com::sun::star::lang">XEventListener::disposing</member>
+ at the listeners
+ */
+ void clear();
+
+ /** determines whether the listener container is currently empty
+ */
+ inline bool
+ empty() const SAL_THROW(());
+
+ /** determines the number of elements in the container
+ */
+ inline size_t
+ size() const SAL_THROW(());
+
+ /** creates an iterator for looping through all registered listeners
+ */
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ ::std::auto_ptr< ::cppu::OInterfaceIteratorHelper > createIterator()
+ {
+ ::std::auto_ptr< ::cppu::OInterfaceIteratorHelper > pIterator( new ::cppu::OInterfaceIteratorHelper( m_aListeners ) );
+ return pIterator;
+ }
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+
+ protected:
+ OListenerContainer( ::osl::Mutex& _rMutex );
+
+ virtual ~OListenerContainer();
+
+ void impl_addListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& _rxListener );
+ void impl_removeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& _rxListener );
+
+ /** notifies all listeners of the given event, using THB's notification pattern
+
+ internally, this method will call <member>implNotify</member> for every listener
+
+ @return
+ <TRUE/> if all listeners have been notified, <FALSE/> else. The latter can happen
+ if <member>implNotify</member> cancelles the notification loop.
+
+ @see implNotify
+ */
+ bool impl_notify( const ::com::sun::star::lang::EventObject& _rEvent ) SAL_THROW(( ::com::sun::star::uno::Exception ));
+
+ protected:
+ /** call a single listener
+
+ @pure
+
+ @throws ::com::sun::star::uno::Exception
+ if the listener throws an exception during notification. Please don't catch
+ any listener exceptions in your implementation of this method, simply let them
+ pass to the caller.
+
+ @param _rxListener
+ specifies the listener to call. Is guaranteed to not be <NULL/>
+ @param _rEvent
+ the event to broadcast. This is the same as passed to <member>notify</member>, so if
+ your base class knows the type passed into <member>notify</member>, it can safely assume
+ that <arg>_rEvent</arg> is also of this type.
+
+ @return
+ <TRUE/> if the remaining listeners should be called, <FALSE/> if the notification
+ loop should be cancelled
+
+ @see notify
+ */
+ virtual bool implNotify(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& _rxListener,
+ const ::com::sun::star::lang::EventObject& _rEvent
+ ) SAL_THROW( ( ::com::sun::star::uno::Exception ) ) = 0;
+ };
+
+ //====================================================================
+ inline bool OListenerContainer::empty() const SAL_THROW(())
+ {
+ return ( m_aListeners.getLength() == 0 );
+ }
+
+ inline size_t OListenerContainer::size() const SAL_THROW(())
+ {
+ return m_aListeners.getLength();
+ }
+
+ //====================================================================
+ //= OSimpleListenerContainer
+ //====================================================================
+ /** helper class for simple notification of the form LISTENER::METHOD( EVENT )
+
+ This class is not threadsafe!
+
+ @param LISTENER
+ the listener class to call, e.g. <type scope="com::sun::star::lang">XEventListener</type>
+ @param EVENT
+ the event type to notify, e.g. <type scope="com::sun::star::lang">EventObject</type>
+ */
+ template< class LISTENER, class EVENT >
+ class OSimpleListenerContainer : protected OListenerContainer
+ {
+ public:
+ typedef LISTENER ListenerClass;
+ typedef EVENT EventClass;
+ typedef void ( SAL_CALL LISTENER::*NotificationMethod )( const EventClass& );
+
+ private:
+ NotificationMethod m_pNotificationMethod;
+
+ public:
+ OSimpleListenerContainer( ::osl::Mutex& _rMutex )
+ :OListenerContainer( _rMutex )
+ ,m_pNotificationMethod( NULL )
+ {
+ }
+
+ inline void addListener( const ::com::sun::star::uno::Reference< ListenerClass >& _rxListener )
+ {
+ OListenerContainer::impl_addListener( _rxListener.get() );
+ }
+
+ inline void removeListener( const ::com::sun::star::uno::Reference< ListenerClass >& _rxListener )
+ {
+ OListenerContainer::impl_removeListener( _rxListener.get() );
+ }
+
+ // publish some otherwise hidden base functionality
+ using OListenerContainer::disposing;
+ using OListenerContainer::clear;
+ using OListenerContainer::empty;
+ using OListenerContainer::size;
+ using OListenerContainer::createIterator;
+
+ /// typed notification
+ inline bool notify( const EventClass& _rEvent, NotificationMethod _pNotify ) SAL_THROW(( ::com::sun::star::uno::Exception ));
+
+ protected:
+ inline virtual bool implNotify(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& _rxListener,
+ const ::com::sun::star::lang::EventObject& _rEvent
+ ) SAL_THROW( ( ::com::sun::star::uno::Exception ) );
+ };
+
+ //--------------------------------------------------------------------
+ template< class LISTENER, class EVENT >
+ inline bool OSimpleListenerContainer< LISTENER, EVENT >::notify( const EventClass& _rEvent, NotificationMethod _pNotify ) SAL_THROW(( ::com::sun::star::uno::Exception ))
+ {
+ m_pNotificationMethod = _pNotify;
+ bool bRet = OListenerContainer::impl_notify( _rEvent );
+ m_pNotificationMethod = NULL;
+ return bRet;
+ }
+
+ //--------------------------------------------------------------------
+ template< class LISTENER, class EVENT >
+ inline bool OSimpleListenerContainer< LISTENER, EVENT >::implNotify(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& _rxListener,
+ const ::com::sun::star::lang::EventObject& _rEvent ) SAL_THROW( ( ::com::sun::star::uno::Exception ) )
+ {
+ const EventClass& rTypedEvent( static_cast< const EventClass& >( _rEvent ) );
+ ListenerClass* pTypedListener( static_cast< ListenerClass* >( _rxListener.get() ) );
+ (pTypedListener->*m_pNotificationMethod)( rTypedEvent );
+ return true;
+ }
+
+ //====================================================================
+ //= OListenerContainerBase
+ //====================================================================
+ /** is a specialization of OListenerContainer which saves you some additional type casts,
+ by making the required listener and event types template arguments.
+ */
+ template< class LISTENER, class EVENT >
+ class OListenerContainerBase : public OListenerContainer
+ {
+ public:
+ typedef LISTENER ListenerClass;
+ typedef EVENT EventClass;
+
+ public:
+ inline OListenerContainerBase( ::osl::Mutex& _rMutex ) : OListenerContainer( _rMutex )
+ {
+ }
+
+ inline void addTypedListener( const ::com::sun::star::uno::Reference< ListenerClass >& _rxListener )
+ {
+ OListenerContainer::impl_addListener( _rxListener.get() );
+ }
+
+ inline void removeTypedListener( const ::com::sun::star::uno::Reference< ListenerClass >& _rxListener )
+ {
+ OListenerContainer::impl_removeListener( _rxListener.get() );
+ }
+
+ inline bool notify( const EventClass& _rEvent )
+ {
+ return OListenerContainer::impl_notify( _rEvent );
+ }
+
+ using OListenerContainer::impl_notify;
+
+ protected:
+ inline virtual bool implNotify(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& _rxListener,
+ const ::com::sun::star::lang::EventObject& _rEvent
+ ) SAL_THROW( ( ::com::sun::star::uno::Exception ) );
+
+ virtual bool implTypedNotify(
+ const ::com::sun::star::uno::Reference< ListenerClass >& _rxListener,
+ const EventClass& _rEvent
+ ) SAL_THROW( ( ::com::sun::star::uno::Exception ) ) = 0;
+ };
+
+ template< class LISTENER, class EVENT >
+ inline bool OListenerContainerBase< LISTENER, EVENT >::implNotify(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& _rxListener,
+ const ::com::sun::star::lang::EventObject& _rEvent ) SAL_THROW( ( ::com::sun::star::uno::Exception ) )
+ {
+ return implTypedNotify(
+ ::com::sun::star::uno::Reference< ListenerClass >( static_cast< ListenerClass* >( _rxListener.get() ) ),
+ static_cast< const EventClass& >( _rEvent )
+ );
+ }
+
+//........................................................................
+} // namespace comphelper
+//........................................................................
+
+#endif // COMPHELPER_INC_COMPHELPER_LISTENERNOTIFICATION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/logging.hxx b/include/comphelper/logging.hxx
new file mode 100644
index 000000000000..b6356384af3d
--- /dev/null
+++ b/include/comphelper/logging.hxx
@@ -0,0 +1,726 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_LOGGING_HXX
+#define COMPHELPER_LOGGING_HXX
+
+#include <comphelper/comphelperdllapi.h>
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/logging/XLogHandler.hpp>
+#include <com/sun/star/logging/LogLevel.hpp>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/optional.hpp>
+
+//........................................................................
+namespace comphelper
+{
+//........................................................................
+
+ //====================================================================
+ //= string conversions, employed by the templatized log* members of
+ //= EventLogger
+ //====================================================================
+
+ namespace log { namespace convert
+ {
+ inline const OUString& convertLogArgToString( const OUString& _rValue )
+ {
+ return _rValue;
+ }
+
+ inline OUString convertLogArgToString( const sal_Char* _pAsciiValue )
+ {
+ return OUString::createFromAscii( _pAsciiValue );
+ }
+
+ inline OUString convertLogArgToString( double _nValue ) { return OUString::valueOf( _nValue ); }
+ inline OUString convertLogArgToString( float _nValue ) { return OUString::valueOf( _nValue ); }
+ inline OUString convertLogArgToString( sal_Int64 _nValue ) { return OUString::valueOf( _nValue ); }
+ inline OUString convertLogArgToString( sal_Int32 _nValue ) { return OUString::valueOf( _nValue ); }
+ inline OUString convertLogArgToString( sal_Int16 _nValue ) { return OUString::valueOf( (sal_Int32)_nValue ); }
+ inline OUString convertLogArgToString( sal_Unicode _nValue ) { return OUString::valueOf( _nValue ); }
+ inline OUString convertLogArgToString( sal_Bool _nValue ) { return OUString::valueOf( _nValue ); }
+
+ } } // namespace log::convert
+
+ //====================================================================
+ //= EventLogger
+ //====================================================================
+ class EventLogger_Impl;
+ typedef ::boost::optional< OUString > OptionalString;
+
+ /** encapsulates an <type scope="com::sun::star::logging">XLogger</type>
+
+ The class silences several (unlikely) errors which could potentially happen
+ when working with a logger. Additionally, it provides some convenience methods
+ for logging events.
+
+ You can use this class as follows
+<pre>
+ EventLogger aLogger( xContext, sLoggerName );
+ ....
+ aLogger.log( LogLevel::SEVERE, sSomeMessage );
+ aLogger.logp( LogLevel::CONFIG, "MyClass", "MyMethod", sSomeMessage, SomeParameter1, SomeParameter2, SomeParameter3 );
+</pre>
+
+ The <code>log</code> and <code>logp</code> calls support up to 6 parameters, which can be of
+ arbitrary type. For every parameter, there must exist a function <code>convertLogArgToString</code>
+ which takes an argument of the respective type, and returns a string.
+
+ After a parameter has been converted to a string using the above mentioned
+ <code>convertLogArgToString</code> function, a placeholder $1$ (resp. $2$ resp. $4$ ...)
+ in the message will be replaced with this string, and the resulting message will be logged.
+ */
+ class COMPHELPER_DLLPUBLIC EventLogger
+ {
+ protected:
+ ::boost::shared_ptr< EventLogger_Impl > m_pImpl;
+
+ public:
+ /** creates an <code>EventLogger</code> instance working with a css.logging.XLogger
+ instance given by ASCII name.
+
+ @param _rxContext
+ the component context to create services
+
+ @param _rLoggerName
+ the ASCII name of the logger to create.
+ */
+ EventLogger(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext,
+ const sal_Char* _pAsciiLoggerName
+ );
+
+ ~EventLogger();
+
+ public:
+ /// determines whether an event with the given level would be logged
+ bool isLoggable( const sal_Int32 _nLogLevel ) const;
+
+ //----------------------------------------------------------------
+ //- XLogger::log equivalents/wrappers
+ //- string messages
+
+ /// logs a given message, without any arguments, or source class/method names
+ bool log( const sal_Int32 _nLogLevel, const OUString& _rMessage ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, _rMessage );
+ return false;
+ }
+
+ /** logs a given message, replacing a placeholder in the message with an argument
+
+ The function takes, additionally to the log level and the message, an arbitrary
+ argument. This argument is converted to a string using an overloaded function
+ named <code>convertLogArgToString</code>. Then, a placeholder &quot;$1$&quot;
+ is searched in the message string, and replaced with the argument string.
+ */
+ template< typename ARGTYPE1 >
+ bool log( const sal_Int32 _nLogLevel, const OUString& _rMessage, ARGTYPE1 _argument1 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 2 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2 >
+ bool log( const sal_Int32 _nLogLevel, const OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 3 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3 >
+ bool log( const sal_Int32 _nLogLevel, const OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 4 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4 >
+ bool log( const sal_Int32 _nLogLevel, const OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 5 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5 >
+ bool log( const sal_Int32 _nLogLevel, const OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument5 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 6 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5, typename ARGTYPE6 >
+ bool log( const sal_Int32 _nLogLevel, const OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5, ARGTYPE6 _argument6 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument5 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument6 ) ) );
+ return false;
+ }
+
+ //----------------------------------------------------------------
+ //- XLogger::log equivalents/wrappers
+ //- ASCII messages
+
+ /// logs a given message, without any arguments, or source class/method names
+ bool log( const sal_Int32 _nLogLevel, const sal_Char* _pMessage ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, OUString::createFromAscii( _pMessage ) );
+ return false;
+ }
+
+ /** logs a given message, replacing a placeholder in the message with an argument
+
+ The function takes, additionally to the log level and the message, an arbitrary
+ argument. This argument is converted to a string using an overloaded function
+ named <code>convertLogArgToString</code>. Then, a placeholder &quot;$1$&quot;
+ is searched in the message string, and replaced with the argument string.
+ */
+ template< typename ARGTYPE1 >
+ bool log( const sal_Int32 _nLogLevel, const sal_Char* _pMessage, ARGTYPE1 _argument1 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, OUString::createFromAscii( _pMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 2 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2 >
+ bool log( const sal_Int32 _nLogLevel, const sal_Char* _pMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, OUString::createFromAscii( _pMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 3 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3 >
+ bool log( const sal_Int32 _nLogLevel, const sal_Char* _pMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, OUString::createFromAscii( _pMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 4 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4 >
+ bool log( const sal_Int32 _nLogLevel, const sal_Char* _pMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, OUString::createFromAscii( _pMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 5 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5 >
+ bool log( const sal_Int32 _nLogLevel, const sal_Char* _pMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, OUString::createFromAscii( _pMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument5 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 6 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5, typename ARGTYPE6 >
+ bool log( const sal_Int32 _nLogLevel, const sal_Char* _pMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5, ARGTYPE6 _argument6 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, OUString::createFromAscii( _pMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument5 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument6 ) ) );
+ return false;
+ }
+
+ //----------------------------------------------------------------
+ //- XLogger::logp equivalents/wrappers
+ //- string messages
+
+ /// logs a given message, without any arguments, or source class/method names
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const OUString& _rMessage ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, _rMessage );
+ return false;
+ }
+
+ /** logs a given message, replacing a placeholder in the message with an argument
+
+ The function takes, additionally to the logp level and the message, an arbitrary
+ argument. This argument is converted to a string using an overloaded function
+ named <code>convertLogArgToString</code>. Then, a placeholder &quot;$1$&quot;
+ is searched in the message string, and replaced with the argument string.
+ */
+ template< typename ARGTYPE1 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const OUString& _rMessage, ARGTYPE1 _argument1 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 2 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 3 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 4 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 5 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument5 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 6 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5, typename ARGTYPE6 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5, ARGTYPE6 _argument6 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument5 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument6 ) ) );
+ return false;
+ }
+
+ //----------------------------------------------------------------
+ //- XLogger::logp equivalents/wrappers
+ //- ASCII messages
+
+ /// logs a given ASCII message, without any arguments, or source class/method names
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Char* _pAsciiMessage ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, OUString::createFromAscii( _pAsciiMessage ) );
+ return false;
+ }
+
+ /** logs a given ASCII message, replacing a placeholder in the message with an argument
+
+ The function takes, additionally to the logp level and the message, an arbitrary
+ argument. This argument is converted to a string using an overloaded function
+ named <code>convertLogArgToString</code>. Then, a placeholder &quot;$1$&quot;
+ is searched in the message string, and replaced with the argument string.
+ */
+ template< typename ARGTYPE1 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Char* _pAsciiMessage, ARGTYPE1 _argument1 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, OUString::createFromAscii( _pAsciiMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ) );
+ return false;
+ }
+
+ /// logs a given ASCII message, replacing 2 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Char* _pAsciiMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, OUString::createFromAscii( _pAsciiMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ) );
+ return false;
+ }
+
+ /// logs a given ASCII message, replacing 3 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Char* _pAsciiMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, OUString::createFromAscii( _pAsciiMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ) );
+ return false;
+ }
+
+ /// logs a given ASCII message, replacing 4 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Char* _pAsciiMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, OUString::createFromAscii( _pAsciiMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ) );
+ return false;
+ }
+
+ /// logs a given ASCII message, replacing 5 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Char* _pAsciiMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, OUString::createFromAscii( _pAsciiMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument5 ) ) );
+ return false;
+ }
+
+ /// logs a given ASCII message, replacing 6 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5, typename ARGTYPE6 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Char* _pAsciiMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5, ARGTYPE6 _argument6 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, OUString::createFromAscii( _pAsciiMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument5 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument6 ) ) );
+ return false;
+ }
+
+ protected:
+ bool impl_log(
+ const sal_Int32 _nLogLevel,
+ const sal_Char* _pSourceClass,
+ const sal_Char* _pSourceMethod,
+ const OUString& _rMessage,
+ const OptionalString& _rArgument1 = OptionalString(),
+ const OptionalString& _rArgument2 = OptionalString(),
+ const OptionalString& _rArgument3 = OptionalString(),
+ const OptionalString& _rArgument4 = OptionalString(),
+ const OptionalString& _rArgument5 = OptionalString(),
+ const OptionalString& _rArgument6 = OptionalString()
+ ) const;
+ };
+
+ //====================================================================
+ //= ResourceBasedEventLogger
+ //====================================================================
+ struct ResourceBasedEventLogger_Data;
+ /** extends the EventLogger class with functionality to load log messages from
+ a resource bundle.
+ */
+ class COMPHELPER_DLLPUBLIC ResourceBasedEventLogger : public EventLogger
+ {
+ private:
+ ::boost::shared_ptr< ResourceBasedEventLogger_Data > m_pData;
+
+ public:
+ /** creates a resource based event logger
+ @param _rxContext
+ the component context for creating new components
+ @param _pResourceBundleBaseName
+ the ASCII base name of the resource bundle to use. Will be used
+ in conjunction with XResourceBundleLoader::loadResource.
+ @param _pAsciiLoggerName
+ the ASCII name of the logger to work with. If NULL, the office-wide
+ default logger will be used.
+
+ */
+ ResourceBasedEventLogger(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext,
+ const sal_Char* _pResourceBundleBaseName,
+ const sal_Char* _pAsciiLoggerName = NULL
+ );
+
+ //----------------------------------------------------------------
+ //- XLogger::log equivalents/wrappers
+ //- resource IDs
+
+ /// logs a given message, without any arguments, or source class/method names
+ bool log( const sal_Int32 _nLogLevel, const sal_Int32 _nMessageResID ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, impl_loadStringMessage_nothrow( _nMessageResID ) );
+ return false;
+ }
+
+ /** logs a given message, replacing a placeholder in the message with an argument
+
+ The function takes, additionally to the log level and the message, an arbitrary
+ argument. This argument is converted to a string using an overloaded function
+ named <code>convertLogArgToString</code>. Then, a placeholder &quot;$1$&quot;
+ is searched in the message string, and replaced with the argument string.
+ */
+ template< typename ARGTYPE1 >
+ bool log( const sal_Int32 _nLogLevel, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, impl_loadStringMessage_nothrow( _nMessageResID ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 2 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2 >
+ bool log( const sal_Int32 _nLogLevel, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, impl_loadStringMessage_nothrow( _nMessageResID ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 3 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3 >
+ bool log( const sal_Int32 _nLogLevel, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, impl_loadStringMessage_nothrow( _nMessageResID ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 4 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4 >
+ bool log( const sal_Int32 _nLogLevel, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, impl_loadStringMessage_nothrow( _nMessageResID ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 5 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5 >
+ bool log( const sal_Int32 _nLogLevel, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, impl_loadStringMessage_nothrow( _nMessageResID ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument5 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 6 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5, typename ARGTYPE6 >
+ bool log( const sal_Int32 _nLogLevel, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5, ARGTYPE6 _argument6 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, impl_loadStringMessage_nothrow( _nMessageResID ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument5 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument6 ) ) );
+ return false;
+ }
+
+ //----------------------------------------------------------------
+ //- XLogger::logp equivalents/wrappers
+ //- resource IDs
+
+ /// logs a given ASCII message, without any arguments, or source class/method names
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Int32 _nMessageResID ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, impl_loadStringMessage_nothrow( _nMessageResID ) );
+ return false;
+ }
+
+ /** logs a given ASCII message, replacing a placeholder in the message with an argument
+ */
+ template< typename ARGTYPE1 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, impl_loadStringMessage_nothrow( _nMessageResID ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ) );
+ return false;
+ }
+
+ /// logs a given ASCII message, replacing 2 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, impl_loadStringMessage_nothrow( _nMessageResID ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ) );
+ return false;
+ }
+
+ /// logs a given ASCII message, replacing 3 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, impl_loadStringMessage_nothrow( _nMessageResID ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ) );
+ return false;
+ }
+
+ /// logs a given ASCII message, replacing 4 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, impl_loadStringMessage_nothrow( _nMessageResID ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ) );
+ return false;
+ }
+
+ /// logs a given ASCII message, replacing 5 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, impl_loadStringMessage_nothrow( _nMessageResID ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument5 ) ) );
+ return false;
+ }
+
+ /// logs a given ASCII message, replacing 6 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5, typename ARGTYPE6 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5, ARGTYPE6 _argument6 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, impl_loadStringMessage_nothrow( _nMessageResID ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument5 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument6 ) ) );
+ return false;
+ }
+
+ private:
+ OUString impl_loadStringMessage_nothrow( const sal_Int32 _nMessageResID ) const;
+ };
+
+//........................................................................
+} // namespace comphelper
+//........................................................................
+
+#endif // COMPHELPER_LOGGING_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/make_shared_from_uno.hxx b/include/comphelper/make_shared_from_uno.hxx
new file mode 100644
index 000000000000..2a70094a3f94
--- /dev/null
+++ b/include/comphelper/make_shared_from_uno.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_COMPHELPER_MAKE_SHARED_FROM_UNO_HXX
+#define INCLUDED_COMPHELPER_MAKE_SHARED_FROM_UNO_HXX
+
+#include "boost/shared_ptr.hpp"
+#include <functional>
+
+namespace comphelper {
+
+/// @internal
+namespace detail {
+/// @internal
+template <typename T> struct ReleaseFunc : ::std::unary_function<T *, void> {
+ void operator()( T * p ) const { p->release(); }
+};
+} // namespace detail
+
+/** Makes a boost::shared_ptr from a ref-counted UNO object pointer.
+ This makes sense if the object is used via UNO (implementing some X
+ interface) and also internally using its implementation class, e.g.
+
+ <pre>
+ boost::shared_ptr<MyUnoImpl> const ptr(
+ comphelper::make_shared_from_UNO( new MyUnoImpl ) );
+ ...
+ xUno->callingUno( uno::Reference<XSomeInterface>( ptr.get() ) );
+ ...
+ takeSharedPtr( ptr );
+ ...
+ </pre>
+
+ @attention The shared_ptr operates on a separate reference counter, so
+ weak pointers (boost::weak_ptr) are invalidated when the last
+ shared_ptr is destroyed, although the UNO object may still be
+ alive.
+
+ @param p object pointer
+ @return shared_ptr to object
+*/
+template <typename T>
+inline ::boost::shared_ptr<T> make_shared_from_UNO( T * p )
+{
+ p->acquire();
+ return ::boost::shared_ptr<T>( p, detail::ReleaseFunc<T>() );
+}
+
+} // namespace comphelper
+
+#endif // ! defined(INCLUDED_COMPHELPER_MAKE_SHARED_FROM_UNO_HXX)
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/makesequence.hxx b/include/comphelper/makesequence.hxx
new file mode 100644
index 000000000000..bc35657db9a8
--- /dev/null
+++ b/include/comphelper/makesequence.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_MAKESEQUENCE_HXX_INCLUDED
+#define COMPHELPER_MAKESEQUENCE_HXX_INCLUDED
+
+#include "com/sun/star/uno/Sequence.hxx"
+#include "boost/preprocessor/cat.hpp"
+#include "boost/preprocessor/repetition.hpp"
+#include "boost/preprocessor/arithmetic/add.hpp"
+
+namespace comphelper {
+
+/** Creates a uno::Sequence out of one parameter.
+*/
+template <typename T>
+inline ::com::sun::star::uno::Sequence<T> makeSequence( T const& element )
+{
+ return ::com::sun::star::uno::Sequence<T>( &element, 1 );
+}
+
+#define COMPHELPER_MAKESEQUENCE_assign(z_, n_, unused_) \
+ p[n_] = BOOST_PP_CAT(element, n_);
+
+/** The following preprocessor repetitions generate functions like
+
+ <pre>
+ template <typename T>
+ inline ::com::sun::star::uno::Sequence<T> makeSequence(
+ T const& element0, T const& element1, ... );
+ </pre>
+
+ which make a sequence out of the passed elements.
+
+ The maximum number of elements can be set by defining
+ COMPHELPER_MAKESEQUENCE_MAX_ARGS; its default is 12.
+*/
+#define COMPHELPER_MAKESEQUENCE_make(z_, n_, unused_) \
+template <typename T> \
+inline ::com::sun::star::uno::Sequence<T> makeSequence( \
+ BOOST_PP_ENUM_PARAMS(n_, T const& element) ) \
+{ \
+ ::com::sun::star::uno::Sequence<T> seq( n_ ); \
+ T * p = seq.getArray(); \
+ BOOST_PP_REPEAT(n_, COMPHELPER_MAKESEQUENCE_assign, ~) \
+ return seq; \
+}
+
+#ifndef COMPHELPER_MAKESEQUENCE_MAX_ARGS
+#define COMPHELPER_MAKESEQUENCE_MAX_ARGS 12
+#endif
+
+BOOST_PP_REPEAT_FROM_TO(2, BOOST_PP_ADD(COMPHELPER_MAKESEQUENCE_MAX_ARGS, 1),
+ COMPHELPER_MAKESEQUENCE_make, ~)
+
+#undef COMPHELPER_MAKESEQUENCE_MAX_ARGS
+#undef COMPHELPER_MAKESEQUENCE_make
+#undef COMPHELPER_MAKESEQUENCE_assign
+
+} // namespace comphelper
+
+#endif // ! defined(COMPHELPER_MAKESEQUENCE_HXX_INCLUDED)
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/mediadescriptor.hxx b/include/comphelper/mediadescriptor.hxx
new file mode 100644
index 000000000000..7c7174644292
--- /dev/null
+++ b/include/comphelper/mediadescriptor.hxx
@@ -0,0 +1,310 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_MEDIADESCRIPTOR_HXX_
+#define _COMPHELPER_MEDIADESCRIPTOR_HXX_
+
+#include <comphelper/sequenceashashmap.hxx>
+#include <rtl/ustring.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+namespace com { namespace sun { namespace star { namespace io {
+ class XInputStream;
+} } } }
+
+namespace comphelper{
+
+/** @short can be used to work with a <type scope="::com::sun::star::document">MediaDescriptor</type>
+ struct.
+
+ @descr It wraps a ::boost::unordered_map around the Sequence< css::beans::PropertyValue >, which
+ represent the MediaDescriptor item.
+ Further this helper defines often used functions (as e.g. open of the required streams,
+ consistent checks etcpp.) and it defines all useable property names.
+
+ @attention This class isnt threadsafe and must be guarded from outside!
+ */
+class COMPHELPER_DLLPUBLIC MediaDescriptor : public SequenceAsHashMap
+{
+ public:
+
+ //---------------------------------------
+ /** @short these methods can be used to get the different property names
+ as static const OUString values.
+
+ @descr Because definition and declaration of static const class members
+ does not work as expected under windows (under unix it works as well)
+ these way must be used :-(
+ */
+ static const OUString& PROP_ABORTED();
+ static const OUString& PROP_ASTEMPLATE();
+ static const OUString& PROP_COMPONENTDATA();
+ static const OUString& PROP_DOCUMENTSERVICE();
+ static const OUString& PROP_ENCRYPTIONDATA();
+ static const OUString& PROP_FILENAME();
+ static const OUString& PROP_FILTERNAME();
+ static const OUString& PROP_FILTERPROVIDER();
+ static const OUString& PROP_FILTEROPTIONS();
+ static const OUString& PROP_FRAME();
+ static const OUString& PROP_FRAMENAME();
+ static const OUString& PROP_HIDDEN();
+ static const OUString& PROP_INPUTSTREAM();
+ static const OUString& PROP_INTERACTIONHANDLER();
+ static const OUString& PROP_JUMPMARK();
+ static const OUString& PROP_MACROEXECUTIONMODE();
+ static const OUString& PROP_MEDIATYPE();
+ static const OUString& PROP_MINIMIZED();
+ static const OUString& PROP_NOAUTOSAVE();
+ static const OUString& PROP_OPENNEWVIEW();
+ static const OUString& PROP_OUTPUTSTREAM();
+ static const OUString& PROP_PASSWORD();
+ static const OUString& PROP_POSTDATA();
+ static const OUString& PROP_PREVIEW();
+ static const OUString& PROP_READONLY();
+ static const OUString& PROP_REFERRER();
+ static const OUString& PROP_SALVAGEDFILE();
+ static const OUString& PROP_STATUSINDICATOR();
+ static const OUString& PROP_STREAM();
+ static const OUString& PROP_STREAMFOROUTPUT();
+ static const OUString& PROP_TEMPLATENAME();
+ static const OUString& PROP_TITLE();
+ static const OUString& PROP_TYPENAME();
+ static const OUString& PROP_UCBCONTENT();
+ static const OUString& PROP_UPDATEDOCMODE();
+ static const OUString& PROP_URL();
+ static const OUString& PROP_VERSION();
+ static const OUString& PROP_DOCUMENTTITLE();
+ static const OUString& PROP_MODEL();
+ static const OUString& PROP_VIEWONLY();
+ static const OUString& PROP_DOCUMENTBASEURL();
+
+ static const OUString& PROP_DEEPDETECTION();
+
+ //-------------------------------------------
+ // interface
+ public:
+ //---------------------------------------
+ /** @short these ctors do nothing - excepting that they forward
+ the given parameters to the base class ctors.
+
+ @descr The ctros must be overwritten to resolve conflicts with
+ the default ctors of the compiler :-(.
+ */
+ MediaDescriptor();
+ MediaDescriptor(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lSource);
+
+ //---------------------------------------
+ /** @short it checks if the descriptor already has a valid
+ InputStream item and creates a new one, if not.
+
+ @descr This method uses the current items of this MediaDescriptor,
+ to open the stream (as e.g. URL, ReadOnly, PostData etcpp.).
+ It creates a seekable stream and put it into the descriptor.
+
+ A might existing InteractionHandler will be used automaticly,
+ to solve problems!
+
+ In case of local file the system file locking is used.
+
+ @return TRUE, if the stream was already part of the descriptor or could
+ be created as new item. FALSE otherwise.
+ */
+ sal_Bool addInputStream();
+
+ //---------------------------------------
+ /** @short it checks if the descriptor already has a valid
+ InputStream item and creates a new one, if not.
+
+ @descr This method uses the current items of this MediaDescriptor,
+ to open the stream (as e.g. URL, ReadOnly, PostData etcpp.).
+ It creates a seekable stream and put it into the descriptor.
+
+ A might existing InteractionHandler will be used automaticly,
+ to solve problems!
+
+ In case of local file the system file locking is used based on
+ configuration settings.
+
+ @return TRUE, if the stream was already part of the descriptor or could
+ be created as new item. FALSE otherwise.
+ */
+ sal_Bool addInputStreamOwnLock();
+
+ //---------------------------------------
+ /** @short it checks if the descriptor describes a readonly stream.
+
+ @descr The descriptor itself isnt changed doing so.
+ It's only checked if the stream seems to be based
+ of a real readonly file.
+
+ @Attention
+ We dont check the property "ReadOnly" here. Because
+ this property can be set from outside and overwrites
+ the readonly state of the stream.
+ If e.g. the stream could be opened read/write ...
+ but "ReadOnly" property is set to TRUE, this means:
+ show a readonly UI on top of this read/write stream.
+
+ @return TRUE, if the stream must be interpreted as readonly ...
+ FALSE otherwise.
+ */
+ sal_Bool isStreamReadOnly() const;
+
+ //---------------------------------------
+ /** Returns a value from the sequence contained in the property
+ 'ComponentData' of this media descriptor.
+
+ @descr The property 'ComponentData' should be empty, or should
+ contain a value of type sequence<com.sun.star.beans.NamedValue>
+ or sequence<com.sun.star.beans.PropertyValue>.
+
+ @return The value with the specified name, if existing in the
+ sequence of the 'ComponentData' property, otherwise an empty
+ Any.
+ */
+ ::com::sun::star::uno::Any getComponentDataEntry(
+ const OUString& rName ) const;
+
+ //---------------------------------------
+ /** Inserts a value into the sequence contained in the property
+ 'ComponentData' of the media descriptor.
+
+ @descr The property 'ComponentData' should be empty, or should
+ contain a value of type sequence<com.sun.star.beans.NamedValue>
+ or sequence<com.sun.star.beans.PropertyValue>. The passed value
+ will be inserted into the sequence, or, if already existing,
+ will be overwritten.
+
+ @param rName The name of the value to be inserted into the
+ sequence of the 'ComponentData' property.
+
+ @param rValue The value to be inserted into the sequence of the
+ 'ComponentData' property.
+ */
+ void setComponentDataEntry(
+ const OUString& rName,
+ const ::com::sun::star::uno::Any& rValue );
+
+ //---------------------------------------
+ /** Removes a value from the sequence contained in the property
+ 'ComponentData' of the media descriptor.
+
+ @descr The property 'ComponentData' should be empty, or should
+ contain a value of type sequence<com.sun.star.beans.NamedValue>
+ or sequence<com.sun.star.beans.PropertyValue>. The value with
+ the passed name will be removed from the sequence, if existing.
+
+ @param rName The name of the value to be removed from the sequence
+ of the 'ComponentData' property.
+ */
+ void clearComponentDataEntry(
+ const OUString& rName );
+
+ //-------------------------------------------
+ // helper
+ private:
+
+ //---------------------------------------
+ /** @short tries to open a stream by using the given PostData stream.
+
+ @descr The stream is used directly ...
+
+ The MediaDescriptor itself is changed inside this method.
+ Means: the stream is added internal and not returned by a value.
+
+ @param _rxPostData
+ the PostData stream.
+
+ @return TRUE if the stream could be added successfully.
+ Note: If FALSE is returned, the error was already handled inside!
+
+ @throw [css::uno::RuntimeException]
+ if the MediaDescriptor seems to be invalid!
+
+ @throw [css::lang::IllegalArgumentException]
+ if the given PostData stream is <NULL/>.
+ */
+ COMPHELPER_DLLPRIVATE sal_Bool impl_openStreamWithPostData(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& _rxPostData
+ ) throw(::com::sun::star::uno::RuntimeException);
+
+ //---------------------------------------
+ /** @short tries to open a stream by using the given URL.
+
+ @descr First it tries to open the content in r/w mode (if its
+ allowed to do so). Only in case its not allowed or it failed
+ the stream will be tried to open in readonly mode.
+
+ The MediaDescriptor itself is changed inside this method.
+ Means: the stream is added internal and not returned by a value.
+
+ @param sURL
+ the URL for open.
+
+ @param bLockFile
+ specifies whether the file should be locked
+
+ @return TRUE if the stream could be added successfully.
+ Note: If FALSE is returned, the error was already handled inside!
+
+ @throw [css::uno::RuntimeException]
+ if the MediaDescriptor seems to be invalid!
+ */
+ COMPHELPER_DLLPRIVATE sal_Bool impl_openStreamWithURL(
+ const OUString& sURL,
+ sal_Bool bLockFile
+ ) throw(::com::sun::star::uno::RuntimeException);
+
+ //---------------------------------------
+ /** @short some URL parts can make trouble for opening streams (e.g. jumpmarks.)
+ An URL should be "normalized" before its used.
+
+ @param sURL
+ the original URL (e.g. including a jumpmark)
+
+ @return [string]
+ the "normalized" URL (e.g. without jumpmark)
+ */
+ COMPHELPER_DLLPRIVATE OUString impl_normalizeURL(const OUString& sURL);
+
+ //---------------------------------------
+ /** @short it checks if the descriptor already has a valid
+ InputStream item and creates a new one, if not.
+
+ @descr This method uses the current items of this MediaDescriptor,
+ to open the stream (as e.g. URL, ReadOnly, PostData etcpp.).
+ It creates a seekable stream and put it into the descriptor.
+
+ A might existing InteractionHandler will be used automaticly,
+ to solve problems!
+
+ @param bLockFile
+ specifies whether the file should be locked
+
+ @return TRUE, if the stream was already part of the descriptor or could
+ be created as new item. FALSE otherwise.
+ */
+ COMPHELPER_DLLPRIVATE sal_Bool impl_addInputStream( sal_Bool bLockFile );
+};
+
+} // namespace comphelper
+
+#endif // _COMPHELPER_MEDIADESCRIPTOR_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/mimeconfighelper.hxx b/include/comphelper/mimeconfighelper.hxx
new file mode 100644
index 000000000000..6e2b128d5a23
--- /dev/null
+++ b/include/comphelper/mimeconfighelper.hxx
@@ -0,0 +1,141 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_MIMECONFIGHELPER_HXX_
+#define _COMPHELPER_MIMECONFIGHELPER_HXX_
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XContainerQuery.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/embed/VerbDescriptor.hpp>
+#include "comphelper/comphelperdllapi.h"
+
+
+namespace comphelper {
+
+class COMPHELPER_DLLPUBLIC MimeConfigurationHelper
+{
+ ::osl::Mutex m_aMutex;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xConfigProvider;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xObjectConfig;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xVerbsConfig;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xMediaTypeConfig;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xFilterFactory;
+
+public:
+
+ MimeConfigurationHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
+
+
+ static OUString GetStringClassIDRepresentation( const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID );
+
+ static ::com::sun::star::uno::Sequence< sal_Int8 > GetSequenceClassIDRepresentation( const OUString& aClassID );
+
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
+ GetConfigurationByPath( const OUString& aPath );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > GetObjConfiguration();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > GetVerbsConfiguration();
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > GetMediaTypeConfiguration();
+
+
+ OUString GetDocServiceNameFromFilter( const OUString& aFilterName );
+
+ OUString GetDocServiceNameFromMediaType( const OUString& aMediaType );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetObjPropsFromConfigEntry(
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& xObjectProps );
+
+ sal_Bool GetVerbByShortcut( const OUString& aVerbShortcut,
+ ::com::sun::star::embed::VerbDescriptor& aDescriptor );
+
+ OUString GetExplicitlyRegisteredObjClassID( const OUString& aMediaType );
+
+
+ // retrieving object description from configuration
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetObjectPropsByStringClassID(
+ const OUString& aStringClassID );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetObjectPropsByClassID(
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetObjectPropsByMediaType(
+ const OUString& aMediaType );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetObjectPropsByFilter(
+ const OUString& aFilterName );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetObjectPropsByDocumentName(
+ const OUString& aDocumentName );
+
+ // retrieving object factory from configuration
+ OUString GetFactoryNameByStringClassID( const OUString& aStringClassID );
+ OUString GetFactoryNameByClassID( const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID );
+ OUString GetFactoryNameByDocumentName( const OUString& aDocName );
+ OUString GetFactoryNameByMediaType( const OUString& aMediaType );
+
+ // typedetection related
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > GetFilterFactory();
+
+ OUString UpdateMediaDescriptorWithFilterName(
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescr,
+ sal_Bool bIgnoreType );
+ OUString UpdateMediaDescriptorWithFilterName(
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescr,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aObject );
+#ifdef WNT
+ sal_Int32 GetFilterFlags( const OUString& aFilterName );
+
+ sal_Bool AddFilterNameCheckOwnFile(
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescr );
+#endif
+
+ OUString GetDefaultFilterFromServiceName( const OUString& aServName, sal_Int32 nVersion );
+
+ OUString GetExportFilterFromImportFilter( const OUString& aImportFilterName );
+
+ static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SearchForFilter(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerQuery >& xFilterQuery,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aSearchRequest,
+ sal_Int32 nMustFlags,
+ sal_Int32 nDontFlags );
+
+ static sal_Bool ClassIDsEqual( const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID1,
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID2 );
+ static ::com::sun::star::uno::Sequence< sal_Int8 > GetSequenceClassID( sal_uInt32 n1, sal_uInt16 n2, sal_uInt16 n3,
+ sal_uInt8 b8, sal_uInt8 b9, sal_uInt8 b10, sal_uInt8 b11,
+ sal_uInt8 b12, sal_uInt8 b13, sal_uInt8 b14, sal_uInt8 b15 );
+};
+
+}
+
+#endif // _COMPHELPER_MIMECONFIGHELPER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/namecontainer.hxx b/include/comphelper/namecontainer.hxx
new file mode 100644
index 000000000000..6ac5aff190fb
--- /dev/null
+++ b/include/comphelper/namecontainer.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_NAMECONTAINER_HXX_
+#define _COMPHELPER_NAMECONTAINER_HXX_
+
+#include <com/sun/star/uno/Type.hxx>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include "comphelper/comphelperdllapi.h"
+
+namespace comphelper
+{
+ COMPHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
+ NameContainer_createInstance( ::com::sun::star::uno::Type aType );
+}
+
+#endif // _COMPHELPER_NAMECONTAINER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/namedvaluecollection.hxx b/include/comphelper/namedvaluecollection.hxx
new file mode 100644
index 000000000000..93b53dd14c6c
--- /dev/null
+++ b/include/comphelper/namedvaluecollection.hxx
@@ -0,0 +1,376 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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_NAMEDVALUECOLLECTION_HXX
+#define COMPHELPER_NAMEDVALUECOLLECTION_HXX
+
+#include <comphelper/comphelperdllapi.h>
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+
+#include <memory>
+#include <algorithm>
+#include <vector>
+
+//........................................................................
+namespace comphelper
+{
+//........................................................................
+
+ // ====================================================================
+ // = NamedValueCollection
+ // ====================================================================
+ struct NamedValueCollection_Impl;
+ /** a collection of named values, packed in various formats.
+ */
+ class COMPHELPER_DLLPUBLIC NamedValueCollection
+ {
+ private:
+ ::std::auto_ptr< NamedValueCollection_Impl > m_pImpl;
+
+ public:
+ NamedValueCollection();
+
+ NamedValueCollection( const NamedValueCollection& _rCopySource );
+
+ NamedValueCollection& operator=( const NamedValueCollection& i_rCopySource );
+
+ /** constructs a collection
+ @param _rElements
+ the wrapped elements of the collection. The <code>Any</code> might contain a sequence of
+ property values, a sequence of named values, or directly a property value or named value.
+ All other cases are worth an assertion in non-product builds.
+ */
+ NamedValueCollection( const ::com::sun::star::uno::Any& _rElements );
+
+ /** constructs a collection
+ @param _rArguments
+ a sequence of Any's containing either PropertyValue's or NamedValue's.
+ */
+ NamedValueCollection( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& _rArguments );
+
+ /** constructs a collection
+ @param _rArguments
+ a sequence of PropertyValues's
+ */
+ NamedValueCollection( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rArguments );
+
+ /** constructs a collection
+ @param _rArguments
+ a sequence of NamedValue's
+ */
+ NamedValueCollection( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _rArguments );
+
+ ~NamedValueCollection();
+
+ inline void assign( const ::com::sun::star::uno::Any& i_rWrappedElements )
+ {
+ impl_assign( i_rWrappedElements );
+ }
+
+ inline void assign( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& _rArguments )
+ {
+ impl_assign( _rArguments );
+ }
+
+ inline void assign( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rArguments )
+ {
+ impl_assign( _rArguments );
+ }
+
+ inline void assign( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _rArguments )
+ {
+ impl_assign( _rArguments );
+ }
+
+ inline void clear()
+ {
+ impl_assign( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >() );
+ }
+
+ /** determines whether or not named values can be extracted from the given value
+
+ @return
+ <TRUE/> if and only if the given <code>Any</code> contains a <code>NamedValue</code>, a
+ <code>PropertyValue</code>, or a sequence thereof.
+ */
+ static bool canExtractFrom( ::com::sun::star::uno::Any const & i_value );
+
+ /// returns the number of elements in the collection
+ size_t size() const;
+
+ /// determines whether the collection is empty
+ bool empty() const;
+
+ /** returns the names of all elements in the collection
+ */
+ ::std::vector< OUString >
+ getNames() const;
+
+ /** merges the content of another collection into |this|
+ @param _rAdditionalValues
+ the collection whose values are to be merged
+ @param _bOverwriteExisting
+ defines whether or not elements which are already present in |this|
+ should be overwritten (<TRUE/>) or preserved (<FALSE/>).
+ @return |*this|
+ */
+ NamedValueCollection&
+ merge(
+ const NamedValueCollection& _rAdditionalValues,
+ bool _bOverwriteExisting
+ );
+
+ /** retrieves a value with a given name from the collection, if it is present
+
+ @param _pAsciiValueName
+ the ASCII name of the value to retrieve
+
+ @param _out_rValue
+ is the output parameter taking the desired value upon successful return. If
+ a value with the given name is not present in the collection, or if a wrong-typed
+ value is present, then this parameter will not be touched.
+
+ @return
+ <TRUE/> if there is a value with the given name, which could successfully
+ be extraced. In this case, <arg>_out_rValue</arg> will contain the requested
+ value.<br/>
+ <FALSE/>, if there is no value with the given name.
+ @throws IllegalArgumentException
+ in case there is a value with the given name, but it cannot legally assigned to
+ _out_rValue.
+ */
+ template < typename VALUE_TYPE >
+ bool get_ensureType( const sal_Char* _pAsciiValueName, VALUE_TYPE& _out_rValue ) const
+ {
+ return get_ensureType( OUString::createFromAscii( _pAsciiValueName ), &_out_rValue, ::cppu::UnoType< VALUE_TYPE >::get() );
+ }
+
+ template < typename VALUE_TYPE >
+ bool get_ensureType( const OUString& _rValueName, VALUE_TYPE& _out_rValue ) const
+ {
+ return get_ensureType( _rValueName, &_out_rValue, ::cppu::UnoType< VALUE_TYPE >::get() );
+ }
+
+ /** retrieves a value with a given name, or defaults it to a given value, if its not present
+ in the colllection
+ */
+ template < typename VALUE_TYPE >
+ VALUE_TYPE getOrDefault( const sal_Char* _pAsciiValueName, const VALUE_TYPE& _rDefault ) const
+ {
+ return getOrDefault( OUString::createFromAscii( _pAsciiValueName ), _rDefault );
+ }
+
+ template < typename VALUE_TYPE >
+ VALUE_TYPE getOrDefault( const OUString& _rValueName, const VALUE_TYPE& _rDefault ) const
+ {
+ VALUE_TYPE retVal( _rDefault );
+ get_ensureType( _rValueName, retVal );
+ return retVal;
+ }
+
+ /** retrieves a (untyped) value with a given name
+
+ If the collection does not contain a value with the given name, an empty
+ Any is returned.
+ */
+ const ::com::sun::star::uno::Any& get( const sal_Char* _pAsciiValueName ) const
+ {
+ return get( OUString::createFromAscii( _pAsciiValueName ) );
+ }
+
+ /** retrieves a (untyped) value with a given name
+
+ If the collection does not contain a value with the given name, an empty
+ Any is returned.
+ */
+ const ::com::sun::star::uno::Any& get( const OUString& _rValueName ) const
+ {
+ return impl_get( _rValueName );
+ }
+
+ /// determines whether a value with a given name is present in the collection
+ inline bool has( const sal_Char* _pAsciiValueName ) const
+ {
+ return impl_has( OUString::createFromAscii( _pAsciiValueName ) );
+ }
+
+ /// determines whether a value with a given name is present in the collection
+ inline bool has( const OUString& _rValueName ) const
+ {
+ return impl_has( _rValueName );
+ }
+
+ /** puts a value into the collection
+
+ @return <TRUE/> if and only if a value was already present previously, in
+ which case it has been overwritten.
+ */
+ template < typename VALUE_TYPE >
+ inline bool put( const sal_Char* _pAsciiValueName, const VALUE_TYPE& _rValue )
+ {
+ return impl_put( OUString::createFromAscii( _pAsciiValueName ), ::com::sun::star::uno::makeAny( _rValue ) );
+ }
+
+ /** puts a value into the collection
+
+ @return <TRUE/> if and only if a value was already present previously, in
+ which case it has been overwritten.
+ */
+ template < typename VALUE_TYPE >
+ inline bool put( const OUString& _rValueName, const VALUE_TYPE& _rValue )
+ {
+ return impl_put( _rValueName, ::com::sun::star::uno::makeAny( _rValue ) );
+ }
+
+ inline bool put( const sal_Char* _pAsciiValueName, const ::com::sun::star::uno::Any& _rValue )
+ {
+ return impl_put( OUString::createFromAscii( _pAsciiValueName ), _rValue );
+ }
+
+ inline bool put( const OUString& _rValueName, const ::com::sun::star::uno::Any& _rValue )
+ {
+ return impl_put( _rValueName, _rValue );
+ }
+
+ /** removes the value with the given name from the collection
+
+ @return <TRUE/> if and only if a value with the given name existed in the collection.
+ */
+ inline bool remove( const sal_Char* _pAsciiValueName )
+ {
+ return impl_remove( OUString::createFromAscii( _pAsciiValueName ) );
+ }
+
+ /** removes the value with the given name from the collection
+
+ @return <TRUE/> if and only if a value with the given name existed in the collection.
+ */
+ inline bool remove( const OUString& _rValueName )
+ {
+ return impl_remove( _rValueName );
+ }
+
+ /** transforms the collection to a sequence of PropertyValues
+
+ @return
+ the number of elements in the sequence
+ */
+ sal_Int32 operator >>= ( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _out_rValues ) const;
+
+ /** transforms the collection to a sequence of NamedValues
+
+ @return
+ the number of elements in the sequence
+ */
+ sal_Int32 operator >>= ( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _out_rValues ) const;
+
+ /** transforms the collection into a sequence of PropertyValues
+ */
+ inline ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
+ getPropertyValues() const
+ {
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aValues;
+ *this >>= aValues;
+ return aValues;
+ }
+
+ /** returns a Sequence< Any >, containing PropertyValues
+ */
+ inline ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
+ getWrappedPropertyValues() const
+ {
+ return impl_wrap< ::com::sun::star::beans::PropertyValue >();
+ }
+
+ /** returns a Sequence< Any >, containing NamedValues
+ */
+ inline ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
+ getWrappedNamedValues() const
+ {
+ return impl_wrap< ::com::sun::star::beans::NamedValue >();
+ }
+
+ /** transforms the collection into a sequence of NamedValues
+ */
+ inline ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >
+ getNamedValues() const
+ {
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > aValues;
+ *this >>= aValues;
+ return aValues;
+ }
+
+ private:
+ void impl_assign( const ::com::sun::star::uno::Any& i_rWrappedElements );
+ void impl_assign( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& _rArguments );
+ void impl_assign( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rArguments );
+ void impl_assign( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _rArguments );
+
+ bool get_ensureType(
+ const OUString& _rValueName,
+ void* _pValueLocation,
+ const ::com::sun::star::uno::Type& _rExpectedValueType
+ ) const;
+
+ const ::com::sun::star::uno::Any&
+ impl_get( const OUString& _rValueName ) const;
+
+ bool impl_has( const OUString& _rValueName ) const;
+
+ bool impl_put( const OUString& _rValueName, const ::com::sun::star::uno::Any& _rValue );
+
+ bool impl_remove( const OUString& _rValueName );
+
+ template< class VALUE_TYPE >
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > impl_wrap() const
+ {
+ ::com::sun::star::uno::Sequence< VALUE_TYPE > aValues;
+ *this >>= aValues;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aWrappedValues( aValues.getLength() );
+ ::com::sun::star::uno::Any (* const makeAny)(const VALUE_TYPE&) = ::com::sun::star::uno::makeAny< VALUE_TYPE >;
+ ::std::transform(
+ aValues.getConstArray(),
+ aValues.getConstArray() + aValues.getLength(),
+ aWrappedValues.getArray(),
+ makeAny
+ );
+ return aWrappedValues;
+ }
+ };
+
+//........................................................................
+} // namespace comphelper
+//........................................................................
+
+#endif // COMPHELPER_NAMEDVALUECOLLECTION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/newarray.hxx b/include/comphelper/newarray.hxx
new file mode 100644
index 000000000000..b64095ae8ff4
--- /dev/null
+++ b/include/comphelper/newarray.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_NEW_ARRAY_HXX
+#define COMPHELPER_NEW_ARRAY_HXX
+
+#include <limits>
+#include <new>
+#include <stddef.h>
+
+namespace comphelper {
+
+template<typename T> T *
+newArray_null(size_t const n) throw()
+{
+ if (((::std::numeric_limits<size_t>::max)() / sizeof(T)) <= n) {
+ return 0;
+ }
+ return new (::std::nothrow) T[n];
+}
+
+template<typename T> T *
+newArray_ex(size_t const n)
+{
+ if (((::std::numeric_limits<size_t>::max)() / sizeof(T)) <= n) {
+ throw ::std::bad_alloc();
+ }
+ return new T[n];
+}
+
+} // namespace comphelper
+
+#endif // COMPHELPER_NEW_ARRAY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/numberedcollection.hxx b/include/comphelper/numberedcollection.hxx
new file mode 100644
index 000000000000..6a311767658d
--- /dev/null
+++ b/include/comphelper/numberedcollection.hxx
@@ -0,0 +1,176 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_NUMBEREDCOLLECTION_HXX_
+#define _COMPHELPER_NUMBEREDCOLLECTION_HXX_
+
+#include "comphelper/comphelperdllapi.h"
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/frame/XUntitledNumbers.hpp>
+
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+#include <vector>
+#include <boost/unordered_map.hpp>
+
+
+namespace comphelper{
+
+/** @short defines a collection of UNO components, where every component will get it's own unique number.
+
+ @descr Such number will be unique at runtime only ... but it supports fragmentation.
+ Note: This collection uses weak refrences only to know her components.
+ So lifetime of thise components must be controlled outside.
+
+ @threadsafe
+ */
+class COMPHELPER_DLLPUBLIC NumberedCollection : private ::cppu::BaseMutex
+ , public ::cppu::WeakImplHelper1< css::frame::XUntitledNumbers >
+{
+ //-------------------------------------------
+ // types, const
+ private:
+
+ struct TNumberedItem
+ {
+ css::uno::WeakReference< css::uno::XInterface > xItem;
+ ::sal_Int32 nNumber;
+ };
+
+ typedef ::boost::unordered_map<
+ long ,
+ TNumberedItem ,
+ ::boost::hash< long > ,
+ ::std::equal_to< long > > TNumberedItemHash;
+
+ typedef ::std::vector< long > TDeadItemList;
+
+ //-------------------------------------------
+ // interface
+ public:
+
+ //---------------------------------------
+ /** @short lightweight constructor.
+ */
+ NumberedCollection();
+
+ //---------------------------------------
+ /** @short free all internaly used resources.
+ */
+ virtual ~NumberedCollection();
+
+ //---------------------------------------
+ /** set an outside component which uses this container and must be set
+ as source of all broadcasted messages, exceptions.
+
+ It's holded weak only so we do not need any complex dispose sessions.
+
+ Note: Passing NULL as parameter will be allowed. It will reset the internal
+ member reference only.
+
+ @param xOwner
+ the new owner of this collection.
+ */
+ void setOwner (const css::uno::Reference< css::uno::XInterface >& xOwner);
+
+ //---------------------------------------
+ /** set the localized prefix to be used for untitled components.
+
+ Localization has to be done outside. This container will return
+ those value then. There are no further checks. Its up to you to define
+ a suitable string here :-)
+
+ @param sPrefix
+ the new prefix for untitled components.
+ */
+ void setUntitledPrefix(const OUString& sPrefix);
+
+ //---------------------------------------
+ /** @see css.frame.XUntitledNumbers */
+ virtual ::sal_Int32 SAL_CALL leaseNumber(const css::uno::Reference< css::uno::XInterface >& xComponent)
+ throw (css::lang::IllegalArgumentException,
+ css::uno::RuntimeException );
+
+ //---------------------------------------
+ /** @see css.frame.XUntitledNumbers */
+ virtual void SAL_CALL releaseNumber(::sal_Int32 nNumber)
+ throw (css::lang::IllegalArgumentException,
+ css::uno::RuntimeException );
+
+ //---------------------------------------
+ /** @see css.frame.XUntitledNumbers */
+ virtual void SAL_CALL releaseNumberForComponent(const css::uno::Reference< css::uno::XInterface >& xComponent)
+ throw (css::lang::IllegalArgumentException,
+ css::uno::RuntimeException );
+
+ //---------------------------------------
+ /** @see css.frame.XUntitledNumbers */
+ virtual OUString SAL_CALL getUntitledPrefix()
+ throw (css::uno::RuntimeException);
+
+ //-------------------------------------------
+ // internal
+ private:
+
+ //---------------------------------------
+ /** @short trys to find an unique number not already used within this collection.
+
+ @descr It reuses the smalles number which isnt used by any component
+ of this collection. (fragmentation!) If collection is full (means there
+ is no free number) the special value INVALID_NUMBER will be returned.
+
+ @note Those method cant be called within a multithreaded environment ..
+ Because such number wont be "reserved" for the calli of these method
+ it can happen that two calls returns the same number (reasoned by the fact that first calli
+ doesnt used the returned number already.
+
+ So the outside code has to make sure that retrieving and using of those number
+ will be an atomic operation.
+
+ @return an unique number or special value INVALID_NUMBER if collection is full.
+ */
+ ::sal_Int32 impl_searchFreeNumber ();
+
+ void impl_cleanUpDeadItems ( TNumberedItemHash& lItems ,
+ const TDeadItemList& lDeadItems);
+
+ //-------------------------------------------
+ // member
+ private:
+
+ /// localized string to be used for untitled components
+ OUString m_sUntitledPrefix;
+
+ /// cache of all "leased numbers" and its bound components
+ TNumberedItemHash m_lComponents;
+
+ /// used as source of broadcasted messages or exceptions (can be null !)
+ css::uno::WeakReference< css::uno::XInterface > m_xOwner;
+};
+
+} // namespace comphelper
+
+#endif // _COMPHELPER_NUMBEREDCOLLECTION_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/numbers.hxx b/include/comphelper/numbers.hxx
new file mode 100644
index 000000000000..b64fe341da4f
--- /dev/null
+++ b/include/comphelper/numbers.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_NUMBERS_HXX_
+#define _COMPHELPER_NUMBERS_HXX_
+
+#include <com/sun/star/util/XNumberFormats.hpp>
+#include <com/sun/star/util/XNumberFormatter.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+#include "comphelper/comphelperdllapi.h"
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+ namespace staruno = ::com::sun::star::uno;
+ namespace starlang = ::com::sun::star::lang;
+ namespace starutil = ::com::sun::star::util;
+
+ /// returns the ::com::sun::star::util::NumberFormat of the given key under the given formats
+ COMPHELPER_DLLPUBLIC sal_Int16 getNumberFormatType(const staruno::Reference<starutil::XNumberFormats>& xFormats, sal_Int32 nKey);
+
+ /// returns the ::com::sun::star::util::NumberFormat of the given key under the given formatter
+ COMPHELPER_DLLPUBLIC sal_Int16 getNumberFormatType(const staruno::Reference<starutil::XNumberFormatter>& xFormatter, sal_Int32 nKey);
+
+ /// returns the decimals of the given numeric number formatunder the given formats
+ COMPHELPER_DLLPUBLIC staruno::Any getNumberFormatDecimals(const staruno::Reference<starutil::XNumberFormats>& xFormats, sal_Int32 nKey);
+
+ /** returns the standard format for the given type and the given _rLocale
+ */
+ sal_Int32 getStandardFormat(
+ const staruno::Reference<starutil::XNumberFormatter>& xFormatter,
+ sal_Int16 nType,
+ const starlang::Locale& _rLocale);
+
+ /** retrieves a the value of a given property for a given format key, relating to a given formatter
+ */
+ COMPHELPER_DLLPUBLIC ::com::sun::star::uno::Any getNumberFormatProperty(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxFormatter,
+ sal_Int32 _nKey,
+ const OUString& _rPropertyName
+ );
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // _COMPHELPER_NUMBERS_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/officeresourcebundle.hxx b/include/comphelper/officeresourcebundle.hxx
new file mode 100644
index 000000000000..5e6d9e1bccc5
--- /dev/null
+++ b/include/comphelper/officeresourcebundle.hxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_OFFICE_RESOURCE_BUNDLE_HXX
+#define COMPHELPER_OFFICE_RESOURCE_BUNDLE_HXX
+
+#include <comphelper/comphelperdllapi.h>
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <rtl/ustring.hxx>
+
+#include <memory>
+
+//........................................................................
+namespace comphelper
+{
+//........................................................................
+
+ //====================================================================
+ //= OfficeResourceBundle
+ //====================================================================
+ class ResourceBundle_Impl;
+ /** wraps the <type scope="com::sun::star::resource">OfficeResourceAccess</type> service
+ */
+ class COMPHELPER_DLLPUBLIC OfficeResourceBundle
+ {
+ private:
+ ::std::auto_ptr< ResourceBundle_Impl > m_pImpl;
+
+ public:
+ /** constructs a resource bundle with the resource bundle given as 8-bit ASCII name
+
+ This is a convenience constructor only, it does nothing different than the constructor
+ taking an unicode string.
+
+ @param _context
+ the component context to operate in
+ @param _bundleBaseName
+ the base name of the resource file which should be accessed (*without* the SUPD!)
+ @raises ::com::sun::star::lang::NullPointerException
+ if the given component context is <NULL/>
+ */
+ OfficeResourceBundle(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _context,
+ const sal_Char* _bundleBaseAsciiName
+ );
+
+ /** destroys the instance
+ */
+ ~OfficeResourceBundle();
+
+ /** loads the string with the given resource id from the resource bundle
+ @param _resourceId
+ the id of the string to load
+ @return
+ the requested resource string. If no string with the given id exists in the resource bundle,
+ an empty string is returned. In a non-product version, an OSL_ENSURE will notify you of this
+ then.
+ */
+ OUString loadString( sal_Int32 _resourceId ) const;
+
+ /** determines whether the resource bundle has a string with the given id
+ @param _resourceId
+ the id of the string whose existence is to be checked
+ @return
+ <TRUE/> if and only if a string with the given ID exists in the resource
+ bundle.
+ */
+ bool hasString( sal_Int32 _resourceId ) const;
+ };
+
+//........................................................................
+} // namespace comphelper
+//........................................................................
+
+#endif // COMPHELPER_OFFICE_RESOURCE_BUNDLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/ofopxmlhelper.hxx b/include/comphelper/ofopxmlhelper.hxx
new file mode 100644
index 000000000000..e054d0dbc909
--- /dev/null
+++ b/include/comphelper/ofopxmlhelper.hxx
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_OFOPXMLHELPER_HXX
+#define _COMPHELPER_OFOPXMLHELPER_HXX
+
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/beans/StringPair.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/comphelperdllapi.h>
+
+
+namespace comphelper
+{
+
+// this helper class is designed to allow to parse ContentType- and Relationship-related information from OfficeOpenXML format
+class COMPHELPER_DLLPUBLIC OFOPXMLHelper : public cppu::WeakImplHelper1 < com::sun::star::xml::sax::XDocumentHandler >
+{
+ sal_uInt16 m_nFormat; // which format to parse
+
+ // Relations info related strings
+ OUString m_aRelListElement;
+ OUString m_aRelElement;
+ OUString m_aIDAttr;
+ OUString m_aTypeAttr;
+ OUString m_aTargetModeAttr;
+ OUString m_aTargetAttr;
+
+ // ContentType related strings
+ OUString m_aTypesElement;
+ OUString m_aDefaultElement;
+ OUString m_aOverrideElement;
+ OUString m_aExtensionAttr;
+ OUString m_aPartNameAttr;
+ OUString m_aContentTypeAttr;
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > > m_aResultSeq;
+ ::com::sun::star::uno::Sequence< OUString > m_aElementsSeq; // stack of elements being parsed
+
+ OFOPXMLHelper( sal_uInt16 nFormat ); // must not be created directly
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > > GetParsingResult();
+
+ static COMPHELPER_DLLPRIVATE ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > > SAL_CALL ReadSequence_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream, const OUString& aStringID, sal_uInt16 nFormat, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext )
+ throw( ::com::sun::star::uno::Exception );
+
+public:
+ ~OFOPXMLHelper();
+
+ // returns sequence of elements, where each element is described by sequence of tags,
+ // where each tag is described by StringPair ( First - name, Second - value )
+ // the first tag of each element sequence must be "Id"
+ static
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > >
+ SAL_CALL
+ ReadRelationsInfoSequence(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream,
+ const OUString aStreamName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext )
+ throw( ::com::sun::star::uno::Exception );
+
+ // returns sequence containing two entries of type sequence<StringPair>
+ // the first sequence describes "Default" elements, where each element is described
+ // by StringPair object ( First - Extension, Second - ContentType )
+ // the second sequence describes "Override" elements, where each element is described
+ // by StringPair object ( First - PartName, Second - ContentType )
+ static
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > >
+ SAL_CALL
+ ReadContentTypeSequence(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext )
+ throw( ::com::sun::star::uno::Exception );
+
+ // writes sequence of elements, where each element is described by sequence of tags,
+ // where each tag is described by StringPair ( First - name, Second - value )
+ // the first tag of each element sequence must be "Id"
+ static
+ void SAL_CALL WriteRelationsInfoSequence(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutStream,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > >& aSequence,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext )
+ throw( ::com::sun::star::uno::Exception );
+
+ // writes two entries of type sequence<StringPair>
+ // the first sequence describes "Default" elements, where each element is described
+ // by StringPair object ( First - Extension, Second - ContentType )
+ // the second sequence describes "Override" elements, where each element is described
+ // by StringPair object ( First - PartName, Second - ContentType )
+ static
+ void SAL_CALL WriteContentSequence(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutStream,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair >& aDefaultsSequence,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair >& aOverridesSequence,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext )
+ throw( ::com::sun::star::uno::Exception );
+
+ // XDocumentHandler
+ virtual void SAL_CALL startDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL startElement( const OUString& aName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endElement( const OUString& aName ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL characters( const OUString& aChars ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL ignorableWhitespace( const OUString& aWhitespaces ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL processingInstruction( const OUString& aTarget, const OUString& aData ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDocumentLocator( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >& xLocator ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+};
+
+} // namespace comphelper
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/optional.hxx b/include/comphelper/optional.hxx
new file mode 100644
index 000000000000..031a30328340
--- /dev/null
+++ b/include/comphelper/optional.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_COMPHELPER_OPTIONAL_HXX
+#define INCLUDED_COMPHELPER_OPTIONAL_HXX
+
+#include "com/sun/star/beans/Optional.hpp"
+#include "boost/optional.hpp"
+
+namespace comphelper {
+
+/// Object generators for boost::optional<T>, beans::Optional<T>:
+
+template <typename T>
+inline ::boost::optional<T> make_optional( T const& v )
+{
+ return ::boost::optional<T>(v);
+}
+
+template <typename T>
+inline ::boost::optional<T> make_optional(
+ ::com::sun::star::beans::Optional<T> const& o )
+{
+ if (o.IsPresent)
+ return ::boost::optional<T>(o.Value);
+ else
+ return ::boost::optional<T>();
+}
+
+template <typename T>
+inline ::com::sun::star::beans::Optional<T> makeOptional( T const& v )
+{
+// CPPU_IS_CPP_MAPPING_OF_NON_VOID_UNO_TYPE(T);
+ return ::com::sun::star::beans::Optional<T>(true, v);
+}
+
+template <typename T>
+inline ::com::sun::star::beans::Optional<T> makeOptional(
+ ::boost::optional<T> const& o )
+{
+// CPPU_IS_CPP_MAPPING_OF_NON_VOID_UNO_TYPE(T);
+ if (o)
+ return ::com::sun::star::beans::Optional<T>(true, *o);
+ else
+ return ::com::sun::star::beans::Optional<T>();
+}
+
+inline ::com::sun::star::beans::Optional<sal_Bool> makeOptional(
+ ::boost::optional<bool> const& o )
+{
+ if (o)
+ return ::com::sun::star::beans::Optional<sal_Bool>(true, *o);
+ else
+ return ::com::sun::star::beans::Optional<sal_Bool>();
+}
+
+inline ::com::sun::star::beans::Optional<sal_Bool> makeOptional( bool v )
+{
+ return ::com::sun::star::beans::Optional<sal_Bool>(true, v);
+}
+
+} // namespace comphelper
+
+#endif // ! defined(INCLUDED_COMPHELPER_OPTIONAL_HXX)
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/oslfile2streamwrap.hxx b/include/comphelper/oslfile2streamwrap.hxx
new file mode 100644
index 000000000000..f43297b28b43
--- /dev/null
+++ b/include/comphelper/oslfile2streamwrap.hxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * 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_STREAM_OSLFILEWRAPPER_HXX_
+#define _COMPHELPER_STREAM_OSLFILEWRAPPER_HXX_
+
+#include <osl/mutex.hxx>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <osl/file.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+namespace comphelper
+{
+ namespace stario = ::com::sun::star::io;
+ namespace staruno = ::com::sun::star::uno;
+
+//==================================================================
+// FmUnoIOStream,
+// Stream to read and write data, based on File
+//==================================================================
+class COMPHELPER_DLLPUBLIC OSLInputStreamWrapper : public ::cppu::WeakImplHelper1<stario::XInputStream>
+{
+ ::osl::Mutex m_aMutex;
+ ::osl::File* m_pFile;
+
+public:
+ OSLInputStreamWrapper(::osl::File& _rStream);
+ virtual ~OSLInputStreamWrapper();
+
+// stario::XInputStream
+ virtual sal_Int32 SAL_CALL readBytes(staruno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead) throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
+ virtual sal_Int32 SAL_CALL readSomeBytes(staruno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead) throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
+ virtual void SAL_CALL skipBytes(sal_Int32 nBytesToSkip) throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
+ virtual sal_Int32 SAL_CALL available() throw(stario::NotConnectedException, staruno::RuntimeException);
+ virtual void SAL_CALL closeInput() throw(stario::NotConnectedException, staruno::RuntimeException);
+};
+
+//==================================================================
+// FmUnoOutStream,
+// data sink for the files
+//==================================================================
+class OSLOutputStreamWrapper : public ::cppu::WeakImplHelper1<stario::XOutputStream>
+{
+public:
+ COMPHELPER_DLLPUBLIC OSLOutputStreamWrapper(::osl::File& _rFile);
+
+private:
+ virtual ~OSLOutputStreamWrapper();
+
+// stario::XOutputStream
+ virtual void SAL_CALL writeBytes(const staruno::Sequence< sal_Int8 >& aData) throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
+ virtual void SAL_CALL flush() throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
+ virtual void SAL_CALL closeOutput() throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
+
+ ::osl::File& rFile;
+};
+
+} // namespace comphelper
+
+
+#endif // _COMPHELPER_STREAM_OSLFILEWRAPPER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/processfactory.hxx b/include/comphelper/processfactory.hxx
new file mode 100644
index 000000000000..e6833fc49327
--- /dev/null
+++ b/include/comphelper/processfactory.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_PROCESSFACTORY_HXX_
+#define _COMPHELPER_PROCESSFACTORY_HXX_
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+namespace com { namespace sun { namespace star { namespace lang {
+ class XMultiServiceFactory;
+} } } }
+
+namespace comphelper
+{
+
+/**
+ * This function set the process service factory.
+ *
+ * @author Juergen Schmidt
+ */
+COMPHELPER_DLLPUBLIC void setProcessServiceFactory(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xSMgr);
+
+/**
+ * This function gets the process service factory.
+ *
+ * If no service factory is set the function throws a RuntimeException.
+ *
+ * @author Juergen Schmidt
+ */
+COMPHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getProcessServiceFactory();
+
+/** Obtains a component context from a service factory.
+
+ Throws a RuntimeException if no component context can be obtained.
+
+ @param factory may be null
+ @return may be null
+ */
+COMPHELPER_DLLPUBLIC
+com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+getComponentContext(
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
+ const & factory);
+
+/**
+ * This function gets the process service factory's default component context.
+ *
+ * Throws a RuntimeException if no component context can be obtained.
+ */
+COMPHELPER_DLLPUBLIC
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+getProcessComponentContext();
+
+}
+
+
+extern "C" {
+/// @internal ATTENTION returns ACQUIRED pointer! release it explicitly!
+COMPHELPER_DLLPUBLIC
+::com::sun::star::uno::XComponentContext *
+comphelper_getProcessComponentContext();
+} // extern "C"
+
+#endif // _COMPHELPER_PROCESSFACTORY_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/propagg.hxx b/include/comphelper/propagg.hxx
new file mode 100644
index 000000000000..3a6ca83e36c1
--- /dev/null
+++ b/include/comphelper/propagg.hxx
@@ -0,0 +1,325 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_PROPERTY_AGGREGATION_HXX_
+#define _COMPHELPER_PROPERTY_AGGREGATION_HXX_
+
+#include <com/sun/star/uno/XAggregation.hpp>
+#include <comphelper/propstate.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+#include <map>
+
+//=========================================================================
+//= property helper classes
+//=========================================================================
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+//==================================================================
+//= OPropertyAccessor
+//= internal helper class for OPropertyArrayAggregationHelper
+//==================================================================
+namespace internal
+{
+ struct OPropertyAccessor
+ {
+ sal_Int32 nOriginalHandle;
+ sal_Int32 nPos;
+ bool bAggregate;
+
+ OPropertyAccessor(sal_Int32 _nOriginalHandle, sal_Int32 _nPos, bool _bAggregate)
+ :nOriginalHandle(_nOriginalHandle) ,nPos(_nPos) ,bAggregate(_bAggregate) { }
+ OPropertyAccessor()
+ :nOriginalHandle(-1) ,nPos(-1) ,bAggregate(false) { }
+
+ bool operator==(const OPropertyAccessor& rOb) const { return nPos == rOb.nPos; }
+ bool operator <(const OPropertyAccessor& rOb) const { return nPos < rOb.nPos; }
+ };
+
+ typedef std::map< sal_Int32, OPropertyAccessor, ::std::less< sal_Int32 > > PropertyAccessorMap;
+ typedef PropertyAccessorMap::iterator PropertyAccessorMapIterator;
+ typedef PropertyAccessorMap::const_iterator ConstPropertyAccessorMapIterator;
+}
+
+//==================================================================
+/**
+ * used as callback for a OPropertyArrayAggregationHelper
+ */
+class IPropertyInfoService
+{
+public:
+ /** get the prefered handle for the given property
+ @param _rName the property name
+ @return the handle the property should be refered by, or -1 if there are no
+ preferences for the given property
+ */
+ virtual sal_Int32 getPreferedPropertyId(const OUString& _rName) = 0;
+
+protected:
+ ~IPropertyInfoService() {}
+};
+
+/**
+ * used for implementing an cppu::IPropertyArrayHelper for classes
+ * aggregating property sets
+ */
+
+#define DEFAULT_AGGREGATE_PROPERTY_ID 10000
+//------------------------------------------------------------------
+class COMPHELPER_DLLPUBLIC OPropertyArrayAggregationHelper: public ::cppu::IPropertyArrayHelper
+{
+ friend class OPropertySetAggregationHelper;
+protected:
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property> m_aProperties;
+ internal::PropertyAccessorMap m_aPropertyAccessors;
+
+public:
+ /** construct the object.
+ @param _rProperties the properties of the object doing the aggregation. These properties
+ are used without any checks, so the caller has to ensure that the names and
+ handles are valid.
+ @param _rAggProperties the properties of the aggregate, usually got via an call to getProperties on the
+ XPropertySetInfo of the aggregate.
+ The names of the properties are used without any checks, so the caller has to ensure
+ that there are no doubles.
+ The handles are stored for later quick access, but the outside-handles the
+ aggregate properties get depend from the following two parameters.
+ @param _pInfoService
+ If not NULL, the object pointed to is used to calc handles which should be used
+ for refering the aggregate's properties from outside.
+ If one of the properties returned from the info service conflict with other handles
+ alread present (e.g. through _rProperties), the property is handled as if -1 was returned.
+ If NULL (or, for a special property, a call to getPreferedPropertyId returns -1),
+ the aggregate property(ies) get a new handle which they can be refered by from outside.
+ @param _nFirstAggregateId
+ if the object is about to create new handles for the aggregate properties, it uses
+ id's ascending from this given id.
+ No checks are made if the handle range determined by _nFirstAggregateId conflicts with other
+ handles within _rProperties.
+ */
+ OPropertyArrayAggregationHelper(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property>& _rProperties,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property>& _rAggProperties,
+ IPropertyInfoService* _pInfoService = NULL,
+ sal_Int32 _nFirstAggregateId = DEFAULT_AGGREGATE_PROPERTY_ID);
+
+
+ /// inherited from IPropertyArrayHelper
+ virtual sal_Bool SAL_CALL fillPropertyMembersByHandle( OUString* _pPropName, sal_Int16* _pAttributes,
+ sal_Int32 _nHandle) ;
+
+ /// inherited from IPropertyArrayHelper
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property> SAL_CALL getProperties();
+ /// inherited from IPropertyArrayHelper
+ virtual ::com::sun::star::beans::Property SAL_CALL getPropertyByName(const OUString& _rPropertyName)
+ throw(::com::sun::star::beans::UnknownPropertyException);
+
+ /// inherited from IPropertyArrayHelper
+ virtual sal_Bool SAL_CALL hasPropertyByName(const OUString& _rPropertyName) ;
+ /// inherited from IPropertyArrayHelper
+ virtual sal_Int32 SAL_CALL getHandleByName(const OUString & _rPropertyName);
+ /// inherited from IPropertyArrayHelper
+ virtual sal_Int32 SAL_CALL fillHandles( /*out*/sal_Int32* _pHandles, const ::com::sun::star::uno::Sequence< OUString >& _rPropNames );
+
+ /** returns information about a property of the aggregate.
+ @param _pPropName points to a string to receive the property name. No name is returned if this is NULL.
+ @param _pOriginalHandle points to a sal_Int32 to receive the original property hande. No original handle is returned
+ if this is NULL.
+ @param _nHandle the handle of the property as got by, for instance, fillHandles
+
+ @return sal_True, if _nHandle marks an aggregate property, otherwise sal_False
+ */
+ virtual bool SAL_CALL fillAggregatePropertyInfoByHandle(OUString* _pPropName, sal_Int32* _pOriginalHandle,
+ sal_Int32 _nHandle) const;
+
+ /** returns information about a property given by handle
+ */
+ sal_Bool getPropertyByHandle( sal_Int32 _nHandle, ::com::sun::star::beans::Property& _rProperty ) const;
+
+
+ enum PropertyOrigin
+ {
+ AGGREGATE_PROPERTY,
+ DELEGATOR_PROPERTY,
+ UNKNOWN_PROPERTY
+ };
+ /** prefer this one over the XPropertySetInfo of the aggregate!
+
+ <p>The reason is that OPropertyArrayAggregationHelper is the only instance which really knows
+ which properties of the aggregate are to be exposed. <br/>
+
+ For instance, some derivee of OPropertySetAggregationHelper may decide to create an
+ OPropertyArrayAggregationHelper which contains only a subset of the aggregate properties. This way,
+ some of the aggregate properties may be hidded to the public.<br/>
+
+ When using the XPropertySetInfo of the aggregate set to determine the existence of a property, then this
+ would return false positives.</p>
+ */
+ PropertyOrigin classifyProperty( const OUString& _rName );
+
+protected:
+ const ::com::sun::star::beans::Property* findPropertyByName(const OUString& _rName) const;
+};
+
+//==================================================================
+namespace internal
+{
+ class PropertyForwarder;
+}
+
+/**
+ * helper class for implementing the property-set-related interfaces
+ * for an object doin' aggregation
+ * supports at least XPropertySet and XMultiPropertySet
+ *
+ */
+class COMPHELPER_DLLPUBLIC OPropertySetAggregationHelper :public OPropertyStateHelper
+ ,public ::com::sun::star::beans::XPropertiesChangeListener
+ ,public ::com::sun::star::beans::XVetoableChangeListener
+{
+ friend class internal::PropertyForwarder;
+
+protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState> m_xAggregateState;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> m_xAggregateSet;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet> m_xAggregateMultiSet;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet> m_xAggregateFastSet;
+
+ internal::PropertyForwarder* m_pForwarder;
+ sal_Bool m_bListening : 1;
+
+public:
+ OPropertySetAggregationHelper( ::cppu::OBroadcastHelper& rBHelper );
+
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type& aType) throw(::com::sun::star::uno::RuntimeException);
+
+// XEventListener
+ virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw (::com::sun::star::uno::RuntimeException);
+
+// XFastPropertySet
+ virtual void SAL_CALL setFastPropertyValue(sal_Int32 nHandle, const ::com::sun::star::uno::Any& aValue) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue(sal_Int32 nHandle) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+// XPropertySet
+ virtual void SAL_CALL addPropertyChangeListener(const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener(const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+// XPropertiesChangeListener
+ virtual void SAL_CALL propertiesChange(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& evt) throw(::com::sun::star::uno::RuntimeException);
+
+// XVetoableChangeListener
+ virtual void SAL_CALL vetoableChange(const ::com::sun::star::beans::PropertyChangeEvent& aEvent) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException);
+
+// XMultiPropertySet
+ virtual void SAL_CALL setPropertyValues(const ::com::sun::star::uno::Sequence< OUString >& PropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Values) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertiesChangeListener(const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener) throw(::com::sun::star::uno::RuntimeException);
+
+// XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState(const OUString& PropertyName) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault(const OUString& PropertyName) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault(const OUString& aPropertyName) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+// OPropertySetHelper
+ /** still waiting to be overwritten ...
+ you <B>must<B/> use an OPropertyArrayAggregationHelper here, as the implementation strongly relies on this.
+ */
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() = 0;
+
+ /** only implemented for "forwarded" properties, every other property must be handled
+ in the derivee, and will assert if passed herein
+ */
+ virtual sal_Bool SAL_CALL convertFastPropertyValue( ::com::sun::star::uno::Any& _rConvertedValue, ::com::sun::star::uno::Any& _rOldValue, sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue ) throw(::com::sun::star::lang::IllegalArgumentException);
+
+ /** only implemented for "forwarded" properties, every other property must be handled
+ in the derivee, and will assert if passed herein
+ */
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue ) throw ( ::com::sun::star::uno::Exception );
+
+protected:
+ ~OPropertySetAggregationHelper();
+
+ virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle) const;
+ virtual void SAL_CALL disposing();
+
+ sal_Int32 getOriginalHandle( sal_Int32 _nHandle ) const;
+ OUString getPropertyName( sal_Int32 _nHandle ) const;
+
+ /** declares the property with the given (public) handle as one to be forwarded to the aggregate
+
+ Sometimes, you might want to <em>overwrite</em> properties at the aggregate. That is,
+ though the aggregate implements this property, and still is to hold the property value,
+ you want to do additional handling upon setting the property, but then forward the value
+ to the aggregate.
+
+ Use this method to declare such properties.
+
+ When a "forwarded property" is set from outside, the class first calls
+ <member>forwardingPropertyValue</member> for any preprocessing, then forwards the property
+ value to the aggregate, and then calls <member>forwardedPropertyValue</member>.
+
+ When you declare a property as "forwarded", the class takes care for some multi-threading
+ issues, for instance, it won't fire any property change notifications which result from
+ forwarding a property value, unless it's safe to do so (i.e. unless our mutex is
+ released).
+
+ @see forwardingPropertyValue
+ @see forwardedPropertyValue
+ */
+ void declareForwardedProperty( sal_Int32 _nHandle );
+
+ /** checks whether we're actually forwarding a property value to our aggregate
+
+ @see declareForwardedProperty
+ @see forwardingPropertyValue
+ @see forwardedPropertyValue
+ */
+ bool isCurrentlyForwardingProperty( sal_Int32 _nHandle ) const;
+
+ /** called immediately before a property value which is overwritten in this instance
+ is forwarded to the aggregate
+
+ @see declareForwardedProperty
+ @see forwardedPropertyValue
+ */
+ virtual void SAL_CALL forwardingPropertyValue( sal_Int32 _nHandle );
+
+ /** called immediately after a property value which is overwritten in this instance
+ has been forwarded to the aggregate
+
+ @see declareForwardedProperty
+ @see forwardingPropertyValue
+ */
+ virtual void SAL_CALL forwardedPropertyValue( sal_Int32 _nHandle, bool _bSuccess );
+
+ /// must be called before aggregation, if aggregation is used
+ void setAggregation(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >&) throw( ::com::sun::star::lang::IllegalArgumentException );
+ void startListening();
+};
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // _COMPHELPER_PROPERTY_AGGREGATION_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/proparrhlp.hxx b/include/comphelper/proparrhlp.hxx
new file mode 100644
index 000000000000..840213e88427
--- /dev/null
+++ b/include/comphelper/proparrhlp.hxx
@@ -0,0 +1,175 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_
+#define _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_
+
+#include <comphelper/stl_types.hxx>
+#include <comphelper/propagg.hxx>
+#include <cppuhelper/propshlp.hxx>
+#include <osl/mutex.hxx>
+#include <osl/diagnose.h>
+#include <rtl/instance.hxx>
+
+namespace cppu {
+ class IPropertyArrayHelper;
+}
+
+//... namespace comphelper ................................................
+namespace comphelper
+{
+//.........................................................................
+
+ namespace staruno = ::com::sun::star::uno;
+ namespace starbeans = ::com::sun::star::beans;
+
+
+//==================================================================
+
+template <typename TYPE> struct OPropertyArrayUsageHelperMutex
+ : public rtl::Static< ::osl::Mutex, OPropertyArrayUsageHelperMutex<TYPE> > {};
+
+
+template <class TYPE>
+class OPropertyArrayUsageHelper
+{
+protected:
+ static sal_Int32 s_nRefCount;
+ static ::cppu::IPropertyArrayHelper* s_pProps;
+
+public:
+ OPropertyArrayUsageHelper();
+ virtual ~OPropertyArrayUsageHelper()
+ { // ARGHHHHHHH ..... would like to implement this after the class
+ // definition (as we do with all other methods) but SUNPRO 5 compiler
+ // (linker) doesn't like this
+ ::osl::MutexGuard aGuard(OPropertyArrayUsageHelperMutex<TYPE>::get());
+ OSL_ENSURE(s_nRefCount > 0, "OPropertyArrayUsageHelper::~OPropertyArrayUsageHelper : suspicious call : have a refcount of 0 !");
+ if (!--s_nRefCount)
+ {
+ delete s_pProps;
+ s_pProps = NULL;
+ }
+ }
+
+ /** call this in the getInfoHelper method of your derived class. The method returns the array helper of the
+ class, which is created if neccessary.
+ */
+ ::cppu::IPropertyArrayHelper* getArrayHelper();
+
+protected:
+ /** used to implement the creation of the array helper which is shared amongst all instances of the class.
+ This method needs to be implemented in derived classes.
+ <BR>
+ The method gets called with Mutex acquired.
+ <BR>
+ as long as IPropertyArrayHelper has no virtual destructor, the implementation of ~OPropertyArrayUsageHelper
+ assumes that you created an ::cppu::OPropertyArrayHelper when deleting s_pProps.
+ @return an pointer to the newly created array helper. Must not be NULL.
+ */
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const = 0;
+};
+
+//==================================================================
+/** a OPropertyArrayUsageHelper which will create an OPropertyArrayAggregationHelper
+*/
+template <class TYPE>
+class OAggregationArrayUsageHelper: public OPropertyArrayUsageHelper<TYPE>
+{
+protected:
+ /** overwrite this in your derived class. initialize the two sequences with your and your aggregate's
+ properties.
+ <BR>
+ The method gets called with Mutex acquired.
+ @param _rProps out parameter to be filled with the property descriptions of your own class
+ @param _rAggregateProps out parameter to be filled with the properties of your aggregate.
+ */
+ virtual void fillProperties(
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps
+ ) const = 0;
+
+ /** creates an OPropertyArrayAggregationHelper filled with properties for which's initialization
+ fillProperties is called. getInfoService and getFirstAggregateId may be overwritten to determine
+ the additional parameters of the OPropertyArrayAggregationHelper.
+ */
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
+
+ /** the return value is used for the construction of the OPropertyArrayAggregationHelper.
+ Beware of the lifetime of the returned object, as it has to exist 'til the last instance
+ of this class dies.
+ */
+ virtual IPropertyInfoService* getInfoService() const { return NULL; }
+
+ /** the return value is used for the construction of the OPropertyArrayAggregationHelper.
+ */
+ virtual sal_Int32 getFirstAggregateId() const { return DEFAULT_AGGREGATE_PROPERTY_ID; }
+};
+
+//------------------------------------------------------------------
+template<class TYPE>
+sal_Int32 OPropertyArrayUsageHelper< TYPE >::s_nRefCount = 0;
+
+template<class TYPE>
+::cppu::IPropertyArrayHelper* OPropertyArrayUsageHelper< TYPE >::s_pProps = NULL;
+
+//------------------------------------------------------------------
+template <class TYPE>
+OPropertyArrayUsageHelper<TYPE>::OPropertyArrayUsageHelper()
+{
+ ::osl::MutexGuard aGuard(OPropertyArrayUsageHelperMutex<TYPE>::get());
+ ++s_nRefCount;
+}
+
+//------------------------------------------------------------------
+template <class TYPE>
+::cppu::IPropertyArrayHelper* OPropertyArrayUsageHelper<TYPE>::getArrayHelper()
+{
+ OSL_ENSURE(s_nRefCount, "OPropertyArrayUsageHelper::getArrayHelper : suspicious call : have a refcount of 0 !");
+ if (!s_pProps)
+ {
+ ::osl::MutexGuard aGuard(OPropertyArrayUsageHelperMutex<TYPE>::get());
+ if (!s_pProps)
+ {
+ s_pProps = createArrayHelper();
+ OSL_ENSURE(s_pProps, "OPropertyArrayUsageHelper::getArrayHelper : createArrayHelper returned nonsense !");
+ }
+ }
+ return s_pProps;
+}
+
+//------------------------------------------------------------------
+template <class TYPE> inline
+::cppu::IPropertyArrayHelper* OAggregationArrayUsageHelper<TYPE>::createArrayHelper() const
+{
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > aProps;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > aAggregateProps;
+ fillProperties(aProps, aAggregateProps);
+ OSL_ENSURE(aProps.getLength(), "OAggregationArrayUsageHelper::createArrayHelper : fillProperties returned nonsense !");
+ return new OPropertyArrayAggregationHelper(aProps, aAggregateProps, getInfoService(), getFirstAggregateId());
+}
+
+//.........................................................................
+}
+//... namespace comphelper ................................................
+
+#endif // _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/property.hxx b/include/comphelper/property.hxx
new file mode 100644
index 000000000000..95fe122d51a6
--- /dev/null
+++ b/include/comphelper/property.hxx
@@ -0,0 +1,205 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_PROPERTY_HXX_
+#define _COMPHELPER_PROPERTY_HXX_
+
+#include <cppuhelper/proptypehlp.hxx>
+#include <comphelper/extract.hxx>
+#include <com/sun/star/beans/Property.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <functional>
+#include "comphelper/comphelperdllapi.h"
+#include "cppu/unotype.hxx"
+
+//=========================================================================
+//= property helper classes
+//=========================================================================
+
+//... namespace comphelper .......................................................
+namespace comphelper
+{
+//.........................................................................
+
+ namespace starbeans = ::com::sun::star::beans;
+ namespace staruno = ::com::sun::star::uno;
+
+/** compare two properties by name
+*/
+ //--------------------------------------------------------------------------
+ // comparing two property instances
+ struct PropertyCompareByName : public ::std::binary_function< ::com::sun::star::beans::Property, ::com::sun::star::beans::Property, bool >
+ {
+ bool operator() (const ::com::sun::star::beans::Property& x, const ::com::sun::star::beans::Property& y) const
+ {
+ return x.Name.compareTo(y.Name) < 0;// ? true : false;
+ }
+ };
+
+ //--------------------------------------------------------------------------
+ /** compare two properties by name
+ */
+ struct PropertyStringEqualFunctor : ::std::binary_function< ::com::sun::star::beans::Property, OUString, bool >
+ {
+ // ................................................................
+ inline bool operator()( const ::com::sun::star::beans::Property& lhs, const OUString& rhs ) const
+ {
+ return lhs.Name == rhs ;
+ }
+ // ................................................................
+ inline bool operator()( const OUString& lhs, const ::com::sun::star::beans::Property& rhs ) const
+ {
+ return lhs == rhs.Name ;
+ }
+ };
+ //--------------------------------------------------------------------------
+ // comparing two property instances
+ struct PropertyEqualByName : public ::std::binary_function< ::com::sun::star::beans::Property, ::com::sun::star::beans::Property, bool >
+ {
+ bool operator() (const ::com::sun::star::beans::Property& x, const ::com::sun::star::beans::Property& y) const
+ {
+ return x.Name == y.Name ;
+ }
+ };
+
+//------------------------------------------------------------------
+/// remove the property with the given name from the given sequence
+COMPHELPER_DLLPUBLIC void RemoveProperty(staruno::Sequence<starbeans::Property>& seqProps, const OUString& _rPropName);
+
+//------------------------------------------------------------------
+/** within the given property sequence, modify attributes of a special property
+ @param _rProps the sequence of properties to search in
+ @param _sPropName the name of the property which's attributes should be modified
+ @param _nAddAttrib the attributes which should be added
+ @param _nRemoveAttrib the attributes which should be removed
+*/
+COMPHELPER_DLLPUBLIC void ModifyPropertyAttributes(staruno::Sequence<starbeans::Property>& _rProps, const OUString& _sPropName, sal_Int16 _nAddAttrib, sal_Int16 _nRemoveAttrib);
+
+//------------------------------------------------------------------
+/** check if the given set has the given property.
+*/
+COMPHELPER_DLLPUBLIC sal_Bool hasProperty(const OUString& _rName, const staruno::Reference<starbeans::XPropertySet>& _rxSet);
+
+//------------------------------------------------------------------
+/** copy properties between property sets, in compliance with the property
+ attributes of the target object
+*/
+COMPHELPER_DLLPUBLIC void copyProperties(const staruno::Reference<starbeans::XPropertySet>& _rxSource,
+ const staruno::Reference<starbeans::XPropertySet>& _rxDest);
+
+//==================================================================
+//= property conversion helpers
+//==================================================================
+
+/** helper for implementing ::cppu::OPropertySetHelper::convertFastPropertyValue
+ @param _rConvertedValue the conversion result (if successful)
+ @param _rOldValue the old value of the property, calculated from _rCurrentValue
+ @param _rValueToSet the new value which is about to be set
+ @param _rCurrentValue the current value of the property
+ @return sal_True, if the value could be converted and has changed
+ sal_False, if the value could be converted and has not changed
+ @exception InvalidArgumentException thrown if the value could not be converted to the requested type (which is the template argument)
+*/
+template <typename T>
+sal_Bool tryPropertyValue(staruno::Any& /*out*/_rConvertedValue, staruno::Any& /*out*/_rOldValue, const staruno::Any& _rValueToSet, const T& _rCurrentValue)
+{
+ sal_Bool bModified(sal_False);
+ T aNewValue = T();
+ ::cppu::convertPropertyValue(aNewValue, _rValueToSet);
+ if (aNewValue != _rCurrentValue)
+ {
+ _rConvertedValue <<= aNewValue;
+ _rOldValue <<= _rCurrentValue;
+ bModified = sal_True;
+ }
+ return bModified;
+}
+
+/** helper for implementing ::cppu::OPropertySetHelper::convertFastPropertyValue for enum values
+ @param _rConvertedValue the conversion result (if successful)
+ @param _rOldValue the old value of the property, calculated from _rCurrentValue
+ @param _rValueToSet the new value which is about to be set
+ @param _rCurrentValue the current value of the property
+ @return sal_True, if the value could be converted and has changed
+ sal_False, if the value could be converted and has not changed
+ @exception InvalidArgumentException thrown if the value could not be converted to the requested type (which is the template argument)
+*/
+template <class ENUMTYPE>
+sal_Bool tryPropertyValueEnum(staruno::Any& /*out*/_rConvertedValue, staruno::Any& /*out*/_rOldValue, const staruno::Any& _rValueToSet, const ENUMTYPE& _rCurrentValue)
+{
+ if (cppu::getTypeFavourUnsigned(&_rCurrentValue).getTypeClass()
+ != staruno::TypeClass_ENUM)
+ return tryPropertyValue(_rConvertedValue, _rOldValue, _rValueToSet, _rCurrentValue);
+
+ sal_Bool bModified(sal_False);
+ ENUMTYPE aNewValue;
+ ::cppu::any2enum(aNewValue, _rValueToSet);
+ // will throw an exception if not convertible
+
+ if (aNewValue != _rCurrentValue)
+ {
+ _rConvertedValue <<= aNewValue;
+ _rOldValue <<= _rCurrentValue;
+ bModified = sal_True;
+ }
+ return bModified;
+}
+
+/** helper for implementing ::cppu::OPropertySetHelper::convertFastPropertyValue for boolean properties
+ @param _rConvertedValue the conversion result (if successful)
+ @param _rOldValue the old value of the property, calculated from _rCurrentValue
+ @param _rValueToSet the new value which is about to be set
+ @param _rCurrentValue the current value of the property
+ @return sal_True, if the value could be converted and has changed
+ sal_False, if the value could be converted and has not changed
+ @exception InvalidArgumentException thrown if the value could not be converted to a boolean type
+*/
+inline sal_Bool tryPropertyValue(staruno::Any& /*out*/_rConvertedValue, staruno::Any& /*out*/_rOldValue, const staruno::Any& _rValueToSet, sal_Bool _bCurrentValue)
+{
+ sal_Bool bModified(sal_False);
+ sal_Bool bNewValue(sal_False);
+ ::cppu::convertPropertyValue(bNewValue, _rValueToSet);
+ if (bNewValue != _bCurrentValue)
+ {
+ _rConvertedValue.setValue(&bNewValue, ::getBooleanCppuType());
+ _rOldValue.setValue(&_bCurrentValue, ::getBooleanCppuType());
+ bModified = sal_True;
+ }
+ return bModified;
+}
+
+/** helper for implementing ::cppu::OPropertySetHelper::convertFastPropertyValue
+ @param _rConvertedValue the conversion result (if successful)
+ @param _rOldValue the old value of the property, calculated from _rCurrentValue
+ @param _rValueToSet the new value which is about to be set
+ @param _rCurrentValue the current value of the property
+ @param _rExpectedType the type which the property should have (if not void)
+ @return sal_True, if the value could be converted and has changed
+ sal_False, if the value could be converted and has not changed
+ @exception InvalidArgumentException thrown if the value could not be converted to the requested type (which is the template argument)
+*/
+COMPHELPER_DLLPUBLIC sal_Bool tryPropertyValue(staruno::Any& _rConvertedValue, staruno::Any& _rOldValue, const staruno::Any& _rValueToSet, const staruno::Any& _rCurrentValue, const staruno::Type& _rExpectedType);
+
+//.........................................................................
+}
+//... namespace comphelper .......................................................
+
+#endif // _COMPHELPER_PROPERTY_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/propertybag.hxx b/include/comphelper/propertybag.hxx
new file mode 100644
index 000000000000..92c0026ba845
--- /dev/null
+++ b/include/comphelper/propertybag.hxx
@@ -0,0 +1,227 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_PROPERTYBAG_HXX
+#define COMPHELPER_PROPERTYBAG_HXX
+
+#include "comphelper/comphelperdllapi.h"
+#include <comphelper/propertycontainerhelper.hxx>
+
+#include <memory>
+
+//........................................................................
+namespace comphelper
+{
+//........................................................................
+
+ struct PropertyBag_Impl;
+ //====================================================================
+ //= PropertyBag
+ //====================================================================
+ /** provides a bag of properties associated with their values
+
+ This class can, for instance, be used for components which need to implement
+ the com.sun.star.beans.PropertyBag service.
+ */
+ class COMPHELPER_DLLPUBLIC PropertyBag : protected OPropertyContainerHelper
+ {
+ private:
+ ::std::auto_ptr< PropertyBag_Impl > m_pImpl;
+
+ public:
+ PropertyBag();
+ virtual ~PropertyBag();
+
+ /** allow adding property with empty string as name
+ (by default, such names are rejected with IllegalActionException).
+ @param i_isAllowed
+ iff true, empty property name will be allowed
+ */
+ void setAllowEmptyPropertyName(bool i_isAllowed = true);
+
+ /** adds a property to the bag
+
+ The type of the property is determined from its initial value (<code>_rInitialValue</code>).
+
+ @param _rName
+ the name of the new property. Must not be empty unless
+ explicitly allowed with setAllowEmptyPropertyName.
+ @param _nHandle
+ the handle of the new property
+ @param _nAttributes
+ the attributes of the property
+ @param _rInitialValue
+ the initial value of the property. Must not be <NULL/>, to allow
+ determining the property type.
+
+ @throws ::com::sun::star::beans::IllegalTypeException
+ if the initial value is <NULL/>
+ @throws ::com::sun::star::beans::PropertyExistException
+ if the name or the handle are already used
+ @throws ::com::sun::star::beans::IllegalArgumentException
+ if the name is empty
+ */
+ void addProperty(
+ const OUString& _rName,
+ sal_Int32 _nHandle,
+ sal_Int32 _nAttributes,
+ const ::com::sun::star::uno::Any& _rInitialValue
+ );
+
+ /** adds a property to the bag
+
+ The initial value of the property is <NULL/>.
+
+ @param _rName
+ the name of the new property. Must not be empty unless
+ explicitly allowed with setAllowEmptyPropertyName.
+ @param _rType
+ the type of the new property
+ @param _nHandle
+ the handle of the new property
+ @param _nAttributes
+ the attributes of the property
+
+ @throws ::com::sun::star::beans::IllegalTypeException
+ if the initial value is <NULL/>
+ @throws ::com::sun::star::beans::PropertyExistException
+ if the name or the handle are already used
+ @throws ::com::sun::star::beans::IllegalArgumentException
+ if the name is empty
+ */
+ void addVoidProperty(
+ const OUString& _rName,
+ const ::com::sun::star::uno::Type& _rType,
+ sal_Int32 _nHandle,
+ sal_Int32 _nAttributes
+ );
+
+ /** removes a property from the bag
+ @param _rName
+ the name of the to-be-removed property.
+ @throws UnknownPropertyException
+ if the bag does not contain a property with the given name
+ @throws NotRemoveableException
+ if the property with the given name is not removeable, as indicated
+ by the property attributes used in a previous <code>addProperty</code>
+ call.
+ */
+ void removeProperty(
+ const OUString& _rName
+ );
+
+ /** describes all properties in the bag
+ @param _out_rProps
+ takes, upon return, the descriptions of all properties in the bag
+ */
+ inline void describeProperties(
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& _out_rProps
+ ) const
+ {
+ OPropertyContainerHelper::describeProperties( _out_rProps );
+ }
+
+ /** retrieves the value of a property given by handle
+ @param _nHandle
+ the handle of the property whose value is to be retrieved
+ @param _out_rValue
+ output parameter taking the property value
+ @throws UnknownPropertyException
+ if the given handle does not denote a property in the bag
+ */
+ void getFastPropertyValue(
+ sal_Int32 _nHandle,
+ ::com::sun::star::uno::Any& _out_rValue
+ ) const;
+
+ /** converts a to-be-set value of a property (given by handle) so that it can
+ be used in subsequent calls to setFastPropertyValue
+ @param _nHandle
+ the handle of the property
+ @param _rNewValue
+ the new value, which should be converted
+ @param _out_rConvertedValue
+ output parameter taking the converted value
+ @param _out_rCurrentValue
+ output parameter taking the current value of the
+ property
+ @throws UnknownPropertyException
+ if the given handle does not denote a property in the bag
+ @throws IllegalArgumentException
+ if the given value cannot be lossless converted into a value
+ for the given property.
+ */
+ bool convertFastPropertyValue(
+ sal_Int32 _nHandle,
+ const ::com::sun::star::uno::Any& _rNewValue,
+ ::com::sun::star::uno::Any& _out_rConvertedValue,
+ ::com::sun::star::uno::Any& _out_rCurrentValue
+ ) const;
+
+ /** sets a new value for a property given by handle
+ @throws UnknownPropertyException
+ if the given handle does not denote a property in the bag
+ */
+ void setFastPropertyValue(
+ sal_Int32 _nHandle,
+ const ::com::sun::star::uno::Any& _rValue
+ );
+
+ /** returns the default value for a property given by handle
+
+ The default value of a property is its initial value, as passed
+ to ->addProperty.
+
+ @param _nHandle
+ handle of the property whose default value is to be obtained
+ @param _out_rValue
+ the default value
+ @throws UnknownPropertyException
+ if the given handle does not denote a property in the bag
+ */
+ void getPropertyDefaultByHandle(
+ sal_Int32 _nHandle,
+ ::com::sun::star::uno::Any& _out_rValue
+ ) const;
+
+ /** determines whether a property with a given name is part of the bag
+ */
+ inline bool hasPropertyByName( const OUString& _rName ) const
+ {
+ return isRegisteredProperty( _rName );
+ }
+
+ /** determines whether a property with a given handle is part of the bag
+ */
+ inline bool hasPropertyByHandle( sal_Int32 _nHandle ) const
+ {
+ return isRegisteredProperty( _nHandle );
+ }
+ protected:
+ using OPropertyContainerHelper::convertFastPropertyValue;
+ using OPropertyContainerHelper::getFastPropertyValue;
+ };
+
+//........................................................................
+} // namespace comphelper
+//........................................................................
+
+#endif // COMPHELPER_PROPERTYBAG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/propertycontainer.hxx b/include/comphelper/propertycontainer.hxx
new file mode 100644
index 000000000000..3d208413a722
--- /dev/null
+++ b/include/comphelper/propertycontainer.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_PROPERTYCONTAINER_HXX_
+#define _COMPHELPER_PROPERTYCONTAINER_HXX_
+
+#include <comphelper/propertycontainerhelper.hxx>
+#include <cppuhelper/propshlp.hxx>
+#include <com/sun/star/uno/Type.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+//==========================================================================
+//= OPropertyContainer
+//==========================================================================
+typedef ::cppu::OPropertySetHelper OPropertyContainer_Base;
+/** a OPropertySetHelper implementation which is just a simple container for properties represented
+ by class members, usually in a derived class.
+ <BR>
+ A restriction of this class is that no value conversions are made on a setPropertyValue call. Though
+ the base class supports this with the convertFastPropertyValue method, the OPropertyContainer accepts only
+ values which already have the correct type, it's unable to convert, for instance, a long to a short.
+*/
+class COMPHELPER_DLLPUBLIC OPropertyContainer
+ :public OPropertyContainer_Base
+ ,public OPropertyContainerHelper
+{
+public:
+ // this dtor is needed otherwise we can get a wrong delete operator
+ virtual ~OPropertyContainer();
+
+protected:
+ OPropertyContainer(::cppu::OBroadcastHelper& _rBHelper);
+
+ /// for scripting : the types of the interfaces supported by this class
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException);
+
+// OPropertySetHelper overridables
+ virtual sal_Bool SAL_CALL convertFastPropertyValue(
+ ::com::sun::star::uno::Any & rConvertedValue,
+ ::com::sun::star::uno::Any & rOldValue,
+ sal_Int32 nHandle,
+ const ::com::sun::star::uno::Any& rValue )
+ throw (::com::sun::star::lang::IllegalArgumentException);
+
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
+ sal_Int32 nHandle,
+ const ::com::sun::star::uno::Any& rValue
+ )
+ throw (::com::sun::star::uno::Exception);
+
+ using OPropertyContainer_Base::getFastPropertyValue;
+ virtual void SAL_CALL getFastPropertyValue(
+ ::com::sun::star::uno::Any& rValue,
+ sal_Int32 nHandle
+ ) const;
+
+ // disambiguate a base class method (XFastPropertySet)
+ virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+};
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // _COMPHELPER_PROPERTYCONTAINER_HXX_
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/propertycontainerhelper.hxx b/include/comphelper/propertycontainerhelper.hxx
new file mode 100644
index 000000000000..dacefd8737a6
--- /dev/null
+++ b/include/comphelper/propertycontainerhelper.hxx
@@ -0,0 +1,203 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_PROPERTYCONTAINERHELPER_HXX
+#define COMPHELPER_PROPERTYCONTAINERHELPER_HXX
+
+#include <cppuhelper/propshlp.hxx>
+#include <com/sun/star/uno/Type.hxx>
+#include <com/sun/star/beans/Property.hpp>
+#include <vector>
+#include "comphelper/comphelperdllapi.h"
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+// infos about one single property
+struct COMPHELPER_DLLPUBLIC PropertyDescription
+{
+ // the possibilities where a property holding object may be located
+ enum LocationType
+ {
+ ltDerivedClassRealType, // within the derived class, it's a "real" (non-Any) type
+ ltDerivedClassAnyType, // within the derived class, it's a <type scope="com.sun.star.uno">Any</type>
+ ltHoldMyself // within m_aHoldProperties
+ };
+ // the location of an object holding a property value :
+ union LocationAccess
+ {
+ void* pDerivedClassMember; // a pointer to a member of an object of a derived class
+ sal_Int32 nOwnClassVectorIndex; // an index within m_aHoldProperties
+ };
+
+ ::com::sun::star::beans::Property
+ aProperty;
+ LocationType eLocated; // where is the object containing the value located ?
+ LocationAccess aLocation; // access to the property value
+
+ PropertyDescription()
+ :aProperty( OUString(), -1, ::com::sun::star::uno::Type(), 0 )
+ ,eLocated( ltHoldMyself )
+ {
+ aLocation.nOwnClassVectorIndex = -1;
+ }
+};
+
+//==========================================================================
+//= OPropertyContainerHelper
+//==========================================================================
+/** helper class for managing property values, and implementing most of the X*Property* interfaces
+
+ The property values are usually held in derived classes, but can also be given to the
+ responsibility of this class here.
+
+ For more information, see http://wiki.services.openoffice.org/wiki/Development/Cpp/Helper/PropertyContainerHelper.
+*/
+class COMPHELPER_DLLPUBLIC OPropertyContainerHelper
+{
+ typedef ::std::vector< ::com::sun::star::uno::Any > PropertyContainer;
+ typedef PropertyContainer::iterator PropertyContainerIterator;
+ typedef PropertyContainer::const_iterator ConstPropertyContainerIterator;
+ PropertyContainer m_aHoldProperties;
+ // the properties which are hold by this class' instance, not the derived one's
+
+private:
+ typedef ::std::vector< PropertyDescription > Properties;
+ typedef Properties::iterator PropertiesIterator;
+ typedef Properties::const_iterator ConstPropertiesIterator;
+ Properties m_aProperties;
+
+ sal_Bool m_bUnused;
+
+protected:
+ OPropertyContainerHelper();
+ ~OPropertyContainerHelper();
+
+ /** register a property. The property is represented through a member of the derived class which calls
+ this methdod.
+ @param _rName the name of the property
+ @param _nHandle the handle of the property
+ @param _nAttributes the attributes of the property
+ @param _pPointerToMember the pointer to the member representing the property
+ within the derived class.
+ @param _rMemberType the cppu type of the property represented by the object
+ to which _pPointerToMember points.
+ */
+ void registerProperty(const OUString& _rName, sal_Int32 _nHandle, sal_Int32 _nAttributes,
+ void* _pPointerToMember, const ::com::sun::star::uno::Type& _rMemberType);
+
+
+ /** register a property. The property is represented through a ::com::sun::star::uno::Any member of the
+ derived class which calls this methdod.
+ @param _rName the name of the property
+ @param _nHandle the handle of the property
+ @param _nAttributes the attributes of the property
+ @param _pPointerToMember the pointer to the member representing the property
+ within the derived class, which has to be a ::com::sun::star::uno::Any.
+ @param _rExpectedType the expected type of the property. NOT the type of the object to which
+ _pPointerToMember points (this is always an Any).
+ */
+ void registerMayBeVoidProperty(const OUString& _rName, sal_Int32 _nHandle, sal_Int32 _nAttributes,
+ ::com::sun::star::uno::Any* _pPointerToMember, const ::com::sun::star::uno::Type& _rExpectedType);
+
+ /** register a property. The repository will create an own object holding this property, so there is no
+ need to declare an extra member in your derived class
+ @param _rName the name of the property
+ @param _nHandle the handle of the property
+ @param _nAttributes the attributes of the property
+ @param _rType the type of the property
+ @param _pInitialValue the initial value of the property. May be null if _nAttributes includes
+ the ::com::sun::star::beans::PropertyAttribute::MAYBEVOID flag.
+ Else it must be a pointer to an object of the type described by _rType.
+ */
+ void registerPropertyNoMember(const OUString& _rName, sal_Int32 _nHandle, sal_Int32 _nAttributes,
+ const ::com::sun::star::uno::Type& _rType, const void* _pInitialValue);
+
+ /** revokes a previously registered property
+ @throw com::sun::star::beans::UnknownPropertyException
+ if no property with the given handle is registered
+ */
+ void revokeProperty( sal_Int32 _nHandle );
+
+
+ /// checkes whether a property with the given handle has been registered
+ sal_Bool isRegisteredProperty( sal_Int32 _nHandle ) const;
+
+ /// checkes whether a property with the given name has been registered
+ sal_Bool isRegisteredProperty( const OUString& _rName ) const;
+
+
+ // helper for implementing OPropertySetHelper overridables
+ sal_Bool convertFastPropertyValue(
+ ::com::sun::star::uno::Any & rConvertedValue,
+ ::com::sun::star::uno::Any & rOldValue,
+ sal_Int32 nHandle,
+ const ::com::sun::star::uno::Any& rValue
+ )
+ SAL_THROW((::com::sun::star::lang::IllegalArgumentException));
+
+ void setFastPropertyValue(
+ sal_Int32 nHandle,
+ const ::com::sun::star::uno::Any& rValue
+ )
+ SAL_THROW((::com::sun::star::uno::Exception));
+
+ void getFastPropertyValue(
+ ::com::sun::star::uno::Any& rValue,
+ sal_Int32 nHandle
+ ) const;
+
+// helper
+ /** appends the descriptions of all properties which were registered 'til that moment to the given sequence,
+ keeping the array sorted (by name)
+ @precond
+ the given sequence is already sorted by name
+ @param _rProps
+ initial property sequence which is to be extended
+ */
+ void describeProperties(::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps) const;
+
+ /** retrieves the description for a registered property
+ @throw com::sun::star::beans::UnknownPropertyException
+ if no property with the given name is registered
+ */
+ const ::com::sun::star::beans::Property&
+ getProperty( const OUString& _rName ) const;
+
+private:
+ /// insertion of _rProp into m_aProperties, keeping the sort order
+ COMPHELPER_DLLPRIVATE void implPushBackProperty(const PropertyDescription& _rProp);
+
+ /// search the PropertyDescription for the given handle (within m_aProperties)
+ COMPHELPER_DLLPRIVATE PropertiesIterator searchHandle(sal_Int32 _nHandle);
+
+private:
+ COMPHELPER_DLLPRIVATE OPropertyContainerHelper( const OPropertyContainerHelper& ); // never implemented
+ COMPHELPER_DLLPRIVATE OPropertyContainerHelper& operator=( const OPropertyContainerHelper& ); // never implemented
+};
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // COMPHELPER_PROPERTYCONTAINERHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/propertysethelper.hxx b/include/comphelper/propertysethelper.hxx
new file mode 100644
index 000000000000..ecc600c37d3c
--- /dev/null
+++ b/include/comphelper/propertysethelper.hxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_PROPERTYSETHELPER_HXX_
+#define _COMPHELPER_PROPERTYSETHELPER_HXX_
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include "comphelper/comphelperdllapi.h"
+
+//=========================================================================
+//= property helper classes
+//=========================================================================
+
+//... namespace comphelper ................................................
+namespace comphelper
+{
+//.........................................................................
+
+class PropertySetInfo;
+struct PropertyMapEntry;
+class PropertySetHelperImpl;
+
+class COMPHELPER_DLLPUBLIC PropertySetHelper : public ::com::sun::star::beans::XPropertySet,
+ public ::com::sun::star::beans::XPropertyState,
+ public ::com::sun::star::beans::XMultiPropertySet
+{
+private:
+ PropertySetHelperImpl* mp;
+
+protected:
+ virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const ::com::sun::star::uno::Any* pValues ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException ) = 0;
+ virtual void _getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, ::com::sun::star::uno::Any* pValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException ) = 0;
+
+ virtual void _getPropertyStates( const comphelper::PropertyMapEntry** ppEntries, ::com::sun::star::beans::PropertyState* pStates ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException );
+ virtual void _setPropertyToDefault( const comphelper::PropertyMapEntry* pEntry ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Any _getPropertyDefault( const comphelper::PropertyMapEntry* pEntry ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+
+public:
+ PropertySetHelper( comphelper::PropertySetInfo* pInfo ) throw();
+ PropertySetHelper( comphelper::PropertySetInfo* pInfo, __sal_NoAcquire ) throw();
+ virtual ~PropertySetHelper() throw();
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XMultiPropertySet
+// virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+};
+
+//.........................................................................
+}
+//... namespace comphelper..................................................
+
+#endif // _UTL_PROPERTYSETHELPER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/propertysetinfo.hxx b/include/comphelper/propertysetinfo.hxx
new file mode 100644
index 000000000000..e0b863e8f2ca
--- /dev/null
+++ b/include/comphelper/propertysetinfo.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_PROPERTSETINFO_HXX_
+#define _COMPHELPER_PROPERTSETINFO_HXX_
+
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/stl_types.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+//=========================================================================
+//= property helper classes
+//=========================================================================
+
+//... namespace comphelper .......................................................
+namespace comphelper
+{
+//.........................................................................
+
+struct PropertyMapEntry
+{
+ const sal_Char* mpName;
+ sal_uInt16 mnNameLen;
+ sal_Int32 mnHandle;
+ const com::sun::star::uno::Type* mpType;
+ sal_Int16 mnAttributes;
+ sal_uInt8 mnMemberId;
+};
+
+DECLARE_STL_USTRINGACCESS_MAP( PropertyMapEntry*, PropertyMap );
+
+class PropertyMapImpl;
+
+/** this class implements a XPropertySetInfo that is initialized with arrays of PropertyMapEntry.
+ It is used by the class PropertySetHelper.
+*/
+class COMPHELPER_DLLPUBLIC PropertySetInfo : public ::cppu::WeakImplHelper1< ::com::sun::star::beans::XPropertySetInfo >
+{
+private:
+ PropertyMapImpl* mpMap;
+public:
+ PropertySetInfo() throw();
+ PropertySetInfo( PropertyMapEntry* pMap ) throw();
+ virtual ~PropertySetInfo() throw();
+
+ /** returns a stl map with all PropertyMapEntry pointer.<p>
+ The key is the property name.
+ */
+ const PropertyMap* getPropertyMap() const throw();
+
+ /** adds an array of PropertyMapEntry to this instance.<p>
+ The end is marked with a PropertyMapEntry where mpName equals NULL</p>
+ */
+ void add( PropertyMapEntry* pMap ) throw();
+
+ /** removes an already added PropertyMapEntry which string in mpName equals to aName */
+ void remove( const OUString& aName ) throw();
+
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::beans::Property SAL_CALL getPropertyByName( const OUString& aName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+//.........................................................................
+}
+//... namespace comphelper .......................................................
+
+#endif // _UTL_PROPERTSETINFO_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/propertystatecontainer.hxx b/include/comphelper/propertystatecontainer.hxx
new file mode 100644
index 000000000000..acd368646628
--- /dev/null
+++ b/include/comphelper/propertystatecontainer.hxx
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_PROPERTYSTATECONTAINER_HXX
+#define COMPHELPER_PROPERTYSTATECONTAINER_HXX
+
+#include <comphelper/propertycontainer.hxx>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/uno3.hxx>
+#include <osl/diagnose.h>
+#include "comphelper/comphelperdllapi.h"
+
+#include <map>
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+ //=====================================================================
+ //= OPropertyStateContainer
+ //=====================================================================
+ typedef ::cppu::ImplHelper1 < ::com::sun::star::beans::XPropertyState
+ > OPropertyStateContainer_TBase;
+
+ /** helper implementation for components which have properties with a default
+
+ <p>This class is not intended for direct use, you need to derive from it.</p>
+
+ @see com.sun.star.beans.XPropertyState
+ */
+ class COMPHELPER_DLLPUBLIC OPropertyStateContainer
+ :public OPropertyContainer
+ ,public OPropertyStateContainer_TBase
+ {
+ protected:
+ /** ctor
+ @param _rBHelper
+ help to be used for broadcasting events
+ */
+ OPropertyStateContainer( ::cppu::OBroadcastHelper& _rBHelper );
+
+ // ................................................................
+ // XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< OUString >& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // ................................................................
+ // own overridables
+ // these are the impl-methods for the XPropertyState members - they are implemented already by this class,
+ // but you may want to override them for whatever reasons (for instance, if your derived class
+ // supports the AMBIGUOUS state for properties)
+
+ /** get the PropertyState of the property denoted by the given handle
+
+ <p>Already implemented by this base class, no need to override</p>
+ @precond <arg>_nHandle</arg> is a valid property handle
+ */
+ virtual ::com::sun::star::beans::PropertyState getPropertyStateByHandle( sal_Int32 _nHandle );
+
+ /** set the property denoted by the given handle to it's default value
+
+ <p>Already implemented by this base class, no need to override</p>
+ @precond <arg>_nHandle</arg> is a valid property handle
+ */
+ virtual void setPropertyToDefaultByHandle( sal_Int32 _nHandle );
+
+ /** get the default value for the property denoted by the given handle
+
+ @precond
+ <arg>_nHandle</arg> is a valid property handle
+ */
+ virtual void getPropertyDefaultByHandle( sal_Int32 _nHandle, ::com::sun::star::uno::Any& _rDefault ) const = 0;
+
+ protected:
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException);
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER( )
+
+ protected:
+ /** returns the handle for the given name
+
+ @throw UnknownPropertyException if the given name is not a registered property
+ */
+ sal_Int32 getHandleForName( const OUString& _rPropertyName ) SAL_THROW( ( ::com::sun::star::beans::UnknownPropertyException ) );
+ };
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // COMPHELPER_PROPERTYSTATECONTAINER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/propmultiplex.hxx b/include/comphelper/propmultiplex.hxx
new file mode 100644
index 000000000000..28795e57ce8a
--- /dev/null
+++ b/include/comphelper/propmultiplex.hxx
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_PROPERTY_MULTIPLEX_HXX_
+#define _COMPHELPER_PROPERTY_MULTIPLEX_HXX_
+
+#include <comphelper/propstate.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+//=========================================================================
+//= property helper classes
+//=========================================================================
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+ class OPropertyChangeMultiplexer;
+
+ //==================================================================
+ //= OPropertyChangeListener
+ //==================================================================
+ /// simple listener adapter for property sets
+ class COMPHELPER_DLLPUBLIC OPropertyChangeListener
+ {
+ friend class OPropertyChangeMultiplexer;
+
+ OPropertyChangeMultiplexer* m_pAdapter;
+ ::osl::Mutex& m_rMutex;
+
+ public:
+ OPropertyChangeListener(::osl::Mutex& _rMutex)
+ : m_pAdapter(NULL), m_rMutex(_rMutex) { }
+ virtual ~OPropertyChangeListener();
+
+ virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& _rEvent) throw( ::com::sun::star::uno::RuntimeException) = 0;
+ virtual void _disposing(const ::com::sun::star::lang::EventObject& _rSource) throw( ::com::sun::star::uno::RuntimeException);
+
+ protected:
+ /** If the derivee also owns the mutex which we know as reference, then call this within your
+ derivee's dtor.
+ */
+ void disposeAdapter();
+
+ // pseudo-private. Making it private now could break compatibility
+ void setAdapter( OPropertyChangeMultiplexer* _pAdapter );
+ };
+
+ //==================================================================
+ //= OPropertyChangeMultiplexer
+ //==================================================================
+ /// multiplexer for property changes
+ class COMPHELPER_DLLPUBLIC OPropertyChangeMultiplexer :public cppu::WeakImplHelper1< ::com::sun::star::beans::XPropertyChangeListener>
+ {
+ friend class OPropertyChangeListener;
+ ::com::sun::star::uno::Sequence< OUString > m_aProperties;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> m_xSet;
+ OPropertyChangeListener* m_pListener;
+ sal_Int32 m_nLockCount;
+ sal_Bool m_bListening : 1;
+ sal_Bool m_bAutoSetRelease : 1;
+
+
+ virtual ~OPropertyChangeMultiplexer();
+ public:
+ OPropertyChangeMultiplexer(OPropertyChangeListener* _pListener, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxSet, sal_Bool _bAutoReleaseSet = sal_True);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw( ::com::sun::star::uno::RuntimeException);
+
+ // XPropertyChangeListener
+ virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw( ::com::sun::star::uno::RuntimeException);
+
+ /// incremental lock
+ void lock();
+ /// incremental unlock
+ void unlock();
+ /// get the lock count
+ sal_Int32 locked() const { return m_nLockCount; }
+
+ void addProperty(const OUString& aPropertyName);
+ void dispose();
+ };
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // _COMPHELPER_PROPERTY_MULTIPLEX_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/propstate.hxx b/include/comphelper/propstate.hxx
new file mode 100644
index 000000000000..727f40d96824
--- /dev/null
+++ b/include/comphelper/propstate.hxx
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_PROPERTY_STATE_HXX_
+#define _COMPHELPER_PROPERTY_STATE_HXX_
+
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+
+#include <cppuhelper/propshlp.hxx>
+#include <cppuhelper/proptypehlp.hxx>
+#include <cppuhelper/weak.hxx>
+#include <comphelper/uno3.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include "comphelper/comphelperdllapi.h"
+
+//=========================================================================
+//= property helper classes
+//=========================================================================
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+ //==================================================================
+ //= OPropertyStateHelper
+ //==================================================================
+ /// helper class for implementing property states
+ class COMPHELPER_DLLPUBLIC OPropertyStateHelper :public ::cppu::OPropertySetHelper2
+ ,public ::com::sun::star::beans::XPropertyState
+ {
+ public:
+ OPropertyStateHelper(::cppu::OBroadcastHelper& rBHlp):OPropertySetHelper2(rBHlp) { }
+ OPropertyStateHelper(::cppu::OBroadcastHelper& rBHlp,
+ ::cppu::IEventNotificationHook *i_pFireEvents);
+
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type& aType) throw(::com::sun::star::uno::RuntimeException);
+
+ // XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL
+ getPropertyState(const OUString& PropertyName) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState> SAL_CALL
+ getPropertyStates(const ::com::sun::star::uno::Sequence< OUString >& aPropertyName) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL
+ setPropertyToDefault(const OUString& PropertyName) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL
+ getPropertyDefault(const OUString& aPropertyName) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // access via handle
+ virtual ::com::sun::star::beans::PropertyState getPropertyStateByHandle(sal_Int32 nHandle);
+ virtual void setPropertyToDefaultByHandle(sal_Int32 nHandle);
+ virtual ::com::sun::star::uno::Any getPropertyDefaultByHandle(sal_Int32 nHandle) const;
+
+ protected:
+ virtual ~OPropertyStateHelper();
+
+ void firePropertyChange(sal_Int32 nHandle, const ::com::sun::star::uno::Any& aNewValue, const ::com::sun::star::uno::Any& aOldValue);
+
+ protected:
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ };
+
+ //==================================================================
+ //= OPropertyStateHelper
+ //==================================================================
+ class COMPHELPER_DLLPUBLIC OStatefulPropertySet :public ::cppu::OWeakObject
+ ,public ::com::sun::star::lang::XTypeProvider
+ ,public OMutexAndBroadcastHelper // order matters: before OPropertyStateHelper/OPropertySetHelper
+ ,public OPropertyStateHelper
+ {
+ protected:
+ OStatefulPropertySet();
+ virtual ~OStatefulPropertySet();
+
+ protected:
+ DECLARE_XINTERFACE()
+ DECLARE_XTYPEPROVIDER()
+ };
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // _COMPHELPER_PROPERTY_STATE_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/proxyaggregation.hxx b/include/comphelper/proxyaggregation.hxx
new file mode 100644
index 000000000000..2c01a7a3587f
--- /dev/null
+++ b/include/comphelper/proxyaggregation.hxx
@@ -0,0 +1,221 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_PROXY_AGGREGATION
+#define COMPHELPER_PROXY_AGGREGATION
+
+#include <com/sun/star/uno/XAggregation.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <comphelper/uno3.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <cppuhelper/compbase_ex.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+/* class hierarchy herein:
+
+ +-------------------+ helper class for aggregating the proxy to another object
+ | OProxyAggregation | - not ref counted
+ +-------------------+ - no UNO implementation, i.e. not derived from XInterface
+ ^ (neither direct nor indirect)
+ |
+ |
+ +----------------------------------+ helper class for aggregating a proxy to an XComponent
+ | OComponentProxyAggregationHelper | - life time coupling: if the inner component (the "aggregate")
+ +----------------------------------+ is disposed, the outer (the delegator) is disposed, too, and
+ ^ vice versa
+ | - UNO based, implementing XEventListener
+ |
+ +----------------------------+ component aggregating another XComponent
+ | OComponentProxyAggregation | - life time coupling as above
+ +----------------------------+ - ref-counted
+ - implements an XComponent itself
+
+ If you need to
+
+ - wrap a foreign object which is a XComponent
+ => use OComponentProxyAggregation
+ - call componentAggregateProxyFor in your ctor
+ - call implEnsureDisposeInDtor in your dtor
+
+ - wrap a foreign object which is a XComponent, but already have ref-counting mechanisms
+ inherited from somewhere else
+ => use OComponentProxyAggregationHelper
+ - override dispose - don't forget to call the base class' dispose!
+ - call componentAggregateProxyFor in your ctor
+
+ - wrap a foreign object which is no XComponent
+ => use OProxyAggregation
+ - call baseAggregateProxyFor in your ctor
+*/
+
+//.............................................................................
+namespace comphelper
+{
+//.............................................................................
+
+ //=========================================================================
+ //= OProxyAggregation
+ //=========================================================================
+ /** helper class for aggregating a proxy for a foreign object
+ */
+ class OProxyAggregation
+ {
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > m_xProxyAggregate;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider > m_xProxyTypeAccess;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+
+ protected:
+ inline const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& getComponentContext()
+ {
+ return m_xContext;
+ }
+
+ protected:
+ OProxyAggregation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext );
+ ~OProxyAggregation();
+
+ /// to be called from within your ctor
+ void baseAggregateProxyFor(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent,
+ oslInterlockedCount& _rRefCount,
+ ::cppu::OWeakObject& _rDelegator
+ );
+
+ // XInterface and XTypeProvider
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException);
+
+ private:
+ OProxyAggregation( ); // never implemented
+ OProxyAggregation( const OProxyAggregation& ); // never implemented
+ OProxyAggregation& operator=( const OProxyAggregation& ); // never implemented
+ };
+
+ //=========================================================================
+ //= OComponentProxyAggregationHelper
+ //=========================================================================
+ /** a helper class for aggregating a proxy to an XComponent
+
+ <p>The object couples the life time of itself and the component: if one of the both
+ dies (in a sense of being disposed), the other one dies, too.</p>
+
+ <p>The class itself does not implement XComponent so you need to forward any XComponent::dispose
+ calls which your derived class gets to the dispose method of this class.</p>
+ */
+
+ class COMPHELPER_DLLPUBLIC OComponentProxyAggregationHelper :public ::cppu::ImplHelper1 < com::sun::star::lang::XEventListener
+ >
+ ,private OProxyAggregation
+ {
+ private:
+ typedef ::cppu::ImplHelper1 < ::com::sun::star::lang::XEventListener
+ > BASE; // prevents some MSVC problems
+
+ protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
+ m_xInner;
+ ::cppu::OBroadcastHelper& m_rBHelper;
+
+ protected:
+ // OProxyAggregation
+ using OProxyAggregation::getComponentContext;
+
+ // XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER( )
+
+ protected:
+ OComponentProxyAggregationHelper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext,
+ ::cppu::OBroadcastHelper& _rBHelper
+ );
+ virtual ~OComponentProxyAggregationHelper( );
+
+ /// to be called from within your ctor
+ void componentAggregateProxyFor(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& _rxComponent,
+ oslInterlockedCount& _rRefCount,
+ ::cppu::OWeakObject& _rDelegator
+ );
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException );
+
+ private:
+ COMPHELPER_DLLPRIVATE OComponentProxyAggregationHelper( ); // never implemented
+ COMPHELPER_DLLPRIVATE OComponentProxyAggregationHelper( const OComponentProxyAggregationHelper& ); // never implemented
+ COMPHELPER_DLLPRIVATE OComponentProxyAggregationHelper& operator=( const OComponentProxyAggregationHelper& ); // never implemented
+ };
+
+ //=========================================================================
+ //= OComponentProxyAggregation
+ //=========================================================================
+ class COMPHELPER_DLLPUBLIC OComponentProxyAggregation :public OBaseMutex
+ ,public cppu::WeakComponentImplHelperBase
+ ,public OComponentProxyAggregationHelper
+ {
+ protected:
+ OComponentProxyAggregation(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& _rxComponent
+ );
+
+ virtual ~OComponentProxyAggregation();
+
+ // XInterface
+ DECLARE_XINTERFACE()
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing() throw (::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& _rSource ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent/OComponentProxyAggregationHelper
+ virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException );
+
+ protected:
+ // be called from within the dtor of derived classes
+ void implEnsureDisposeInDtor( );
+
+ private:
+ COMPHELPER_DLLPRIVATE OComponentProxyAggregation( ); // never implemented
+ COMPHELPER_DLLPRIVATE OComponentProxyAggregation( const OComponentProxyAggregation& ); // never implemented
+ COMPHELPER_DLLPRIVATE OComponentProxyAggregation& operator=( const OComponentProxyAggregation& ); // never implemented
+ };
+
+//.............................................................................
+} // namespace comphelper
+//.............................................................................
+
+
+#endif // COMPHELPER_PROXY_AGGREGATION
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/scoped_disposing_ptr.hxx b/include/comphelper/scoped_disposing_ptr.hxx
new file mode 100644
index 000000000000..dabf9f473e92
--- /dev/null
+++ b/include/comphelper/scoped_disposing_ptr.hxx
@@ -0,0 +1,160 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef _SCOPED_DISPOSING_PTR
+#define _SCOPED_DISPOSING_PTR
+
+#include <cppuhelper/implbase1.hxx>
+#include <boost/utility.hpp>
+#include <boost/scoped_ptr.hpp>
+
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
+
+// for locking SolarMutex: svapp + mutex
+#include <vcl/svapp.hxx>
+#include <osl/mutex.hxx>
+
+namespace comphelper
+{
+//Similar to boost::scoped_ptr, except additionally releases the ptr on XComponent::disposing and/or XTerminateListener::notifyTermination if supported
+template<class T> class scoped_disposing_ptr : private boost::noncopyable
+{
+private:
+ boost::scoped_ptr<T> m_aItem;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XTerminateListener> m_xTerminateListener;
+public:
+ scoped_disposing_ptr( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > &rComponent, T * p = 0 )
+ : m_aItem(p)
+ {
+ m_xTerminateListener = new TerminateListener(rComponent, *this);
+ }
+
+ virtual void reset(T * p = 0)
+ {
+ m_aItem.reset(p);
+ }
+
+ T & operator*() const
+ {
+ return *m_aItem;
+ }
+
+ T * get() const
+ {
+ return m_aItem.get();
+ }
+
+ T * operator->() const
+ {
+ return m_aItem.get();
+ }
+
+ operator bool () const
+ {
+ return static_cast< bool >(m_aItem);
+ }
+
+ virtual ~scoped_disposing_ptr()
+ {
+ reset();
+ }
+private:
+ class TerminateListener : public ::cppu::WeakImplHelper1< ::com::sun::star::frame::XTerminateListener >
+ {
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xComponent;
+ scoped_disposing_ptr<T>& m_rItem;
+ public:
+ TerminateListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > &rComponent,
+ scoped_disposing_ptr<T>& rItem) : m_xComponent(rComponent), m_rItem(rItem)
+ {
+ if (m_xComponent.is())
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop> xDesktop(m_xComponent, ::com::sun::star::uno::UNO_QUERY);
+ if (xDesktop.is())
+ xDesktop->addTerminateListener(this);
+ else
+ m_xComponent->addEventListener(this);
+ }
+ }
+
+ ~TerminateListener()
+ {
+ if ( m_xComponent.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop> xDesktop(m_xComponent, ::com::sun::star::uno::UNO_QUERY);
+ if (xDesktop.is())
+ xDesktop->removeTerminateListener(this);
+ else
+ m_xComponent->removeEventListener(this);
+ }
+ }
+
+ private:
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& rEvt )
+ throw (::com::sun::star::uno::RuntimeException)
+ {
+ bool shutDown = (rEvt.Source == m_xComponent);
+
+ if (shutDown && m_xComponent.is())
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop> xDesktop(m_xComponent, ::com::sun::star::uno::UNO_QUERY);
+ if (xDesktop.is())
+ xDesktop->removeTerminateListener(this);
+ else
+ m_xComponent->removeEventListener(this);
+ m_xComponent.clear();
+ }
+
+ if (shutDown)
+ m_rItem.reset();
+ }
+
+ // XTerminateListener
+ virtual void SAL_CALL queryTermination( const ::com::sun::star::lang::EventObject& )
+ throw(::com::sun::star::frame::TerminationVetoException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ }
+
+ virtual void SAL_CALL notifyTermination( const ::com::sun::star::lang::EventObject& rEvt )
+ throw (::com::sun::star::uno::RuntimeException)
+ {
+ disposing(rEvt);
+ }
+ };
+};
+
+//Something like an OutputDevice requires the SolarMutex to be taken before use
+//for threadsafety. The user can ensure this, except in the case of its dtor
+//being called from reset due to a terminate on the XComponent being called
+//from an aribitrary thread
+template<class T> class scoped_disposing_solar_mutex_reset_ptr
+ : public scoped_disposing_ptr<T>
+{
+public:
+ scoped_disposing_solar_mutex_reset_ptr( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > &rComponent, T * p = 0 )
+ : scoped_disposing_ptr<T>(rComponent, p)
+ {
+ }
+
+ virtual void reset(T * p = 0)
+ {
+ SolarMutexGuard aGuard;
+ scoped_disposing_ptr<T>::reset(p);
+ }
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/scopeguard.hxx b/include/comphelper/scopeguard.hxx
new file mode 100644
index 000000000000..5bc2aafaa781
--- /dev/null
+++ b/include/comphelper/scopeguard.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_SCOPEGUARD_HXX
+#define INCLUDED_COMPHELPER_SCOPEGUARD_HXX
+
+#include "comphelper/comphelperdllapi.h"
+#include "boost/function.hpp"
+#include "boost/noncopyable.hpp"
+#include "boost/bind.hpp"
+
+namespace comphelper {
+
+/** ScopeGuard to ease writing exception-safe code.
+ */
+class COMPHELPER_DLLPUBLIC ScopeGuard : private ::boost::noncopyable
+ // noncopyable until we have
+ // good reasons...
+{
+public:
+ enum exc_handling { IGNORE_EXCEPTIONS, ALLOW_EXCEPTIONS };
+
+ /** @param func function object to be executed in dtor
+ @param excHandling switches whether thrown exceptions in dtor will be
+ silently ignored (but OSL_ asserted)
+ */
+ template <typename func_type>
+ explicit ScopeGuard( func_type const & func,
+ exc_handling excHandling = IGNORE_EXCEPTIONS )
+ : m_func( func ), m_excHandling( excHandling ) {}
+
+ ~ScopeGuard();
+
+ /** Dismisses the scope guard, i.e. the function won't
+ be executed.
+ */
+ void dismiss();
+
+private:
+ ::boost::function0<void> m_func; // preferring portable syntax
+ exc_handling const m_excHandling;
+};
+
+} // namespace comphelper
+
+#endif // ! defined(INCLUDED_COMPHELPER_SCOPEGUARD_HXX)
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/seekableinput.hxx b/include/comphelper/seekableinput.hxx
new file mode 100644
index 000000000000..02c4997a2cb6
--- /dev/null
+++ b/include/comphelper/seekableinput.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _COMPHELPER_STREAM_SEEKABLEINPUT_HXX_
+#define _COMPHELPER_STREAM_SEEKABLEINPUT_HXX_
+
+#include <osl/mutex.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
+#include <cppuhelper/implbase2.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+namespace comphelper
+{
+
+class COMPHELPER_DLLPUBLIC OSeekableInputWrapper : public ::cppu::WeakImplHelper2< ::com::sun::star::io::XInputStream,
+ ::com::sun::star::io::XSeekable >
+{
+ ::osl::Mutex m_aMutex;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > m_xOriginalStream;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > m_xCopyInput;
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XSeekable > m_xCopySeek;
+
+private:
+ COMPHELPER_DLLPRIVATE void PrepareCopy_Impl();
+
+public:
+ OSeekableInputWrapper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
+
+ virtual ~OSeekableInputWrapper();
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > CheckSeekableCanWrap(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
+
+// XInputStream
+ virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL available() throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL closeInput() throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+
+// XSeekable
+ virtual void SAL_CALL seek( sal_Int64 location ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int64 SAL_CALL getPosition() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int64 SAL_CALL getLength() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+
+};
+
+} // namespace comphelper
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/seqstream.hxx b/include/comphelper/seqstream.hxx
new file mode 100644
index 000000000000..4f9c9380bfa1
--- /dev/null
+++ b/include/comphelper/seqstream.hxx
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _COMPHELPER_SEQSTREAM_HXX
+#define _COMPHELPER_SEQSTREAM_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
+#include <osl/mutex.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+namespace comphelper
+{
+
+ typedef ::com::sun::star::uno::Sequence<sal_Int8> ByteSequence;
+
+//==================================================================
+// SequenceInputStream
+// stream for reading data from a sequence of bytes
+//==================================================================
+
+
+class COMPHELPER_DLLPUBLIC SequenceInputStream
+: public ::cppu::WeakImplHelper2< ::com::sun::star::io::XInputStream, ::com::sun::star::io::XSeekable >
+{
+ ::osl::Mutex m_aMutex;
+ ByteSequence m_aData;
+ sal_Int32 m_nPos;
+
+public:
+ SequenceInputStream(const ByteSequence& rData);
+
+// com::sun::star::io::XInputStream
+ virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence<sal_Int8>& aData, sal_Int32 nBytesToRead )
+ throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException,
+ ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence<sal_Int8>& aData, sal_Int32 nMaxBytesToRead )
+ throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException,
+ ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip )
+ throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException,
+ ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Int32 SAL_CALL available( )
+ throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL closeInput( )
+ throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL seek( sal_Int64 location ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int64 SAL_CALL getPosition( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int64 SAL_CALL getLength( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ inline sal_Int32 avail();
+};
+typedef ::cppu::WeakImplHelper1< ::com::sun::star::io::XOutputStream > OSequenceOutputStream_Base;
+
+class OSequenceOutputStream : public OSequenceOutputStream_Base
+{
+protected:
+ ::com::sun::star::uno::Sequence< sal_Int8 >& m_rSequence;
+ double m_nResizeFactor;
+ sal_Int32 m_nMinimumResize;
+ sal_Int32 m_nMaximumResize;
+ sal_Int32 m_nSize;
+ // the size of the virtual stream. This is not the size of the sequence, but the number of bytes written
+ // into the stream at a given moment.
+
+ sal_Bool m_bConnected;
+ // closeOutput has been called ?
+
+ ::osl::Mutex m_aMutex;
+
+protected:
+ ~OSequenceOutputStream() { if (m_bConnected) closeOutput(); }
+
+public:
+ /** constructs the object. Everything written into the stream through the XOutputStream methods will be forwarded
+ to the sequence, reallocating it if neccessary. Writing will start at offset 0 within the sequence.
+ @param _rSeq a reference to the sequence which will be used for output.
+ The caller is responsible for taking care of the lifetime of the stream
+ object and the sequence. If you're in doubt about this, use <code>closeOutput</code>
+ before destroying the sequence
+ @param _nResizeFactor the factor which is used for resizing the sequence when neccessary. In every
+ resize step, the new sequence size will be calculated by multiplying the current
+ size with this factor, rounded off to the next multiple of 4.
+ @param _nMinimumResize the minmal number of bytes which is additionally allocated on resizing
+ @param _nMaximumResize as the growth of the stream size is exponential, you may want to specify a
+ maxmimum amount of memory which the sequence will grow by. If -1 is used,
+ no limit is applied
+ @see closeOutput
+ */
+ OSequenceOutputStream(
+ ::com::sun::star::uno::Sequence< sal_Int8 >& _rSeq,
+ double _nResizeFactor = 1.3,
+ sal_Int32 _nMinimumResize = 128,
+ sal_Int32 _nMaximumResize = -1
+ );
+
+ /// same as XOutputStream::writeBytes (as expected :)
+ virtual void SAL_CALL writeBytes( const ::com::sun::star::uno::Sequence< sal_Int8 >& aData ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ /// this is a dummy in this implementation, no buffering is used
+ virtual void SAL_CALL flush( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ /** closes the output stream. In the case of this class, this means that the sequence used for writing is
+ resized to the really used size and not used any further, every subsequent call to one of the XOutputStream
+ methods will throw a <code>NotConnectedException</code>.
+ */
+ virtual void SAL_CALL closeOutput( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+};
+
+} // namespace comphelper
+
+#endif //_COMPHELPER_SEQSTREAM_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/sequence.hxx b/include/comphelper/sequence.hxx
new file mode 100644
index 000000000000..ad1e8943b952
--- /dev/null
+++ b/include/comphelper/sequence.hxx
@@ -0,0 +1,369 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_SEQUENCE_HXX_
+#define _COMPHELPER_SEQUENCE_HXX_
+
+#include <algorithm> // copy algorithm
+#include <com/sun/star/uno/Sequence.hxx>
+#include <osl/diagnose.h>
+#include "comphelper/comphelperdllapi.h"
+
+#include <vector>
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+ namespace staruno = ::com::sun::star::uno;
+
+ //-------------------------------------------------------------------------
+ /** search the given string within the given sequence, return the positions where it was found.
+ if _bOnlyFirst is sal_True, only the first occurrence will be returned.
+ */
+ COMPHELPER_DLLPUBLIC staruno::Sequence<sal_Int16> findValue(const staruno::Sequence< OUString >& _rList, const OUString& _rValue, sal_Bool _bOnlyFirst = sal_False);
+
+ /** Checks if the name exists
+ *
+ * \param Value The value to search for.
+ * \param _aList The list in which to search for the value.
+ * \return <TRUE/> if the value can be found, otherwise <FALSE/>.
+ */
+ COMPHELPER_DLLPUBLIC sal_Bool existsValue(const OUString& Value,const ::com::sun::star::uno::Sequence< OUString >& _aList);
+
+
+ //-------------------------------------------------------------------------
+ namespace internal
+ {
+ template <class T>
+ void implCopySequence(const T* _pSource, T*& _pDest, sal_Int32 _nSourceLen)
+ {
+ for (sal_Int32 i=0; i<_nSourceLen; ++i, ++_pSource, ++_pDest)
+ *_pDest = *_pSource;
+ }
+ }
+ //-------------------------------------------------------------------------
+ /// concat two sequences
+ template <class T>
+ staruno::Sequence<T> concatSequences(const staruno::Sequence<T>& _rLeft, const staruno::Sequence<T>& _rRight)
+ {
+ sal_Int32 nLeft(_rLeft.getLength()), nRight(_rRight.getLength());
+ const T* pLeft = _rLeft.getConstArray();
+ const T* pRight = _rRight.getConstArray();
+
+ sal_Int32 nReturnLen(nLeft + nRight);
+ staruno::Sequence<T> aReturn(nReturnLen);
+ T* pReturn = aReturn.getArray();
+
+ internal::implCopySequence(pLeft, pReturn, nLeft);
+ internal::implCopySequence(pRight, pReturn, nRight);
+
+ return aReturn;
+ }
+
+ //-------------------------------------------------------------------------
+ /// concat three sequences
+ template <class T>
+ staruno::Sequence<T> concatSequences(const staruno::Sequence<T>& _rLeft, const staruno::Sequence<T>& _rMiddle, const staruno::Sequence<T>& _rRight)
+ {
+ sal_Int32 nLeft(_rLeft.getLength()), nMiddle(_rMiddle.getLength()), nRight(_rRight.getLength());
+ const T* pLeft = _rLeft.getConstArray();
+ const T* pMiddle = _rMiddle.getConstArray();
+ const T* pRight = _rRight.getConstArray();
+
+ sal_Int32 nReturnLen(nLeft + nMiddle + nRight);
+ staruno::Sequence<T> aReturn(nReturnLen);
+ T* pReturn = aReturn.getArray();
+
+ internal::implCopySequence(pLeft, pReturn, nLeft);
+ internal::implCopySequence(pMiddle, pReturn, nMiddle);
+ internal::implCopySequence(pRight, pReturn, nRight);
+
+ return aReturn;
+ }
+
+ //-------------------------------------------------------------------------
+ /// remove a specified element from a sequences
+ template<class T>
+ void removeElementAt(staruno::Sequence<T>& _rSeq, sal_Int32 _nPos)
+ {
+ sal_uInt32 nLength = _rSeq.getLength();
+
+ OSL_ENSURE(0 <= _nPos && (sal_uInt32)_nPos < nLength, "invalid index");
+
+ for (sal_uInt32 i = (sal_uInt32)_nPos + 1; i < nLength; ++i)
+ {
+ _rSeq[i-1] = _rSeq[i];
+ }
+
+ _rSeq.realloc(nLength-1);
+ }
+
+ //=====================================================================
+ //= iterating through sequences
+ //=====================================================================
+ /** a helper class for iterating through a sequence
+ */
+ template <class TYPE>
+ class OSequenceIterator
+ {
+ const TYPE* m_pElements;
+ sal_Int32 m_nLen;
+ const TYPE* m_pCurrent;
+
+ public:
+ /** contrcuct a sequence iterator from a sequence
+ */
+ OSequenceIterator(const ::com::sun::star::uno::Sequence< TYPE >& _rSeq);
+ /** contrcuct a sequence iterator from a Any containing a sequence
+ */
+ OSequenceIterator(const ::com::sun::star::uno::Any& _rSequenceAny);
+
+ sal_Bool hasMoreElements() const;
+ ::com::sun::star::uno::Any nextElement();
+
+ private:
+ void construct(const ::com::sun::star::uno::Sequence< TYPE >& _rSeq);
+ };
+
+ //---------------------------------------------------------------------
+ template <class TYPE>
+ OSequenceIterator<TYPE>::OSequenceIterator(const ::com::sun::star::uno::Sequence< TYPE >& _rSeq)
+ :m_pElements(NULL)
+ ,m_nLen(0)
+ ,m_pCurrent(NULL)
+ {
+ construct(_rSeq);
+ }
+
+ //---------------------------------------------------------------------
+ template <class TYPE>
+ OSequenceIterator<TYPE>::OSequenceIterator(const ::com::sun::star::uno::Any& _rSequenceAny)
+ :m_pElements(NULL)
+ ,m_nLen(0)
+ ,m_pCurrent(NULL)
+ {
+ ::com::sun::star::uno::Sequence< TYPE > aContainer;
+ sal_Bool bSuccess = _rSequenceAny >>= aContainer;
+ OSL_ENSURE(bSuccess, "OSequenceIterator::OSequenceIterator: invalid Any!");
+ (void)bSuccess;
+ construct(aContainer);
+ }
+
+ //---------------------------------------------------------------------
+ template <class TYPE>
+ void OSequenceIterator<TYPE>::construct(const ::com::sun::star::uno::Sequence< TYPE >& _rSeq)
+ {
+ m_pElements = _rSeq.getConstArray();
+ m_nLen = _rSeq.getLength();
+ m_pCurrent = m_pElements;
+ }
+
+ //---------------------------------------------------------------------
+ template <class TYPE>
+ sal_Bool OSequenceIterator<TYPE>::hasMoreElements() const
+ {
+ return m_pCurrent - m_pElements < m_nLen;
+ }
+
+ //---------------------------------------------------------------------
+ template <class TYPE>
+ ::com::sun::star::uno::Any OSequenceIterator<TYPE>::nextElement()
+ {
+ return ::com::sun::star::uno::makeAny(*m_pCurrent++);
+ }
+
+ //-------------------------------------------------------------------------
+ /** Copy from a plain C/C++ array into a Sequence.
+
+ @tpl SrcType
+ Array element type. Must be assignable to DstType
+
+ @tpl DstType
+ Sequence element type. Must be assignable from SrcType
+
+ @param i_pArray
+ Valid pointer to at least num elements of type SrcType
+
+ @param nNum
+ Number of array elements to copy
+
+ @return the resulting Sequence
+
+ @attention when copying from e.g. a double array to a
+ Sequence<int>, no proper rounding will be performed, but the
+ values will be truncated. There's currently no measure to
+ prevent or detect precision loss, overflow or truncation.
+ */
+ template < typename DstType, typename SrcType >
+ ::com::sun::star::uno::Sequence< DstType > arrayToSequence( const SrcType* i_pArray, sal_Int32 nNum )
+ {
+ ::com::sun::star::uno::Sequence< DstType > result( nNum );
+ ::std::copy( i_pArray, i_pArray+nNum, result.getArray() );
+ return result;
+ }
+
+ //-------------------------------------------------------------------------
+ /** Copy from a Sequence into a plain C/C++ array
+
+ @tpl SrcType
+ Sequence element type. Must be assignable to DstType
+
+ @tpl DstType
+ Array element type. Must be assignable from SrcType
+
+ @param io_pArray
+ Valid pointer to at least i_Sequence.getLength() elements of
+ type DstType
+
+ @param i_Sequence
+ Reference to a Sequence of SrcType elements
+
+ @return a pointer to the array
+
+ @attention when copying from e.g. a Sequence<double> to an int
+ array, no proper rounding will be performed, but the values
+ will be truncated. There's currently no measure to prevent or
+ detect precision loss, overflow or truncation.
+ */
+ template < typename DstType, typename SrcType >
+ DstType* sequenceToArray( DstType* io_pArray, const ::com::sun::star::uno::Sequence< SrcType >& i_Sequence )
+ {
+ ::std::copy( i_Sequence.getConstArray(), i_Sequence.getConstArray()+i_Sequence.getLength(), io_pArray );
+ return io_pArray;
+ }
+
+ //-------------------------------------------------------------------------
+ /** Copy from a container into a Sequence
+
+ @tpl SrcType
+ Container type. This type must fulfill the STL container
+ concept, in particular, the size(), begin() and end() methods
+ must be available and have the usual semantics.
+
+ @tpl DstType
+ Sequence element type. Must be assignable from SrcType's
+ elements
+
+ @param i_Container
+ Reference to the input contain with elements of type SrcType
+
+ @return the generated Sequence
+
+ @attention this function always performs a copy. Furthermore,
+ when copying from e.g. a vector<double> to a Sequence<int>, no
+ proper rounding will be performed, but the values will be
+ truncated. There's currently no measure to prevent or detect
+ precision loss, overflow or truncation.
+ */
+ template < typename DstType, typename SrcType >
+ ::com::sun::star::uno::Sequence< DstType > containerToSequence( const SrcType& i_Container )
+ {
+ ::com::sun::star::uno::Sequence< DstType > result( i_Container.size() );
+ ::std::copy( i_Container.begin(), i_Container.end(), result.getArray() );
+ return result;
+ }
+
+ template <typename T>
+ inline ::com::sun::star::uno::Sequence<T> containerToSequence(
+ ::std::vector<T> const& v )
+ {
+ return ::com::sun::star::uno::Sequence<T>(
+ v.empty() ? 0 : &v[0], static_cast<sal_Int32>(v.size()) );
+ }
+
+ //-------------------------------------------------------------------------
+ /** Copy from a Sequence into a container
+
+ @tpl SrcType
+ Sequence element type. Must be assignable to SrcType's
+ elements
+
+ @tpl DstType
+ Container type. This type must fulfill the STL container and
+ sequence concepts, in particular, the begin(), end() and the
+ unary constructor DstType(int) methods must be available and
+ have the usual semantics.
+
+ @param i_Sequence
+ Reference to a Sequence of SrcType elements
+
+ @return the generated container
+
+ @attention this function always performs a copy. Furthermore,
+ when copying from e.g. a Sequence<double> to a vector<int>, no
+ proper rounding will be performed, but the values will be
+ truncated. There's currently no measure to prevent or detect
+ precision loss, overflow or truncation.
+ */
+ template < typename DstType, typename SrcType >
+ DstType sequenceToContainer( const ::com::sun::star::uno::Sequence< SrcType >& i_Sequence )
+ {
+ DstType result( i_Sequence.getLength() );
+ ::std::copy( i_Sequence.getConstArray(), i_Sequence.getConstArray()+i_Sequence.getLength(), result.begin() );
+ return result;
+ }
+ //-------------------------------------------------------------------------
+ /** Copy from a Sequence into an existing container
+
+ This potentially saves a needless extra copy operation over
+ the whole container, as it passes the target object by
+ reference.
+
+ @tpl SrcType
+ Sequence element type. Must be assignable to SrcType's
+ elements
+
+ @tpl DstType
+ Container type. This type must fulfill the STL container and
+ sequence concepts, in particular, the begin(), end() and
+ resize(int) methods must be available and have the usual
+ semantics.
+
+ @param o_Output
+ Reference to the target container
+
+ @param i_Sequence
+ Reference to a Sequence of SrcType elements
+
+ @return a non-const reference to the given container
+
+ @attention this function always performs a copy. Furthermore,
+ when copying from e.g. a Sequence<double> to a vector<int>, no
+ proper rounding will be performed, but the values will be
+ truncated. There's currently no measure to prevent or detect
+ precision loss, overflow or truncation.
+ */
+ template < typename DstType, typename SrcType >
+ DstType& sequenceToContainer( DstType& o_Output, const ::com::sun::star::uno::Sequence< SrcType >& i_Sequence )
+ {
+ o_Output.resize( i_Sequence.getLength() );
+ ::std::copy( i_Sequence.getConstArray(), i_Sequence.getConstArray()+i_Sequence.getLength(), o_Output.begin() );
+ return o_Output;
+ }
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+
+#endif // _COMPHELPER_SEQUENCE_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/sequenceashashmap.hxx b/include/comphelper/sequenceashashmap.hxx
new file mode 100644
index 000000000000..0c8353776931
--- /dev/null
+++ b/include/comphelper/sequenceashashmap.hxx
@@ -0,0 +1,313 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_SEQUENCEASHASHMAP_HXX_
+#define _COMPHELPER_SEQUENCEASHASHMAP_HXX_
+
+#include <boost/unordered_map.hpp>
+
+#include <algorithm>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+
+#include <com/sun/star/beans/IllegalTypeException.hpp>
+#include "comphelper/comphelperdllapi.h"
+
+
+namespace comphelper{
+
+
+/** @short Implements a stl hash map on top of some
+ specialized sequence from type PropertyValue
+ or NamedValue.
+
+ @descr That provides the possibility to modify
+ such name sequences very easy ...
+ */
+
+struct SequenceAsHashMapBase : public ::boost::unordered_map<
+ OUString ,
+ ::com::sun::star::uno::Any ,
+ OUStringHash ,
+ ::std::equal_to< OUString > >
+{
+};
+
+class COMPHELPER_DLLPUBLIC SequenceAsHashMap : public SequenceAsHashMapBase
+{
+ //-------------------------------------------
+ public:
+
+ //---------------------------------------
+ /** @short creates an empty hash map.
+ */
+ SequenceAsHashMap();
+
+ //---------------------------------------
+ /** @see operator<<(const ::com::sun::star::uno::Any&)
+ */
+ SequenceAsHashMap(const ::com::sun::star::uno::Any& aSource);
+
+ //---------------------------------------
+ /** @see operator<<(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >&)
+ */
+ SequenceAsHashMap(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& lSource);
+
+ //---------------------------------------
+ /** @see operator<<(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >&)
+ */
+ SequenceAsHashMap(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lSource);
+
+ //---------------------------------------
+ /** @see operator<<(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >&)
+ */
+ SequenceAsHashMap(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& lSource);
+
+ //---------------------------------------
+ /** @short not realy used but maybe useful :-)
+ */
+ ~SequenceAsHashMap();
+
+ //---------------------------------------
+ /** @short fill this map from the given
+ any, which of course must contain
+ a suitable sequence of element types
+ "css.beans.PropertyValue" or "css.beans.NamedValue".
+
+ @attention If the given Any is an empty one
+ (if its set to VOID), no exception
+ is thrown. In such case this instance will
+ be created as an empty one too!
+
+ @param aSource
+ contains the new items for this map.
+
+ @throw An <type scope="com::sun::star::beans">IllegalTypeException</type>
+ is thrown, if the given any does not contain a suitable sequence ...
+ but not if its a VOID Any!
+ */
+ void operator<<(const ::com::sun::star::uno::Any& aSource);
+
+ //---------------------------------------
+ /** @short fill this map from the given
+ sequence, where every Any must contain
+ an item from type "css.beans.PropertyValue"
+ "css.beans.NamedValue".
+
+ @param lSource
+ contains the new items for this map.
+
+ @throw An <type scope="com::sun::star::beans">IllegalTypeException</type>
+ is thrown, if the given any sequence
+ uses wrong types for its items. VOID Any will be ignored!
+ */
+ void operator<<(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& lSource);
+
+ //---------------------------------------
+ /** @short fill this map from the given
+ PropertyValue sequence.
+
+ @param lSource
+ contains the new items for this map.
+ */
+ void operator<<(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lSource);
+
+ //---------------------------------------
+ /** @short fill this map from the given
+ NamedValue sequence.
+
+ @param lSource
+ contains the new items for this map.
+ */
+ void operator<<(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& lSource);
+
+ //---------------------------------------
+ /** @short converts this map instance to an
+ PropertyValue sequence.
+
+ @param lDestination
+ target sequence for converting.
+ */
+ void operator>>(::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lDestination) const;
+
+ //---------------------------------------
+ /** @short converts this map instance to an
+ NamedValue sequence.
+
+ @param lDestination
+ target sequence for converting.
+ */
+ void operator>>(::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& lDestination) const;
+
+ //---------------------------------------
+ /** @short return this map instance as an
+ Any, which can be
+ used in const environments only.
+
+ @descr Its made const to prevent using of the
+ return value directly as an in/out parameter!
+ usage: myMethod(stlDequeAdapter.getAsAnyList());
+
+ @param bAsPropertyValue
+ switch between using of PropertyValue or NamedValue as
+ value type.
+
+ @return A const Any, which
+ contains all items of this map.
+ */
+ const ::com::sun::star::uno::Any getAsConstAny(::sal_Bool bAsPropertyValue) const;
+
+ //---------------------------------------
+ /** @short return this map instance to as a
+ NamedValue sequence, which can be
+ used in const environments only.
+
+ @descr Its made const to prevent using of the
+ return value directly as an in/out parameter!
+ usage: myMethod(stlDequeAdapter.getAsNamedValueList());
+
+ @return A const sequence of type NamedValue, which
+ contains all items of this map.
+ */
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > getAsConstNamedValueList() const;
+
+ //---------------------------------------
+ /** @short return this map instance to as a
+ PropertyValue sequence, which can be
+ used in const environments only.
+
+ @descr Its made const to prevent using of the
+ return value directly as an in/out parameter!
+ usage: myMethod(stlDequeAdapter.getAsPropertyValueList());
+
+ @return A const sequence of type PropertyValue, which
+ contains all items of this map.
+ */
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > getAsConstPropertyValueList() const;
+
+ //---------------------------------------
+ /** @short check if the specified item exists
+ and return its (unpacked!) value or it returns the
+ specified default value otherwise.
+
+ @descr If a value should be extracted only in case
+ the requsted property exists realy (without creating
+ of new items as it the index operator of a
+ has_map does!) this method can be used.
+
+ @param sKey
+ key name of the item.
+
+ @param aDefault
+ the default value, which is returned
+ if the specified item could not
+ be found.
+
+ @return The (unpacked!) value of the specified property or
+ the given default value otherwise.
+
+ @attention "unpacked" means the Any content of every iterator->second!
+ */
+ template< class TValueType >
+ TValueType getUnpackedValueOrDefault(const OUString& sKey ,
+ const TValueType& aDefault) const
+ {
+ const_iterator pIt = find(sKey);
+ if (pIt == end())
+ return aDefault;
+
+ TValueType aValue = TValueType();
+ if (!(pIt->second >>= aValue))
+ return aDefault;
+
+ return aValue;
+ }
+
+ //---------------------------------------
+ /** @short creates a new item with the specified
+ name and value only in case such item name
+ does not already exist.
+
+ @descr To check if the property already exists only
+ her name is used for compare. Its value isnt
+ checked!
+
+ @param sKey
+ key name of the property.
+
+ @param aValue
+ the new (unpacked!) value.
+ Note: This value will be transformed to an Any
+ internaly, because only Any values can be
+ part of a PropertyValue or NamedValue structure.
+
+ @return TRUE if this property was added as new item;
+ FALSE if it already exists.
+ */
+ template< class TValueType >
+ sal_Bool createItemIfMissing(const OUString& sKey ,
+ const TValueType& aValue)
+ {
+ if (find(sKey) == end())
+ {
+ (*this)[sKey] = ::com::sun::star::uno::makeAny(aValue);
+ return sal_True;
+ }
+
+ return sal_False;
+ }
+
+ //---------------------------------------
+ /** @short check if all items of given map
+ exists in these called map also.
+
+ @descr Every item of the given map must exists
+ with same name and value inside these map.
+ But these map can contain additional items
+ which are not part of the search-map.
+
+ @param rCheck
+ the map containing all items for checking.
+
+ @return
+ TRUE if all items of Rcheck could be found
+ in these map; FALSE otherwise.
+ */
+ sal_Bool match(const SequenceAsHashMap& rCheck) const;
+
+ //---------------------------------------
+ /** @short merge all values from the given map into
+ this one.
+
+ @descr Existing items will be overwritten ...
+ missing items will be created new ...
+ but non specified items will stay alive !
+
+ @param rSource
+ the map containing all items for the update.
+ */
+ void update(const SequenceAsHashMap& rSource);
+};
+
+} // namespace comphelper
+
+#endif // _COMPHELPER_SEQUENCEASHASHMAP_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/sequenceasvector.hxx b/include/comphelper/sequenceasvector.hxx
new file mode 100644
index 000000000000..305eba9245ff
--- /dev/null
+++ b/include/comphelper/sequenceasvector.hxx
@@ -0,0 +1,247 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_SEQUENCEASVECTOR_HXX_
+#define _COMPHELPER_SEQUENCEASVECTOR_HXX_
+
+#include <vector>
+#include <algorithm>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <com/sun/star/beans/IllegalTypeException.hpp>
+
+
+namespace comphelper{
+
+
+/** @short Implements a stl vector on top of any
+ uno sequence.
+
+ @descr That provides the possibility to modify
+ sequences very easy ...
+ Of course this can be useful only, if
+ count of modifications is high, so copying
+ of the sequence make sense!
+ */
+template< class TElementType >
+class SequenceAsVector : public ::std::vector< TElementType >
+{
+ //-------------------------------------------
+ // types
+
+ public:
+
+ //---------------------------------------
+ /** @short When inheriting from a template using typename is generally required when using
+ types from the base! */
+ typedef typename ::std::vector< TElementType >::const_iterator const_iterator;
+
+ //---------------------------------------
+ /** @short When inheriting from a template using typename is generally required when using
+ types from the base! */
+ typedef typename ::std::vector< TElementType >::iterator iterator;
+
+ //-------------------------------------------
+ // interface
+ public:
+
+ //---------------------------------------
+ /** @short default ctor, to create an empty list.
+ */
+ SequenceAsVector()
+ {}
+
+ //---------------------------------------
+ /** @short default dtor
+ */
+ ~SequenceAsVector()
+ {}
+
+ //---------------------------------------
+ /** @short creates a new vector with the given length.
+
+ @param nLength
+ the number of elements for the new vector.
+ */
+ explicit SequenceAsVector(sal_Int32 nLength) :
+ ::std::vector< TElementType >( static_cast< size_t >( nLength ) )
+ {
+ }
+
+ //---------------------------------------
+ /** @short creates a new deque from the given uno sequence.
+
+ @param lSource
+ contains the new items for this deque.
+ */
+ SequenceAsVector(const ::com::sun::star::uno::Sequence< TElementType >& lSource)
+ {
+ (*this) << lSource;
+ }
+
+ //---------------------------------------
+ /** @short creates a new instance from the given Any, which
+ of course must contain a valid sequence using the
+ right element type for every item.
+
+ @attention If the given Any is an empty one
+ (if its set to VOID), no exception
+ is thrown. In such case this instance will
+ be created as an empty one too!
+
+ @param aSource
+ this any must contain a suitable sequence. :-)
+
+ @throw A <type scope="com::sun::star::beans">IllegalTypeException</type>
+ if an unsupported element inside this Any
+ is given. An empty Any reset this instance!
+ */
+ SequenceAsVector(const ::com::sun::star::uno::Any& aSource)
+ {
+ (*this) << aSource;
+ }
+
+ //---------------------------------------
+ /** @short fill this instance from the given uno sequence.
+
+ @param lSource
+ contains the new items for this deque.
+ */
+ void operator<<(const ::com::sun::star::uno::Sequence< TElementType >& lSource)
+ {
+ this->clear();
+
+ sal_Int32 c = lSource.getLength();
+ const TElementType* pSource = lSource.getConstArray();
+
+ for (sal_Int32 i=0; i<c; ++i)
+ this->push_back(pSource[i]);
+ }
+
+ //---------------------------------------
+ /** @short fill this instance from the given Any, which
+ of course must contain a valid sequence using the
+ right element type for every item.
+
+ @attention If the given Any is an empty one
+ (if its set to VOID), no exception
+ is thrown. In such case this instance will
+ be created as an empty one too!
+
+ @param aSource
+ this any must contain a suitable sequence. :-)
+
+ @throw A <type scope="com::sun::star::beans">IllegalTypeException</type>
+ if an unsupported element inside this Any
+ is given. An empty Any reset this instance!
+ */
+ void operator<<(const ::com::sun::star::uno::Any& aSource)
+ {
+ // An empty Any reset this instance!
+ if (!aSource.hasValue())
+ {
+ this->clear();
+ return;
+ }
+
+ ::com::sun::star::uno::Sequence< TElementType > lSource;
+ if (!(aSource >>= lSource))
+ throw ::com::sun::star::beans::IllegalTypeException(
+ OUString("SequenceAsVector operator<<(Any) was called with an unsupported Any type."),
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >());
+
+ (*this) << lSource;
+ }
+
+ //---------------------------------------
+ /** @short converts this instance to an uno sequence.
+
+ @param lDestination
+ target sequence for converting.
+ */
+ void operator>>(::com::sun::star::uno::Sequence< TElementType >& lDestination) const
+ {
+ sal_Int32 c = (sal_Int32)this->size();
+ lDestination.realloc(c);
+ TElementType* pDestination = lDestination.getArray();
+
+ sal_Int32 i = 0;
+ for (typename std::vector<TElementType>::const_iterator pThis = this->begin();
+ pThis != this->end() ;
+ ++pThis )
+ {
+ pDestination[i] = *pThis;
+ ++i;
+ }
+ }
+
+ //---------------------------------------
+ /** @short converts this instance to an uno any
+ which contains a suitable sequence
+ of items of this stl struct.
+
+ @param aDestination
+ target any for converting.
+ */
+ void operator>>(::com::sun::star::uno::Any& aDestination) const
+ {
+ sal_Int32 c = (sal_Int32)this->size();
+ ::com::sun::star::uno::Sequence< TElementType > lDestination(c);
+ TElementType* pDestination = lDestination.getArray();
+
+ sal_Int32 i = 0;
+ for (typename std::vector<TElementType>::const_iterator pThis = this->begin();
+ pThis != this->end() ;
+ ++pThis )
+ {
+ pDestination[i] = *pThis;
+ ++i;
+ }
+
+ aDestination <<= lDestination;
+ }
+
+ //---------------------------------------
+ /** @short converts this deque to a suitable uno
+ sequence which contains all items.
+
+ @attention It return a const sequence to prevent
+ the outside code against using of this
+ return value as [in/]out parameter for
+ direct function calls!
+ Of course it can be casted to non const
+ ... but then its a problem of the outside
+ code :-)
+
+ @return A (const!) sequence, which contains all items of
+ this deque.
+ */
+ const ::com::sun::star::uno::Sequence< TElementType > getAsConstList() const
+ {
+ ::com::sun::star::uno::Sequence< TElementType > lDestination;
+ (*this) >> lDestination;
+ return lDestination;
+ }
+};
+
+} // namespace comphelper
+
+#endif // _COMPHELPER_SEQUENCEASVECTOR_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/servicedecl.hxx b/include/comphelper/servicedecl.hxx
new file mode 100644
index 000000000000..be3b275cf215
--- /dev/null
+++ b/include/comphelper/servicedecl.hxx
@@ -0,0 +1,409 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef COMPHELPER_SERVICEDECL_HXX_INCLUDED
+#define COMPHELPER_SERVICEDECL_HXX_INCLUDED
+
+#include <comphelper/comphelperdllapi.h>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#include <uno/environment.h>
+#include <boost/utility.hpp>
+#include <boost/function.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/repetition.hpp>
+#include <boost/preprocessor/seq/enum.hpp>
+
+namespace comphelper {
+namespace service_decl {
+
+class ServiceDecl;
+
+namespace detail {
+typedef ::boost::function3<
+ css::uno::Reference<css::uno::XInterface> /* return */,
+ ServiceDecl const&,
+ css::uno::Sequence<css::uno::Any> const&,
+ css::uno::Reference<css::uno::XComponentContext> const&> CreateFuncF;
+}
+
+/** Class to declare a service implementation. There is no need to implement
+ lang::XServiceInfo nor lang::XInitialization anymore.
+ The declaration can be done in various ways, the (simplest) form is
+
+ <pre>
+ class MyClass : public cppu::WeakImplHelper2<XInterface1, XInterface2> {
+ public:
+ MyClass( uno::Reference<uno::XComponentContext> const& xContext )
+ [...]
+ };
+ [...]
+ namespace sdecl = comphelper::service_decl;
+ sdecl::ServiceDecl const myDecl(
+ sdecl::class_<MyClass>(),
+ "my.unique.implementation.name",
+ "MyServiceSpec1;MyServiceSpec2" );
+ </pre>
+
+ If the service demands initialization by arguments, the implementation
+ class has to define a constructor taking both arguments and component
+ context:
+
+ <pre>
+ class MyClass : public cppu::WeakImplHelper2<XInterface1, XInterface2> {
+ public:
+ MyClass( uno::Sequence<uno::Any> const& args,
+ uno::Reference<uno:XComponentContext> const& xContext )
+ [...]
+ };
+ [...]
+ namespace sdecl = comphelper::service_decl;
+ sdecl::ServiceDecl const myDecl(
+ sdecl::class_<MyClass, sdecl::with_args<true> >(),
+ "my.unique.implementation.name",
+ "MyServiceSpec1;MyServiceSpec2" );
+ </pre>
+
+ Additionally, there is the possibility to process some code after creation,
+ e.g. to add the newly created object as a listener or perform aggregation
+ (C++-UNO only):
+
+ <pre>
+ uno::Reference<uno::XInterface> somePostProcCode( MyClass * p );
+ [...]
+ namespace sdecl = comphelper::service_decl;
+ sdecl::ServiceDecl const myDecl(
+ sdecl::class_<MyClass, ... >(&somePostProcCode),
+ "my.unique.implementation.name",
+ "MyServiceSpec1;MyServiceSpec2" );
+ </pre>
+
+ In the latter case, somePostProcCode gets the yet unacquired "raw" pointer.
+*/
+class COMPHELPER_DLLPUBLIC ServiceDecl : private ::boost::noncopyable
+{
+public:
+ /** Ctor for multiple supported service names.
+
+ @param implClass implementation class description
+ @param pImplName implementation name
+ @param pSupportedServiceNames supported service names
+ @param cDelim delimiter for supported service names
+ */
+ template <typename ImplClassT>
+ ServiceDecl( ImplClassT const& implClass,
+ char const* pImplName,
+ char const* pSupportedServiceNames, char cDelim = ';' )
+ : m_createFunc(implClass.m_createFunc),
+ m_pImplName(pImplName),
+ m_pServiceNames(pSupportedServiceNames),
+ m_cDelim(cDelim) {}
+
+ /// @internal gets called by component_getFactoryHelper()
+ void * getFactory( sal_Char const* pImplName ) const;
+
+ /// @return supported service names
+ ::com::sun::star::uno::Sequence< OUString>
+ getSupportedServiceNames() const;
+
+ /// @return whether name is in set of supported service names
+ bool supportsService( OUString const& name ) const;
+
+ /// @return implementation name
+ OUString getImplementationName() const;
+
+private:
+ class Factory;
+ friend class Factory;
+
+ detail::CreateFuncF const m_createFunc;
+ char const* const m_pImplName;
+ char const* const m_pServiceNames;
+ char const m_cDelim;
+};
+
+/** To specify whether the implementation class expects arguments
+ (uno::Sequence<uno::Any>).
+*/
+template <bool> struct with_args;
+
+/// @internal
+namespace detail {
+template <typename ImplT>
+class OwnServiceImpl
+ : public ImplT,
+ private ::boost::noncopyable
+{
+ typedef ImplT BaseT;
+
+public:
+ OwnServiceImpl(
+ ServiceDecl const& rServiceDecl,
+ css::uno::Sequence<css::uno::Any> const& args,
+ css::uno::Reference<css::uno::XComponentContext> const& xContext )
+ :BaseT(args, xContext), m_rServiceDecl(rServiceDecl) {}
+ OwnServiceImpl(
+ ServiceDecl const& rServiceDecl,
+ css::uno::Reference<css::uno::XComponentContext> const& xContext )
+ : BaseT(xContext), m_rServiceDecl(rServiceDecl) {}
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName()
+ throw (css::uno::RuntimeException) {
+ return m_rServiceDecl.getImplementationName();
+ }
+ virtual sal_Bool SAL_CALL supportsService( OUString const& name )
+ throw (css::uno::RuntimeException) {
+ return m_rServiceDecl.supportsService(name);
+ }
+ virtual css::uno::Sequence< OUString>
+ SAL_CALL getSupportedServiceNames() throw (css::uno::RuntimeException) {
+ return m_rServiceDecl.getSupportedServiceNames();
+ }
+
+private:
+ ServiceDecl const& m_rServiceDecl;
+};
+
+template <typename ImplT>
+class ServiceImpl : public OwnServiceImpl< ::cppu::ImplInheritanceHelper1<ImplT,css::lang::XServiceInfo> >
+{
+typedef OwnServiceImpl< ::cppu::ImplInheritanceHelper1<ImplT,css::lang::XServiceInfo> > ServiceImpl_BASE;
+public:
+ ServiceImpl(
+ ServiceDecl const& rServiceDecl,
+ css::uno::Sequence<css::uno::Any> const& args,
+ css::uno::Reference<css::uno::XComponentContext> const& xContext )
+ : ServiceImpl_BASE(rServiceDecl, args, xContext) {}
+ ServiceImpl(
+ ServiceDecl const& rServiceDecl,
+ css::uno::Reference<css::uno::XComponentContext> const& xContext )
+ : ServiceImpl_BASE(rServiceDecl, xContext) {}
+};
+
+template <typename ServiceImplT>
+struct PostProcessDefault {
+ css::uno::Reference<css::uno::XInterface>
+ operator()( ServiceImplT * p ) const {
+ return static_cast<css::lang::XServiceInfo *>(p);
+ }
+};
+
+template <typename ImplT, typename PostProcessFuncT, typename WithArgsT>
+struct CreateFunc;
+
+template <typename ImplT, typename PostProcessFuncT>
+struct CreateFunc<ImplT, PostProcessFuncT, with_args<false> > {
+ PostProcessFuncT const m_postProcessFunc;
+ explicit CreateFunc( PostProcessFuncT const& postProcessFunc )
+ : m_postProcessFunc(postProcessFunc) {}
+
+ css::uno::Reference<css::uno::XInterface>
+ operator()( ServiceDecl const& rServiceDecl,
+ css::uno::Sequence<css::uno::Any> const&,
+ css::uno::Reference<css::uno::XComponentContext>
+ const& xContext ) const
+ {
+ return m_postProcessFunc(
+ new ImplT( rServiceDecl, xContext ) );
+ }
+};
+
+template <typename ImplT, typename PostProcessFuncT>
+struct CreateFunc<ImplT, PostProcessFuncT, with_args<true> > {
+ PostProcessFuncT const m_postProcessFunc;
+ explicit CreateFunc( PostProcessFuncT const& postProcessFunc )
+ : m_postProcessFunc(postProcessFunc) {}
+
+ css::uno::Reference<css::uno::XInterface>
+ operator()( ServiceDecl const& rServiceDecl,
+ css::uno::Sequence<css::uno::Any> const& args,
+ css::uno::Reference<css::uno::XComponentContext>
+ const& xContext ) const
+ {
+ return m_postProcessFunc(
+ new ImplT( rServiceDecl, args, xContext ) );
+ }
+};
+
+} // namespace detail
+
+/** Defines a service implementation class.
+
+ @tpl ImplT_ service implementation class
+ @WithArgsT whether the implementation class ctor expects arguments
+ (uno::Sequence<uno::Any>, uno::Reference<uno::XComponentContext>)
+ or just (uno::Reference<uno::XComponentContext>)
+*/
+template <typename ImplT_, typename WithArgsT = with_args<false> >
+struct serviceimpl_base {
+ typedef ImplT_ ImplT;
+
+ detail::CreateFuncF const m_createFunc;
+
+ typedef detail::PostProcessDefault<ImplT> PostProcessDefaultT;
+
+ /** Default ctor. Implementation class without args, expecting
+ component context as single argument.
+ */
+ serviceimpl_base() : m_createFunc(
+ detail::CreateFunc<ImplT, PostProcessDefaultT, WithArgsT>(
+ PostProcessDefaultT() ) ) {}
+
+ /** Ctor to pass a post processing function/functor.
+
+ @tpl PostProcessDefaultT let your compiler deduce this
+ @param postProcessFunc function/functor that gets the yet unacquired
+ ImplT_ pointer returning a
+ uno::Reference<uno::XInterface>
+ */
+ template <typename PostProcessFuncT>
+ explicit serviceimpl_base( PostProcessFuncT const& postProcessFunc )
+ : m_createFunc( detail::CreateFunc<ImplT, PostProcessFuncT, WithArgsT>(
+ postProcessFunc ) ) {}
+};
+
+template <typename ImplT_, typename WithArgsT = with_args<false> >
+struct class_ : public serviceimpl_base< detail::ServiceImpl<ImplT_>, WithArgsT >
+{
+ typedef serviceimpl_base< detail::ServiceImpl<ImplT_>, WithArgsT > baseT;
+ /** Default ctor. Implementation class without args, expecting
+ component context as single argument.
+ */
+ class_() : baseT() {}
+ template <typename PostProcessFuncT>
+ /** Ctor to pass a post processing function/functor.
+
+ @tpl PostProcessDefaultT let your compiler deduce this
+ @param postProcessFunc function/functor that gets the yet unacquired
+ ImplT_ pointer returning a
+ uno::Reference<uno::XInterface>
+ */
+ explicit class_( PostProcessFuncT const& postProcessFunc ) : baseT( postProcessFunc ) {}
+};
+
+//
+// component_... helpers with arbitrary service declarations:
+//
+
+#define COMPHELPER_SERVICEDECL_getFactory(z_, n_, unused_) \
+ if (pRet == 0) \
+ pRet = BOOST_PP_CAT(s, n_).getFactory(pImplName);
+
+/** The following preprocessor repetitions generate functions like
+
+ <pre>
+ inline void * component_getFactoryHelper(
+ sal_Char const* pImplName,
+ ::com::sun::star::lang::XMultiServiceFactory *,
+ ::com::sun::star::registry::XRegistryKey * xRegistryKey,
+ ServiceDecl const& s0, ServiceDecl const& s1, ... );
+ </pre>
+
+ which call on the passed service declarations.
+
+ The maximum number of service declarations can be set by defining
+ COMPHELPER_SERVICEDECL_COMPONENT_HELPER_MAX_ARGS; its default is 8.
+*/
+#define COMPHELPER_SERVICEDECL_make(z_, n_, unused_) \
+inline void * component_getFactoryHelper( \
+ sal_Char const* pImplName, \
+ ::com::sun::star::lang::XMultiServiceFactory *, \
+ ::com::sun::star::registry::XRegistryKey *, \
+ BOOST_PP_ENUM_PARAMS(n_, ServiceDecl const& s) ) \
+{ \
+ void * pRet = 0; \
+ BOOST_PP_REPEAT(n_, COMPHELPER_SERVICEDECL_getFactory, ~) \
+ return pRet; \
+}
+
+#ifndef COMPHELPER_SERVICEDECL_COMPONENT_HELPER_MAX_ARGS
+#define COMPHELPER_SERVICEDECL_COMPONENT_HELPER_MAX_ARGS 8
+#endif
+
+BOOST_PP_REPEAT_FROM_TO(1, COMPHELPER_SERVICEDECL_COMPONENT_HELPER_MAX_ARGS,
+ COMPHELPER_SERVICEDECL_make, ~)
+
+#undef COMPHELPER_SERVICEDECL_COMPONENT_HELPER_MAX_ARGS
+#undef COMPHELPER_SERVICEDECL_make
+#undef COMPHELPER_SERVICEDECL_getFactory
+
+} // namespace service_decl
+} // namespace comphelper
+
+/** The following preprocessor macro generates the C access functions,
+ that are used to initialize and register the components of a
+ shared library object.
+
+ If you have, say, written a lib that contains three distinct
+ components, each with its own ServiceDecl object, you might want
+ to employ the following code:
+
+ <pre>
+ // must reside outside _any_ namespace
+ COMPHELPER_SERVICEDECL_EXPORTS3(yourServiceDecl1,
+ yourServiceDecl2,
+ yourServiceDecl3);
+ </pre>
+
+ For your convenience, the COMPHELPER_SERVICEDECL_EXPORTS<N> macro
+ comes pre-defined up to N=8, if you should need more arguments,
+ call COMPHELPER_SERVICEDECL_make_exports directly, like this:
+
+ <pre>
+ // must reside outside _any_ namespace
+ COMPHELPER_SERVICEDECL_make_exports((yourServiceDecl1)(yourServiceDecl2)...(yourServiceDeclN));
+ </pre>
+
+ Note the missing colons between the bracketed arguments.
+ */
+#define COMPHELPER_SERVICEDECL_make_exports(compName, varargs_ ) \
+extern "C" \
+{ \
+ SAL_DLLPUBLIC_EXPORT void* SAL_CALL compName##_component_getFactory( sal_Char const* pImplName, \
+ ::com::sun::star::lang::XMultiServiceFactory* pServiceManager, \
+ ::com::sun::star::registry::XRegistryKey* pRegistryKey ) \
+ { \
+ return component_getFactoryHelper( pImplName, pServiceManager, \
+ pRegistryKey, \
+ BOOST_PP_SEQ_ENUM(varargs_) ); \
+ } \
+}
+
+#define COMPHELPER_SERVICEDECL_EXPORTS1(compName,comp0_) \
+ COMPHELPER_SERVICEDECL_make_exports(compName,(comp0_))
+#define COMPHELPER_SERVICEDECL_EXPORTS2(compName,comp0_,comp1_) \
+ COMPHELPER_SERVICEDECL_make_exports(compName,(comp0_)(comp1_))
+#define COMPHELPER_SERVICEDECL_EXPORTS3(compName,comp0_,comp1_,comp2_) \
+ COMPHELPER_SERVICEDECL_make_exports(compName,(comp0_)(comp1_)(comp2_))
+#define COMPHELPER_SERVICEDECL_EXPORTS4(compName,comp0_,comp1_,comp2_,comp3_) \
+ COMPHELPER_SERVICEDECL_make_exports(compName,(comp0_)(comp1_)(comp2_)(comp3_))
+#define COMPHELPER_SERVICEDECL_EXPORTS5(compName,comp0_,comp1_,comp2_,comp3_,comp4_) \
+ COMPHELPER_SERVICEDECL_make_exports(compName,(comp0_)(comp1_)(comp2_)(comp3_)(comp4_))
+#define COMPHELPER_SERVICEDECL_EXPORTS6(compName,comp0_,comp1_,comp2_,comp3_,comp4_,comp5_) \
+ COMPHELPER_SERVICEDECL_make_exports(compName,(comp0_)(comp1_)(comp2_)(comp3_)(comp4_)(comp5_))
+#define COMPHELPER_SERVICEDECL_EXPORTS7(compName,comp0_,comp1_,comp2_,comp3_,comp4_,comp5_,comp6_) \
+ COMPHELPER_SERVICEDECL_make_exports(compName,(comp0_)(comp1_)(comp2_)(comp3_)(comp4_)(comp5_)(comp6_))
+#define COMPHELPER_SERVICEDECL_EXPORTS8(compName,comp0_,comp1_,comp2_,comp3_,comp4_,comp5_,comp6_,comp7_) \
+ COMPHELPER_SERVICEDECL_make_exports(compName,(comp0_)(comp1_)(comp2_)(comp3_)(comp4_)(comp5_)(comp6_)(comp7_))
+
+#endif // ! defined(COMPHELPER_SERVICEDECL_HXX_INCLUDED)
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/servicehelper.hxx b/include/comphelper/servicehelper.hxx
new file mode 100644
index 000000000000..a861e88db2d7
--- /dev/null
+++ b/include/comphelper/servicehelper.hxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_SERVICEHELPER_HXX_
+#define _COMPHELPER_SERVICEHELPER_HXX_
+
+#include <rtl/uuid.h>
+#include <rtl/instance.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+class UnoTunnelIdInit
+{
+private:
+ ::com::sun::star::uno::Sequence< sal_Int8 > m_aSeq;
+public:
+ UnoTunnelIdInit() : m_aSeq(16)
+ {
+ rtl_createUuid( (sal_uInt8*)m_aSeq.getArray(), 0, sal_True );
+ }
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& getSeq() const { return m_aSeq; }
+};
+
+/** 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( 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 ) \
+namespace \
+{ \
+ class the##classname##UnoTunnelId : public rtl::Static< UnoTunnelIdInit, the##classname##UnoTunnelId> {}; \
+} \
+const ::com::sun::star::uno::Sequence< sal_Int8 > & classname::getUnoTunnelId() throw() \
+{ \
+ return the##classname##UnoTunnelId::get().getSeq(); \
+} \
+\
+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() ) \
+ 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 == memcmp( 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 == memcmp( getUnoTunnelId().getConstArray(), \
+ rId.getConstArray(), 16 ) ) \
+ { \
+ return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); \
+ } \
+ else \
+ { \
+ return baseclass::getSomething( rId ); \
+ } \
+}
+
+
+#endif // _COMPHELPER_SERVICEHELPER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/serviceinfohelper.hxx b/include/comphelper/serviceinfohelper.hxx
new file mode 100644
index 000000000000..25169d1043a0
--- /dev/null
+++ b/include/comphelper/serviceinfohelper.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_SERVICEINFOHELPER_HXX
+#define COMPHELPER_SERVICEINFOHELPER_HXX
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include "comphelper/comphelperdllapi.h"
+
+namespace comphelper {
+
+/** this class provides a basic helper for classes suporting the XServiceInfo Interface.
+ *
+ * you can overload the <code>getSupprotedServiceNames</code> to implement a XServiceInfo.
+ * you can use the static helper methods to combine your services with that of parent
+ * or aggregatet classes.
+ */
+class COMPHELPER_DLLPUBLIC ServiceInfoHelper : public ::com::sun::star::lang::XServiceInfo
+{
+public:
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+
+ // helper
+ static void addToSequence( ::com::sun::star::uno::Sequence< OUString >& rSeq, sal_uInt16 nServices, /* sal_Char* */... ) throw();
+ static sal_Bool SAL_CALL supportsService( const OUString& ServiceName, const ::com::sun::star::uno::Sequence< OUString >& SupportedServices ) throw();
+
+protected:
+ ~ServiceInfoHelper() {}
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/sharedmutex.hxx b/include/comphelper/sharedmutex.hxx
new file mode 100644
index 000000000000..8013e7f404aa
--- /dev/null
+++ b/include/comphelper/sharedmutex.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_SHAREDMUTEX_HXX
+#define COMPHELPER_SHAREDMUTEX_HXX
+
+#include "comphelper/comphelperdllapi.h"
+
+#include <osl/mutex.hxx>
+
+#include <boost/shared_ptr.hpp>
+
+//........................................................................
+namespace comphelper
+{
+//........................................................................
+
+ //============================================================
+ //= SharedMutex
+ //============================================================
+ class COMPHELPER_DLLPUBLIC SharedMutex
+ {
+ public:
+ SharedMutex();
+ SharedMutex( const SharedMutex& );
+ SharedMutex& operator=( const SharedMutex& );
+ ~SharedMutex()
+ {
+ }
+
+ inline ::osl::Mutex& getMutex() { return *m_pMutexImpl; }
+ inline operator ::osl::Mutex& () { return *m_pMutexImpl; }
+
+ private:
+ ::boost::shared_ptr< ::osl::Mutex > m_pMutexImpl;
+ };
+
+ //============================================================
+ //= SharedMutexBase
+ //============================================================
+ /** sometimes, it's necessary to have an initialized ::osl::Mutex to pass
+ to some ctor call of your base class. In this case, you can't hold the
+ SharedMutex as member, but you need to move it into another base class,
+ which is initialized before the mutex-requiring class is.
+ */
+ class COMPHELPER_DLLPUBLIC SharedMutexBase
+ {
+ protected:
+ SharedMutexBase()
+ {
+ }
+ ~SharedMutexBase()
+ {
+ }
+
+ protected:
+ ::osl::Mutex& getMutex() const { return m_aMutex; }
+ SharedMutex& getSharedMutex() const { return m_aMutex; }
+
+ private:
+ mutable SharedMutex m_aMutex;
+ };
+
+//........................................................................
+} // namespace comphelper
+//........................................................................
+
+#endif // COMPHELPER_SHAREDMUTEX_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/stillreadwriteinteraction.hxx b/include/comphelper/stillreadwriteinteraction.hxx
new file mode 100644
index 000000000000..c6d62e8da9e2
--- /dev/null
+++ b/include/comphelper/stillreadwriteinteraction.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_STILLREADWRITEINTERACTION_HXX_
+#define _COMPHELPER_STRILLREADWRITEINTERACTION_HXX_
+
+#include <ucbhelper/interceptedinteraction.hxx>
+
+#include <com/sun/star/task/XInteractionHandler.hpp>
+
+#include "comphelper/comphelperdllapi.h"
+
+
+namespace comphelper{
+class COMPHELPER_DLLPUBLIC StillReadWriteInteraction : public ::ucbhelper::InterceptedInteraction
+{
+private:
+ static const sal_Int32 HANDLE_INTERACTIVEIOEXCEPTION = 0;
+ static const sal_Int32 HANDLE_UNSUPPORTEDDATASINKEXCEPTION = 1;
+
+ sal_Bool m_bUsed;
+ sal_Bool m_bHandledByMySelf;
+ sal_Bool m_bHandledByInternalHandler;
+
+public:
+ StillReadWriteInteraction(const com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler >& xHandler);
+
+ void resetInterceptions();
+ void resetErrorStates();
+ sal_Bool wasWriteError();
+
+private:
+ virtual ucbhelper::InterceptedInteraction::EInterceptionState intercepted(const ::ucbhelper::InterceptedInteraction::InterceptedRequest& aRequest,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& xRequest);
+
+};
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/stl_types.hxx b/include/comphelper/stl_types.hxx
new file mode 100644
index 000000000000..cef5afdff3f2
--- /dev/null
+++ b/include/comphelper/stl_types.hxx
@@ -0,0 +1,273 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _COMPHELPER_STLTYPES_HXX_
+#define _COMPHELPER_STLTYPES_HXX_
+
+#include "sal/config.h"
+
+#include <vector>
+#include <map>
+
+#include <stack>
+#include <set>
+
+#include <math.h> // prevent conflict between exception and std::exception
+#include <functional>
+
+
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+
+//... namespace comphelper ................................................
+namespace comphelper
+{
+//.........................................................................
+
+//========================================================================
+// comparisation functions
+
+//------------------------------------------------------------------------
+ struct UStringLess : public ::std::binary_function< OUString, OUString, bool>
+{
+ bool operator() (const OUString& x, const OUString& y) const { return x < y ? true : false;} // construct prevents a MSVC6 warning
+};
+//------------------------------------------------------------------------
+struct UStringMixLess : public ::std::binary_function< OUString, OUString, bool>
+{
+ bool m_bCaseSensitive;
+public:
+ UStringMixLess(bool bCaseSensitive = true):m_bCaseSensitive(bCaseSensitive){}
+ bool operator() (const OUString& x, const OUString& y) const
+ {
+ if (m_bCaseSensitive)
+ return rtl_ustr_compare(x.getStr(), y.getStr()) < 0 ? true : false;
+ else
+ return rtl_ustr_compareIgnoreAsciiCase(x.getStr(), y.getStr()) < 0 ? true : false;
+ }
+
+ bool isCaseSensitive() const {return m_bCaseSensitive;}
+};
+//------------------------------------------------------------------------
+struct UStringEqual
+{
+ sal_Bool operator() (const OUString& lhs, const OUString& rhs) const { return lhs.equals( rhs );}
+};
+
+//------------------------------------------------------------------------
+struct UStringIEqual
+{
+ sal_Bool operator() (const OUString& lhs, const OUString& rhs) const { return lhs.equalsIgnoreAsciiCase( rhs );}
+};
+
+//------------------------------------------------------------------------
+class UStringMixEqual
+{
+ sal_Bool m_bCaseSensitive;
+
+public:
+ UStringMixEqual(sal_Bool bCaseSensitive = sal_True):m_bCaseSensitive(bCaseSensitive){}
+ sal_Bool operator() (const OUString& lhs, const OUString& rhs) const
+ {
+ return m_bCaseSensitive ? lhs.equals( rhs ) : lhs.equalsIgnoreAsciiCase( rhs );
+ }
+ sal_Bool isCaseSensitive() const {return m_bCaseSensitive;}
+};
+//------------------------------------------------------------------------
+class TStringMixEqualFunctor : public ::std::binary_function< OUString,OUString,bool>
+{
+ sal_Bool m_bCaseSensitive;
+
+public:
+ TStringMixEqualFunctor(sal_Bool bCaseSensitive = sal_True)
+ :m_bCaseSensitive(bCaseSensitive)
+ {}
+ bool operator() (const OUString& lhs, const OUString& rhs) const
+ {
+ return !!(m_bCaseSensitive ? lhs.equals( rhs ) : lhs.equalsIgnoreAsciiCase( rhs ));
+ }
+ sal_Bool isCaseSensitive() const {return m_bCaseSensitive;}
+};
+//------------------------------------------------------------------------
+class TPropertyValueEqualFunctor : public ::std::binary_function< ::com::sun::star::beans::PropertyValue,OUString,bool>
+{
+public:
+ TPropertyValueEqualFunctor()
+ {}
+ bool operator() (const ::com::sun::star::beans::PropertyValue& lhs, const OUString& rhs) const
+ {
+ return !!(lhs.Name == rhs);
+ }
+};
+//------------------------------------------------------------------------
+class TNamedValueEqualFunctor : public ::std::binary_function< ::com::sun::star::beans::NamedValue,OUString,bool>
+{
+public:
+ TNamedValueEqualFunctor()
+ {}
+ bool operator() (const ::com::sun::star::beans::NamedValue& lhs, const OUString& rhs) const
+ {
+ return !!(lhs.Name == rhs);
+ }
+};
+//------------------------------------------------------------------------
+class UStringMixHash
+{
+ sal_Bool m_bCaseSensitive;
+
+public:
+ UStringMixHash(sal_Bool bCaseSensitive = sal_True):m_bCaseSensitive(bCaseSensitive){}
+ size_t operator() (const OUString& rStr) const
+ {
+ return m_bCaseSensitive ? rStr.hashCode() : rStr.toAsciiUpperCase().hashCode();
+ }
+ sal_Bool isCaseSensitive() const {return m_bCaseSensitive;}
+};
+
+//=====================================================================
+//= OInterfaceCompare
+//=====================================================================
+/** is stl-compliant structure for comparing Reference&lt; &lt;iface&gt; &gt; instances
+*/
+template < class IAFCE >
+struct OInterfaceCompare
+ :public ::std::binary_function < ::com::sun::star::uno::Reference< IAFCE >
+ , ::com::sun::star::uno::Reference< IAFCE >
+ , bool
+ >
+{
+ bool operator() (const ::com::sun::star::uno::Reference< IAFCE >& lhs, const ::com::sun::star::uno::Reference< IAFCE >& rhs) const
+ {
+ return lhs.get() < rhs.get();
+ // this does not make any sense if you see the semantics of the pointer returned by get:
+ // It's a pointer to a point in memory where an interface implementation lies.
+ // But for our purpose (provide a reliable less-operator which can be used with the STL), this is
+ // sufficient ....
+ }
+};
+
+template <class _Tp, class _Arg>
+class mem_fun1_t : public ::std::binary_function<_Tp*,_Arg,void>
+{
+ typedef void (_Tp::*_fun_type)(_Arg);
+public:
+ explicit mem_fun1_t(_fun_type __pf) : _M_f(__pf) {}
+ void operator()(_Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
+private:
+ _fun_type _M_f;
+};
+
+template <class _Tp, class _Arg>
+inline mem_fun1_t<_Tp,_Arg> mem_fun(void (_Tp::*__f)(_Arg))
+{
+ return mem_fun1_t<_Tp,_Arg>(__f);
+}
+
+//.........................................................................
+/** output iterator that appends OUStrings into an OUStringBuffer.
+ */
+class OUStringBufferAppender :
+ public ::std::iterator< ::std::output_iterator_tag, void, void, void, void>
+{
+public:
+ typedef OUStringBufferAppender Self;
+ typedef ::std::output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void reference;
+ typedef void pointer;
+ typedef size_t difference_type;
+
+ OUStringBufferAppender(OUStringBuffer & i_rBuffer)
+ : m_rBuffer(i_rBuffer) { }
+ Self & operator=(OUString const & i_rStr)
+ {
+ m_rBuffer.append( i_rStr );
+ return *this;
+ }
+ Self & operator*() { return *this; } // so operator= works
+ Self & operator++() { return *this; }
+ Self & operator++(int) { return *this; }
+
+private:
+ OUStringBuffer & m_rBuffer;
+};
+
+//.........................................................................
+/** algorithm similar to std::copy, but inserts a separator between elements.
+ */
+template< typename ForwardIter, typename OutputIter, typename T >
+OutputIter intersperse(
+ ForwardIter start, ForwardIter end, OutputIter out, T const & separator)
+{
+ if (start != end) {
+ *out = *start;
+ ++start;
+ ++out;
+ }
+
+ while (start != end) {
+ *out = separator;
+ ++out;
+ *out = *start;
+ ++start;
+ ++out;
+ }
+
+ return out;
+}
+
+//.........................................................................
+}
+//... namespace comphelper ................................................
+
+//==================================================================
+// consistently defining stl-types
+//==================================================================
+
+#define DECLARE_STL_ITERATORS(classname) \
+ typedef classname::iterator classname##Iterator; \
+ typedef classname::const_iterator Const##classname##Iterator \
+
+#define DECLARE_STL_MAP(keytype, valuetype, comparefct, classname) \
+ typedef std::map< keytype, valuetype, comparefct > classname; \
+ DECLARE_STL_ITERATORS(classname) \
+
+#define DECLARE_STL_STDKEY_MAP(keytype, valuetype, classname) \
+ DECLARE_STL_MAP(keytype, valuetype, std::less< keytype >, classname) \
+
+#define DECLARE_STL_VECTOR(valuetyp, classname) \
+ typedef std::vector< valuetyp > classname; \
+ DECLARE_STL_ITERATORS(classname) \
+
+#define DECLARE_STL_USTRINGACCESS_MAP(valuetype, classname) \
+ DECLARE_STL_MAP(OUString, valuetype, ::comphelper::UStringLess, classname) \
+
+#define DECLARE_STL_STDKEY_SET(valuetype, classname) \
+ typedef ::std::set< valuetype > classname; \
+ DECLARE_STL_ITERATORS(classname) \
+
+#define DECLARE_STL_SET(valuetype, comparefct, classname) \
+ typedef ::std::set< valuetype, comparefct > classname; \
+ DECLARE_STL_ITERATORS(classname) \
+
+#endif // _COMPHELPER_STLTYPES_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/stlunosequence.hxx b/include/comphelper/stlunosequence.hxx
new file mode 100644
index 000000000000..c7b776f78d6e
--- /dev/null
+++ b/include/comphelper/stlunosequence.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_STLUNOITERATOR_HXX
+#define _COMPHELPER_STLUNOITERATOR_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <sal/types.h>
+
+
+namespace comphelper
+{
+ /**
+ @short stl-container-like access to an existing ::com::sun::star::uno::Sequence
+ @descr These template functions allows using an existing
+ ::com::sun::star::uno::Sequence using stl algorithms. They provides
+ standard-compliant mutable random access iterators. Because random access
+ iterators are the most generic iterators defined by the stl, any stl algorithm
+ can be applied to the Sequence (excluding algorithms requiring output
+ iterators).
+ <p>
+ Example: (creating a ::std::list from a ::com::sun::star::uno::Sequence)
+ <code>
+ ::com::sun::star::uno::Sequence<sal_Int32> aSeq(10);
+ ::std::list stl_list(stl_begin(aSeq), stl_end(aSeq));
+ </code>
+ <p>
+ Example: (sorting ::com::sun::star::uno::Sequence inplace)
+ <code>
+ ::com::sun::star::uno::Sequence<sal_Int32> aSeq(10);
+ ::std::sort(stl_begin(aSeq), stl_seq.end(aSeq));
+ </code>
+ <p>
+ Example: (counting occurrences of 4711 in a ::com::sun::star::uno::Sequence)
+ <code>
+ ::com::sun::star::uno::Sequence<sal_Int32> aSeq(10);
+ sal_Int32 count = 0;
+ ::std::count(stl_begin(aSeq), stl_end(aSeq), 4711, count);
+ </code>
+ <p>
+
+ @see http://www.sgi.com/tech/stl/Container.html
+ @see http://www.sgi.com/tech/stl/Sequence.html
+ @see http://www.sgi.com/tech/stl/RandomAccessIterator.html
+ */
+
+ template <typename V>
+ V* stl_begin(::com::sun::star::uno::Sequence<V>& rSeq)
+ { return rSeq.getArray(); }
+
+ template <typename V>
+ V* stl_end(::com::sun::star::uno::Sequence<V>& rSeq)
+ { return rSeq.getArray() + rSeq.getLength(); }
+
+ template <typename V>
+ const V* stl_begin(const ::com::sun::star::uno::Sequence<V>& rSeq)
+ { return rSeq.getConstArray(); }
+
+ template <typename V>
+ const V* stl_end(const ::com::sun::star::uno::Sequence<V>& rSeq)
+ { return rSeq.getConstArray() + rSeq.getLength(); }
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/storagehelper.hxx b/include/comphelper/storagehelper.hxx
new file mode 100644
index 000000000000..093038e6e5ed
--- /dev/null
+++ b/include/comphelper/storagehelper.hxx
@@ -0,0 +1,200 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef COMPHELPER_STORAGEHELPER_HXX
+#define COMPHELPER_STORAGEHELPER_HXX
+
+#include <boost/scoped_ptr.hpp>
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/embed/ElementModes.hpp>
+#include "comphelper/comphelperdllapi.h"
+
+
+#define PACKAGE_STORAGE_FORMAT_STRING OUString( "PackageFormat" )
+#define ZIP_STORAGE_FORMAT_STRING OUString( "ZipFormat" )
+#define OFOPXML_STORAGE_FORMAT_STRING OUString( "OFOPXMLFormat" )
+
+#define PACKAGE_ENCRYPTIONDATA_SHA256UTF8 OUString( "PackageSHA256UTF8EncryptionKey" )
+#define PACKAGE_ENCRYPTIONDATA_SHA1UTF8 OUString( "PackageSHA1UTF8EncryptionKey" )
+#define PACKAGE_ENCRYPTIONDATA_SHA1MS1252 OUString( "PackageSHA1MS1252EncryptionKey" )
+
+namespace com { namespace sun { namespace star {
+ namespace beans { struct NamedValue; }
+ namespace embed { class XStorage; }
+ namespace io {
+ class XInputStream;
+ class XOutputStream;
+ class XStream;
+ }
+ namespace lang { class XSingleServiceFactory; }
+ namespace uno { class XComponentContext; }
+} } }
+
+namespace comphelper {
+
+// Unfortunately - the impl.s of XStorage like to invalidate all
+// their sub streams and storages when you release references, so
+// it is necessary to keep references to all storages down the
+// path - this is 'beautiful' (TM). So we need this ugly hack:
+class COMPHELPER_DLLPUBLIC LifecycleProxy
+{
+private:
+ class Impl;
+public:
+ ::boost::scoped_ptr<Impl> m_pBadness;
+ LifecycleProxy();
+ ~LifecycleProxy();
+ // commit the storages: necessary for writes to streams to take effect!
+ void commitStorages();
+};
+
+class COMPHELPER_DLLPUBLIC OStorageHelper
+{
+public:
+ static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory >
+ GetStorageFactory(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
+ = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >() )
+ throw ( ::com::sun::star::uno::Exception );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory >
+ GetFileSystemStorageFactory(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
+ = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >() )
+ throw ( ::com::sun::star::uno::Exception );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
+ GetTemporaryStorage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
+ = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >() )
+ throw ( ::com::sun::star::uno::Exception );
+
+ /// this one will only return Storage
+ static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
+ GetStorageFromURL(
+ const OUString& aURL,
+ sal_Int32 nStorageMode,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
+ = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >() )
+ throw ( ::com::sun::star::uno::Exception );
+
+ /// this one will return either Storage or FileSystemStorage
+ static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
+ GetStorageFromURL2(
+ const OUString& aURL,
+ sal_Int32 nStorageMode,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
+ = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >() )
+
+ throw ( ::com::sun::star::uno::Exception );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
+ GetStorageFromInputStream(
+ const ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream >& xStream,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
+ = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >() )
+ throw ( ::com::sun::star::uno::Exception );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
+ GetStorageFromStream(
+ const ::com::sun::star::uno::Reference < ::com::sun::star::io::XStream >& xStream,
+ sal_Int32 nStorageMode = ::com::sun::star::embed::ElementModes::READWRITE,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
+ = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >() )
+ throw ( ::com::sun::star::uno::Exception );
+
+ static void CopyInputToOutput(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInput,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutput )
+ throw ( ::com::sun::star::uno::Exception );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ GetInputStreamFromURL(
+ const OUString& aURL,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& context )
+ throw ( ::com::sun::star::uno::Exception );
+
+ static void SetCommonStorageEncryptionData(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aEncryptionData )
+ throw ( ::com::sun::star::uno::Exception );
+
+ // the following method supports only storages of OOo formats
+ static sal_Int32 GetXStorageFormat(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage )
+ throw ( ::com::sun::star::uno::Exception );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
+ GetStorageOfFormatFromURL(
+ const OUString& aFormat,
+ const OUString& aURL,
+ sal_Int32 nStorageMode,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
+ = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >(),
+ sal_Bool bRepairStorage = sal_False )
+ throw ( ::com::sun::star::uno::Exception );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
+ GetStorageOfFormatFromInputStream(
+ const OUString& aFormat,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream >& xStream,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
+ = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >(),
+ sal_Bool bRepairStorage = sal_False )
+ throw ( ::com::sun::star::uno::Exception );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
+ GetStorageOfFormatFromStream(
+ const OUString& aFormat,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::io::XStream >& xStream,
+ sal_Int32 nStorageMode = ::com::sun::star::embed::ElementModes::READWRITE,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
+ = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >(),
+ sal_Bool bRepairStorage = sal_False )
+ throw ( ::com::sun::star::uno::Exception );
+
+ static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >
+ CreatePackageEncryptionData(
+ const OUString& aPassword );
+
+ static sal_Bool IsValidZipEntryFileName( const OUString& aName, sal_Bool bSlashAllowed );
+ static sal_Bool IsValidZipEntryFileName( const sal_Unicode *pChar, sal_Int32 nLength, sal_Bool bSlashAllowed );
+
+ static sal_Bool PathHasSegment( const OUString& aPath, const OUString& aSegment );
+
+ // Methods to allow easy use of hierachical names inside storages
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetStorageAtPath(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > &xStorage,
+ const OUString& aPath, sal_uInt32 nOpenMode, LifecycleProxy &rNastiness );
+ static ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > GetStreamAtPath(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > &xStorage,
+ const OUString& aPath, sal_uInt32 nOpenMode, LifecycleProxy &rNastiness );
+ static ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > GetStreamAtPackageURL(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > &xStorage,
+ const OUString& rURL, sal_uInt32 const nOpenMode,
+ LifecycleProxy & rNastiness );
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/streamsection.hxx b/include/comphelper/streamsection.hxx
new file mode 100644
index 000000000000..40ea508f888b
--- /dev/null
+++ b/include/comphelper/streamsection.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_STREAMSECTION_HXX_
+#define _COMPHELPER_STREAMSECTION_HXX_
+
+#include <com/sun/star/io/XMarkableStream.hpp>
+#include <com/sun/star/io/XDataInputStream.hpp>
+#include <com/sun/star/io/XDataOutputStream.hpp>
+#include "comphelper/comphelperdllapi.h"
+
+namespace comphelper
+{
+
+ namespace stario = ::com::sun::star::io;
+ namespace staruno = ::com::sun::star::uno;
+
+/** implements handling for compatibly reading/writing data from/into an input/output stream.
+ data written in a block secured by this class should be readable by older versions which
+ use the same mechanism.
+
+ @author Frank Schoenheit
+ @since 00/26/05
+*/
+
+class COMPHELPER_DLLPUBLIC OStreamSection
+{
+ staruno::Reference< stario::XMarkableStream > m_xMarkStream;
+ staruno::Reference< stario::XDataInputStream > m_xInStream;
+ staruno::Reference< stario::XDataOutputStream > m_xOutStream;
+
+ sal_Int32 m_nBlockStart;
+ sal_Int32 m_nBlockLen;
+
+public:
+ /** starts reading of a "skippable" section of data within the given input stream<BR>
+ @param _rxInput the stream to read from. Must support the
+ <type scope="com::sun::star::io">XMarkableStream</type> interface
+ */
+ OStreamSection(const staruno::Reference< stario::XDataInputStream >& _rxInput);
+
+ /** starts writing of a "skippable" section of data into the given output stream
+ @param _rxOutput the stream the stream to write to. Must support the
+ <type scope="com::sun::star::io">XMarkableStream</type> interface
+ @param _nPresumedLength estimation for the length of the upcoming section. If greater 0, this
+ value will be written as section length and corrected (in the dtor) only if
+ needed. If you know how much bytes you are about to write, you may
+ want to use this param, saving some stream operations this way.
+ */
+ OStreamSection(const staruno::Reference< stario::XDataOutputStream >& _rxOutput, sal_Int32 _nPresumedLength = 0);
+
+ /** dtor. <BR>If constructed for writing, the section "opened" by this object will be "closed".<BR>
+ If constructed for reading, any remaining bytes 'til the end of the section will be skipped.
+ */
+ ~OStreamSection();
+};
+
+} // namespace comphelper
+
+#endif // _COMPHELPER_STREAMSECTION_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/string.hxx b/include/comphelper/string.hxx
new file mode 100644
index 000000000000..85b0816b895e
--- /dev/null
+++ b/include/comphelper/string.hxx
@@ -0,0 +1,466 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_STRING_HXX
+#define INCLUDED_COMPHELPER_STRING_HXX
+
+#include "sal/config.h"
+
+#include <cstddef>
+#include "comphelper/comphelperdllapi.h"
+#include <sal/types.h>
+#include <rtl/strbuf.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/i18n/XCollator.hpp>
+#include <com/sun/star/i18n/XBreakIterator.hpp>
+
+// OUString helper functions that are not widespread or mature enough to
+// go into the stable URE API:
+namespace comphelper { namespace string {
+
+/** Compare an OString to a single char
+
+ @param rIn The input OString
+ @param c The character to compare againsg
+
+ @return true if rIn has one char and its equal to c
+ */
+inline bool equals(const OString& rIn, sal_Char c)
+{ return rIn.getLength() == 1 && rIn[0] == c; }
+
+/** Compare an OUString to a single char
+
+ @param rIn The input OUString
+ @param c The character to compare againsg
+
+ @return true if rIn has one char and its equal to c
+ */
+inline bool equals(const OUString& rIn, sal_Unicode c)
+{ return rIn.getLength() == 1 && rIn[0] == c; }
+
+/** Removes all occurrences of a character from within the source string
+
+ @deprecated Use OString::replaceAll(OString(c), OString())
+ instead.
+
+ @param rIn The input OString
+ @param c The character to be removed
+
+ @return The resulting OString
+ */
+inline OString remove(const OString &rIn,
+ sal_Char c)
+{ return rIn.replaceAll(OString(c), OString()); }
+
+/** Removes all occurrences of a character from within the source string
+
+ @deprecated Use
+ OUString::replaceAll(OUString(c), OUString()) instead.
+
+ @param rIn The input OUString
+ @param c The character to be removed
+
+ @return The resulting OUString
+ */
+inline OUString remove(const OUString &rIn,
+ sal_Unicode c)
+{ return rIn.replaceAll(OUString(c), OUString()); }
+
+/** Strips occurrences of a character from the start of the source string
+
+ @param rIn The input OString
+ @param c The character to be stripped from the start
+
+ @return The resulting OString
+ */
+COMPHELPER_DLLPUBLIC OString stripStart(const OString &rIn,
+ sal_Char c);
+
+/** Strips occurrences of a character from the start of the source string
+
+ @param rIn The input OUString
+ @param c The character to be stripped from the start
+
+ @return The resulting OUString
+ */
+COMPHELPER_DLLPUBLIC OUString stripStart(const OUString &rIn,
+ sal_Unicode c);
+
+/** Strips occurrences of a character from the end of the source string
+
+ @param rIn The input OString
+ @param c The character to be stripped from the end
+
+ @return The resulting OString
+ */
+COMPHELPER_DLLPUBLIC OString stripEnd(const OString &rIn,
+ sal_Char c);
+
+/** Strips occurrences of a character from the end of the source string
+
+ @param rIn The input OUString
+ @param c The character to be stripped from the end
+
+ @return The resulting OUString
+ */
+COMPHELPER_DLLPUBLIC OUString stripEnd(const OUString &rIn,
+ sal_Unicode c);
+
+/** Strips occurrences of a character from the start and end of the source string
+
+ @param rIn The input OString
+ @param c The character to be stripped from the start and end
+
+ @return The resulting OString
+ */
+COMPHELPER_DLLPUBLIC OString strip(const OString &rIn,
+ sal_Char c);
+
+/** Strips occurrences of a character from the start and end of the source string
+
+ @param rIn The input OUString
+ @param c The character to be stripped from the start and end
+
+ @return The resulting OUString
+ */
+COMPHELPER_DLLPUBLIC OUString strip(const OUString &rIn,
+ sal_Unicode c);
+
+/** Returns a token in an OString
+
+ @deprecated Use OString::getToken(nToken, cTok) instead.
+
+ @param rIn the input OString
+ @param nToken the number of the token to return
+ @param cTok the character which seperate the tokens.
+ @return the token if token is negative or doesn't exist an empty token
+ is returned
+*/
+inline OString getToken(const OString &rIn,
+ sal_Int32 nToken, sal_Char cTok) SAL_THROW(())
+{
+ return rIn.getToken(nToken, cTok);
+}
+
+/** Returns a token in an OUString
+
+ @deprecated Use OUString::getToken(nToken, cTok) instead.
+
+ @param rIn the input OUString
+ @param nToken the number of the token to return
+ @param cTok the character which seperate the tokens.
+ @return the token if token is negative or doesn't exist an empty token
+ is returned
+*/
+inline OUString getToken(const OUString &rIn,
+ sal_Int32 nToken, sal_Unicode cTok) SAL_THROW(())
+{
+ return rIn.getToken(nToken, cTok);
+}
+
+/** Returns number of tokens in an OUString
+
+ @param rIn the input OString
+ @param cTok the character which seperate the tokens.
+ @return the number of tokens
+*/
+COMPHELPER_DLLPUBLIC sal_Int32 getTokenCount(const OString &rIn, sal_Char cTok);
+
+/** Returns number of tokens in an OUString
+
+ @param rIn the input OUString
+ @param cTok the character which seperate the tokens.
+ @return the number of tokens
+*/
+COMPHELPER_DLLPUBLIC sal_Int32 getTokenCount(const OUString &rIn, sal_Unicode cTok);
+
+/** Reverse an OUString
+
+ @param rIn the input OUString
+ @return the reversed input
+*/
+COMPHELPER_DLLPUBLIC OUString reverseString(const OUString &rStr);
+
+/** Reverse an OString
+
+ @param rIn the input OString
+ @return the reversed input
+*/
+COMPHELPER_DLLPUBLIC OString reverseString(const OString &rStr);
+
+
+namespace detail
+{
+ template<typename B> B& truncateToLength(B& rBuffer, sal_Int32 nLen)
+ {
+ if (nLen < rBuffer.getLength())
+ rBuffer.remove(nLen, rBuffer.getLength()-nLen);
+ return rBuffer;
+ }
+}
+
+/** Truncate a buffer to a given length.
+
+ If the StringBuffer has more characters than nLength it will be truncated
+ on the right to nLength characters.
+
+ Has no effect if the StringBuffer is <= nLength
+
+ @param rBuf StringBuffer to operate on
+ @param nLength Length to truncate the buffer to
+
+ @return rBuf;
+ */
+COMPHELPER_DLLPUBLIC inline OStringBuffer& truncateToLength(
+ OStringBuffer& rBuffer, sal_Int32 nLength) SAL_THROW(())
+{
+ return detail::truncateToLength(rBuffer, nLength);
+}
+
+COMPHELPER_DLLPUBLIC inline OUStringBuffer& truncateToLength(
+ OUStringBuffer& rBuffer, sal_Int32 nLength) SAL_THROW(())
+{
+ return detail::truncateToLength(rBuffer, nLength);
+}
+
+namespace detail
+{
+ template<typename B, typename U> B& padToLength(B& rBuffer, sal_Int32 nLen,
+ U cFill = '\0')
+ {
+ sal_Int32 nOrigLen = rBuffer.getLength();
+ if (nLen > nOrigLen)
+ {
+ rBuffer.setLength(nLen);
+ for (sal_Int32 i = nOrigLen; i < nLen; ++i)
+ rBuffer[i] = cFill;
+ }
+ return rBuffer;
+ }
+}
+
+/** Pad a buffer to a given length using a given char.
+
+ If the StringBuffer has less characters than nLength it will be expanded on
+ the right to nLength characters, with the expansion filled using cFill.
+
+ Has no effect if the StringBuffer is >= nLength
+
+ @param rBuf StringBuffer to operate on
+ @param nLength Length to pad the buffer to
+ @param cFill character to fill expansion with
+
+ @return rBuf;
+ */
+COMPHELPER_DLLPUBLIC inline OStringBuffer& padToLength(
+ OStringBuffer& rBuffer, sal_Int32 nLength,
+ sal_Char cFill = '\0') SAL_THROW(())
+{
+ return detail::padToLength(rBuffer, nLength, cFill);
+}
+
+COMPHELPER_DLLPUBLIC inline OUStringBuffer& padToLength(
+ OUStringBuffer& rBuffer, sal_Int32 nLength,
+ sal_Unicode cFill = '\0') SAL_THROW(())
+{
+ return detail::padToLength(rBuffer, nLength, cFill);
+}
+
+/** Find any of a list of code units in the string.
+ @param rIn OUString to search
+ @param pChars 0-terminated array of sal_Unicode code units to search for
+ @param nPos start position
+
+ @return position of first occurrence of any of the elements of pChars
+ or -1 if none of the code units occur in the string
+ */
+COMPHELPER_DLLPUBLIC sal_Int32 indexOfAny(OUString const& rIn,
+ sal_Unicode const*const pChars, sal_Int32 const nPos = 0);
+
+/** Convert a sequence of strings to a single comma separated string.
+
+ Note that no escaping of commas or anything fancy is done.
+
+ @param i_rSeq A list of strings to be concatenated.
+
+ @return A single string containing the concatenation of the given
+ list, interspersed with the string ", ".
+ */
+COMPHELPER_DLLPUBLIC OUString convertCommaSeparated(
+ ::com::sun::star::uno::Sequence< OUString > const & i_rSeq);
+
+/** Convert a decimal string to a number.
+
+ The string must be base-10, no sign but can contain any
+ codepoint listed in the "Number, Decimal Digit" Unicode
+ category.
+
+ No verification is made about the validity of the string,
+ passing string not containing decimal digit code points
+ gives unspecified results
+
+ If your string is guaranteed to contain only ASCII digit
+ use OUString::toInt32 instead.
+
+ @param str The string to convert containing only decimal
+ digit codepoints.
+
+ @return The value of the string as an int32.
+ */
+COMPHELPER_DLLPUBLIC sal_uInt32 decimalStringToNumber(
+ OUString const & str );
+
+/** Convert a single comma separated string to a sequence of strings.
+
+ Note that no escaping of commas or anything fancy is done.
+
+ @param i_rString A string containing comma-separated words.
+
+ @return A sequence of strings resulting from splitting the given
+ string at ',' tokens and stripping whitespace.
+ */
+COMPHELPER_DLLPUBLIC ::com::sun::star::uno::Sequence< OUString >
+ convertCommaSeparated( OUString const & i_rString );
+
+/**
+ Compares two strings using natural order.
+
+ For non digit characters, the comparison use the same algorithm as
+ rtl_str_compare. When a number is encountered during the comparison,
+ natural order is used. Thus, Heading 10 will be considered as greater
+ than Heading 2. Numerical comparison is done using decimal representation.
+
+ Beware that "MyString 001" and "MyString 1" will be considered as equal
+ since leading 0 are meaningless.
+
+ @param str the object to be compared.
+ @return 0 - if both strings are equal
+ < 0 - if this string is less than the string argument
+ > 0 - if this string is greater than the string argument
+*/
+COMPHELPER_DLLPUBLIC sal_Int32 compareNatural( const OUString &rLHS, const OUString &rRHS,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCollator > &rCollator,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > &rBI,
+ const ::com::sun::star::lang::Locale &rLocale );
+
+class COMPHELPER_DLLPUBLIC NaturalStringSorter
+{
+private:
+ ::com::sun::star::lang::Locale m_aLocale;
+ ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCollator > m_xCollator;
+ ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > m_xBI;
+public:
+ NaturalStringSorter(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &rContext,
+ const ::com::sun::star::lang::Locale &rLocale);
+ sal_Int32 compare(const OUString &rLHS, const OUString &rRHS) const
+ {
+ return compareNatural(rLHS, rRHS, m_xCollator, m_xBI, m_aLocale);
+ }
+ const ::com::sun::star::lang::Locale& getLocale() const { return m_aLocale; }
+};
+
+/** Determine if an OString contains solely ASCII numeric digits
+
+ @param rString An OString
+
+ @return false if string contains any characters outside
+ the ASCII '0'-'9' range
+ true otherwise, including for empty string
+ */
+COMPHELPER_DLLPUBLIC bool isdigitAsciiString(const OString &rString);
+
+/** Determine if an OUString contains solely ASCII numeric digits
+
+ @param rString An OUString
+
+ @return false if string contains any characters outside
+ the ASCII '0'-'9' range
+ true otherwise, including for empty string
+ */
+COMPHELPER_DLLPUBLIC bool isdigitAsciiString(const OUString &rString);
+
+COMPHELPER_DLLPUBLIC inline bool isdigitAscii(sal_Unicode c)
+{
+ return ((c >= '0') && (c <= '9'));
+}
+
+COMPHELPER_DLLPUBLIC inline bool isxdigitAscii(sal_Unicode c)
+{
+ return isdigitAscii(c) || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f');
+}
+
+COMPHELPER_DLLPUBLIC inline bool islowerAscii(sal_Unicode c)
+{
+ return ((c >= 'a') && (c <= 'z'));
+}
+
+COMPHELPER_DLLPUBLIC inline bool isupperAscii(sal_Unicode c)
+{
+ return ((c >= 'A') && (c <= 'Z'));
+}
+
+COMPHELPER_DLLPUBLIC inline bool isalphaAscii(sal_Unicode c)
+{
+ return islowerAscii(c) || isupperAscii(c);
+}
+
+COMPHELPER_DLLPUBLIC inline bool isalnumAscii(sal_Unicode c)
+{
+ return isalphaAscii(c) || isdigitAscii(c);
+}
+
+//============================================================
+//= a helper for static ascii pseudo-unicode strings
+//============================================================
+struct COMPHELPER_DLLPUBLIC ConstAsciiString
+{
+ const sal_Char* ascii;
+ sal_Int32 length;
+
+ operator OUString() const
+ {
+ return OUString(ascii, length, RTL_TEXTENCODING_ASCII_US);
+ }
+};
+
+} }
+
+#ifdef RTL_FAST_STRING
+// TODO The whole ConstAsciiString class should probably be dumped
+// and replaced with plain 'const char[]'.
+namespace rtl
+{
+template<>
+struct ToStringHelper< comphelper::string::ConstAsciiString >
+ {
+ static int length( const comphelper::string::ConstAsciiString& str ) { return str.length; }
+ static sal_Unicode* addData( sal_Unicode* buffer, const comphelper::string::ConstAsciiString& str ) { return addDataLiteral( buffer, str.ascii, str.length ); }
+ static const bool allowOStringConcat = false;
+ static const bool allowOUStringConcat = true;
+ };
+}
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/synchronousdispatch.hxx b/include/comphelper/synchronousdispatch.hxx
new file mode 100644
index 000000000000..efeffea6b4eb
--- /dev/null
+++ b/include/comphelper/synchronousdispatch.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_SYNCHRONOUSDISPATCH_HXX
+#define _COMPHELPER_SYNCHRONOUSDISPATCH_HXX
+
+#include "comphelper/comphelperdllapi.h"
+
+#include "com/sun/star/uno/Reference.hxx"
+#include "com/sun/star/uno/Sequence.hxx"
+
+#include "com/sun/star/beans/PropertyValue.hpp"
+
+namespace com { namespace sun { namespace star {
+ namespace uno {
+ class XInterface; }
+ namespace lang {
+ class XComponent; }
+} } }
+
+
+//........................................................................
+namespace comphelper
+{
+//........................................................................
+
+ //====================================================================
+ //= SynchronousDispatch
+ //====================================================================
+ /** a helper class for working with the dispatch interface replacing
+ loadComponentFromURL
+ */
+ class SynchronousDispatch
+ {
+ public:
+ static COMPHELPER_DLLPUBLIC com::sun::star::uno::Reference< com::sun::star::lang::XComponent > dispatch(
+ const com::sun::star::uno::Reference< com::sun::star::uno::XInterface > &xStartPoint,
+ const OUString &sURL,
+ const OUString &sTarget,
+ const sal_Int32 nFlags,
+ const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > &lArguments );
+ };
+
+//........................................................................
+} // namespace comphelper
+//........................................................................
+
+#endif // _COMPHELPER_SYNCHRONOUSDISPATCH_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/syntaxhighlight.hxx b/include/comphelper/syntaxhighlight.hxx
new file mode 100644
index 000000000000..ef1a9486a6bf
--- /dev/null
+++ b/include/comphelper/syntaxhighlight.hxx
@@ -0,0 +1,162 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _COMPHELPER_SYNTAXHIGHLIGHT_HXX
+#define _COMPHELPER_SYNTAXHIGHLIGHT_HXX
+
+#include <vector>
+#include <rtl/ustring.hxx>
+
+#include <comphelper/comphelperdllapi.h>
+
+
+#if defined CDECL
+#undef CDECL
+#endif
+
+// for the bsearch
+#ifdef WNT
+#define CDECL _cdecl
+#endif
+#if defined(UNX)
+#define CDECL
+#endif
+#ifdef UNX
+#include <sys/resource.h>
+#endif
+
+
+// Token-Typen TT_...
+enum TokenTypes
+{
+ TT_UNKNOWN,
+ TT_IDENTIFIER,
+ TT_WHITESPACE,
+ TT_NUMBER,
+ TT_STRING,
+ TT_EOL,
+ TT_COMMENT,
+ TT_ERROR,
+ TT_OPERATOR,
+ TT_KEYWORDS,
+ TT_PARAMETER
+};
+
+struct HighlightPortion { sal_uInt16 nBegin; sal_uInt16 nEnd; TokenTypes tokenType; };
+
+
+typedef std::vector<HighlightPortion> HighlightPortions;
+
+/////////////////////////////////////////////////////////////////////////
+// Auxiliary class to support JavaScript modules, next to find functions which
+// will later will be used for syntax highlighting
+
+// Flags for character properties
+#define CHAR_START_IDENTIFIER 0x0001
+#define CHAR_IN_IDENTIFIER 0x0002
+#define CHAR_START_NUMBER 0x0004
+#define CHAR_IN_NUMBER 0x0008
+#define CHAR_IN_HEX_NUMBER 0x0010
+#define CHAR_IN_OCT_NUMBER 0x0020
+#define CHAR_START_STRING 0x0040
+#define CHAR_OPERATOR 0x0080
+#define CHAR_SPACE 0x0100
+#define CHAR_EOL 0x0200
+
+#define CHAR_EOF 0x00
+
+
+// Language mode of the Highlighter (possibly to be refined later with keyword
+// lists, C comment flags)
+enum HighlighterLanguage
+{
+ HIGHLIGHT_BASIC,
+ HIGHLIGHT_SQL
+};
+
+class SimpleTokenizer_Impl
+{
+ HighlighterLanguage aLanguage;
+ // Character information tables
+ sal_uInt16 aCharTypeTab[256];
+
+ const sal_Unicode* mpStringBegin;
+ const sal_Unicode* mpActualPos;
+
+ // Lines and columns
+ sal_uInt32 nLine;
+ sal_uInt32 nCol;
+
+ sal_Unicode peekChar( void ) { return *mpActualPos; }
+ sal_Unicode getChar( void ) { nCol++; return *mpActualPos++; }
+
+ // Auxiliary function: testing of the character flags
+ sal_Bool testCharFlags( sal_Unicode c, sal_uInt16 nTestFlags );
+
+ // Get new token, EmptyString == nothing more over there
+ sal_Bool getNextToken( /*out*/TokenTypes& reType,
+ /*out*/const sal_Unicode*& rpStartPos, /*out*/const sal_Unicode*& rpEndPos );
+
+ const char** ppListKeyWords;
+ sal_uInt16 nKeyWordCount;
+
+public:
+ SimpleTokenizer_Impl( HighlighterLanguage aLang = HIGHLIGHT_BASIC );
+ ~SimpleTokenizer_Impl( void );
+
+ sal_uInt16 parseLine( sal_uInt32 nLine, const OUString* aSource );
+ void getHighlightPortions( sal_uInt32 nParseLine, const OUString& rLine,
+ /*out*/HighlightPortions& portions );
+ void setKeyWords( const char** ppKeyWords, sal_uInt16 nCount );
+};
+
+
+//*** SyntaxHighlighter Class ***
+// Concept: the Highlighter will be notified of all changes in the source
+// (notifyChange) and returns the caller the range of lines, which based on the
+// changes, need to be highlighted again. For this the Highlighter marks all
+// lines internally whether or not C comments begin or end.
+class COMPHELPER_DLLPUBLIC SyntaxHighlighter
+{
+ HighlighterLanguage eLanguage;
+ SimpleTokenizer_Impl* m_pSimpleTokenizer;
+ char* m_pKeyWords;
+ sal_uInt16 m_nKeyWordCount;
+
+// void initializeKeyWords( HighlighterLanguage eLanguage );
+
+public:
+ SyntaxHighlighter( void );
+ ~SyntaxHighlighter( void );
+
+ // (Re-)initialize Highlighter. The line-table will be completely erased,
+ // meaning that on completion an empty Source is assumed.
+ // notifyChange() can only be given line 0
+ void initialize( HighlighterLanguage eLanguage_ );
+
+ void notifyChange( sal_uInt32 nLine, sal_Int32 nLineCountDifference,
+ const OUString* pChangedLines, sal_uInt32 nArrayLength);
+
+ void getHighlightPortions( sal_uInt32 nLine, const OUString& rLine,
+ HighlightPortions& pPortions );
+
+ HighlighterLanguage GetLanguage() { return eLanguage;}
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/types.hxx b/include/comphelper/types.hxx
new file mode 100644
index 000000000000..66c6a9e0bcfb
--- /dev/null
+++ b/include/comphelper/types.hxx
@@ -0,0 +1,174 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_TYPES_HXX_
+#define _COMPHELPER_TYPES_HXX_
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include "comphelper/comphelperdllapi.h"
+#include "cppu/unotype.hxx"
+
+namespace com { namespace sun { namespace star { namespace awt {
+ struct FontDescriptor;
+} } } }
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+ namespace staruno = ::com::sun::star::uno;
+ namespace starawt = ::com::sun::star::awt;
+ namespace starlang = ::com::sun::star::lang;
+
+ typedef staruno::Reference< staruno::XInterface > InterfaceRef;
+ typedef staruno::Sequence< OUString > StringSequence;
+
+ //-------------------------------------------------------------------------
+ /** compare the two given Anys
+ The comparison is deep, means if one of the Any's contains an Any which contains an Any ..., this is resolved <br/>
+ Other types recognized currently : FontDescriptor, ::com::sun::star::util::Date/Tim/DateTime, staruno::Sequence<sal_Int8>
+ */
+ COMPHELPER_DLLPUBLIC sal_Bool compare(const staruno::Any& rLeft, const staruno::Any& rRight);
+
+ //-------------------------------------------------------------------------
+ /** compare two FontDescriptor's
+ */
+ COMPHELPER_DLLPUBLIC sal_Bool operator ==(const starawt::FontDescriptor& _rLeft, const starawt::FontDescriptor& _rRight);
+ inline sal_Bool operator !=(const starawt::FontDescriptor& _rLeft, const starawt::FontDescriptor& _rRight)
+ {
+ return !(_rLeft == _rRight);
+ }
+
+ //-------------------------------------------------------------------------
+ /// returns sal_True if objects of the types given are "compatible"
+ COMPHELPER_DLLPUBLIC sal_Bool isAssignableFrom(const staruno::Type& _rAssignable, const staruno::Type& _rFrom);
+
+ //-------------------------------------------------------------------------
+ /** just a small shortcut ...
+ check if a type you have at hand at runtime is equal to another type you have at compile time
+ if all our compiler would accept function calls with explicit template arguments (like
+ isA<classFoo>(runtimeType)), we wouldn't need the second parameter. But unfortunally at
+ least the current solaris compiler doesn't allow this ....
+ So this function is nearly senseless ....
+ */
+ template <class TYPE>
+ sal_Bool isA(const staruno::Type& _rType, TYPE* pDummy)
+ {
+ return _rType.equals(cppu::getTypeFavourUnsigned(pDummy));
+ }
+
+ //-------------------------------------------------------------------------
+ /** check if a type you have at hand at runtime is equal to another type you have at compile time
+ same comment as for the other isA ....
+ */
+ template <class TYPE>
+ sal_Bool isA(const staruno::Any& _rVal, TYPE* pDummy)
+ {
+ return _rVal.getValueType().equals(
+ cppu::getTypeFavourUnsigned(pDummy));
+ }
+
+ //-------------------------------------------------------------------------
+ /** check if a type you have at hand at runtime is equal to another type you have at compile time
+ */
+ template <class TYPE>
+ sal_Bool isAReference(const staruno::Any& _rVal, TYPE*)
+ {
+ return _rVal.getValueType().equals(
+ cppu::getTypeFavourUnsigned(
+ static_cast<staruno::Reference<TYPE>*>(NULL)));
+ }
+
+ //-------------------------------------------------------------------------
+ /** ask the given object for an XComponent interface and dispose on it
+ */
+ template <class TYPE>
+ void disposeComponent(staruno::Reference<TYPE>& _rxComp)
+ {
+ staruno::Reference<starlang::XComponent> xComp(_rxComp, staruno::UNO_QUERY);
+ if (xComp.is())
+ {
+ xComp->dispose();
+ _rxComp = NULL;
+ }
+ }
+ //-------------------------------------------------------------------------
+ template <class TYPE>
+ sal_Bool getImplementation(TYPE*& _pObject, const staruno::Reference< staruno::XInterface >& _rxIFace)
+ {
+ _pObject = NULL;
+ staruno::Reference< starlang::XUnoTunnel > xTunnel(_rxIFace, staruno::UNO_QUERY);
+ if (xTunnel.is())
+ _pObject = reinterpret_cast< TYPE* >(xTunnel->getSomething(TYPE::getUnoTunnelImplementationId()));
+
+ return (_pObject != NULL);
+ }
+
+
+ //-------------------------------------------------------------------------
+ /** get a com::sun::star::awt::FontDescriptor that is fully initialized with
+ the XXX_DONTKNOW enum values (which isn't the case if you instantiate it
+ via the default constructor)
+ */
+ COMPHELPER_DLLPUBLIC starawt::FontDescriptor getDefaultFont();
+
+ /** examine a sequence for the <type scope="com.sun.star.uno">Type</type> of it's elements.
+ */
+ COMPHELPER_DLLPUBLIC staruno::Type getSequenceElementType(const staruno::Type& _rSequenceType);
+
+//=========================================================================
+//= replacement of the former UsrAny.getXXX methods
+
+ // may be used if you need the return value just as temporary, else it's may be too inefficient ....
+
+ // no, we don't use templates here. This would lead to a lot of implicit uses of the conversion methods,
+ // which would be difficult to trace ...
+
+ COMPHELPER_DLLPUBLIC sal_Int64 getINT64(const staruno::Any& _rAny);
+ COMPHELPER_DLLPUBLIC sal_Int32 getINT32(const staruno::Any& _rAny);
+ COMPHELPER_DLLPUBLIC sal_Int16 getINT16(const staruno::Any& _rAny);
+ COMPHELPER_DLLPUBLIC double getDouble(const staruno::Any& _rAny);
+ COMPHELPER_DLLPUBLIC float getFloat(const staruno::Any& _rAny);
+ COMPHELPER_DLLPUBLIC OUString getString(const staruno::Any& _rAny);
+ COMPHELPER_DLLPUBLIC sal_Bool getBOOL(const staruno::Any& _rAny);
+
+ COMPHELPER_DLLPUBLIC sal_Int32 getEnumAsINT32(const staruno::Any& _rAny) throw(starlang::IllegalArgumentException);
+
+//= replacement of some former UsrAny.setXXX methods - can be used with rvalues
+ inline void setBOOL(staruno::Any& _rAny, sal_Bool _b)
+ { _rAny.setValue(&_b, ::getBooleanCppuType()); }
+
+//= extension of ::cppu::makeAny()
+ inline staruno::Any makeBoolAny(sal_Bool _b)
+ { return staruno::Any(&_b, ::getBooleanCppuType()); }
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // _COMPHELPER_TYPES_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/uno3.hxx b/include/comphelper/uno3.hxx
new file mode 100644
index 000000000000..1b83c73f4f25
--- /dev/null
+++ b/include/comphelper/uno3.hxx
@@ -0,0 +1,275 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_UNO3_HXX_
+#define _COMPHELPER_UNO3_HXX_
+
+#include <osl/interlck.h>
+#include <rtl/instance.hxx>
+#include <comphelper/types.hxx>
+#include <com/sun/star/uno/XAggregation.hpp>
+#include <comphelper/sequence.hxx>
+#include <cppuhelper/typeprovider.hxx>
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+//=========================================================================
+
+ /// manipulate ref counts without calling acquire/release
+ inline oslInterlockedCount increment(oslInterlockedCount& _counter) { return osl_atomic_increment(&_counter); }
+ inline oslInterlockedCount decrement(oslInterlockedCount& _counter) { return osl_atomic_decrement(&_counter); }
+
+//=========================================================================
+
+ /** used for declaring UNO3-Defaults, i.e. acquire/release
+ */
+ #define DECLARE_UNO3_DEFAULTS(classname, baseclass) \
+ virtual void SAL_CALL acquire() throw() { baseclass::acquire(); } \
+ virtual void SAL_CALL release() throw() { baseclass::release(); } \
+ void SAL_CALL PUT_SEMICOLON_AT_THE_END()
+
+ /** used for declaring UNO3-Defaults, i.e. acquire/release if you want to forward all queryInterfaces to the base class,
+ (e.g. if you overload queryAggregation)
+ */
+ #define DECLARE_UNO3_AGG_DEFAULTS(classname, baseclass) \
+ virtual void SAL_CALL acquire() throw() { baseclass::acquire(); } \
+ virtual void SAL_CALL release() throw() { baseclass::release(); } \
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException) \
+ { return baseclass::queryInterface(_rType); } \
+ void SAL_CALL PUT_SEMICOLON_AT_THE_END()
+
+ /** Use this macro to forward XComponent methods to base class
+
+ When using the ::cppu::WeakComponentImplHelper base classes to
+ implement a UNO interface, a problem occurs when the interface
+ itself already derives from XComponent (like e.g. awt::XWindow
+ or awt::XControl): ::cppu::WeakComponentImplHelper is then
+ still abstract. Using this macro in the most derived class
+ definition provides overrides for the XComponent methods,
+ forwarding them to the given baseclass.
+
+ @param classname
+ Name of the class this macro is issued within
+
+ @param baseclass
+ Name of the baseclass that should have the XInterface methods
+ forwarded to - that's usually the WeakComponentImplHelperN base
+
+ @param implhelper
+ Name of the baseclass that should have the XComponent methods
+ forwarded to - in the case of the WeakComponentImplHelper,
+ that would be ::cppu::WeakComponentImplHelperBase
+ */
+ #define DECLARE_UNO3_XCOMPONENT_DEFAULTS(classname, baseclass, implhelper) \
+ virtual void SAL_CALL acquire() throw() { baseclass::acquire(); } \
+ virtual void SAL_CALL release() throw() { baseclass::release(); } \
+ virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException) \
+ { \
+ implhelper::dispose(); \
+ } \
+ virtual void SAL_CALL addEventListener( \
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > const & xListener ) throw (::com::sun::star::uno::RuntimeException) \
+ { \
+ implhelper::addEventListener(xListener); \
+ } \
+ virtual void SAL_CALL removeEventListener( \
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > const & xListener ) throw (::com::sun::star::uno::RuntimeException) \
+ { \
+ implhelper::removeEventListener(xListener); \
+ } \
+ void SAL_CALL PUT_SEMICOLON_AT_THE_END()
+
+
+ /** Use this macro to forward XComponent methods to base class
+
+ When using the ::cppu::WeakComponentImplHelper base classes to
+ implement a UNO interface, a problem occurs when the interface
+ itself already derives from XComponent (like e.g. awt::XWindow
+ or awt::XControl): ::cppu::WeakComponentImplHelper is then
+ still abstract. Using this macro in the most derived class
+ definition provides overrides for the XComponent methods,
+ forwarding them to the given baseclass.
+
+ @param classname
+ Name of the class this macro is issued within
+
+ @param baseclass
+ Name of the baseclass that should have the XInterface methods
+ forwarded to - that's usually the WeakComponentImplHelperN base
+
+ @param implhelper
+ Name of the baseclass that should have the XComponent methods
+ forwarded to - in the case of the WeakComponentImplHelper,
+ that would be ::cppu::WeakComponentImplHelperBase
+ */
+ #define DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS(classname, baseclass, implhelper) \
+ virtual void SAL_CALL acquire() throw() { baseclass::acquire(); } \
+ virtual void SAL_CALL release() throw() { baseclass::release(); } \
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException) \
+ { return baseclass::queryInterface(_rType); } \
+ virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException) \
+ { \
+ implhelper::dispose(); \
+ } \
+ virtual void SAL_CALL addEventListener( \
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > const & xListener ) throw (::com::sun::star::uno::RuntimeException) \
+ { \
+ implhelper::addEventListener(xListener); \
+ } \
+ virtual void SAL_CALL removeEventListener( \
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > const & xListener ) throw (::com::sun::star::uno::RuntimeException) \
+ { \
+ implhelper::removeEventListener(xListener); \
+ } \
+ void SAL_CALL PUT_SEMICOLON_AT_THE_END()
+
+
+ //=====================================================================
+ //= deriving from multiple XInterface-derived classes
+ //=====================================================================
+ //= forwarding/merging XInterface funtionality
+ //=====================================================================
+ #define DECLARE_XINTERFACE( ) \
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException); \
+ virtual void SAL_CALL acquire() throw(); \
+ virtual void SAL_CALL release() throw();
+
+ #define IMPLEMENT_FORWARD_REFCOUNT( classname, refcountbase ) \
+ void SAL_CALL classname::acquire() throw() { refcountbase::acquire(); } \
+ void SAL_CALL classname::release() throw() { refcountbase::release(); }
+
+ #define IMPLEMENT_FORWARD_XINTERFACE2( classname, refcountbase, baseclass2 ) \
+ IMPLEMENT_FORWARD_REFCOUNT( classname, refcountbase ) \
+ ::com::sun::star::uno::Any SAL_CALL classname::queryInterface( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException) \
+ { \
+ ::com::sun::star::uno::Any aReturn = refcountbase::queryInterface( _rType ); \
+ if ( !aReturn.hasValue() ) \
+ aReturn = baseclass2::queryInterface( _rType ); \
+ return aReturn; \
+ }
+
+ #define IMPLEMENT_FORWARD_XINTERFACE3( classname, refcountbase, baseclass2, baseclass3 ) \
+ IMPLEMENT_FORWARD_REFCOUNT( classname, refcountbase ) \
+ ::com::sun::star::uno::Any SAL_CALL classname::queryInterface( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException) \
+ { \
+ ::com::sun::star::uno::Any aReturn = refcountbase::queryInterface( _rType ); \
+ if ( !aReturn.hasValue() ) \
+ { \
+ aReturn = baseclass2::queryInterface( _rType ); \
+ if ( !aReturn.hasValue() ) \
+ aReturn = baseclass3::queryInterface( _rType ); \
+ } \
+ return aReturn; \
+ }
+
+ //=====================================================================
+ //= forwarding/merging XTypeProvider funtionality
+ //=====================================================================
+ #define DECLARE_XTYPEPROVIDER( ) \
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException); \
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (::com::sun::star::uno::RuntimeException);
+
+ #define IMPLEMENT_GET_IMPLEMENTATION_ID( classname ) \
+ namespace \
+ { \
+ class the##classname##ImplementationId : public rtl::Static< ::cppu::OImplementationId, the##classname##ImplementationId> {}; \
+ } \
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL classname::getImplementationId( ) throw (::com::sun::star::uno::RuntimeException) \
+ { \
+ return the##classname##ImplementationId::get().getImplementationId(); \
+ }
+
+ #define IMPLEMENT_FORWARD_XTYPEPROVIDER2( classname, baseclass1, baseclass2 ) \
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL classname::getTypes( ) throw (::com::sun::star::uno::RuntimeException) \
+ { \
+ return ::comphelper::concatSequences( \
+ baseclass1::getTypes(), \
+ baseclass2::getTypes() \
+ ); \
+ } \
+ \
+ IMPLEMENT_GET_IMPLEMENTATION_ID( classname )
+
+ #define IMPLEMENT_FORWARD_XTYPEPROVIDER3( classname, baseclass1, baseclass2, baseclass3 ) \
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL classname::getTypes( ) throw (::com::sun::star::uno::RuntimeException) \
+ { \
+ return ::comphelper::concatSequences( \
+ baseclass1::getTypes(), \
+ baseclass2::getTypes(), \
+ baseclass3::getTypes() \
+ ); \
+ } \
+ \
+ IMPLEMENT_GET_IMPLEMENTATION_ID( classname )
+
+//=========================================================================
+
+ /** ask for an iface of an aggregated object
+ usage:<br/>
+ Reference<XFoo> xFoo;<br/>
+ if (query_aggregation(xAggregatedObject, xFoo))<br/>
+ ....
+ */
+ template <class iface>
+ sal_Bool query_aggregation(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation >& _rxAggregate, ::com::sun::star::uno::Reference<iface>& _rxOut)
+ {
+ _rxOut = static_cast<iface*>(NULL);
+ if (_rxAggregate.is())
+ {
+ ::com::sun::star::uno::Any aCheck = _rxAggregate->queryAggregation(
+ iface::static_type());
+ if (aCheck.hasValue())
+ _rxOut = *(::com::sun::star::uno::Reference<iface>*)aCheck.getValue();
+ }
+ return _rxOut.is();
+ }
+
+ /** ask for an iface of an object
+ usage:<br/>
+ Reference<XFoo> xFoo;<br/>
+ if (query_interface(xAnything, xFoo))<br/>
+ ....
+ */
+ template <class iface>
+ sal_Bool query_interface(const InterfaceRef& _rxObject, ::com::sun::star::uno::Reference<iface>& _rxOut)
+ {
+ _rxOut = static_cast<iface*>(NULL);
+ if (_rxObject.is())
+ {
+ ::com::sun::star::uno::Any aCheck = _rxObject->queryInterface(
+ iface::static_type());
+ if(aCheck.hasValue())
+ {
+ _rxOut = *(::com::sun::star::uno::Reference<iface>*)aCheck.getValue();
+ return _rxOut.is();
+ }
+ }
+ return sal_False;
+ }
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // _COMPHELPER_UNO3_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/unwrapargs.hxx b/include/comphelper/unwrapargs.hxx
new file mode 100644
index 000000000000..c4885f3883d9
--- /dev/null
+++ b/include/comphelper/unwrapargs.hxx
@@ -0,0 +1,138 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_UNWRAPARGS_HXX_INCLUDED
+#define COMPHELPER_UNWRAPARGS_HXX_INCLUDED
+
+#include "rtl/ustrbuf.hxx"
+#include "com/sun/star/uno/Sequence.hxx"
+#include "com/sun/star/lang/IllegalArgumentException.hpp"
+#include "boost/optional.hpp"
+#include "boost/preprocessor/cat.hpp"
+#include "boost/preprocessor/repetition.hpp"
+#include "boost/preprocessor/arithmetic/add.hpp"
+#include "cppu/unotype.hxx"
+
+namespace comphelper {
+
+//
+// generating helper functions to unwrap the service's argument sequence:
+//
+
+/// @internal
+namespace detail {
+
+template <typename T>
+inline void extract(
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any> const& seq,
+ sal_Int32 nArg, T & v,
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>
+ const& xErrorContext )
+{
+ if (nArg >= seq.getLength()) {
+ throw ::com::sun::star::lang::IllegalArgumentException(
+ OUString( "No such argument available!"),
+ xErrorContext, static_cast<sal_Int16>(nArg) );
+ }
+ if (! (seq[nArg] >>= v)) {
+ OUStringBuffer buf;
+ buf.append( "Cannot extract ANY { " );
+ buf.append( seq[nArg].getValueType().getTypeName() );
+ buf.append( " } to " );
+ buf.append( ::cppu::UnoType<T>::get().getTypeName() );
+ buf.append( static_cast<sal_Unicode>('!') );
+ throw ::com::sun::star::lang::IllegalArgumentException(
+ buf.makeStringAndClear(), xErrorContext,
+ static_cast<sal_Int16>(nArg) );
+ }
+}
+
+template <typename T>
+inline void extract(
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any> const& seq,
+ sal_Int32 nArg, ::boost::optional<T> & v,
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>
+ const& xErrorContext )
+{
+ if (nArg < seq.getLength()) {
+ T t;
+ extract( seq, nArg, t, xErrorContext );
+ v.reset( t );
+ }
+}
+
+} // namespace detail
+
+#define COMPHELPER_UNWRAPARGS_extract(z_, n_, unused_) \
+ detail::extract( seq, n_, BOOST_PP_CAT(v, n_), xErrorContext );
+#define COMPHELPER_UNWRAPARGS_args(z_, n_, unused_) \
+ BOOST_PP_CAT(T, n_) & BOOST_PP_CAT(v, n_)
+
+/** The following preprocessor repetitions generate functions like
+
+ <pre>
+ template <typename T0, typename T1, ...>
+ inline void unwrapArgs(
+ uno::Sequence<uno::Any> const& seq,
+ T0 & v0, T1 & v1, ...,
+ css::uno::Reference<css::uno::XInterface> const& xErrorContext =
+ css::uno::Reference<css::uno::XInterface>() );
+ </pre>
+ (full namespace qualification ::com::sun::star has been omitted
+ for brevity)
+
+ which unwraps the passed sequence's elements, assigning them to the
+ referenced values. Specify optional arguments as boost::optional<T>.
+ If the length of the sequence is greater than the count of arguments,
+ then the latter sequence elements are ignored.
+ If too few arguments are given in the sequence and a missing argument is
+ no boost::optional<T>, then an lang::IllegalArgumentException is thrown
+ with the specified xErrorContext (defaults to null-ref).
+
+ The maximum number of service declarations can be set by defining
+ COMPHELPER_UNWRAPARGS_MAX_ARGS; its default is 12.
+*/
+#define COMPHELPER_UNWRAPARGS_make(z_, n_, unused_) \
+template < BOOST_PP_ENUM_PARAMS( BOOST_PP_ADD(n_, 1), typename T) > \
+inline void unwrapArgs( \
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > const& seq, \
+ BOOST_PP_ENUM(BOOST_PP_ADD(n_, 1), COMPHELPER_UNWRAPARGS_args, ~), \
+ ::com::sun::star::uno::Reference< \
+ ::com::sun::star::uno::XInterface> const& xErrorContext = \
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>() ) \
+{ \
+ BOOST_PP_REPEAT(BOOST_PP_ADD(n_, 1), COMPHELPER_UNWRAPARGS_extract, ~) \
+}
+
+#ifndef COMPHELPER_UNWRAPARGS_MAX_ARGS
+#define COMPHELPER_UNWRAPARGS_MAX_ARGS 12
+#endif
+
+BOOST_PP_REPEAT(COMPHELPER_UNWRAPARGS_MAX_ARGS, COMPHELPER_UNWRAPARGS_make, ~)
+
+#undef COMPHELPER_UNWRAPARGS_MAX_ARGS
+#undef COMPHELPER_UNWRAPARGS_make
+#undef COMPHELPER_UNWRAPARGS_args
+#undef COMPHELPER_UNWRAPARGS_extract
+
+} // namespace comphelper
+
+#endif // ! defined(COMPHELPER_UNWRAPARGS_HXX_INCLUDED)
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/weak.hxx b/include/comphelper/weak.hxx
new file mode 100644
index 000000000000..126078adbf59
--- /dev/null
+++ b/include/comphelper/weak.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _COMPHELPER_WEAK_HXX_
+#define _COMPHELPER_WEAK_HXX_
+
+#include "comphelper/comphelperdllapi.h"
+
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <cppuhelper/weak.hxx>
+
+namespace comphelper
+{
+/** Base class to implement an UNO object supporting types and weak references, i.e. the object can be held
+ weakly (by a ::com::sun::star::uno::WeakReference).
+ This implementation copes with reference counting. Upon last release(), the virtual dtor
+ is called.
+
+ In addition to the features from cppu::OWeakObject, derivations from this class can
+ also used as a base class for ::cppu::ImplInheritanceHelper?
+*/
+class COMPHELPER_DLLPUBLIC OWeakTypeObject : public ::cppu::OWeakObject, public ::com::sun::star::lang::XTypeProvider
+{
+public:
+ OWeakTypeObject();
+ virtual ~OWeakTypeObject();
+
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type & rType ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw ();
+ virtual void SAL_CALL release() throw ();
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL getImplementationId( ) throw (::com::sun::star::uno::RuntimeException);
+
+};
+
+}
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/weakbag.hxx b/include/comphelper/weakbag.hxx
new file mode 100644
index 000000000000..b654baa2bda4
--- /dev/null
+++ b/include/comphelper/weakbag.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_WEAKBAG_HXX
+#define INCLUDED_COMPHELPER_WEAKBAG_HXX
+
+#include "sal/config.h"
+
+#include <list>
+#include "com/sun/star/uno/Reference.hxx"
+#include "cppuhelper/weakref.hxx"
+#include "osl/diagnose.h"
+
+namespace comphelper {
+
+/**
+ A bag of UNO weak references.
+*/
+template< typename T > class WeakBag {
+public:
+ /**
+ Add a new weak reference.
+
+ The implementation keeps the amount of memory consumed linear in the
+ number of living references added, not linear in the number of total
+ references added.
+
+ @param e
+ a non-null reference.
+ */
+ void add(com::sun::star::uno::Reference< T > const & e) {
+ OSL_ASSERT(e.is());
+ for (typename WeakReferenceList::iterator i(m_list.begin()); i != m_list.end();) {
+ if (com::sun::star::uno::Reference< T >(*i).is()) {
+ ++i;
+ } else {
+ i = m_list.erase(i);
+ }
+ }
+ m_list.push_back(com::sun::star::uno::WeakReference< T >(e));
+ }
+
+ /**
+ Remove a living reference.
+
+ @return
+ a living reference, or null if there are none.
+ */
+ com::sun::star::uno::Reference< T > remove() {
+ while (!m_list.empty()) {
+ com::sun::star::uno::Reference< T > r(m_list.front());
+ m_list.pop_front();
+ if (r.is()) {
+ return r;
+ }
+ }
+ return com::sun::star::uno::Reference< T >();
+ }
+
+private:
+ typedef std::list< com::sun::star::uno::WeakReference< T > > WeakReferenceList;
+
+ WeakReferenceList m_list;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/weakeventlistener.hxx b/include/comphelper/weakeventlistener.hxx
new file mode 100644
index 000000000000..33defc8a36c9
--- /dev/null
+++ b/include/comphelper/weakeventlistener.hxx
@@ -0,0 +1,182 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_WEAKEVENTLISTENER_HXX
+#define COMPHELPER_WEAKEVENTLISTENER_HXX
+
+#include <cppuhelper/compbase1.hxx>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/uno/XWeak.hpp>
+#include <cppuhelper/weakref.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+ //=====================================================================
+ //= OWeakListenerAdapterBase
+ //=====================================================================
+ /** (the base for) an adapter which allows to add as listener to a foreign component, without
+ being held hard.
+
+ <p>The idea is that this adapter is added as listener to a foreign component, which usually
+ holds it's listener hard. The adapter itself knows the real listener as weak reference,
+ thus not affecting it's life time.</p>
+ */
+ class OWeakListenerAdapterBase : public OBaseMutex
+ {
+ private:
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface >
+ m_aListener;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+ m_xBroadcaster;
+
+ protected:
+ inline ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+ getListener( ) const
+ {
+ return m_aListener.get();
+ }
+
+ inline const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >&
+ getBroadcaster( ) const
+ {
+ return m_xBroadcaster;
+ }
+
+ inline void resetListener( )
+ {
+ m_aListener.clear();
+ }
+
+
+ protected:
+ inline OWeakListenerAdapterBase(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XWeak >& _rxListener,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxBroadcaster
+ )
+ :m_aListener ( _rxListener )
+ ,m_xBroadcaster ( _rxBroadcaster )
+ {
+ }
+
+ protected:
+ virtual ~OWeakListenerAdapterBase();
+ };
+
+
+ //=====================================================================
+ //= OWeakListenerAdapter
+ //=====================================================================
+ template< class BROADCASTER, class LISTENER >
+ /** yet another base for weak listener adapters, this time with some type safety
+
+ <p>Note that derived classes need to overwrite all virtual methods of their interface
+ except XEventListener::disposing, and forward it to their master listener.</p>
+
+ <p>Addtionally, derived classes need to add themself as listener to the broadcaster,
+ as this can't be done in a generic way</p>
+ */
+ class OWeakListenerAdapter
+ :public ::cppu::WeakComponentImplHelper1 < LISTENER >
+ ,public OWeakListenerAdapterBase
+ {
+ protected:
+ /** ctor
+ <p>Note that derived classes still need to add themself as listener to the broadcaster,
+ as this can't be done in a generic way</p>
+ */
+ OWeakListenerAdapter(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XWeak >& _rxListener,
+ const ::com::sun::star::uno::Reference< BROADCASTER >& _rxBroadcaster
+ );
+
+ protected:
+ inline ::com::sun::star::uno::Reference< LISTENER > getListener( ) const
+ {
+ return ::com::sun::star::uno::Reference< LISTENER >( OWeakListenerAdapterBase::getListener(), ::com::sun::star::uno::UNO_QUERY );
+ }
+
+ // XEventListener overridables
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+
+ protected:
+ // OComponentHelper overridables
+ // to be overridden, again - the derived class should revoke the listener from the broadcaster
+ virtual void SAL_CALL disposing( ) = 0;
+ };
+
+ //=====================================================================
+ //= OWeakEventListenerAdapter
+ //=====================================================================
+ typedef OWeakListenerAdapter < ::com::sun::star::lang::XComponent
+ , ::com::sun::star::lang::XEventListener
+ > OWeakEventListenerAdapter_Base;
+ /** the most simple listener adapter: for XEventListeners at XComponents
+ */
+ class COMPHELPER_DLLPUBLIC OWeakEventListenerAdapter : public OWeakEventListenerAdapter_Base
+ {
+ public:
+ OWeakEventListenerAdapter(
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XWeak > _rxListener,
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > _rxBroadcaster
+ );
+
+ // nothing to do except an own ctor - the forwarding of the "disposing" is already done
+ // in the base class
+
+ protected:
+ using OWeakEventListenerAdapter_Base::disposing;
+ virtual void SAL_CALL disposing( );
+ };
+
+ //=====================================================================
+ //= OWeakListenerAdapter
+ //=====================================================================
+ //---------------------------------------------------------------------
+ template< class BROADCASTER, class LISTENER >
+ OWeakListenerAdapter< BROADCASTER, LISTENER >::OWeakListenerAdapter(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XWeak >& _rxListener,
+ const ::com::sun::star::uno::Reference< BROADCASTER >& _rxBroadcaster
+ )
+ : ::cppu::WeakComponentImplHelper1< LISTENER >( m_aMutex )
+ , OWeakListenerAdapterBase( _rxListener, _rxBroadcaster )
+ {
+ }
+
+ //---------------------------------------------------------------------
+ template< class BROADCASTER, class LISTENER >
+ void SAL_CALL OWeakListenerAdapter< BROADCASTER, LISTENER >::disposing( const ::com::sun::star::lang::EventObject& _rSource ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ ::com::sun::star::uno::Reference< LISTENER > xListener( getListener() );
+ if ( xListener.is() )
+ xListener->disposing( _rSource );
+ }
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif// COMPHELPER_WEAKEVENTLISTENER_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/xmltools.hxx b/include/comphelper/xmltools.hxx
new file mode 100644
index 000000000000..d8287dd4a89b
--- /dev/null
+++ b/include/comphelper/xmltools.hxx
@@ -0,0 +1,28 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef _XMLCHAFF_HXX
+#define _XMLCHAFF_HXX
+
+#include <rtl/strbuf.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <comphelper/comphelperdllapi.h>
+
+namespace comphelper
+{
+ namespace xml
+ {
+ COMPHELPER_DLLPUBLIC OString makeXMLChaff();
+ }
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/BlobHelper.hxx b/include/connectivity/BlobHelper.hxx
new file mode 100644
index 000000000000..6788a17b10df
--- /dev/null
+++ b/include/connectivity/BlobHelper.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _CONNECTIVITY_BLOBHELPER_HXX_
+#define _CONNECTIVITY_BLOBHELPER_HXX_
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <com/sun/star/sdbc/XBlob.hpp>
+#include <cppuhelper/implbase1.hxx>
+
+namespace connectivity
+{
+ class OOO_DLLPUBLIC_DBTOOLS BlobHelper : public ::cppu::WeakImplHelper1< com::sun::star::sdbc::XBlob >
+ {
+ ::com::sun::star::uno::Sequence< sal_Int8 > m_aValue;
+ public:
+ BlobHelper(const ::com::sun::star::uno::Sequence< sal_Int8 >& _val);
+ private:
+ virtual ::sal_Int64 SAL_CALL length( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL getBytes( ::sal_Int64 pos, ::sal_Int32 length ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int64 SAL_CALL position( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& pattern, ::sal_Int64 start ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int64 SAL_CALL positionOfBlob( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& pattern, ::sal_Int64 start ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ };
+}
+
+#endif //_CONNECTIVITY_BLOBHELPER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/CommonTools.hxx b/include/connectivity/CommonTools.hxx
new file mode 100644
index 000000000000..c13b97dc7050
--- /dev/null
+++ b/include/connectivity/CommonTools.hxx
@@ -0,0 +1,215 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_
+#define _CONNECTIVITY_COMMONTOOLS_HXX_
+
+#include <rtl/ref.hxx>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#ifndef _VECTOR_
+#include <vector>
+#endif
+#include <cppuhelper/weakref.hxx>
+#include <comphelper/stl_types.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <osl/interlck.h>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace com { namespace sun { namespace star { namespace util {
+ struct Date;
+ struct DateTime;
+ struct Time;
+}
+}}}
+
+#ifdef SOLAR_JAVA
+namespace jvmaccess { class VirtualMachine; }
+#endif
+
+namespace connectivity
+{
+ //------------------------------------------------------------------------------
+ OOO_DLLPUBLIC_DBTOOLS sal_Bool match(const sal_Unicode* pWild, const sal_Unicode* pStr, const sal_Unicode cEscape);
+ inline sal_Bool match(const OUString &rWild, const OUString &rStr, const sal_Unicode cEscape)
+ {
+ return match(rWild.getStr(), rStr.getStr(), cEscape);
+ }
+ //------------------------------------------------------------------------------
+ OOO_DLLPUBLIC_DBTOOLS OUString toDateString(const ::com::sun::star::util::Date& rDate);
+ OOO_DLLPUBLIC_DBTOOLS OUString toTimeString(const ::com::sun::star::util::Time& rTime);
+ OOO_DLLPUBLIC_DBTOOLS OUString toDateTimeString(const ::com::sun::star::util::DateTime& rDateTime);
+
+ // typedefs
+ typedef std::vector< ::com::sun::star::uno::WeakReferenceHelper > OWeakRefArray;
+ typedef ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier> OSQLTable;
+
+ DECLARE_STL_MAP(OUString,OSQLTable,comphelper::UStringMixLess, OSQLTables);
+
+ // -------------------------------------------------------------------------
+ // class ORefVector allows reference counting on a std::vector
+ // -------------------------------------------------------------------------
+ template< class VectorVal > class ORefVector
+ {
+ std::vector< VectorVal > m_vector;
+ oslInterlockedCount m_refCount;
+
+ protected:
+ virtual ~ORefVector(){}
+ public:
+ typedef std::vector< VectorVal > Vector;
+
+ ORefVector() : m_refCount(0) {}
+ ORefVector(size_t _st) : m_vector(_st) , m_refCount(0) {}
+ ORefVector(const ORefVector& _rRH) : m_vector(_rRH.m_vector),m_refCount(0)
+ {
+ }
+ ORefVector& operator=(const ORefVector& _rRH)
+ {
+ if ( &_rRH != this )
+ {
+ m_vector = _rRH.m_vector;
+ }
+ return *this;
+ }
+
+ std::vector< VectorVal > & get() { return m_vector; }
+ std::vector< VectorVal > const & get() const { return m_vector; }
+
+ inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW(())
+ { return ::rtl_allocateMemory( nSize ); }
+ inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW(())
+ { ::rtl_freeMemory( pMem ); }
+ inline static void * SAL_CALL operator new( size_t, void * pMem ) SAL_THROW(())
+ { return pMem; }
+ inline static void SAL_CALL operator delete( void *, void * ) SAL_THROW(())
+ {}
+
+ void acquire()
+ {
+ osl_atomic_increment( &m_refCount );
+ }
+ void release()
+ {
+ if (! osl_atomic_decrement( &m_refCount ))
+ delete this;
+ }
+
+ };
+ // -------------------------------------------------------------------------
+ // class ORowVector incudes refcounting and initialze himself
+ // with at least one element. This first element is reserved for
+ // the bookmark
+ // -------------------------------------------------------------------------
+ template< class VectorVal > class ORowVector : public ORefVector< VectorVal >
+ {
+ public:
+ ORowVector() : ORefVector< VectorVal >(1){}
+ ORowVector(size_t _st) : ORefVector< VectorVal >(_st+1)
+ {}
+ };
+
+ typedef ORefVector< ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> > OSQLColumns;
+
+ // =======================================================================================
+ // search from __first to __last the column with the name _rVal
+ // when no such column exist __last is returned
+ OOO_DLLPUBLIC_DBTOOLS
+ OSQLColumns::Vector::const_iterator find( OSQLColumns::Vector::const_iterator __first,
+ OSQLColumns::Vector::const_iterator __last,
+ const OUString& _rVal,
+ const ::comphelper::UStringMixEqual& _rCase);
+ // =======================================================================================
+ // search from __first to __last the column with the realname _rVal
+ // when no such column exist __last is returned
+ OOO_DLLPUBLIC_DBTOOLS
+ OSQLColumns::Vector::const_iterator findRealName( OSQLColumns::Vector::const_iterator __first,
+ OSQLColumns::Vector::const_iterator __last,
+ const OUString& _rVal,
+ const ::comphelper::UStringMixEqual& _rCase);
+
+ // =======================================================================================
+ // the first two find methods are much faster than the one below
+ // =======================================================================================
+ // search from __first to __last the column with the property _rProp equals the value _rVal
+ // when no such column exist __last is returned
+ OOO_DLLPUBLIC_DBTOOLS
+ OSQLColumns::Vector::const_iterator find( OSQLColumns::Vector::const_iterator __first,
+ OSQLColumns::Vector::const_iterator __last,
+ const OUString& _rProp,
+ const OUString& _rVal,
+ const ::comphelper::UStringMixEqual& _rCase);
+
+ OOO_DLLPUBLIC_DBTOOLS void checkDisposed(sal_Bool _bThrow) throw ( ::com::sun::star::lang::DisposedException );
+
+#ifdef SOLAR_JAVA
+ /** creates a java virtual machine
+ @param _rxContext
+ The ORB.
+ @return
+ The JavaVM.
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::rtl::Reference< jvmaccess::VirtualMachine > getJavaVM(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext);
+
+ /** return <TRUE/> if the java class exists, otherwise <FALSE/>.
+ @param _pJVM
+ The JavaVM.
+ @param _sClassName
+ The class name to look for.
+ */
+ OOO_DLLPUBLIC_DBTOOLS sal_Bool existsJavaClassByName( const ::rtl::Reference< jvmaccess::VirtualMachine >& _pJVM,const OUString& _sClassName );
+#endif
+}
+
+//==================================================================================
+
+#define DECLARE_SERVICE_INFO() \
+ virtual OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); \
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); \
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) \
+
+#define IMPLEMENT_SERVICE_INFO(classname, implasciiname, serviceasciiname) \
+ OUString SAL_CALL classname::getImplementationName( ) throw (::com::sun::star::uno::RuntimeException) \
+ { \
+ return OUString::createFromAscii(implasciiname); \
+ } \
+ ::com::sun::star::uno::Sequence< OUString > SAL_CALL classname::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) \
+ { \
+ ::com::sun::star::uno::Sequence< OUString > aSupported(1); \
+ aSupported[0] = OUString::createFromAscii(serviceasciiname); \
+ return aSupported; \
+ } \
+ sal_Bool SAL_CALL classname::supportsService( const OUString& _rServiceName ) throw(::com::sun::star::uno::RuntimeException) \
+ { \
+ Sequence< OUString > aSupported(getSupportedServiceNames()); \
+ const OUString* pSupported = aSupported.getConstArray(); \
+ const OUString* pEnd = pSupported + aSupported.getLength(); \
+ for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) \
+ ; \
+ \
+ return pSupported != pEnd; \
+ } \
+
+//==================================================================================
+
+#endif // _CONNECTIVITY_COMMONTOOLS_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/ConnectionWrapper.hxx b/include/connectivity/ConnectionWrapper.hxx
new file mode 100644
index 000000000000..84a828800a9c
--- /dev/null
+++ b/include/connectivity/ConnectionWrapper.hxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_ZCONNECTIONWRAPPER_HXX_
+#define _CONNECTIVITY_ZCONNECTIONWRAPPER_HXX_
+
+#include <cppuhelper/implbase2.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <comphelper/broadcasthelper.hxx>
+#include "connectivity/CommonTools.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace connectivity
+{
+
+ //==========================================================================
+ //= OConnectionWrapper - wraps all methods to the real connection from the driver
+ //= but when disposed it doesn't dispose the real connection
+ //==========================================================================
+ typedef ::cppu::ImplHelper2< ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::lang::XUnoTunnel
+ > OConnection_BASE;
+
+ class OOO_DLLPUBLIC_DBTOOLS OConnectionWrapper : public OConnection_BASE
+ {
+ protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > m_xProxyConnection;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xConnection;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider > m_xTypeProvider;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > m_xUnoTunnel;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo > m_xServiceInfo;
+
+ virtual ~OConnectionWrapper();
+ void setDelegation(::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation >& _rxProxyConnection,oslInterlockedCount& _rRefCount);
+ void setDelegation(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext
+ ,oslInterlockedCount& _rRefCount);
+ // must be called from derived classes
+ void disposing();
+ public:
+ OConnectionWrapper( );
+
+ // XServiceInfo
+ DECLARE_SERVICE_INFO();
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // com::sun::star::lang::XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
+ /** method to create unique ids
+ @param _rURL
+ The URL.
+ @param _rInfo
+ The info property of the datasource. It will be resorted if needed.
+ @param _pBuffer
+ Here we store the digest. Must not NULL.
+ @param _rUserName
+ The user name.
+ @param _rPassword
+ The password.
+ */
+ static void createUniqueId( const OUString& _rURL
+ ,::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rInfo
+ ,sal_uInt8* _pBuffer
+ ,const OUString& _rUserName = OUString()
+ ,const OUString& _rPassword = OUString());
+ };
+}
+#endif // _CONNECTIVITY_ZCONNECTIONWRAPPER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/DriversConfig.hxx b/include/connectivity/DriversConfig.hxx
new file mode 100644
index 000000000000..69c28cacbb02
--- /dev/null
+++ b/include/connectivity/DriversConfig.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED
+#define CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED
+
+#include <comphelper/stl_types.hxx>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/uno/Sequence.h>
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <salhelper/singletonref.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+#include <unotools/confignode.hxx>
+
+namespace connectivity
+{
+ typedef struct
+ {
+ ::comphelper::NamedValueCollection aProperties;
+ ::comphelper::NamedValueCollection aFeatures;
+ ::comphelper::NamedValueCollection aMetaData;
+ OUString sDriverFactory;
+ OUString sDriverTypeDisplayName;
+ } TInstalledDriver;
+ DECLARE_STL_USTRINGACCESS_MAP( TInstalledDriver, TInstalledDrivers);
+
+ class DriversConfigImpl
+ {
+ mutable ::utl::OConfigurationTreeRoot m_aInstalled;
+ mutable TInstalledDrivers m_aDrivers;
+ void Load(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB) const;
+ public:
+ DriversConfigImpl();
+
+ const TInstalledDrivers& getInstalledDrivers(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB) const { Load(_rxORB); return m_aDrivers; }
+ };
+ //
+ // Allows to access all driver which are located in the configuration
+ //
+ class OOO_DLLPUBLIC_DBTOOLS DriversConfig
+ {
+ typedef salhelper::SingletonRef<DriversConfigImpl> OSharedConfigNode;
+
+ const ::comphelper::NamedValueCollection& impl_get(const OUString& _sURL,sal_Int32 _nProps) const;
+ public:
+ DriversConfig(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB);
+ ~DriversConfig();
+
+ DriversConfig( const DriversConfig& );
+ DriversConfig& operator=( const DriversConfig& );
+
+ OUString getDriverFactoryName(const OUString& _sUrl) const;
+ OUString getDriverTypeDisplayName(const OUString& _sUrl) const;
+ const ::comphelper::NamedValueCollection& getProperties(const OUString& _sURL) const;
+ const ::comphelper::NamedValueCollection& getFeatures(const OUString& _sURL) const;
+ const ::comphelper::NamedValueCollection& getMetaData(const OUString& _sURL) const;
+ ::com::sun::star::uno::Sequence< OUString > getURLs() const;
+ private:
+ OSharedConfigNode m_aNode;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xORB;
+ };
+}
+#endif // CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/FValue.hxx b/include/connectivity/FValue.hxx
new file mode 100644
index 000000000000..34e73612bfa1
--- /dev/null
+++ b/include/connectivity/FValue.hxx
@@ -0,0 +1,539 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_FILE_VALUE_HXX_
+#define _CONNECTIVITY_FILE_VALUE_HXX_
+
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <rtl/ustring.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+#include <osl/diagnose.h>
+#include <comphelper/stl_types.hxx>
+#include <rtl/ref.hxx>
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/CommonTools.hxx"
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/util/Time.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/sdb/XColumn.hpp>
+
+namespace connectivity
+{
+ namespace detail
+ {
+ class IValueSource;
+ }
+
+ class OOO_DLLPUBLIC_DBTOOLS ORowSetValue
+ {
+ union
+ {
+ bool m_bBool;
+
+ sal_Int8 m_nInt8;
+ sal_uInt8 m_uInt8;
+
+ sal_Int16 m_nInt16;
+ sal_uInt16 m_uInt16;
+
+ sal_Int32 m_nInt32;
+ sal_uInt32 m_uInt32;
+
+ sal_Int64 m_nInt64;
+ sal_uInt64 m_uInt64;
+
+ float m_nFloat;
+ double m_nDouble;
+
+ rtl_uString* m_pString;
+
+ void* m_pValue; // date/time/timestamp/sequence
+ } m_aValue;
+
+ sal_Int32 m_eTypeKind; // the database type
+ bool m_bNull : 1; // value is null
+ bool m_bBound : 1; // is bound
+ bool m_bModified : 1; // value was changed
+ bool m_bSigned : 1; // value is signed
+
+ void free();
+
+ public:
+ ORowSetValue()
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::VARCHAR)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = NULL;
+ }
+
+ ORowSetValue(const ORowSetValue& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::VARCHAR)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(const OUString& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::VARCHAR)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(const double& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::DOUBLE)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(const float& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::FLOAT)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(const sal_Int8& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::TINYINT)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(const sal_uInt8& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::TINYINT)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(false)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+ ORowSetValue(const sal_Int16& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::SMALLINT)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+ ORowSetValue(const sal_uInt16& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::SMALLINT)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(false)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+ ORowSetValue(const sal_Int32& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::INTEGER)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+ ORowSetValue(const sal_uInt32& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::INTEGER)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(false)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+ ORowSetValue(const sal_Int64& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::BIGINT)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+ ORowSetValue(const sal_uInt64& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::BIGINT)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(false)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(const bool& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::BIT)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(const ::com::sun::star::util::Date& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::DATE)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(const ::com::sun::star::util::Time& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::TIME)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(const ::com::sun::star::util::DateTime& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::TIMESTAMP)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(const ::com::sun::star::uno::Sequence<sal_Int8>& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::LONGVARBINARY)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+
+ ~ORowSetValue()
+ {
+ free();
+ }
+
+ inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW(())
+ { return ::rtl_allocateMemory( nSize ); }
+ inline static void * SAL_CALL operator new( size_t,void* _pHint ) SAL_THROW(())
+ { return _pHint; }
+ inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW(())
+ { ::rtl_freeMemory( pMem ); }
+ inline static void SAL_CALL operator delete( void *,void* ) SAL_THROW(())
+ { }
+
+ ORowSetValue& operator=(const ORowSetValue& _rRH);
+
+ // simple types
+ ORowSetValue& operator=(const bool _rRH);
+
+ ORowSetValue& operator=(const sal_Int8& _rRH);
+ ORowSetValue& operator=(const sal_uInt8& _rRH);
+
+ ORowSetValue& operator=(const sal_Int16& _rRH);
+ ORowSetValue& operator=(const sal_uInt16& _rRH);
+
+ ORowSetValue& operator=(const sal_Int32& _rRH);
+ ORowSetValue& operator=(const sal_uInt32& _rRH);
+
+ ORowSetValue& operator=(const sal_Int64& _rRH);
+ ORowSetValue& operator=(const sal_uInt64& _rRH);
+
+ ORowSetValue& operator=(const double& _rRH);
+ ORowSetValue& operator=(const float& _rRH);
+
+ // ADT's
+ ORowSetValue& operator=(const ::com::sun::star::util::Date& _rRH);
+ ORowSetValue& operator=(const ::com::sun::star::util::Time& _rRH);
+ ORowSetValue& operator=(const ::com::sun::star::util::DateTime& _rRH);
+
+ ORowSetValue& operator=(const OUString& _rRH);
+ // the type isn't set it will be set to VARCHAR if the type is different change it
+ ORowSetValue& operator=(const ::com::sun::star::uno::Sequence<sal_Int8>& _rRH);
+ // we the possiblity to save a any for bookmarks
+ ORowSetValue& operator=(const ::com::sun::star::uno::Any& _rAny);
+
+ operator bool() const { return isNull() ? false : getBool(); }
+ operator sal_Int8() const { return isNull() ? static_cast<sal_Int8>(0) : getInt8(); }
+ operator sal_uInt8() const { return isNull() ? static_cast<sal_uInt8>(0) : getUInt8(); }
+
+ operator sal_Int16() const { return isNull() ? static_cast<sal_Int16>(0) : getInt16(); }
+ operator sal_uInt16() const { return isNull() ? static_cast<sal_uInt16>(0) : getUInt16(); }
+
+ operator sal_Int32() const { return isNull() ? 0 : getInt32(); }
+ operator sal_uInt32() const { return isNull() ? 0 : getUInt32(); }
+
+ operator sal_Int64() const { return isNull() ? 0 : getLong(); }
+ operator sal_uInt64() const { return isNull() ? 0 : getULong(); }
+
+ operator float() const { return isNull() ? (float)0.0: getFloat(); }
+ operator double() const { return isNull() ? 0.0 : getDouble(); }
+
+ operator OUString() const
+ {
+ return isNull() ? OUString() : getString();
+ }
+
+ operator ::com::sun::star::util::Date() const
+ {
+ return isNull() ? ::com::sun::star::util::Date() : getDate();
+ }
+
+ operator ::com::sun::star::util::Time() const
+ {
+ return isNull() ? ::com::sun::star::util::Time() : getTime();
+ }
+
+ operator ::com::sun::star::util::DateTime() const
+ {
+ return isNull() ? ::com::sun::star::util::DateTime() : getDateTime();
+ }
+
+ operator ::com::sun::star::uno::Sequence<sal_Int8>() const
+ {
+ return isNull() ? ::com::sun::star::uno::Sequence<sal_Int8>() : getSequence();
+ }
+
+ bool operator==(const ORowSetValue& _rRH) const;
+ bool operator!=(const ORowSetValue& _rRH) const
+ {
+ return !( *this == _rRH );
+ }
+
+ bool isNull() const
+ {
+ return m_bNull;
+ }
+ void setNull()
+ {
+ free();
+ m_bNull = true;
+ m_aValue.m_pString = NULL;
+ }
+
+ bool isBound() const { return m_bBound; }
+ void setBound(bool _bBound) { m_bBound = _bBound ? 1 : 0; }
+
+ bool isModified() const { return m_bModified; }
+ void setModified(bool _bMod=true) { m_bModified = _bMod ? 1 : 0; }
+
+ bool isSigned() const { return m_bSigned; }
+ void setSigned(bool _bSig=true);
+
+ sal_Int32 getTypeKind() const { return m_eTypeKind; }
+ void setTypeKind(sal_Int32 _eType);
+
+ // before calling one of this methods, be sure that the value is not null
+ void* getValue() const { OSL_ENSURE(m_bBound,"Value is not bound!");return m_aValue.m_pValue; }
+ bool getBool() const;
+
+ sal_Int8 getInt8() const;
+ sal_uInt8 getUInt8() const;
+
+ sal_Int16 getInt16() const;
+ sal_uInt16 getUInt16() const;
+
+ sal_Int32 getInt32() const;
+ sal_uInt32 getUInt32() const;
+
+ sal_Int64 getLong() const;
+ sal_uInt64 getULong() const;
+
+ double getDouble() const;
+ float getFloat() const;
+
+ OUString getString() const; // makes a automatic conversion if type isn't a string
+ ::com::sun::star::util::Date getDate() const;
+ ::com::sun::star::util::Time getTime() const;
+ ::com::sun::star::util::DateTime getDateTime() const;
+ ::com::sun::star::uno::Sequence<sal_Int8> getSequence() const;
+ // only use for anys
+ ::com::sun::star::uno::Any getAny() const { return *(::com::sun::star::uno::Any*)m_aValue.m_pValue; }
+ ::com::sun::star::uno::Any makeAny() const;
+
+ /**
+ fetches a single value out of the row
+ @param _nPos the current column position
+ @param _nType the type of the current column
+ @param _xRow the row where to fetch the data from
+ */
+ void fill(sal_Int32 _nPos,
+ sal_Int32 _nType,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow>& _xRow);
+
+ /**
+ fetches a single value out of the row
+ @param _nPos the current column position
+ @param _nType the type of the current column
+ @param _bNullable if true then it will be checked if the result could be NULL, otherwise not.
+ @param _xRow the row where to fetch the data from
+ */
+ void fill(sal_Int32 _nPos,
+ sal_Int32 _nType,
+ bool _bNullable,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow>& _xRow);
+
+ void fill(const ::com::sun::star::uno::Any& _rValue);
+
+ void fill( const sal_Int32 _nType,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxColumn );
+
+ private:
+ void impl_fill( const sal_Int32 _nType, bool _bNullable, const detail::IValueSource& _rValueSource );
+ };
+
+ /// ORowSetValueDecorator decorates a ORowSetValue so the value is "refcounted"
+ class OOO_DLLPUBLIC_DBTOOLS ORowSetValueDecorator : public ::salhelper::SimpleReferenceObject
+ {
+ ORowSetValue m_aValue; // my own value
+ public:
+ ORowSetValueDecorator(){m_aValue.setBound(true);}
+ ORowSetValueDecorator(const ORowSetValue& _aValue) : m_aValue(_aValue){m_aValue.setBound(true);}
+ ORowSetValueDecorator& operator=(const ORowSetValue& _aValue);
+
+ inline operator const ORowSetValue&() const { return m_aValue; }
+ inline bool operator ==( const ORowSetValue & _rRH ) { return m_aValue == _rRH; }
+ inline const ORowSetValue& getValue() const { return m_aValue; }
+ inline ORowSetValue& get() { return m_aValue; }
+ inline void setValue(const ORowSetValue& _aValue) { m_aValue = _aValue; }
+ inline void setNull() { m_aValue.setNull(); }
+ inline void setBound(bool _bBound ) { m_aValue.setBound(_bBound);}
+ inline bool isBound( ) const { return m_aValue.isBound();}
+ inline void setTypeKind(sal_Int32 _nType) { m_aValue.setTypeKind(_nType); }
+ inline void setModified(bool _bModified) { m_aValue.setModified(_bModified); }
+
+ };
+ typedef ::rtl::Reference<ORowSetValueDecorator> ORowSetValueDecoratorRef;
+
+ // -------------------------------------------------------------------------
+ /// TSetBound is a unary_function to set the bound value with e.q. for_each call
+ struct OOO_DLLPUBLIC_DBTOOLS TSetBound : ::std::unary_function<ORowSetValue,void>
+ {
+ bool m_bBound;
+ TSetBound(bool _bBound) : m_bBound(_bBound){}
+ void operator()(ORowSetValue& _rValue) const { _rValue.setBound(m_bBound); }
+
+ };
+
+ // -------------------------------------------------------------------------
+ /// TSetBound is a unary_function to set the bound value with e.q. for_each call
+ struct OOO_DLLPUBLIC_DBTOOLS TSetRefBound : ::std::unary_function<ORowSetValueDecoratorRef,void>
+ {
+ bool m_bBound;
+ TSetRefBound(bool _bBound) : m_bBound(_bBound){}
+ void operator()(ORowSetValueDecoratorRef& _rValue) const { _rValue->setBound(m_bBound); }
+
+ };
+
+ // ----------------------------------------------------------------------------
+ // Vector for file based rows
+ // ----------------------------------------------------------------------------
+ template< class VectorVal > class ODeleteVector : public connectivity::ORowVector< VectorVal >
+ {
+ bool m_bDeleted;
+ public:
+ ODeleteVector() : connectivity::ORowVector< VectorVal >() ,m_bDeleted(false) {}
+ ODeleteVector(size_t _st) : connectivity::ORowVector< VectorVal >(_st) ,m_bDeleted(false) {}
+
+ bool isDeleted() const { return m_bDeleted; }
+ void setDeleted(bool _bDeleted) { m_bDeleted = _bDeleted; }
+ };
+
+ typedef ODeleteVector< ORowSetValue > OValueVector;
+
+ class OOO_DLLPUBLIC_DBTOOLS OValueRefVector : public ODeleteVector< ORowSetValueDecoratorRef >
+ {
+ public:
+ OValueRefVector(){}
+ OValueRefVector(size_t _st) : ODeleteVector< ORowSetValueDecoratorRef >(_st)
+ {
+ for(OValueRefVector::Vector::iterator aIter = get().begin() ; aIter != get().end() ;++aIter)
+ *aIter = new ORowSetValueDecorator;
+ }
+ };
+
+#define SQL_NO_PARAMETER (SAL_MAX_UINT32)
+ class OAssignValues : public OValueRefVector
+ {
+ ::std::vector<sal_Int32> m_nParameterIndexes;
+ public:
+ OAssignValues() : m_nParameterIndexes(1,SQL_NO_PARAMETER){}
+ OAssignValues(Vector::size_type n) : OValueRefVector(n),m_nParameterIndexes(n+1,SQL_NO_PARAMETER){}
+
+ void setParameterIndex(sal_Int32 _nId,sal_Int32 _nParameterIndex) { m_nParameterIndexes[_nId] = _nParameterIndex;}
+ sal_Int32 getParameterIndex(sal_Int32 _nId) const { return m_nParameterIndexes[_nId]; }
+ };
+
+ typedef ::rtl::Reference< OAssignValues > ORefAssignValues;
+
+
+
+ typedef ::rtl::Reference< OValueVector > OValueRow;
+ typedef ::rtl::Reference< OValueRefVector > OValueRefRow;
+}
+
+#endif // #ifndef _CONNECTIVITY_FILE_VALUE_HXX_
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/IParseContext.hxx b/include/connectivity/IParseContext.hxx
new file mode 100644
index 000000000000..0352ed8ec39f
--- /dev/null
+++ b/include/connectivity/IParseContext.hxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef CONNECTIVITY_IPARSECONTEXT_HXX
+#define CONNECTIVITY_IPARSECONTEXT_HXX
+
+namespace connectivity { class OSQLParseNode; }
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace connectivity
+{
+ //==========================================================================
+ //= IParseContext
+ //==========================================================================
+ class IParseContext
+ {
+ public:
+ enum ErrorCode
+ {
+ ERROR_NONE = 0,
+ ERROR_GENERAL, // "Syntax error in SQL expression"
+ ERROR_VALUE_NO_LIKE, // "The value #1 can not be used with LIKE."
+ ERROR_FIELD_NO_LIKE, // "LIKE can not be used with this field."
+ ERROR_INVALID_COMPARE, // "The entered criterion can not be compared with this field."
+ ERROR_INVALID_INT_COMPARE, // "The field can not be compared with a number."
+ ERROR_INVALID_DATE_COMPARE, // "The field can not be compared with a date."
+ ERROR_INVALID_REAL_COMPARE, // "The field can not be compared with a floating point number."
+ ERROR_INVALID_TABLE, // "The database does not contain a table named \"#\"."
+ ERROR_INVALID_TABLE_OR_QUERY, // "The database does contain neither a table nor a query named \"#\"."
+ ERROR_INVALID_COLUMN, // "The column \"#1\" is unknown in the table \"#2\"."
+ ERROR_INVALID_TABLE_EXIST, // "The database already contains a table or view with name \"#\"."
+ ERROR_INVALID_QUERY_EXIST // "The database already contains a query with name \"#\".";
+ };
+
+ enum InternationalKeyCode
+ {
+ KEY_NONE = 0,
+ KEY_LIKE,
+ KEY_NOT,
+ KEY_NULL,
+ KEY_TRUE,
+ KEY_FALSE,
+ KEY_IS,
+ KEY_BETWEEN,
+ KEY_OR,
+ KEY_AND,
+ KEY_AVG,
+ KEY_COUNT,
+ KEY_MAX,
+ KEY_MIN,
+ KEY_SUM,
+ KEY_EVERY,
+ KEY_ANY,
+ KEY_SOME,
+ KEY_STDDEV_POP,
+ KEY_STDDEV_SAMP,
+ KEY_VAR_SAMP,
+ KEY_VAR_POP,
+ KEY_COLLECT,
+ KEY_FUSION,
+ KEY_INTERSECTION
+ };
+
+ public:
+ // retrieves language specific error messages
+ virtual OUString getErrorMessage(ErrorCode _eCodes) const = 0;
+
+ // retrieves language specific keyword strings (only ASCII allowed)
+ virtual OString getIntlKeywordAscii(InternationalKeyCode _eKey) const = 0;
+
+ // finds out, if we have an international keyword (only ASCII allowed)
+ virtual InternationalKeyCode getIntlKeyCode(const OString& rToken) const = 0;
+
+ /** get's a locale instance which should be used when parsing in the context specified by this instance
+ <p>if this is not overridden by derived classes, it returns the static default locale.</p>
+ */
+ virtual ::com::sun::star::lang::Locale getPreferredLocale( ) const = 0;
+
+ protected:
+ ~IParseContext() {}
+ };
+}
+
+#endif // CONNECTIVITY_IPARSECONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/OSubComponent.hxx b/include/connectivity/OSubComponent.hxx
new file mode 100644
index 000000000000..2a55aa35c374
--- /dev/null
+++ b/include/connectivity/OSubComponent.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_OSUBCOMPONENT_HXX_
+#define _CONNECTIVITY_OSUBCOMPONENT_HXX_
+
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/interfacecontainer.h>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace com
+{
+ namespace sun
+ {
+ namespace star
+ {
+ namespace lang
+ {
+ class XComponent;
+ }
+ }
+ }
+}
+namespace connectivity
+{
+ OOO_DLLPUBLIC_DBTOOLS
+ void release(oslInterlockedCount& _refCount,
+ ::cppu::OBroadcastHelper& rBHelper,
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface,
+ ::com::sun::star::lang::XComponent* _pObject);
+ //************************************************************
+ // OSubComponent
+ //************************************************************
+ template <class SELF, class WEAK> class OSubComponent
+ {
+ protected:
+ // the parent must support the tunnel implementation
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xParent;
+ SELF* m_pDerivedImplementation;
+
+ public:
+ OSubComponent(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xParent,
+ SELF* _pDerivedImplementation)
+ :m_xParent(_xParent)
+ ,m_pDerivedImplementation(_pDerivedImplementation)
+ {
+ }
+
+ protected:
+ void dispose_ChildImpl()
+ {
+ // avoid ambiguity
+ ::osl::MutexGuard aGuard( m_pDerivedImplementation->WEAK::rBHelper.rMutex );
+ m_xParent.clear();
+ }
+ void relase_ChildImpl()
+ {
+ ::connectivity::release(m_pDerivedImplementation->m_refCount,
+ m_pDerivedImplementation->WEAK::rBHelper,
+ m_xParent,
+ m_pDerivedImplementation);
+
+ m_pDerivedImplementation->WEAK::release();
+ }
+ };
+}
+#endif // _CONNECTIVITY_OSUBCOMPONENT_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/PColumn.hxx b/include/connectivity/PColumn.hxx
new file mode 100644
index 000000000000..a54cb809ca29
--- /dev/null
+++ b/include/connectivity/PColumn.hxx
@@ -0,0 +1,154 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _CONNECTIVITY_PCOLUMN_HXX_
+#define _CONNECTIVITY_PCOLUMN_HXX_
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/sdbcx/VColumn.hxx"
+#include "connectivity/CommonTools.hxx"
+#include <rtl/ref.hxx>
+#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <comphelper/proparrhlp.hxx>
+
+namespace connectivity
+{
+ namespace parse
+ {
+ class OParseColumn;
+
+ typedef sdbcx::OColumn OParseColumn_BASE;
+ typedef ::comphelper::OPropertyArrayUsageHelper<OParseColumn> OParseColumn_PROP;
+
+ class OOO_DLLPUBLIC_DBTOOLS OParseColumn :
+ public OParseColumn_BASE, public OParseColumn_PROP
+ {
+ OUString m_aRealName;
+ OUString m_sLabel;
+ sal_Bool m_bFunction;
+ sal_Bool m_bDbasePrecisionChanged;
+ sal_Bool m_bAggregateFunction;
+ sal_Bool m_bIsSearchable;
+
+ protected:
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const;
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ virtual ~OParseColumn();
+ public:
+ OParseColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xColumn,sal_Bool _bCase);
+ OParseColumn(const OUString& _Name,
+ const OUString& _TypeName,
+ const OUString& _DefaultValue,
+ const OUString& _Description,
+ sal_Int32 _IsNullable,
+ sal_Int32 _Precision,
+ sal_Int32 _Scale,
+ sal_Int32 _Type,
+ sal_Bool _IsAutoIncrement,
+ sal_Bool _IsCurrency,
+ sal_Bool _bCase,
+ const OUString& _CatalogName,
+ const OUString& _SchemaName,
+ const OUString& _TableName);
+
+ virtual void construct();
+
+ void setRealName(const OUString& _rName) { m_aRealName = _rName; }
+ void setLabel(const OUString& i_sLabel) { m_sLabel = i_sLabel; }
+ void setTableName(const OUString& _rName) { m_TableName = _rName; }
+ void setFunction(sal_Bool _bFunction) { m_bFunction = _bFunction; }
+ void setAggregateFunction(sal_Bool _bFunction) { m_bAggregateFunction = _bFunction; }
+ void setIsSearchable( sal_Bool _bIsSearchable ) { m_bIsSearchable = _bIsSearchable; }
+ void setDbasePrecisionChanged(sal_Bool _bDbasePrecisionChanged) { m_bDbasePrecisionChanged = _bDbasePrecisionChanged; }
+
+ const OUString& getRealName() const { return m_aRealName; }
+ const OUString& getLabel() const { return m_sLabel; }
+ const OUString& getTableName() const { return m_TableName; }
+ sal_Bool getFunction() const { return m_bFunction; }
+ sal_Bool getDbasePrecisionChanged() const { return m_bDbasePrecisionChanged; }
+
+ public:
+ /** creates a collection of OParseColumn, as described by a result set meta data instance.
+ */
+ static ::rtl::Reference< OSQLColumns >
+ createColumnsForResultSet(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData >& _rxResMetaData,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rxDBMetaData,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& i_xQueryColumns
+ );
+
+ DECLARE_STL_USTRINGACCESS_MAP(int,StringMap);
+ /** creates a single OParseColumn, as described by a result set meta data instance.
+ The column names are unique.
+ */
+ static OParseColumn*
+ createColumnForResultSet(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData >& _rxResMetaData,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rxDBMetaData,
+ sal_Int32 _nColumnPos,
+ StringMap& _rColumns
+ );
+
+ private:
+ using OParseColumn_BASE::createArrayHelper;
+ };
+
+ class OOrderColumn;
+
+ typedef sdbcx::OColumn OOrderColumn_BASE;
+ typedef ::comphelper::OPropertyArrayUsageHelper<OOrderColumn> OOrderColumn_PROP;
+
+ class OOO_DLLPUBLIC_DBTOOLS OOrderColumn :
+ public OOrderColumn_BASE, public OOrderColumn_PROP
+ {
+ const sal_Bool m_bAscending;
+
+ protected:
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const;
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ virtual ~OOrderColumn();
+ public:
+ OOrderColumn(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xColumn,
+ const OUString& i_rOriginatingTableName,
+ sal_Bool _bCase,
+ sal_Bool _bAscending
+ );
+
+ OOrderColumn(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xColumn,
+ sal_Bool _bCase,
+ sal_Bool _bAscending
+ );
+
+ virtual void construct();
+
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+ private:
+ using OOrderColumn_BASE::createArrayHelper;
+ };
+ }
+}
+
+#endif //_CONNECTIVITY_PCOLUMN_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/ParameterCont.hxx b/include/connectivity/ParameterCont.hxx
new file mode 100644
index 000000000000..0c9c92ee4468
--- /dev/null
+++ b/include/connectivity/ParameterCont.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef CONNECTIVITY_PARAMETERCONTINUATION_HXX_INCLUDED
+#define CONNECTIVITY_PARAMETERCONTINUATION_HXX_INCLUDED
+
+#include <com/sun/star/sdb/XInteractionSupplyParameters.hpp>
+#include <comphelper/interaction.hxx>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace dbtools
+{
+//====================================================================
+ //= OParameterContinuation
+ //====================================================================
+ class OOO_DLLPUBLIC_DBTOOLS OParameterContinuation : public comphelper::OInteraction< ::com::sun::star::sdb::XInteractionSupplyParameters >
+ {
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > m_aValues;
+
+ public:
+ OParameterContinuation() { }
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > getValues() const { return m_aValues; }
+
+ // XInteractionSupplyParameters
+ virtual void SAL_CALL setParameters( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rValues ) throw(::com::sun::star::uno::RuntimeException);
+
+ protected:
+ virtual ~OParameterContinuation() { }
+ private:
+ OParameterContinuation(const OParameterContinuation&);
+ void operator =(const OParameterContinuation&);
+ };
+} // dbtools
+#endif //CONNECTIVITY_PARAMETERCONTINUATION_HXX_INCLUDED
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/SQLStatementHelper.hxx b/include/connectivity/SQLStatementHelper.hxx
new file mode 100644
index 000000000000..8302dae6b5c5
--- /dev/null
+++ b/include/connectivity/SQLStatementHelper.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_SQLSTATEMENTHELPER_HXX_
+#define _CONNECTIVITY_SQLSTATEMENTHELPER_HXX_
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+//.........................................................................
+namespace dbtools
+{
+ class OOO_DLLPUBLIC_DBTOOLS ISQLStatementHelper
+ {
+ public:
+ virtual void addComment(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor,OUStringBuffer& _rOut) = 0;
+
+ protected:
+ ~ISQLStatementHelper() {}
+ };
+
+//.........................................................................
+} // namespace dbtools
+//.........................................................................
+
+#endif // _CONNECTIVITY_SQLSTATEMENTHELPER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/StdTypeDefs.hxx b/include/connectivity/StdTypeDefs.hxx
new file mode 100644
index 000000000000..8751a656d2c0
--- /dev/null
+++ b/include/connectivity/StdTypeDefs.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef CONNECTIVITY_STDTYPEDEFS_HXX
+#define CONNECTIVITY_STDTYPEDEFS_HXX
+
+#include "sal/config.h"
+
+#include <map>
+#include <vector>
+#include "sal/types.h"
+
+
+namespace connectivity
+{
+ typedef ::std::vector< OUString> TStringVector;
+ typedef ::std::vector< sal_Int32> TIntVector;
+ typedef ::std::map<sal_Int32,sal_Int32> TInt2IntMap;
+ typedef ::std::map< OUString,sal_Int32> TString2IntMap;
+ typedef ::std::map< sal_Int32,OUString> TInt2StringMap;
+}
+
+#endif // CONNECTIVITY_STDTYPEDEFS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/TColumnsHelper.hxx b/include/connectivity/TColumnsHelper.hxx
new file mode 100644
index 000000000000..5fe1dd0eb845
--- /dev/null
+++ b/include/connectivity/TColumnsHelper.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_COLUMNSHELPER_HXX
+#define CONNECTIVITY_COLUMNSHELPER_HXX
+
+#include "connectivity/sdbcx/VCollection.hxx"
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+#include "connectivity/sdbcx/IRefreshable.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace connectivity
+{
+ class OTableHelper;
+ class OColumnsHelperImpl;
+ /** contains generell column handling to creat default columns and default sql statements.
+ */
+ class OOO_DLLPUBLIC_DBTOOLS OColumnsHelper : public sdbcx::OCollection
+ {
+ OColumnsHelperImpl* m_pImpl;
+ protected:
+ OTableHelper* m_pTable;
+
+ virtual sdbcx::ObjectType createObject(const OUString& _rName);
+ virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor();
+ virtual sdbcx::ObjectType appendObject( const OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor );
+ virtual void dropObject(sal_Int32 _nPos,const OUString _sElementName);
+ public:
+ OColumnsHelper( ::cppu::OWeakObject& _rParent
+ ,sal_Bool _bCase
+ ,::osl::Mutex& _rMutex
+ ,const TStringVector &_rVector
+ ,sal_Bool _bUseHardRef = sal_True
+ );
+ virtual ~OColumnsHelper();
+
+ /** set the parent of the columns. Can also be <NULL/>.
+ @param _pTable
+ The parent.
+ */
+ inline void setParent(OTableHelper* _pTable) { m_pTable = _pTable;}
+ };
+}
+#endif // CONNECTIVITY_COLUMNSHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/TIndex.hxx b/include/connectivity/TIndex.hxx
new file mode 100644
index 000000000000..b8502af9c5ec
--- /dev/null
+++ b/include/connectivity/TIndex.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_INDEXHELPER_HXX_
+#define CONNECTIVITY_INDEXHELPER_HXX_
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/sdbcx/VIndex.hxx"
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+
+namespace connectivity
+{
+ class OTableHelper;
+ class OOO_DLLPUBLIC_DBTOOLS OIndexHelper : public connectivity::sdbcx::OIndex
+ {
+ OTableHelper* m_pTable;
+ public:
+ virtual void refreshColumns();
+ public:
+ OIndexHelper( OTableHelper* _pTable);
+ OIndexHelper( OTableHelper* _pTable,
+ const OUString& _Name,
+ const OUString& _Catalog,
+ sal_Bool _isUnique,
+ sal_Bool _isPrimaryKeyIndex,
+ sal_Bool _isClustered
+ );
+ inline OTableHelper* getTable() const { return m_pTable; }
+ };
+}
+#endif // CONNECTIVITY_INDEXHELPER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/TIndexColumns.hxx b/include/connectivity/TIndexColumns.hxx
new file mode 100644
index 000000000000..31b0ecfe3ca5
--- /dev/null
+++ b/include/connectivity/TIndexColumns.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_INDEXCOLUMNSHELPER_HXX
+#define CONNECTIVITY_INDEXCOLUMNSHELPER_HXX
+
+#include "connectivity/sdbcx/VCollection.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace connectivity
+{
+ class OIndexHelper;
+ class OOO_DLLPUBLIC_DBTOOLS OIndexColumns : public sdbcx::OCollection
+ {
+ OIndexHelper* m_pIndex;
+ protected:
+ virtual sdbcx::ObjectType createObject(const OUString& _rName);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor();
+ virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
+ public:
+ OIndexColumns( OIndexHelper* _pIndex,
+ ::osl::Mutex& _rMutex,
+ const ::std::vector< OUString> &_rVector);
+ };
+}
+#endif // CONNECTIVITY_INDEXCOLUMNSHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/TIndexes.hxx b/include/connectivity/TIndexes.hxx
new file mode 100644
index 000000000000..c558c709c8e8
--- /dev/null
+++ b/include/connectivity/TIndexes.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_INDEXESHELPER_HXX
+#define CONNECTIVITY_INDEXESHELPER_HXX
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/sdbcx/VCollection.hxx"
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+
+namespace connectivity
+{
+ class OTableHelper;
+ class OOO_DLLPUBLIC_DBTOOLS OIndexesHelper : public sdbcx::OCollection
+ {
+ OTableHelper* m_pTable;
+ protected:
+ virtual sdbcx::ObjectType createObject(const OUString& _rName);
+ virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor();
+ virtual sdbcx::ObjectType appendObject( const OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor );
+ virtual void dropObject(sal_Int32 _nPos,const OUString _sElementName);
+ public:
+ OIndexesHelper(OTableHelper* _pTable,
+ ::osl::Mutex& _rMutex,
+ const ::std::vector< OUString> &_rVector
+ );
+
+ };
+}
+
+#endif // CONNECTIVITY_INDEXESHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/TKey.hxx b/include/connectivity/TKey.hxx
new file mode 100644
index 000000000000..9b24e41c3126
--- /dev/null
+++ b/include/connectivity/TKey.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_TKEY_HXX
+#define CONNECTIVITY_TKEY_HXX
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <connectivity/sdbcx/VKey.hxx>
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+
+namespace connectivity
+{
+ class OTableHelper;
+ class OOO_DLLPUBLIC_DBTOOLS OTableKeyHelper : public connectivity::sdbcx::OKey
+ {
+ OTableHelper* m_pTable;
+ public:
+ virtual void refreshColumns();
+ public:
+ OTableKeyHelper( OTableHelper* _pTable);
+ OTableKeyHelper( OTableHelper* _pTable
+ ,const OUString& _Name
+ ,const sdbcx::TKeyProperties& _rProps
+ );
+ inline OTableHelper* getTable() const { return m_pTable; }
+ };
+}
+#endif // CONNECTIVITY_TKEY_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/TKeyColumns.hxx b/include/connectivity/TKeyColumns.hxx
new file mode 100644
index 000000000000..6dbb041805b4
--- /dev/null
+++ b/include/connectivity/TKeyColumns.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_TKEYCOLUMNS_HXX
+#define CONNECTIVITY_TKEYCOLUMNS_HXX
+
+#include "connectivity/sdbcx/VCollection.hxx"
+#include "connectivity/TKey.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace connectivity
+{
+ class OOO_DLLPUBLIC_DBTOOLS OKeyColumnsHelper : public connectivity::sdbcx::OCollection
+ {
+ OTableKeyHelper* m_pKey;
+ protected:
+ virtual sdbcx::ObjectType createObject(const OUString& _rName);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor();
+ virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
+ public:
+ OKeyColumnsHelper( OTableKeyHelper* _pKey,
+ ::osl::Mutex& _rMutex,
+ const ::std::vector< OUString> &_rVector);
+ };
+}
+#endif // CONNECTIVITY_TKEYCOLUMNS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/TKeys.hxx b/include/connectivity/TKeys.hxx
new file mode 100644
index 000000000000..817b24da3a42
--- /dev/null
+++ b/include/connectivity/TKeys.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_TKEYS_HXX
+#define CONNECTIVITY_TKEYS_HXX
+
+#include "connectivity/sdbcx/VCollection.hxx"
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+#include "connectivity/TTableHelper.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace connectivity
+{
+ typedef sdbcx::OCollection OKeys_BASE;
+ class OOO_DLLPUBLIC_DBTOOLS OKeysHelper : public OKeys_BASE
+ {
+ OTableHelper* m_pTable;
+ protected:
+ virtual sdbcx::ObjectType createObject(const OUString& _rName);
+ virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor();
+ virtual sdbcx::ObjectType appendObject( const OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor );
+ virtual void dropObject(sal_Int32 _nPos,const OUString _sElementName);
+
+ virtual OUString getDropForeignKey() const;
+
+ public:
+ OKeysHelper( OTableHelper* _pTable,
+ ::osl::Mutex& _rMutex,
+ const TStringVector& _rVector
+ );
+ inline OTableHelper* getTable() const { return m_pTable; }
+
+ static void cloneDescriptorColumns(
+ const sdbcx::ObjectType& _rSourceDescriptor,
+ const sdbcx::ObjectType& _rDestDescriptor
+ );
+ };
+}
+
+#endif // CONNECTIVITY_TKEYS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/TTableHelper.hxx b/include/connectivity/TTableHelper.hxx
new file mode 100644
index 000000000000..aeb58cb4dd0c
--- /dev/null
+++ b/include/connectivity/TTableHelper.hxx
@@ -0,0 +1,166 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_TABLEHELPER_HXX
+#define CONNECTIVITY_TABLEHELPER_HXX
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/sdbcx/VTable.hxx"
+#include "connectivity/sdbcx/VKey.hxx"
+#include "connectivity/StdTypeDefs.hxx"
+#include <comphelper/stl_types.hxx>
+#include <com/sun/star/sdb/tools/XTableRename.hpp>
+#include <com/sun/star/sdb/tools/XTableAlteration.hpp>
+#include <com/sun/star/sdb/tools/XKeyAlteration.hpp>
+#include <com/sun/star/sdb/tools/XIndexAlteration.hpp>
+
+namespace connectivity
+{
+ typedef sal_Int32 OrdinalPosition;
+ struct ColumnDesc
+ {
+ OUString sName;
+ OUString aField6;
+ OUString sField12; // REMARKS
+ OUString sField13;
+ sal_Int32 nField5
+ , nField7
+ , nField9
+ , nField11;
+
+ OrdinalPosition nOrdinalPosition;
+
+ ColumnDesc() {}
+ ColumnDesc( const OUString& _rName
+ , sal_Int32 _nField5
+ , const OUString& _aField6
+ , sal_Int32 _nField7
+ , sal_Int32 _nField9
+ , sal_Int32 _nField11
+ , const OUString& _sField12
+ , const OUString& _sField13
+ ,OrdinalPosition _nPosition )
+ :sName( _rName )
+ ,aField6(_aField6)
+ ,sField12(_sField12)
+ ,sField13(_sField13)
+ ,nField5(_nField5)
+ ,nField7(_nField7)
+ ,nField9(_nField9)
+ ,nField11(_nField11)
+ ,nOrdinalPosition( _nPosition )
+ {
+ }
+ };
+ typedef connectivity::sdbcx::OTable OTable_TYPEDEF;
+
+ OOO_DLLPUBLIC_DBTOOLS OUString getTypeString(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xColProp);
+
+ DECLARE_STL_USTRINGACCESS_MAP( sdbcx::TKeyProperties , TKeyMap);
+
+ struct OTableHelperImpl;
+
+ class OOO_DLLPUBLIC_DBTOOLS OTableHelper : public OTable_TYPEDEF
+ {
+ ::std::auto_ptr<OTableHelperImpl> m_pImpl;
+
+ void refreshPrimaryKeys(TStringVector& _rKeys);
+ void refreshForeignKeys(TStringVector& _rKeys);
+
+ protected:
+ /** creates the column collection for the table
+ @param _rNames
+ The column names.
+ */
+ virtual sdbcx::OCollection* createColumns(const TStringVector& _rNames) = 0;
+
+ /** creates the key collection for the table
+ @param _rNames
+ The key names.
+ */
+ virtual sdbcx::OCollection* createKeys(const TStringVector& _rNames) = 0;
+
+ /** creates the index collection for the table
+ @param _rNames
+ The index names.
+ */
+ virtual sdbcx::OCollection* createIndexes(const TStringVector& _rNames) = 0;
+
+ /** this function is called upon disposing the component
+ */
+ virtual void SAL_CALL disposing();
+
+ /** The default returns "RENAME TABLE " or "RENAME VIEW " depending on the type.
+ *
+ * \return The start of the rename statement.
+ */
+ virtual OUString getRenameStart() const;
+
+ virtual ~OTableHelper();
+
+ public:
+ virtual void refreshColumns();
+ virtual void refreshKeys();
+ virtual void refreshIndexes();
+
+ const ColumnDesc* getColumnDescription(const OUString& _sName) const;
+
+ public:
+ OTableHelper( sdbcx::OCollection* _pTables,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection,
+ sal_Bool _bCase);
+ OTableHelper( sdbcx::OCollection* _pTables,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection,
+ sal_Bool _bCase,
+ const OUString& _Name,
+ const OUString& _Type,
+ const OUString& _Description = OUString(),
+ const OUString& _SchemaName = OUString(),
+ const OUString& _CatalogName = OUString()
+ );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> getMetaData() const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection() const;
+
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // XRename
+ virtual void SAL_CALL rename( const OUString& newName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException);
+
+ // XAlterTable
+ virtual void SAL_CALL alterColumnByIndex( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ // XNamed
+ virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
+
+ // helper method to get key properties
+ sdbcx::TKeyProperties getKeyProperties(const OUString& _sName) const;
+ void addKey(const OUString& _sName,const sdbcx::TKeyProperties& _aKeyProperties);
+
+ virtual OUString getTypeCreatePattern() const;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdb::tools::XTableRename> getRenameService() const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdb::tools::XTableAlteration> getAlterService() const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdb::tools::XKeyAlteration> getKeyService() const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdb::tools::XIndexAlteration> getIndexService() const;
+ };
+}
+#endif // CONNECTIVITY_TABLEHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/conncleanup.hxx b/include/connectivity/conncleanup.hxx
new file mode 100644
index 000000000000..1eec5ac50f98
--- /dev/null
+++ b/include/connectivity/conncleanup.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_CONNCLEANUP_HXX_
+#define _CONNECTIVITY_CONNCLEANUP_HXX_
+
+#include <cppuhelper/implbase2.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sdbc/XRowSet.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+//.........................................................................
+namespace dbtools
+{
+//.........................................................................
+
+ //=====================================================================
+ //= OAutoConnectionDisposer
+ //=====================================================================
+ typedef ::cppu::WeakImplHelper2 < ::com::sun::star::beans::XPropertyChangeListener,
+ ::com::sun::star::sdbc::XRowSetListener
+ > OAutoConnectionDisposer_Base;
+
+ class OOO_DLLPUBLIC_DBTOOLS OAutoConnectionDisposer : public OAutoConnectionDisposer_Base
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
+ m_xOriginalConnection;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > m_xRowSet; // needed to add as listener
+ sal_Bool m_bRSListening : 1; // true when we're listening on rowset
+ sal_Bool m_bPropertyListening : 1; // true when we're listening for property changes
+
+ public:
+ /** constructs an object
+ <p>The connection given will be set on the rowset (as ActiveConnection), and the object adds itself as property
+ change listener for the connection. Once somebody sets a new ActiveConnection, the old one (the one given
+ here) will be disposed.</p>
+ */
+ OAutoConnectionDisposer(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& _rxRowSet,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection
+ );
+
+ protected:
+ // XPropertyChangeListener
+ virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& _rSource ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XRowSetListener
+ virtual void SAL_CALL cursorMoved( const ::com::sun::star::lang::EventObject& event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL rowChanged( const ::com::sun::star::lang::EventObject& event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL rowSetChanged( const ::com::sun::star::lang::EventObject& event ) throw (::com::sun::star::uno::RuntimeException);
+
+ private:
+ void clearConnection();
+
+ void startRowSetListening();
+ void stopRowSetListening();
+ sal_Bool isRowSetListening() const { return m_bRSListening; }
+
+ void startPropertyListening( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxProps );
+ void stopPropertyListening( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxEventSource );
+ sal_Bool isPropertyListening() const { return m_bPropertyListening; }
+ };
+
+//.........................................................................
+} // namespace dbtools
+//.........................................................................
+
+#endif // _CONNECTIVITY_CONNCLEANUP_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/dbcharset.hxx b/include/connectivity/dbcharset.hxx
new file mode 100644
index 000000000000..712c44abddb4
--- /dev/null
+++ b/include/connectivity/dbcharset.hxx
@@ -0,0 +1,164 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _DBHELPER_DBCHARSET_HXX_
+#define _DBHELPER_DBCHARSET_HXX_
+
+#include "sal/config.h"
+
+#include <cstddef>
+
+#include <comphelper/stl_types.hxx>
+#include <rtl/textenc.h>
+#include <rtl/tencinfo.h>
+#include <rtl/ustring.hxx>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+//.........................................................................
+namespace dbtools
+{
+//.........................................................................
+
+ //=========================================================================
+ //= OCharsetMap
+ //=========================================================================
+ /** is a class which translates between different charset representations.
+
+ <p>The set of recognized charsets is very limited: only the ones which are database relevant are
+ implemented at the moment</p>
+
+ <p>Possible representations are:
+ <ul>
+ <li><b>IANA names.</b>
+ Have a look at <A href="http://www.iana.org/assignments/character-sets">this document</A> for
+ more details</li>
+ <li><b>rtl_TextEncoding</b></li>
+ </ul>
+ </p>
+ */
+ class OOO_DLLPUBLIC_DBTOOLS OCharsetMap
+ {
+ protected:
+ DECLARE_STL_STDKEY_SET( rtl_TextEncoding, TextEncBag );
+
+ TextEncBag m_aEncodings;
+
+ public:
+ class CharsetIterator;
+ friend class OCharsetMap::CharsetIterator;
+ typedef CharsetIterator iterator;
+ typedef CharsetIterator const_iterator;
+
+ OCharsetMap();
+ virtual ~OCharsetMap();
+
+ struct IANA { };
+
+ /** find the given text encoding in the map.
+ @return the <em>end</em> iterator if the encoding could not be found.
+ */
+ CharsetIterator find(const rtl_TextEncoding _eEncoding) const;
+ /** find the given IANA name in the map.
+ @return the <em>end</em> iterator if the IANA name could not be found.
+ */
+ CharsetIterator find(const OUString& _rIanaName, const IANA&) const;
+
+ std::size_t size() const { ensureConstructed( ); return m_aEncodings.size(); }
+
+ /// get access to the first element of the charset collection
+ CharsetIterator begin() const;
+ /// get access to the (last + 1st) element of the charset collection
+ CharsetIterator end() const;
+
+ protected:
+ // needed because we want to call a virtual method during construction
+ void lateConstruct();
+ inline void ensureConstructed( ) const { if ( m_aEncodings.empty() ) const_cast< OCharsetMap* >( this )->lateConstruct(); }
+
+ virtual sal_Bool approveEncoding( const rtl_TextEncoding _eEncoding, const rtl_TextEncodingInfo& _rInfo ) const;
+ };
+
+ //-------------------------------------------------------------------------
+ //- CharsetIteratorDerefHelper
+ //-------------------------------------------------------------------------
+ class OOO_DLLPUBLIC_DBTOOLS CharsetIteratorDerefHelper
+ {
+ friend class OCharsetMap::CharsetIterator;
+
+ rtl_TextEncoding m_eEncoding;
+ OUString m_aIanaName;
+
+ public:
+ CharsetIteratorDerefHelper(const CharsetIteratorDerefHelper& _rSource);
+
+ rtl_TextEncoding getEncoding() const { return m_eEncoding; }
+ OUString getIanaName() const { return m_aIanaName; }
+
+ protected:
+ CharsetIteratorDerefHelper( const rtl_TextEncoding _eEncoding, const OUString& _rIanaName );
+
+ };
+
+
+ //-------------------------------------------------------------------------
+ //- OCharsetMap::CharsetIterator
+ //-------------------------------------------------------------------------
+ class OOO_DLLPUBLIC_DBTOOLS OCharsetMap::CharsetIterator
+ {
+ friend class OCharsetMap;
+
+ friend OOO_DLLPUBLIC_DBTOOLS bool operator==(const CharsetIterator& lhs, const CharsetIterator& rhs);
+ friend bool operator!=(const CharsetIterator& lhs, const CharsetIterator& rhs) { return !(lhs == rhs); }
+
+// friend sal_Int32 operator-(const CharsetIterator& lhs, const CharsetIterator& rhs);
+
+ protected:
+ const OCharsetMap* m_pContainer;
+ OCharsetMap::TextEncBag::const_iterator m_aPos;
+
+ public:
+ CharsetIterator(const CharsetIterator& _rSource);
+ ~CharsetIterator();
+
+ CharsetIteratorDerefHelper operator*() const;
+ // no -> operator
+ // this would require us to a) store CharsetIteratorDerefHelper instances ourself so that we
+ // can return a pointer or b) introduce a -> operator on the CharsetIteratorDerefHelper, too.
+
+ /// prefix increment
+ const CharsetIterator& operator++();
+ /// postfix increment
+ const CharsetIterator operator++(int) { CharsetIterator hold(*this); ++*this; return hold; }
+
+ /// prefix decrement
+ const CharsetIterator& operator--();
+ /// postfix decrement
+ const CharsetIterator operator--(int) { CharsetIterator hold(*this); --*this; return hold; }
+
+ protected:
+ CharsetIterator(const OCharsetMap* _pContainer, OCharsetMap::TextEncBag::const_iterator _aPos );
+ };
+
+//.........................................................................
+} // namespace dbtools
+//.........................................................................
+
+#endif // _DBHELPER_DBCHARSET_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/dbconversion.hxx b/include/connectivity/dbconversion.hxx
new file mode 100644
index 000000000000..9536c799ec81
--- /dev/null
+++ b/include/connectivity/dbconversion.hxx
@@ -0,0 +1,213 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _DBHELPER_DBCONVERSION_HXX_
+#define _DBHELPER_DBCONVERSION_HXX_
+
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+// forward declarations
+namespace com
+{
+ namespace sun
+ {
+ namespace star
+ {
+ namespace lang
+ {
+ struct Locale;
+ }
+ namespace sdb
+ {
+ class XColumn;
+ class XColumnUpdate;
+ }
+ namespace sdbc
+ {
+ class SQLException;
+ }
+ namespace beans
+ {
+ class XPropertySet;
+ }
+ namespace util
+ {
+ class XNumberFormatter;
+ class XNumberFormatsSupplier;
+ struct Time;
+ struct DateTime;
+ }
+ namespace script
+ {
+ class XTypeConverter;
+ }
+ }
+ }
+}
+
+//.........................................................................
+namespace dbtools
+{
+//.........................................................................
+
+ class OOO_DLLPUBLIC_DBTOOLS DBTypeConversion
+ {
+ public:
+ static ::com::sun::star::util::Date getStandardDate();
+ static void setValue(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumnUpdate>& xVariant,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter>& xFormatter,
+ const ::com::sun::star::util::Date& rNullDate,
+ const OUString& rString,
+ sal_Int32 nKey,
+ sal_Int16 nFieldType,
+ sal_Int16 nKeyType) throw(::com::sun::star::lang::IllegalArgumentException);
+
+ static void setValue(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumnUpdate>& xVariant,
+ const ::com::sun::star::util::Date& rNullDate,
+ const double& rValue,
+ sal_Int16 nKeyType) throw(::com::sun::star::lang::IllegalArgumentException);
+
+ static double getValue( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn>& xVariant, const ::com::sun::star::util::Date& rNullDate );
+
+ // get the columnvalue as string with a default format given by the column or a default format
+ // for the type
+ static OUString getFormattedValue(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xColumn,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter>& xFormatter,
+ const ::com::sun::star::lang::Locale& _rLocale,
+ const ::com::sun::star::util::Date& rNullDate);
+
+ static OUString getFormattedValue(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn>& _xColumn,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter>& xFormatter,
+ const ::com::sun::star::util::Date& rNullDate,
+ sal_Int32 nKey,
+ sal_Int16 nKeyType);
+
+ static ::com::sun::star::util::Date toDate(double dVal, const ::com::sun::star::util::Date& _rNullDate = getStandardDate());
+ static ::com::sun::star::util::Date toDate(const OUString& _sSQLDate);
+ static ::com::sun::star::util::Time toTime(double dVal);
+ static ::com::sun::star::util::Time toTime(const OUString& _sSQLDate);
+ static ::com::sun::star::util::DateTime toDateTime(double dVal, const ::com::sun::star::util::Date& _rNullDate = getStandardDate());
+ static ::com::sun::star::util::DateTime toDateTime(const OUString& _sSQLDate);
+
+
+ // TODO: consider removing getMsFromTime
+ static sal_Int32 getMsFromTime(const ::com::sun::star::util::Time& rVal);
+ static sal_Int64 getNsFromTime(const ::com::sun::star::util::Time& rVal);
+
+ static sal_Int32 toDays(const ::com::sun::star::util::Date& _rVal, const ::com::sun::star::util::Date& _rNullDate = getStandardDate());
+
+ static double toDouble(const ::com::sun::star::util::Date& rVal, const ::com::sun::star::util::Date& _rNullDate = getStandardDate());
+ static double toDouble(const ::com::sun::star::util::Time& rVal);
+ static double toDouble(const ::com::sun::star::util::DateTime& rVal, const ::com::sun::star::util::Date& _rNullDate = getStandardDate());
+
+ static sal_Int32 toINT32(const ::com::sun::star::util::Date& rVal);
+ static sal_Int64 toINT64(const ::com::sun::star::util::Time& rVal);
+
+ static ::com::sun::star::util::Date toDate(sal_Int32 _nVal);
+ static ::com::sun::star::util::Time toTime(sal_Int64 _nVal);
+
+ /** convert a double which is a date value relative to a given fixed date into a date value relative
+ to the standard db null date.
+ */
+ static double toStandardDbDate(const ::com::sun::star::util::Date& _rNullDate, double _rVal) { return _rVal + toDays(_rNullDate); }
+ /** convert a double which is a date value relative to the standard db null date into a date value relative
+ to a given fixed date.
+ */
+ static double toNullDate(const ::com::sun::star::util::Date& _rNullDate, double _rVal) { return _rVal - toDays(_rNullDate); }
+
+ // return the date from the numberformatsupplier or the STANDARD_DATE (1900,1,1)
+ static ::com::sun::star::util::Date getNULLDate(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > &xSupplier);
+
+ // return the date in the format %04d-%02d-%02d
+ static OUString toDateString(const ::com::sun::star::util::Date& rDate);
+ // return the time in the format %02d:%02d:%02d.%09d
+ static OUString toTimeString(const ::com::sun::star::util::Time& rTime);
+ // return the DateTime in the format %04d-%02d-%02d %02d:%02d:%02d.%09d
+ static OUString toDateTimeString(const ::com::sun::star::util::DateTime& _rDateTime);
+ // return the any in an sql standard format
+ static OUString toSQLString(sal_Int32 eType, const ::com::sun::star::uno::Any& _rVal, sal_Bool bQuote,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::script::XTypeConverter >& _rxTypeConverter);
+
+ /** converts a Unicode string into a 8-bit string, using the given encoding
+
+ @param _rSource
+ the source string to convert
+ @param _rDest
+ the destination string
+ @param _eEncoding
+ the encoding to use for the conversion
+
+ @throws com::sun::star::sdbc::SQLException
+ if the given string contains characters which are not convertible using the given encoding
+ The SQLState of the exception will be set to 22018 ("Invalid character value for cast specification")
+
+ @return
+ the length of the converted string
+ */
+ static sal_Int32 convertUnicodeString(
+ const OUString& _rSource,
+ OString& _rDest,
+ rtl_TextEncoding _eEncoding
+ )
+ SAL_THROW((::com::sun::star::sdbc::SQLException));
+
+ /** converts a Unicode string into a 8-bit string, using the given encoding
+
+ @param _rSource
+ the source string to convert
+
+ @param _rDest
+ the destination string
+
+ @param _nMaxLen
+ the maximum length of the destination string
+
+ @param _eEncoding
+ the encoding to use for the conversion
+
+ @throws com::sun::star::sdbc::SQLException
+ if convertUnicodeString, which is called internally, throws such an exception
+
+ @throws com::sun::star::sdbc::SQLException
+ if the conversion results in a string which is longer than _nMaxLen
+
+ @return
+ the length of the converted string
+ */
+ static sal_Int32 convertUnicodeStringToLength(
+ const OUString& _rSource,
+ OString& _rDest,
+ sal_Int32 _nMaxLen,
+ rtl_TextEncoding _eEncoding
+ )
+ SAL_THROW((::com::sun::star::sdbc::SQLException));
+ };
+
+//.........................................................................
+} // namespace dbtools
+//.........................................................................
+
+#endif // _DBHELPER_DBCONVERSION_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/dbexception.hxx b/include/connectivity/dbexception.hxx
new file mode 100644
index 000000000000..a84450b607d8
--- /dev/null
+++ b/include/connectivity/dbexception.hxx
@@ -0,0 +1,353 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _DBHELPER_DBEXCEPTION_HXX_
+#define _DBHELPER_DBEXCEPTION_HXX_
+
+#include <com/sun/star/sdbc/SQLException.hpp>
+#include "connectivity/standardsqlstate.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace com
+{
+ namespace sun
+ {
+ namespace star
+ {
+ namespace sdb
+ {
+ class SQLContext;
+ struct SQLErrorEvent;
+ }
+ namespace sdbc
+ {
+ class SQLWarning;
+ }
+ }
+ }
+}
+//.........................................................................
+namespace dbtools
+{
+//.........................................................................
+
+//==============================================================================
+//= Special exception if cancel is pressed in DBA UI
+//==============================================================================
+enum OOoBaseErrorCode
+{
+ ParameterInteractionCancelled = 1
+};
+
+//==============================================================================
+//= SQLExceptionInfo - encapsulating the type info of an SQLException-derived class
+//==============================================================================
+
+class OOO_DLLPUBLIC_DBTOOLS SQLExceptionInfo
+{
+public:
+ enum TYPE { SQL_EXCEPTION, SQL_WARNING, SQL_CONTEXT, UNDEFINED };
+
+private:
+ ::com::sun::star::uno::Any m_aContent;
+ TYPE m_eType; // redundant (could be derived from m_aContent.getValueType())
+
+public:
+ SQLExceptionInfo();
+ SQLExceptionInfo(const ::com::sun::star::sdbc::SQLException& _rError);
+ SQLExceptionInfo(const ::com::sun::star::sdbc::SQLWarning& _rError);
+ SQLExceptionInfo(const ::com::sun::star::sdb::SQLContext& _rError);
+
+ /** convenience constructor
+
+ If your error processing relies on SQLExceptions, and SQLExceptionInfos, you still may
+ need to display an error which consists of a simple message string only.
+ In those cases, you can use this constructor, which behaves as if you would have used
+ an SQLException containing exactly the given error message.
+ */
+ SQLExceptionInfo( const OUString& _rSimpleErrorMessage );
+
+ SQLExceptionInfo(const SQLExceptionInfo& _rCopySource);
+
+ // use for events got via XSQLErrorListener::errorOccured
+ SQLExceptionInfo(const ::com::sun::star::uno::Any& _rError);
+ // use with the Reason member of an SQLErrorEvent or with NextElement of an SQLException
+
+ /** prepends a plain error message to the chain of exceptions
+ @param _rSimpleErrorMessage
+ the error message to prepend
+ @param _pAsciiSQLState
+ the SQLState of the to-be-constructed SQLException, or NULL if this should be defaulted to HY000
+ @param _nErrorCode
+ the ErrorCode of the to-be-constructed SQLException
+ */
+ void prepend( const OUString& _rErrorMessage, const sal_Char* _pAsciiSQLState = NULL, const sal_Int32 _nErrorCode = 0 );
+
+ /** appends a plain message to the chain of exceptions
+ @param _eType
+ the type of exception to append. Must be SQL_EXCEPTION, SQL_WARNING, SQL_CONTEXT, for all other
+ values, the behavior is undefined.
+ @param _rErrorMessage
+ the message to append
+ @param _pAsciiSQLState
+ the SQLState of the exception to append
+ @param _nErrorCode
+ the error code of the exception to append
+ */
+ void append( TYPE _eType, const OUString& _rErrorMessage, const sal_Char* _pAsciiSQLState = NULL, const sal_Int32 _nErrorCode = 0 );
+
+ /** throws (properly typed) the exception contained in the object
+ @precond
+ isValid() returns <TRUE/>
+ @throws SQLException
+ @throws RuntimeException
+ if the instance does not contain an SQLException
+ */
+ void doThrow();
+
+ const SQLExceptionInfo& operator=(const ::com::sun::star::sdbc::SQLException& _rError);
+ const SQLExceptionInfo& operator=(const ::com::sun::star::sdbc::SQLWarning& _rError);
+ const SQLExceptionInfo& operator=(const ::com::sun::star::sdb::SQLContext& _rError);
+ const SQLExceptionInfo& operator=(const ::com::sun::star::sdb::SQLErrorEvent& _rErrorEvent);
+ const SQLExceptionInfo& operator=(const ::com::sun::star::uno::Any& _rCaughtSQLException);
+
+ sal_Bool isKindOf(TYPE _eType) const;
+ // not just a simple comparisation ! e.g. getType() == SQL_CONTEXT implies isKindOf(SQL_EXCEPTION) == sal_True !
+ sal_Bool isValid() const { return m_eType != UNDEFINED; }
+ TYPE getType() const { return m_eType; }
+
+ operator const ::com::sun::star::sdbc::SQLException* () const;
+ operator const ::com::sun::star::sdbc::SQLWarning* () const;
+ operator const ::com::sun::star::sdb::SQLContext* () const;
+
+ const ::com::sun::star::uno::Any& get() const { return m_aContent; }
+
+ void clear()
+ {
+ m_aContent.clear();
+ m_eType = UNDEFINED;
+ }
+
+protected:
+ void implDetermineType();
+};
+
+//==============================================================================
+//= SQLExceptionIteratorHelper - iterating through an SQLException chain
+//==============================================================================
+
+class OOO_DLLPUBLIC_DBTOOLS SQLExceptionIteratorHelper
+{
+protected:
+ const ::com::sun::star::sdbc::SQLException* m_pCurrent;
+ SQLExceptionInfo::TYPE m_eCurrentType;
+
+public:
+ /** constructs an iterator instance from an SQLException
+
+ @param _rChainStart
+ the start of the exception chain to iterate. Must live as long as the iterator
+ instances lives, at least.
+ */
+ SQLExceptionIteratorHelper( const ::com::sun::star::sdbc::SQLException& _rChainStart );
+
+ /** constructs an iterator instance from an SQLExceptionInfo
+
+ @param _rErrorInfo
+ the start of the exception chain to iterate. Must live as long as the iterator
+ instances lives, at least.
+ */
+ SQLExceptionIteratorHelper( const SQLExceptionInfo& _rErrorInfo );
+
+ /** determines whether there are more elements in the exception chain
+ */
+ sal_Bool hasMoreElements() const { return ( m_pCurrent != NULL ); }
+
+ /** returns the type of the current element in the exception chain
+ */
+ SQLExceptionInfo::TYPE currentType() const { return m_eCurrentType; }
+
+ /** retrieves the current element in the chain, or <NULL/> if the chain has been completely
+ traveled.
+ */
+ const ::com::sun::star::sdbc::SQLException* current() const { return m_pCurrent; }
+
+ /** retrieves the current element in the chain, or <NULL/> if the chain has been completely
+ traveled.
+
+ In opposite to the second <member>current</member>, this version allows typed access to
+ the respective SQLException.
+ */
+ void current( SQLExceptionInfo& _out_rInfo ) const;
+
+ /** proceeds to the next element in the chain
+
+ @return the current element in the chain, as <b>before</em> the chain move.
+ */
+ const ::com::sun::star::sdbc::SQLException* next();
+
+ /** proceeds to the next element in the chain
+
+ In opposite to the second <member>current</member>, this version allows typed access to
+ the respective SQLException.
+ */
+ void next( SQLExceptionInfo& _out_rInfo );
+};
+
+//==================================================================================
+//= StandardExceptions
+//==================================================================================
+//----------------------------------------------------------------------------------
+/** returns a standard error string for a given SQLState
+
+ @param _eState
+ describes the state whose description is to retrieve. Must not be SQL_ERROR_UNSPECIFIED.
+ @raises RuntimeException
+ in case of an internal error
+*/
+OOO_DLLPUBLIC_DBTOOLS OUString getStandardSQLState( StandardSQLState _eState );
+
+//----------------------------------------------------------------------------------
+/** returns a standard ASCII string for a given SQLState
+
+ @param _eState
+ describes the state whose description is to retrieve. Must not be SQL_ERROR_UNSPECIFIED.
+ @return
+ a non-<NULL/> pointer to an ASCII character string denoting the requested SQLState
+ @raises RuntimeException
+ in case of an internal error
+*/
+OOO_DLLPUBLIC_DBTOOLS const sal_Char* getStandardSQLStateAscii( StandardSQLState _eState );
+
+//----------------------------------------------------------------------------------
+OOO_DLLPUBLIC_DBTOOLS void throwFunctionNotSupportedException(
+ const OUString& _rMsg,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _Context,
+ const ::com::sun::star::uno::Any& _Next = ::com::sun::star::uno::Any()
+ )
+ throw ( ::com::sun::star::sdbc::SQLException );
+
+//----------------------------------------------------------------------------------
+/** throws an exception with SQL state IM001, saying that a certain function is not supported
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwFunctionNotSupportedException(
+ const sal_Char* _pAsciiFunctionName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
+ const ::com::sun::star::uno::Any* _pNextException = NULL
+ )
+ throw ( ::com::sun::star::sdbc::SQLException );
+
+//----------------------------------------------------------------------------------
+/** throws a function sequence (HY010) exception
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwFunctionSequenceException(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _Context,
+ const ::com::sun::star::uno::Any& _Next = ::com::sun::star::uno::Any()
+ )
+ throw ( ::com::sun::star::sdbc::SQLException );
+
+//----------------------------------------------------------------------------------
+/** throw a invalid index sqlexception
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwInvalidIndexException(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _Context,
+ const ::com::sun::star::uno::Any& _Next = ::com::sun::star::uno::Any()
+ )
+ throw ( ::com::sun::star::sdbc::SQLException );
+
+//----------------------------------------------------------------------------------
+/** throw a generic SQLException, i.e. one with an SQLState of HY000, an ErrorCode of 0 and no NextException
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwGenericSQLException(
+ const OUString& _rMsg,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxSource
+ )
+ throw (::com::sun::star::sdbc::SQLException);
+
+//----------------------------------------------------------------------------------
+/** throw a generic SQLException, i.e. one with an SQLState of HY000, an ErrorCode of 0 and no NextException
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwGenericSQLException(
+ const OUString& _rMsg,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxSource,
+ const ::com::sun::star::uno::Any& _rNextException
+ )
+ throw (::com::sun::star::sdbc::SQLException);
+
+//----------------------------------------------------------------------------------
+/** throw a SQLException with SQLState HYC00 (Optional feature not implemented)
+ @param _pAsciiFeatureName
+ an ASCII description of the feature which is not implemented. It's recommended that the feature
+ name is built from the name of the interface plus its method, for instance "XParameters::updateBinaryStream"
+ @param _rxContext
+ the context of the exception
+ @param _pNextException
+ the next exception to chain into the thrown exception, if any
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwFeatureNotImplementedException(
+ const sal_Char* _pAsciiFeatureName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
+ const ::com::sun::star::uno::Any* _pNextException = NULL
+ )
+ throw (::com::sun::star::sdbc::SQLException);
+
+//----------------------------------------------------------------------------------
+/** throws an SQLException
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwSQLException(
+ const sal_Char* _pAsciiMessage,
+ const sal_Char* _pAsciiState,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
+ const sal_Int32 _nErrorCode = 0,
+ const ::com::sun::star::uno::Any* _pNextException = NULL
+ )
+ throw (::com::sun::star::sdbc::SQLException);
+
+//----------------------------------------------------------------------------------
+/** throws an SQLException
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwSQLException(
+ const sal_Char* _pAsciiMessage,
+ StandardSQLState _eSQLState,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
+ const sal_Int32 _nErrorCode = 0,
+ const ::com::sun::star::uno::Any* _pNextException = NULL
+ )
+ throw (::com::sun::star::sdbc::SQLException);
+
+//----------------------------------------------------------------------------------
+/** throws an SQLException
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwSQLException(
+ const OUString& _rMessage,
+ StandardSQLState _eSQLState,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
+ const sal_Int32 _nErrorCode = 0,
+ const ::com::sun::star::uno::Any* _pNextException = NULL
+ )
+ throw (::com::sun::star::sdbc::SQLException);
+
+//.........................................................................
+} // namespace dbtools
+//.........................................................................
+
+#endif // _DBHELPER_DBEXCEPTION_HXX_
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/dbmetadata.hxx b/include/connectivity/dbmetadata.hxx
new file mode 100644
index 000000000000..565854ba7ed8
--- /dev/null
+++ b/include/connectivity/dbmetadata.hxx
@@ -0,0 +1,192 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_INC_CONNECTIVITY_DBMETADATA_HXX
+#define CONNECTIVITY_INC_CONNECTIVITY_DBMETADATA_HXX
+
+#include <com/sun/star/sdbc/XConnection.hpp>
+
+#include <memory>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace comphelper
+{
+ class ComponentContext;
+}
+
+//........................................................................
+namespace dbtools
+{
+//........................................................................
+
+ //====================================================================
+ //= DatabaseMetaData
+ //====================================================================
+ struct DatabaseMetaData_Impl;
+ /** encapsulates meta data about a database/connection which cannot be obtained
+ from the usual XDatabaseMetaData result set.
+
+ Meta data perhaps isn't really the right term ... Some of the methods
+ in this class involved heuristics, some are just a convenient wrapper
+ around more complex ways to obtain the same information.
+
+ @todo
+ Once CWS dba30 is integrated, we could easily add all the meta data
+ which is part of the "Info" property of a data source.
+ */
+ class OOO_DLLPUBLIC_DBTOOLS DatabaseMetaData
+ {
+ private:
+ ::std::auto_ptr< DatabaseMetaData_Impl > m_pImpl;
+
+ public:
+ DatabaseMetaData();
+ /** constructs a DatabaseMetaData instance
+ @param _rxConnection
+ is the connection whose meta data you're interested in.
+ Note that some of the information provided by this class can only be obtained
+ if this connection denotes an application-level connection, i.e. supports
+ the com.sun.star.sdb.Connection service.
+
+ @throws ::com::sun::star::lang::IllegalArgumentException
+ if the given connection is not <NULL/>, but the XDatabaseMetaData provided by it
+ are <NULL/>
+ @throws ::com::sun::star::sdbc::SQLException
+ if obtaining the meta data from the connection throws an SQLException
+ @throws ::com::sun::star::uno::RuntimeException
+ if obtaining the meta data from the connection throws an RuntimeException
+ */
+ DatabaseMetaData(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _connection );
+ DatabaseMetaData( const DatabaseMetaData& _copyFrom );
+ DatabaseMetaData& operator=( const DatabaseMetaData& _copyFrom );
+
+ ~DatabaseMetaData();
+
+ public:
+ /** determines whether or not the instances is based on a valid connection
+
+ As long as this method returns true<TRUE/>, you should expect all other
+ methods throwing an SQLException when called.
+ */
+ bool isConnected() const;
+
+ /** resets the instance so that it's based on a new connection
+ */
+ inline void reset( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _connection )
+ {
+ *this = DatabaseMetaData( _connection );
+ }
+
+ /// wraps XDatabaseMetaData::getIdentifierQuoteString
+ const OUString& getIdentifierQuoteString() const;
+
+ /// wraps XDatabaseMetaData::getCatalogSeparator
+ const OUString& getCatalogSeparator() const;
+
+ /** determines whether the database supports sub queries in the FROM part
+ of a SELECT clause are supported.
+ @throws ::com::sun::star::sdbc::SQLException
+ with SQLState 08003 (connection does not exist) if the instances was
+ default-constructed and does not have a connection, yet.
+ */
+ bool supportsSubqueriesInFrom() const;
+
+ /** checks whether the database supports primary keys
+
+ Since there's no dedicated API to ask a database for this, a heuristics needs to be applied.
+ First, the <code>PrimaryKeySupport<code> settings of the data source is examined. If it is <TRUE/>
+ or <FALSE/>, then value is returned. If it is <NULL/>, then the database meta data are examined
+ for support of core SQL grammar, and the result is returned. The assumption is that a database/driver
+ which supports core SQL grammar usually also supports primary keys, and vice versa. At least, experience
+ shows this is true most of the time.
+ */
+ bool supportsPrimaryKeys() const;
+
+ /** determines whether names in the database should be restricted to SQL-92 identifiers
+
+ Effectively, this method checks the EnableSQL92Check property of the data source settings,
+ if present.
+ */
+ bool restrictIdentifiersToSQL92() const;
+
+ /** determines whether when generating SQL statements, an AS keyword should be generated
+ before a correlation name.
+
+ E.g., it determines whether <code>SELECT * FROM table AS correlation_name</code> or
+ <code>SELECT * FROM table correlation_name</code> is generated.
+ */
+ bool generateASBeforeCorrelationName() const;
+
+ /** should date time be escaped like '2001-01-01' => {D '2001-01-01' }
+ */
+ bool shouldEscapeDateTime() const;
+
+ /** auto increment columns should be automaticly used as primary key.
+ */
+ bool isAutoIncrementPrimaryKey() const;
+
+ /** determines the syntax to use for boolean comparison predicates
+
+ @see ::com::sun::star::sdb::BooleanComparisonMode
+ */
+ sal_Int32
+ getBooleanComparisonMode() const;
+
+ /** determines in relations are supported.
+ *
+ * \return <TRUE/> when relations are supported, otherwise <FALSE/>
+ */
+ bool supportsRelations() const;
+
+ /** determines if column alias names can be used in the order by clause.
+ *
+ * \return <TRUE/> when relations are supported, otherwise <FALSE/>
+ */
+ bool supportsColumnAliasInOrderBy() const;
+
+ /** determines whether user administration is supported for the database
+
+ User administration support is controlled by the availability of the XUsersSupplier
+ interface, and it returning a non-NULL users container.
+
+ @param _rContext
+ the component context we operate in. Might be needed to create the
+ css.sdbc.DriverManager instance.
+ */
+ bool supportsUserAdministration( const ::comphelper::ComponentContext& _rContext ) const;
+
+ /** determines whether in the application UI, empty table folders (aka catalogs/schemas) should be displayed
+ */
+ bool displayEmptyTableFolders() const;
+
+ /** determines that threads are supported.
+ *
+ * \return <TRUE/> when threads are supported, otherwise <FALSE/>
+ */
+ bool supportsThreads() const;
+ };
+
+//........................................................................
+} // namespace dbtools
+//........................................................................
+
+#endif // CONNECTIVITY_INC_CONNECTIVITY_DBMETADATA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/dbtools.hxx b/include/connectivity/dbtools.hxx
new file mode 100644
index 000000000000..9706af6ccb1c
--- /dev/null
+++ b/include/connectivity/dbtools.hxx
@@ -0,0 +1,787 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_DBTOOLS_HXX_
+#define _CONNECTIVITY_DBTOOLS_HXX_
+
+#include <connectivity/dbexception.hxx>
+#include <comphelper/types.hxx>
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <comphelper/stl_types.hxx>
+#include <unotools/sharedunocomponent.hxx>
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/FValue.hxx"
+
+namespace com { namespace sun { namespace star {
+
+namespace sdb {
+ class XSingleSelectQueryComposer;
+ class SQLContext;
+}
+namespace sdbcx {
+ class XTablesSupplier;
+}
+namespace sdbc {
+ class XConnection;
+ class XDatabaseMetaData;
+ class XRowSet;
+ class XDataSource;
+ class SQLException;
+ class XParameters;
+ class XRowUpdate;
+}
+namespace beans {
+ class XPropertySet;
+}
+namespace awt {
+ class XWindow;
+}
+namespace lang {
+ struct Locale;
+ class XMultiServiceFactory;
+ class WrappedTargetException;
+}
+namespace container {
+ class XNameAccess;
+}
+namespace uno {
+ class XComponentContext;
+}
+namespace util {
+ class XNumberFormatTypes;
+ class XNumberFormatsSupplier;
+}
+namespace task {
+ class XInteractionHandler;
+}
+
+} } }
+
+
+//.........................................................................
+namespace dbtools
+{
+ class ISQLStatementHelper;
+ typedef ::utl::SharedUNOComponent< ::com::sun::star::sdbc::XConnection > SharedConnection;
+
+ enum EComposeRule
+ {
+ eInTableDefinitions,
+ eInIndexDefinitions,
+ eInDataManipulation,
+ eInProcedureCalls,
+ eInPrivilegeDefinitions,
+ eComplete
+ };
+//=========================================================================
+ // date conversion
+
+ // calculates the default numberformat for a given datatype and a give language
+ OOO_DLLPUBLIC_DBTOOLS
+ sal_Int32 getDefaultNumberFormat(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xColumn,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatTypes >& _xTypes,
+ const ::com::sun::star::lang::Locale& _rLocale);
+
+ // calculates the default numberformat for a given datatype and a give language
+ // @param _nDataType @see com.sun.star.sdbc.DataType
+ // @param _nScale can be zero
+ OOO_DLLPUBLIC_DBTOOLS
+ sal_Int32 getDefaultNumberFormat(sal_Int32 _nDataType,
+ sal_Int32 _nScale,
+ sal_Bool _bIsCurrency,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatTypes >& _xTypes,
+ const ::com::sun::star::lang::Locale& _rLocale);
+
+//=========================================================================
+
+ /** creates a connection which can be used for the rowset given
+
+ The function tries to obtain a connection for the row set with the following
+ steps (in this order):
+ <nl>
+ <li>If the rowset already has an ActiveConnection (means a non-<NULL/> value vor this property),
+ this one is used.</li>
+ <li>If row set is part of a database form document (see ->isEmbeddedInDatabase),
+ a connection for the respective database is used.</li>
+ <li>If in the parent hierarchy of the row set, there is an object supporting
+ the XConnection interface, this one is returned.</li>
+ <li>If the DataSourceName property of the row set is not empty, a connection for this
+ data source is retrieved.</li>
+ <li>If the URL property of the row set is not empty, an connection for this URL is
+ retrieved from the driver manager.
+ </nl>
+
+ @param _rxRowSet
+ the row set
+
+ @param _rxFactory
+ a service factory, which can be used to create data sources, interaction handler etc (the usual stuff)
+
+ @param _bSetAsActiveConnection
+ If <TRUE/>, the calculated connection is set as ActiveConnection property on the rowset.
+
+ If the connection was newly created by the method, and this parameter is <TRUE/>, then
+ the ownership of the connection is delivered to a temporary object, which observes the
+ row set: As soon as a connection-relevant property of the row set changes, or as soon
+ as somebody else sets another ActiveConnection at the row set, the original
+ connection (the one which this function calculated) is disposed and discarded. At this
+ very moment, also the temporary observer object dies. This way, it is ensured that
+ there's no resource leak from an un-owned connection object.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> connectRowset(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext,
+ sal_Bool _bSetAsActiveConnection
+ ) SAL_THROW ( ( ::com::sun::star::sdbc::SQLException
+ , ::com::sun::star::lang::WrappedTargetException
+ , ::com::sun::star::uno::RuntimeException ) );
+
+ /** ensures that a row set has a valid ActiveConnection, if possible
+
+ This function does nearly the same as ->connectRowset. In fact, it is to be preferred over
+ ->connectRowset, if possible.
+
+ There are a few differences:
+ <ul><li>If a connection could be determined for the given RowSet, it is always
+ set as ActiveConnection.</li>
+ <li>Definition of the ownership of the created connection allows for more scenarios:
+ <ul><li>If the connection was not newly created, the returned ->SharedConnection
+ instance will not have the ownership, since in this case it's assumed
+ that there already is an instance which has the ownership.</li>
+ <li>If the connection was newly created, and ->_bUseAutoConnectionDisposer
+ is <TRUE/>, then the returned SharedConnection instance will <em>not</em>
+ be the owner of the connection. Instead, the ownership will be delivered
+ to a temporary object as described for connectRowset.</li>
+ <li>If the connection was newly created, and ->_bUseAutoConnectionDisposer
+ is <FALSE/>, then the returned SharedConnection instance will have the
+ ownership of the XConnection.</li>
+ </ul>
+ </li>
+ </ul>
+ */
+ OOO_DLLPUBLIC_DBTOOLS SharedConnection ensureRowSetConnection(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext,
+ bool _bUseAutoConnectionDisposer
+ ) SAL_THROW ( ( ::com::sun::star::sdbc::SQLException
+ , ::com::sun::star::lang::WrappedTargetException
+ , ::com::sun::star::uno::RuntimeException ) );
+
+ /** returns the connection the RowSet is currently working with (which is the ActiveConnection property)
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet) throw (::com::sun::star::uno::RuntimeException);
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection_withFeedback(
+ const OUString& _rDataSourceName,
+ const OUString& _rUser,
+ const OUString& _rPwd,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext)
+ SAL_THROW ( (::com::sun::star::sdbc::SQLException) );
+
+
+ /** determines whether the given component is part of a document which is an embedded database
+ document (such as a form)
+ */
+ OOO_DLLPUBLIC_DBTOOLS bool isEmbeddedInDatabase(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent,
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxActualConnection
+ );
+
+ /** returns the columns of the named table of the given connection
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> getTableFields(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _rxConn,
+ const OUString& _rName
+ );
+
+ /** returns the primary key columns of the table
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> getPrimaryKeyColumns_throw(
+ const ::com::sun::star::uno::Any& i_aTable
+ );
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> getPrimaryKeyColumns_throw(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& i_xTable
+ );
+
+ /** get fields for a result set given by a "command descriptor"
+
+ <p>A command descriptor here means:
+ <ul><li>a SDB-level connection (<type scope="com.sun.star.sdb">Connection</type></li>
+ <li>a string specifying the name of an object relative to the connection</li>
+ <li>a <type scope="com.sun.star.sdb">CommandType</type> value specifying the type
+ of the object</type></li>
+ </ul>
+ </p>
+
+ @param _rxConnection
+ the connection relative to which the to-be-examined object exists
+
+ @param _nCommandType
+ the type of the object
+
+ @param _rCommand
+ the object. This may be a table name, a query name, or an SQL statement, depending on the value
+ of <arg>_nCommandType</arg>
+
+ @param _rxCollectionOner
+ If (and only if) <arg>CommandType</arg> is CommandType.COMMAND, the fields collection which is returned
+ by this function here is a temporary object. It is kept alive by another object, which is to be
+ created temporarily, too. To ensure that the fields you get are valid as long as you need them,
+ the owner which controls their life time is transfered to this parameter upon return.<br/>
+
+ Your fields live as long as this component lives.<br/>
+
+ Additionally, you are encouraged to dispose this component as soon as you don't need the fields anymore.
+ It depends on the connection's implementation if this is necessary, but the is no guarantee, so to
+ be on the safe side with respect to resource leaks, you should dispose the component.
+
+ @param _pErrorInfo
+ If not <NULL/>, then upon return from the function the instance pointed to by this argument will
+ contain any available error information in case something went wrong.
+
+ @return
+ the container of the columns (aka fields) of the object
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
+ getFieldsByCommandDescriptor(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const sal_Int32 _nCommandType,
+ const OUString& _rCommand,
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& _rxKeepFieldsAlive,
+ SQLExceptionInfo* _pErrorInfo = NULL
+ ) SAL_THROW( ( ) );
+
+
+ /** get fields for a result set given by a "command descriptor"
+
+ <p>A command descriptor here means:
+ <ul><li>a SDB-level connection (<type scope="com.sun.star.sdb">Connection</type></li>
+ <li>a string specifying the name of an object relative to the connection</li>
+ <li>a <type scope="com.sun.star.sdb">CommandType</type> value specifying the type
+ of the object</type></li>
+ </ul>
+ </p>
+
+ @param _rxConnection
+ the connection relative to which the to-be-examined object exists
+
+ @param _nCommandType
+ the type of the object
+
+ @param _rCommand
+ the object. This may be a table name, a query name, or an SQL statement, depending on the value
+ of <arg>_nCommandType</arg>
+
+ @param _pErrorInfo
+ If not <NULL/>, then upon return from the function the instance pointed to by this argument will
+ contain any available error information in case something went wrong.
+
+ @return
+ an array of strings containing the names of the columns (aka fields) of the object
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Sequence< OUString >
+ getFieldNamesByCommandDescriptor(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const sal_Int32 _nCommandType,
+ const OUString& _rCommand,
+ SQLExceptionInfo* _pErrorInfo = NULL
+ ) SAL_THROW( ( ) );
+
+
+ /** create a new ::com::sun::star::sdbc::SQLContext, fill it with the given descriptions and the given source,
+ and <i>append</i> _rException (i.e. put it into the NextException member of the SQLContext).
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::sdb::SQLContext prependContextInfo(const ::com::sun::star::sdbc::SQLException& _rException, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext, const OUString& _rContextDescription, const OUString& _rContextDetails );
+
+ OOO_DLLPUBLIC_DBTOOLS
+ ::com::sun::star::sdbc::SQLException prependErrorInfo(
+ const ::com::sun::star::sdbc::SQLException& _rChainedException,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
+ const OUString& _rAdditionalError,
+ const StandardSQLState _eSQLState = SQL_ERROR_UNSPECIFIED,
+ const sal_Int32 _nErrorCode = 0);
+
+ /** search the parent hierachy for a data source.
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> findDataSource(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xParent);
+
+ /** determines the value of a booolean data source setting, given by ASCII name
+
+ @param _rxConnection
+ the connection belonging to the data source whose setting is to be retrieved
+ @param _pAsciiSettingName
+ the ASCII name of the setting
+ */
+ OOO_DLLPUBLIC_DBTOOLS bool getBooleanDataSourceSetting(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const sal_Char* _pAsciiSettingName
+ );
+
+ /** check if a specific property is enabled in the info sequence
+ @deprecated
+ Use getBooleanDataSourceSetting instead, which cares for the default of the property itself,
+ instead of spreading this knowledge through all callers.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ sal_Bool isDataSourcePropertyEnabled(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _xProp
+ ,const OUString& _sProperty,
+ sal_Bool _bDefault = sal_False);
+
+ /** retrieves a particular indirect data source setting
+
+ @param _rxDataSource
+ a data source component
+ @param _pAsciiSettingsName
+ the ASCII name of the setting to obtain
+ @param _rSettingsValue
+ the value of the setting, upon successful return
+
+ @return
+ <FALSE/> if the setting is not present in the <member scope="com::sun::star::sdb">DataSource::Info</member>
+ member of the data source
+ <TRUE/> otherwise
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ bool getDataSourceSetting(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxDataSource,
+ const sal_Char* _pAsciiSettingsName,
+ ::com::sun::star::uno::Any& /* [out] */ _rSettingsValue
+ );
+ OOO_DLLPUBLIC_DBTOOLS
+ bool getDataSourceSetting(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxDataSource,
+ const OUString& _sSettingsName,
+ ::com::sun::star::uno::Any& /* [out] */ _rSettingsValue
+ );
+
+ OOO_DLLPUBLIC_DBTOOLS OUString getDefaultReportEngineServiceName(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxFactory);
+
+ /** quote the given name with the given quote string.
+ */
+ OOO_DLLPUBLIC_DBTOOLS OUString quoteName(const OUString& _rQuote, const OUString& _rName);
+
+ /** quote the given table name (which may contain a catalog and a schema) according to the rules provided by the meta data
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ OUString quoteTableName(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData>& _rxMeta
+ , const OUString& _rName
+ ,EComposeRule _eComposeRule);
+
+ /** split a fully qualified table name (including catalog and schema, if appliable) into it's component parts.
+ @param _rxConnMetaData meta data describing the connection where you got the table name from
+ @param _rQualifiedName fully qualified table name
+ @param _rCatalog (out parameter) upon return, contains the catalog name
+ @param _rSchema (out parameter) upon return, contains the schema name
+ @param _rName (out parameter) upon return, contains the table name
+ @param _eComposeRule where do you need the name for
+ */
+ OOO_DLLPUBLIC_DBTOOLS void qualifiedNameComponents(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rxConnMetaData,
+ const OUString& _rQualifiedName, OUString& _rCatalog, OUString& _rSchema, OUString& _rName,EComposeRule _eComposeRule);
+
+ /** calculate a NumberFormatsSupplier for use with an given connection
+ @param _rxConn the connection for which the formatter is requested
+ @param _bAllowDefault if the connection (and related components, such as it's parent) cannot supply
+ a formatter, we can ask the DatabaseEnvironment for a default one. This parameter
+ states if this is allowed.
+ @param _rxFactory required (only of _bAllowDefault is sal_True) for creating the DatabaseEnvironment.
+ @return the formatter all object related to the given connection should work with.
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier> getNumberFormats(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _rxConn,
+ sal_Bool _bAllowDefault = sal_False,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>()
+ );
+
+ /** create an <type scope="com::sun::star::sdb">XSingleSelectQueryComposer</type> which represents
+ the current settings (Command/CommandType/Filter/Order) of the given rowset.
+
+ As such an instance can be obtained from a <type scope="com::sun::star::sdb">Connection</type>
+ only the function searches for the connection the RowSet is using via connectRowset.
+ This implies that a connection will be set on the RowSet if needed.
+ (need to changes this sometimes ...)
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer > getCurrentSettingsComposer(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxRowSetProps,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext
+ );
+
+ /** transfer and translate properties between two FormComponents
+ @param _rxOld the source property set
+ @param _rxNew the destination property set
+ @param _rLocale the locale for converting number related properties
+ */
+ OOO_DLLPUBLIC_DBTOOLS void TransferFormComponentProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxOld,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxNew,
+ const ::com::sun::star::lang::Locale& _rLocale
+ );
+
+ /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::INSERT
+ @param _rxCursorSet the property set
+ */
+ OOO_DLLPUBLIC_DBTOOLS sal_Bool canInsert(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet);
+ /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::UPDATE
+ @param _rxCursorSet the property set
+ */
+ OOO_DLLPUBLIC_DBTOOLS sal_Bool canUpdate(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet);
+ /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::DELETE
+ @param _rxCursorSet the property set
+ */
+ OOO_DLLPUBLIC_DBTOOLS sal_Bool canDelete(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet);
+
+ //----------------------------------------------------------------------------------
+ /** compose a complete table name from it's up to three parts, regarding to the database meta data composing rules
+ */
+ OOO_DLLPUBLIC_DBTOOLS OUString composeTableName( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rxMetaData,
+ const OUString& _rCatalog,
+ const OUString& _rSchema,
+ const OUString& _rName,
+ sal_Bool _bQuote,
+ EComposeRule _eComposeRule);
+
+ /** composes a table name for usage in a SELECT statement
+
+ This includes quoting of the table as indicated by the connection's meta data, plus respecting
+ the settings "UseCatalogInSelect" and "UseSchemaInSelect", which might be present
+ in the data source which the connection belongs to.
+ */
+ OOO_DLLPUBLIC_DBTOOLS OUString composeTableNameForSelect(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const OUString& _rCatalog,
+ const OUString& _rSchema,
+ const OUString& _rName );
+
+ /** composes a table name for usage in a SELECT statement
+
+ This includes quoting of the table as indicated by the connection's meta data, plus respecting
+ the settings "UseCatalogInSelect" and "UseSchemaInSelect", which might be present
+ in the data source which the connection belongs to.
+ */
+ OOO_DLLPUBLIC_DBTOOLS OUString composeTableNameForSelect(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xTable );
+ //----------------------------------------------------------------------------------
+ /** compose the table name out of the property set which must support the properties from the service <member scope= "com::sun::star::sdbcx">table</member>
+ @param _xMetaData
+ The metadata from the connection.
+ @param _xTable
+ The table.
+ */
+ OOO_DLLPUBLIC_DBTOOLS OUString composeTableName(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData>& _xMetaData,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xTable,
+ EComposeRule _eComposeRule,
+ bool _bSuppressCatalogName,
+ bool _bSuppressSchemaName,
+ bool _bQuote);
+
+ //----------------------------------------------------------------------------------
+ OOO_DLLPUBLIC_DBTOOLS sal_Int32 getSearchColumnFlag( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _rxConn,
+ sal_Int32 _nDataType);
+ // return the datasource for the given datasource name
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> getDataSource(const OUString& _rsDataSourceName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext);
+
+ /** search for a name that is NOT in the NameAcces
+ @param _rxContainer
+ the NameAccess container to search in
+ @param _rBaseName
+ the base name that should be used to create the new name
+ @param _bStartWithNumber
+ When <TRUE/> the name ends with number even when the name itself doesn't occur in the collection.
+ @return
+ A name which doesn't exist in the collection.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ OUString createUniqueName(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& _rxContainer,
+ const OUString& _rBaseName,
+ sal_Bool _bStartWithNumber = sal_True);
+
+ /** creates a unique name which is not already used in the given name array
+ */
+ OOO_DLLPUBLIC_DBTOOLS OUString createUniqueName(
+ const ::com::sun::star::uno::Sequence< OUString >& _rNames,
+ const OUString& _rBaseName,
+ sal_Bool _bStartWithNumber = sal_True
+ );
+
+ /** create a name which is a valid SQL 92 identifier name
+ @param _rName the string which should be converted
+ @param _rSpecials @see com.sun.star.sdbc.XDatabaseMetaData.getExtraNameCharacters
+
+ @see isValidSQLName
+ */
+ OOO_DLLPUBLIC_DBTOOLS OUString convertName2SQLName(const OUString& _rName,const OUString& _rSpecials);
+
+ /** checks whether the given name is a valid SQL name
+
+ @param _rName the string which should be converted
+ @param _rSpecials @see com.sun.star.sdbc.XDatabaseMetaData.getExtraNameCharacters
+
+ @see convertName2SQLName
+ */
+ OOO_DLLPUBLIC_DBTOOLS sal_Bool isValidSQLName( const OUString& _rName, const OUString& _rSpecials );
+
+ OOO_DLLPUBLIC_DBTOOLS
+ void showError( const SQLExceptionInfo& _rInfo,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& _pParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext);
+
+ /** implements <method scope="com.sun.star.sdb">XRowUpdate::updateObject</method>
+ <p>The object which is to be set is analyzed, and in case it is a simlpe scalar type for which there
+ is another updateXXX method, this other method is used.</p>
+ @param _rxUpdatedObject
+ the interface to forward all updateXXX calls to (except updateObject)
+ @param _nColumnIndex
+ the column index to update
+ @param _rValue
+ the value to update
+ @return
+ <TRUE/> if the update request was successfully re-routed to one of the other updateXXX methods
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ sal_Bool implUpdateObject( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowUpdate >& _rxUpdatedObject,
+ const sal_Int32 _nColumnIndex,
+ const ::com::sun::star::uno::Any& _rValue) SAL_THROW ( ( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) );
+
+
+
+ /** ask the user for parameters if the prepared statement needs some and sets them in the prepared statement
+ @param _xConnection the connection must be able to create <type scope="com::sun::star::sdb">SingleSelectQueryComposer</type>s
+ @param _xPreparedStmt the prepared statement where the parameters could be set when needed
+ @param _aParametersSet contains which parameters have to asked for and which already have set.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ void askForParameters( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer >& _xComposer,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XParameters>& _xParameters,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxHandler,
+ const ::std::vector<bool, std::allocator<bool> >& _aParametersSet = ::std::vector<bool, std::allocator<bool> >());
+
+ /** call the appropriate set method for the specific sql type @see com::sun::star::sdbc::DataType
+ @param _xParams the parameters where to set the value
+ @param parameterIndex the index of the parameter, 1 based
+ @param x the value to set
+ @param sqlType the corresponding sql type @see com::sun::star::sdbc::DataType
+ @param scale the scale of the sql type can be 0
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ void setObjectWithInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XParameters>& _xParameters,
+ sal_Int32 parameterIndex,
+ const ::com::sun::star::uno::Any& x,
+ sal_Int32 sqlType,
+ sal_Int32 scale=0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+
+ /** call the appropriate set method for the specific sql type @see com::sun::star::sdbc::DataType
+ @param _xParams the parameters where to set the value
+ @param parameterIndex the index of the parameter, 1 based
+ @param x the value to set
+ @param sqlType the corresponding sql type @see com::sun::star::sdbc::DataType
+ @param scale the scale of the sql type can be 0
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ void setObjectWithInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XParameters>& _xParameters,
+ sal_Int32 parameterIndex,
+ const ::connectivity::ORowSetValue& x,
+ sal_Int32 sqlType,
+ sal_Int32 scale=0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+
+
+ /** implements <method scope="com.sun.star.sdb">XParameters::setObject</method>
+ <p>The object which is to be set is analyzed, and in case it is a simlpe scalar type for which there
+ is another setXXX method, this other method is used.</p>
+ @param _rxParameters
+ the interface to forward all setXXX calls to (except setObject)
+ @param _nColumnIndex
+ the column index to update
+ @param _rValue
+ the value to update
+ @return
+ <TRUE/> if the update request was successfully re-routed to one of the other updateXXX methods
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ sal_Bool implSetObject( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XParameters>& _rxParameters,
+ const sal_Int32 _nColumnIndex,
+ const ::com::sun::star::uno::Any& _rValue) SAL_THROW ( ( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ) );
+
+ /** creates the standard sql create table statement without the key part.
+ @param descriptor
+ The descriptor of the new table.
+ @param _xConnection
+ The connection.
+ @param _bAddScale
+ The scale will also be added when the value is 0.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ OUString createStandardCreateStatement( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
+ ISQLStatementHelper* _pHelper,
+ const OUString& _sCreatePattern = OUString());
+
+ /** creates the standard sql statement for the key part of a create table statement.
+ @param descriptor
+ The descriptor of the new table.
+ @param _xConnection
+ The connection.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ OUString createStandardKeyStatement( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection);
+
+ /** creates the standard sql statement for the column part of a create table statement.
+ @param _pHelper
+ Allow to add special SQL constructs.
+ @param descriptor
+ The descriptor of the column.
+ @param _xConnection
+ The connection.
+ @param _pHelper
+ Allow to add special SQL constructs.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ OUString createStandardColumnPart( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection
+ ,ISQLStatementHelper* _pHelper = NULL
+ ,const OUString& _sCreatePattern = OUString());
+
+ /** creates a SQL CREATE TABLE statement
+
+ @param descriptor
+ The descriptor of the new table.
+ @param _xConnection
+ The connection.
+ @param _pHelper
+ Allow to add special SQL constructs.
+ @param _sCreatePattern
+
+ @return
+ The CREATE TABLE statement.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ OUString createSqlCreateTableStatement( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection
+ ,ISQLStatementHelper* _pHelper = NULL
+ ,const OUString& _sCreatePattern = OUString());
+
+ /** creates a SDBC column with the help of getColumns.
+ @param _xTable
+ The table.
+ @param _rName
+ The name of the column.
+ @param _bCase
+ Is the column case sensitive.
+ @param _bQueryForInfo
+ If <TRUE/> the autoincrement and currency field will be read from the meta data, otherwise the following parameters will be used instead
+ @param _bIsAutoIncrement
+ <TRUE/> if the column is an autoincrement.
+ @param _bIsCurrency
+ <TRUE/> if the column is a currency field.
+ @param _nDataType
+ The data type of the column.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>
+ createSDBCXColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xTable,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
+ const OUString& _rName,
+ sal_Bool _bCase,
+ sal_Bool _bQueryForInfo = sal_True,
+ sal_Bool _bIsAutoIncrement = sal_False,
+ sal_Bool _bIsCurrency = sal_False,
+ sal_Int32 _nDataType = com::sun::star::sdbc::DataType::OTHER);
+
+ /** tries to locate the corresponding DataDefinitionSupplier for the given url and connection
+ @param _rsUrl
+ The URL used to connect to the database.
+ @param _xConnection
+ The connection used to find the correct driver.
+ @param _rxContext
+ Used to create the drivermanager.
+ @return
+ The datadefintion object.
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier> getDataDefinitionByURLAndConnection(
+ const OUString& _rsUrl,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext);
+
+ /** returns the table privileges to the given parameters
+ @param _xMetaData
+ The meta data.
+ @param _sCatalog
+ contains the catalog name
+ @param _sSchema
+ contains the schema name
+ @param _sTable
+ contains the table name
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ sal_Int32 getTablePrivileges(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData>& _xMetaData,
+ const OUString& _sCatalog,
+ const OUString& _sSchema,
+ const OUString& _sTable);
+
+ typedef ::std::pair<sal_Bool,sal_Bool> TBoolPair;
+ typedef ::std::pair< TBoolPair,sal_Int32 > ColumnInformation;
+ typedef ::std::multimap< OUString, ColumnInformation, ::comphelper::UStringMixLess> ColumnInformationMap;
+ /** collects the information about auto increment, currency and data type for the given column name.
+ The column must be quoted, * is also valid.
+ @param _xConnection
+ The connection.
+ @param _sComposedTableName
+ The quoted table name. ccc.sss.ttt
+ @param _sName
+ The name of the column, or *
+ @param _rInfo
+ The information about the column(s).
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ void collectColumnInformation( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
+ const OUString& _sComposedTableName,
+ const OUString& _rName,
+ ColumnInformationMap& _rInfo);
+
+
+ /** adds a boolean comparison clause to the given SQL predicate
+
+ @param _rExpression
+ the expression which is to be compared with a boolean value
+ @param _bValue
+ the boolean value which the expression is to be compared with
+ @param _nBooleanComparisonMode
+ the boolean comparison mode to be used. Usually obtained from
+ a css.sdb.DataSource's Settings member.
+ @param _out_rSQLPredicate
+ the buffer to which the comparison predicate will be appended
+ */
+ OOO_DLLPUBLIC_DBTOOLS void getBoleanComparisonPredicate(
+ const OUString& _rExpression,
+ const sal_Bool _bValue,
+ const sal_Int32 _nBooleanComparisonMode,
+ OUStringBuffer& _out_rSQLPredicate
+ );
+
+//.........................................................................
+} // namespace dbtools
+//.........................................................................
+
+#endif // _CONNECTIVITY_DBTOOLS_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/dbtoolsdllapi.hxx b/include/connectivity/dbtoolsdllapi.hxx
new file mode 100644
index 000000000000..51210a633092
--- /dev/null
+++ b/include/connectivity/dbtoolsdllapi.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_DBTOOLSDLLAPI_HXX
+#define INCLUDED_CONNECTIVITY_DBTOOLSDLLAPI_HXX
+
+#include "sal/config.h"
+
+#include "sal/types.h"
+
+#if defined OOO_DLLIMPLEMENTATION_DBTOOLS
+#define OOO_DLLPUBLIC_DBTOOLS SAL_DLLPUBLIC_EXPORT
+#else
+#define OOO_DLLPUBLIC_DBTOOLS SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/filtermanager.hxx b/include/connectivity/filtermanager.hxx
new file mode 100644
index 000000000000..c489a91e5033
--- /dev/null
+++ b/include/connectivity/filtermanager.hxx
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef CONNECTIVITY_FILTERMANAGER_HXX
+#define CONNECTIVITY_FILTERMANAGER_HXX
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sdb/XSQLQueryComposer.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+
+#include <rtl/ustrbuf.hxx>
+
+#include <vector>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+//........................................................................
+namespace dbtools
+{
+//........................................................................
+
+ //====================================================================
+ //= FilterManager
+ //====================================================================
+ /** manages the filter of a database component with filter properties
+
+ The idea is that the filter which a database component actually really uses is composed of several single
+ filter components (which all are conjunctive).
+
+ First, there is a component which is visible to the clients of the database component itself - if they ask
+ the database component for the Filter property, they will get this public filter.
+
+ Second, there is an implicit filter, which is (to be) created from the MasterFields and DetailFields
+ property of the database component, if the latter denote columns.<br/>
+ For instance, if there is a link-pair CustomerID->cid, where |CustomerID| is a column of the master
+ database component, and |cid| is a column of the detail database component (the database component we're responsible for), then there will
+ be an implicit filter "cid = :param_cid_link" (or something like this), which is never visible
+ to the clients of the database component, but nevertheless needs to be propagated to the aggregated RowSet.<br/>
+ Actually, this implicit filter is maintained by the FormParameterManager.
+
+ Potentially, there could be more filter components (for instance, you could imagine database component
+ controls which act as live filter, which could be implemented with a third component), but
+ at the moment there are only these two.
+ */
+ class OOO_DLLPUBLIC_DBTOOLS FilterManager
+ {
+ public:
+ enum FilterComponent
+ {
+ fcPublicFilter = 0, // the filter which is to be published as "Filter" property of the database component
+ fcLinkFilter, // the filter part which is implicitly created for a database component when connecting
+ // master and detail database components via column names
+
+ FC_COMPONENT_COUNT // boundary delimiter, not to be used from outside
+ };
+
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
+ m_xORB;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ m_xComponentAggregate;
+ ::std::vector< OUString > m_aFilterComponents;
+ sal_Bool m_bApplyPublicFilter;
+
+ public:
+ /// ctor
+ explicit FilterManager(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
+ );
+
+ /// late ctor
+ void initialize(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxComponentAggregate );
+
+ /// makes the object forgetting the references to the database component
+ void dispose( );
+
+ const OUString& getFilterComponent( FilterComponent _eWhich ) const;
+ void setFilterComponent( FilterComponent _eWhich, const OUString& _rComponent );
+
+ inline sal_Bool isApplyPublicFilter( ) const { return m_bApplyPublicFilter; }
+ void setApplyPublicFilter( sal_Bool _bApply );
+
+ private:
+ /** retrieves a filter which is a conjunction of all single filter components
+ */
+ OUString getComposedFilter( ) const;
+
+ /** appends one filter component to the statement in our composer
+ */
+ void appendFilterComponent( OUStringBuffer& io_appendTo, const OUString& i_component ) const;
+
+ /// checks whether there is only one (or even no) non-empty filter component
+ bool isThereAtMostOneComponent( OUStringBuffer& o_singleComponent ) const;
+
+ /// returns the index of the first filter component which should be considered when building the composed filter
+ inline sal_Int32 getFirstApplicableFilterIndex() const
+ {
+ return m_bApplyPublicFilter ? fcPublicFilter : fcPublicFilter + 1;
+ }
+ };
+
+//........................................................................
+} // namespacefrm
+//........................................................................
+
+#endif // CONNECTIVITY_FORMFILTERMANAGER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/formattedcolumnvalue.hxx b/include/connectivity/formattedcolumnvalue.hxx
new file mode 100644
index 000000000000..fe5c4dbfff52
--- /dev/null
+++ b/include/connectivity/formattedcolumnvalue.hxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_FORMATTEDCOLUMNVALUE_HXX
+#define CONNECTIVITY_FORMATTEDCOLUMNVALUE_HXX
+
+#include <com/sun/star/sdbc/XRowSet.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sdb/XColumn.hpp>
+#include <com/sun/star/sdb/XColumnUpdate.hpp>
+#include <com/sun/star/util/XNumberFormatter.hpp>
+
+#include <boost/noncopyable.hpp>
+
+#include <memory>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace comphelper { class ComponentContext; }
+
+//........................................................................
+namespace dbtools
+{
+//........................................................................
+
+ struct FormattedColumnValue_Data;
+ //====================================================================
+ //= FormattedColumnValue
+ //====================================================================
+ /** a class which helps retrieving and setting the value of a database column
+ as formatted string.
+ */
+ class OOO_DLLPUBLIC_DBTOOLS FormattedColumnValue : public ::boost::noncopyable
+ {
+ public:
+ /** constructs an instance
+
+ The format key for the string value exchange is taken from the given column object.
+ If it has a non-<NULL/> property value <code>FormatKey</code>, this key is taken.
+ Otherwise, a default format matching the column type is determined.
+
+ The locale of this fallback format is the current system locale.
+
+ The number formats supplier is determined from the given <code>RowSet</code>, by
+ examining its <code>ActiveConnection</code>.
+ */
+ FormattedColumnValue(
+ const ::comphelper::ComponentContext& _rContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& _rxRowSet,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn
+ );
+
+ /** constructs an instance
+
+ The format key for the string value exchange is taken from the given column object.
+ If it has a non-<NULL/> property value <code>FormatKey</code>, this key is taken.
+ Otherwise, a default format matching the column type is determined.
+
+ The locale of this fallback format is the current system locale.
+ */
+ FormattedColumnValue(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& i_rNumberFormatter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& i_rColumn
+ );
+
+ // note that all methods of this class need to be virtual, since it's
+ // used in a load-on-demand context in module SVX
+
+ virtual ~FormattedColumnValue();
+
+ virtual void clear();
+
+ // access to the details of the formatting we determined
+ virtual sal_Int32 getFormatKey() const;
+ virtual sal_Int32 getFieldType() const;
+ virtual sal_Int16 getKeyType() const;
+ virtual const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >&
+ getColumn() const;
+ virtual const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumnUpdate >&
+ getColumnUpdate() const;
+
+ virtual bool setFormattedValue( const OUString& _rFormattedStringValue ) const;
+ virtual OUString getFormattedValue() const;
+
+ private:
+ ::std::auto_ptr< FormattedColumnValue_Data > m_pData;
+ };
+
+//........................................................................
+} // namespace dbtools
+//........................................................................
+
+#endif // CONNECTIVITY_FORMATTEDCOLUMNVALUE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/parameters.hxx b/include/connectivity/parameters.hxx
new file mode 100644
index 000000000000..9bdbe0e5c3fb
--- /dev/null
+++ b/include/connectivity/parameters.hxx
@@ -0,0 +1,417 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef CONNECTIVITY_PARAMETERS_HXX
+#define CONNECTIVITY_PARAMETERS_HXX
+
+#include <map>
+#include <vector>
+
+#include <com/sun/star/uno/XAggregation.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/form/XDatabaseParameterListener.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/task/XInteractionHandler.hpp>
+#include <com/sun/star/sdbc/XParameters.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/paramwrapper.hxx"
+#include <unotools/sharedunocomponent.hxx>
+#include <comphelper/implementationreference.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+
+//........................................................................
+namespace dbtools
+{
+//........................................................................
+
+ typedef ::utl::SharedUNOComponent< ::com::sun::star::sdb::XSingleSelectQueryComposer, ::utl::DisposableComponent >
+ SharedQueryComposer;
+
+ //====================================================================
+ //= ParameterManager
+ //====================================================================
+ class FilterManager;
+ class OOO_DLLPUBLIC_DBTOOLS ParameterManager
+ {
+ public:
+ /// classifies the origin of the data to fill a parameter
+ enum ParameterClassification
+ {
+ /** parameters which are filled from the master-detail relationship, where the detail
+ name is an explicit parameter name
+ */
+ eLinkedByParamName,
+ /** parameters which are filled from the master-detail relationship, where the detail
+ name is a column name, so an implicit parameter had to be generated for it
+ */
+ eLinkedByColumnName,
+ /** parameters which are filled externally (i.e. by XParameters::setXXX, or by the parameter listeners)
+ */
+ eFilledExternally
+ };
+ /** meta data about an inner parameter
+ */
+ private:
+ struct ParameterMetaData
+ {
+ /// the type of the parameter
+ ParameterClassification eType;
+ /// the column object for this parameter, as returned by the query composer
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ xComposerColumn;
+ /// the indicies of inner parameters which need to be filled when this concrete parameter is set
+ ::std::vector< sal_Int32 > aInnerIndexes;
+
+ /// default ctor
+ ParameterMetaData()
+ :eType( eFilledExternally )
+ {
+ }
+
+ /// ctor with composer column
+ ParameterMetaData( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn )
+ :eType ( eFilledExternally )
+ ,xComposerColumn ( _rxColumn )
+ {
+ }
+ };
+
+ typedef ::std::map< OUString, ParameterMetaData > ParameterInformation;
+
+ private:
+ ::osl::Mutex& m_rMutex;
+ ::cppu::OInterfaceContainerHelper m_aParameterListeners;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ m_xContext;
+
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::beans::XPropertySet >
+ m_xComponent; // the database component whose parameters we're handling
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation >
+ m_xAggregatedRowSet; // the aggregated row set - necessary for unwrapped access to some interfaces
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XParameters >
+ m_xInnerParamUpdate; // write access to the inner parameters
+ SharedQueryComposer m_xComposer; // query composer wrapping the statement which the *aggregate* is based on
+ SharedQueryComposer m_xParentComposer; // query composer wrapping the statement of our parent database component
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >
+ m_xInnerParamColumns; // index access to the parameter columns, as got from the query composer
+
+ ::dbtools::param::ParametersContainerRef
+ m_pOuterParameters; // the container of parameters which still need to be filled in by
+ // external instances
+ sal_Int32 m_nInnerCount; // overall number of parameters as required by the database component's aggregate
+
+ ParameterInformation m_aParameterInformation;
+
+ ::com::sun::star::uno::Sequence< OUString > m_aMasterFields;
+ ::com::sun::star::uno::Sequence< OUString > m_aDetailFields;
+
+ OUString m_sIdentifierQuoteString;
+ OUString m_sSpecialCharacters;
+
+ ::std::vector< bool > m_aParametersVisited;
+
+ bool m_bUpToDate;
+
+ public:
+ /** ctor
+ */
+ explicit ParameterManager(
+ ::osl::Mutex& _rMutex,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext
+ );
+
+ /// late ctor
+ void initialize(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxComponent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation >& _rxComponentAggregate
+ );
+
+ /// makes the object forgetting the references to the database component
+ void dispose( );
+
+ /// clears the instance data
+ void clearAllParameterInformation();
+
+ /// checks whether the parameter information are up-to-date
+ inline bool isUpToDate() const { return m_bUpToDate; }
+
+ /** updates all parameter information represented by the instance
+ */
+ void updateParameterInfo( FilterManager& _rFilterManager );
+
+ /** fills parameter values, as extensive as possible
+
+ <p>In particular, all values which can be filled from the master-detail relationship of
+ between our database component and it's parent are filled in.</p>
+
+ @param _rxCompletionHandler
+ an interaction handler which should be used to fill all parameters which
+ cannot be filled by other means. May be <NULL/>
+ @param _rClearForNotifies
+ the mutex guard to be (temporarily) cleared for notifications
+
+ @precond
+ the instance is alive, i.e. <member>isAlive</member> returns <TRUE/>
+
+ @return
+ <TRUE/> if and only if the parameter filling has <em>not</em> been cancelled by the user
+ */
+ bool fillParameterValues(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxCompletionHandler,
+ ::osl::ResettableMutexGuard& _rClearForNotifies
+ );
+
+ /** sets all parameter values to null (via <member>XParameters::setNull</member>)
+
+ @precond
+ the instance is alive, i.e. <member>isAlive</member> returns <TRUE/>
+ */
+ void setAllParametersNull() SAL_THROW( ( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ) );
+
+ /** resets all detail columns which are, via a parameter, linked to a master column, to
+ the value of this master column.
+
+ For instance, if the database component is bound to a statement <code>SELECT * from invoice where inv_id = :cid</code>,
+ and there is <em>one</em> master-detail link from
+
+ @precond
+ the instance is alive, i.e. <member>isAlive</member> returns <TRUE/>
+ */
+ void resetParameterValues() SAL_THROW(());
+
+ /** tells the object that it's database component is being disposed
+
+ The object then fires the <member>XEventListener::disposing</member> notification to
+ the parameter listeners
+ */
+ void disposing( const ::com::sun::star::lang::EventObject& _rDisposingEvent );
+
+ /** adds the given listener to the list of parameter listeners
+ */
+ void addParameterListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener >& _rxListener
+ );
+
+ /** removes the given listener from the list of parameter listeners
+ */
+ void removeParameterListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener >& _rxListener
+ );
+
+ // XParameters equivalents
+ void setNull ( sal_Int32 _nIndex, sal_Int32 sqlType);
+ void setObjectNull ( sal_Int32 _nIndex, sal_Int32 sqlType, const OUString& typeName);
+ void setBoolean ( sal_Int32 _nIndex, sal_Bool x);
+ void setByte ( sal_Int32 _nIndex, sal_Int8 x);
+ void setShort ( sal_Int32 _nIndex, sal_Int16 x);
+ void setInt ( sal_Int32 _nIndex, sal_Int32 x);
+ void setLong ( sal_Int32 _nIndex, sal_Int64 x);
+ void setFloat ( sal_Int32 _nIndex, float x);
+ void setDouble ( sal_Int32 _nIndex, double x);
+ void setString ( sal_Int32 _nIndex, const OUString& x);
+ void setBytes ( sal_Int32 _nIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x);
+ void setDate ( sal_Int32 _nIndex, const ::com::sun::star::util::Date& x);
+ void setTime ( sal_Int32 _nIndex, const ::com::sun::star::util::Time& x);
+ void setTimestamp ( sal_Int32 _nIndex, const ::com::sun::star::util::DateTime& x);
+ void setBinaryStream ( sal_Int32 _nIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream>& x, sal_Int32 length);
+ void setCharacterStream ( sal_Int32 _nIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream>& x, sal_Int32 length);
+ void setObject ( sal_Int32 _nIndex, const ::com::sun::star::uno::Any& x);
+ void setObjectWithInfo ( sal_Int32 _nIndex, const ::com::sun::star::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale);
+ void setRef ( sal_Int32 _nIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef>& x);
+ void setBlob ( sal_Int32 _nIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob>& x);
+ void setClob ( sal_Int32 _nIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob>& x);
+ void setArray ( sal_Int32 _nIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray>& x);
+ void clearParameters();
+
+ private:
+ /// checkes whether the object is already initialized, and not yet disposed
+ inline bool isAlive() const { return m_xComponent.get().is() && m_xInnerParamUpdate.is(); }
+
+ /** creates a filter expression from a master-detail link where the detail denotes a column name
+ */
+ OUString
+ createFilterConditionFromColumnLink(
+ const OUString& /* [in] */ _rMasterColumn,
+ const OUString& /* [in] */ _rDetailColumn,
+ OUString& /* [out] */ _rNewParamName
+ );
+
+ /** initializes our query composer, and the collection of inner parameter columns
+
+ @param _rxComponent
+ the database component to initialize from. Must not be <NULL/>
+ @return
+ <TRUE/> if and only if the initialization was successful
+
+ @postcond
+ if and only if <TRUE/> is returned, then <member>m_xInnerParamColumns</member> contains the collection of
+ inner parameters
+ */
+ bool initializeComposerByComponent(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxComponent
+ );
+
+ /** collects initial meta information about inner parameters (i.e. it initially fills
+ <member>m_aParameterInformation</member>).
+
+ @param _bSecondRun
+ if <TRUE/>, this is the second run, because we ourself previously extended the filter of
+ the RowSet
+
+ @precond
+ <member>m_xInnerParamColumns</member> is not <NULL/>
+ */
+ void collectInnerParameters( bool _bSecondRun );
+
+ /** analyzes the master-detail links for our database component, and initializes m_aMasterFields and m_aDetailFields
+
+ @param _rFilterManager
+ the filter manager of the database component
+ @param _rColumnsInLinkDetails
+ will be set to <TRUE/> if and only if there were link pairs where the detail field denoted
+ a column name of our database component
+
+ @precond
+ the instance is alive, i.e. <member>isAlive</member> returns <TRUE/>
+ */
+ void analyzeFieldLinks( FilterManager& _rFilterManager, bool& /* [out] */ _rColumnsInLinkDetails );
+
+ /** classifies the link pairs
+
+ @param _rxParentColumns
+ the columns of the parent database component
+
+ @param _rxColumns
+ the columns of our own database component
+
+ @param _out_rAdditionalFilterComponents
+ the additional filter components which are required for master-detail relationships where
+ the detail part denotes a column name. In such a case, an additional filter needs to be created,
+ containing a new parameter.
+
+ @precond
+ <member>m_aMasterFields</member> and <member>m_aDetailFields</member> have the same length
+ */
+ void classifyLinks(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxParentColumns,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxColumns,
+ ::std::vector< OUString >& _out_rAdditionalFilterComponents
+ ) SAL_THROW(( ::com::sun::star::uno::Exception ));
+
+ /** finalizes our <member>m_pOuterParameters</member> so that it can be used for
+ external parameter listeners
+
+ @precond
+ <member>m_pOuterParameters</member> is <NULL/>
+ @precond
+ <member>m_xInnerParamUpdate</member> is not <NULL/>
+ */
+ void createOuterParameters();
+
+ /** fills in the parameters values which result from the master-detail relationship
+ between the database component and it's parent
+
+ @param _rxParentColumns
+ the columns of the parameter database component. Must not be <NULL/>
+ @precond
+ the instance is alive, i.e. <member>isAlive</member> returns <TRUE/>
+ */
+ void fillLinkedParameters(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxParentColumns
+ );
+
+ /** completes all missing parameters via an interaction handler
+
+ @precond
+ the instance is alive, i.e. <member>isAlive</member> returns <TRUE/>
+
+ @return
+ <TRUE/> if and only if the parameter filling has <em>not</em> been cancelled by the user
+ */
+ bool completeParameters(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxCompletionHandler,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > _rxConnection
+ );
+
+ /** asks the parameter listeners to fill in final values
+
+ @precond
+ the instance is alive, i.e. <member>isAlive</member> returns <TRUE/>
+
+ @return
+ <TRUE/> if and only if the parameter filling has <em>not</em> been cancelled by the user
+ */
+ bool consultParameterListeners( ::osl::ResettableMutexGuard& _rClearForNotifies );
+
+ /** mark an externally filled parameter asvisited
+ */
+ void externalParameterVisited( sal_Int32 _nIndex );
+
+ private:
+ /** retrieves the columns of the parent database component
+
+ @precond
+ the instance is alive, i.e. <member>isAlive</member> returns <TRUE/>
+ @return
+ <TRUE/> if and only if the columns could be successfully retrieved
+ */
+ bool getParentColumns(
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& /* [out] */ _out_rxParentColumns,
+ bool _bFromComposer
+ );
+
+ /** retrieves the columns of our database component
+
+ @param _bFromComposer
+ if <TRUE/>, the columns are obtained from the composer, else from the living database component itself
+ @return
+ <TRUE/> if and only if the columns could be successfully retrieved
+ */
+ bool getColumns(
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& /* [out] */ _rxColumns,
+ bool _bFromComposer
+ ) SAL_THROW(( ::com::sun::star::uno::Exception ));
+
+ /** retrieves the active connection of the database component
+ */
+ bool getConnection(
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& /* [out] */ _rxConnection
+ );
+
+ /** caches some info about the connection of our database component
+ */
+ void cacheConnectionInfo() SAL_THROW(( ));
+
+ private:
+ ParameterManager(); // never implemented
+ ParameterManager( const ParameterManager& ); // never implemented
+ ParameterManager& operator=( const ParameterManager& ); // never implemented
+ };
+
+//........................................................................
+} // namespacefrm
+//........................................................................
+
+#endif // CONNECTIVITY_PARAMETERS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/paramwrapper.hxx b/include/connectivity/paramwrapper.hxx
new file mode 100644
index 000000000000..69347e9c4e6d
--- /dev/null
+++ b/include/connectivity/paramwrapper.hxx
@@ -0,0 +1,200 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_PARAMWRAPPER_HXX
+#define CONNECTIVITY_PARAMWRAPPER_HXX
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <connectivity/FValue.hxx>
+
+#include <com/sun/star/sdbc/XParameters.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/sdb/XSingleSelectQueryAnalyzer.hpp>
+
+#include <comphelper/uno3.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/propshlp.hxx>
+#include <cppuhelper/compbase2.hxx>
+
+#include <memory>
+#include <vector>
+
+//........................................................................
+namespace dbtools
+{
+namespace param
+{
+//........................................................................
+
+ //====================================================================
+ //= ParameterWrapper
+ //====================================================================
+ /** wraps a parameter column as got from an SQLQueryComposer, so that it has an additional
+ property "Value", which is forwarded to an XParameters interface
+ */
+ class OOO_DLLPUBLIC_DBTOOLS ParameterWrapper :public ::cppu::OWeakObject
+ ,public ::comphelper::OMutexAndBroadcastHelper
+ ,public ::cppu::OPropertySetHelper
+ {
+ private:
+ typedef ::cppu::OWeakObject UnoBase;
+ typedef ::cppu::OPropertySetHelper PropertyBase;
+
+ private:
+ /// the most recently set value of the parameter
+ ::connectivity::ORowSetValue m_aValue;
+ /// the positions (in our m_xValueDestination) at which the value should be set (0-based!)
+ ::std::vector< sal_Int32 > m_aIndexes;
+
+ /// the "delegator" column to which standard property requests are forwarded
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xDelegator;
+ /// the property set info for our delegator
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > m_xDelegatorPSI;
+ /// the component taking the value
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XParameters > m_xValueDestination;
+ /// helper for implementing XPropertySetInfo
+ ::std::auto_ptr< ::cppu::OPropertyArrayHelper > m_pInfoHelper;
+
+
+ public:
+ const ::connectivity::ORowSetValue& Value() const { return m_aValue; }
+ ::connectivity::ORowSetValue& Value() { return m_aValue; }
+
+ public:
+ ParameterWrapper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn
+ );
+
+ ParameterWrapper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XParameters >& _rxAllParameters,
+ const ::std::vector< sal_Int32 >& _rIndexes
+ );
+
+ DECLARE_XINTERFACE()
+ DECLARE_XTYPEPROVIDER()
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+ // OPropertySetHelper
+ virtual sal_Bool SAL_CALL convertFastPropertyValue( ::com::sun::star::uno::Any& rConvertedValue, ::com::sun::star::uno::Any& rOldValue, sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue) throw( ::com::sun::star::lang::IllegalArgumentException );
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw( ::com::sun::star::uno::Exception );
+ virtual void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const;
+
+ // pseudo-XComponent
+ virtual void SAL_CALL dispose();
+
+ protected:
+ virtual ~ParameterWrapper();
+
+ // disambiguations
+ using ::cppu::OPropertySetHelper::getFastPropertyValue;
+
+ private:
+ OUString impl_getPseudoAggregatePropertyName( sal_Int32 _nHandle ) const;
+
+ private:
+ ParameterWrapper(); // not implemented
+ };
+
+ //====================================================================
+ //= ParameterWrapperContainer
+ //====================================================================
+ typedef ::std::vector< ::rtl::Reference< ParameterWrapper > > Parameters;
+
+ //====================================================================
+ //= ParameterWrapperContainer
+ //====================================================================
+ typedef ::cppu::WeakComponentImplHelper2 < ::com::sun::star::container::XIndexAccess
+ , ::com::sun::star::container::XEnumerationAccess
+ > ParameterWrapperContainer_Base;
+
+ /// class for the parameter event @see approveParameter
+ class OOO_DLLPUBLIC_DBTOOLS ParameterWrapperContainer :
+ public ParameterWrapperContainer_Base
+ {
+ private:
+ ::osl::Mutex m_aMutex;
+ Parameters m_aParameters;
+
+ protected:
+ virtual ~ParameterWrapperContainer();
+
+ public:
+ /** creates an empty container
+ */
+ ParameterWrapperContainer();
+
+ /** creates a container from a SingleSelectQuerAnalyzer's parameter columns
+
+ Note that here, the simple constructor of the ParameterWrapper will be used, which does not
+ use a XParameters instance to forward values to, but only remembers the values itself.
+ */
+ ParameterWrapperContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryAnalyzer >& _rxComposer );
+
+ // ::com::sun::star::container::XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL hasElements() throw( ::com::sun::star::uno::RuntimeException );
+
+ // ::com::sun::star::container::XEnumerationAccess
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration() throw( ::com::sun::star::uno::RuntimeException );
+
+ // ::com::sun::star::container::XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount() throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 _rIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+
+ public:
+ const Parameters& getParameters() { return m_aParameters; }
+
+ const ::connectivity::ORowSetValue& operator[]( size_t _index ) const { return m_aParameters[ _index ]->Value(); }
+ ::connectivity::ORowSetValue& operator[]( size_t _index ) { return m_aParameters[ _index ]->Value(); }
+
+ /** adds an ParameterWrapper to the end of the array
+ */
+ void push_back( ParameterWrapper* _pParameter )
+ {
+ m_aParameters.push_back( _pParameter );
+ }
+
+ size_t size() const { return m_aParameters.size(); }
+
+ protected:
+ // XComponent
+ virtual void SAL_CALL disposing();
+
+ private:
+ void impl_checkDisposed_throw();
+ };
+
+ //====================================================================
+ //= ParametersContainer
+ //====================================================================
+ typedef ::rtl::Reference< ParameterWrapperContainer > ParametersContainerRef;
+
+//........................................................................
+} } // namespace dbtools::param
+//........................................................................
+
+#endif // CONNECTIVITY_PARAMWRAPPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/predicateinput.hxx b/include/connectivity/predicateinput.hxx
new file mode 100644
index 000000000000..629419c9719d
--- /dev/null
+++ b/include/connectivity/predicateinput.hxx
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_PREDICATEINPUT_HXX
+#define CONNECTIVITY_PREDICATEINPUT_HXX
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/util/XNumberFormatter.hpp>
+#include <com/sun/star/i18n/XLocaleData4.hpp>
+#include <connectivity/sqlparse.hxx>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+//.........................................................................
+namespace dbtools
+{
+//.........................................................................
+
+ //=====================================================================
+ //= OPredicateInputController
+ //=====================================================================
+ /** A class which allows input of an SQL predicate for a row set column
+ into a edit field.
+ */
+ class OOO_DLLPUBLIC_DBTOOLS OPredicateInputController
+ {
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
+ m_xConnection;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >
+ m_xFormatter;
+ ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData4 >
+ m_xLocaleData;
+
+ ::connectivity::OSQLParser
+ m_aParser;
+
+ public:
+ OPredicateInputController(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const ::connectivity::IParseContext* _pParseContext = NULL
+ );
+
+ /** transforms a "raw" predicate value (usually obtained from a user input) into a valid predicate for the given column
+ @param _rPredicateValue
+ The text to normalize.
+ @param _rxField
+ The field for which the text should be a predicate value.
+ @param _pErrorMessage
+ If not <NULL/>, and a parsing error occurs, the error message will be copied to the string the argument
+ points to.
+ */
+ sal_Bool normalizePredicateString(
+ OUString& _rPredicateValue,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxField,
+ OUString* _pErrorMessage = NULL
+ ) const;
+
+ /** get's a value of the predicate which can be used in a WHERE clause.
+ @param _rPredicateValue
+ the value which has been normalized using normalizePredicateString
+ @param _rxField
+ is the field for which a predicate is to be entered
+ @param _bForStatementUse
+ If <TRUE/>, the returned value can be used in an SQL statement. If <FALSE/>, it can be used
+ for instance for setting parameter values.
+ @param _pErrorMessage
+ If not <NULL/>, and a parsing error occurs, the error message will be copied to the string the argument
+ points to.
+ @see normalizePredicateString
+ */
+ OUString getPredicateValue(
+ const OUString& _rPredicateValue,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & _rxField,
+ sal_Bool _bForStatementUse,
+ OUString* _pErrorMessage = NULL
+ ) const;
+
+ OUString getPredicateValue(
+ const OUString& _sField
+ , const OUString& _rPredicateValue
+ , sal_Bool _bForStatementUse
+ , OUString* _pErrorMessage = NULL) const;
+
+ private:
+ ::connectivity::OSQLParseNode* implPredicateTree(
+ OUString& _rErrorMessage,
+ const OUString& _rStatement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & _rxField
+ ) const;
+
+ sal_Bool getSeparatorChars(
+ const ::com::sun::star::lang::Locale& _rLocale,
+ sal_Unicode& _rDecSep,
+ sal_Unicode& _rThdSep
+ ) const;
+
+ OUString implParseNode(::connectivity::OSQLParseNode* pParseNode,sal_Bool _bForStatementUse) const;
+ };
+
+//.........................................................................
+} // namespace dbtools
+//.........................................................................
+
+#endif // CONNECTIVITY_PREDICATEINPUT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sdbcx/IRefreshable.hxx b/include/connectivity/sdbcx/IRefreshable.hxx
new file mode 100644
index 000000000000..629b2b3137b5
--- /dev/null
+++ b/include/connectivity/sdbcx/IRefreshable.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_
+#define _CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_
+
+#include "connectivity/CommonTools.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+ class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE IRefreshableGroups
+ {
+ public:
+ virtual void refreshGroups() = 0;
+
+ protected:
+ ~IRefreshableGroups() {}
+ };
+
+ class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE IRefreshableUsers
+ {
+ public:
+ virtual void refreshUsers() = 0;
+
+ protected:
+ ~IRefreshableUsers() {}
+ };
+
+ class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE IRefreshableColumns
+ {
+ public:
+ virtual void refreshColumns() = 0;
+
+ protected:
+ ~IRefreshableColumns() {}
+ };
+ }
+}
+#endif //_CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sdbcx/VCatalog.hxx b/include/connectivity/sdbcx/VCatalog.hxx
new file mode 100644
index 000000000000..14840400b385
--- /dev/null
+++ b/include/connectivity/sdbcx/VCatalog.hxx
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_SDBCX_CATALOG_HXX_
+#define _CONNECTIVITY_SDBCX_CATALOG_HXX_
+
+#include <osl/diagnose.h>
+#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
+#include <com/sun/star/sdbcx/XViewsSupplier.hpp>
+#include <com/sun/star/sdbcx/XUsersSupplier.hpp>
+#include <com/sun/star/sdbcx/XGroupsSupplier.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <cppuhelper/compbase5.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include "connectivity/CommonTools.hxx"
+#include "connectivity/OSubComponent.hxx"
+#include "connectivity/sdbcx/IRefreshable.hxx"
+#include "connectivity/StdTypeDefs.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+
+ class OCollection;
+ // OCatalog is a general catalog class
+ // other drivers can be derived their catalog from this class when they want to support sdbcx
+ // it holds already tables, views, groups and users
+
+ typedef ::cppu::WeakComponentImplHelper5< ::com::sun::star::sdbcx::XTablesSupplier,
+ ::com::sun::star::sdbcx::XViewsSupplier,
+ ::com::sun::star::sdbcx::XUsersSupplier,
+ ::com::sun::star::sdbcx::XGroupsSupplier,
+ ::com::sun::star::lang::XServiceInfo> OCatalog_BASE;
+
+
+ class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE OCatalog :
+ public OCatalog_BASE,
+ public IRefreshableGroups,
+ public IRefreshableUsers,
+ public connectivity::OSubComponent<OCatalog, OCatalog_BASE>
+ {
+ friend class connectivity::OSubComponent<OCatalog, OCatalog_BASE>;
+ protected:
+
+ ::osl::Mutex m_aMutex;
+
+ // this members are deleted when the dtor is called
+ // they are hold weak
+ OCollection* m_pTables;
+ OCollection* m_pViews;
+ OCollection* m_pGroups;
+ OCollection* m_pUsers;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; // just to make things easier
+
+ /** builds the name which should be used to access the object later on in the collection.
+ Will only be called in fillNames.
+ @param _xRow
+ The current row from the resultset given to fillNames.
+ */
+ virtual OUString buildName( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >& _xRow);
+
+ /** fills a vector with the necessary names which can be used in combination with the collections.
+ For each row buildName will be called.
+ @param _xResult
+ The resultset which should be used to fill the names. Will be disposed after return and set to NULL.
+ @param _rNames
+ The vector who will be filled.
+ */
+ void fillNames(::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >& _xResult,TStringVector& _rNames);
+
+ public:
+ OCatalog(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> &_xConnection);
+ virtual ~OCatalog();
+
+ DECLARE_SERVICE_INFO();
+
+ // refreshTables is called when the method getTables had been called
+ // the member m_pTables has to be created
+ virtual void refreshTables() = 0;
+ // refreshViews is called when the method getViews had been called
+ virtual void refreshViews() = 0;
+
+ // the other refresh methods come from base classes IRefreshableGroups and IRefreshableUsers
+
+ // ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing(void);
+ // XInterface
+ void SAL_CALL acquire() throw();
+ void SAL_CALL release() throw();
+ // XTablesSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTables( ) throw(::com::sun::star::uno::RuntimeException);
+ // XViewsSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getViews( ) throw(::com::sun::star::uno::RuntimeException);
+ // XUsersSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getUsers( ) throw(::com::sun::star::uno::RuntimeException);
+ // XGroupsSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getGroups( ) throw(::com::sun::star::uno::RuntimeException);
+
+ };
+ }
+}
+
+#endif // _CONNECTIVITY_SDBCX_CATALOG_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sdbcx/VCollection.hxx b/include/connectivity/sdbcx/VCollection.hxx
new file mode 100644
index 000000000000..e30075f009e9
--- /dev/null
+++ b/include/connectivity/sdbcx/VCollection.hxx
@@ -0,0 +1,237 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_
+#define _CONNECTIVITY_SDBCX_COLLECTION_HXX_
+
+#include <cppuhelper/implbase10.hxx>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/util/XRefreshable.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
+#include <com/sun/star/sdbcx/XAppend.hpp>
+#include <com/sun/star/sdbcx/XDrop.hpp>
+#include <com/sun/star/sdbc/XColumnLocate.hpp>
+#include <comphelper/stl_types.hxx>
+#include <cppuhelper/interfacecontainer.h>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include "connectivity/CommonTools.hxx"
+#include <com/sun/star/container/XContainer.hpp>
+#include "connectivity/StdTypeDefs.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <memory>
+
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+
+ // the class OCollection is base class for collections :-)
+ typedef ::cppu::ImplHelper10< ::com::sun::star::container::XNameAccess,
+ ::com::sun::star::container::XIndexAccess,
+ ::com::sun::star::container::XEnumerationAccess,
+ ::com::sun::star::container::XContainer,
+ ::com::sun::star::sdbc::XColumnLocate,
+ ::com::sun::star::util::XRefreshable,
+ ::com::sun::star::sdbcx::XDataDescriptorFactory,
+ ::com::sun::star::sdbcx::XAppend,
+ ::com::sun::star::sdbcx::XDrop,
+ ::com::sun::star::lang::XServiceInfo> OCollectionBase;
+
+ typedef ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > ObjectType;
+
+ class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE IObjectCollection
+ {
+ public:
+ virtual ~IObjectCollection();
+ virtual void reserve(size_t nLength) = 0;
+ virtual bool exists(const OUString& _sName ) = 0;
+ virtual bool empty() = 0;
+ virtual void swapAll() = 0;
+ virtual void swap() = 0;
+ virtual void clear() = 0;
+ virtual void reFill(const TStringVector &_rVector) = 0;
+ virtual void insert(const OUString& _sName,const ObjectType& _xObject) = 0;
+ virtual bool rename(const OUString _sOldName,const OUString _sNewName) = 0;
+ virtual sal_Int32 size() = 0;
+ virtual ::com::sun::star::uno::Sequence< OUString > getElementNames() = 0;
+ virtual OUString getName(sal_Int32 _nIndex) = 0;
+ virtual void disposeAndErase(sal_Int32 _nIndex) = 0;
+ virtual void disposeElements() = 0;
+ virtual sal_Int32 findColumn( const OUString& columnName ) = 0;
+ virtual OUString findColumnAtIndex( sal_Int32 _nIndex) = 0;
+ virtual ObjectType getObject(sal_Int32 _nIndex) = 0;
+ virtual ObjectType getObject(const OUString& columnName) = 0;
+ virtual void setObject(sal_Int32 _nIndex,const ObjectType& _xObject) = 0;
+ virtual sal_Bool isCaseSensitive() const = 0;
+ };
+ //************************************************************
+ // OCollection
+ //************************************************************
+ class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE OCollection :
+ public OCollectionBase
+ {
+ protected:
+ ::std::auto_ptr<IObjectCollection> m_pElements;
+
+ ::cppu::OInterfaceContainerHelper m_aContainerListeners;
+ ::cppu::OInterfaceContainerHelper m_aRefreshListeners;
+
+ protected:
+ ::cppu::OWeakObject& m_rParent; // parent of the collection
+ ::osl::Mutex& m_rMutex; // mutex of the parent
+ sal_Bool m_bUseIndexOnly; // is only TRUE when only an indexaccess is needed
+
+ // the implementing class should refresh their elements
+ virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException) = 0;
+
+ // will be called when a object was requested by one of the accessing methods like getByIndex
+ virtual ObjectType createObject(const OUString& _rName) = 0;
+
+ // will be called when a new object should be generated by a call of createDataDescriptor
+ // the returned object is empty will be filled outside and added to the collection
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor();
+
+ /** appends an object described by a descriptor, under a given name
+ @param _rForName
+ is the name under which the object should be appended. Guaranteed to not be empty.
+ This is passed for convenience only, since it's the result of a call of
+ getNameForObject for the given descriptor
+ @param descriptor
+ describes the object to append
+ @return
+ the new object which is to be inserted into the collection. This might be the result
+ of a call of <code>createObject( _rForName )</code>, or a clone of the descriptor.
+ */
+ virtual ObjectType appendObject( const OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor );
+
+ // called when XDrop was called
+ virtual void dropObject(sal_Int32 _nPos,const OUString _sElementName);
+
+ /** returns the name for the object. The default implementation ask for the property NAME. If this doesn't satisfy, it has to be overloaded.
+ @param _xObject The object where the name should be extracted.
+ @return The name of the object.
+ */
+ virtual OUString getNameForObject(const ObjectType& _xObject);
+
+ /** clones the given descriptor
+
+ The method calls createDescriptor to create a new, empty descriptor, and then copies all properties from
+ _descriptor to the new object, which is returned.
+
+ This method might come handy in derived classes for implementing appendObject, when the object
+ is not actually appended to any backend (e.g. for the columns collection of a descriptor object itself,
+ where there is not yet a database backend to append the column to).
+ */
+ ObjectType cloneDescriptor( const ObjectType& _descriptor );
+
+ OCollection(::cppu::OWeakObject& _rParent,
+ sal_Bool _bCase,
+ ::osl::Mutex& _rMutex,
+ const TStringVector &_rVector,
+ sal_Bool _bUseIndexOnly = sal_False,
+ sal_Bool _bUseHardRef = sal_True);
+
+ /** clear the name map
+ <p>Does <em>not</em> dispose the objects hold by the collection.</p>
+ */
+ void clear_NoDispose();
+
+ /** insert a new element into the collection
+ */
+ void insertElement(const OUString& _sElementName,const ObjectType& _xElement);
+
+ /** return the name of element at index _nIndex
+ */
+ inline OUString getElementName(sal_Int32 _nIndex)
+ {
+ return m_pElements->findColumnAtIndex(_nIndex);
+ }
+
+
+ /** return the object, if not existent it creates it.
+ @param _nIndex
+ The index of the object to create.
+ @return ObjectType
+ */
+ ObjectType getObject(sal_Int32 _nIndex);
+
+ public:
+ virtual ~OCollection();
+ DECLARE_SERVICE_INFO();
+
+ void reFill(const TStringVector &_rVector);
+ inline sal_Bool isCaseSensitive() const { return m_pElements->isCaseSensitive(); }
+ void renameObject(const OUString _sOldName,const OUString _sNewName);
+
+ // only the name is identical to ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing(void);
+ // dispatch the refcounting to the parent
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+ // ::com::sun::star::container::XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XNameAccess
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName( const OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+ // XEnumerationAccess
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration( ) throw(::com::sun::star::uno::RuntimeException);
+ // ::com::sun::star::util::XRefreshable
+ virtual void SAL_CALL refresh( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addRefreshListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeRefreshListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ // XDataDescriptorFactory
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) throw(::com::sun::star::uno::RuntimeException);
+ // XAppend
+ virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException);
+ // XDrop
+ virtual void SAL_CALL dropByName( const OUString& elementName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL dropByIndex( sal_Int32 index ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ // XColumnLocate
+ virtual sal_Int32 SAL_CALL findColumn( const OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ // ::com::sun::star::container::XContainer
+ virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ private:
+ void notifyElementRemoved(const OUString& _sName);
+ void disposeElements();
+ void dropImpl(sal_Int32 _nIndex,sal_Bool _bReallyDrop = sal_True);
+ };
+ }
+}
+#endif // _CONNECTIVITY_SDBCX_COLLECTION_HXX_
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sdbcx/VColumn.hxx b/include/connectivity/sdbcx/VColumn.hxx
new file mode 100644
index 000000000000..42cddc51c041
--- /dev/null
+++ b/include/connectivity/sdbcx/VColumn.hxx
@@ -0,0 +1,118 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_
+#define _CONNECTIVITY_SDBCX_COLUMN_HXX_
+
+#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <comphelper/IdPropArrayHelper.hxx>
+#include <cppuhelper/compbase2.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include "connectivity/CommonTools.hxx"
+#include <comphelper/broadcasthelper.hxx>
+#include "connectivity/sdbcx/VDescriptor.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+ class OColumn;
+ typedef ::comphelper::OIdPropertyArrayUsageHelper<OColumn> OColumn_PROP;
+
+ typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::container::XNamed,
+ ::com::sun::star::lang::XServiceInfo> OColumnDescriptor_BASE;
+ typedef ::cppu::ImplHelper1< ::com::sun::star::sdbcx::XDataDescriptorFactory > OColumn_BASE;
+
+
+ class OOO_DLLPUBLIC_DBTOOLS OColumn :
+ public comphelper::OBaseMutex,
+ public OColumn_BASE,
+ public OColumnDescriptor_BASE,
+ public OColumn_PROP,
+ public ODescriptor
+ {
+ protected:
+ OUString m_TypeName;
+ OUString m_Description;
+ OUString m_DefaultValue;
+
+ sal_Int32 m_IsNullable;
+ sal_Int32 m_Precision;
+ sal_Int32 m_Scale;
+ sal_Int32 m_Type;
+
+ sal_Bool m_IsAutoIncrement;
+ sal_Bool m_IsRowVersion;
+ sal_Bool m_IsCurrency;
+
+ OUString m_CatalogName;
+ OUString m_SchemaName;
+ OUString m_TableName;
+
+ using OColumnDescriptor_BASE::rBHelper;
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const;
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+ virtual ~OColumn();
+ public:
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ OColumn( sal_Bool _bCase);
+ OColumn( const OUString& _Name,
+ const OUString& _TypeName,
+ const OUString& _DefaultValue,
+ const OUString& _Description,
+ sal_Int32 _IsNullable,
+ sal_Int32 _Precision,
+ sal_Int32 _Scale,
+ sal_Int32 _Type,
+ sal_Bool _IsAutoIncrement,
+ sal_Bool _IsRowVersion,
+ sal_Bool _IsCurrency,
+ sal_Bool _bCase,
+ const OUString& _CatalogName,
+ const OUString& _SchemaName,
+ const OUString& _TableName);
+
+ DECLARE_SERVICE_INFO();
+ //XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ //XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ // ODescriptor
+ virtual void construct();
+ // ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing(void);
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ // XNamed
+ virtual OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+ // XDataDescriptorFactory
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) throw(::com::sun::star::uno::RuntimeException);
+ };
+ }
+}
+
+#endif // _CONNECTIVITY_SDBCX_COLUMN_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sdbcx/VDescriptor.hxx b/include/connectivity/sdbcx/VDescriptor.hxx
new file mode 100644
index 000000000000..aa04b5229ac9
--- /dev/null
+++ b/include/connectivity/sdbcx/VDescriptor.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_SDBCX_DESCRIPTOR_HXX_
+#define _CONNECTIVITY_SDBCX_DESCRIPTOR_HXX_
+
+#include <comphelper/propertycontainer.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/typeprovider.hxx>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <comphelper/stl_types.hxx>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+ // =========================================================================
+ // = ODescriptor
+ // =========================================================================
+ typedef ::comphelper::OPropertyContainer ODescriptor_PBASE;
+ class OOO_DLLPUBLIC_DBTOOLS ODescriptor
+ :public ODescriptor_PBASE
+ ,public ::com::sun::star::lang::XUnoTunnel
+ {
+ protected:
+ OUString m_Name;
+
+ /** helper for derived classes to implement OPropertyArrayUsageHelper::createArrayHelper
+
+ This method just calls describeProperties, and flags all properties as READONLY if and
+ only if we do *not* act as descriptor, but as final object.
+
+ @seealso isNew
+ */
+ ::cppu::IPropertyArrayHelper* doCreateArrayHelper() const;
+
+ private:
+ comphelper::UStringMixEqual m_aCase;
+ sal_Bool m_bNew;
+
+ public:
+ ODescriptor(::cppu::OBroadcastHelper& _rBHelper,sal_Bool _bCase, sal_Bool _bNew = sal_False);
+
+ virtual ~ODescriptor();
+
+ sal_Bool isNew() const { return m_bNew; }
+ sal_Bool getNew() const { return m_bNew; }
+ virtual void setNew(sal_Bool _bNew);
+
+ sal_Bool isCaseSensitive() const { return m_aCase.isCaseSensitive(); }
+
+ virtual void construct();
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // compare
+ inline sal_Bool operator == ( const OUString & _rRH )
+ {
+ return m_aCase(m_Name,_rRH);
+ }
+
+ // com::sun::star::lang::XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
+
+ static ODescriptor* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxSomeComp );
+ // retrieves the ODescriptor implementation of a given UNO component, and returns its ->isNew flag
+ static sal_Bool isNew( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxDescriptor );
+ };
+ }
+
+}
+#endif // _CONNECTIVITY_SDBCX_DESCRIPTOR_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sdbcx/VGroup.hxx b/include/connectivity/sdbcx/VGroup.hxx
new file mode 100644
index 000000000000..6e4ba2355d62
--- /dev/null
+++ b/include/connectivity/sdbcx/VGroup.hxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_SDBCX_GROUP_HXX_
+#define _CONNECTIVITY_SDBCX_GROUP_HXX_
+
+#include <osl/diagnose.h>
+
+
+#include <com/sun/star/sdbcx/XUsersSupplier.hpp>
+#include <com/sun/star/sdbcx/XAuthorizable.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <comphelper/proparrhlp.hxx>
+#include <cppuhelper/compbase4.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include "connectivity/sdbcx/VCollection.hxx"
+#include <comphelper/propertycontainer.hxx>
+#include "connectivity/sdbcx/IRefreshable.hxx"
+#include "connectivity/sdbcx/VDescriptor.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+ typedef OCollection OUsers;
+
+ typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::sdbcx::XUsersSupplier,
+ ::com::sun::star::sdbcx::XAuthorizable,
+ ::com::sun::star::container::XNamed,
+ ::com::sun::star::lang::XServiceInfo> OGroup_BASE;
+
+ class OOO_DLLPUBLIC_DBTOOLS OGroup :
+ public comphelper::OBaseMutex,
+ public OGroup_BASE,
+ public IRefreshableUsers,
+ public ::comphelper::OPropertyArrayUsageHelper<OGroup>,
+ public ODescriptor
+ {
+ protected:
+ OUsers* m_pUsers;
+
+ using OGroup_BASE::rBHelper;
+
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
+ // OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+ public:
+ OGroup(sal_Bool _bCase);
+ OGroup( const OUString& _Name,sal_Bool _bCase);
+ virtual ~OGroup();
+ DECLARE_SERVICE_INFO();
+
+ // XInterface
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ //XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ //XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing(void);
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ // XUsersSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getUsers( ) throw(::com::sun::star::uno::RuntimeException);
+ // XAuthorizable
+ virtual sal_Int32 SAL_CALL getPrivileges( const OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getGrantablePrivileges( const OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grantPrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL revokePrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+
+ // XNamed
+ virtual OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+ };
+ }
+}
+
+#endif // _CONNECTIVITY_SDBCX_GROUP_HXX_
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sdbcx/VIndex.hxx b/include/connectivity/sdbcx/VIndex.hxx
new file mode 100644
index 000000000000..3e50ddf9459c
--- /dev/null
+++ b/include/connectivity/sdbcx/VIndex.hxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_SDBCX_INDEX_HXX_
+#define _CONNECTIVITY_SDBCX_INDEX_HXX_
+
+#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <comphelper/IdPropArrayHelper.hxx>
+#include <cppuhelper/compbase2.hxx>
+#include "connectivity/CommonTools.hxx"
+#include <comphelper/broadcasthelper.hxx>
+#include "connectivity/sdbcx/VTypeDef.hxx"
+#include "connectivity/sdbcx/IRefreshable.hxx"
+#include "connectivity/sdbcx/VDescriptor.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase1.hxx>
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+ class OCollection;
+ class OIndex;
+ typedef ::cppu::ImplHelper1< ::com::sun::star::sdbcx::XDataDescriptorFactory > OIndex_BASE;
+ typedef ::comphelper::OIdPropertyArrayUsageHelper<OIndex> OIndex_PROP;
+
+ class OOO_DLLPUBLIC_DBTOOLS OIndex :
+ public comphelper::OBaseMutex,
+ public ODescriptor_BASE,
+ public IRefreshableColumns,
+ public OIndex_PROP,
+ public ODescriptor,
+ public OIndex_BASE
+ {
+ protected:
+ OUString m_Catalog;
+ sal_Bool m_IsUnique;
+ sal_Bool m_IsPrimaryKeyIndex;
+ sal_Bool m_IsClustered;
+
+ OCollection* m_pColumns;
+
+ using ODescriptor_BASE::rBHelper;
+ virtual void refreshColumns();
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const;
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+ public:
+ OIndex(sal_Bool _bCase);
+ OIndex( const OUString& _Name,
+ const OUString& _Catalog,
+ sal_Bool _isUnique,
+ sal_Bool _isPrimaryKeyIndex,
+ sal_Bool _isClustered,
+ sal_Bool _bCase);
+
+ virtual ~OIndex( );
+
+ DECLARE_SERVICE_INFO();
+
+ //XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+ //XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ // ODescriptor
+ virtual void construct();
+ // ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing(void);
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ // XColumnsSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getColumns( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XNamed
+ virtual OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+ // XDataDescriptorFactory
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) throw(::com::sun::star::uno::RuntimeException);
+ };
+ }
+}
+
+#endif // _CONNECTIVITY_SDBCX_INDEX_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sdbcx/VIndexColumn.hxx b/include/connectivity/sdbcx/VIndexColumn.hxx
new file mode 100644
index 000000000000..a4de9e6bf5bd
--- /dev/null
+++ b/include/connectivity/sdbcx/VIndexColumn.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_SDBCX_INDEXCOLUMN_HXX_
+#define _CONNECTIVITY_SDBCX_INDEXCOLUMN_HXX_
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/sdbcx/VColumn.hxx"
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+ class OIndexColumn;
+ typedef ::comphelper::OIdPropertyArrayUsageHelper<OIndexColumn> OIndexColumn_PROP;
+
+ class OOO_DLLPUBLIC_DBTOOLS OIndexColumn :
+ public OColumn, public OIndexColumn_PROP
+ {
+ protected:
+ sal_Bool m_IsAscending;
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const;
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+ public:
+ OIndexColumn( sal_Bool _bCase);
+ OIndexColumn( sal_Bool _IsAscending,
+ const OUString& _Name,
+ const OUString& _TypeName,
+ const OUString& _DefaultValue,
+ sal_Int32 _IsNullable,
+ sal_Int32 _Precision,
+ sal_Int32 _Scale,
+ sal_Int32 _Type,
+ sal_Bool _IsAutoIncrement,
+ sal_Bool _IsRowVersion,
+ sal_Bool _IsCurrency,
+ sal_Bool _bCase,
+ const OUString& _CatalogName,
+ const OUString& _SchemaName,
+ const OUString& _TableName);
+
+ virtual void construct();
+ DECLARE_SERVICE_INFO();
+ };
+ }
+}
+#endif // _CONNECTIVITY_SDBCX_INDEXCOLUMN_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sdbcx/VKey.hxx b/include/connectivity/sdbcx/VKey.hxx
new file mode 100644
index 000000000000..24d85dfb2614
--- /dev/null
+++ b/include/connectivity/sdbcx/VKey.hxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_SDBCX_KEY_HXX_
+#define _CONNECTIVITY_SDBCX_KEY_HXX_
+
+
+#include <comphelper/IdPropArrayHelper.hxx>
+#include "connectivity/CommonTools.hxx"
+#include <comphelper/broadcasthelper.hxx>
+#include "connectivity/sdbcx/VTypeDef.hxx"
+#include <com/sun/star/container/XNamed.hpp>
+#include "connectivity/sdbcx/IRefreshable.hxx"
+#include "connectivity/sdbcx/VDescriptor.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
+#include <boost/shared_ptr.hpp>
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+
+ struct OOO_DLLPUBLIC_DBTOOLS KeyProperties
+ {
+ ::std::vector< OUString> m_aKeyColumnNames;
+ OUString m_ReferencedTable;
+ sal_Int32 m_Type;
+ sal_Int32 m_UpdateRule;
+ sal_Int32 m_DeleteRule;
+ KeyProperties(const OUString& _ReferencedTable,
+ sal_Int32 _Type,
+ sal_Int32 _UpdateRule,
+ sal_Int32 _DeleteRule)
+ :m_ReferencedTable(_ReferencedTable),
+ m_Type(_Type),
+ m_UpdateRule(_UpdateRule),
+ m_DeleteRule(_DeleteRule)
+ {}
+ KeyProperties():m_Type(0),m_UpdateRule(0),m_DeleteRule(0){}
+ };
+ typedef ::boost::shared_ptr< KeyProperties > TKeyProperties;
+ typedef ::cppu::ImplHelper1< ::com::sun::star::sdbcx::XDataDescriptorFactory > OKey_BASE;
+ class OCollection;
+
+ class OOO_DLLPUBLIC_DBTOOLS OKey :
+ public comphelper::OBaseMutex,
+ public ODescriptor_BASE,
+ public IRefreshableColumns,
+ public ::comphelper::OIdPropertyArrayUsageHelper<OKey>,
+ public ODescriptor,
+ public OKey_BASE
+ {
+ protected:
+ TKeyProperties m_aProps;
+ OCollection* m_pColumns;
+
+ using ODescriptor_BASE::rBHelper;
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const;
+ // OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+ public:
+ OKey(sal_Bool _bCase);
+ OKey(const OUString& _Name,const TKeyProperties& _rProps,sal_Bool _bCase);
+ /*OKey( const OUString& _Name,
+ const OUString& _ReferencedTable,
+ sal_Int32 _Type,
+ sal_Int32 _UpdateRule,
+ sal_Int32 _DeleteRule,
+ sal_Bool _bCase);*/
+
+ virtual ~OKey( );
+
+ DECLARE_SERVICE_INFO();
+ //XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+ //XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ // ODescriptor
+ virtual void construct();
+
+ // ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing();
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ // XColumnsSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getColumns( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XNamed
+ virtual OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+ // XDataDescriptorFactory
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) throw(::com::sun::star::uno::RuntimeException);
+ };
+ }
+}
+
+#endif // _CONNECTIVITY_SDBCX_KEY_HXX_
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sdbcx/VKeyColumn.hxx b/include/connectivity/sdbcx/VKeyColumn.hxx
new file mode 100644
index 000000000000..b22ea3247941
--- /dev/null
+++ b/include/connectivity/sdbcx/VKeyColumn.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_SDBCX_KEYCOLUMN_HXX_
+#define _CONNECTIVITY_SDBCX_KEYCOLUMN_HXX_
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/sdbcx/VColumn.hxx"
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+ class OKeyColumn;
+ typedef ::comphelper::OIdPropertyArrayUsageHelper<OKeyColumn> OKeyColumn_PROP;
+
+ class OOO_DLLPUBLIC_DBTOOLS OKeyColumn :
+ public OColumn, public OKeyColumn_PROP
+ {
+ protected:
+ OUString m_ReferencedColumn;
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const;
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+ public:
+ OKeyColumn(sal_Bool _bCase);
+ OKeyColumn( const OUString& _ReferencedColumn,
+ const OUString& _Name,
+ const OUString& _TypeName,
+ const OUString& _DefaultValue,
+ sal_Int32 _IsNullable,
+ sal_Int32 _Precision,
+ sal_Int32 _Scale,
+ sal_Int32 _Type,
+ sal_Bool _IsAutoIncrement,
+ sal_Bool _IsRowVersion,
+ sal_Bool _IsCurrency,
+ sal_Bool _bCase,
+ const OUString& _CatalogName,
+ const OUString& _SchemaName,
+ const OUString& _TableName);
+ // just to make it not inline
+ virtual ~OKeyColumn();
+
+ virtual void construct();
+ DECLARE_SERVICE_INFO();
+ };
+ }
+}
+#endif // _CONNECTIVITY_SDBCX_KEYCOLUMN_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sdbcx/VTable.hxx b/include/connectivity/sdbcx/VTable.hxx
new file mode 100644
index 000000000000..0be41a9cd22f
--- /dev/null
+++ b/include/connectivity/sdbcx/VTable.hxx
@@ -0,0 +1,141 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_SDBCX_TABLE_HXX_
+#define _CONNECTIVITY_SDBCX_TABLE_HXX_
+
+#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
+#include <com/sun/star/sdbcx/XIndexesSupplier.hpp>
+#include <com/sun/star/sdbcx/XRename.hpp>
+#include <com/sun/star/sdbcx/XAlterTable.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/sdbcx/XKeysSupplier.hpp>
+#include <comphelper/IdPropArrayHelper.hxx>
+#include <cppuhelper/compbase4.hxx>
+#include <cppuhelper/implbase4.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <com/sun/star/container/XNamed.hpp>
+#include "connectivity/sdbcx/IRefreshable.hxx"
+#include "connectivity/sdbcx/VDescriptor.hxx"
+#include "connectivity/CommonTools.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+
+ class OTable;
+ class OCollection;
+
+ typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::sdbcx::XColumnsSupplier,
+ ::com::sun::star::sdbcx::XKeysSupplier,
+ ::com::sun::star::container::XNamed,
+ ::com::sun::star::lang::XServiceInfo> OTableDescriptor_BASE;
+
+ typedef ::cppu::ImplHelper4< ::com::sun::star::sdbcx::XDataDescriptorFactory,
+ ::com::sun::star::sdbcx::XIndexesSupplier,
+ ::com::sun::star::sdbcx::XRename,
+ ::com::sun::star::sdbcx::XAlterTable > OTable_BASE;
+
+ typedef ::comphelper::OIdPropertyArrayUsageHelper<OTable> OTable_PROP;
+
+
+ class OOO_DLLPUBLIC_DBTOOLS OTable :
+ public comphelper::OBaseMutex,
+ public OTable_BASE,
+ public OTableDescriptor_BASE,
+ public IRefreshableColumns,
+ public OTable_PROP,
+ public ODescriptor
+ {
+ protected:
+ OUString m_CatalogName;
+ OUString m_SchemaName;
+ OUString m_Description;
+ OUString m_Type;
+
+ OCollection* m_pKeys;
+ OCollection* m_pColumns;
+ OCollection* m_pIndexes;
+ OCollection* m_pTables; // must hold his own container to notify him when renaming
+
+ using OTableDescriptor_BASE::rBHelper;
+
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 _nId ) const;
+ // OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+ public:
+ OTable( OCollection* _pTables,
+ sal_Bool _bCase);
+ OTable( OCollection* _pTables,
+ sal_Bool _bCase,
+ const OUString& _Name,
+ const OUString& _Type,
+ const OUString& _Description = OUString(),
+ const OUString& _SchemaName = OUString(),
+ const OUString& _CatalogName = OUString());
+
+ virtual ~OTable();
+
+ DECLARE_SERVICE_INFO();
+ //XInterface
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ //XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ODescriptor
+ virtual void construct();
+ virtual void refreshColumns();
+ virtual void refreshKeys();
+ virtual void refreshIndexes();
+ // ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing(void);
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ // XColumnsSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getColumns( ) throw(::com::sun::star::uno::RuntimeException);
+ // XKeysSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL getKeys( ) throw(::com::sun::star::uno::RuntimeException);
+ // XNamed
+ virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+ // XDataDescriptorFactory
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( void ) throw(::com::sun::star::uno::RuntimeException);
+ // XIndexesSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getIndexes( ) throw(::com::sun::star::uno::RuntimeException);
+ // XRename
+ virtual void SAL_CALL rename( const OUString& newName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException);
+ // XAlterTable
+ virtual void SAL_CALL alterColumnByName( const OUString& colName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL alterColumnByIndex( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // helper method
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> getMetaData() const;
+ };
+ }
+}
+
+#endif // _CONNECTIVITY_SDBCX_TABLE_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sdbcx/VTypeDef.hxx b/include/connectivity/sdbcx/VTypeDef.hxx
new file mode 100644
index 000000000000..08019f9174da
--- /dev/null
+++ b/include/connectivity/sdbcx/VTypeDef.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_SDBCX_TYPEDEF_HXX_
+#define _CONNECTIVITY_SDBCX_TYPEDEF_HXX_
+
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <cppuhelper/compbase3.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+ typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::sdbcx::XColumnsSupplier,
+ ::com::sun::star::container::XNamed,
+ ::com::sun::star::lang::XServiceInfo> ODescriptor_BASE;
+ }
+}
+
+#endif // _CONNECTIVITY_SDBCX_TYPEDEF_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sdbcx/VUser.hxx b/include/connectivity/sdbcx/VUser.hxx
new file mode 100644
index 000000000000..01bafc0d177c
--- /dev/null
+++ b/include/connectivity/sdbcx/VUser.hxx
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_SDBCX_USER_HXX_
+#define _CONNECTIVITY_SDBCX_USER_HXX_
+
+#include <osl/diagnose.h>
+#include <com/sun/star/sdbcx/XUser.hpp>
+#include <com/sun/star/sdbcx/XGroupsSupplier.hpp>
+#include <comphelper/proparrhlp.hxx>
+#include <cppuhelper/compbase4.hxx>
+#include "connectivity/CommonTools.hxx"
+#include <comphelper/broadcasthelper.hxx>
+#include "connectivity/sdbcx/VCollection.hxx"
+#include <com/sun/star/container/XNamed.hpp>
+#include "connectivity/sdbcx/IRefreshable.hxx"
+#include "connectivity/sdbcx/VDescriptor.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+ typedef OCollection OGroups;
+
+ typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::sdbcx::XUser,
+ ::com::sun::star::sdbcx::XGroupsSupplier,
+ ::com::sun::star::container::XNamed,
+ ::com::sun::star::lang::XServiceInfo> OUser_BASE;
+
+ class OOO_DLLPUBLIC_DBTOOLS OUser :
+ public comphelper::OBaseMutex,
+ public OUser_BASE,
+ public IRefreshableGroups,
+ public ::comphelper::OPropertyArrayUsageHelper<OUser>,
+ public ODescriptor
+ {
+ protected:
+ OGroups* m_pGroups;
+
+ using OUser_BASE::rBHelper;
+
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
+ // OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+ public:
+ OUser(sal_Bool _bCase);
+ OUser(const OUString& _Name,sal_Bool _bCase);
+
+ virtual ~OUser( );
+
+ DECLARE_SERVICE_INFO();
+
+ // ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing(void);
+ //XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+ //XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ // XUser
+ virtual void SAL_CALL changePassword( const OUString& objPassword, const OUString& newPassword ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ // XAuthorizable
+ virtual sal_Int32 SAL_CALL getPrivileges( const OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getGrantablePrivileges( const OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grantPrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL revokePrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ // XGroupsSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getGroups( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XNamed
+ virtual OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+ };
+ }
+}
+
+#endif // _CONNECTIVITY_SDBCX_USER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sdbcx/VView.hxx b/include/connectivity/sdbcx/VView.hxx
new file mode 100644
index 000000000000..6134ddc4bb69
--- /dev/null
+++ b/include/connectivity/sdbcx/VView.hxx
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_SDBCX_VIEW_HXX_
+#define _CONNECTIVITY_SDBCX_VIEW_HXX_
+
+#include <osl/diagnose.h>
+#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+#include <comphelper/proparrhlp.hxx>
+#include <cppuhelper/compbase1.hxx>
+#include "connectivity/CommonTools.hxx"
+#include <cppuhelper/interfacecontainer.h>
+#include <com/sun/star/container/XNamed.hpp>
+#include "connectivity/sdbcx/VDescriptor.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <comphelper/IdPropArrayHelper.hxx>
+#include <cppuhelper/implbase2.hxx>
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+
+ typedef ::cppu::WeakImplHelper2< ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::container::XNamed> OView_BASE;
+
+
+
+ class OOO_DLLPUBLIC_DBTOOLS OView :
+ public ::comphelper::OMutexAndBroadcastHelper,
+ public OView_BASE,
+ public ::comphelper::OIdPropertyArrayUsageHelper<OView>,
+ public ODescriptor
+ {
+ protected:
+ OUString m_CatalogName;
+ OUString m_SchemaName;
+ OUString m_Command;
+ sal_Int32 m_CheckOption;
+ // need for the getName method
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData;
+
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const;
+ // OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ public:
+ DECLARE_SERVICE_INFO();
+
+ OView(sal_Bool _bCase,const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _xMetaData);
+ OView( sal_Bool _bCase,
+ const OUString& _rName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _xMetaData,
+ sal_Int32 _nCheckOption = 0,
+ const OUString& _rCommand = OUString(),
+ const OUString& _rSchemaName = OUString(),
+ const OUString& _rCatalogName = OUString());
+ virtual ~OView();
+
+ // ODescriptor
+ virtual void construct();
+
+ // ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing(void);
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+ //XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ // XNamed
+ virtual OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName( const OUString& ) throw(::com::sun::star::uno::RuntimeException);
+ };
+ }
+}
+
+#endif // _CONNECTIVITY_SDBCX_VIEW_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sqlerror.hxx b/include/connectivity/sqlerror.hxx
new file mode 100644
index 000000000000..ccad18a88d0f
--- /dev/null
+++ b/include/connectivity/sqlerror.hxx
@@ -0,0 +1,317 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_SQLERROR_HXX
+#define CONNECTIVITY_SQLERROR_HXX
+
+#include <com/sun/star/sdbc/SQLException.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/optional.hpp>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+//........................................................................
+namespace connectivity
+{
+//........................................................................
+
+ //====================================================================
+ //= ErrorCondition
+ //====================================================================
+ /** the type of error codes to be used in SQLExceptions
+
+ @see com::sun::star::sdbc::SQLException::ErrorCode
+ */
+ typedef ::sal_Int32 ErrorCode;
+
+ /** error condition values as defined in <type scope="com::sun::star::sdb">ErrorCondition</type>
+ */
+ typedef ::sal_Int32 ErrorCondition;
+
+ //====================================================================
+ //= SQLError
+ //====================================================================
+ class SQLError_Impl;
+
+ /** a class which provides helpers for working with SQLErrors
+
+ In particular, this class provides vendor-specific error codes (where
+ the vendor is OpenOffice.org Base), which can be used in OOo's various
+ database drivers, and checked in application-level code, to properly
+ recognize highly specific error conditions.
+
+ @see ::com::sun::star::sdb::ErrorCondition
+ */
+ class OOO_DLLPUBLIC_DBTOOLS SQLError
+ {
+ public:
+ // --------------------------------------------------------------------
+ // - optional
+ // --------------------------------------------------------------------
+ /** convenience wrapper around boost::optional, allowing implicit construction
+ */
+ class ParamValue : public ::boost::optional< OUString >
+ {
+ typedef ::boost::optional< OUString > base_type;
+
+ public:
+ ParamValue( ) : base_type( ) { }
+ ParamValue( OUString const& val ) : base_type( val ) { }
+ ParamValue( ParamValue const& rhs ) : base_type( (base_type const&)rhs ) { }
+
+ bool is() const { return !base_type::operator!(); }
+ };
+
+
+ public:
+ explicit SQLError( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & _rxContext );
+ ~SQLError();
+
+ /** returns the message associated with a given error condition, after (optionally) replacing
+ a placeholder with a given string
+
+ Some error messages need to contain references to runtime-dependent data (say, the
+ name of a concrete table in the database), which in the resource file's strings are
+ represented by a placeholder, namely $1$, $2, and so on. This method allows to
+ retrieve such an error message, and replace upo to 3 placeholders with their concrete
+ values.
+
+ In a non-product build, assertions will fire if the number of placeholders in the
+ message's resource string does not match the number of passed parameter values.
+
+ As specified in the <type scope="com::sun::star::sdb">ErrorCondition</type> type,
+ error messages thrown by core components of OpenOffice.org Base will contain
+ a standardized prefix &quot;[OOoBase]&quot; in every message.
+
+ @param _rParamValue1
+ the value which the placeholder $1$ should be replaced with. If this value is
+ not present (see <code>::boost::optional::operator !</code>), then no replacement
+ will happen, and <code>_rParamValue2</code> and <code>_rParamValue3</code> will be
+ ignored.
+
+ @param _rParamValue2
+ the value which the placeholder $2$ should be replaced with. If this value is
+ not present (see <code>::boost::optional::operator !</code>), then no replacement
+ will happen, and <code>_rParamValue3</code> will be ignored.
+
+ @param _rParamValue1
+ the value which the placeholder $1$ should be replaced with. If this value is
+ not present (see <code>::boost::optional::operator !</code>), then no replacement
+ will happen.
+
+ @see ::com::sun::star::sdb::ErrorCondition
+ */
+ OUString getErrorMessage(
+ const ErrorCondition _eCondition,
+ const ParamValue& _rParamValue1 = ParamValue(),
+ const ParamValue& _rParamValue2 = ParamValue(),
+ const ParamValue& _rParamValue3 = ParamValue()
+ ) const;
+
+ /** returns the error code associated with a given error condition
+
+ @see getErrorMessage
+ @see ::com::sun::star::sdb::ErrorCondition
+ @see ::com::sun::star::sdbc::SQLException::ErrorCode
+ */
+ static ErrorCode
+ getErrorCode( const ErrorCondition _eCondition );
+
+ /** returns the prefix which is used for OpenOffice.org Base's error messages
+
+ As specified in the <type scope="com::sun::star::sdb">ErrorCondition</type> type,
+ error messages thrown by core components of OpenOffice.org Base will
+ contain a standardized prefix in every message. <code>getBaseErrorMessagePrefix</code>
+ returns this prefix, so clients of such error messages might decide to strip this
+ prefix before presenting the message to the user, or use it to determine
+ whether a concrete error has been raised by a OpenOffice.org core component.
+ */
+ static const OUString&
+ getMessagePrefix();
+
+
+ /** throws an SQLException describing the given error condition
+
+ The thrown SQLException will contain the OOo-specific error code which derives
+ from the given error condition, and the error message associated with that condition.
+
+ @param _eCondition
+ the ErrorCondition which hit you
+
+ @param _rxContext
+ the context in which the error occurred. This will be filled in as
+ <member scope="com::sun::star::uno">Exception::Context</member> member.
+
+ @param _rParamValue1
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the first placeholder
+ in this message.
+
+ @param _rParamValue2
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the second placeholder
+ in this message.
+
+ @param _rParamValue3
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the third placeholder
+ in this message.
+
+ @see getErrorMessage
+ @see getErrorCode
+ */
+ void raiseException(
+ const ErrorCondition _eCondition,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
+ const ParamValue& _rParamValue1 = ParamValue(),
+ const ParamValue& _rParamValue2 = ParamValue(),
+ const ParamValue& _rParamValue3 = ParamValue()
+ ) const;
+
+ /** throws an SQLException describing the given error condition
+
+ The thrown SQLException will contain the OOo-specific error code which derives
+ from the given error condition, and the error message associated with that condition.
+
+ Note: You should prefer the version of <type>raiseException</type> which takes
+ an additional <type>Context</type> parameter, since this allows clients of your
+ exception to examine where the error occurred.
+
+ @param _eCondition
+ the ErrorCondition which hit you
+
+ @param _rParamValue1
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the first placeholder
+ in this message.
+
+ @param _rParamValue2
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the second placeholder
+ in this message.
+
+ @param _rParamValue3
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the third placeholder
+ in this message.
+
+ @see getErrorMessage
+ @see getErrorCode
+ */
+ void raiseException(
+ const ErrorCondition _eCondition,
+ const ParamValue& _rParamValue1 = ParamValue(),
+ const ParamValue& _rParamValue2 = ParamValue(),
+ const ParamValue& _rParamValue3 = ParamValue()
+ ) const;
+
+ /** raises a typed exception, that is, a UNO exception which is derived from
+ <type scope="com::sun::star::sdbc">SQLException</type>
+
+ @param _eCondition
+ the ErrorCondition which hit you
+
+ @param _rxContext
+ the context in which the error occurred. This will be filled in as
+ <member scope="com::sun::star::uno">Exception::Context</member> member.
+
+ @param _rExceptionType
+ the type of the exception to throw. This type <em>must</em> specify
+ an exception class derived from <type scope="com::sun::star::sdbc">SQLException</type>.
+
+ @param _rParamValue1
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the first placeholder
+ in this message.
+
+ @param _rParamValue2
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the second placeholder
+ in this message.
+
+ @param _rParamValue3
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the third placeholder
+ in this message.
+
+ @throws ::std::bad_cast
+ if <arg>_rExceptionType</arg> does not specify an exception class derived from
+ <type scope="com::sun::star::sdbc">SQLException</type>.
+
+ @see getErrorMessage
+ @see getErrorCode
+ */
+ void raiseTypedException(
+ const ErrorCondition _eCondition,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
+ const ::com::sun::star::uno::Type& _rExceptionType,
+ const ParamValue& _rParamValue1 = ParamValue(),
+ const ParamValue& _rParamValue2 = ParamValue(),
+ const ParamValue& _rParamValue3 = ParamValue()
+ ) const;
+
+ /** retrieves an <code>SQLException</code> object which contains information about
+ the given error condition
+
+ @param _eCondition
+ the ErrorCondition which hit you
+
+ @param _rxContext
+ the context in which the error occurred. This will be filled in as
+ <member scope="com::sun::star::uno">Exception::Context</member> member.
+
+ @param _rParamValue1
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the first placeholder
+ in this message.
+
+ @param _rParamValue2
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the second placeholder
+ in this message.
+
+ @param _rParamValue3
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the third placeholder
+ in this message.
+
+ @see getErrorMessage
+ @see getErrorCode
+ */
+ ::com::sun::star::sdbc::SQLException
+ getSQLException(
+ const ErrorCondition _eCondition,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
+ const ParamValue& _rParamValue1 = ParamValue(),
+ const ParamValue& _rParamValue2 = ParamValue(),
+ const ParamValue& _rParamValue3 = ParamValue()
+ ) const;
+
+ private:
+ ::boost::shared_ptr< SQLError_Impl > m_pImpl;
+ };
+
+//........................................................................
+} // namespace connectivity
+//........................................................................
+
+#endif // CONNECTIVITY_SQLERROR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sqliterator.hxx b/include/connectivity/sqliterator.hxx
new file mode 100644
index 000000000000..ee967dd7d7a3
--- /dev/null
+++ b/include/connectivity/sqliterator.hxx
@@ -0,0 +1,356 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _CONNECTIVITY_PARSE_SQLITERATOR_HXX_
+#define _CONNECTIVITY_PARSE_SQLITERATOR_HXX_
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/sqlnode.hxx"
+#include <connectivity/IParseContext.hxx>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/sdbc/SQLWarning.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include "connectivity/CommonTools.hxx"
+#include <rtl/ref.hxx>
+#include <cppuhelper/weak.hxx>
+
+#include <map>
+#include <memory>
+#include <vector>
+
+namespace connectivity
+{
+
+ class OSQLParseNode;
+ class OSQLParser;
+
+ typedef ::std::pair<const OSQLParseNode*,const OSQLParseNode* > TNodePair;
+
+ enum OSQLStatementType {
+ SQL_STATEMENT_UNKNOWN,
+ SQL_STATEMENT_SELECT,
+ SQL_STATEMENT_INSERT,
+ SQL_STATEMENT_UPDATE,
+ SQL_STATEMENT_DELETE,
+ SQL_STATEMENT_ODBC_CALL,
+ SQL_STATEMENT_CREATE_TABLE
+ };
+
+ struct OSQLParseTreeIteratorImpl;
+
+ class OOO_DLLPUBLIC_DBTOOLS OSQLParseTreeIterator
+ {
+ private:
+ ::com::sun::star::sdbc::SQLException m_aErrors; // conatins the error while iterating through the statement
+ const OSQLParseNode* m_pParseTree; // current ParseTree
+ const OSQLParser& m_rParser; // if set used for general error messages from the context
+ OSQLStatementType m_eStatementType;
+ ::rtl::Reference<OSQLColumns> m_aSelectColumns; // all columns from the Select clause
+ ::rtl::Reference<OSQLColumns> m_aParameters; // all parameters
+ ::rtl::Reference<OSQLColumns> m_aGroupColumns; // the group by columns
+ ::rtl::Reference<OSQLColumns> m_aOrderColumns; // the order by columns
+ ::rtl::Reference<OSQLColumns> m_aCreateColumns; // the columns for Create table clause
+
+ ::std::auto_ptr< OSQLParseTreeIteratorImpl > m_pImpl;
+
+ void traverseParameter(const OSQLParseNode* _pParseNode,const OSQLParseNode* _pColumnRef,const OUString& _aColumnName, OUString& _aTableRange, const OUString& _rColumnAlias);
+ // inserts a table into the map
+ void traverseOneTableName( OSQLTables& _rTables,const OSQLParseNode * pTableName, const OUString & rTableRange );
+ void traverseSearchCondition(OSQLParseNode * pSearchCondition);
+ void traverseOnePredicate(
+ OSQLParseNode * pColumnRef,
+ OUString& aValue,
+ OSQLParseNode * pParameter);
+ void traverseByColumnNames(const OSQLParseNode* pSelectNode,sal_Bool _bOrder);
+ void traverseParameters(const OSQLParseNode* pSelectNode);
+
+ const OSQLParseNode* getTableNode( OSQLTables& _rTables, const OSQLParseNode* pTableRef, OUString& aTableRange );
+ void getQualified_join( OSQLTables& _rTables, const OSQLParseNode *pTableRef, OUString& aTableRange );
+ void getSelect_statement(OSQLTables& _rTables,const OSQLParseNode* pSelect);
+ OUString getUniqueColumnName(const OUString & rColumnName) const;
+
+ /** finds the column with a given name, belonging to a given table, in a given tables collection
+ @param _rTables
+ the tables collection to look in
+ @param rColumnName
+ the column name to look for
+ @param rTableRange
+ the table alias name; if empty, look in all tables
+ @return
+ the desired column object, or <NULL/> if no such column could be found
+ */
+ static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > findColumn(
+ const OSQLTables& _rTables, const OUString & rColumnName, OUString & rTableRange );
+
+ /** finds a column with a given name, belonging to a given table
+ @param rColumnName
+ the column name to look for
+ @param rTableRange
+ the table alias name; if empty, look in all tables
+ @param _bLookInSubTables
+ <TRUE/> if and only if not only our direct tables, but also our sub tables (from sub selects)
+ should be searched
+ @return
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > findColumn(
+ const OUString & rColumnName, OUString & rTableRange, bool _bLookInSubTables );
+
+ protected:
+ void setSelectColumnName(::rtl::Reference<OSQLColumns>& _rColumns,const OUString & rColumnName,const OUString & rColumnAlias, const OUString & rTableRange,sal_Bool bFkt=sal_False,sal_Int32 _nType = com::sun::star::sdbc::DataType::VARCHAR,sal_Bool bAggFkt=sal_False);
+ void appendColumns(::rtl::Reference<OSQLColumns>& _rColumns,const OUString& _rTableAlias,const OSQLTable& _rTable);
+ // Other member variables that should be available in the "set" functions
+ // can be defined in the derived class. They can be initialized
+ // in its constructor and, after the "traverse" routines have been used,
+ // they can be queried using other functions.
+
+
+ private:
+ OSQLParseTreeIterator(); // never implemented
+ OSQLParseTreeIterator(const OSQLParseTreeIterator & rIter); // never implemented
+
+ public:
+ OSQLParseTreeIterator(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxTables,
+ const OSQLParser& _rParser,
+ const OSQLParseNode* pRoot = NULL );
+ ~OSQLParseTreeIterator();
+
+ inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW(())
+ { return ::rtl_allocateMemory( nSize ); }
+ inline static void * SAL_CALL operator new( size_t,void* _pHint ) SAL_THROW(())
+ { return _pHint; }
+ inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW(())
+ { ::rtl_freeMemory( pMem ); }
+ inline static void SAL_CALL operator delete( void *,void* ) SAL_THROW(())
+ { }
+
+ void dispose();
+ bool isCaseSensitive() const;
+ // The parse tree to be analysed/traversed:
+ // If NULL is passed, the current parse tree will be deleted and the error status cleared.
+ void setParseTree(const OSQLParseNode * pNewParseTree);
+// void setParser(const OSQLParser* _pParser) { m_pParser = _pParser; }
+ const OSQLParseNode * getParseTree() const { return m_pParseTree; };
+
+ // subtrees in case of a select statement
+ const OSQLParseNode* getWhereTree() const;
+ const OSQLParseNode* getOrderTree() const;
+ const OSQLParseNode* getGroupByTree() const;
+ const OSQLParseNode* getHavingTree() const;
+
+ const OSQLParseNode* getSimpleWhereTree() const;
+ const OSQLParseNode* getSimpleOrderTree() const;
+ const OSQLParseNode* getSimpleGroupByTree() const;
+ const OSQLParseNode* getSimpleHavingTree() const;
+
+ /** returns the errors which occurred during parsing.
+
+ The returned object contains a chain (via SQLException::NextException) of SQLExceptions.
+ */
+ inline const ::com::sun::star::sdbc::SQLException& getErrors() const { return m_aErrors; }
+ inline bool hasErrors() const { return !m_aErrors.Message.isEmpty(); }
+
+ // statement type (already set in setParseTree):
+ OSQLStatementType getStatementType() const { return m_eStatementType; }
+
+ /** traverses the complete statement tree, and fills all our data with
+ the information obatined during traversal.
+
+ Implemented by calling the single traverse* methods in the proper
+ order (depending on the statement type).
+ */
+ void traverseAll();
+
+ enum TraversalParts
+ {
+ Parameters = 0x0001,
+ TableNames = 0x0002,
+ SelectColumns = 0x0006, // note that this includes TableNames. No SelectColumns without TableNames
+
+ // Those are not implemented currently
+ // GroupColumns = 0x0008,
+ // OrderColumns = 0x0010,
+ // SelectColumns = 0x0020,
+ // CreateColumns = 0x0040,
+
+ All = 0xFFFF
+ };
+ /** traverses selected parts of the statement tree, and fills our data with
+ the information obtained during traversal
+
+ @param _nIncludeMask
+ set of TraversalParts bits, specifying which information is to be collected.
+ Note TraversalParts is currently not
+ */
+ void traverseSome( sal_uInt32 _nIncludeMask );
+
+ // The TableRangeMap contains all tables associated with the range name found first.
+ const OSQLTables& getTables() const;
+
+ ::rtl::Reference<OSQLColumns> getSelectColumns() const { return m_aSelectColumns;}
+ ::rtl::Reference<OSQLColumns> getGroupColumns() const { return m_aGroupColumns;}
+ ::rtl::Reference<OSQLColumns> getOrderColumns() const { return m_aOrderColumns;}
+ ::rtl::Reference<OSQLColumns> getParameters() const { return m_aParameters; }
+ ::rtl::Reference<OSQLColumns> getCreateColumns() const { return m_aCreateColumns;}
+
+ /** return the columname and the table range
+ @param _pColumnRef
+ The column ref parse node.
+ @param _rColumnName
+ The column name to be set.
+ @param _rTableRange
+ The table range to be set.
+ */
+ void getColumnRange( const OSQLParseNode* _pColumnRef,
+ OUString &_rColumnName,
+ OUString& _rTableRange) const;
+
+ /** retrieves a column's name, table range, and alias
+
+ @param _pColumnRef
+ The column_ref parse node.
+ @param _out_rColumnName
+ The column name to be set.
+ @param _out_rTableRange
+ The table range to be set.
+ @param _out_rColumnAliasIfPresent
+ If the column specified by _pColumnRef is part of the select columns, and contains a column alias there,
+ this alias is returned here.
+ */
+ void getColumnRange( const OSQLParseNode* _pColumnRef,
+ OUString& _out_rColumnName,
+ OUString& _out_rTableRange,
+ OUString& _out_rColumnAliasIfPresent
+ ) const;
+
+ /** return the alias name of a column
+ @param _pDerivedColumn
+ The parse node where SQL_ISRULE(_pDerivedColumn,derived_column) must be true
+ @return
+ The alias name of the column or an empty string.
+ */
+ static OUString getColumnAlias(const OSQLParseNode* _pDerivedColumn);
+
+ /** return the columname and the table range
+ @param _pColumnRef
+ The column ref parse node.
+ @param _xMetaData
+ The database meta data.
+ @param _rColumnName
+ The column name to be set.
+ @param _rTableRange
+ The table range to be set.
+ */
+ static void getColumnRange( const OSQLParseNode* _pColumnRef,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ OUString &_rColumnName,
+ OUString& _rTableRange);
+
+ // empty if ambiguous
+ sal_Bool getColumnTableRange(const OSQLParseNode* pNode, OUString &rTableRange) const;
+
+ // return true when the tableNode is a rule like catalog_name, schema_name or table_name
+ sal_Bool isTableNode(const OSQLParseNode* _pTableNode) const;
+
+ // tries to find the correct type of the function
+ sal_Int32 getFunctionReturnType(const OSQLParseNode* _pNode );
+
+ // returns a lis of all joined columns
+ ::std::vector< TNodePair >& getJoinConditions() const;
+
+ private:
+ /** traverses the list of table names, and filles _rTables
+ */
+ bool traverseTableNames( OSQLTables& _rTables );
+
+ /// traverses columns in a SELECT statement
+ bool traverseSelectColumnNames(const OSQLParseNode* pSelectNode);
+ /// traverses columns in a CREATE TABLE statement
+ void traverseCreateColumns(const OSQLParseNode* pSelectNode);
+
+ bool traverseOrderByColumnNames(const OSQLParseNode* pSelectNode);
+ bool traverseGroupByColumnNames(const OSQLParseNode* pSelectNode);
+
+ bool traverseSelectionCriteria(const OSQLParseNode* pSelectNode);
+
+ private:
+ /** constructs a new iterator, which inherits some of the settings from a parent iterator
+ */
+ OSQLParseTreeIterator(
+ const OSQLParseTreeIterator& _rParentIterator,
+ const OSQLParser& _rParser,
+ const OSQLParseNode* pRoot );
+
+ /** creates a table object and inserts it into our tables collection
+
+ only used when we're iterating through a CREATE TABLE statement
+ */
+ OSQLTable impl_createTableObject(
+ const OUString& rTableName, const OUString& rCatalogName, const OUString& rSchemaName );
+
+ /** locates a record source (a table or query) with the given name
+ */
+ OSQLTable impl_locateRecordSource(
+ const OUString& _rComposedName
+ );
+
+ /** implementation for both traverseAll and traverseSome
+ */
+ void impl_traverse( sal_uInt32 _nIncludeMask );
+
+ /** retrieves the parameter columns of the given query
+ */
+ void impl_getQueryParameterColumns( const OSQLTable& _rQuery );
+
+ void setOrderByColumnName(const OUString & rColumnName, OUString & rTableRange, sal_Bool bAscending);
+ void setGroupByColumnName(const OUString & rColumnName, OUString & rTableRange);
+
+ private:
+ /** appends an SQLException corresponding to the given error code to our error collection
+
+ @param _eError
+ the code of the error which occurred
+ @param _pReplaceToken1
+ if not <NULL/>, the first occurrence of '#' in the error message will be replaced
+ with the given token
+ @param _pReplaceToken2
+ if not <NULL/>, and if _rReplaceToken1 is not <NULL/>, the second occurrence of '#'
+ in the error message will be replaced with _rReplaceToken2
+ */
+ void impl_appendError( IParseContext::ErrorCode _eError,
+ const OUString* _pReplaceToken1 = NULL, const OUString* _pReplaceToken2 = NULL );
+
+ /** appends an SQLException corresponding to the given error code to our error collection
+ */
+ void impl_appendError( const ::com::sun::star::sdbc::SQLException& _rError );
+
+ /** resets our errors
+ */
+ inline void impl_resetErrors()
+ {
+ m_aErrors = ::com::sun::star::sdbc::SQLException();
+ }
+ void impl_fillJoinConditions(const OSQLParseNode* i_pJoinCondition);
+ };
+}
+
+#endif // _CONNECTIVITY_PARSE_SQLITERATOR_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sqlnode.hxx b/include/connectivity/sqlnode.hxx
new file mode 100644
index 000000000000..f988f78e7e14
--- /dev/null
+++ b/include/connectivity/sqlnode.hxx
@@ -0,0 +1,466 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _CONNECTIVITY_SQLNODE_HXX
+#define _CONNECTIVITY_SQLNODE_HXX
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/dbmetadata.hxx"
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/util/XNumberFormatTypes.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <vector>
+#include <functional>
+#include <set>
+#include <boost/shared_ptr.hpp>
+#include <rtl/ustrbuf.hxx>
+
+// forward declarations
+namespace com
+{
+ namespace sun
+ {
+ namespace star
+ {
+ namespace beans
+ {
+ class XPropertySet;
+ }
+ namespace util
+ {
+ class XNumberFormatter;
+ }
+ namespace container
+ {
+ class XNameAccess;
+ }
+ }
+ }
+}
+
+#define ORDER_BY_CHILD_POS 5
+#define TABLE_EXPRESSION_CHILD_COUNT 9
+
+namespace connectivity
+{
+ class OSQLParser;
+ class OSQLParseNode;
+ class IParseContext;
+
+ typedef ::std::vector< OSQLParseNode* > OSQLParseNodes;
+
+ enum SQLNodeType {SQL_NODE_RULE, SQL_NODE_LISTRULE, SQL_NODE_COMMALISTRULE,
+ SQL_NODE_KEYWORD, SQL_NODE_COMPARISON, SQL_NODE_NAME,
+ SQL_NODE_STRING, SQL_NODE_INTNUM, SQL_NODE_APPROXNUM,
+ SQL_NODE_EQUAL,SQL_NODE_LESS,SQL_NODE_GREAT,SQL_NODE_LESSEQ,SQL_NODE_GREATEQ,SQL_NODE_NOTEQUAL,
+ SQL_NODE_PUNCTUATION, SQL_NODE_AMMSC, SQL_NODE_ACCESS_DATE,SQL_NODE_DATE,SQL_NODE_CONCAT};
+
+ typedef ::std::set< OUString > QueryNameSet;
+ //==================================================================
+ //= SQLParseNodeParameter
+ //==================================================================
+ struct OOO_DLLPUBLIC_DBTOOLS SQLParseNodeParameter
+ {
+ const ::com::sun::star::lang::Locale& rLocale;
+ ::dbtools::DatabaseMetaData aMetaData;
+ OSQLParser* pParser;
+ ::boost::shared_ptr< QueryNameSet > pSubQueryHistory;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > xFormatter;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xField;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > xQueries; // see bParseToSDBCLevel
+ const IParseContext& m_rContext;
+ sal_Char cDecSep;
+ bool bQuote : 1; /// should we quote identifiers?
+ bool bInternational : 1; /// should we internationalize keywords and placeholders?
+ bool bPredicate : 1; /// are we going to parse a mere predicate?
+ bool bParseToSDBCLevel : 1; /// should we create an SDBC-level statement (e.g. with substituted sub queries)?
+
+ SQLParseNodeParameter(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _xFormatter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xField,
+ const ::com::sun::star::lang::Locale& _rLocale,
+ const IParseContext* _pContext,
+ bool _bIntl,
+ bool _bQuote,
+ sal_Char _cDecSep,
+ bool _bPredicate,
+ bool _bParseToSDBC
+ );
+ ~SQLParseNodeParameter();
+ };
+
+ //==========================================================================
+ //= OSQLParseNode
+ //==========================================================================
+ class OOO_DLLPUBLIC_DBTOOLS OSQLParseNode
+ {
+ friend class OSQLParser;
+
+ OSQLParseNodes m_aChildren;
+ OSQLParseNode* m_pParent; // pParent for reverse linkage in the tree
+ OUString m_aNodeValue; // token name, or empty in case of rules,
+ // or OUString in case of
+ // OUString, INT, etc.
+ SQLNodeType m_eNodeType; // see above
+ sal_uInt32 m_nNodeID; // ::com::sun::star::chaos::Rule ID (if IsRule())
+ // or Token ID (if !IsRule())
+ // ::com::sun::star::chaos::Rule IDs and Token IDs can't
+ // be distinguished by their values,
+ // IsRule has to be used for that!
+ public:
+ enum Rule
+ {
+ UNKNOWN_RULE = 0, // ID indicating that a node is no rule with a matching Rule-enum value (see getKnownRuleID)
+ // we make sure it is 0 so that it is the default-constructor value of this enum
+ // and std::map<foo,Rule>::operator[](bar) default-inserts UNKNOWN_RULE rather than select_statement (!)
+ select_statement,
+ table_exp,
+ table_ref_commalist,
+ table_ref,
+ catalog_name,
+ schema_name,
+ table_name,
+ opt_column_commalist,
+ column_commalist,
+ column_ref_commalist,
+ column_ref,
+ opt_order_by_clause,
+ ordering_spec_commalist,
+ ordering_spec,
+ opt_asc_desc,
+ where_clause,
+ opt_where_clause,
+ search_condition,
+ comparison_predicate,
+ between_predicate,
+ like_predicate,
+ opt_escape,
+ test_for_null,
+ scalar_exp_commalist,
+ scalar_exp,
+ parameter_ref,
+ parameter,
+ general_set_fct,
+ range_variable,
+ column,
+ delete_statement_positioned,
+ delete_statement_searched,
+ update_statement_positioned,
+ update_statement_searched,
+ assignment_commalist,
+ assignment,
+ values_or_query_spec,
+ insert_statement,
+ insert_atom_commalist,
+ insert_atom,
+ predicate_check,
+ from_clause,
+ qualified_join,
+ cross_union,
+ select_sublist,
+ derived_column,
+ column_val,
+ set_fct_spec,
+ boolean_term,
+ boolean_primary,
+ num_value_exp,
+ join_type,
+ position_exp,
+ extract_exp,
+ length_exp,
+ char_value_fct,
+ odbc_call_spec,
+ in_predicate,
+ existence_test,
+ unique_test,
+ all_or_any_predicate,
+ named_columns_join,
+ join_condition,
+ joined_table,
+ boolean_factor,
+ sql_not,
+ boolean_test,
+ manipulative_statement,
+ subquery,
+ value_exp_commalist,
+ odbc_fct_spec,
+ union_statement,
+ outer_join_type,
+ char_value_exp,
+ term,
+ value_exp_primary,
+ value_exp,
+ selection,
+ fold,
+ char_substring_fct,
+ factor,
+ base_table_def,
+ base_table_element_commalist,
+ data_type,
+ column_def,
+ table_node,
+ as_clause,
+ opt_as,
+ op_column_commalist,
+ table_primary_as_range_column,
+ datetime_primary,
+ concatenation,
+ char_factor,
+ bit_value_fct,
+ comparison_predicate_part_2,
+ parenthesized_boolean_value_expression,
+ character_string_type,
+ other_like_predicate_part_2,
+ between_predicate_part_2,
+ cast_spec,
+ rule_count // last value
+ };
+
+ // must be ascii encoding for the value
+ OSQLParseNode(const sal_Char* _pValueStr,
+ SQLNodeType _eNodeType,
+ sal_uInt32 _nNodeID = 0);
+
+ OSQLParseNode(const OString& _rValue,
+ SQLNodeType eNewNodeType,
+ sal_uInt32 nNewNodeID=0);
+
+ OSQLParseNode(const OUString& _rValue,
+ SQLNodeType _eNodeType,
+ sal_uInt32 _nNodeID = 0);
+
+ // copies the respective ParseNode
+ OSQLParseNode(const OSQLParseNode& rParseNode);
+ OSQLParseNode& operator=(const OSQLParseNode& rParseNode);
+
+ sal_Bool operator==(OSQLParseNode& rParseNode) const;
+
+ // destructor destructs the tree recursively
+ virtual ~OSQLParseNode();
+
+ OSQLParseNode* getParent() const {return m_pParent;};
+
+ void setParent(OSQLParseNode* pParseNode) {m_pParent = pParseNode;};
+
+ size_t count() const {return m_aChildren.size();};
+ inline OSQLParseNode* getChild(sal_uInt32 nPos) const;
+
+ void append(OSQLParseNode* pNewSubTree);
+ void insert(sal_uInt32 nPos, OSQLParseNode* pNewSubTree);
+
+ OSQLParseNode* replace(OSQLParseNode* pOldSubTree, OSQLParseNode* pNewSubTree);
+
+ OSQLParseNode* removeAt(sal_uInt32 nPos);
+
+ void replaceNodeValue(const OUString& rTableAlias,const OUString& rColumnName);
+
+ /** parses the node to a string which can be passed to a driver's connection for execution
+
+ Any particles of the parse tree which represent application-level features - such
+ as queries appearing in the FROM part - are substituted, so that the resulting statement can
+ be executed at an SDBC-level connection.
+
+ @param _out_rString
+ is an output parameter taking the resulting SQL statement
+
+ @param _rxConnection
+ the connection relative to which to parse. This must be an SDB-level connection (e.g.
+ support the XQueriesSupplier interface) for the method to be able to do all necessary
+ substitutions.
+
+ @param _rParser
+ the SQLParser used to create the node. This is needed in case we need to parse
+ sub queries which are present in the SQL statement - those sub queries need to be parsed,
+ too, to check whether they contain nested sub queries.
+
+ @param _pErrorHolder
+ takes the error which occurred while generating the statement, if any. Might be <NULL/>,
+ in this case the error is not reported back, and can only be recognized by examing the
+ return value.
+
+ @return
+ <TRUE/> if and only if the parsing was successful.<br/>
+
+ Currently, there's only one condition how this method can fail: If it contains a nested
+ query which causes a cycle. E.g., consider a statement <code>SELECT * from "foo"</code>,
+ where <code>foo</code> is a query defined as <code>SELECT * FROM "bar"</code>, where
+ <code>bar</code> is defined as <code>SELECT * FROM "foo"</code>. This statement obviously
+ cannot be parsed to an executable statement.
+
+ If this method returns <FALSE/>, you're encouraged to check and handle the error in
+ <arg>_pErrorHolder</arg>.
+ */
+ bool parseNodeToExecutableStatement( OUString& _out_rString,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ OSQLParser& _rParser,
+ ::com::sun::star::sdbc::SQLException* _pErrorHolder ) const;
+
+ void parseNodeToStr(OUString& rString,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const IParseContext* pContext = NULL,
+ sal_Bool _bIntl = sal_False,
+ sal_Bool _bQuote= sal_True) const;
+
+ // quoted and internationalised
+ void parseNodeToPredicateStr(OUString& rString,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > & xFormatter,
+ const ::com::sun::star::lang::Locale& rIntl,
+ sal_Char _cDec,
+ const IParseContext* pContext = NULL ) const;
+
+ void parseNodeToPredicateStr(OUString& rString,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > & xFormatter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & _xField,
+ const ::com::sun::star::lang::Locale& rIntl,
+ sal_Char _cDec,
+ const IParseContext* pContext = NULL ) const;
+
+ OSQLParseNode* getByRule(OSQLParseNode::Rule eRule) const;
+
+#if OSL_DEBUG_LEVEL > 1
+ // shows the ParseTree with tabs and linefeeds
+ void showParseTree( OUString& rString ) const;
+ void showParseTree( OUStringBuffer& _inout_rBuf, sal_uInt32 nLevel ) const;
+#endif
+
+ SQLNodeType getNodeType() const {return m_eNodeType;};
+
+ // RuleId returns the RuleID of the node's rule (only if IsRule())
+ sal_uInt32 getRuleID() const {return m_nNodeID;}
+
+ /** returns the ID of the rule represented by the node
+ If the node does not represent a rule, UNKNOWN_RULE is returned
+ */
+ Rule getKnownRuleID() const;
+
+ // returns the TokenId of the node's token (only if !isRule())
+ sal_uInt32 getTokenID() const {return m_nNodeID;}
+
+ // IsRule tests whether a node is a rule (NonTerminal)
+ // ATTENTION: rules can be leaves, for example empty lists
+ sal_Bool isRule() const
+ { return (m_eNodeType == SQL_NODE_RULE) || (m_eNodeType == SQL_NODE_LISTRULE)
+ || (m_eNodeType == SQL_NODE_COMMALISTRULE);}
+
+ // IsToken tests whether a Node is a Token (Terminal but not a rule)
+ sal_Bool isToken() const {return !isRule();}
+
+ const OUString& getTokenValue() const {return m_aNodeValue;}
+
+ void setTokenValue(const OUString& rString) { if (isToken()) m_aNodeValue = rString;}
+
+ sal_Bool isLeaf() const {return m_aChildren.empty();}
+
+ // negate only a searchcondition, any other rule could cause a gpf
+ static void negateSearchCondition(OSQLParseNode*& pSearchCondition,sal_Bool bNegate=sal_False);
+
+ // normalize a logic form
+ // e.q. (a or b) and (c or d) <=> a and c or a and d or b and c or b and d
+ static void disjunctiveNormalForm(OSQLParseNode*& pSearchCondition);
+
+ // Simplifies logic expressions
+ // a and a = a
+ // a or a = a
+ // a and ( a + b) = a
+ // a or a and b = a
+ static void absorptions(OSQLParseNode*& pSearchCondition);
+
+ // erase unnecessary braces
+ static void eraseBraces(OSQLParseNode*& pSearchCondition);
+
+ // makes the logic formula a little smaller
+ static void compress(OSQLParseNode*& pSearchCondition);
+ // return the catalog, schema and tablename form this node
+ // _pTableNode must be a rule of that above or a SQL_TOKEN_NAME
+ static sal_Bool getTableComponents(const OSQLParseNode* _pTableNode,
+ ::com::sun::star::uno::Any &_rCatalog,
+ OUString &_rSchema,
+ OUString &_rTable
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _xMetaData);
+
+ // substitute all occurrences of :var or [name] into the dynamic parameter ?
+ // _pNode will be modified if parameters exists
+ static void substituteParameterNames(OSQLParseNode* _pNode);
+
+ /** return a table range when it exists.
+ */
+ static OUString getTableRange(const OSQLParseNode* _pTableRef);
+
+ protected:
+ // ParseNodeToStr concatenates all Tokens (leaves) of the ParseNodes.
+ void parseNodeToStr(OUString& rString,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > & xFormatter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & _xField,
+ const ::com::sun::star::lang::Locale& rIntl,
+ const IParseContext* pContext,
+ bool _bIntl,
+ bool _bQuote,
+ sal_Char _cDecSep,
+ bool _bPredicate,
+ bool _bSubstitute) const;
+
+ private:
+ void impl_parseNodeToString_throw( OUStringBuffer& rString, const SQLParseNodeParameter& rParam) const;
+ void impl_parseLikeNodeToString_throw( OUStringBuffer& rString, const SQLParseNodeParameter& rParam ) const;
+ void impl_parseTableRangeNodeToString_throw( OUStringBuffer& rString, const SQLParseNodeParameter& rParam ) const;
+
+ /** parses a table_name node into a SQL statement particle.
+ @return
+ <TRUE/> if and only if parsing was successful, <FALSE/> if default handling should
+ be applied.
+ */
+ bool impl_parseTableNameNodeToString_throw( OUStringBuffer& rString, const SQLParseNodeParameter& rParam ) const;
+
+ sal_Bool addDateValue(OUStringBuffer& rString, const SQLParseNodeParameter& rParam) const;
+ OUString convertDateTimeString(const SQLParseNodeParameter& rParam, const OUString& rString) const;
+ OUString convertDateString(const SQLParseNodeParameter& rParam, const OUString& rString) const;
+ OUString convertTimeString(const SQLParseNodeParameter& rParam, const OUString& rString) const;
+ void parseLeaf(OUStringBuffer& rString, const SQLParseNodeParameter& rParam) const;
+ };
+
+ //-----------------------------------------------------------------------------
+ inline OSQLParseNode* OSQLParseNode::getChild(sal_uInt32 nPos) const
+ {
+ OSL_ENSURE(nPos < m_aChildren.size(), "Invalid Position");
+
+ // return m_aChildren[nPos];
+ return m_aChildren.at(nPos);
+ }
+
+ // utilities to query for a specific rule, token or punctuation
+ #define SQL_ISRULE(pParseNode, eRule) ((pParseNode)->isRule() && (pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::eRule))
+ #define SQL_ISRULEOR2(pParseNode, e1, e2) ((pParseNode)->isRule() && ( \
+ (pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::e1) || \
+ (pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::e2)))
+ #define SQL_ISRULEOR3(pParseNode, e1, e2, e3) ((pParseNode)->isRule() && ( \
+ (pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::e1) || \
+ (pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::e2) || \
+ (pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::e3)))
+ #define SQL_ISTOKEN(pParseNode, token) ((pParseNode)->isToken() && (pParseNode)->getTokenID() == SQL_TOKEN_##token)
+ #define SQL_ISTOKENOR2(pParseNode, tok0, tok1) ((pParseNode)->isToken() && ( (pParseNode)->getTokenID() == SQL_TOKEN_##tok0 || (pParseNode)->getTokenID() == SQL_TOKEN_##tok1 ))
+ #define SQL_ISTOKENOR3(pParseNode, tok0, tok1, tok2) ((pParseNode)->isToken() && ( (pParseNode)->getTokenID() == SQL_TOKEN_##tok0 || (pParseNode)->getTokenID() == SQL_TOKEN_##tok1 || (pParseNode)->getTokenID() == SQL_TOKEN_##tok2 ))
+ #define SQL_ISPUNCTUATION(pParseNode, aString) ((pParseNode)->getNodeType() == SQL_NODE_PUNCTUATION && !(pParseNode)->getTokenValue().compareToAscii(aString))
+}
+
+#endif //_CONNECTIVITY_SQLNODE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sqlparse.hxx b/include/connectivity/sqlparse.hxx
new file mode 100644
index 000000000000..892d3ecb8db5
--- /dev/null
+++ b/include/connectivity/sqlparse.hxx
@@ -0,0 +1,253 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _CONNECTIVITY_SQLPARSE_HXX
+#define _CONNECTIVITY_SQLPARSE_HXX
+
+#include <com/sun/star/uno/Reference.h>
+#include <osl/mutex.hxx>
+#include <connectivity/sqlnode.hxx>
+#ifndef DISABLE_DBCONNECTIVITY
+#ifndef YYBISON
+#ifndef FLEX_SCANNER
+#include "sqlbison.hxx"
+#endif
+#endif
+#endif
+#include <com/sun/star/i18n/XCharacterClassification.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/i18n/XLocaleData4.hpp>
+#include "connectivity/IParseContext.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/sqlerror.hxx"
+#include <salhelper/singletonref.hxx>
+
+#include <map>
+
+// forward declarations
+namespace com
+{
+ namespace sun
+ {
+ namespace star
+ {
+ namespace beans
+ {
+ class XPropertySet;
+ }
+ namespace util
+ {
+ class XNumberFormatter;
+ }
+ namespace lang
+ {
+ struct Locale;
+ }
+ }
+ }
+}
+namespace connectivity
+{
+ class OSQLScanner;
+ class SQLError;
+
+ //==========================================================================
+ //= OParseContext
+ //==========================================================================
+ class OOO_DLLPUBLIC_DBTOOLS OParseContext : public IParseContext
+ {
+ public:
+ OParseContext();
+
+ virtual ~OParseContext();
+ // retrieves language specific error messages
+ virtual OUString getErrorMessage(ErrorCode _eCodes) const;
+
+ // retrieves language specific keyword strings (only ASCII allowed)
+ virtual OString getIntlKeywordAscii(InternationalKeyCode _eKey) const;
+
+ // finds out, if we have an international keyword (only ASCII allowed)
+ virtual InternationalKeyCode getIntlKeyCode(const OString& rToken) const;
+
+ // determines the default international setting
+ static const ::com::sun::star::lang::Locale& getDefaultLocale();
+
+ /** get's a locale instance which should be used when parsing in the context specified by this instance
+ <p>if this is not overridden by derived classes, it returns the static default locale.</p>
+ */
+ virtual ::com::sun::star::lang::Locale getPreferredLocale( ) const;
+ };
+
+ //==========================================================================
+ // OSQLParseNodesContainer
+ // grabage collection of nodes
+ //==========================================================================
+ class OSQLParseNodesContainer
+ {
+ ::osl::Mutex m_aMutex;
+ ::std::vector< OSQLParseNode* > m_aNodes;
+ public:
+ OSQLParseNodesContainer();
+ ~OSQLParseNodesContainer();
+
+ void push_back(OSQLParseNode* _pNode);
+ void erase(OSQLParseNode* _pNode);
+ void clear();
+ void clearAndDelete();
+ };
+
+ typedef salhelper::SingletonRef<OSQLParseNodesContainer> OSQLParseNodesGarbageCollector;
+
+ //==========================================================================
+ //= OSQLParser
+ //==========================================================================
+ struct OSQLParser_Data
+ {
+ ::com::sun::star::lang::Locale aLocale;
+ ::connectivity::SQLError aErrors;
+
+ OSQLParser_Data( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext )
+ :aErrors( _rxContext )
+ {
+ }
+ };
+
+ /** Parser for SQL92
+ */
+ class OOO_DLLPUBLIC_DBTOOLS OSQLParser
+ {
+ friend class OSQLParseNode;
+ friend class OSQLInternalNode;
+ friend struct SQLParseNodeParameter;
+
+ private:
+ typedef ::std::map< sal_uInt32, OSQLParseNode::Rule > RuleIDMap;
+ // static parts for parsers
+ static sal_uInt32 s_nRuleIDs[OSQLParseNode::rule_count + 1];
+ static RuleIDMap s_aReverseRuleIDLookup;
+ static OParseContext s_aDefaultContext;
+
+ static OSQLScanner* s_pScanner;
+ static OSQLParseNodesGarbageCollector* s_pGarbageCollector;
+ static sal_Int32 s_nRefCount;
+
+ // information on the current parse action
+ const IParseContext* m_pContext;
+ OSQLParseNode* m_pParseTree; // result from parsing
+ ::std::auto_ptr< OSQLParser_Data >
+ m_pData;
+ OUString m_sFieldName; // current field name for a predicate
+ OUString m_sErrorMessage;// current error msg
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ m_xField; // current field
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >
+ m_xFormatter; // current number formatter
+ sal_Int32 m_nFormatKey; // numberformat, which should be used
+ sal_Int32 m_nDateFormatKey;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCharacterClassification> m_xCharClass;
+ static ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData4> s_xLocaleData;
+ ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData> xDummy; // can be deleted after 627
+
+ // convert a string into double trim it to scale of _nscale and than transform it back to string
+ OUString stringToDouble(const OUString& _rValue,sal_Int16 _nScale);
+ OSQLParseNode* buildDate(sal_Int32 _nType,OSQLParseNode*& pLiteral);
+ bool extractDate(OSQLParseNode* pLiteral,double& _rfValue);
+ void killThousandSeparator(OSQLParseNode* pLiteral);
+ OSQLParseNode* convertNode(sal_Int32 nType,OSQLParseNode*& pLiteral);
+ // makes a string out of a number, pLiteral will be deleted
+ OSQLParseNode* buildNode_STR_NUM(OSQLParseNode*& pLiteral);
+ OSQLParseNode* buildNode_Date(const double& fValue, sal_Int32 nType);
+
+ static ::osl::Mutex& getMutex();
+
+ public:
+ // if NULL, a default context will be used
+ // the context must live as long as the parser
+ OSQLParser(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const IParseContext* _pContext = NULL);
+ ~OSQLParser();
+
+ // Parsing an SQLStatement
+ OSQLParseNode* parseTree(OUString& rErrorMessage,
+ const OUString& rStatement,
+ sal_Bool bInternational = sal_False);
+
+ // Check a Predicate
+ OSQLParseNode* predicateTree(OUString& rErrorMessage, const OUString& rStatement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > & xFormatter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & xField);
+
+ // Access to the context
+ const IParseContext& getContext() const {return *m_pContext;}
+
+ /// access to the SQLError instance owned by this parser
+ const SQLError& getErrorHelper() const;
+
+ // TokenIDToStr: token name belonging to a token number.
+ static OString TokenIDToStr(sal_uInt32 nTokenID, const IParseContext* pContext = NULL);
+
+#if OSL_DEBUG_LEVEL > 1
+ // (empty string if not found)
+ static OUString RuleIDToStr(sal_uInt32 nRuleID);
+#endif
+
+ // StrToRuleID calculates the RuleID for a OUString (that is, ::com::sun::star::sdbcx::Index in yytname)
+ // (0 if not found). The search for an ID based on a String is
+ // extremely inefficient (sequential search for OUString)!
+ static sal_uInt32 StrToRuleID(const OString & rValue);
+
+ static OSQLParseNode::Rule RuleIDToRule( sal_uInt32 _nRule );
+
+ // RuleId with enum, far more efficient
+ static sal_uInt32 RuleID(OSQLParseNode::Rule eRule);
+ // compares the _sFunctionName with all known function names and return the DataType of the return value
+ static sal_Int32 getFunctionReturnType(const OUString& _sFunctionName, const IParseContext* pContext = NULL);
+
+ // returns the type for a parameter in a given function name
+ static sal_Int32 getFunctionParameterType(sal_uInt32 _nTokenId,sal_uInt32 _nPos);
+
+ void error(const sal_Char *fmt);
+ int SQLlex();
+#ifdef YYBISON
+ void setParseTree(OSQLParseNode * pNewParseTree);
+
+ // Is the parse in a special mode?
+ // Predicate chack is used to check a condition for a field
+ sal_Bool inPredicateCheck() const {return m_xField.is();}
+ const OUString& getFieldName() const {return m_sFieldName;}
+
+ void reduceLiteral(OSQLParseNode*& pLiteral, sal_Bool bAppendBlank);
+ // does not change the pLiteral argument
+ sal_Int16 buildNode(OSQLParseNode*& pAppend,OSQLParseNode* pCompare,OSQLParseNode* pLiteral,OSQLParseNode* pLiteral2);
+
+ sal_Int16 buildComparsionRule(OSQLParseNode*& pAppend,OSQLParseNode* pLiteral);
+ // pCompre will be deleted if it is not used
+ sal_Int16 buildPredicateRule(OSQLParseNode*& pAppend,OSQLParseNode* pLiteral,OSQLParseNode*& pCompare,OSQLParseNode* pLiteral2 = NULL);
+
+ sal_Int16 buildLikeRule(OSQLParseNode*& pAppend,OSQLParseNode*& pLiteral,const OSQLParseNode* pEscape);
+ sal_Int16 buildStringNodes(OSQLParseNode*& pLiteral);
+#else
+#endif
+ };
+}
+
+
+#endif //_CONNECTIVITY_SQLPARSE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/standardsqlstate.hxx b/include/connectivity/standardsqlstate.hxx
new file mode 100644
index 000000000000..fb896d1a8af8
--- /dev/null
+++ b/include/connectivity/standardsqlstate.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_STANDARD_SQL_STATE_HXX
+#define CONNECTIVITY_STANDARD_SQL_STATE_HXX
+
+//.........................................................................
+namespace dbtools
+{
+//.........................................................................
+
+ //----------------------------------------------------------------------------------
+ /** standard SQLStates to be used with an SQLException
+
+ Extend this list whenever you need a new state ...
+
+ @see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcodbc_error_codes.asp
+ */
+ enum StandardSQLState
+ {
+ SQL_WRONG_PARAMETER_NUMBER, // 07001
+ SQL_INVALID_DESCRIPTOR_INDEX, // 07009
+ SQL_UNABLE_TO_CONNECT, // 08001
+ SQL_NUMERIC_OUT_OF_RANGE, // 22003
+ SQL_INVALID_DATE_TIME, // 22007
+ SQL_INVALID_CURSOR_STATE, // 24000
+ SQL_TABLE_OR_VIEW_EXISTS, // 42S01
+ SQL_TABLE_OR_VIEW_NOT_FOUND, // 42S02
+ SQL_INDEX_ESISTS, // 42S11
+ SQL_INDEX_NOT_FOUND, // 42S12
+ SQL_COLUMN_EXISTS, // 42S21
+ SQL_COLUMN_NOT_FOUND, // 42S22
+ SQL_GENERAL_ERROR, // HY000
+ SQL_INVALID_SQL_DATA_TYPE, // HY004
+ SQL_OPERATION_CANCELED, // HY008
+ SQL_FUNCTION_SEQUENCE_ERROR, // HY010
+ SQL_INVALID_CURSOR_POSITION, // HY109
+ SQL_INVALID_BOOKMARK_VALUE, // HY111
+ SQL_FEATURE_NOT_IMPLEMENTED, // HYC00
+ SQL_FUNCTION_NOT_SUPPORTED, // IM001
+ SQL_CONNECTION_DOES_NOT_EXIST, // 08003
+
+ SQL_ERROR_UNSPECIFIED = SAL_MAX_ENUM // special value indicating that an SQLState is not to be specified
+ };
+
+//.........................................................................
+} // namespace dbtools
+//.........................................................................
+
+#endif // CONNECTIVITY_STANDARD_SQL_STATE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/statementcomposer.hxx b/include/connectivity/statementcomposer.hxx
new file mode 100644
index 000000000000..56b10ebd0d11
--- /dev/null
+++ b/include/connectivity/statementcomposer.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_STATEMENTCOMPOSER_HXX
+#define CONNECTIVITY_STATEMENTCOMPOSER_HXX
+
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
+
+#include <boost/noncopyable.hpp>
+
+#include <memory>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+//........................................................................
+namespace dbtools
+{
+//........................................................................
+
+ //====================================================================
+ //= StatementComposer
+ //====================================================================
+ struct StatementComposer_Data;
+ /** a class which is able to compose queries (SELECT statements) from a command and a command type
+ */
+ class OOO_DLLPUBLIC_DBTOOLS StatementComposer : public ::boost::noncopyable
+ {
+ ::std::auto_ptr< StatementComposer_Data > m_pData;
+
+ public:
+ /** constructs an instance
+
+ @param _rxConnection
+ the connection to work with. Must not be <NULL/>.
+ */
+ StatementComposer(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const OUString& _rCommand,
+ const sal_Int32 _nCommandType,
+ const sal_Bool _bEscapeProcessing
+ );
+
+ ~StatementComposer();
+
+ /** controls whether or not the instance disposes its XSingleSelectQueryComposer upon
+ destruction
+
+ Unless you explicitly call this method with the parameter being <TRUE/>,
+ the XSingleSelectQueryComposer will be disposed when the StatementComposer
+ instance is destroyed.
+ */
+ void setDisposeComposer( bool _bDoDispose );
+
+ void setFilter( const OUString& _rFilter );
+ void setOrder( const OUString& _rOrder );
+
+ /** returns the composer which has been fed with the current settings
+
+ @throws ::com::sun::star::sdbc::SQLException
+ if such an exception occurs while creating the composer
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer >
+ getComposer();
+
+ /** returns the composer statement
+
+ Effectively, this is equivalent to calling getComposer, and asking the composer
+ for its Query attribute.
+
+ @throws ::com::sun::star::sdbc::SQLException
+ if such an exception occurs while creating the composer
+ */
+ OUString
+ getQuery();
+
+ private:
+ StatementComposer(); // not implemented
+ };
+
+//........................................................................
+} // namespace dbtools
+//........................................................................
+
+#endif // CONNECTIVITY_STATEMENTCOMPOSER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/virtualdbtools.hxx b/include/connectivity/virtualdbtools.hxx
new file mode 100644
index 000000000000..352c98d7a8c4
--- /dev/null
+++ b/include/connectivity/virtualdbtools.hxx
@@ -0,0 +1,371 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_VIRTUAL_DBTOOLS_HXX
+#define CONNECTIVITY_VIRTUAL_DBTOOLS_HXX
+
+#include <rtl/ref.hxx>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/sdbc/SQLException.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <vector>
+#include <memory>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+//========================================================================
+//= forward declarations
+//========================================================================
+namespace com {
+ namespace sun {
+ namespace star {
+ namespace util {
+ class XNumberFormatter;
+ class XNumberFormatTypes;
+ class XNumberFormatsSupplier;
+ }
+ namespace beans {
+ class XPropertySet;
+ }
+ namespace lang {
+ class XMultiServiceFactory;
+ class XComponent;
+ class WrappedTargetException;
+ struct Locale;
+ }
+ namespace sdbc {
+ class XDatabaseMetaData;
+ class XConnection;
+ class XRowSet;
+ class XDataSource;
+ }
+ namespace sdb {
+ class XColumn;
+ class SQLContext;
+ }
+ namespace uno {
+ class XComponentContext;
+ }
+ namespace container {
+ class XNameAccess;
+ }
+ }
+ }
+}
+
+namespace dbtools {
+ class SQLExceptionInfo;
+ class FormattedColumnValue;
+}
+
+namespace comphelper {
+ class ComponentContext;
+}
+
+//========================================================================
+//= entry into this library
+//========================================================================
+/** this is the entry point for the load-on-call usage of the DBTOOLS
+ library.
+ <p>When you need one of the simple objects in this library, load the lib
+ and call this method. The returned pointer is a pointer to an IDataAccessToolsFactory
+ instance, which is acquired <em>once</em>.</p>
+ @return
+ a pointer to an object implementing the IDataAccessToolsFactory interface,
+ aquired exactly <em>once</em>.
+*/
+extern "C" OOO_DLLPUBLIC_DBTOOLS void* SAL_CALL createDataAccessToolsFactory();
+
+//========================================================================
+//=
+//========================================================================
+//........................................................................
+namespace connectivity
+{
+//........................................................................
+
+ class IParseContext;
+ //....................................................................
+ namespace simple
+ {
+ //....................................................................
+
+ typedef void* (SAL_CALL * createDataAccessToolsFactoryFunction)( );
+
+ //================================================================
+ //= IDataAccessTools
+ //================================================================
+ class OOO_DLLPUBLIC_DBTOOLS IDataAccessTools : public ::rtl::IReference
+ {
+ public:
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection_withFeedback(
+ const OUString& _rDataSourceName,
+ const OUString& _rUser,
+ const OUString& _rPwd,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext
+ ) const SAL_THROW ( (::com::sun::star::sdbc::SQLException) ) = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> connectRowset(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext,
+ sal_Bool _bSetAsActiveConnection
+ ) const SAL_THROW ( ( ::com::sun::star::sdbc::SQLException
+ , ::com::sun::star::lang::WrappedTargetException
+ , ::com::sun::star::uno::RuntimeException ) ) = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getRowSetConnection(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet)
+ const SAL_THROW ( (::com::sun::star::uno::RuntimeException) ) = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier> getNumberFormats(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _rxConn,
+ sal_Bool _bAllowDefault
+ ) const = 0;
+
+ virtual sal_Int32 getDefaultNumberFormat(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatTypes >& _rxTypes,
+ const ::com::sun::star::lang::Locale& _rLocale
+ ) const = 0;
+
+ virtual void TransferFormComponentProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxOld,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxNew,
+ const ::com::sun::star::lang::Locale& _rLocale
+ ) const = 0;
+
+ virtual OUString quoteName(
+ const OUString& _rQuote,
+ const OUString& _rName
+ ) const = 0;
+
+ virtual OUString composeTableNameForSelect(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const OUString& _rCatalog,
+ const OUString& _rSchema,
+ const OUString& _rName
+ ) const = 0;
+
+ virtual OUString composeTableNameForSelect(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xTable
+ ) const = 0;
+
+ virtual ::com::sun::star::sdb::SQLContext prependContextInfo(
+ ::com::sun::star::sdbc::SQLException& _rException,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
+ const OUString& _rContextDescription,
+ const OUString& _rContextDetails
+ ) const = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource > getDataSource(
+ const OUString& _rsRegisteredName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext
+ ) const = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
+ getFieldsByCommandDescriptor(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const sal_Int32 _nCommandType,
+ const OUString& _rCommand,
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& _rxKeepFieldsAlive,
+ ::dbtools::SQLExceptionInfo* _pErrorInfo = NULL
+ ) SAL_THROW( ( ) ) = 0;
+
+ virtual ::com::sun::star::uno::Sequence< OUString >
+ getFieldNamesByCommandDescriptor(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const sal_Int32 _nCommandType,
+ const OUString& _rCommand,
+ ::dbtools::SQLExceptionInfo* _pErrorInfo = NULL
+ ) SAL_THROW( ( ) ) = 0;
+
+ /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::INSERT
+ @param _rxCursorSet the property set
+ */
+ virtual sal_Bool canInsert(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet) const = 0;
+
+ /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::UPDATE
+ @param _rxCursorSet the property set
+ */
+ virtual sal_Bool canUpdate(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet) const = 0;
+
+ /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::DELETE
+ @param _rxCursorSet the property set
+ */
+ virtual sal_Bool canDelete(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet) const = 0;
+
+ /** determines whether the given component is part of a document which is an embedded database
+ document (such as a form)
+ */
+ virtual bool isEmbeddedInDatabase(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent,
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxActualConnection
+ ) = 0;
+
+ protected:
+ ~IDataAccessTools() {}
+ };
+
+ //================================================================
+ //= IDataAccessCharSet
+ //================================================================
+ /** simple wrapper for the <type>OCharsetMap</type>
+ */
+ class OOO_DLLPUBLIC_DBTOOLS IDataAccessCharSet :
+ public ::rtl::IReference
+ {
+ // to be extended if necessary ....
+ public:
+ /** enumerates all supported char sets
+ @return the number of charsets supported
+ */
+ virtual sal_Int32 getSupportedTextEncodings(
+ ::std::vector< rtl_TextEncoding >& /* [out] */ _rEncs
+ ) const = 0;
+
+ protected:
+ ~IDataAccessCharSet() {}
+ };
+
+ //================================================================
+ //= IDataAccessTypeConversion
+ //================================================================
+ class OOO_DLLPUBLIC_DBTOOLS IDataAccessTypeConversion :
+ public ::rtl::IReference
+ {
+ public:
+ virtual ::com::sun::star::util::Date getStandardDate() const = 0;
+
+ virtual double getValue(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn>& _rxVariant,
+ const ::com::sun::star::util::Date& rNullDate ) const = 0;
+
+ virtual OUString getFormattedValue(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxColumn,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxFormatter,
+ const ::com::sun::star::util::Date& _rNullDate,
+ sal_Int32 _nKey,
+ sal_Int16 _nKeyType) const = 0;
+
+ virtual OUString getFormattedValue(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxColumn,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter>& _rxFormatter,
+ const ::com::sun::star::lang::Locale& _rLocale,
+ const ::com::sun::star::util::Date& _rNullDate
+ ) const = 0;
+
+ protected:
+ ~IDataAccessTypeConversion() {}
+ };
+
+ //================================================================
+ //= ISQLParseNode
+ //================================================================
+ /** a simple version of the OSQLParseNode, with all methods beeing virtual
+ */
+ class OOO_DLLPUBLIC_DBTOOLS ISQLParseNode : public ::rtl::IReference
+ {
+ public:
+ virtual void parseNodeToStr(OUString& _rString,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const IParseContext* _pContext
+ ) const = 0;
+
+ virtual void parseNodeToPredicateStr(OUString& _rString,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxFormatter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxField,
+ const ::com::sun::star::lang::Locale& _rIntl,
+ const sal_Char _cDecSeparator,
+ const IParseContext* _pContext
+ ) const = 0;
+
+ protected:
+ ~ISQLParseNode() {}
+ };
+
+ //================================================================
+ //= ISQLParser
+ //================================================================
+ /** a simple version of the OSQLParser, with all methods beeing virtual
+ */
+ class OOO_DLLPUBLIC_DBTOOLS ISQLParser : public ::rtl::IReference
+ {
+ public:
+ virtual ::rtl::Reference< ISQLParseNode > predicateTree(
+ OUString& rErrorMessage,
+ const OUString& rStatement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxFormatter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxField
+ ) const = 0;
+
+ virtual const IParseContext& getContext() const = 0;
+
+ protected:
+ ~ISQLParser() {}
+ };
+
+ //================================================================
+ //= IDataAccessToolsFactory
+ //================================================================
+ /** the main factory for runtime-loadable tools in the DBTOOLS library
+ */
+ class OOO_DLLPUBLIC_DBTOOLS IDataAccessToolsFactory :
+ public ::rtl::IReference
+ {
+ public:
+ /// creates a simple version of the class OSQLParser
+ virtual ::rtl::Reference< ISQLParser > createSQLParser(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const IParseContext* _pContext
+ ) const = 0;
+
+ /// creates a helper for charset related functionality (<type>OCharsetMap</type>)
+ virtual ::rtl::Reference< IDataAccessCharSet > createCharsetHelper( ) const = 0;
+
+ /// creates a simple version of the DBTypeConversion helper
+ virtual ::rtl::Reference< IDataAccessTypeConversion > getTypeConversionHelper() = 0;
+
+ /// creates a helper which can be used to access the static methods in dbtools.hxx
+ virtual ::rtl::Reference< IDataAccessTools > getDataAccessTools() = 0;
+
+ virtual ::std::auto_ptr< ::dbtools::FormattedColumnValue > createFormattedColumnValue(
+ const ::comphelper::ComponentContext& _rContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& _rxRowSet,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn
+ ) = 0;
+
+ protected:
+ ~IDataAccessToolsFactory() {}
+ };
+
+ //....................................................................
+ } // namespace simple
+ //....................................................................
+
+//........................................................................
+} // namespace connectivity
+//........................................................................
+
+#endif // CONNECTIVITY_VIRTUAL_DBTOOLS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/warningscontainer.hxx b/include/connectivity/warningscontainer.hxx
new file mode 100644
index 000000000000..5a013f9a5145
--- /dev/null
+++ b/include/connectivity/warningscontainer.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef DBTOOLS_WARNINGSCONTAINER_HXX
+#define DBTOOLS_WARNINGSCONTAINER_HXX
+
+#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
+#include <com/sun/star/sdb/SQLContext.hpp>
+
+#include "connectivity/dbtoolsdllapi.hxx"
+
+//.........................................................................
+namespace dbtools
+{
+//.........................................................................
+
+ //=====================================================================
+ //= IWarningsContainer
+ //=====================================================================
+ class SAL_NO_VTABLE IWarningsContainer
+ {
+ public:
+ virtual void appendWarning(const ::com::sun::star::sdbc::SQLException& _rWarning) = 0;
+ virtual void appendWarning(const ::com::sun::star::sdbc::SQLWarning& _rWarning) = 0;
+ virtual void appendWarning(const ::com::sun::star::sdb::SQLContext& _rContext) = 0;
+
+ protected:
+ ~IWarningsContainer() {}
+ };
+
+ //====================================================================
+ //= WarningsContainer
+ //====================================================================
+ /** helper class for implementing XWarningsSupplier, which mixes own warnings with
+ warnings obtained from an external instance
+ */
+ class OOO_DLLPUBLIC_DBTOOLS WarningsContainer : public IWarningsContainer
+ {
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XWarningsSupplier > m_xExternalWarnings;
+ ::com::sun::star::uno::Any m_aOwnWarnings;
+
+ public:
+ WarningsContainer() { }
+ WarningsContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XWarningsSupplier >& _rxExternalWarnings )
+ :m_xExternalWarnings( _rxExternalWarnings )
+ {
+ }
+ virtual ~WarningsContainer();
+
+ void setExternalWarnings( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XWarningsSupplier >& _rxExternalWarnings )
+ {
+ m_xExternalWarnings = _rxExternalWarnings;
+ }
+
+ // convenience
+ /** appends an SQLWarning instance to the chain
+ @param _rWarning
+ the warning message
+ @param _pAsciiSQLState
+ the SQLState of the warning
+ @param _rxContext
+ the context of the warning
+ */
+ void appendWarning(
+ const OUString& _rWarning,
+ const sal_Char* _pAsciiSQLState,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext );
+
+ // IWarningsContainer
+ virtual void appendWarning(const ::com::sun::star::sdbc::SQLException& _rWarning);
+ virtual void appendWarning(const ::com::sun::star::sdbc::SQLWarning& _rWarning);
+ virtual void appendWarning(const ::com::sun::star::sdb::SQLContext& _rContext);
+
+ // XWarningsSupplier equivalents
+ ::com::sun::star::uno::Any SAL_CALL getWarnings( ) const;
+ void SAL_CALL clearWarnings( );
+ };
+
+//.........................................................................
+} // namespace dbtools
+//.........................................................................
+
+#endif // DBTOOLS_WARNINGSCONTAINER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/bstream.hxx b/include/cosv/bstream.hxx
new file mode 100644
index 000000000000..2d943bc02ce6
--- /dev/null
+++ b/include/cosv/bstream.hxx
@@ -0,0 +1,143 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_BSTREAM_HXX
+#define CSV_BSTREAM_HXX
+
+#include <string.h>
+#include <cosv/string.hxx>
+
+
+namespace csv
+{
+
+
+enum seek_dir
+{
+ beg = 0,
+ cur = 1,
+ end = 2
+};
+
+
+class bistream
+{
+ public:
+ // LIFECYCLE
+ virtual ~bistream() {}
+
+ // OPERATIONS
+ /// @return Number of actually read bytes.
+ uintt read(
+ void * out_pDest,
+ uintt i_nNrofBytes);
+ // INQUIRY
+ /** @return True, if already one try to read had failed.
+ There is no guarantee, that it returns true, if end of data
+ is just reached.
+ Though it will return false, if there is still somemething
+ to read.
+ */
+ bool eod() const;
+
+ private:
+ virtual uintt do_read(
+ void * out_pDest,
+ uintt i_nNrofBytes) = 0;
+ virtual bool inq_eod() const = 0;
+};
+
+
+class bostream
+{
+ public:
+ // LIFECYCLE
+ virtual ~bostream() {}
+
+ // OPERATIONS
+ /// @return Number of actually written bytes.
+ uintt write(
+ const void * i_pSrc,
+ uintt i_nNrofBytes);
+ /// @return Number of actually written bytes.
+ uintt write(
+ const char * i_pSrc );
+ /// @return Number of actually written bytes.
+ uintt write(
+ const String & i_pSrc );
+ private:
+ virtual uintt do_write(
+ const void * i_pSrc,
+ uintt i_nNrofBytes) = 0;
+};
+
+
+class bstream : public bistream,
+ public bostream
+{
+ public:
+ uintt seek(
+ intt i_nDistanceFromBegin,
+ seek_dir i_eStartPoint = ::csv::beg );
+ uintt position() const;
+
+ private:
+ virtual uintt do_seek(
+ intt i_nDistance,
+ seek_dir i_eStartPoint = ::csv::beg ) = 0;
+ virtual uintt inq_position() const = 0;
+};
+
+
+// IMPLEMENTATION
+inline uintt
+bistream::read( void * o_pDest,
+ uintt i_nNrofBytes)
+ { return do_read(o_pDest, i_nNrofBytes); }
+inline bool
+bistream::eod() const
+ { return inq_eod(); }
+
+inline uintt
+bostream::write( const void * i_pSrc,
+ uintt i_nNrofBytes)
+ { return do_write( i_pSrc, i_nNrofBytes ); }
+inline uintt
+bostream::write( const char * i_sSrc )
+ { return write( i_sSrc, strlen(i_sSrc) ); }
+inline uintt
+bostream::write( const String & i_sSrc )
+ { return write( i_sSrc.c_str(), i_sSrc.length() ); }
+
+inline uintt
+bstream::seek( intt i_nDistance,
+ seek_dir i_eStartPoint )
+ { return do_seek( i_nDistance, i_eStartPoint ); }
+inline uintt
+bstream::position() const
+ { return inq_position(); }
+
+
+
+} // namespace csv
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/comdline.hxx b/include/cosv/comdline.hxx
new file mode 100644
index 000000000000..80ebc763b9d9
--- /dev/null
+++ b/include/cosv/comdline.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_COMDLINE_HXX
+#define CSV_COMDLINE_HXX
+// KORR_DEPRECATED_3.0
+// Replace by cosv/commandline.hxx.
+
+
+namespace csv
+{
+
+class CommandLine_Ifc
+{
+ public:
+ virtual ~CommandLine_Ifc() {}
+
+ void Init(
+ int argc,
+ char * argv[] );
+ void PrintUse() const;
+ bool CheckParameters() const;
+
+ private:
+ virtual void do_Init(
+ int argc,
+ char * argv[] ) = 0;
+
+ virtual void do_PrintUse() const = 0;
+ virtual bool inq_CheckParameters() const = 0;
+};
+
+inline void
+CommandLine_Ifc::Init( int argc,
+ char * argv[] )
+ { do_Init( argc, argv ); }
+inline void
+CommandLine_Ifc::PrintUse() const
+ { do_PrintUse(); }
+
+} // namespace csv
+
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/comfunc.hxx b/include/cosv/comfunc.hxx
new file mode 100644
index 000000000000..a294d81f2aae
--- /dev/null
+++ b/include/cosv/comfunc.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_COMFUNC_HXX
+#define CSV_COMFUNC_HXX
+
+#include <stdlib.h>
+
+
+
+
+namespace csv
+{
+ class String;
+
+
+// min, max and range functions
+template <class E>
+inline E max(E in1, E in2);
+template <class E>
+inline E min(E in1, E in2);
+template <class E>
+inline bool in_range(E low, E val, E high); // return low <= val < high;
+
+
+// string functions
+inline const char * valid_str(const char * str);
+inline bool no_str(const char * str); // return !str || !strlen(str)
+
+
+// IMPLEMENTATION
+template <class E>
+inline E
+max(E in1, E in2) { return in1 < in2 ? in2 : in1; }
+template <class E>
+inline E
+min(E in1, E in2) { return in1 < in2 ? in1 : in2; }
+template <class E>
+inline bool
+in_range(E low, E val, E high) { return low <= val AND val < high; }
+
+inline const char *
+valid_str(const char * str) { return str != 0 ? str : ""; }
+inline bool
+no_str(const char * str) { return str != 0 ? *str == '\0' : true; }
+
+} // namespace csv
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/csv_env.hxx b/include/cosv/csv_env.hxx
new file mode 100644
index 000000000000..f49ed54ea464
--- /dev/null
+++ b/include/cosv/csv_env.hxx
@@ -0,0 +1,148 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_CSV_ENV_HXX
+#define CSV_CSV_ENV_HXX
+
+
+
+//******* Include c-language-types ************//
+// size_t, wchar_t
+#include <stdlib.h>
+
+
+
+//******* Builtin types of exact length ************//
+
+// Exact length builtin types
+typedef signed char INT8;
+typedef unsigned char UINT8;
+typedef short INT16;
+typedef unsigned short UINT16;
+typedef long INT32;
+typedef unsigned long UINT32;
+typedef float REAL32;
+typedef double REAL64;
+
+
+// Additional builtin types
+typedef INT32 intt; // standard sized integer.
+typedef UINT32 uintt; // standard sized unsigned integer.
+typedef REAL64 real; // standard sized real.
+
+// Constants
+// ---------
+// Zero-pointer for use in ellipsed (...) parameter lists which expect a
+// pointer which may have another size than an int.
+// Must be a define to be used in precompiled headers:
+#define NIL ((void*)0)
+// char '\0'
+#define NULCH '\0'
+
+
+
+// Boolesche Operatoren
+#define AND &&
+#define OR ||
+#define NOT !
+
+// Macro for distinguishing dynamic allocated pointers from
+// referencing pointers
+#define DYN // Exact specification: DYN has to be used if and only if:
+ // 1. DYN specifies a class member pointer or reference variable and
+ // the class must free the referenced memory.
+ // 2. DYN specifies a pointer or reference (return-) parameter of a function
+ // and for in-parameters the function or its class
+ // must free the referenced memory, the parameter is then called
+ // a let-parameter.
+ // For out- and inout-parameters
+ // or return values the caller of the function hast to
+ // free the referenced memory.
+ //
+ // It is irrelevant who allocated the memory!
+ //
+ // DYN - variables use the prefixes "dp" or "dr" instead of "p" or "r".
+
+
+//****** Assertions ******//
+
+namespace csv
+{
+void PerformAssertion(
+ const char * condition,
+ const char * file,
+ unsigned line );
+}
+
+// Programming by contract
+#ifndef CSV_NO_ASSERTIONS
+
+#ifdef CSV_USE_CSV_ASSERTIONS
+#define csv_assert(x) ( (x) ? (void)(0) : ::csv::PerformAssertion( #x, __FILE__, __LINE__) )
+#else
+
+// Save NDEBUG state
+#ifdef NDEBUG
+#define CSV_CSV_ENV_HXX_HAD_NDEBUG
+#undef NDEBUG
+#endif
+
+#if OSL_DEBUG_LEVEL == 0
+#define NDEBUG
+#endif
+#include <assert.h>
+
+#define csv_assert(x) assert(x);
+
+// Restore NDEBUG state
+#ifdef CSV_CSV_ENV_HXX_HAD_NDEBUG
+#define NDEBUG
+#else
+#undef NDEBUG
+#endif
+
+#endif
+
+#else // #ifndef CSV_NO_ASSERTIONS else
+
+#define csv_assert(x)
+
+#endif // end ifndef CSV_NO_ASSERTIONS else
+
+
+
+/* Additional Programming Conventions
+
+1. see above at "#define DYN"
+2. function parameters get one of these prefixes:
+ - i_ := Function uses only the value, but must not change a referenced variable.
+ - o_ := Parameter is undefined until function has set it.
+ Parametere must be set by the function.
+ - io_ := Function may use and change the referenced variable.
+ - pass_ := Funktion may use and change the referenced variable and HAS TO free the
+ associated memory.
+3. Global constants get the prefix 'C_', global variables the prefix 'G_'.
+4. Static members end with an underscore '_'.
+
+*/
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/csv_ostream.hxx b/include/cosv/csv_ostream.hxx
new file mode 100644
index 000000000000..911fcb8c799e
--- /dev/null
+++ b/include/cosv/csv_ostream.hxx
@@ -0,0 +1,127 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_CSV_OSTREAM_HXX
+#define CSV_CSV_OSTREAM_HXX
+
+// USED SERVICES
+ // BASE CLASSES
+ // COMPONENTS
+ // PARAMETERS
+
+
+
+#ifndef CSV_NO_IOSTREAMS
+
+#include <iostream>
+
+
+namespace csv
+{
+
+typedef std::ios ios;
+typedef std::ostream ostream;
+
+} // namespace csv
+
+
+#else
+
+#include <cosv/tpl/dyn.hxx>
+
+namespace csv
+{
+
+class StreamStr;
+
+class ios
+{
+ public:
+ enum seek_dir
+ {
+ beg=0,
+ cur=1,
+ end=2
+ };
+};
+
+class ostream : public ios
+{
+ public:
+ typedef ostream self;
+
+ virtual ~ostream();
+
+ self & operator<<(
+ const char * i_s );
+ self & operator<<(
+ char i_c );
+ self & operator<<(
+ unsigned char i_c );
+ self & operator<<(
+ signed char i_c );
+
+ self & operator<<(
+ short i_n );
+ self & operator<<(
+ unsigned short i_n );
+ self & operator<<(
+ int i_n );
+ self & operator<<(
+ unsigned int i_n );
+ self & operator<<(
+ long i_n );
+ self & operator<<(
+ unsigned long i_n );
+
+ self & operator<<(
+ float i_n );
+ self & operator<<(
+ double i_n );
+
+ self & seekp(
+ intt i_nOffset,
+ seek_dir i_eStart = ios::beg );
+ protected:
+ ostream(
+ uintt i_nStartSize );
+ const StreamStr & Data() const;
+
+ private:
+ Dyn<StreamStr> pData;
+};
+
+
+
+inline const StreamStr &
+ostream::Data() const
+ { return *pData; }
+
+
+} // namespace csv
+
+
+#endif
+
+
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/csv_precomp.h b/include/cosv/csv_precomp.h
new file mode 100644
index 000000000000..78f1378cda61
--- /dev/null
+++ b/include/cosv/csv_precomp.h
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __CSV_PRECOMP_H_06071998__
+#define __CSV_PRECOMP_H_06071998__
+
+
+
+
+#define CSV_USE_CSV_ASSERTIONS
+#include <cosv/csv_env.hxx>
+
+#include <cosv/comfunc.hxx>
+#include <cosv/string.hxx>
+#include <cosv/streamstr.hxx>
+#include <cosv/std_outp.hxx>
+#include <cosv/tpl/dyn.hxx>
+
+
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/dirchain.hxx b/include/cosv/dirchain.hxx
new file mode 100644
index 000000000000..980937212690
--- /dev/null
+++ b/include/cosv/dirchain.hxx
@@ -0,0 +1,146 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_DIRCHAIN_HXX
+#define CSV_DIRCHAIN_HXX
+
+
+// USED SERVICES
+ // BASE CLASSES
+ // COMPONENTS
+#include <cosv/string.hxx>
+ // PARAMETERS
+#include <cosv/csv_ostream.hxx>
+
+#include <cosv/persist.hxx>
+#include <cosv/tpl/tpltools.hxx>
+
+
+
+namespace csv
+{
+ class bostream;
+
+namespace ploc
+{
+
+
+class DirectoryChain
+{
+ public:
+ DirectoryChain();
+ DirectoryChain(
+ const DirectoryChain &
+ i_rDC );
+ ~DirectoryChain();
+
+ // OPERATORS
+ DirectoryChain & operator=(
+ const DirectoryChain &
+ i_rDC );
+ DirectoryChain & operator+=(
+ const String & i_sName );
+ DirectoryChain & operator+=(
+ const DirectoryChain &
+ i_rDC );
+ DirectoryChain & operator-=(
+ uintt i_nLevelsUp );
+
+ // OPERATIONS
+ void Set(
+ const char * i_sPath,
+ bool i_bPathIsAlwaysDir = false,
+ const char * i_sDelimiter = Delimiter() );
+ void PushBack(
+ const String & i_sName );
+ void PushBack(
+ const DirectoryChain &
+ i_sPath );
+ void PopBack(
+ uintt i_nCount = 1 );
+
+ // INQUIRY
+ uintt Size() const;
+
+ StringVector::const_iterator
+ Begin() const;
+ StringVector::const_iterator
+ End() const;
+
+ const String & Front() const;
+ const String & Back() const;
+
+ void Get(
+ bostream & o_rPath,
+ const char * i_sDelimiter ) const;
+ private:
+ StringVector aPath;
+};
+
+
+// IMPLEMENTATION
+inline
+DirectoryChain::DirectoryChain( const DirectoryChain & i_rDC )
+ { PushBack(i_rDC); }
+
+ // OPERATORS
+inline DirectoryChain &
+DirectoryChain::operator=( const DirectoryChain & i_rDC )
+ { csv::erase_container(aPath); PushBack(i_rDC); return *this; }
+inline DirectoryChain &
+DirectoryChain::operator+=( const String & i_sName )
+ { PushBack(i_sName); return *this; }
+inline DirectoryChain &
+DirectoryChain::operator+=( const DirectoryChain & i_rDC )
+ { PushBack(i_rDC); return *this; }
+inline DirectoryChain &
+DirectoryChain::operator-=( uintt i_nLevelsUp )
+ { PopBack(i_nLevelsUp); return *this; }
+inline uintt
+DirectoryChain::Size() const
+ { return aPath.size(); }
+
+inline StringVector::const_iterator
+DirectoryChain::Begin() const
+ { return aPath.begin(); }
+inline StringVector::const_iterator
+DirectoryChain::End() const
+ { return aPath.end(); }
+inline const String &
+DirectoryChain::Front() const
+ { return aPath.empty() ? String::Null_() : aPath.front(); }
+inline const String &
+DirectoryChain::Back() const
+ { return aPath.empty() ? String::Null_() : aPath.back(); }
+
+
+} // namespace ploc
+} // namespace csv
+
+inline csv::bostream &
+operator<<( csv::bostream & o_rOut,
+ const csv::ploc::DirectoryChain & i_rSubPath )
+{
+ i_rSubPath.Get(o_rOut, csv::ploc::Delimiter());
+ return o_rOut;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/file.hxx b/include/cosv/file.hxx
new file mode 100644
index 000000000000..86c880e73184
--- /dev/null
+++ b/include/cosv/file.hxx
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_FILE_HXX
+#define CSV_FILE_HXX
+
+// USED SERVICES
+ // BASE CLASSES
+#include <cosv/bstream.hxx>
+#include <cosv/openclose.hxx>
+ // COMPONENTS
+#include <stdio.h>
+#include <cosv/string.hxx>
+ // PARAMETERS
+#include <cosv/persist.hxx>
+#include <cosv/ploc.hxx>
+
+
+namespace csv
+{
+
+
+/** @task
+ File is a class representing a file.
+*/
+class File : public bstream,
+ public OpenClose,
+ public ploc::Persistent
+{
+ public:
+ // LIFECYCLE
+ File(
+ const char * i_sLocation,
+ uintt in_nMode = CFM_RW );
+ File(
+ const String & i_sLocation,
+ uintt in_nMode = CFM_RW );
+ virtual ~File();
+
+ // INQUIRY
+ uintt Mode() const;
+
+ private:
+ enum E_LastIO
+ {
+ io_none = 0,
+ io_read,
+ io_write
+ };
+
+ // Interface bistream:
+ virtual uintt do_read(
+ void * out_pDest,
+ uintt i_nNrofBytes);
+ virtual bool inq_eod() const;
+ // Interface bostream:
+ virtual uintt do_write(
+ const void * i_pSrc,
+ uintt i_nNrofBytes);
+ // Interface bstream:
+ virtual uintt do_seek(
+ intt i_nDistance,
+ seek_dir i_eStartPoint = ::csv::beg );
+ virtual uintt inq_position() const;
+ // Interface OpenClose:
+ virtual bool do_open(
+ uintt in_nOpenModeInfo );
+ virtual void do_close();
+ virtual bool inq_is_open() const;
+ // Interface Persistent:
+ virtual const ploc::Path &
+ inq_MyPath() const;
+ // DATA
+ ploc::Path aPath;
+ FILE * pStream;
+
+ uintt nMode; /// RWMode, OpenMode and ShareMode.
+ E_LastIO eLastIO;
+};
+
+
+
+// IMPLEMENTATION
+
+inline uintt
+File::Mode() const
+ { return nMode; }
+
+
+} // namespace csv
+
+
+
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/openclose.hxx b/include/cosv/openclose.hxx
new file mode 100644
index 000000000000..c65ce5b753e2
--- /dev/null
+++ b/include/cosv/openclose.hxx
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_OPENCLOSE_HXX
+#define CSV_OPENCLOSE_HXX
+
+
+namespace csv
+{
+
+// Open modes for storages:
+enum E_RWMode
+{
+ rwDefault = 0x0000, // Keep old settings. If there are none, set default.
+ rwRead = 0x0001, // Reads only
+ rwWrite = 0x0002, // Writes only
+ rwReadWrite = 0x0003 // Reads and writes.
+};
+
+enum E_OpenMode
+{
+ omCreateIfNecessary = 0x0000, // Creates a new file only, if file does not exist.
+ omCreateNot = 0x0010, // Open fails, if file does not exist.
+ omCreate = 0x0020 // Existing file will be deleted.
+};
+enum E_ShareMode
+{
+ shmShareNot = 0x0000, // Allow others nothing
+ shmShareRead = 0x0004, // Allow others to read
+ shmShareAll = 0x000C // Allow others to read and write
+};
+
+/** Constants for filemode combinations
+ These combinations are the only ones, guaranteed to be supported.
+*/
+const UINT32 CFM_RW = rwReadWrite;
+const UINT32 CFM_CREATE =
+ static_cast< UINT32 >(rwReadWrite) | static_cast< UINT32 >(omCreate);
+const UINT32 CFM_READ =
+ static_cast< UINT32 >(rwRead) | static_cast< UINT32 >(omCreateNot) |
+ static_cast< UINT32 >(shmShareRead);
+
+
+
+class OpenClose
+{
+ public:
+ virtual ~OpenClose() {}
+
+ bool open(
+ UINT32 in_nOpenModeInfo = 0 ); /// Combination of values of E_RWMode and E_ShareMode und E_OpenMode. 0 := Keep existing mode.
+ void close();
+
+ bool is_open() const;
+
+ private:
+ virtual bool do_open(
+ UINT32 in_nOpenModeInfo ) = 0;
+ virtual void do_close() = 0;
+ virtual bool inq_is_open() const = 0;
+};
+
+
+
+class OpenCloseGuard
+{
+ public:
+ OpenCloseGuard(
+ OpenClose & i_rOpenClose,
+ UINT32 i_nOpenModeInfo = 0 );
+ ~OpenCloseGuard();
+ operator bool() const;
+
+ private:
+ // Forbidden:
+ OpenCloseGuard(OpenCloseGuard&);
+ OpenCloseGuard & operator=(OpenCloseGuard&);
+
+ // DATA
+ OpenClose & rOpenClose;
+};
+
+
+// IMPLEMENTATION
+
+inline bool
+OpenClose::open( UINT32 i_nOpenModeInfo )
+ { return do_open(i_nOpenModeInfo); }
+inline void
+OpenClose::close()
+ { do_close(); }
+inline bool
+OpenClose::is_open() const
+ { return inq_is_open(); }
+
+inline
+OpenCloseGuard::OpenCloseGuard( OpenClose & i_rOpenClose,
+ UINT32 i_nOpenModeInfo )
+ : rOpenClose(i_rOpenClose)
+ { rOpenClose.open(i_nOpenModeInfo); }
+inline
+OpenCloseGuard::~OpenCloseGuard()
+ { if (rOpenClose.is_open()) rOpenClose.close(); }
+inline
+OpenCloseGuard::operator bool() const
+ { return rOpenClose.is_open(); }
+
+
+
+
+} // namespace csv
+
+
+
+
+
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/persist.hxx b/include/cosv/persist.hxx
new file mode 100644
index 000000000000..13ac4b5dab68
--- /dev/null
+++ b/include/cosv/persist.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_PERSIST_HXX
+#define CSV_PERSIST_HXX
+
+
+// USED SERVICES
+ // BASE CLASSES
+ // COMPONENTS
+#include <cosv/string.hxx>
+ // PARAMETERS
+
+
+namespace csv
+{
+namespace ploc
+{
+
+class Path;
+
+
+inline const char *
+Delimiter()
+{
+#ifdef WNT
+ return "\\";
+#elif defined(UNX)
+ return "/";
+#else
+#error For using csv::ploc there has to be defined: WNT or UNX.
+#endif
+}
+
+
+
+class Persistent
+{
+ public:
+ virtual ~Persistent() {}
+
+ const Path & MyPath() const;
+ /// @return all paths without completing delimiter, even directories.
+ const char * StrPath() const;
+ bool Exists() const;
+
+ protected:
+ Persistent();
+ void InvalidatePath();
+
+ private:
+ virtual const Path &
+ inq_MyPath() const = 0;
+ // DATA
+ mutable StreamStr sPath;
+};
+
+
+
+// IMPLEMENTATION
+
+inline
+Persistent::Persistent()
+ : sPath(30) { }
+inline const Path &
+Persistent::MyPath() const
+ { return inq_MyPath(); }
+inline void
+Persistent::InvalidatePath()
+ { sPath.clear(); }
+
+
+
+} // namespace csv
+} // namespace ploc
+
+
+#endif
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/ploc.hxx b/include/cosv/ploc.hxx
new file mode 100644
index 000000000000..81f952de5223
--- /dev/null
+++ b/include/cosv/ploc.hxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_PLOC_HXX
+#define CSV_PLOC_HXX
+
+// USED SERVICES
+#include <cosv/string.hxx>
+#include <cosv/plocroot.hxx>
+#include <cosv/dirchain.hxx>
+#include <cosv/tpl/dyn.hxx>
+#include <cosv/csv_ostream.hxx>
+
+
+
+
+namespace csv
+{
+ class bostream;
+
+namespace ploc
+{
+ class Root;
+
+
+/** Represents a path in the file system.
+
+ The path can be relative or absolute and in Unix- or Windows-syntax.
+*/
+class Path
+{
+ public:
+
+ // LIFECYCLE
+ explicit Path(
+ const char * i_sPath = ".", /// Dirs have to be ended with a '\\ or '/'.
+ bool i_bPathIsAlwaysDir = false, /// This overrides a missing Delimiter at the end of the i_sPath, if true.
+ const char * i_sDelimiter = Delimiter() );
+ Path(
+ const Path & i_rPath );
+ ~Path();
+ // OPERATORS
+ Path & operator=(
+ const Path & i_rPath );
+ // OPERATIONS
+ void Set(
+ const char * i_sPath,
+ bool i_bPathIsAlwaysDir = false,
+ const char * i_sDelimiter = Delimiter() );
+ void SetFile( // If there is already a file, that is exchanged.
+ const String & i_sName );
+ // INQUIRY
+ const Root & RootDir() const { return *pRoot; }
+ const DirectoryChain &
+ DirChain() const { return aPath; }
+ const String & File() const { return sFile; }
+ bool IsValid() const;
+ bool IsDirectory() const { return sFile.length() == 0; }
+ bool IsFile() const { return sFile.length() > 0; }
+
+ /// Directories have a delimiter at the end, files not.
+ void Get(
+ bostream & o_rPath ) const;
+ // ACCESS
+ DirectoryChain & DirChain() { return aPath; }
+
+ private:
+ Dyn<Root> pRoot;
+ DirectoryChain aPath;
+ String sFile;
+};
+
+
+
+
+} // namespace ploc
+} // namespace csv
+
+/// Directories produce a delimiter at the end, files not.
+inline csv::bostream &
+operator<<( csv::bostream & o_rOut,
+ const csv::ploc::Path & i_rPath )
+{
+ i_rPath.Get(o_rOut);
+ return o_rOut;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/ploc_dir.hxx b/include/cosv/ploc_dir.hxx
new file mode 100644
index 000000000000..e6c8f04538f2
--- /dev/null
+++ b/include/cosv/ploc_dir.hxx
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_PLOCDIR_HXX
+#define CSV_PLOCDIR_HXX
+
+
+// USED SERVICES
+ // BASE CLASSES
+#include <cosv/persist.hxx>
+ // COMPONENTS
+#include <cosv/ploc.hxx>
+ // PARAMETERS
+
+namespace csv
+{
+namespace ploc
+{
+
+class DirectoryChain;
+
+enum E_Recursivity
+{
+ flat,
+ recursive
+};
+
+class Directory : public Persistent
+{
+ public:
+ // LIFECYCLE
+ Directory();
+ Directory(
+ const Path & i_rLocation );
+ Directory(
+ const char * i_rLocation );
+ Directory(
+ const Directory & i_rDir );
+ virtual ~Directory();
+
+ // OPERATORS
+ Directory & operator+=(
+ const String & i_sName );
+ Directory & operator+=(
+ const DirectoryChain &
+ i_sDirChain );
+ Directory & operator-=(
+ uintt i_nLevels );
+
+ // OPERATIONS
+ bool PhysicalCreate(
+ bool i_bCreateParentsIfNecessary = true ) const;
+
+ // INQUIRY
+ void GetContainedDirectories(
+ StringVector & o_rResult ) const;
+ /** @param i_sFilter
+ Currently only filters of the form "*.ending" or "*.*"
+ (the default) are processed correctly under UNIX. Under WNT this
+ restriction does not apply.
+ */
+ void GetContainedFiles(
+ StringVector & o_rResult,
+ const char * i_sFilter = "*.*",
+ E_Recursivity i_eRecursivity = flat ) const;
+ private:
+ // Interface Peristent:
+ virtual const Path &
+ inq_MyPath() const;
+
+ // Locals:
+ /** @return
+ true, if parent(!) directory exists or could be created.
+ false, if this is a root directory.
+ */
+ bool Check_Parent() const;
+ bool PhysicalCreate_Dir(
+ const char * i_sStr ) const;
+ // DATA
+ Path aPath;
+};
+
+
+
+} // namespace ploc
+} // namespace csv
+
+
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/plocroot.hxx b/include/cosv/plocroot.hxx
new file mode 100644
index 000000000000..b079f04b1b9f
--- /dev/null
+++ b/include/cosv/plocroot.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_PLOCROOT_HXX
+#define CSV_PLOCROOT_HXX
+
+
+// USED SERVICES
+ // BASE CLASSES
+ // COMPONENTS
+#include <cosv/string.hxx>
+ // PARAMETERS
+#include <cosv/csv_ostream.hxx>
+#include <cosv/persist.hxx>
+
+
+namespace csv
+{
+
+class bostream;
+
+
+namespace ploc
+{
+
+
+class Root
+{
+ public:
+ virtual ~Root();
+
+ static DYN Root * Create_(
+ const char * & o_sPathAfterRoot,
+ const char * i_sPath,
+ const char * i_sDelimiter = Delimiter() );
+
+ virtual void Get( /// Does not add a '\0' at the end,
+ ostream & o_rPath ) const = 0;
+ virtual void Get( /// Does not add a '\0' at the end.
+ bostream & so_rPath ) const = 0;
+ virtual DYN Root * CreateCopy() const = 0;
+ virtual const char *
+ OwnDelimiter() const = 0;
+};
+
+
+
+} // namespace ploc
+} // namespace csv
+
+
+
+#endif
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/std_outp.hxx b/include/cosv/std_outp.hxx
new file mode 100644
index 000000000000..08fe179e16ab
--- /dev/null
+++ b/include/cosv/std_outp.hxx
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_STD_OUTP_HXX
+#define CSV_STD_OUTP_HXX
+
+// USED SERVICES
+ // BASE CLASSES
+ // COMPONENTS
+#include <cosv/csv_ostream.hxx>
+ // PARAMETERS
+
+
+
+
+namespace csv
+{
+
+#ifdef CSV_NO_IOSTREAMS
+class redirect_out : public ostream
+{
+ public:
+ virtual ~redirect_out() {}
+
+ static void set_(
+ redirect_out & o_rStdOut,
+ redirect_out & o_rStdErr )
+ { pStdOut_ = &o_rStdOut;
+ pStdErr_ = &o_rStdErr; }
+
+ static redirect_out &
+ std_() { return *pStdOut_; }
+ static redirect_out &
+ err_() { return *pStdErr_; }
+ static bool useme_() { return pStdOut_ != 0; }
+
+ private:
+ // DATA
+ static redirect_out *
+ pStdOut_;
+ static redirect_out *
+ pStdErr_;
+};
+#endif // defined(CSV_NO_IOSTREAMS)
+
+
+inline ostream &
+Cout()
+{
+
+#ifndef CSV_NO_IOSTREAMS
+// return redirect_out::useme_()
+// ? (ostream&)( redirect_out::std_() )
+// : (ostream&)( std::cout );
+ return (ostream&)( std::cout );
+#else
+ csv_assert( redirect_out::useme_() );
+ return redirect_out::std_();
+#endif
+}
+
+inline ostream &
+Cerr()
+{
+#ifndef CSV_NO_IOSTREAMS
+// return redirect_out::useme_()
+// ? (ostream&)( redirect_out::err_() )
+// : (ostream&)( std::cerr );
+ return (ostream&)( std::cerr );
+#else
+ csv_assert( redirect_out::useme_() );
+ return redirect_out::err_();
+#endif
+}
+
+
+
+typedef void (*F_FLUSHING_FUNC)(ostream&);
+
+void Endl( ostream& );
+
+void Flush( ostream& );
+
+
+} // namespace csv
+
+
+
+inline csv::ostream &
+operator<<( csv::ostream & io_rStream,
+ csv::F_FLUSHING_FUNC i_fFlushingFunc )
+{
+#ifndef CSV_NO_IOSTREAMS
+// (*i_fFlushingFunc)( io_rStream, csv::redirect_out::useme_(), 0 );
+ (*i_fFlushingFunc)( io_rStream );
+#else
+ csv_assert( csv::redirect_out::useme_() );
+ (*i_fFlushingFunc)( io_rStream, true, 0 );
+#endif
+ return io_rStream;
+}
+
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/str_types.hxx b/include/cosv/str_types.hxx
new file mode 100644
index 000000000000..ecf9c997c271
--- /dev/null
+++ b/include/cosv/str_types.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COSV_STR_TYPES_HXX
+#define COSV_STR_TYPES_HXX
+
+
+namespace csv
+{
+
+/** Provides some generally used constants.
+*/
+struct str
+{
+ public:
+ typedef ::size_t position;
+ typedef ::size_t size;
+
+ static const position npos = -1;
+ static const size maxsize = -1;
+
+ enum insert_mode
+ {
+ overwrite = 0,
+ insert = 1
+ };
+};
+
+
+/** Is used for string comparisons.
+
+ @collab String
+ @collab various csv::compare(...) functions
+*/
+class CharOrder_Table
+{
+ public:
+ /** @precond
+ Parameter i_pCharWeightsArray
+ must have size of 256.
+ */
+ CharOrder_Table(
+ const int * i_pCharWeightsArray );
+
+ /** @return the weight of the char i_c.
+ @precond
+ Even with unusual implementations, where char has more than 8 bit,
+ there must be true: 0 <= i_c < 256.
+ */
+ int operator()(
+ char i_c ) const;
+ private:
+ int cWeights[256];
+};
+
+
+// IMPLEMENTATION
+
+inline int
+CharOrder_Table::operator()( char i_c ) const
+ { return cWeights[ UINT8(i_c) ]; }
+
+
+
+} // namespace csv
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/streamstr.hxx b/include/cosv/streamstr.hxx
new file mode 100644
index 000000000000..ec13f8ec63c6
--- /dev/null
+++ b/include/cosv/streamstr.hxx
@@ -0,0 +1,310 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_STREAMSTR_HXX
+#define CSV_STREAMSTR_HXX
+
+#include "sal/config.h"
+
+#include "sal/types.h"
+
+// BASE CLASSES
+#include <cosv/bstream.hxx>
+// USED SERVICES
+#include <cosv/str_types.hxx>
+#include <string.h>
+
+
+
+
+namespace csv
+{
+ class String;
+
+
+void c_str(); // Dummy needed for StreamStr::operator<<(StreamStr::F_CSTR);
+
+
+/** A string buffer class for all kinds of string manipulation.
+*/
+class StreamStr : public bostream
+{
+ public:
+ typedef StreamStr self;
+
+ typedef str::size size_type;
+ typedef str::position position_type;
+ typedef intt seek_type;
+ typedef str::insert_mode insert_mode;
+
+ typedef const char * const_iterator;
+ typedef char * iterator;
+
+ typedef void (*F_CSTR)();
+
+
+ /** Represents an area within a string.
+ */
+ struct Area
+ {
+ typedef str::size size_type;
+
+ Area(
+ const char * i_str = "",
+ size_type i_nLength = str::maxsize )
+ : sStr(i_str),
+ nLength( i_nLength == str::maxsize
+ ? strlen(i_str)
+ : i_nLength ) {}
+ const char * sStr;
+ size_type nLength;
+ };
+
+ // LIFECYCLE
+ StreamStr(
+ size_type i_nCapacity );
+ /// Copies also insert_mode and current position.
+ StreamStr(
+ const self & i_rOther );
+ ~StreamStr();
+
+ // OPERATORS
+ /// Copies also insert_mode and current position.
+ self & operator=(
+ const self & i_rOther );
+
+ self & operator<<(
+ const char * i_s );
+ self & operator<<(
+ const String & i_s );
+ self & operator<<(
+ char i_c );
+ self & operator<<(
+ unsigned char i_c );
+ self & operator<<(
+ signed char i_c );
+
+ self & operator<<(
+ short i_n );
+ self & operator<<(
+ unsigned short i_n );
+ self & operator<<(
+ int i_n );
+ self & operator<<(
+ unsigned int i_n );
+ self & operator<<(
+ long i_n );
+ self & operator<<(
+ unsigned long i_n );
+
+ self & operator<<(
+ float i_n );
+ self & operator<<(
+ double i_n );
+
+ /** This operator is used to finish a sequence of streaming
+ oeprators by returning the c-string of the complete string.
+
+ @return The same as ->c_str().
+
+ @example
+ csv::StreamStr s(100);
+ const char *
+ fullname = s << qualifier() << "::" << name() << csv::c_str;
+ */
+ const char * operator<<(
+ F_CSTR i_f );
+
+ const char & operator[](
+ position_type i_nPosition ) const;
+ char & operator[](
+ position_type i_nPosition );
+
+ // OPERATIONS
+ void resize(
+ size_type i_nMinimumCapacity );
+
+ void clear();
+
+ /** Sets start point for the next operator<<() call.
+ if the intended position is not reachable, nothing happens.
+ */
+ self & seekp(
+ seek_type i_nCount,
+ seek_dir i_eDirection = ::csv::beg );
+ self & reset() { return seekp(0); }
+ /** Sets the insertion mode of all and only the operator<<() calls.
+
+ Default is str::overwrite:
+ str::overwrite: seekp() always sets the cur end of the string.
+ operator<<() calls push the end of the string forward.
+ str::insert: seekp() only sets the insertion point.
+ operator<<() calls insert their text at the tellp()
+ position and keep the rest of the string. tellp() is
+ then after the inserted text, on the beginning of the
+ rest of the string.
+ */
+ self & set_insert_mode(
+ insert_mode i_eMode );
+
+ void pop_front(
+ size_type i_nCount );
+ void pop_back(
+ size_type i_nCount );
+
+ /// Works like operator<<(). Does the same as Perl's join().
+ self & operator_join(
+ std::vector<String>::const_iterator
+ i_rBegin,
+ std::vector<String>::const_iterator
+ i_rEnd,
+ const char * i_sLink );
+ /// Works like operator<<()
+ self & operator_add_substr(
+ const char * i_sText,
+ size_type i_nLength );
+ /// Works like operator<<()
+ self & operator_add_token(
+ const char * i_sText,
+ char i_cDelimiter );
+ /// Works like operator<<()
+ self & operator_read_line(
+ bstream & i_src );
+
+ void strip_front_whitespace(); /// removes space, tab and crlf.
+ void strip_back_whitespace();
+ void strip_frontback_whitespace();
+
+ void replace_all(
+ char i_cCarToSearch,
+ char i_cReplacement );
+
+ // INQUIRY
+ const char * c_str() const;
+ const char * data() const;
+
+ bool empty() const;
+ size_type size() const;
+ size_type length() const;
+
+ size_type capacity() const;
+
+ position_type tellp() const;
+
+ const_iterator begin() const;
+ const_iterator cur() const;
+ const_iterator end() const;
+
+ // ACCESS
+ iterator begin();
+ iterator cur();
+ iterator end();
+
+ private:
+ // Interface bostream
+ virtual UINT32 do_write(
+ const void * i_pSrc,
+ UINT32 i_nNrofBytes);
+ // Locals
+ void ProvideAddingSize(
+ size_type i_nSize2Add );
+ /// Resizes with the factor 2.0 (under 128), 1.5 or until i_nMinimumCapacity, whatever is bigger.
+ void Resize(
+ size_type i_nMinimumCapacity = 0 );
+ void Advance(
+ size_type i_nAddedSize );
+ void MoveData(
+ char * i_pStart,
+ char * i_pEnd,
+ seek_type i_nDiff );
+ // DATA
+ size_type nCapacity1; /// Capacity of characters to contain + 1 for terminating 0.
+ DYN char * dpData;
+ char * pEnd;
+ char * pCur;
+ insert_mode eMode;
+};
+
+
+
+class StreamStrLock
+{
+ public:
+ StreamStrLock(
+ uintt i_nMinimalSize );
+ ~StreamStrLock();
+
+ StreamStr & operator()() { return *pStr; }
+
+ private:
+ StreamStr * pStr;
+};
+
+// IMPLEMENTATION
+
+inline const char *
+StreamStr::operator<<( SAL_UNUSED_PARAMETER F_CSTR )
+ { return dpData; }
+inline void
+StreamStr::clear()
+ { pEnd = pCur = dpData; *pEnd = '\0'; }
+inline const char *
+StreamStr::c_str() const
+ { return dpData; }
+inline const char *
+StreamStr::data() const
+ { return dpData; }
+inline bool
+StreamStr::empty() const
+ { return dpData == pEnd; }
+inline StreamStr::size_type
+StreamStr::size() const
+ { return pEnd - dpData; }
+inline StreamStr::size_type
+StreamStr::length() const
+ { return size(); }
+inline StreamStr::size_type
+StreamStr::capacity() const
+ { return nCapacity1-1; }
+inline StreamStr::position_type
+StreamStr::tellp() const
+ { return size_type(pCur-dpData); }
+inline StreamStr::const_iterator
+StreamStr::begin() const
+ { return dpData; }
+inline StreamStr::const_iterator
+StreamStr::cur() const
+ { return pCur; }
+inline StreamStr::const_iterator
+StreamStr::end() const
+ { return pEnd; }
+inline StreamStr::iterator
+StreamStr::begin()
+ { return dpData; }
+inline StreamStr::iterator
+StreamStr::cur()
+ { return pCur; }
+inline StreamStr::iterator
+StreamStr::end()
+ { return pEnd; }
+
+} // namespace csv
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/string.hxx b/include/cosv/string.hxx
new file mode 100644
index 000000000000..756aa9a1492c
--- /dev/null
+++ b/include/cosv/string.hxx
@@ -0,0 +1,501 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COSV_STRING_HXX
+#define COSV_STRING_HXX
+
+// USED SERVICES
+#include <string.h>
+#include <cosv/stringdata.hxx>
+#include <cosv/str_types.hxx>
+#include <cosv/csv_ostream.hxx>
+#include <vector>
+
+
+
+
+namespace csv
+{
+
+
+/** The Simple String:
+ It is used to just hold short to middle long texts as
+ data, which are constant at most times. They are reference
+ counted, so they are space efficient and have constant time
+ copy semantics.
+
+ For all compare() functions the return value is like in strcmp().
+
+ @attention
+ The present version of this class is NOT thread safe.
+*/
+
+
+class String
+{
+ public:
+ typedef String self;
+
+ typedef str::size size_type;
+ typedef str::position position_type;
+
+ typedef const char * const_iterator;
+
+ // LIFECYCLE
+ String();
+
+ /// Intentionally not explicit, smooth casting is intended.
+ String(
+ const char * i_str );
+ /// @precond i_nLength <= strlen(i_str) or i_nLength == str::maxsize.
+ String(
+ const char * i_str,
+ size_type i_nLength );
+
+ /** @precond i_itBegin and i_itEnd are in the same valid
+ memory-area, such that zero to finite times repetition of
+ ++i_itBegin leads to i_itBegin == i_itEnd.
+ */
+ String(
+ const_iterator i_itBegin,
+ const_iterator i_itEnd );
+
+ String(
+ const self & i_rStr );
+
+ ~String();
+ // OPERATORS
+ self & operator=(
+ const self & i_rStr );
+ self & operator=(
+ const char * i_str );
+
+ operator const char * () const;
+
+ bool operator==(
+ const self & i_rStr ) const;
+ bool operator!=(
+ const self & i_rStr ) const;
+ bool operator<(
+ const self & i_rStr ) const;
+ bool operator>(
+ const self & i_rStr ) const;
+ bool operator<=(
+ const self & i_rStr ) const;
+ bool operator>=(
+ const self & i_rStr ) const;
+
+ // OPERATIONS
+ void clear();
+
+ /// @precond i_nLength == str::maxsize OR i_nLength < strlen(i_str) .
+ void assign(
+ const char * i_str,
+ size_type i_nLength );
+ /// Create a string consisting of a sequence of i_nCount times the same char.
+ void assign(
+ size_type i_nCount,
+ char i_c );
+
+ // INQUIRY
+ const char * c_str() const;
+ const char * data() const;
+
+ bool empty() const;
+ size_type size() const;
+ size_type length() const;
+
+ const char & char_at(
+ position_type i_nPosition ) const;
+
+ const_iterator begin() const;
+
+ /// This is inefficient, so shouldn't be used within loops.
+ const_iterator end() const;
+
+ int compare(
+ const self & i_rStr ) const;
+ int compare(
+ const CharOrder_Table &
+ i_rOrder,
+ const self & i_rStr ) const;
+
+//*********** Not yet implemented *********************//
+ position_type rfind(
+ const char * i_strToSearch,
+ position_type i_nSearchStartPosition = str::npos ) const;
+ position_type rfind(
+ char i_charToSearch,
+ position_type i_nSearchStartPosition = str::npos ) const;
+
+ position_type find_first_not_of(
+ const char * i_strToSearch,
+ position_type i_nSearchStartPosition = 0 ) const;
+ position_type find_first_not_of(
+ char i_charToSearch,
+ position_type i_nSearchStartPosition = 0 ) const;
+
+ position_type find_last_not_of(
+ const char * i_strToSearch,
+ position_type i_nSearchStartPosition = str::npos ) const;
+ position_type find_last_not_of(
+ char i_charToSearch,
+ position_type i_nSearchStartPosition = str::npos ) const;
+//*********** end - not yet implemented *****************//
+
+ static const self & Null_();
+ static const char & Nulch_();
+
+ private:
+ struct S_Data
+ {
+ S_Data();
+ /// @precond i_nValidLength <= strlen(i_sData) or i_nValidLength == str::maxsize.
+ explicit S_Data(
+ const char * i_sData,
+ size_type i_nValidLength = str::maxsize );
+ ~S_Data();
+
+ const S_Data * Acquire() const;
+
+ /// Deletes this, if nCount becomes 0.
+ void Release() const;
+
+ StringData<char> aStr;
+ mutable UINT32 nCount;
+
+ private:
+ // Forbidden functions, because this is a refcounted structure.
+ S_Data(const S_Data&);
+ S_Data & operator=(const S_Data&);
+ };
+
+ // Locals
+ const StringData<char> &
+ Str() const;
+
+ // DATA
+ const S_Data * pd;
+};
+
+
+//********** Global compare functions ***************//
+
+ //*** Natural order, no substrings
+
+inline int compare(
+ const String & i_s1,
+ const String & i_s2 );
+inline int compare(
+ const String & i_s1,
+ const char * i_s2 );
+inline int compare(
+ const char * i_s1,
+ const String & i_s2 );
+inline int compare(
+ const char * i_s1,
+ const char * i_s2 );
+
+ //*** Natural order, substrings
+
+int compare(
+ const String & i_s1,
+ csv::str::position i_nStartPosition1,
+ const char * i_s2,
+ csv::str::size i_nLength );
+inline int compare(
+ const char * i_s1,
+ const char * i_s2,
+ csv::str::size i_nLength );
+
+ //*** Defined order, no substrings
+
+inline int compare(
+ const CharOrder_Table & i_rOrder,
+ const String & i_s1,
+ const char * i_s2 );
+inline int compare(
+ const CharOrder_Table & i_rOrder,
+ const char * i_s1,
+ const String & i_s2 );
+int compare(
+ const CharOrder_Table & i_rOrder,
+ const char * i_s1,
+ const char * i_s2 );
+} // namespace csv
+
+
+
+
+//****************** global comparation operators *********************//
+
+inline bool operator==(
+ const csv::String & i_s1,
+ const char * i_s2 );
+inline bool operator!=(
+ const csv::String & i_s1,
+ const char * i_s2 );
+inline bool operator<(
+ const csv::String & i_s1,
+ const char * i_s2 );
+inline bool operator>(
+ const csv::String & i_s1,
+ const char * i_s2 );
+inline bool operator<=(
+ const csv::String & i_s1,
+ const char * i_s2 );
+inline bool operator>=(
+ const csv::String & i_s1,
+ const char * i_s2 );
+
+inline bool operator==(
+ const char * i_s1,
+ const csv::String & i_s2 );
+inline bool operator!=(
+ const char * i_s1,
+ const csv::String & i_s2 );
+inline bool operator<(
+ const char * i_s1,
+ const csv::String & i_s2 );
+inline bool operator>(
+ const char * i_s1,
+ const csv::String & i_s2 );
+inline bool operator<=(
+ const char * i_s1,
+ const csv::String & i_s2 );
+inline bool operator>=(
+ const char * i_s1,
+ const csv::String & i_s2 );
+
+
+//****************** global stream operators *********************//
+
+
+inline csv::ostream &
+operator<<( csv::ostream & o_rOut,
+ const csv::String & i_rSrc );
+
+
+
+
+// IMPLEMENTATION
+namespace csv
+{
+
+
+inline const StringData<char> &
+String::Str() const
+{ return pd->aStr; }
+
+
+inline const char &
+String::char_at( position_type i_nPosition ) const
+{ if ( i_nPosition < Str().Size() )
+ return Str().Data()[i_nPosition];
+ return Nulch_();
+}
+
+inline bool
+String::operator==( const self & i_rStr ) const
+{ return compare(i_rStr) == 0; }
+
+inline bool
+String::operator!=( const self & i_rStr ) const
+{ return compare(i_rStr) != 0; }
+
+inline bool
+String::operator<( const self & i_rStr ) const
+{ return compare(i_rStr) < 0; }
+
+inline bool
+String::operator>( const self & i_rStr ) const
+{ return compare(i_rStr) > 0; }
+
+inline bool
+String::operator<=( const self & i_rStr ) const
+{ return compare(i_rStr) <= 0; }
+
+inline bool
+String::operator>=( const self & i_rStr ) const
+{ return compare(i_rStr) >= 0; }
+
+inline void
+String::clear()
+{ operator=( String::Null_() ); }
+
+inline const char *
+String::c_str() const
+{ return Str().Data(); }
+
+inline
+String::operator const char * () const
+{ return c_str(); }
+
+inline const char *
+String::data() const
+{ return c_str(); }
+
+inline String::size_type
+String::size() const
+{ return Str().Size(); }
+
+inline bool
+String::empty() const
+{ return size() == 0; }
+
+inline String::size_type
+String::length() const
+{ return size(); }
+
+inline String::const_iterator
+String::begin() const
+{ return data(); }
+
+inline String::const_iterator
+String::end() const
+{ return data() + size(); }
+
+
+
+//****************** global compare-functions ********************//
+inline int
+compare( const String & i_s1,
+ const String & i_s2 )
+{ return i_s1.compare(i_s2); }
+
+inline int
+compare( const String & i_s1,
+ const char * i_s2 )
+{ return strcmp(i_s1.c_str(), i_s2); }
+
+inline int
+compare( const char * i_s1,
+ const String & i_s2 )
+{ return strcmp(i_s1, i_s2.c_str()); }
+
+inline int
+compare( const char * i_s1,
+ const char * i_s2 )
+{ return strcmp(i_s1, i_s2); }
+
+inline int
+compare( const char * i_s1,
+ const char * i_s2,
+ str::size i_nLength )
+{ return strncmp( i_s1, i_s2, i_nLength ); }
+
+inline int
+compare( const CharOrder_Table & i_rOrder,
+ const String & i_s1,
+ const char * i_s2 )
+{ return compare( i_rOrder, i_s1.c_str(), i_s2 ); }
+
+inline int
+compare( const CharOrder_Table & i_rOrder,
+ const char * i_s1,
+ const String & i_s2 )
+{ return compare( i_rOrder, i_s1, i_s2.c_str() ); }
+
+
+} // namespace csv
+
+
+inline bool
+operator==( const csv::String & i_s1,
+ const char * i_s2 )
+{ return csv::compare( i_s1, i_s2 ) == 0; }
+
+inline bool
+operator!=( const csv::String & i_s1,
+ const char * i_s2 )
+{ return csv::compare( i_s1, i_s2 ) != 0; }
+
+inline bool
+operator<( const csv::String & i_s1,
+ const char * i_s2 )
+{ return csv::compare( i_s1, i_s2 ) < 0; }
+
+inline bool
+operator>( const csv::String & i_s1,
+ const char * i_s2 )
+{ return csv::compare( i_s1, i_s2 ) > 0; }
+
+inline bool
+operator<=( const csv::String & i_s1,
+ const char * i_s2 )
+{ return csv::compare( i_s1, i_s2 ) <= 0; }
+
+inline bool
+operator>=( const csv::String & i_s1,
+ const char * i_s2 )
+{ return csv::compare( i_s1, i_s2 ) >= 0; }
+
+
+inline bool
+operator==( const char * i_s1,
+ const csv::String & i_s2 )
+{ return csv::compare( i_s1, i_s2 ) == 0; }
+
+inline bool
+operator!=( const char * i_s1,
+ const csv::String & i_s2 )
+{ return csv::compare( i_s1, i_s2 ) != 0; }
+
+inline bool
+operator<( const char * i_s1,
+ const csv::String & i_s2 )
+{ return csv::compare( i_s1, i_s2 ) < 0; }
+
+inline bool
+operator>( const char * i_s1,
+ const csv::String & i_s2 )
+{ return csv::compare( i_s1, i_s2 ) > 0; }
+
+inline bool
+operator<=( const char * i_s1,
+ const csv::String & i_s2 )
+{ return csv::compare( i_s1, i_s2 ) <= 0; }
+
+inline bool
+operator>=( const char * i_s1,
+ const csv::String & i_s2 )
+{ return csv::compare( i_s1, i_s2 ) >= 0; }
+
+
+ //************ global stream operators **************//
+
+
+inline csv::ostream &
+operator<<( csv::ostream & o_rOut,
+ const csv::String & i_rSrc )
+ { o_rOut << i_rSrc.c_str(); return o_rOut; }
+
+
+//****************** typedefs *********************//
+
+namespace csv
+{
+
+typedef std::vector<String> StringVector;
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/stringdata.hxx b/include/cosv/stringdata.hxx
new file mode 100644
index 000000000000..0187cb4265a9
--- /dev/null
+++ b/include/cosv/stringdata.hxx
@@ -0,0 +1,128 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COSV_STRINGDATA_HXX
+#define COSV_STRINGDATA_HXX
+
+
+#include <cosv/str_types.hxx>
+
+
+
+namespace csv
+{
+
+/** @tpl CHAR
+ The expression CHAR(0) has to be valid.
+*/
+template <class CHAR>
+class StringData
+{
+ public:
+ typedef StringData self;
+
+ typedef str::size size_type;
+ typedef str::position position_type;
+
+ // LIFECYCLE
+ StringData();
+ /** @precond i_pData != 0
+ @precond i_nValidLength <= strlen(i_pData)
+ */
+ StringData(
+ const CHAR * i_pData,
+ size_type i_nValidLength );
+ ~StringData();
+ // OPERATORS
+
+ // OPERATIONS
+
+ // INQUIRY
+ const CHAR * Data() const;
+
+ /** @returns the allocated number of CHAR.
+ This may be different from the number of bytes.
+ There is actually allocated one more CHAR,
+ which is guaranteed to be CHAR(0) in all circumstances.
+ */
+ size_type Size() const;
+
+ private:
+ /* Because this is used only within a refcounted structure,
+ these functions are forbidden - at least yet.
+ */
+ StringData(const self&);
+ self & operator=(const self&);
+
+ // DATA
+ DYN CHAR * dpData;
+ size_type nSize; /// The allocated size - 1 (for the finishing 0).
+};
+
+
+
+// IMPLEMENTATION
+
+template <class CHAR>
+StringData<CHAR>::StringData()
+ : dpData( new CHAR[1] ),
+ nSize(0)
+{
+ *dpData = CHAR(0);
+}
+
+template <class CHAR>
+StringData<CHAR>::StringData( const CHAR * i_pData,
+ size_type i_nValidLength )
+ : dpData( new CHAR[i_nValidLength + 1] ),
+ nSize(i_nValidLength)
+{
+ memcpy( dpData, i_pData, i_nValidLength * sizeof(CHAR) );
+ dpData[nSize] = CHAR(0);
+}
+
+template <class CHAR>
+StringData<CHAR>::~StringData()
+{
+ delete [] dpData;
+}
+
+template <class CHAR>
+const CHAR *
+StringData<CHAR>::Data() const
+{
+ return dpData;
+}
+
+template <class CHAR>
+typename StringData<CHAR>::size_type
+StringData<CHAR>::Size() const
+{
+ return nSize;
+}
+
+
+
+} // namespace csv
+
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/tpl/dyn.hxx b/include/cosv/tpl/dyn.hxx
new file mode 100644
index 000000000000..46095c6c3b7c
--- /dev/null
+++ b/include/cosv/tpl/dyn.hxx
@@ -0,0 +1,232 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_DYN_HXX
+#define CSV_DYN_HXX
+
+
+
+
+namespace csv
+{
+
+
+/** Dyn owns an object on the heap, which will be automatically
+ deleted in its D'tor.
+
+ Dyn's main purpose is for class members on the heap:
+ You can't forget to delete them in the D'tor. Constness will be transfered
+ to the hold object.
+
+ Dyn forbids the CopyC'tor and operator=(). So you can't incidentally
+ run into problems with compiler defined CopyC'tor or operator=() of the
+ owning class. If you need those, you have to define them explicitly - as
+ you should do anyway with all classes, that own members on the heap.
+
+ Dyn also works with incomplete types.
+ You only need to write
+ class DX;
+ but needn't include #include <DX>.hxx.
+ This is a difference to std::auto_ptr, where it is not absolutely clear
+ if it is allowed to use it with incomplete types.
+
+ You can also use Dyn within function bodies, to make them exception safe.
+
+ @attention
+ If you use Dyn with an incomplete type, the owning class needs to
+ define a non-inline D'tor. Else the compiler will complain.
+*/
+template <class DX>
+class Dyn
+{
+ public:
+ // LIFECYCLE
+ /// From now on, let_dpObject is owned by this Dyn-object.
+ explicit Dyn(
+ DX * let_dpObject = 0);
+ ~Dyn();
+ // OPERATORS
+ /** This deletes a prevoiusly existing dpObject!
+ From now on, let_dpObject is owned by this Dyn-object.
+ */
+ Dyn<DX> & operator=(
+ DX * let_dpObject);
+ /// @return true, if any valid object is hold, false else.
+ operator bool() const;
+
+ const DX * operator->() const;
+ DX * operator->();
+
+ const DX & operator*() const;
+ DX & operator*();
+
+ // OPERATIONS
+ /** @return The hold object on the heap.
+
+ @ATTENTION
+ The caller of the function is responsible to delete
+ the returned object
+
+ @postcond
+ this->dpObject == 0.
+ */
+ DX * Release();
+
+ // INQUIRY
+ /// Shorthand for operator->(), if implicit overloading of -> can not be used.
+ const DX * Ptr() const;
+
+ // ACCESS
+ /// Shorthand for operator->(), if implicit overloading of -> can not be used.
+ DX * Ptr();
+ /// So const objects can return mutable pointers to the owned object.
+ DX * MutablePtr() const;
+
+ private:
+ /* Does NOT set dpObject to zero! Because it is only used
+ internally in situations where dpObject is set immediately
+ after.
+ */
+ void Delete();
+
+ /** Forbidden function!
+ -------------------
+ Help ensure, that classes with
+ dynamic pointers use a selfdefined copy constructor
+ and operator=(). If the default versions of these
+ functions are used, the compiler will throw an error.
+ **/
+ Dyn( const Dyn<DX> & );
+ /** Forbidden function!
+ -------------------
+ Help ensure, that classes with
+ dynamic pointers use a selfdefined copy constructor
+ and operator=(). If the default versions of these
+ functions are used, the compiler will throw an error.
+ **/
+ Dyn<DX> & operator=( const Dyn<DX> & );
+
+ // DATA
+ /// An owned heap object. Needs to be deleted by this class.
+ DX * dpObject;
+};
+
+
+
+
+// IMPLEMENTATION
+template <class DX>
+void
+Dyn<DX>::Delete()
+{
+ if (dpObject != 0)
+ delete dpObject;
+}
+
+template <class DX>
+inline
+Dyn<DX>::Dyn( DX * let_dpObject )
+ : dpObject(let_dpObject) {}
+
+template <class DX>
+inline
+Dyn<DX>::~Dyn()
+{ Delete(); }
+
+
+template <class DX>
+inline Dyn<DX> &
+Dyn<DX>::operator=( DX * let_dpObject )
+{
+ if ( dpObject == let_dpObject )
+ return *this;
+
+ Delete();
+ dpObject = let_dpObject;
+ return *this;
+}
+
+template <class DX>
+inline
+Dyn<DX>::operator bool() const
+{ return dpObject != 0; }
+
+template <class DX>
+inline
+const DX *
+Dyn<DX>::operator->() const
+{ return dpObject; }
+
+template <class DX>
+inline DX *
+Dyn<DX>::operator->()
+{ return dpObject; }
+
+template <class DX>
+inline const DX &
+Dyn<DX>::operator*() const
+{ csv_assert(dpObject != 0);
+ return *dpObject;
+}
+
+template <class DX>
+inline DX &
+Dyn<DX>::operator*()
+{ csv_assert(dpObject != 0);
+ return *dpObject;
+}
+
+template <class DX>
+inline DX *
+Dyn<DX>::Release()
+{ DX * ret = dpObject;
+ dpObject = 0;
+ return ret;
+}
+
+template <class DX>
+inline const DX *
+Dyn<DX>::Ptr() const
+{ return dpObject; }
+
+template <class DX>
+inline DX *
+Dyn<DX>::Ptr()
+{ return dpObject; }
+
+template <class DX>
+inline DX *
+Dyn<DX>::MutablePtr() const
+{ return dpObject; }
+
+} // namespace csv
+
+
+
+
+#ifndef CSV_HIDE_DYN
+#define Dyn ::csv::Dyn
+#endif
+
+
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/tpl/processor.hxx b/include/cosv/tpl/processor.hxx
new file mode 100644
index 000000000000..a685acd5bed6
--- /dev/null
+++ b/include/cosv/tpl/processor.hxx
@@ -0,0 +1,129 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_TPL_PROCESSOR_HXX
+#define CSV_TPL_PROCESSOR_HXX
+
+// USED SERVICES
+
+
+
+
+namespace csv
+{
+
+
+/** Implements an acyclic visitor pattern. This is the abstract
+ base for the classes doing the work (the "visitors").
+*/
+class ProcessorIfc
+{
+ public:
+ virtual ~ProcessorIfc() {}
+};
+
+
+
+/** Implements an acyclic visitor pattern. This is the abstract
+ base for the classes to be processed (the "visitables").
+*/
+class ConstProcessorClient
+{
+ public:
+ virtual ~ConstProcessorClient() {}
+
+ void Accept(
+ ProcessorIfc & io_processor ) const
+ { do_Accept(io_processor); }
+ private:
+ virtual void do_Accept(
+ ProcessorIfc & io_processor ) const = 0;
+};
+
+
+/** Typed base for "visitor" classes, leaving the visited
+ object const.
+
+ @see ProcessorIfc
+ @see Processor<>
+*/
+template <typename X, typename R = void>
+class ConstProcessor
+{
+ public:
+ virtual ~ConstProcessor() {}
+
+ R Process(
+ const X & i_object )
+ { return do_Process(i_object ); }
+ private:
+ virtual R do_Process(
+ const X & i_object ) = 0;
+};
+
+
+/** Typed base for "visitor" classes which may change the visited
+ object.
+
+ @see ProcessorIfc
+ @see ConstProcessor<>
+*/
+template <typename X, typename R = void>
+class Processor
+{
+ public:
+ virtual ~Processor() {}
+
+ R Process(
+ X & i_object )
+ { return do_Process(i_object ); }
+ private:
+ virtual R do_Process(
+ X & i_object ) = 0;
+};
+
+
+template <class C>
+inline void
+CheckedCall( ProcessorIfc & io_processor,
+ const C & i_client )
+{
+ ConstProcessor<C> *
+ pProcessor = dynamic_cast< csv::ConstProcessor<C> * >
+ (&io_processor);
+ if (pProcessor != 0)
+ pProcessor->Process(i_client);
+}
+
+template <class C>
+inline void
+CheckedCall( ProcessorIfc & io_processor,
+ C & io_client )
+{
+ Processor<C> *
+ pProcessor = dynamic_cast< csv::Processor<C> * >
+ (&io_processor);
+ if (pProcessor != 0)
+ pProcessor->Process(io_client);
+}
+
+} // namespace csv
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/tpl/swelist.hxx b/include/cosv/tpl/swelist.hxx
new file mode 100644
index 000000000000..5c64efc29cc2
--- /dev/null
+++ b/include/cosv/tpl/swelist.hxx
@@ -0,0 +1,362 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_SWELIST_HXX
+#define CSV_SWELIST_HXX
+
+// USED SERVICES
+ // BASE CLASSES
+ // COMPONENTS
+ // PARAMETERS
+#include <cosv/tpl/dyn.hxx>
+
+
+namespace csv
+{
+
+
+template <class XX>
+class SweListElement
+{
+ public:
+ typedef SweListElement<XX> self;
+
+ SweListElement(
+ const XX & in_aObj )
+ : aObj(in_aObj), pNext(0) {}
+
+ const XX & Obj() const { return aObj; }
+ XX & Obj() { return aObj; }
+ self * Next() const { return pNext; }
+
+ void SetNext(
+ self * i_pNext )
+ { pNext = i_pNext; }
+ private:
+ XX aObj;
+ self * pNext;
+};
+
+
+
+template <class XX> class SweListIterator;
+template <class XX> class SweListCIterator;
+
+
+template <class XX>
+class SweList
+{
+ public:
+ // TYPES
+ typedef SweList<XX> self;
+ typedef XX value_type;
+ typedef SweListIterator<XX> iterator;
+ typedef SweListCIterator<XX> const_iterator;
+ private:
+ typedef SweListElement<XX> elem;
+
+ public:
+ // LIFECYCLE
+ SweList() : pTop(0), pTail(0) {}
+ ~SweList() { erase_all(); }
+ // OPERATIONS
+ void push_front(
+ const XX & i_aObj );
+ void pop_front();
+ void push_back(
+ const XX & i_aObj );
+ void erase_all();
+
+ // INQUIRY
+ const_iterator begin() const { return pTop; }
+ iterator begin() { return pTop; }
+ const_iterator end() const { return (elem*)0; }
+ iterator end() { return (elem*)0; }
+ const XX & front() const { return pTop->Obj(); }
+ XX & front() { return pTop->Obj(); }
+ const XX & back() const { return pTail->Obj(); }
+ XX & back() { return pTail->Obj(); }
+
+ bool empty() const { return pTop == 0; }
+ uintt size() const;
+
+
+ private:
+ // Forbiddden methods.
+ SweList(
+ const self & i_rList );
+ self & operator=(
+ const self & i_rList );
+
+ // DATA
+ DYN elem * pTop;
+ elem * pTail;
+};
+
+template <class XX>
+class SweList_dyn
+{
+ public:
+ // TYPES
+ typedef SweList_dyn<XX> self;
+ typedef SweListElement< XX* > elem;
+ typedef SweListIterator< XX* > iterator;
+
+ // LIFECYCLE
+ SweList_dyn() : pTop(0), pTail(0) {}
+ ~SweList_dyn() { erase_all(); }
+ // OPERATIONS
+ void push_front(
+ XX * i_pObj );
+ void push_back(
+ XX * i_pObj );
+ void pop_front();
+ void erase_all();
+
+ // INQUIRY
+ iterator begin() const { return pTop; }
+ iterator end() const { return (elem*)0; }
+ XX * front() const { return pTop->Obj(); }
+ XX * back() const { return pTail->Obj(); }
+
+ bool empty() const { return pTop == 0; }
+ uintt size() const;
+
+ private:
+ // Forbiddden methods.
+ SweList_dyn(
+ const self & i_rList );
+ self & operator=(
+ const self & i_rList );
+
+ DYN elem * pTop;
+ elem * pTail;
+};
+
+
+
+
+template<class XX>
+class SweListIterator
+{
+ public:
+ typedef SweListIterator<XX> self;
+ typedef SweListElement<XX> elem;
+
+ SweListIterator(
+ elem * i_pElem = 0)
+ : pElem(i_pElem) { }
+
+ // OPERATORS
+ XX & operator*() const { return pElem->Obj(); }
+ self & operator++() { if (pElem != 0) pElem = pElem->Next();
+ return *this; }
+ bool operator==(
+ const self & i_rIter ) const
+ { return pElem == i_rIter.pElem; }
+ bool operator!=(
+ const self & i_rIter ) const
+ { return pElem != i_rIter.pElem; }
+ private:
+ friend class SweListCIterator<XX>;
+
+ elem * pElem;
+};
+
+template<class XX>
+class SweListCIterator
+{
+ public:
+ typedef SweListCIterator<XX> self;
+ typedef SweListElement<XX> elem;
+
+ SweListCIterator(
+ const elem * i_pElem = 0)
+ : pElem(i_pElem) { }
+
+ // OPERATORS
+ self & operator=(
+ const SweListIterator<XX> &
+ i_rIter )
+ { pElem = i_rIter.pElem; return *this; }
+
+ const XX & operator*() const { return pElem->Obj(); }
+ self & operator++() { if (pElem != 0) pElem = pElem->Next();
+ return *this; }
+ bool operator==(
+ const self & i_rIter ) const
+ { return pElem == i_rIter.pElem; }
+ bool operator!=(
+ const self & i_rIter ) const
+ { return pElem != i_rIter.pElem; }
+ private:
+ const elem * pElem;
+};
+
+// IMPLEMENTATION
+
+template <class XX>
+void
+SweList<XX>::push_front( const XX & i_aObj )
+{
+ DYN elem * dpNew = new elem(i_aObj);
+ dpNew->SetNext(pTop);
+ pTop = dpNew;
+ if (pTail == 0)
+ pTail = pTop;
+}
+
+template <class XX>
+void
+SweList<XX>::push_back( const XX & i_aObj)
+{
+ if (pTail != 0)
+ {
+ pTail->SetNext(new elem(i_aObj));
+ pTail = pTail->Next();
+ }
+ else
+ {
+ pTop = pTail = new elem(i_aObj);
+ }
+}
+
+template <class XX>
+void
+SweList<XX>::pop_front()
+{
+ if (pTop != 0)
+ {
+ elem * pDel = pTop;
+ pTop = pTop->Next();
+ delete pDel;
+ if (pTop == 0)
+ pTail = 0;
+ }
+}
+
+template <class XX>
+uintt
+SweList<XX>::size() const
+{
+ uintt ret = 0;
+ for ( const_iterator iter = begin();
+ iter != end();
+ ++iter )
+ {
+ ++ret;
+ }
+ return ret;
+}
+
+
+template <class XX>
+void
+SweList<XX>::erase_all()
+{
+ for (pTail = pTop ; pTop != 0; pTail = pTop)
+ {
+ pTop = pTop->Next();
+ delete pTail;
+ }
+ pTop = pTail = 0;
+}
+
+
+template <class XX>
+void
+SweList_dyn<XX>::push_front( XX * i_pObj )
+{
+ DYN elem * dpNew = new elem(i_pObj);
+ dpNew->SetNext(pTop);
+ pTop = dpNew;
+ if (pTail == 0)
+ pTail = pTop;
+}
+
+template <class XX>
+void
+SweList_dyn<XX>::push_back( XX * i_pObj )
+{
+ if (pTail != 0)
+ {
+ pTail->SetNext(new elem(i_pObj));
+ pTail = pTail->Next();
+ }
+ else
+ {
+ pTop = pTail = new elem(i_pObj);
+ }
+}
+
+template <class XX>
+void
+SweList_dyn<XX>::pop_front()
+{
+ if (pTop != 0)
+ {
+ elem * pDel = pTop;
+ pTop = pTop->Next();
+ if (pDel->Obj() != 0)
+ Delete_dyn(pDel->Obj());
+ delete pDel;
+ if (pTop == 0)
+ pTail = 0;
+ }
+}
+
+
+template <class XX>
+void
+SweList_dyn<XX>::erase_all()
+{
+ for (pTail = pTop ; pTop != 0; pTail = pTop)
+ {
+ pTop = pTop->Next();
+ if (pTail->Obj() != 0)
+ {
+ delete pTail->Obj();
+ }
+ delete pTail;
+ }
+ pTop = pTail = 0;
+}
+
+template <class XX>
+uintt
+SweList_dyn<XX>::size() const
+{
+ uintt ret = 0;
+ for ( iterator iter = begin();
+ iter != end();
+ ++iter )
+ {
+ ++ret;
+ }
+ return ret;
+}
+
+
+} // namespace csv
+
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/tpl/tpltools.hxx b/include/cosv/tpl/tpltools.hxx
new file mode 100644
index 000000000000..487a74cf8237
--- /dev/null
+++ b/include/cosv/tpl/tpltools.hxx
@@ -0,0 +1,154 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_TPLTOOLS_HXX
+#define CSV_TPLTOOLS_HXX
+
+#include <vector>
+#include <map>
+
+
+
+
+namespace csv
+{
+
+
+template <class COLLECTION>
+inline void erase_container(
+ COLLECTION & o_rCollection );
+
+/// Version for other containers than std::map, with non-pair value_type.
+template <class COLLECTION>
+void erase_container_of_heap_ptrs(
+ COLLECTION & o_rCollection );
+
+
+template <class KEY, class VAL>
+const VAL * find_in_map( /// Usable for all kinds of values
+ const std::map< KEY, VAL > &
+ i_rMap,
+ const KEY & i_rKey );
+
+
+/** @return the value in the map, if it is in there, else 0.
+ @precond VAL has to be convertible to "0".
+*/
+template <class KEY, class VAL>
+VAL value_from_map(
+ const std::map< KEY, VAL > &
+ i_rMap,
+ const KEY & i_rKey );
+
+/** @return the value in the map, if it is in there, else i_notFound.
+*/
+template <class KEY, class VAL>
+VAL value_from_map(
+ const std::map< KEY, VAL > &
+ i_rMap,
+ const KEY & i_rKey,
+ VAL i_notFound );
+
+template <class COLLECTION, class VALUE>
+bool contains(
+ const COLLECTION & i_collection,
+ const VALUE & i_value );
+
+
+
+
+// IMPLEMENTATION
+template <class COLLECTION>
+inline void
+erase_container( COLLECTION & o_rCollection )
+{
+ o_rCollection.erase( o_rCollection.begin(),
+ o_rCollection.end() );
+}
+
+template <class COLLECTION>
+void
+erase_container_of_heap_ptrs( COLLECTION & o_rCollection )
+{
+ typename COLLECTION::iterator itEnd = o_rCollection.end();
+ for ( typename COLLECTION::iterator it = o_rCollection.begin();
+ it != itEnd;
+ ++it )
+ {
+ delete *it;
+ }
+
+ o_rCollection.erase( o_rCollection.begin(),
+ o_rCollection.end() );
+}
+
+template <class KEY, class VAL>
+const VAL *
+find_in_map( const std::map< KEY, VAL > & i_rMap,
+ const KEY & i_rKey )
+{
+ typename std::map< KEY, VAL >::const_iterator
+ ret = i_rMap.find(i_rKey);
+ return ret != i_rMap.end()
+ ? & (*ret).second
+ : (const VAL*)0;
+}
+
+template <class KEY, class VAL>
+VAL
+value_from_map( const std::map< KEY, VAL > & i_rMap,
+ const KEY & i_rKey )
+{
+ typename std::map< KEY, VAL >::const_iterator
+ ret = i_rMap.find(i_rKey);
+ return ret != i_rMap.end()
+ ? (*ret).second
+ : VAL(0);
+}
+
+template <class KEY, class VAL>
+VAL
+value_from_map( const std::map< KEY, VAL > & i_rMap,
+ const KEY & i_rKey,
+ VAL i_notFound )
+{
+ typename std::map< KEY, VAL >::const_iterator
+ ret = i_rMap.find(i_rKey);
+ return ret != i_rMap.end()
+ ? (*ret).second
+ : i_notFound;
+}
+
+template <class COLLECTION, class VALUE>
+bool
+contains( const COLLECTION & i_collection,
+ const VALUE & i_value )
+{
+ return std::find(i_collection.begin(), i_collection.end(), i_value)
+ !=
+ i_collection.end();
+}
+
+
+
+
+} // namespace csv
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/tpl/vvector.hxx b/include/cosv/tpl/vvector.hxx
new file mode 100644
index 000000000000..dec58642bf23
--- /dev/null
+++ b/include/cosv/tpl/vvector.hxx
@@ -0,0 +1,535 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_VVECTOR_HXX
+#define CSV_VVECTOR_HXX
+
+#include <cstddef> // for ptrdiff_t
+
+// USED SERVICES
+#include <vector>
+#include <cosv/tpl/tpltools.hxx>
+
+
+
+
+namespace csv
+{
+namespace vvector
+{
+
+
+template <class TYPE>
+struct delete_ptrs
+{
+ static void Destruct(
+ std::vector< TYPE* > &
+ v)
+ { csv::erase_container_of_heap_ptrs(v); }
+
+ /// @precond ->it is a valid iterator within v
+ static void Erase(
+ std::vector< TYPE* > &
+ v,
+ typename std::vector< TYPE* >::iterator
+ it2erase )
+ { delete *it2erase; v.erase(it2erase); }
+
+ /// @precond ->v.size() > 0
+ static void PopBack(
+ std::vector< TYPE* > &
+ v )
+ { delete v.back(); v.pop_back(); }
+
+ /// @precond ->it is a valid iterator
+ static void ReplacePtr(
+ typename std::vector< TYPE* >::iterator
+ it,
+ DYN TYPE * pass_new )
+ { delete *it; *it = pass_new; }
+};
+
+
+/** One helper class for the ->csv::VirtualVector.
+ Implements a
+*/
+template <class TYPE>
+struct keep_ptrs
+{
+ static void Destruct(std::vector< TYPE* > &)
+ {}
+
+ static void Erase(
+ std::vector< TYPE* > &
+ v,
+ typename std::vector< TYPE* >::iterator
+ it2erase )
+ { v.erase(it2erase); }
+
+ static void PopBack(
+ std::vector< TYPE* > &
+ v )
+ { v.pop_back(); }
+
+ /// @precond ->it is a valid iterator
+ static void ReplacePtr(
+ typename std::vector< TYPE* >::iterator
+ it,
+ TYPE * io_new )
+ { *it = io_new; }
+};
+
+
+} // namespace vvector
+
+
+
+
+/** Implements a vector of different implementations of a base
+ class.
+
+ Implementation has to be by pointers to get the polymorphic
+ behaviour, however access is by references to the base class.
+
+ @tpl XX
+ The common base class of vector elements.
+
+ @tpl PTRDEL
+ Has two possible values:
+ vvector::delete_ptrs<XX> Elements have to be on the heap and
+ are deleted when removed (default).
+ vvector::keep_ptrs<XX> Elements are only referenced and not
+ deleted when removed.
+
+*/
+template <class XX, class PTRDEL = vvector::delete_ptrs<XX> >
+class VirtualVector
+{
+ public:
+ typedef VirtualVector<XX,PTRDEL> self;
+ typedef std::vector< DYN XX* > impl_type;
+ typedef typename impl_type::size_type size_type;
+ typedef std::ptrdiff_t difference_type;
+
+ class const_iterator;
+ class iterator;
+
+ // LIFECYCLE
+ VirtualVector();
+ explicit VirtualVector(
+ int i_size );
+ ~VirtualVector();
+
+ // OPERATORS
+ const XX & operator[](
+ size_type i_pos ) const;
+ XX & operator[](
+ size_type i_pos );
+
+ // OPERATIONS
+ void push_back(
+ DYN XX & i_drElement );
+ void pop_back();
+
+ iterator insert(
+ iterator i_pos,
+ DYN XX & i_drElement );
+ void erase(
+ iterator i_pos );
+ void replace(
+ iterator i_pos,
+ DYN XX & i_drElement );
+ void reserve(
+ size_type i_size );
+
+ // INQUIRY
+ bool empty() const;
+ size_t size() const;
+ const_iterator begin() const;
+ const_iterator end() const;
+ const XX & front() const;
+ const XX & back() const;
+
+ // ACCESS
+ iterator begin();
+ iterator end();
+ XX & front();
+ XX & back();
+
+ private:
+ // Forbidden:
+ VirtualVector(const VirtualVector&);
+ VirtualVector & operator=(const VirtualVector&);
+
+ // DATA
+ std::vector< DYN XX* >
+ aData;
+};
+
+
+
+
+/** Should be usable for all STL algorithms.
+ Implements the Random Access Iterator concept.
+*/
+template <class XX, class PTRDEL>
+class VirtualVector<XX,PTRDEL>::
+ const_iterator
+
+ // This derivation provides type information for the STL
+ // It introduces the types "value_type" and "difference_type".
+ : public std::iterator<std::random_access_iterator_tag,
+ const XX>
+{
+ public:
+ typedef VirtualVector<XX,PTRDEL> my_container;
+ typedef typename my_container::impl_type::const_iterator impl_iterator;
+
+ // LIFECYCLE
+ const_iterator(
+ impl_iterator i_implIter )
+ : itImpl(i_implIter) {}
+
+
+ /////////// STL ITERATOR CONCEPT IMPLEMENTATION //////////////
+
+ // Default Constructible functions:
+ const_iterator()
+ : itImpl() {}
+
+ // Assignable functions:
+ // Assignment and copy constructor use the compiler generated versions.
+
+ // Equality Comparable functions:
+ bool operator==(
+ const_iterator i_other ) const
+ { return itImpl == i_other.itImpl; }
+ bool operator!=(
+ const_iterator i_other ) const
+ { return itImpl != i_other.itImpl; }
+
+ // Trivial Iterator functions:
+ const XX & operator*() const
+ { return *(*itImpl); }
+
+ // Input Iterator functions:
+ const_iterator & operator++()
+ { ++itImpl; return *this; }
+ const_iterator operator++(int)
+ { return const_iterator(itImpl++); }
+
+ // Bidirectional Iterator functions:
+ const_iterator & operator--()
+ { --itImpl; return *this; }
+ const_iterator operator--(int)
+ { return const_iterator(itImpl--); }
+
+ // Less Than Comparable functions:
+ bool operator<(
+ const_iterator i_other ) const
+ { return itImpl < i_other.itImpl; }
+
+ // Random Access Iterator functions:
+ const_iterator & operator+=(
+ difference_type i_diff )
+ { itImpl += i_diff; return *this; }
+ const_iterator operator+(
+ difference_type i_diff ) const
+ { const_iterator ret(itImpl);
+ return ret += i_diff; }
+ const_iterator & operator-=(
+ difference_type i_diff )
+ { itImpl -= i_diff; return *this; }
+ const_iterator operator-(
+ difference_type i_diff ) const
+ { const_iterator ret(itImpl);
+ return ret -= i_diff; }
+ difference_type operator-(
+ const_iterator i_it ) const
+ { return itImpl - i_it.itImpl; }
+ const XX & operator[](
+ difference_type i_index )
+ { return *(*itImpl[i_index]); }
+
+ //////////////////////////////////////////////////////////////////////////
+
+ private:
+ friend class VirtualVector<XX,PTRDEL>;
+ impl_iterator ImplValue() const { return itImpl; }
+
+ // DATA
+ impl_iterator itImpl;
+};
+
+
+
+
+/** Should be usable for all STL algorithms.
+ Implements the Random Access Iterator concept.
+*/
+template <class XX, class PTRDEL>
+class VirtualVector<XX,PTRDEL>::
+ iterator
+
+ // This derivation provides type information for the STL
+ // It introduces the types "value_type" and "difference_type".
+ : public std::iterator<std::random_access_iterator_tag,
+ XX>
+{
+ public:
+ typedef VirtualVector<XX,PTRDEL> my_container;
+ typedef typename my_container::impl_type::iterator impl_iterator;
+
+ // LIFECYCLE
+ iterator(
+ impl_iterator i_implIter )
+ : itImpl(i_implIter) {}
+
+
+ /////////// STL ITERATOR CONCEPT IMPLEMENTATION //////////////
+
+ // Default Constructible functions:
+ iterator()
+ : itImpl() {}
+
+ // Assignable functions:
+ // Assignment and copy constructor use the compiler generated versions.
+
+ // Equality Comparable functions:
+ bool operator==(
+ iterator i_other ) const
+ { return itImpl == i_other.itImpl; }
+ bool operator!=(
+ iterator i_other ) const
+ { return itImpl != i_other.itImpl; }
+
+ // Trivial Iterator functions:
+ XX & operator*() const
+ { return *(*itImpl); }
+
+ // Input Iterator functions:
+ iterator & operator++()
+ { ++itImpl; return *this; }
+ iterator operator++(int)
+ { return iterator(itImpl++); }
+
+ // Bidirectional Iterator functions:
+ iterator & operator--()
+ { --itImpl; return *this; }
+ iterator operator--(int)
+ { return iterator(itImpl--); }
+
+ // Less Than Comparable functions:
+ bool operator<(
+ iterator i_other ) const
+ { return itImpl < i_other.itImpl; }
+
+ // Random Access Iterator functions:
+ iterator & operator+=(
+ difference_type i_diff )
+ { itImpl += i_diff; return *this; }
+ iterator operator+(
+ difference_type i_diff ) const
+ { iterator ret(itImpl);
+ return ret += i_diff; }
+ iterator & operator-=(
+ difference_type i_diff )
+ { itImpl -= i_diff; return *this; }
+ iterator operator-(
+ difference_type i_diff ) const
+ { iterator ret(itImpl);
+ return ret -= i_diff; }
+ difference_type operator-(
+ iterator i_it ) const
+ { return itImpl - i_it.itImpl; }
+ XX & operator[](
+ difference_type i_index )
+ { return *(*itImpl[i_index]); }
+
+ //////////////////////////////////////////////////////////////////////////
+
+ private:
+ friend class VirtualVector<XX,PTRDEL>;
+ impl_iterator ImplValue() const { return itImpl; }
+
+ // DATA
+ impl_iterator itImpl;
+};
+
+
+
+
+// IMPLEMENTATION
+template <class XX, class PTRDEL>
+inline
+VirtualVector<XX,PTRDEL>::VirtualVector()
+ : aData()
+{
+}
+
+template <class XX, class PTRDEL>
+inline
+VirtualVector<XX,PTRDEL>::VirtualVector(int i_size)
+ : aData(i_size, 0)
+{
+}
+
+template <class XX, class PTRDEL>
+inline
+VirtualVector<XX,PTRDEL>::~VirtualVector()
+{
+ PTRDEL::Destruct(aData);
+}
+
+template <class XX, class PTRDEL>
+inline const XX &
+VirtualVector<XX,PTRDEL>::operator[]( size_type i_pos ) const
+{
+ return *aData[i_pos];
+}
+
+template <class XX, class PTRDEL>
+inline XX &
+VirtualVector<XX,PTRDEL>::operator[]( size_type i_pos )
+{
+ return *aData[i_pos];
+}
+
+template <class XX, class PTRDEL>
+inline void
+VirtualVector<XX,PTRDEL>::push_back( DYN XX & i_drElement )
+{
+ aData.push_back(&i_drElement);
+}
+
+template <class XX, class PTRDEL>
+inline void
+VirtualVector<XX,PTRDEL>::pop_back()
+{
+ if (NOT aData.empty())
+ PTRDEL::PopBack(aData);
+}
+
+template <class XX, class PTRDEL>
+inline typename VirtualVector<XX,PTRDEL>::iterator
+VirtualVector<XX,PTRDEL>::insert( iterator i_pos,
+ DYN XX & i_drElement )
+{
+ return iterator(aData.insert(i_pos.ImplValue(), &i_drElement));
+}
+
+template <class XX, class PTRDEL>
+inline void
+VirtualVector<XX,PTRDEL>::erase( iterator i_pos )
+{
+ PTRDEL::Erase(aData, i_pos.ImplValue());
+}
+
+template <class XX, class PTRDEL>
+inline void
+VirtualVector<XX,PTRDEL>::replace( iterator i_pos,
+ DYN XX & i_drElement )
+{
+ PTRDEL::ReplacePtr(*i_pos, &i_drElement);
+}
+
+template <class XX, class PTRDEL>
+inline void
+VirtualVector<XX,PTRDEL>::reserve( size_type i_size )
+{
+ aData.reserve(i_size);
+}
+
+template <class XX, class PTRDEL>
+inline bool
+VirtualVector<XX,PTRDEL>::empty() const
+{
+ return aData.empty();
+}
+
+template <class XX, class PTRDEL>
+inline size_t
+VirtualVector<XX,PTRDEL>::size() const
+{
+ return aData.size();
+}
+
+template <class XX, class PTRDEL>
+inline typename VirtualVector<XX,PTRDEL>::const_iterator
+VirtualVector<XX,PTRDEL>::begin() const
+{
+ return const_iterator(aData.begin());
+}
+
+template <class XX, class PTRDEL>
+inline typename VirtualVector<XX,PTRDEL>::const_iterator
+VirtualVector<XX,PTRDEL>::end() const
+{
+ return const_iterator(aData.end());
+}
+
+template <class XX, class PTRDEL>
+inline const XX &
+VirtualVector<XX,PTRDEL>::front() const
+{
+ return *aData.front();
+}
+
+template <class XX, class PTRDEL>
+inline const XX &
+VirtualVector<XX,PTRDEL>::back() const
+{
+ return *aData.back();
+}
+
+template <class XX, class PTRDEL>
+inline typename VirtualVector<XX,PTRDEL>::iterator
+VirtualVector<XX,PTRDEL>::begin()
+{
+ return iterator(aData.begin());
+}
+
+template <class XX, class PTRDEL>
+inline typename VirtualVector<XX,PTRDEL>::iterator
+VirtualVector<XX,PTRDEL>::end()
+{
+ return iterator(aData.end());
+}
+
+template <class XX, class PTRDEL>
+inline XX &
+VirtualVector<XX,PTRDEL>::front()
+{
+ return *aData.front();
+}
+
+template <class XX, class PTRDEL>
+inline XX &
+VirtualVector<XX,PTRDEL>::back()
+{
+ return *aData.back();
+}
+
+
+
+
+} // namespace csv
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/x.hxx b/include/cosv/x.hxx
new file mode 100644
index 000000000000..755436317a39
--- /dev/null
+++ b/include/cosv/x.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_X_HXX
+#define CSV_X_HXX
+
+// USED SERVICES
+ // BASE CLASSES
+ // COMPONENTS
+#include <cosv/string.hxx>
+ // PARAMETERS
+#include <cosv/csv_ostream.hxx>
+
+
+namespace csv
+{
+
+class Exception
+{
+ public:
+ virtual ~Exception() {}
+ virtual void GetInfo(
+ ostream & o_rOutputMedium ) const = 0;
+};
+
+
+class X_Default : public Exception
+{
+ public:
+ X_Default(
+ const char * i_sMessage )
+ : sMessage(i_sMessage) {}
+ virtual void GetInfo( // Implemented in comfunc.cxx
+ ostream & o_rOutputMedium ) const;
+ private:
+ String sMessage;
+};
+
+
+} // namespace csv
+
+
+
+#endif
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/basegfxfactory.hxx b/include/cppcanvas/basegfxfactory.hxx
new file mode 100644
index 000000000000..83acb38c448f
--- /dev/null
+++ b/include/cppcanvas/basegfxfactory.hxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CPPCANVAS_BASEGFXFACTORY_HXX
+#define _CPPCANVAS_BASEGFXFACTORY_HXX
+
+#include <cppcanvas/canvas.hxx>
+#include <cppcanvas/bitmapcanvas.hxx>
+#include <cppcanvas/spritecanvas.hxx>
+#include <cppcanvas/polypolygon.hxx>
+#include <cppcanvas/bitmap.hxx>
+#include <cppcanvas/renderer.hxx>
+#include <cppcanvas/text.hxx>
+#include <cppcanvas/sprite.hxx>
+#include <basegfx/vector/b2isize.hxx>
+
+#include <cppcanvas/cppcanvasdllapi.h>
+
+namespace basegfx
+{
+ class B2DPolygon;
+ class B2DPolyPolygon;
+}
+
+
+/* Definition of BaseGfxFactory class */
+
+namespace cppcanvas
+{
+ /** The BaseGfxFactory creates Canvas objects for various basegfx
+ primitives, such as polygons and bitmaps (not yet
+ implemented).
+
+ Please note that the objects created for a specific Canvas can
+ only be drawn on exactly that canvas. You have to regenerate
+ them for different canvases.
+ */
+ class CPPCANVAS_DLLPUBLIC BaseGfxFactory
+ {
+ public:
+ static BaseGfxFactory& getInstance();
+
+ /** Create a polygon from a ::basegfx::B2DPolygon
+
+ The created polygon initially has the same size in user
+ coordinate space as the source polygon
+ */
+ PolyPolygonSharedPtr createPolyPolygon( const CanvasSharedPtr&, const ::basegfx::B2DPolygon& rPoly ) const;
+
+ /** Create an uninitialized bitmap with the given size
+ */
+ BitmapSharedPtr createBitmap( const CanvasSharedPtr&, const ::basegfx::B2ISize& rSize ) const;
+
+ /** Create an uninitialized alpha bitmap with the given size
+ */
+ BitmapSharedPtr createAlphaBitmap( const CanvasSharedPtr&, const ::basegfx::B2ISize& rSize ) const;
+
+ private:
+ friend struct InitInstance2;
+
+ // singleton
+ BaseGfxFactory();
+
+ // default: disabled copy/assignment
+ BaseGfxFactory(const BaseGfxFactory&);
+ BaseGfxFactory& operator=( const BaseGfxFactory& );
+ };
+
+}
+
+#endif /* _CPPCANVAS_BASEGFXFACTORY_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/bitmap.hxx b/include/cppcanvas/bitmap.hxx
new file mode 100644
index 000000000000..5e542e7220aa
--- /dev/null
+++ b/include/cppcanvas/bitmap.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CPPCANVAS_BITMAP_HXX
+#define _CPPCANVAS_BITMAP_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <boost/shared_ptr.hpp>
+#include <cppcanvas/canvasgraphic.hxx>
+#include <cppcanvas/bitmapcanvas.hxx>
+
+namespace com { namespace sun { namespace star { namespace rendering
+{
+ class XBitmap;
+} } } }
+
+
+/* Definition of Bitmap interface */
+
+namespace cppcanvas
+{
+
+ /** This interface defines a Bitmap canvas object
+
+ Consider this object part of the view, and not of the model
+ data, as this bitmap can only be painted on its parent canvas
+ */
+ class Bitmap : public virtual CanvasGraphic
+ {
+ public:
+ /** Render to parent canvas, with global alpha.
+
+ This method renders the content to the parent canvas,
+ i.e. the canvas this object was constructed for.
+
+ @param nAlphaModulation
+ Global alpha value, with which each pixel alpha value gets
+ multiplied. For a normal, opaque bitmap, this will make
+ the bitmap appear transparent with the given alpha value
+ (value must be in the range [0,1]).
+
+ @return whether the rendering finished successfully.
+ */
+ virtual bool drawAlphaModulated( double nAlphaModulation ) const = 0;
+
+ virtual BitmapCanvasSharedPtr getBitmapCanvas() const = 0;
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XBitmap > getUNOBitmap() const = 0;
+ };
+
+ typedef ::boost::shared_ptr< ::cppcanvas::Bitmap > BitmapSharedPtr;
+}
+
+#endif /* _CPPCANVAS_BITMAP_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/bitmapcanvas.hxx b/include/cppcanvas/bitmapcanvas.hxx
new file mode 100644
index 000000000000..620182a14e45
--- /dev/null
+++ b/include/cppcanvas/bitmapcanvas.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CPPCANVAS_BITMAPCANVAS_HXX
+#define _CPPCANVAS_BITMAPCANVAS_HXX
+
+#include <sal/types.h>
+#include <osl/diagnose.h>
+
+#include <boost/shared_ptr.hpp>
+#include <basegfx/vector/b2isize.hxx>
+#include <cppcanvas/canvas.hxx>
+
+
+/* Definition of BitmapCanvas */
+
+namespace cppcanvas
+{
+ class BitmapCanvas;
+
+ // forward declaration, since cloneBitmapCanvas() also references BitmapCanvas
+ typedef ::boost::shared_ptr< BitmapCanvas > BitmapCanvasSharedPtr;
+
+ /** BitmapCanvas interface
+ */
+ class BitmapCanvas : public virtual Canvas
+ {
+ public:
+ virtual ::basegfx::B2ISize getSize() const = 0;
+
+ // shared_ptr does not allow for covariant return types
+ BitmapCanvasSharedPtr cloneBitmapCanvas() const
+ {
+ BitmapCanvasSharedPtr p( ::boost::dynamic_pointer_cast< BitmapCanvas >(this->clone()) );
+ OSL_ENSURE(p.get(), "BitmapCanvas::cloneBitmapCanvas(): dynamic cast failed");
+ return p;
+ }
+ };
+
+}
+
+#endif /* _CPPCANVAS_BITMAPCANVAS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/canvas.hxx b/include/cppcanvas/canvas.hxx
new file mode 100644
index 000000000000..0a77e7129a43
--- /dev/null
+++ b/include/cppcanvas/canvas.hxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CPPCANVAS_CANVAS_HXX
+#define _CPPCANVAS_CANVAS_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <boost/shared_ptr.hpp>
+#include <cppcanvas/font.hxx>
+#include <cppcanvas/color.hxx>
+
+
+namespace basegfx
+{
+ class B2DHomMatrix;
+ class B2DPolyPolygon;
+}
+
+namespace com { namespace sun { namespace star { namespace rendering
+{
+ class XCanvas;
+ struct ViewState;
+} } } }
+
+
+/* Definition of BitmapCanvas */
+
+namespace cppcanvas
+{
+ class PolyPolygon;
+ class Canvas;
+
+ // forward declaration, since PolyPolygon also references Canvas
+ typedef ::boost::shared_ptr< PolyPolygon > PolyPolygonSharedPtr;
+
+ // forward declaration, since cloneCanvas() also references Canvas
+ typedef ::boost::shared_ptr< Canvas > CanvasSharedPtr;
+
+ /** Canvas interface
+ */
+ class Canvas
+ {
+ public:
+ enum
+ {
+ /** Extra pixel used when canvas anti-aliases.
+
+ Enlarge the bounding box of drawing primitives by this
+ amount in both dimensions, and on both sides of the
+ bounds, to account for extra pixel touched outside the
+ actual primitive bounding box, when the canvas
+ performs anti-aliasing.
+ */
+ ANTIALIASING_EXTRA_SIZE=2
+ };
+
+ virtual ~Canvas() {}
+
+ virtual void setTransformation( const ::basegfx::B2DHomMatrix& rMatrix ) = 0;
+ virtual ::basegfx::B2DHomMatrix getTransformation() const = 0;
+
+ virtual void setClip( const ::basegfx::B2DPolyPolygon& rClipPoly ) = 0;
+ virtual void setClip() = 0;
+
+ /** Get current clip
+
+ @return NULL, if no clip is set, otherwise the current clip poly-polygon
+ */
+ virtual ::basegfx::B2DPolyPolygon const* getClip() const = 0;
+
+ virtual FontSharedPtr createFont( const OUString& rFontName, const double& rCellSize ) const = 0;
+
+ virtual ColorSharedPtr createColor() const = 0;
+
+ virtual CanvasSharedPtr clone() const = 0;
+ virtual void clear() const = 0;
+
+ // this should be considered private. if RTTI gets enabled
+ // someday, remove that to a separate interface
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XCanvas > getUNOCanvas() const = 0;
+ virtual ::com::sun::star::rendering::ViewState getViewState() const = 0;
+ };
+
+}
+
+#endif /* _CPPCANVAS_CANVAS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/canvasgraphic.hxx b/include/cppcanvas/canvasgraphic.hxx
new file mode 100644
index 000000000000..e496df6aeb33
--- /dev/null
+++ b/include/cppcanvas/canvasgraphic.hxx
@@ -0,0 +1,157 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CPPCANVAS_CANVASGRAPHIC_HXX
+#define _CPPCANVAS_CANVASGRAPHIC_HXX
+
+#include <sal/types.h>
+
+#include <boost/shared_ptr.hpp>
+#include <cppcanvas/color.hxx>
+#include <cppcanvas/canvas.hxx>
+
+namespace basegfx
+{
+ class B2DHomMatrix;
+ class B2DPolyPolygon;
+}
+
+
+/* Definition of CanvasGraphic interface */
+
+namespace cppcanvas
+{
+ // forward declaration, since PolyPolygon also derives from CanvasGraphic
+ typedef ::boost::shared_ptr< class PolyPolygon > PolyPolygonSharedPtr;
+
+
+ /** This interface defines basic properties of
+ objects that can be painted on a Canvas
+ */
+ class CanvasGraphic
+ {
+ public:
+
+ /** These enums determine how the primitive color is combined
+ with the background. When performing this calculations, it
+ is assumed that all color values are premultiplied with
+ the corresponding alpha values (if no alpha is specified,
+ 1.0 is assumed). Then, the following general compositing
+ operation is performed:
+
+ C = Ca * Fa + Cb * Fb
+
+ where C is the result color, Ca and Cb are the input
+ colors, premultiplied with alpha, and Fa and Fb are
+ described for the different composite modes (wherein Aa
+ and Ab denote source and destination alpha, respectively).
+ */
+ enum CompositeOp
+ {
+ /// Clear destination. Fa = Fb = 0.
+ CLEAR,
+
+ /// Copy source as-is to destination. Fa = 1, Fb = 0.
+ SOURCE,
+
+ /// Leave destination as-is. Fa = 0, Fb = 1.
+ DESTINATION,
+
+ /// Copy source over destination. Fa = 1, Fb = 1-Aa.
+ OVER,
+
+ /// Copy source under destination. Fa = 1-Ab, Fb = 1.
+ UNDER,
+
+ /// Copy source to destination, but limited to where the destination is. Fa = Ab, Fb = 0.
+ INSIDE,
+
+ /// Leave destination as is, but only where source was. Fa = 0, Fb = Aa.
+ INSIDE_REVERSE,
+
+ /// Copy source to destination, but limited to where destination is not. Fa = 1-Ab, Fb = 0.
+ OUTSIDE,
+
+ /// Leave destination as is, but only where source has not been. Fa = 0, Fb = 1-Aa.
+ OUTSIDE_REVERSE,
+
+ /// Copy source over destination, but only where destination is. Keep destination. Fa = Ab, Fb = 1-Aa.
+ ATOP,
+
+ /// Copy destination over source, but only where source is. Keep source. Fa = 1-Ab, Fb = Aa.
+ ATOP_REVERSE,
+
+ /// Take only parts where either source or destination, but not both are. Fa = 1-Ab, Fb = 1-Aa.
+ XOR,
+
+ /** simply add contributions of both source and destination. The
+ resulting color values are limited to the permissible color
+ range, and clipped to the maximal value, if exceeded. Fa = 1, Fb = 1.
+ */
+ ADD,
+
+ /// Fa = min(1,(1-Ab)/Aa), Fb = 1
+ SATURATE
+ };
+
+ virtual ~CanvasGraphic() {}
+
+ /** Set object transformation matrix
+ */
+ virtual void setTransformation( const ::basegfx::B2DHomMatrix& rMatrix ) = 0;
+ /** Get object transformation matrix
+ */
+ virtual ::basegfx::B2DHomMatrix getTransformation() const = 0;
+
+ /** Set object clipping polygon
+ */
+ virtual void setClip( const ::basegfx::B2DPolyPolygon& rClipPoly ) = 0;
+ /** Clear object clipping polygon
+ */
+ virtual void setClip() = 0;
+ /** Get object clipping polygon
+
+ @return NULL, if no clip is set; otherwise, the current clip poly-polygon is returned
+ */
+ virtual ::basegfx::B2DPolyPolygon const* getClip() const = 0;
+
+ /** Set object composite mode
+ */
+ virtual void setCompositeOp( CompositeOp aOp ) = 0;
+ /** Get object composite mode
+ */
+ virtual CompositeOp getCompositeOp() const = 0;
+
+ /** Render to parent canvas
+
+ This method renders the content to the parent canvas,
+ i.e. the canvas this object was constructed for.
+
+ @return whether the rendering finished successfully.
+ */
+ virtual bool draw() const = 0;
+
+ };
+
+ typedef ::boost::shared_ptr< ::cppcanvas::CanvasGraphic > CanvasGraphicSharedPtr;
+}
+
+#endif /* _CPPCANVAS_CANVASGRAPHIC_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/color.hxx b/include/cppcanvas/color.hxx
new file mode 100644
index 000000000000..6d7dc957286a
--- /dev/null
+++ b/include/cppcanvas/color.hxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CPPCANVAS_COLOR_HXX
+#define _CPPCANVAS_COLOR_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <boost/shared_ptr.hpp>
+
+
+/* Definition of Color class */
+
+namespace cppcanvas
+{
+ class Color
+ {
+ public:
+ /** Color in the sRGB color space, plus alpha channel
+
+ The four bytes of the sal_uInt32 are allocated as follows
+ to the color channels and alpha: 0xRRGGBBAA.
+ */
+ typedef sal_uInt32 IntSRGBA;
+
+ virtual ~Color() {}
+
+ virtual IntSRGBA getIntSRGBA( ::com::sun::star::uno::Sequence< double >& rDeviceColor ) const = 0;
+ virtual ::com::sun::star::uno::Sequence< double > getDeviceColor( IntSRGBA aSRGBA ) const = 0;
+ };
+
+ typedef ::boost::shared_ptr< ::cppcanvas::Color > ColorSharedPtr;
+
+ inline sal_uInt8 getRed( Color::IntSRGBA nCol )
+ {
+ return static_cast<sal_uInt8>( (nCol&0xFF000000U) >> 24U );
+ }
+
+ inline sal_uInt8 getGreen( Color::IntSRGBA nCol )
+ {
+ return static_cast<sal_uInt8>( (nCol&0x00FF0000U) >> 16U );
+ }
+
+ inline sal_uInt8 getBlue( Color::IntSRGBA nCol )
+ {
+ return static_cast<sal_uInt8>( (nCol&0x0000FF00U) >> 8U );
+ }
+
+ inline sal_uInt8 getAlpha( Color::IntSRGBA nCol )
+ {
+ return static_cast<sal_uInt8>( nCol&0x000000FFU );
+ }
+
+ inline Color::IntSRGBA makeColor( sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue, sal_uInt8 nAlpha )
+ {
+ return (nRed << 24U)|(nGreen << 16U)|(nBlue << 8U)|(nAlpha);
+ }
+
+ inline sal_Int32 unMakeColor( sal_uInt8 nAlpha, sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue)
+ {
+ return (nAlpha << 24U)|(nRed << 16U)|(nGreen << 8U)|(nBlue);
+ }
+
+ inline sal_Int32 makeColorARGB( sal_uInt8 nAlpha, sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue)
+ {
+ return (nAlpha << 24U)|(nRed << 16U)|(nGreen << 8U)|(nBlue);
+ }
+
+}
+
+#endif /* _CPPCANVAS_COLOR_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/cppcanvasdllapi.h b/include/cppcanvas/cppcanvasdllapi.h
new file mode 100644
index 000000000000..be641aad8b2b
--- /dev/null
+++ b/include/cppcanvas/cppcanvasdllapi.h
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_CPPCANVASDLLAPI_H
+#define INCLUDED_CPPCANVASDLLAPI_H
+
+#if defined CPPCANVAS_DLLIMPLEMENTATION
+
+#define CPPCANVAS_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define CPPCANVAS_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define CPPCANVAS_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif
diff --git a/include/cppcanvas/customsprite.hxx b/include/cppcanvas/customsprite.hxx
new file mode 100644
index 000000000000..70004e7e5900
--- /dev/null
+++ b/include/cppcanvas/customsprite.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CPPCANVAS_CUSTOMSPRITE_HXX
+#define _CPPCANVAS_CUSTOMSPRITE_HXX
+
+#include <sal/types.h>
+
+#include <boost/shared_ptr.hpp>
+#include <cppcanvas/sprite.hxx>
+#include <cppcanvas/canvas.hxx>
+
+
+/* Definition of CustomSprite class */
+
+namespace cppcanvas
+{
+
+ class CustomSprite : public virtual Sprite
+ {
+ public:
+
+ virtual CanvasSharedPtr getContentCanvas() const = 0;
+ };
+
+ typedef ::boost::shared_ptr< ::cppcanvas::CustomSprite > CustomSpriteSharedPtr;
+}
+
+#endif /* _CPPCANVAS_CUSTOMSPRITE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/font.hxx b/include/cppcanvas/font.hxx
new file mode 100644
index 000000000000..967903eaa8e7
--- /dev/null
+++ b/include/cppcanvas/font.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CPPCANVAS_FONT_HXX
+#define _CPPCANVAS_FONT_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <boost/shared_ptr.hpp>
+
+
+namespace com { namespace sun { namespace star { namespace rendering
+{
+ class XCanvasFont;
+} } } }
+
+/* Definition of Font class */
+
+namespace cppcanvas
+{
+
+ class Font
+ {
+ public:
+ virtual ~Font() {}
+
+ virtual OUString getName() const = 0;
+ virtual double getCellSize() const = 0;
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XCanvasFont > getUNOFont() const = 0;
+ };
+
+ typedef ::boost::shared_ptr< ::cppcanvas::Font > FontSharedPtr;
+}
+
+#endif /* _CPPCANVAS_FONT_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/polypolygon.hxx b/include/cppcanvas/polypolygon.hxx
new file mode 100644
index 000000000000..ccfbb95d3def
--- /dev/null
+++ b/include/cppcanvas/polypolygon.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CPPCANVAS_POLYPOLYGON_HXX
+#define _CPPCANVAS_POLYPOLYGON_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <boost/shared_ptr.hpp>
+#include <cppcanvas/canvasgraphic.hxx>
+
+namespace basegfx
+{
+ class B2DPolygon;
+ class B2DPolyPolygon;
+}
+
+namespace com { namespace sun { namespace star { namespace rendering
+{
+ class XPolyPolygon2D;
+} } } }
+
+
+/* Definition of PolyPolygon interface */
+
+namespace cppcanvas
+{
+
+ /** This interface defines a PolyPolygon canvas object
+
+ Consider this object part of the view, and not of the model
+ data. Although the given polygon is typically copied and held
+ internally (to facilitate migration to incompatible canvases),
+ ::basegfx::B2DPolygon et al. are ref-counted copy-on-write
+ classes, i.e. memory shouldn't be wasted. On the other hand,
+ the API polygon created internally _does_ necessarily
+ duplicate the data held, but can be easily flushed away via
+ flush().
+ */
+ class PolyPolygon : public virtual CanvasGraphic
+ {
+ public:
+ virtual void addPolygon( const ::basegfx::B2DPolygon& rPoly ) = 0;
+ virtual void addPolyPolygon( const ::basegfx::B2DPolyPolygon& rPoly ) = 0;
+
+ /** Set polygon fill color
+ */
+ virtual void setRGBAFillColor( Color::IntSRGBA ) = 0;
+ /** Set polygon line color
+ */
+ virtual void setRGBALineColor( Color::IntSRGBA ) = 0;
+ /** Get polygon fill color
+ */
+ virtual Color::IntSRGBA getRGBAFillColor() const = 0;
+ /** Get polygon line color
+ */
+ virtual Color::IntSRGBA getRGBALineColor() const = 0;
+
+ virtual void setStrokeWidth( const double& rStrokeWidth ) = 0;
+ virtual double getStrokeWidth() const = 0;
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XPolyPolygon2D > getUNOPolyPolygon() const = 0;
+ };
+
+ typedef ::boost::shared_ptr< ::cppcanvas::PolyPolygon > PolyPolygonSharedPtr;
+}
+
+#endif /* _CPPCANVAS_POLYPOLYGON_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/renderer.hxx b/include/cppcanvas/renderer.hxx
new file mode 100644
index 000000000000..e260e9400248
--- /dev/null
+++ b/include/cppcanvas/renderer.hxx
@@ -0,0 +1,144 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CPPCANVAS_RENDERER_HXX
+#define _CPPCANVAS_RENDERER_HXX
+
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/optional.hpp>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <cppcanvas/canvasgraphic.hxx>
+#include <cppcanvas/color.hxx>
+
+namespace basegfx
+{
+ class B2DRange;
+}
+
+/* Definition of Renderer interface */
+
+namespace cppcanvas
+{
+
+ class Renderer : public virtual CanvasGraphic
+ {
+ public:
+ /** Render subset of metafile to given canvas
+
+ This method renders the given subset of the content to the
+ associated canvas.
+
+ @param nStartIndex
+ The index of the first action to be rendered (the indices
+ correspond roughly to the action indices of the
+ originating GDIMetaFile. Note, although, that certain
+ actions, e.g. text, accounts for more than one index: a
+ text produces as many addressable indices as it has
+ characters).
+
+ @param nEndIndex
+ The index of the first action _not_ painted anymore,
+ i.e. the action after the last action rendered (the
+ indices correspond roughly to the action indices of the
+ originating GDIMetaFile. Note, although, that certain
+ actions, e.g. text, accounts for more than one index: a
+ text produces as many addressable indices as it has
+ characters).
+
+ @return whether the rendering finished successfully.
+ */
+ virtual bool drawSubset( sal_Int32 nStartIndex,
+ sal_Int32 nEndIndex ) const = 0;
+
+ /** Query bounding box of metafile subset
+
+ This method queries the actual bounding box of the given
+ subset, when rendered on the associated canvas.
+
+ @param nStartIndex
+ The index of the first action to be rendered (the indices
+ correspond roughly to the action indices of the
+ originating GDIMetaFile. Note, although, that certain
+ actions, e.g. text, accounts for more than one index: a
+ text produces as many addressable indices as it has
+ characters).
+
+ @param nEndIndex
+ The index of the first action _not_ painted anymore,
+ i.e. the action after the last action rendered (the
+ indices correspond roughly to the action indices of the
+ originating GDIMetaFile. Note, although, that certain
+ actions, e.g. text, accounts for more than one index: a
+ text produces as many addressable indices as it has
+ characters).
+
+ @return the bounding box of the specified subset
+ */
+ virtual ::basegfx::B2DRange getSubsetArea( sal_Int32 nStartIndex,
+ sal_Int32 nEndIndex ) const = 0;
+
+ /** Parameters for the Renderer
+ */
+ struct Parameters
+ {
+ /// Optionally forces the fill color attribute for all actions
+ ::boost::optional< Color::IntSRGBA > maFillColor;
+
+ /// Optionally forces the line color attribute for all actions
+ ::boost::optional< Color::IntSRGBA > maLineColor;
+
+ /// Optionally forces the text color attribute for all actions
+ ::boost::optional< Color::IntSRGBA > maTextColor;
+
+ /// Optionally forces the given fontname for all text actions
+ ::boost::optional< OUString > maFontName;
+
+ /** Optionally transforms all text output actions with the
+ given matrix (in addition to the overall canvas
+ transformation).
+
+ Note that the matrix given here is applied to the unit
+ rect coordinate system, i.e. the metafile is assumed
+ to be contained in the unit rect.
+ */
+ ::boost::optional< ::basegfx::B2DHomMatrix > maTextTransformation;
+
+ /// Optionally forces the given font weight for all text actions
+ ::boost::optional< sal_Int8 > maFontWeight;
+
+ /// Optionally forces the given font letter form (italics etc.) for all text actions
+ ::boost::optional< sal_Int8 > maFontLetterForm;
+
+ /// Optionally forces the given font proportion (condensed, monospaced etc.) for all text actions
+ ::boost::optional< sal_Int8 > maFontProportion;
+
+ /// Optionally forces underlining for all text actions
+ ::boost::optional< bool > maFontUnderline;
+ };
+ };
+
+ typedef ::boost::shared_ptr< ::cppcanvas::Renderer > RendererSharedPtr;
+}
+
+#endif /* _CPPCANVAS_RENDERER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/sprite.hxx b/include/cppcanvas/sprite.hxx
new file mode 100644
index 000000000000..0e87ff9b9dd1
--- /dev/null
+++ b/include/cppcanvas/sprite.hxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CPPCANVAS_SPRITE_HXX
+#define _CPPCANVAS_SPRITE_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <boost/shared_ptr.hpp>
+
+namespace basegfx
+{
+ class B2DHomMatrix;
+ class B2DPolyPolygon;
+ class B2DPoint;
+}
+
+namespace com { namespace sun { namespace star { namespace rendering
+{
+ class XSprite;
+} } } }
+
+
+/* Definition of Sprite class */
+
+namespace cppcanvas
+{
+
+ class Sprite
+ {
+ public:
+ virtual ~Sprite() {}
+
+ virtual void setAlpha( const double& rAlpha ) = 0;
+
+ /** Set the sprite position on screen
+
+ This method differs from the XSprite::move() insofar, as
+ no viewstate/renderstate transformations are applied to
+ the specified position. The given position is interpreted
+ in device coordinates (i.e. screen pixel)
+ */
+ virtual void movePixel( const ::basegfx::B2DPoint& rNewPos ) = 0;
+
+ /** Set the sprite position on screen
+
+ This method sets the sprite position in the view
+ coordinate system of the parent canvas
+ */
+ virtual void move( const ::basegfx::B2DPoint& rNewPos ) = 0;
+
+ virtual void transform( const ::basegfx::B2DHomMatrix& rMatrix ) = 0;
+
+ /** Set output clipping
+
+ This method differs from the XSprite::clip() insofar, as
+ no viewstate/renderstate transformations are applied to
+ the specified clip polygon. The given polygon is
+ interpreted in device coordinates (i.e. screen pixel)
+ */
+ virtual void setClipPixel( const ::basegfx::B2DPolyPolygon& rClipPoly ) = 0;
+
+ /** Set output clipping
+
+ This method applies the clip poly-polygon interpreted in
+ the view coordinate system of the parent canvas.
+ */
+ virtual void setClip( const ::basegfx::B2DPolyPolygon& rClipPoly ) = 0;
+
+ virtual void setClip() = 0;
+
+ virtual void show() = 0;
+ virtual void hide() = 0;
+
+ /** Change the sprite priority
+
+ @param fPriority
+ New sprite priority. The higher the priority, the further
+ towards the viewer the sprite appears. That is, sprites
+ with higher priority appear before ones with lower
+ priority.
+ */
+ virtual void setPriority( double fPriority ) = 0;
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XSprite > getUNOSprite() const = 0;
+ };
+
+ typedef ::boost::shared_ptr< ::cppcanvas::Sprite > SpriteSharedPtr;
+}
+
+#endif /* _CPPCANVAS_SPRITE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/spritecanvas.hxx b/include/cppcanvas/spritecanvas.hxx
new file mode 100644
index 000000000000..6a606b331edf
--- /dev/null
+++ b/include/cppcanvas/spritecanvas.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CPPCANVAS_SPRITECANVAS_HXX
+#define _CPPCANVAS_SPRITECANVAS_HXX
+
+#include <sal/types.h>
+#include <osl/diagnose.h>
+#include <basegfx/vector/b2dsize.hxx>
+
+#include <boost/noncopyable.hpp>
+#include <boost/shared_ptr.hpp>
+
+
+#include <cppcanvas/bitmapcanvas.hxx>
+#include <cppcanvas/sprite.hxx>
+#include <cppcanvas/customsprite.hxx>
+
+namespace com { namespace sun { namespace star { namespace rendering
+{
+ class XSpriteCanvas;
+} } } }
+
+
+/* Definition of SpriteCanvas */
+
+namespace cppcanvas
+{
+ class SpriteCanvas;
+
+ // forward declaration, since cloneSpriteCanvas() also references SpriteCanvas
+ typedef ::boost::shared_ptr< ::cppcanvas::SpriteCanvas > SpriteCanvasSharedPtr;
+
+ /** SpriteCanvas interface
+ */
+ class SpriteCanvas : public virtual BitmapCanvas, private boost::noncopyable
+ {
+ public:
+ virtual bool updateScreen( bool bUpdateAll ) const = 0;
+
+ virtual CustomSpriteSharedPtr createCustomSprite( const ::basegfx::B2DSize& ) const = 0;
+ virtual SpriteSharedPtr createClonedSprite( const SpriteSharedPtr& ) const = 0;
+
+ // shared_ptr does not allow for covariant return types
+ SpriteCanvasSharedPtr cloneSpriteCanvas() const
+ {
+ SpriteCanvasSharedPtr p( ::boost::dynamic_pointer_cast< SpriteCanvas >(this->clone()) );
+ OSL_ENSURE(p.get(), "SpriteCanvas::cloneSpriteCanvas(): dynamic cast failed");
+ return p;
+ }
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XSpriteCanvas > getUNOSpriteCanvas() const = 0;
+ };
+
+}
+
+#endif /* _CPPCANVAS_SPRITECANVAS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/text.hxx b/include/cppcanvas/text.hxx
new file mode 100644
index 000000000000..4ca53532c282
--- /dev/null
+++ b/include/cppcanvas/text.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CPPCANVAS_TEXT_HXX
+#define _CPPCANVAS_TEXT_HXX
+
+#include <boost/shared_ptr.hpp>
+#include <cppcanvas/canvasgraphic.hxx>
+
+
+
+
+/* Definition of Text interface */
+
+namespace cppcanvas
+{
+ class Text : public virtual CanvasGraphic
+ {
+ public:
+ virtual void setFont( const FontSharedPtr& ) = 0;
+ virtual FontSharedPtr getFont() = 0;
+ };
+
+ typedef ::boost::shared_ptr< ::cppcanvas::Text > TextSharedPtr;
+}
+
+#endif /* _CPPCANVAS_TEXT_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/vclfactory.hxx b/include/cppcanvas/vclfactory.hxx
new file mode 100644
index 000000000000..b5d2f9612be9
--- /dev/null
+++ b/include/cppcanvas/vclfactory.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CPPCANVAS_VCLFACTORY_HXX
+#define _CPPCANVAS_VCLFACTORY_HXX
+
+#include <cppcanvas/canvas.hxx>
+#include <cppcanvas/bitmapcanvas.hxx>
+#include <cppcanvas/spritecanvas.hxx>
+#include <cppcanvas/polypolygon.hxx>
+#include <cppcanvas/bitmap.hxx>
+#include <cppcanvas/renderer.hxx>
+#include <cppcanvas/text.hxx>
+#include <cppcanvas/sprite.hxx>
+
+#include <cppcanvas/cppcanvasdllapi.h>
+
+class Window;
+class Bitmap;
+class BitmapEx;
+class Polygon;
+class PolyPolygon;
+class Size;
+class Graphic;
+class GDIMetaFile;
+class Animation;
+
+namespace com { namespace sun { namespace star { namespace rendering
+{
+ class XBitmapCanvas;
+ class XSpriteCanvas;
+} } } }
+
+/* Definition of VCLFactory class */
+
+namespace cppcanvas
+{
+ /** The VCLFactory creates Canvas objects for various VCL
+ OutputDevice primitives, such as windows, polygons, bitmaps
+ and metafiles.
+
+ Please note that the objects created for a specific Canvas can
+ only be drawn on exactly that canvas. You have to regenerate
+ them for different canvases.
+ */
+ class CPPCANVAS_DLLPUBLIC VCLFactory
+ {
+ public:
+ static VCLFactory& getInstance();
+
+ BitmapCanvasSharedPtr createCanvas( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XBitmapCanvas >& xCanvas );
+
+ SpriteCanvasSharedPtr createSpriteCanvas( const ::Window& rVCLWindow ) const;
+ SpriteCanvasSharedPtr createSpriteCanvas( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XSpriteCanvas >& xCanvas ) const;
+
+ /** Create a bitmap from a VCL Bitmap
+ */
+ BitmapSharedPtr createBitmap( const CanvasSharedPtr&, const ::BitmapEx& rBmpEx ) const;
+
+ /** Create a renderer object from a Metafile
+
+ The created renderer initially draws the metafile
+ one-by-one units large, in user coordinate space
+ */
+ RendererSharedPtr createRenderer( const CanvasSharedPtr& rCanvas,
+ const ::GDIMetaFile& rMtf,
+ const Renderer::Parameters& rParms ) const;
+
+ private:
+ friend struct InitInstance;
+
+ // singleton
+ VCLFactory();
+
+ // default: disabled copy/assignment
+ VCLFactory(const VCLFactory&);
+ VCLFactory& operator=( const VCLFactory& );
+ };
+
+}
+
+#endif /* _CPPCANVAS_VCLFACTORY_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/XShapeDumper.hxx b/include/drawinglayer/XShapeDumper.hxx
new file mode 100644
index 000000000000..a1cd59948362
--- /dev/null
+++ b/include/drawinglayer/XShapeDumper.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Artur Dorda <artur.dorda+libo@gmail.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/awt/Gradient.hpp>
+#include <com/sun/star/drawing/Hatch.hpp>
+#include <com/sun/star/awt/XBitmap.hpp>
+#include <com/sun/star/drawing/RectanglePoint.hpp>
+#include <com/sun/star/drawing/BitmapMode.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/drawing/LineDash.hpp>
+#include <com/sun/star/drawing/LineJoint.hpp>
+#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+
+#include <com/sun/star/drawing/PolygonKind.hpp>
+
+#include <com/sun/star/drawing/TextFitToSizeType.hpp>
+#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
+#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
+#include <com/sun/star/drawing/TextAnimationDirection.hpp>
+#include <com/sun/star/drawing/TextAnimationKind.hpp>
+#include <com/sun/star/text/WritingMode.hpp>
+
+#include <com/sun/star/drawing/HomogenMatrixLine3.hpp>
+#include <com/sun/star/drawing/HomogenMatrix3.hpp>
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+#ifndef XShapeDumper_hxx
+#define XShapeDumper_hxx
+
+class DRAWINGLAYER_DLLPUBLIC XShapeDumper
+{
+
+public:
+ XShapeDumper();
+ OUString dump(com::sun::star::uno::Reference<com::sun::star::drawing::XShapes> xPageShapes);
+
+};
+#endif
diff --git a/include/drawinglayer/animation/animationtiming.hxx b/include/drawinglayer/animation/animationtiming.hxx
new file mode 100644
index 000000000000..08ee95090f6c
--- /dev/null
+++ b/include/drawinglayer/animation/animationtiming.hxx
@@ -0,0 +1,141 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ANIMATION_ANIMATIONTIMING_HXX
+#define INCLUDED_DRAWINGLAYER_ANIMATION_ANIMATIONTIMING_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <vector>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace animation
+ {
+ //////////////////////////////////////////////////////////////////////////////
+
+ class DRAWINGLAYER_DLLPUBLIC AnimationEntry
+ {
+ private:
+ AnimationEntry(const AnimationEntry&);
+ AnimationEntry& operator=(const AnimationEntry& rCandidate);
+
+ public:
+ AnimationEntry();
+ virtual ~AnimationEntry();
+ virtual AnimationEntry* clone() const = 0;
+
+ virtual bool operator==(const AnimationEntry& rCandidate) const = 0;
+ virtual double getDuration() const = 0;
+ virtual double getStateAtTime(double fTime) const = 0;
+ virtual double getNextEventTime(double fTime) const = 0;
+ };
+
+ //////////////////////////////////////////////////////////////////////////////
+
+ class DRAWINGLAYER_DLLPUBLIC AnimationEntryFixed : public AnimationEntry
+ {
+ protected:
+ double mfDuration;
+ double mfState;
+
+ public:
+ AnimationEntryFixed(double fDuration, double fState = 0.0);
+ virtual ~AnimationEntryFixed();
+ virtual AnimationEntry* clone() const;
+
+ virtual bool operator==(const AnimationEntry& rCandidate) const;
+ virtual double getDuration() const;
+ virtual double getStateAtTime(double fTime) const;
+ virtual double getNextEventTime(double fTime) const;
+ };
+
+ //////////////////////////////////////////////////////////////////////////////
+
+ class DRAWINGLAYER_DLLPUBLIC AnimationEntryLinear : public AnimationEntry
+ {
+ protected:
+ double mfDuration;
+ double mfFrequency;
+ double mfStart;
+ double mfStop;
+
+ public:
+ AnimationEntryLinear(double fDuration, double fFrequency = 250.0, double fStart = 0.0, double fStop = 1.0);
+ virtual ~AnimationEntryLinear();
+ virtual AnimationEntry* clone() const;
+
+ virtual bool operator==(const AnimationEntry& rCandidate) const;
+ virtual double getDuration() const;
+ virtual double getStateAtTime(double fTime) const;
+ virtual double getNextEventTime(double fTime) const;
+ };
+
+ //////////////////////////////////////////////////////////////////////////////
+
+ class DRAWINGLAYER_DLLPUBLIC AnimationEntryList : public AnimationEntry
+ {
+ protected:
+ double mfDuration;
+ ::std::vector< AnimationEntry* > maEntries;
+
+ // helpers
+ sal_uInt32 impGetIndexAtTime(double fTime, double &rfAddedTime) const;
+
+ public:
+ AnimationEntryList();
+ virtual ~AnimationEntryList();
+ virtual AnimationEntry* clone() const;
+
+ virtual bool operator==(const AnimationEntry& rCandidate) const;
+ void append(const AnimationEntry& rCandidate);
+ virtual double getDuration() const;
+ virtual double getStateAtTime(double fTime) const;
+ virtual double getNextEventTime(double fTime) const;
+ };
+
+ //////////////////////////////////////////////////////////////////////////////
+
+ class DRAWINGLAYER_DLLPUBLIC AnimationEntryLoop : public AnimationEntryList
+ {
+ protected:
+ sal_uInt32 mnRepeat;
+
+ public:
+ AnimationEntryLoop(sal_uInt32 nRepeat = 0xffffffff);
+ virtual ~AnimationEntryLoop();
+ virtual AnimationEntry* clone() const;
+
+ virtual bool operator==(const AnimationEntry& rCandidate) const;
+ virtual double getDuration() const;
+ virtual double getStateAtTime(double fTime) const;
+ virtual double getNextEventTime(double fTime) const;
+ };
+
+ //////////////////////////////////////////////////////////////////////////////
+ } // end of namespace animation
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ANIMATION_ANIMATIONTIMING_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/fillbitmapattribute.hxx b/include/drawinglayer/attribute/fillbitmapattribute.hxx
new file mode 100644
index 000000000000..851dc5ed0697
--- /dev/null
+++ b/include/drawinglayer/attribute/fillbitmapattribute.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLBITMAPATTRIBUTE_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLBITMAPATTRIBUTE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+class BitmapEx;
+
+namespace basegfx {
+ class B2DPoint;
+ class B2DVector;
+}
+
+namespace drawinglayer { namespace attribute {
+ class ImpFillBitmapAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC FillBitmapAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpFillBitmapAttribute > ImplType;
+
+ private:
+ ImplType mpFillBitmapAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ FillBitmapAttribute(
+ const BitmapEx& rBitmapEx,
+ const basegfx::B2DPoint& rTopLeft,
+ const basegfx::B2DVector& rSize,
+ bool bTiling);
+ FillBitmapAttribute(const FillBitmapAttribute& rCandidate);
+ FillBitmapAttribute& operator=(const FillBitmapAttribute& rCandidate);
+ ~FillBitmapAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const FillBitmapAttribute& rCandidate) const;
+
+ // data read access
+ const BitmapEx& getBitmapEx() const;
+ const basegfx::B2DPoint& getTopLeft() const;
+ const basegfx::B2DVector& getSize() const;
+ bool getTiling() const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLBITMAPATTRIBUTE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/fillgradientattribute.hxx b/include/drawinglayer/attribute/fillgradientattribute.hxx
new file mode 100644
index 000000000000..e791193651a0
--- /dev/null
+++ b/include/drawinglayer/attribute/fillgradientattribute.hxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLGRADIENTATTRIBUTE_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLGRADIENTATTRIBUTE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx {
+ class BColor;
+}
+
+namespace drawinglayer { namespace attribute {
+ class ImpFillGradientAttribute;
+}}
+
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ enum GradientStyle
+ {
+ GRADIENTSTYLE_LINEAR,
+ GRADIENTSTYLE_AXIAL,
+ GRADIENTSTYLE_RADIAL,
+ GRADIENTSTYLE_ELLIPTICAL,
+ GRADIENTSTYLE_SQUARE,
+ GRADIENTSTYLE_RECT
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC FillGradientAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpFillGradientAttribute > ImplType;
+
+ private:
+ ImplType mpFillGradientAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ FillGradientAttribute(
+ GradientStyle eStyle,
+ double fBorder,
+ double fOffsetX,
+ double fOffsetY,
+ double fAngle,
+ const basegfx::BColor& rStartColor,
+ const basegfx::BColor& rEndColor,
+ sal_uInt16 nSteps);
+ FillGradientAttribute();
+ FillGradientAttribute(const FillGradientAttribute& rCandidate);
+ FillGradientAttribute& operator=(const FillGradientAttribute& rCandidate);
+ ~FillGradientAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const FillGradientAttribute& rCandidate) const;
+
+ // data read access
+ GradientStyle getStyle() const;
+ double getBorder() const;
+ double getOffsetX() const;
+ double getOffsetY() const;
+ double getAngle() const;
+ const basegfx::BColor& getStartColor() const;
+ const basegfx::BColor& getEndColor() const;
+ sal_uInt16 getSteps() const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLGRADIENTATTRIBUTE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/fillhatchattribute.hxx b/include/drawinglayer/attribute/fillhatchattribute.hxx
new file mode 100644
index 000000000000..7e6244be090b
--- /dev/null
+++ b/include/drawinglayer/attribute/fillhatchattribute.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLHATCHATTRIBUTE_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLHATCHATTRIBUTE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx {
+ class BColor;
+}
+
+namespace drawinglayer { namespace attribute {
+ class ImpFillHatchAttribute;
+}}
+
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ enum HatchStyle
+ {
+ HATCHSTYLE_SINGLE,
+ HATCHSTYLE_DOUBLE,
+ HATCHSTYLE_TRIPLE
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC FillHatchAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpFillHatchAttribute > ImplType;
+
+ private:
+ ImplType mpFillHatchAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ FillHatchAttribute(
+ HatchStyle eStyle,
+ double fDistance,
+ double fAngle,
+ const basegfx::BColor& rColor,
+ bool bFillBackground);
+ FillHatchAttribute();
+ FillHatchAttribute(const FillHatchAttribute& rCandidate);
+ FillHatchAttribute& operator=(const FillHatchAttribute& rCandidate);
+ ~FillHatchAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const FillHatchAttribute& rCandidate) const;
+
+ // data read access
+ HatchStyle getStyle() const;
+ double getDistance() const;
+ double getAngle() const;
+ const basegfx::BColor& getColor() const;
+ bool isFillBackground() const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLHATCHATTRIBUTE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/fontattribute.hxx b/include/drawinglayer/attribute/fontattribute.hxx
new file mode 100644
index 000000000000..b49ab83b300e
--- /dev/null
+++ b/include/drawinglayer/attribute/fontattribute.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FONTATTRIBUTE_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_FONTATTRIBUTE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+class String;
+
+namespace drawinglayer { namespace attribute {
+ class ImpFontAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ /** FontAttribute class
+
+ This attribute class is able to hold all parameters needed/used
+ to completely define the parametrisation of a text portion.
+ */
+ class DRAWINGLAYER_DLLPUBLIC FontAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpFontAttribute > ImplType;
+
+ private:
+ ImplType mpFontAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ /// TODO: pair kerning and CJK kerning
+ FontAttribute(
+ const String& rFamilyName,
+ const String& rStyleName,
+ sal_uInt16 nWeight,
+ bool bSymbol = false,
+ bool bVertical = false,
+ bool bItalic = false,
+ bool bMonospaced = false,
+ bool bOutline = false,
+ bool bRTL = false,
+ bool bBiDiStrong = false);
+ FontAttribute();
+ FontAttribute(const FontAttribute& rCandidate);
+ FontAttribute& operator=(const FontAttribute& rCandidate);
+ ~FontAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const FontAttribute& rCandidate) const;
+
+ /// data read access
+ const String& getFamilyName() const;
+ const String& getStyleName() const;
+ sal_uInt16 getWeight() const;
+ bool getSymbol() const;
+ bool getVertical() const;
+ bool getItalic() const;
+ bool getOutline() const;
+ bool getRTL() const;
+ bool getBiDiStrong() const;
+ bool getMonospaced() const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_FONTATTRIBUTE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/lineattribute.hxx b/include/drawinglayer/attribute/lineattribute.hxx
new file mode 100644
index 000000000000..58eb987714e3
--- /dev/null
+++ b/include/drawinglayer/attribute/lineattribute.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINEATTRIBUTE_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINEATTRIBUTE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <basegfx/vector/b2enums.hxx>
+#include <com/sun/star/drawing/LineCap.hpp>
+#include <o3tl/cow_wrapper.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx {
+ class BColor;
+}
+
+namespace drawinglayer { namespace attribute {
+ class ImpLineAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC LineAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpLineAttribute > ImplType;
+
+ private:
+ ImplType mpLineAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ explicit LineAttribute(
+ const basegfx::BColor& rColor,
+ double fWidth = 0.0,
+ basegfx::B2DLineJoin aB2DLineJoin = basegfx::B2DLINEJOIN_ROUND,
+ com::sun::star::drawing::LineCap aLineCap = com::sun::star::drawing::LineCap_BUTT);
+ LineAttribute();
+ LineAttribute(const LineAttribute& rCandidate);
+ LineAttribute& operator=(const LineAttribute& rCandidate);
+ ~LineAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const LineAttribute& rCandidate) const;
+
+ // data read access
+ const basegfx::BColor& getColor() const;
+ double getWidth() const;
+ basegfx::B2DLineJoin getLineJoin() const;
+ com::sun::star::drawing::LineCap getLineCap() const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINEATTRIBUTE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/linestartendattribute.hxx b/include/drawinglayer/attribute/linestartendattribute.hxx
new file mode 100644
index 000000000000..e02d3565aaf7
--- /dev/null
+++ b/include/drawinglayer/attribute/linestartendattribute.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINESTARTENDATTRIBUTE_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINESTARTENDATTRIBUTE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx {
+ class B2DPolyPolygon;
+}
+
+namespace drawinglayer { namespace attribute {
+ class ImpLineStartEndAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC LineStartEndAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpLineStartEndAttribute > ImplType;
+
+ private:
+ ImplType mpLineStartEndAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ LineStartEndAttribute(
+ double fWidth,
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ bool bCentered);
+ LineStartEndAttribute();
+ LineStartEndAttribute(const LineStartEndAttribute& rCandidate);
+ LineStartEndAttribute& operator=(const LineStartEndAttribute& rCandidate);
+ ~LineStartEndAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const LineStartEndAttribute& rCandidate) const;
+
+ // data read access
+ double getWidth() const;
+ const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const;
+ bool isCentered() const;
+ bool isActive() const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINESTARTENDATTRIBUTE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/materialattribute3d.hxx b/include/drawinglayer/attribute/materialattribute3d.hxx
new file mode 100644
index 000000000000..9c4d34dce155
--- /dev/null
+++ b/include/drawinglayer/attribute/materialattribute3d.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_MATERIALATTRIBUTE3D_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_MATERIALATTRIBUTE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace drawinglayer { namespace attribute {
+ class ImpMaterialAttribute3D;
+}}
+
+namespace basegfx {
+ class BColor;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC MaterialAttribute3D
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpMaterialAttribute3D > ImplType;
+
+ private:
+ ImplType mpMaterialAttribute3D;
+
+ public:
+ // constructors/destructor
+ MaterialAttribute3D(
+ const basegfx::BColor& rColor,
+ const basegfx::BColor& rSpecular,
+ const basegfx::BColor& rEmission,
+ sal_uInt16 nSpecularIntensity);
+ MaterialAttribute3D(const basegfx::BColor& rColor);
+ MaterialAttribute3D();
+ MaterialAttribute3D(const MaterialAttribute3D& rCandidate);
+ ~MaterialAttribute3D();
+
+ // assignment operator
+ MaterialAttribute3D& operator=(const MaterialAttribute3D& rCandidate);
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const MaterialAttribute3D& rCandidate) const;
+
+ // data read access
+ const basegfx::BColor& getColor() const;
+ const basegfx::BColor& getSpecular() const;
+ const basegfx::BColor& getEmission() const;
+ sal_uInt16 getSpecularIntensity() const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_MATERIALATTRIBUTE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/sdrallattribute3d.hxx b/include/drawinglayer/attribute/sdrallattribute3d.hxx
new file mode 100644
index 000000000000..abd46bf273fe
--- /dev/null
+++ b/include/drawinglayer/attribute/sdrallattribute3d.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRALLATTRIBUTE3D_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRALLATTRIBUTE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/attribute/sdrlineattribute.hxx>
+#include <drawinglayer/attribute/sdrfillattribute.hxx>
+#include <drawinglayer/attribute/sdrlinestartendattribute.hxx>
+#include <drawinglayer/attribute/sdrshadowattribute.hxx>
+#include <drawinglayer/attribute/fillgradientattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC SdrLineFillShadowAttribute3D
+ {
+ private:
+ const SdrLineAttribute maLine;
+ const SdrFillAttribute maFill;
+ const SdrLineStartEndAttribute maLineStartEnd;
+ const SdrShadowAttribute maShadow;
+ const FillGradientAttribute maFillFloatTransGradient;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ SdrLineFillShadowAttribute3D(
+ const SdrLineAttribute& rLine,
+ const SdrFillAttribute& rFill,
+ const SdrLineStartEndAttribute& rLineStartEnd,
+ const SdrShadowAttribute& rShadow,
+ const FillGradientAttribute& rFillFloatTransGradient);
+ SdrLineFillShadowAttribute3D();
+
+ // compare operator
+ bool operator==(const SdrLineFillShadowAttribute3D& rCandidate) const;
+
+ // data read access
+ const SdrLineAttribute& getLine() const { return maLine; }
+ const SdrFillAttribute& getFill() const { return maFill; }
+ const SdrLineStartEndAttribute& getLineStartEnd() const { return maLineStartEnd; }
+ const SdrShadowAttribute& getShadow() const { return maShadow; }
+ const FillGradientAttribute& getFillFloatTransGradient() const { return maFillFloatTransGradient; }
+ };
+ } // end of namespace overlay
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRALLATTRIBUTE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/sdrfillattribute.hxx b/include/drawinglayer/attribute/sdrfillattribute.hxx
new file mode 100644
index 000000000000..7fd3d38c224e
--- /dev/null
+++ b/include/drawinglayer/attribute/sdrfillattribute.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLATTRIBUTE_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLATTRIBUTE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx {
+ class BColor;
+}
+
+namespace drawinglayer { namespace attribute {
+ class ImpSdrFillAttribute;
+ class FillGradientAttribute;
+ class FillHatchAttribute;
+ class SdrFillBitmapAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC SdrFillAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpSdrFillAttribute > ImplType;
+
+ private:
+ ImplType mpSdrFillAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ SdrFillAttribute(
+ double fTransparence,
+ const basegfx::BColor& rColor,
+ const FillGradientAttribute& rGradient,
+ const FillHatchAttribute& rHatch,
+ const SdrFillBitmapAttribute& rBitmap);
+ SdrFillAttribute();
+ SdrFillAttribute(const SdrFillAttribute& rCandidate);
+ SdrFillAttribute& operator=(const SdrFillAttribute& rCandidate);
+ ~SdrFillAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const SdrFillAttribute& rCandidate) const;
+
+ // data read access
+ double getTransparence() const;
+ const basegfx::BColor& getColor() const;
+ const FillGradientAttribute& getGradient() const;
+ const FillHatchAttribute& getHatch() const;
+ const SdrFillBitmapAttribute& getBitmap() const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLATTRIBUTE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/sdrfillbitmapattribute.hxx b/include/drawinglayer/attribute/sdrfillbitmapattribute.hxx
new file mode 100644
index 000000000000..78417f3577c9
--- /dev/null
+++ b/include/drawinglayer/attribute/sdrfillbitmapattribute.hxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLBITMAPATTRIBUTE_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLBITMAPATTRIBUTE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+class BitmapEx;
+
+namespace basegfx {
+ class B2DRange;
+ class B2DVector;
+}
+
+namespace drawinglayer { namespace attribute {
+ class FillBitmapAttribute;
+ class ImpSdrFillBitmapAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC SdrFillBitmapAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpSdrFillBitmapAttribute > ImplType;
+
+ private:
+ ImplType mpSdrFillBitmapAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ SdrFillBitmapAttribute(
+ const BitmapEx& rBitmapEx,
+ const basegfx::B2DVector& rSize,
+ const basegfx::B2DVector& rOffset,
+ const basegfx::B2DVector& rOffsetPosition,
+ const basegfx::B2DVector& rRectPoint,
+ bool bTiling,
+ bool bStretch,
+ bool bLogSize);
+ SdrFillBitmapAttribute();
+ SdrFillBitmapAttribute(const SdrFillBitmapAttribute& rCandidate);
+ SdrFillBitmapAttribute& operator=(const SdrFillBitmapAttribute& rCandidate);
+ ~SdrFillBitmapAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const SdrFillBitmapAttribute& rCandidate) const;
+
+ // data read access
+ const BitmapEx& getBitmapEx() const;
+ const basegfx::B2DVector& getSize() const;
+ const basegfx::B2DVector& getOffset() const;
+ const basegfx::B2DVector& getOffsetPosition() const;
+ const basegfx::B2DVector& getRectPoint() const;
+ bool getTiling() const;
+ bool getStretch() const;
+
+ // FillBitmapAttribute generator
+ FillBitmapAttribute getFillBitmapAttribute(const basegfx::B2DRange& rRange) const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLBITMAPATTRIBUTE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/sdrlightattribute3d.hxx b/include/drawinglayer/attribute/sdrlightattribute3d.hxx
new file mode 100644
index 000000000000..f9e35798cd3e
--- /dev/null
+++ b/include/drawinglayer/attribute/sdrlightattribute3d.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTATTRIBUTE3D_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTATTRIBUTE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx {
+ class BColor;
+ class B3DVector;
+}
+
+namespace drawinglayer { namespace attribute {
+ class ImpSdr3DLightAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC Sdr3DLightAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpSdr3DLightAttribute > ImplType;
+
+ private:
+ ImplType mpSdr3DLightAttribute;
+
+ public:
+ // constructors/destructor
+ Sdr3DLightAttribute(
+ const basegfx::BColor& rColor,
+ const basegfx::B3DVector& rDirection,
+ bool bSpecular);
+ explicit Sdr3DLightAttribute(const basegfx::BColor& rColor);
+ Sdr3DLightAttribute(const Sdr3DLightAttribute& rCandidate);
+ ~Sdr3DLightAttribute();
+
+ // assignment operator
+ Sdr3DLightAttribute& operator=(const Sdr3DLightAttribute& rCandidate);
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const Sdr3DLightAttribute& rCandidate) const;
+
+ // data read access
+ const basegfx::BColor& getColor() const;
+ const basegfx::B3DVector& getDirection() const;
+ bool getSpecular() const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTATTRIBUTE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/sdrlightingattribute3d.hxx b/include/drawinglayer/attribute/sdrlightingattribute3d.hxx
new file mode 100644
index 000000000000..0c3bb96b9f70
--- /dev/null
+++ b/include/drawinglayer/attribute/sdrlightingattribute3d.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTINGATTRIBUTE3D_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTINGATTRIBUTE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+#include <vector>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx {
+ class BColor;
+ class B3DVector;
+}
+
+namespace drawinglayer { namespace attribute {
+ class ImpSdrLightingAttribute;
+ class Sdr3DLightAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC SdrLightingAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpSdrLightingAttribute > ImplType;
+
+ private:
+ ImplType mpSdrLightingAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ SdrLightingAttribute(
+ const basegfx::BColor& rAmbientLight,
+ const ::std::vector< Sdr3DLightAttribute >& rLightVector);
+ SdrLightingAttribute();
+ SdrLightingAttribute(const SdrLightingAttribute& rCandidate);
+ SdrLightingAttribute& operator=(const SdrLightingAttribute& rCandidate);
+ ~SdrLightingAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const SdrLightingAttribute& rCandidate) const;
+
+ // data read access
+ const ::std::vector< Sdr3DLightAttribute >& getLightVector() const;
+
+ // color model solver
+ basegfx::BColor solveColorModel(
+ const basegfx::B3DVector& rNormalInEyeCoordinates,
+ const basegfx::BColor& rColor, const basegfx::BColor& rSpecular,
+ const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity) const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTINGATTRIBUTE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/sdrlineattribute.hxx b/include/drawinglayer/attribute/sdrlineattribute.hxx
new file mode 100644
index 000000000000..bedbd9f29bb9
--- /dev/null
+++ b/include/drawinglayer/attribute/sdrlineattribute.hxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINEATTRIBUTE_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINEATTRIBUTE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <basegfx/vector/b2enums.hxx>
+#include <com/sun/star/drawing/LineCap.hpp>
+#include <o3tl/cow_wrapper.hxx>
+#include <vector>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx {
+ class BColor;
+}
+
+namespace drawinglayer { namespace attribute {
+ class ImpSdrLineAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC SdrLineAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpSdrLineAttribute > ImplType;
+
+ private:
+ ImplType mpSdrLineAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ SdrLineAttribute(
+ basegfx::B2DLineJoin eJoin,
+ double fWidth,
+ double fTransparence,
+ const basegfx::BColor& rColor,
+ com::sun::star::drawing::LineCap eCap,
+ const ::std::vector< double >& rDotDashArray,
+ double fFullDotDashLen);
+ SdrLineAttribute();
+ SdrLineAttribute(const SdrLineAttribute& rCandidate);
+ SdrLineAttribute& operator=(const SdrLineAttribute& rCandidate);
+ ~SdrLineAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const SdrLineAttribute& rCandidate) const;
+
+ // data access
+ basegfx::B2DLineJoin getJoin() const;
+ double getWidth() const;
+ double getTransparence() const;
+ const basegfx::BColor& getColor() const;
+ const ::std::vector< double >& getDotDashArray() const;
+ double getFullDotDashLen() const;
+ com::sun::star::drawing::LineCap getCap() const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINEATTRIBUTE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/sdrlinestartendattribute.hxx b/include/drawinglayer/attribute/sdrlinestartendattribute.hxx
new file mode 100644
index 000000000000..19c1a5147db0
--- /dev/null
+++ b/include/drawinglayer/attribute/sdrlinestartendattribute.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINESTARTENDATTRIBUTE_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINESTARTENDATTRIBUTE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx {
+ class B2DPolyPolygon;
+}
+
+namespace drawinglayer { namespace attribute {
+ class ImpSdrLineStartEndAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC SdrLineStartEndAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpSdrLineStartEndAttribute > ImplType;
+
+ private:
+ ImplType mpSdrLineStartEndAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ SdrLineStartEndAttribute(
+ const basegfx::B2DPolyPolygon& rStartPolyPolygon,
+ const basegfx::B2DPolyPolygon& rEndPolyPolygon,
+ double fStartWidth,
+ double fEndWidth,
+ bool bStartActive,
+ bool bEndActive,
+ bool bStartCentered,
+ bool bEndCentered);
+ SdrLineStartEndAttribute();
+ SdrLineStartEndAttribute(const SdrLineStartEndAttribute& rCandidate);
+ SdrLineStartEndAttribute& operator=(const SdrLineStartEndAttribute& rCandidate);
+ ~SdrLineStartEndAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const SdrLineStartEndAttribute& rCandidate) const;
+
+ // data read access
+ const basegfx::B2DPolyPolygon& getStartPolyPolygon() const;
+ const basegfx::B2DPolyPolygon& getEndPolyPolygon() const;
+ double getStartWidth() const;
+ double getEndWidth() const;
+ bool isStartActive() const;
+ bool isEndActive() const;
+ bool isStartCentered() const;
+ bool isEndCentered() const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINESTARTENDATTRIBUTE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/sdrobjectattribute3d.hxx b/include/drawinglayer/attribute/sdrobjectattribute3d.hxx
new file mode 100644
index 000000000000..860093a67666
--- /dev/null
+++ b/include/drawinglayer/attribute/sdrobjectattribute3d.hxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDROBJECTATTRIBUTE3D_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDROBJECTATTRIBUTE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <com/sun/star/drawing/NormalsKind.hpp>
+#include <com/sun/star/drawing/TextureProjectionMode.hpp>
+#include <com/sun/star/drawing/TextureKind2.hpp>
+#include <com/sun/star/drawing/TextureMode.hpp>
+#include <o3tl/cow_wrapper.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace drawinglayer { namespace attribute {
+ class ImpSdr3DObjectAttribute;
+ class MaterialAttribute3D;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC Sdr3DObjectAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpSdr3DObjectAttribute > ImplType;
+
+ private:
+ ImplType mpSdr3DObjectAttribute;
+
+ public:
+ // constructors/destructor
+ Sdr3DObjectAttribute(
+ ::com::sun::star::drawing::NormalsKind aNormalsKind,
+ ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionX,
+ ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionY,
+ ::com::sun::star::drawing::TextureKind2 aTextureKind,
+ ::com::sun::star::drawing::TextureMode aTextureMode,
+ const MaterialAttribute3D& rMaterial,
+ bool bNormalsInvert,
+ bool bDoubleSided,
+ bool bShadow3D,
+ bool bTextureFilter,
+ bool bReducedLineGeometry);
+ Sdr3DObjectAttribute(const Sdr3DObjectAttribute& rCandidate);
+ ~Sdr3DObjectAttribute();
+
+ // assignment operator
+ Sdr3DObjectAttribute& operator=(const Sdr3DObjectAttribute& rCandidate);
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const Sdr3DObjectAttribute& rCandidate) const;
+
+ // data read access
+ ::com::sun::star::drawing::NormalsKind getNormalsKind() const;
+ ::com::sun::star::drawing::TextureProjectionMode getTextureProjectionX() const;
+ ::com::sun::star::drawing::TextureProjectionMode getTextureProjectionY() const;
+ ::com::sun::star::drawing::TextureKind2 getTextureKind() const;
+ ::com::sun::star::drawing::TextureMode getTextureMode() const;
+ const MaterialAttribute3D& getMaterial() const;
+ bool getNormalsInvert() const;
+ bool getDoubleSided() const;
+ bool getShadow3D() const;
+ bool getTextureFilter() const;
+ bool getReducedLineGeometry() const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDROBJECTATTRIBUTE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/sdrsceneattribute3d.hxx b/include/drawinglayer/attribute/sdrsceneattribute3d.hxx
new file mode 100644
index 000000000000..61d4d8a67378
--- /dev/null
+++ b/include/drawinglayer/attribute/sdrsceneattribute3d.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSCENEATTRIBUTE3D_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSCENEATTRIBUTE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <com/sun/star/drawing/ProjectionMode.hpp>
+#include <com/sun/star/drawing/ShadeMode.hpp>
+#include <o3tl/cow_wrapper.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace drawinglayer { namespace attribute {
+ class ImpSdrSceneAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC SdrSceneAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpSdrSceneAttribute > ImplType;
+
+ private:
+ ImplType mpSdrSceneAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ SdrSceneAttribute(
+ double fDistance,
+ double fShadowSlant,
+ ::com::sun::star::drawing::ProjectionMode aProjectionMode,
+ ::com::sun::star::drawing::ShadeMode aShadeMode,
+ bool bTwoSidedLighting);
+ SdrSceneAttribute();
+ SdrSceneAttribute(const SdrSceneAttribute& rCandidate);
+ SdrSceneAttribute& operator=(const SdrSceneAttribute& rCandidate);
+ ~SdrSceneAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const SdrSceneAttribute& rCandidate) const;
+
+ // data read access
+ double getShadowSlant() const;
+ ::com::sun::star::drawing::ProjectionMode getProjectionMode() const;
+ ::com::sun::star::drawing::ShadeMode getShadeMode() const;
+ bool getTwoSidedLighting() const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSCENEATTRIBUTE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/sdrshadowattribute.hxx b/include/drawinglayer/attribute/sdrshadowattribute.hxx
new file mode 100644
index 000000000000..ee1f36292505
--- /dev/null
+++ b/include/drawinglayer/attribute/sdrshadowattribute.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSHADOWATTRIBUTE_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSHADOWATTRIBUTE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx {
+ class BColor;
+ class B2DVector;
+}
+
+namespace drawinglayer { namespace attribute {
+ class ImpSdrShadowAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC SdrShadowAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpSdrShadowAttribute > ImplType;
+
+ private:
+ ImplType mpSdrShadowAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ SdrShadowAttribute(
+ const basegfx::B2DVector& rOffset,
+ double fTransparence,
+ const basegfx::BColor& rColor);
+ SdrShadowAttribute();
+ SdrShadowAttribute(const SdrShadowAttribute& rCandidate);
+ SdrShadowAttribute& operator=(const SdrShadowAttribute& rCandidate);
+ ~SdrShadowAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const SdrShadowAttribute& rCandidate) const;
+
+ // data access
+ const basegfx::B2DVector& getOffset() const;
+ double getTransparence() const;
+ const basegfx::BColor& getColor() const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSHADOWATTRIBUTE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/strokeattribute.hxx b/include/drawinglayer/attribute/strokeattribute.hxx
new file mode 100644
index 000000000000..6d4cea978482
--- /dev/null
+++ b/include/drawinglayer/attribute/strokeattribute.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_STROKEATTRIBUTE_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_STROKEATTRIBUTE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+#include <vector>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace drawinglayer { namespace attribute {
+ class ImpStrokeAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC StrokeAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpStrokeAttribute > ImplType;
+
+ private:
+ ImplType mpStrokeAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ explicit StrokeAttribute(
+ const ::std::vector< double >& rDotDashArray,
+ double fFullDotDashLen = 0.0);
+ StrokeAttribute();
+ StrokeAttribute(const StrokeAttribute& rCandidate);
+ StrokeAttribute& operator=(const StrokeAttribute& rCandidate);
+ ~StrokeAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const StrokeAttribute& rCandidate) const;
+
+ // data read access
+ const ::std::vector< double >& getDotDashArray() const;
+ double getFullDotDashLen() const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_STROKEATTRIBUTE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/drawinglayerdllapi.h b/include/drawinglayer/drawinglayerdllapi.h
new file mode 100644
index 000000000000..0b3983504919
--- /dev/null
+++ b/include/drawinglayer/drawinglayerdllapi.h
@@ -0,0 +1,24 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_DRAWINGLAYERDLLAPI_H
+#define INCLUDED_DRAWINGLAYER_DRAWINGLAYERDLLAPI_H
+
+#include <sal/types.h>
+
+#if defined(DRAWINGLAYER_DLLIMPLEMENTATION)
+#define DRAWINGLAYER_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define DRAWINGLAYER_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define DRAWINGLAYER_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/geometry/viewinformation2d.hxx b/include/drawinglayer/geometry/viewinformation2d.hxx
new file mode 100644
index 000000000000..f8e0d6699448
--- /dev/null
+++ b/include/drawinglayer/geometry/viewinformation2d.hxx
@@ -0,0 +1,181 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_GEOMETRY_VIEWINFORMATION2D_HXX
+#define INCLUDED_DRAWINGLAYER_GEOMETRY_VIEWINFORMATION2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+// the solaris compiler defines 'sun' as '1'. To avoid that (and to allow
+// pre-declarations of com/sun/star namespace), include sal/config.h here
+// where sun is redefined as 'sun' (so i guess the problem is known).
+#include <sal/config.h>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <o3tl/cow_wrapper.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace drawinglayer { namespace geometry {
+ class ImpViewInformation2D;
+}}
+
+namespace basegfx {
+ class B2DHomMatrix;
+ class B2DRange;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace geometry
+ {
+ /** ViewInformation2D class
+
+ This class holds all view-relevant information for a 2d geometry. It works
+ together with UNO API definitions and supports holding a sequence of PropertyValues.
+ The most used data is for convenience offered directly using basegfx tooling classes.
+ It is an implementation to support the sequence of PropertyValues used in a
+ ::com::sun::star::graphic::XPrimitive2D for C++ implementations working with those
+ */
+ class DRAWINGLAYER_DLLPUBLIC ViewInformation2D
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpViewInformation2D, o3tl::ThreadSafeRefCountingPolicy > ImplType;
+
+ private:
+ /// pointer to private implementation class
+ ImplType mpViewInformation2D;
+
+ public:
+ /** Constructor: Create a ViewInformation2D
+
+ @param rObjectTransformation
+ The Transformation from Object to World coordinates (normally logic coordinates).
+
+ @param rViewTransformation
+ The Transformation from World to View coordinates (normally logic coordinates
+ to discrete units, e.g. pixels).
+
+ @param rViewport
+ The visible part of the view in World coordinates. If empty (getViewport().isEmpty())
+ everything is visible. The data is in World coordinates.
+
+ @param rxDrawPage
+ The currently displaqyed page. This information is needed e.g. due to existing PageNumber
+ fields which need to be interpreted.
+
+ @param fViewTime
+ The time the view is defined for. Default is 0.0. This parameter is used e.g. for
+ animated objects
+
+ @param rExtendedParameters
+ A sequence of property values which allows holding various other parameters besides
+ the obvious and needed ones above. For this constructor none of the other parameters
+ should be added as data. The constructor will parse the given parameters and if
+ data for the other parameters is given, the value in rExtendedParameters will
+ be preferred and overwrite the given parameter
+ */
+ ViewInformation2D(
+ const basegfx::B2DHomMatrix& rObjectTransformation,
+ const basegfx::B2DHomMatrix& rViewTransformation,
+ const basegfx::B2DRange& rViewport,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& rxDrawPage,
+ double fViewTime,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rExtendedParameters);
+
+ /** Constructor: Create a ViewInformation2D
+
+ @param rViewParameters
+ A sequence of property values which allows holding any combination of local and various
+ other parameters. This constructor is feeded completely with a sequence of PropertyValues
+ which will be parsed to be able to offer the most used ones in a convenient way.
+ */
+ explicit ViewInformation2D(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rViewParameters);
+
+ /// default (empty) constructor
+ ViewInformation2D();
+
+ /// copy constructor
+ ViewInformation2D(const ViewInformation2D& rCandidate);
+
+ /// destructor
+ ~ViewInformation2D();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ /// assignment operator
+ ViewInformation2D& operator=(const ViewInformation2D& rCandidate);
+
+ /// compare operators
+ bool operator==(const ViewInformation2D& rCandidate) const;
+ bool operator!=(const ViewInformation2D& rCandidate) const { return !operator==(rCandidate); }
+
+ /// data access
+ const basegfx::B2DHomMatrix& getObjectTransformation() const;
+ const basegfx::B2DHomMatrix& getViewTransformation() const;
+ const basegfx::B2DRange& getViewport() const;
+ double getViewTime() const;
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& getVisualizedPage() const;
+
+ /// On-demand prepared Object to View transformation and it's inerse for convenience
+ const basegfx::B2DHomMatrix& getObjectToViewTransformation() const;
+ const basegfx::B2DHomMatrix& getInverseObjectToViewTransformation() const;
+
+ /// On-demand prepared Viewport in discrete units for convenience
+ const basegfx::B2DRange& getDiscreteViewport() const;
+
+ /** support reduced DisplayQuality, PropertyName is 'ReducedDisplayQuality'. This
+ is used e.g. to allow to lower display quality for OverlayPrimitives and
+ may lead to simpler decompositions in the local create2DDecomposition
+ implementations of the primitives
+ */
+ bool getReducedDisplayQuality() const;
+
+ /** Get the uno::Sequence< beans::PropertyValue > which contains all ViewInformation
+
+ Use this call if You need to extract all contained ViewInformation. The ones
+ directly supported for convenience will be added to the ones only available
+ as PropertyValues. This set completely describes this ViewInformation2D and
+ can be used for complete information transport over UNO API.
+ */
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& getViewInformationSequence() const;
+
+ /** Get the uno::Sequence< beans::PropertyValue > which contains only ViewInformation
+ not offered directly
+
+ Use this call if You only need ViewInformation which is not offered conveniently,
+ but only exists as PropertyValue. This is e.g. used to create partially updated
+ incarnations of ViewInformation2D without losing the only with PropertyValues
+ defined data. It does not contain a complete description.
+ */
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& getExtendedInformationSequence() const;
+ };
+ } // end of namespace geometry
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_GEOMETRY_VIEWINFORMATION2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/geometry/viewinformation3d.hxx b/include/drawinglayer/geometry/viewinformation3d.hxx
new file mode 100644
index 000000000000..86c9a2c16296
--- /dev/null
+++ b/include/drawinglayer/geometry/viewinformation3d.hxx
@@ -0,0 +1,175 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_GEOMETRY_VIEWINFORMATION3D_HXX
+#define INCLUDED_DRAWINGLAYER_GEOMETRY_VIEWINFORMATION3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+// the solaris compiler defines 'sun' as '1'. To avoid that (and to allow
+// pre-declarations of com/sun/star namespace), include sal/config.h here
+// where sun is redefined as 'sun' (so i guess the problem is known).
+#include <sal/config.h>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <o3tl/cow_wrapper.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace drawinglayer { namespace geometry {
+ class ImpViewInformation3D;
+}}
+
+namespace basegfx {
+ class B3DHomMatrix;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace geometry
+ {
+ /** ViewInformation3D class
+
+ This class holds all view-relevant information for a 3d geometry. It works
+ together with UNO API definitions and supports holding a sequence of PropertyValues.
+ The most used data is for convenience offered directly using basegfx tooling classes.
+ It is an implementation to support the sequence of PropertyValues used in a
+ ::com::sun::star::graphic::XPrimitive3D for C++ implementations working with those
+ */
+ class DRAWINGLAYER_DLLPUBLIC ViewInformation3D
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpViewInformation3D, o3tl::ThreadSafeRefCountingPolicy > ImplType;
+
+ private:
+ /// pointer to private implementation class
+ ImplType mpViewInformation3D;
+
+ public:
+ /** Constructor: Create a ViewInformation3D
+
+ @param rObjectTransformation
+ The Transformation from Object to World coordinates (normally logic coordinates).
+
+ @param rOrientation
+ A part of the 3D ViewTransformation, the World to Camera coordinates transformation
+ which holds the camera coordinate system.
+
+ @param rProjection
+ A part of the 3D ViewTransformation, the Camera to Device transformation which
+ transforms coordinates to a [0.0 .. 1.0] device range in X,Y and Z. Z may be used
+ as source for for Z-Buffers. This transformation may be e.g. a parallell projection,
+ but also a perspective one and thus may use the last line of the matrix.
+
+ @param rDeviceToView
+ A part of the 3D ViewTransformation, the Device to View transformation which normally
+ translates and scales from [0.0 .. 1.0] range in X,Y and Z to discrete position and
+ size.
+
+ rOrientation, rProjection and rDeviceToView define the 3D transformation pipeline
+ and are normally used multiplied together to have a direct transformation from
+ World to View coordinates
+
+ @param fViewTime
+ The time the view is defined for. Default is 0.0. This parameter is used e.g. for
+ animated objects
+
+ @param rExtendedParameters
+ A sequence of property values which allows holding various other parameters besides
+ the obvious and needed ones above. For this constructor none of the other parameters
+ should be added as data. The constructor will parse the given parameters and if
+ data for the other parameters is given, the value in rExtendedParameters will
+ be preferred and overwrite the given parameter
+ */
+ ViewInformation3D(
+ const basegfx::B3DHomMatrix& rObjectTransformation,
+ const basegfx::B3DHomMatrix& rOrientation,
+ const basegfx::B3DHomMatrix& rProjection,
+ const basegfx::B3DHomMatrix& rDeviceToView,
+ double fViewTime,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rExtendedParameters);
+
+ /** Constructor: Create a ViewInformation3D
+
+ @param rViewParameters
+ A sequence of property values which allows holding any combination of local and various
+ other parameters. This constructor is feeded completely with a sequence of PropertyValues
+ which will be parsed to be able to offer the most used ones in a convenient way.
+ */
+ explicit ViewInformation3D(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rViewParameters);
+
+ /// default (empty) constructor
+ ViewInformation3D();
+
+ /// copy constructor
+ ViewInformation3D(const ViewInformation3D& rCandidate);
+
+ /// destructor
+ ~ViewInformation3D();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ /// assignment operator
+ ViewInformation3D& operator=(const ViewInformation3D& rCandidate);
+
+ /// compare operators
+ bool operator==(const ViewInformation3D& rCandidate) const;
+ bool operator!=(const ViewInformation3D& rCandidate) const { return !operator==(rCandidate); }
+
+ /// data access
+ const basegfx::B3DHomMatrix& getObjectTransformation() const;
+ const basegfx::B3DHomMatrix& getOrientation() const;
+ const basegfx::B3DHomMatrix& getProjection() const;
+ const basegfx::B3DHomMatrix& getDeviceToView() const;
+ double getViewTime() const;
+
+ /// for convenience, the linear combination of the above four transformations is offered
+ const basegfx::B3DHomMatrix& getObjectToView() const;
+
+ /** Get the uno::Sequence< beans::PropertyValue > which contains all ViewInformation
+
+ Use this call if You need to extract all contained ViewInformation. The ones
+ directly supported for convenience will be added to the ones only available
+ as PropertyValues. This set completely describes this ViewInformation3D and
+ can be used for complete information transport over UNO API.
+ */
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& getViewInformationSequence() const;
+
+ /** Get the uno::Sequence< beans::PropertyValue > which contains only ViewInformation
+ not offered directly
+
+ Use this call if You only need ViewInformation which is not offered conveniently,
+ but only exists as PropertyValue. This is e.g. used to create partially updated
+ incarnations of ViewInformation3D without losing the only with PropertyValues
+ defined data. It does not contain a complete description.
+ */
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& getExtendedInformationSequence() const;
+ };
+ } // end of namespace geometry
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_GEOMETRY_VIEWINFORMATION3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/animatedprimitive2d.hxx b/include/drawinglayer/primitive2d/animatedprimitive2d.hxx
new file mode 100644
index 000000000000..59ee3225dc78
--- /dev/null
+++ b/include/drawinglayer/primitive2d/animatedprimitive2d.hxx
@@ -0,0 +1,171 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_ANIMATEDPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_ANIMATEDPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+namespace drawinglayer { namespace animation {
+ class AnimationEntry;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** AnimatedSwitchPrimitive2D class
+
+ This is the basic class for simple, animated primitives. The basic idea
+ is to have an animation definition (AnimationEntry) who's basic
+ functionality is to return a state value for any given animation time in
+ the range of [0.0 .. 1.0]. Depending on the state, the decomposition
+ calculates an index, which of the members of the child vector is to
+ be visualized.
+
+ An example: For blinking, the Child vector should exist of two entries;
+ for values of [0.0 .. 0.5] the first, else the last entry will be used.
+ This mechanism is not limited to two entries, though.
+ */
+ class DRAWINGLAYER_DLLPUBLIC AnimatedSwitchPrimitive2D : public GroupPrimitive2D
+ {
+ private:
+ /**
+ The animation definition which allows translation of a point in time
+ to an animation state [0.0 .. 1.0]. This member contains a cloned
+ definition and is owned by this implementation.
+ */
+ animation::AnimationEntry* mpAnimationEntry;
+
+ /// bitfield
+ /** flag if this is a text or graphic animation. Necessary since SdrViews need to differentiate
+ between both types if they are on/off
+ */
+ unsigned mbIsTextAnimation : 1;
+
+ public:
+ /// constructor
+ AnimatedSwitchPrimitive2D(
+ const animation::AnimationEntry& rAnimationEntry,
+ const Primitive2DSequence& rChildren,
+ bool bIsTextAnimation);
+
+ /// destructor - needed due to mpAnimationEntry
+ virtual ~AnimatedSwitchPrimitive2D();
+
+ /// data read access
+ const animation::AnimationEntry& getAnimationEntry() const { return *mpAnimationEntry; }
+ bool isTextAnimation() const { return mbIsTextAnimation; }
+ bool isGraphicAnimation() const { return !isTextAnimation(); }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+
+ /** The getDecomposition is overloaded here since the decompose is dependent of the point in time,
+ so the default implementation is nut useful here, it needs to be handled locally
+ */
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** AnimatedBlinkPrimitive2D class
+
+ Basically the same mechanism as in AnimatedSwitchPrimitive2D, but the
+ decomposition is specialized in delivering the children in the
+ range [0.0.. 0.5] and an empty sequence else
+ */
+ class DRAWINGLAYER_DLLPUBLIC AnimatedBlinkPrimitive2D : public AnimatedSwitchPrimitive2D
+ {
+ protected:
+ public:
+ /// constructor
+ AnimatedBlinkPrimitive2D(
+ const animation::AnimationEntry& rAnimationEntry,
+ const Primitive2DSequence& rChildren,
+ bool bIsTextAnimation);
+
+ /// create local decomposition
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** AnimatedInterpolatePrimitive2D class
+
+ Specialized on multi-step animations based on matrix transformations. The
+ Child sequelce will be embedded in a matrix transformation. That transformation
+ will be linearly combined from the decomposed values and the animation value
+ to allow a smooth animation.
+ */
+ class DRAWINGLAYER_DLLPUBLIC AnimatedInterpolatePrimitive2D : public AnimatedSwitchPrimitive2D
+ {
+ private:
+ /// the transformations
+ std::vector< basegfx::tools::B2DHomMatrixBufferedDecompose > maMatrixStack;
+
+ protected:
+ public:
+ /// constructor
+ AnimatedInterpolatePrimitive2D(
+ const std::vector< basegfx::B2DHomMatrix >& rmMatrixStack,
+ const animation::AnimationEntry& rAnimationEntry,
+ const Primitive2DSequence& rChildren,
+ bool bIsTextAnimation);
+
+ /// create local decomposition
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_ANIMATEDPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx b/include/drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx
new file mode 100644
index 000000000000..3986aba3566b
--- /dev/null
+++ b/include/drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BACKGROUNDCOLORPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BACKGROUNDCOLORPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// BackgroundColorPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** BackgroundColorPrimitive2D class
+
+ This primitive is defined to fill the whole visible Viewport with
+ the given color (and thus decomposes to a filled polygon). This
+ makes it a view-depnendent primitive by definition. It only has
+ a valid decomposition if a valid Viewport is given in the
+ ViewInformation2D at decomposition time.
+
+ It will try to buffer it's last decomposition using maLastViewport
+ to detect changes in the get2DDecomposition call.
+ */
+ class DRAWINGLAYER_DLLPUBLIC BackgroundColorPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the fill color to use
+ basegfx::BColor maBColor;
+
+ /// the last used viewInformation, used from getDecomposition for buffering
+ basegfx::B2DRange maLastViewport;
+
+ protected:
+ /// create local decomposition
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ explicit BackgroundColorPrimitive2D(
+ const basegfx::BColor& rBColor);
+
+ /// data read access
+ const basegfx::BColor& getBColor() const { return maBColor; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get B2Drange
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+
+ /// Overload standard getDecomposition call to be view-dependent here
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BACKGROUNDCOLORPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/baseprimitive2d.hxx b/include/drawinglayer/primitive2d/baseprimitive2d.hxx
new file mode 100644
index 000000000000..157c13bb33a8
--- /dev/null
+++ b/include/drawinglayer/primitive2d/baseprimitive2d.hxx
@@ -0,0 +1,296 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BASEPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BASEPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <cppuhelper/compbase1.hxx>
+#include <boost/utility.hpp>
+#include <com/sun/star/graphic/XPrimitive2D.hpp>
+#include <comphelper/broadcasthelper.hxx>
+#include <basegfx/range/b2drange.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+/** defines for DeclPrimitrive2DIDBlock and ImplPrimitrive2DIDBlock
+ Added to be able to simply change identification stuff later, e.g. add
+ a identification string and/or ID to the interface and to the implementation
+ ATM used to delclare implement getPrimitive2DID()
+*/
+
+#define DeclPrimitrive2DIDBlock() \
+ virtual sal_uInt32 getPrimitive2DID() const;
+
+#define ImplPrimitrive2DIDBlock(TheClass, TheID) \
+ sal_uInt32 TheClass::getPrimitive2DID() const { return TheID; }
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace drawinglayer { namespace geometry {
+ class ViewInformation2D;
+}}
+
+namespace drawinglayer { namespace primitive2d {
+ /// typedefs for basePrimitive2DImplBase, Primitive2DSequence and Primitive2DReference
+ typedef cppu::WeakComponentImplHelper1< ::com::sun::star::graphic::XPrimitive2D > BasePrimitive2DImplBase;
+ typedef ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XPrimitive2D > Primitive2DReference;
+ typedef ::com::sun::star::uno::Sequence< Primitive2DReference > Primitive2DSequence;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+// basePrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** BasePrimitive2D class
+
+ Baseclass for all C++ implementations of com::sun::star::graphic::XPrimitive2D
+
+ This class is strongly virtual due to the lack of getPrimitiveID() implementation.
+ This is by purpose, this base class shall not be incarnated and be used directly as
+ a XPrimitive2D.
+
+ Is is derived from boost::noncopyable to make clear that a primitive is a read-only
+ instance and copying or changing values is not intended. The idea is to hold all data
+ needed for visualisation of this primitive in unchangeable form.
+
+ It is derived from comphelper::OBaseMutex to have a Mutex at hand; in a base
+ implementation this may not be needed, but e.g. when buffering at last decomposition
+ in a local member, multiple threads may try to decompose at the same time, so locking
+ is needed to avoid race conditions seen from the UNO object implementation.
+
+ A method to get a simplified representation is provided by get2DDecomposition. The
+ default implementation returns an empty sequence. The idea is that processors
+ using this primitive and do not know it, may get the decomposition and process
+ these instead. An example is e.g. a fat line, who's decomposition may contain
+ the geometric representation of that line using filled polygon prmimitives. When
+ the renderer knows how to handle fat lines, he may proccess this primitive directly;
+ if not he can use the decomposition. With this functionality, renderers may operate by
+ knowing only a small set of primitives.
+
+ When a primitive does not implement get2DDecomposition, it is called a 'Basic Primitive' and
+ belongs to the set of primitives which a processor should be able to handle. Practice
+ will define this minimal sets of primitives. When defined and the concept is prooved,
+ unique UNO APIs may be defined/implemented for these set to allow more intense work
+ with primitives using UNO.
+
+ Current Basic 2D Primitives are:
+
+ - BitmapPrimitive2D (bitmap data, evtl. with transparence)
+ - PointArrayPrimitive2D (single points)
+ - PolygonHairlinePrimitive2D (hairline curves/polygons)
+ - PolyPolygonColorPrimitive2D (colored polygons)
+
+ UPDATE: MetafilePrimitive2D (VCL Metafile) is taken off this list since
+ it is implemented with the integration of CWS aw078 into DV300m69.
+
+ All other implemented primitives have a defined decomposition and can thus be
+ decomposed down to this small set.
+
+ A renderer implementing support for this minimal set of primitives can completely
+ render primitive-based visualisations. Of course, he also has to take states into account
+ which are representated by GroupPrimitive2D derivations, see groupprimitive2d.hxx
+
+ To support getting the geometric BoundRect, getB2DRange is used. The default
+ implementation will use the get2DDecomposition result and merge a range from the
+ entries. Thus, an implementation is only necessary for the Basic Primitives, but
+ of course speedups are possible (and are used) by implementing the method at higher-level
+ primitives.
+
+ For primitive identification, getPrimitiveID is used currently in this implementations
+ to allow a fast switch/case processing. This needs a unique identifier mechanism which
+ currently uses defines (see drawinglayer_primitivetypes2d.hxx). For UNO prmitive API
+ it will be needed to add a unique descriptor (Name?) later to the API.
+
+ This base implementation provides mappings from the methods from XPrimitive2D
+ (getDecomposition/getRange) to the appropriate methods in the C++ implementations
+ (get2DDecomposition/getB2DRange). The PropertyValue ViewParameters is converted to
+ the appropriate C++ implementation class ViewInformation2D.
+
+ This base class does not implement any buffering; e.g. buffering the decompositon
+ and/or the range. These may be buffered anytime since the definition is that the primitive
+ is read-only and thus unchangeable. This implies that the decomposition and/or getting
+ the range will lead to the same result as last time, under the precondition that
+ the parameter ViewInformation2D is the same as the last one. This is usually the case
+ for view-independent primitives which are defined by not using ViewInformation2D
+ in their get2DDecomposition/getB2DRange implementations.
+ */
+ class DRAWINGLAYER_DLLPUBLIC BasePrimitive2D
+ : private boost::noncopyable,
+ protected comphelper::OBaseMutex,
+ public BasePrimitive2DImplBase
+ {
+ private:
+ protected:
+ public:
+ // constructor/destructor
+ BasePrimitive2D();
+ virtual ~BasePrimitive2D();
+
+ /** the ==operator is mainly needed to allow testing newly-created primitives against their last
+ incarnation which buffers/holds the made decompositions. The default implementation
+ uses getPrimitive2DID()-calls to test if it's the same ID at last. Overloaded implementation are then
+ based on this implementation
+ */
+ virtual bool operator==( const BasePrimitive2D& rPrimitive ) const;
+ bool operator!=( const BasePrimitive2D& rPrimitive ) const { return !operator==(rPrimitive); }
+
+ /// The default implementation will use getDecomposition results to create the range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /** provide unique ID for fast identifying of known primitive implementations in renderers. These use
+ the defines from drawinglayer_primitivetypes2d.hxx to define unique IDs.
+ This method is normally defined using DeclPrimitrive2DIDBlock()
+ */
+ virtual sal_uInt32 getPrimitive2DID() const = 0;
+
+ /// The default implementation will return an empty sequence
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ //
+ // Methods from XPrimitive2D
+ //
+
+ /** The getDecomposition implementation for UNO API will use getDecomposition from this implementation. It
+ will construct a ViewInformation2D from the ViewParameters for that purpose
+ */
+ virtual Primitive2DSequence SAL_CALL getDecomposition( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rViewParameters ) throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** The getRange implementation for UNO API will use getRange from this implementation. It
+ will construct a ViewInformation2D from the ViewParameters for that purpose
+ */
+ virtual ::com::sun::star::geometry::RealRectangle2D SAL_CALL getRange( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rViewParameters ) throw ( ::com::sun::star::uno::RuntimeException );
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// BufferedDecompositionPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** BufferedDecompositionPrimitive2D class
+
+ Baseclass for all C++ implementations of com::sun::star::graphic::XPrimitive2D
+ which want to buffer the decomoposition result
+
+ Buffering the decomposition is the most-used buffering and is thus used my most
+ primitive implementations which support a decomposition as base class.
+
+ The buffering is done by holding the last decomposition in the local parameter
+ maBuffered2DDecomposition. The default implementation of get2DDecomposition checks
+ if maBuffered2DDecomposition is empty. If yes, it uses create2DDecomposition
+ to create the content. In all cases, maBuffered2DDecomposition is returned.
+
+ For view-dependent primitives derived from Primitive2DBufferDecomposition more needs
+ to be done when the decomposition depends on parts of the parameter ViewInformation2D.
+ This defines a standard method for processing these:
+
+ Implement a view-dependent get2DDecomposition doing te following steps:
+ (a) Locally extract needed parameters from ViewInformation2D to new, local parameters
+ (this may be a complete local copy of ViewInformation2D)
+ (b) If a buffered decomposition exists, ckeck if one of the new local parameters
+ differs from the corresponding locally remembered (as member) ones. If yes,
+ clear maBuffered2DDecomposition
+ (d) call baseclass::get2DDecomposition which will use create2DDecomposition
+ to fill maBuffered2DDecomposition if it's empty
+ (e) copy the new local parameters to the corresponding locally remembered ones
+ to identify if a new decomposition is needed at the next call
+ (f) return maBuffered2DDecomposition
+ */
+ class DRAWINGLAYER_DLLPUBLIC BufferedDecompositionPrimitive2D
+ : public BasePrimitive2D
+ {
+ private:
+ /// a sequence used for buffering the last create2DDecomposition() result
+ Primitive2DSequence maBuffered2DDecomposition;
+
+ protected:
+ /** access methods to maBuffered2DDecomposition. The usage of this methods may allow
+ later thread-safe stuff to be added if needed. Only to be used by getDecomposition()
+ implementations for buffering the last decomposition.
+ */
+ const Primitive2DSequence& getBuffered2DDecomposition() const { return maBuffered2DDecomposition; }
+ void setBuffered2DDecomposition(const Primitive2DSequence& rNew) { maBuffered2DDecomposition = rNew; }
+
+ /** method which is to be used to implement the local decomposition of a 2D primitive. The default
+ implementation will just return an empty decomposition
+ */
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ // constructor/destructor
+ BufferedDecompositionPrimitive2D();
+
+ /** The getDecomposition default implementation will on demand use create2DDecomposition() if
+ maBuffered2DDecomposition is empty. It will set maBuffered2DDecomposition to this obtained decomposition
+ to buffer it. If the decomposition is also ViewInformation2D-dependent, this method needs to be
+ overloaded and the ViewInformation2D for the last decomposition need to be remembered, too, and
+ be used in the next call to decide if the buffered decomposition may be reused or not.
+ */
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// tooling
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /// support to handle a sequence of primitives as stl vector and convert it during creation
+ typedef ::std::vector< BasePrimitive2D* > Primitive2DVector;
+ Primitive2DSequence DRAWINGLAYER_DLLPUBLIC Primitive2DVectorToPrimitive2DSequence(const Primitive2DVector& rSource, bool bInvert = false);
+
+ /// get B2DRange from a given Primitive2DReference
+ basegfx::B2DRange DRAWINGLAYER_DLLPUBLIC getB2DRangeFromPrimitive2DReference(const Primitive2DReference& rCandidate, const geometry::ViewInformation2D& aViewInformation);
+
+ /// get B2DRange from a given Primitive2DSequence
+ basegfx::B2DRange DRAWINGLAYER_DLLPUBLIC getB2DRangeFromPrimitive2DSequence(const Primitive2DSequence& rCandidate, const geometry::ViewInformation2D& aViewInformation);
+
+ /** compare two Primitive2DReferences for equality, including trying to get implementations (BasePrimitive2D)
+ and using compare operator
+ */
+ bool DRAWINGLAYER_DLLPUBLIC arePrimitive2DReferencesEqual(const Primitive2DReference& rA, const Primitive2DReference& rB);
+
+ /// compare two Primitive2DReferences for equality, uses arePrimitive2DReferencesEqual internally
+ bool DRAWINGLAYER_DLLPUBLIC arePrimitive2DSequencesEqual(const Primitive2DSequence& rA, const Primitive2DSequence& rB);
+
+ /// concatenate sequence
+ void DRAWINGLAYER_DLLPUBLIC appendPrimitive2DSequenceToPrimitive2DSequence(Primitive2DSequence& rDest, const Primitive2DSequence& rSource);
+
+ /// concatenate single Primitive2D
+ void DRAWINGLAYER_DLLPUBLIC appendPrimitive2DReferenceToPrimitive2DSequence(Primitive2DSequence& rDest, const Primitive2DReference& rSource);
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BASEPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/bitmapprimitive2d.hxx b/include/drawinglayer/primitive2d/bitmapprimitive2d.hxx
new file mode 100644
index 000000000000..fa262bd9fe95
--- /dev/null
+++ b/include/drawinglayer/primitive2d/bitmapprimitive2d.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BITMAPPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BITMAPPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <vcl/bitmapex.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// BitmapPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** BitmapPrimitive2D class
+
+ This class is the central primitive for Bitmap-based primitives.
+ It provides RGBA-based bitmaps, currently using a BitmapEx from VCL.
+ This may change in the future to any other, maybe more general base
+ class providing 24bit RGBA.
+ */
+ class DRAWINGLAYER_DLLPUBLIC BitmapPrimitive2D : public BasePrimitive2D
+ {
+ private:
+ /// the RGBA Bitmap-data
+ BitmapEx maBitmapEx;
+
+ /** the object transformation from unit coordinates, defining
+ size, shear, rotate and position
+ */
+ basegfx::B2DHomMatrix maTransform;
+
+ public:
+ /// constructor
+ BitmapPrimitive2D(
+ const BitmapEx& rBitmapEx,
+ const basegfx::B2DHomMatrix& rTransform);
+
+ /// data read access
+ const BitmapEx& getBitmapEx() const { return maBitmapEx; }
+ const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BITMAPPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx b/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx
new file mode 100644
index 000000000000..d9ed473851f4
--- /dev/null
+++ b/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx
@@ -0,0 +1,144 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BORDERLINEPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BORDERLINEPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <svtools/ctrlbox.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** BorderLinePrimitive2D class
+
+ This is the basic primitive to build frames around objects, e.g. tables.
+ It defines a single or double line from Start to nd using the LeftWidth,
+ Distance and RightWidth definitions.
+ The LineStart/End overlap is defined by the Extend(Inner|Outer)(Start|End)
+ definitions.
+ */
+ class DRAWINGLAYER_DLLPUBLIC BorderLinePrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the line definition
+ basegfx::B2DPoint maStart;
+ basegfx::B2DPoint maEnd;
+
+ /// the widths of single/double line
+ double mfLeftWidth;
+ double mfDistance;
+ double mfRightWidth;
+
+ /// edge overlap sizes
+ double mfExtendLeftStart;
+ double mfExtendLeftEnd;
+ double mfExtendRightStart;
+ double mfExtendRightEnd;
+
+ /// the line colors
+ basegfx::BColor maRGBColorRight;
+ basegfx::BColor maRGBColorLeft;
+ basegfx::BColor maRGBColorGap;
+ bool mbHasGapColor;
+
+ short mnStyle;
+
+ /// local helpers
+ double getWidth(
+ const geometry::ViewInformation2D& rViewInformation) const;
+
+ bool isSolidLine() const
+ {
+ return (mnStyle==STYLE_SOLID);
+ }
+
+ bool isInsideUsed() const
+ {
+ return !basegfx::fTools::equalZero(mfLeftWidth);
+ }
+
+ bool isOutsideUsed() const
+ {
+ return !basegfx::fTools::equalZero(mfRightWidth);
+ }
+
+ protected:
+ virtual basegfx::B2DPolyPolygon getClipPolygon(
+ const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// create local decomposition
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ BorderLinePrimitive2D(
+ const basegfx::B2DPoint& rStart,
+ const basegfx::B2DPoint& rEnd,
+ double fLeftWidth,
+ double fDistance,
+ double fRightWidth,
+ double fExtendLeftStart,
+ double fExtendLeftEnd,
+ double fExtendRightStart,
+ double fExtendRightEnd,
+ const basegfx::BColor& rRGBColorRight,
+ const basegfx::BColor& rRGBColorLeft,
+ const basegfx::BColor& rRGBColorGap,
+ bool bHasGapColor,
+ const short nStyle );
+
+ /// data read access
+ const basegfx::B2DPoint& getStart() const { return maStart; }
+ const basegfx::B2DPoint& getEnd() const { return maEnd; }
+ double getLeftWidth() const { return mfLeftWidth; }
+ double getDistance() const { return mfDistance; }
+ double getRightWidth() const { return mfRightWidth; }
+ double getExtendLeftStart() const { return mfExtendLeftStart; }
+ double getExtendLeftEnd() const { return mfExtendLeftEnd; }
+ double getExtendRightStart() const { return mfExtendRightStart; }
+ double getExtendRightEnd() const { return mfExtendRightEnd; }
+ const basegfx::BColor& getRGBColorRight () const { return maRGBColorRight; }
+ const basegfx::BColor& getRGBColorLeft () const { return maRGBColorLeft; }
+ const basegfx::BColor& getRGBColorGap () const { return maRGBColorGap; }
+ bool hasGapColor( ) const { return mbHasGapColor; }
+ short getStyle () const { return mnStyle; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BORDERLINEPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/clippedborderlineprimitive2d.hxx b/include/drawinglayer/primitive2d/clippedborderlineprimitive2d.hxx
new file mode 100644
index 000000000000..6db292fd6859
--- /dev/null
+++ b/include/drawinglayer/primitive2d/clippedborderlineprimitive2d.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CLIPPEDBORDERLINEPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CLIPPEDBORDERLINEPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/borderlineprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** BorderLinePrimitive2D clipped by the intersection with a provided
+ polygon.
+ */
+ class DRAWINGLAYER_DLLPUBLIC ClippedBorderLinePrimitive2D : public BorderLinePrimitive2D
+ {
+ private:
+ const basegfx::B2DPolygon maIntersection;
+
+ protected:
+ virtual basegfx::B2DPolyPolygon getClipPolygon(
+ const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ ClippedBorderLinePrimitive2D(
+ const basegfx::B2DPoint& rStart,
+ const basegfx::B2DPoint& rEnd,
+ double fLeftWidth,
+ double fDistance,
+ double fRightWidth,
+ const basegfx::B2DPolygon& rIntersection,
+ const basegfx::BColor& rRGBColorRight,
+ const basegfx::BColor& rRGBColorLeft,
+ const basegfx::BColor& rRGBColorGap,
+ bool bHasGapColor,
+ const short nStyle );
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CLIPPEDBORDERLINEPRIMITIVE2D_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/controlprimitive2d.hxx b/include/drawinglayer/primitive2d/controlprimitive2d.hxx
new file mode 100644
index 000000000000..789b7aa38471
--- /dev/null
+++ b/include/drawinglayer/primitive2d/controlprimitive2d.hxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CONTROLPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CONTROLPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <com/sun/star/awt/XControlModel.hpp>
+#include <com/sun/star/awt/XControl.hpp>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** ControlPrimitive2D class
+
+ Base class for ControlPrimitive handling. It decoposes to a
+ graphical representation (Bitmap data) of the control. This
+ representation is limited to a quadratic pixel maximum defined
+ in the applicatin settings.
+ */
+ class DRAWINGLAYER_DLLPUBLIC ControlPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// object's base data
+ basegfx::B2DHomMatrix maTransform;
+ com::sun::star::uno::Reference< com::sun::star::awt::XControlModel > mxControlModel;
+
+ /// the created an cached awt::XControl
+ com::sun::star::uno::Reference< com::sun::star::awt::XControl > mxXControl;
+
+ /// the last used scaling, used from getDecomposition for buffering
+ basegfx::B2DVector maLastViewScaling;
+
+ /** used from getXControl() to create a local awt::XControl which is remembered in mxXControl
+ and from thereon always used and returned by getXControl()
+ */
+ void createXControl();
+
+ /// single local decompositions, used from create2DDecomposition()
+ Primitive2DReference createBitmapDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+ Primitive2DReference createPlaceholderDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ protected:
+ /// local decomposition
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ ControlPrimitive2D(
+ const basegfx::B2DHomMatrix& rTransform,
+ const com::sun::star::uno::Reference< com::sun::star::awt::XControlModel >& rxControlModel);
+
+ /** constructor with an additional XControl as parameter to allow to hand it over at incarnation time
+ if it exists. This will avoid to create a 2nd one on demand in createXControl()
+ and thus double the XControls.
+ */
+ ControlPrimitive2D(
+ const basegfx::B2DHomMatrix& rTransform,
+ const com::sun::star::uno::Reference< com::sun::star::awt::XControlModel >& rxControlModel,
+ const com::sun::star::uno::Reference< com::sun::star::awt::XControl >& rxXControl);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
+ const com::sun::star::uno::Reference< com::sun::star::awt::XControlModel >& getControlModel() const { return mxControlModel; }
+
+ /** mxControl access. This will on demand create the awt::XControl using createXControl()
+ if it does not exist. It may already have been created or even handed over at
+ incarnation
+ */
+ const com::sun::star::uno::Reference< com::sun::star::awt::XControl >& getXControl() const;
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+
+ /// Overload standard getDecomposition call to be view-dependent here
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CONTROLPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/cropprimitive2d.hxx b/include/drawinglayer/primitive2d/cropprimitive2d.hxx
new file mode 100644
index 000000000000..25d044b3231f
--- /dev/null
+++ b/include/drawinglayer/primitive2d/cropprimitive2d.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CROPPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CROPPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** CropPrimitive2D class
+
+ Caution: Due to old constraints (old core definitions) the
+ crop distances describe how the uncropped content is defined
+ relative to the current object size. This means that maTransformation
+ describes the rurrent object size (the part of the object visible
+ with the crop applied). To get the original size and orientation
+ of the uncropped content it is necessary to calc back from the
+ current situation (maTransformation) using the crop values
+ to get to the uncropped original content.
+
+ Thus a transformation has to be calculated which will be applied
+ to the already exsisting content to get it to the uncropped state
+ ans then this is masked with the current state (mask polygon
+ created from unit polygon and maTransformation).
+
+ At least in this primitive the units of the crop values are
+ already in the local coordinate system; inthe core these distances
+ are defined relative to the object content size (PrefMapMode
+ and PrefSize of the content)...
+
+ Of course this is a primitive, so feel free to just ignore all that
+ stuff and use the automatically generated decomposition. Sigh.
+ */
+ class DRAWINGLAYER_DLLPUBLIC CropPrimitive2D : public GroupPrimitive2D
+ {
+ private:
+ // the transformation already applied to the child geometry
+ basegfx::B2DHomMatrix maTransformation;
+
+ // the crop offsets relative to the range of the unrotated content
+ double mfCropLeft;
+ double mfCropTop;
+ double mfCropRight;
+ double mfCropBottom;
+
+ public:
+ /// constructor
+ CropPrimitive2D(
+ const Primitive2DSequence& rChildren,
+ const basegfx::B2DHomMatrix& rTransformation,
+ double fCropLeft,
+ double fCropTop,
+ double fCropRight,
+ double fCropBottom);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getTransformation() const { return maTransformation; }
+ double getCropLeft() const { return mfCropLeft; }
+ double getCropTop() const { return mfCropTop; }
+ double getCropRight() const { return mfCropRight; }
+ double getCropBottom() const { return mfCropBottom; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// local decomposition
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CROPPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/discretebitmapprimitive2d.hxx b/include/drawinglayer/primitive2d/discretebitmapprimitive2d.hxx
new file mode 100644
index 000000000000..9b8528057c14
--- /dev/null
+++ b/include/drawinglayer/primitive2d/discretebitmapprimitive2d.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_DISCRETEBITMAPPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_DISCRETEBITMAPPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/primitivetools2d.hxx>
+#include <vcl/bitmapex.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// DiscreteBitmapPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** DiscreteBitmapPrimitive2D class
+
+ This class defines a view-dependent BitmapPrimitive which has a
+ logic position for the top-left position and is always to be
+ painted in 1:1 pixel resolution. It will never be sheared, rotated
+ or scaled with the view.
+ */
+ class DRAWINGLAYER_DLLPUBLIC DiscreteBitmapPrimitive2D : public ObjectAndViewTransformationDependentPrimitive2D
+ {
+ private:
+ /// the RGBA Bitmap-data
+ BitmapEx maBitmapEx;
+
+ /** the top-left object position */
+ basegfx::B2DPoint maTopLeft;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ DiscreteBitmapPrimitive2D(
+ const BitmapEx& rBitmapEx,
+ const basegfx::B2DPoint& rTopLeft);
+
+ /// data read access
+ const BitmapEx& getBitmapEx() const { return maBitmapEx; }
+ const basegfx::B2DPoint& getTopLeft() const { return maTopLeft; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_DISCRETEBITMAPPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/discreteshadowprimitive2d.hxx b/include/drawinglayer/primitive2d/discreteshadowprimitive2d.hxx
new file mode 100644
index 000000000000..2c10292b1c59
--- /dev/null
+++ b/include/drawinglayer/primitive2d/discreteshadowprimitive2d.hxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_QUADRATICSHADOWPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_QUADRATICSHADOWPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/primitivetools2d.hxx>
+#include <vcl/bitmapex.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// DiscreteShadowPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** DiscreteShadow data class
+
+ */
+ class DRAWINGLAYER_DLLPUBLIC DiscreteShadow
+ {
+ private:
+ /// the original shadow BitmapEx in a special form
+ BitmapEx maBitmapEx;
+
+ /// buffered extracted parts of CombinedShadow for easier usage
+ BitmapEx maTopLeft;
+ BitmapEx maTop;
+ BitmapEx maTopRight;
+ BitmapEx maRight;
+ BitmapEx maBottomRight;
+ BitmapEx maBottom;
+ BitmapEx maBottomLeft;
+ BitmapEx maLeft;
+
+ public:
+ /// constructor
+ explicit DiscreteShadow(const BitmapEx& rBitmapEx);
+
+ /// data read access
+ const BitmapEx& getBitmapEx() const { return maBitmapEx; }
+
+ /// compare operator
+ bool operator==(const DiscreteShadow& rCompare) const
+ {
+ return getBitmapEx() == rCompare.getBitmapEx();
+ }
+
+ /// helper accesses which create on-demand needed segments
+ const BitmapEx& getTopLeft() const;
+ const BitmapEx& getTop() const;
+ const BitmapEx& getTopRight() const;
+ const BitmapEx& getRight() const;
+ const BitmapEx& getBottomRight() const;
+ const BitmapEx& getBottom() const;
+ const BitmapEx& getBottomLeft() const;
+ const BitmapEx& getLeft() const;
+ };
+
+ /** DiscreteShadowPrimitive2D class
+
+ */
+ class DRAWINGLAYER_DLLPUBLIC DiscreteShadowPrimitive2D : public DiscreteMetricDependentPrimitive2D
+ {
+ private:
+ // the object transformation of the rectangular object
+ basegfx::B2DHomMatrix maTransform;
+
+ // the bitmap shadow data
+ DiscreteShadow maDiscreteShadow;
+
+ protected:
+ /// create local decomposition
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ DiscreteShadowPrimitive2D(
+ const basegfx::B2DHomMatrix& rTransform,
+ const DiscreteShadow& rDiscreteShadow);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
+ const DiscreteShadow& getDiscreteShadow() const { return maDiscreteShadow; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_QUADRATICSHADOWPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
new file mode 100644
index 000000000000..cb8ff0efd0ff
--- /dev/null
+++ b/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX
+
+//////////////////////////////////////////////////////////////////////////////
+// define ranges for other libraries
+
+#define PRIMITIVE2D_ID_RANGE_DRAWINGLAYER (0 << 16)
+#define PRIMITIVE2D_ID_RANGE_SVX (1 << 16)
+#define PRIMITIVE2D_ID_RANGE_SD (2 << 16)
+#define PRIMITIVE2D_ID_RANGE_SW (3 << 16)
+#define PRIMITIVE2D_ID_RANGE_SC (4 << 16)
+
+//////////////////////////////////////////////////////////////////////////////
+// local primitives
+
+#define PRIMITIVE2D_ID_TRANSPARENCEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 0)
+#define PRIMITIVE2D_ID_ANIMATEDSWITCHPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 1)
+#define PRIMITIVE2D_ID_ANIMATEDBLINKPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 2)
+#define PRIMITIVE2D_ID_ANIMATEDINTERPOLATEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 3)
+#define PRIMITIVE2D_ID_BACKGROUNDCOLORPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 4)
+#define PRIMITIVE2D_ID_BITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 5)
+#define PRIMITIVE2D_ID_CONTROLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 6)
+#define PRIMITIVE2D_ID_EMBEDDED3DPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 7)
+#define PRIMITIVE2D_ID_FILLBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 8)
+#define PRIMITIVE2D_ID_FILLGRADIENTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 9)
+#define PRIMITIVE2D_ID_FILLHATCHPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 10)
+#define PRIMITIVE2D_ID_GRAPHICPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 11)
+#define PRIMITIVE2D_ID_GRIDPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 12)
+#define PRIMITIVE2D_ID_GROUPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 13)
+#define PRIMITIVE2D_ID_HELPLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 14)
+#define PRIMITIVE2D_ID_MARKERARRAYPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 15)
+#define PRIMITIVE2D_ID_MASKPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 16)
+#define PRIMITIVE2D_ID_MEDIAPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 17)
+#define PRIMITIVE2D_ID_METAFILEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 18)
+#define PRIMITIVE2D_ID_MODIFIEDCOLORPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 19)
+#define PRIMITIVE2D_ID_POLYGONHAIRLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 20)
+#define PRIMITIVE2D_ID_POLYGONMARKERPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 21)
+#define PRIMITIVE2D_ID_POLYGONSTROKEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 22)
+#define PRIMITIVE2D_ID_POLYGONSTROKEARROWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 23)
+#define PRIMITIVE2D_ID_POLYPOLYGONSTROKEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 24)
+#define PRIMITIVE2D_ID_POLYPOLYGONSTROKEARROWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 25)
+#define PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 26)
+#define PRIMITIVE2D_ID_POLYPOLYGONGRADIENTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 27)
+#define PRIMITIVE2D_ID_POLYPOLYGONHATCHPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 28)
+#define PRIMITIVE2D_ID_POLYPOLYGONBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 29)
+#define PRIMITIVE2D_ID_SCENEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 30)
+#define PRIMITIVE2D_ID_SHADOWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 31)
+#define PRIMITIVE2D_ID_TEXTSIMPLEPORTIONPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 32)
+#define PRIMITIVE2D_ID_TEXTDECORATEDPORTIONPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 33)
+#define PRIMITIVE2D_ID_TRANSFORMPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 34)
+#define PRIMITIVE2D_ID_UNIFIEDTRANSPARENCEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 35)
+#define PRIMITIVE2D_ID_POINTARRAYPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 36)
+#define PRIMITIVE2D_ID_TEXTHIERARCHYFIELDPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 37)
+#define PRIMITIVE2D_ID_TEXTHIERARCHYLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 38)
+#define PRIMITIVE2D_ID_TEXTHIERARCHYPARAGRAPHPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 39)
+#define PRIMITIVE2D_ID_TEXTHIERARCHYBLOCKPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 40)
+#define PRIMITIVE2D_ID_TEXTHIERARCHYEDITPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 41)
+#define PRIMITIVE2D_ID_POLYGONWAVEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 42)
+#define PRIMITIVE2D_ID_WRONGSPELLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 43)
+#define PRIMITIVE2D_ID_TEXTEFFECTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 44)
+#define PRIMITIVE2D_ID_TEXTHIERARCHYBULLETPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 45)
+#define PRIMITIVE2D_ID_POLYPOLYGONHAIRLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 46)
+#define PRIMITIVE2D_ID_EXECUTEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 47)
+#define PRIMITIVE2D_ID_PAGEPREVIEWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 48)
+#define PRIMITIVE2D_ID_STRUCTURETAGPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 49)
+#define PRIMITIVE2D_ID_BORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 50)
+#define PRIMITIVE2D_ID_POLYPOLYGONMARKERPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 51)
+#define PRIMITIVE2D_ID_HITTESTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 52)
+#define PRIMITIVE2D_ID_INVERTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 53)
+#define PRIMITIVE2D_ID_DISCRETEBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 54)
+#define PRIMITIVE2D_ID_WALLPAPERBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 55)
+#define PRIMITIVE2D_ID_TEXTLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 56)
+#define PRIMITIVE2D_ID_TEXTCHARACTERSTRIKEOUTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 57)
+#define PRIMITIVE2D_ID_TEXTGEOMETRYSTRIKEOUTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 58)
+#define PRIMITIVE2D_ID_EPSPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 59)
+#define PRIMITIVE2D_ID_DISCRETESHADOWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 60)
+#define PRIMITIVE2D_ID_HIDDENGEOMETRYPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 61)
+#define PRIMITIVE2D_ID_SVGLINEARGRADIENTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 62)
+#define PRIMITIVE2D_ID_SVGRADIALGRADIENTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 63)
+#define PRIMITIVE2D_ID_SVGLINEARATOMPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 64)
+#define PRIMITIVE2D_ID_SVGRADIALATOMPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 65)
+#define PRIMITIVE2D_ID_CROPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 66)
+#define PRIMITIVE2D_ID_PATTERNFILLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 67)
+#define PRIMITIVE2D_ID_OBJECTINFOPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 68)
+
+#define PRIMITIVE2D_ID_CLIPPEDBORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 68)
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/embedded3dprimitive2d.hxx b/include/drawinglayer/primitive2d/embedded3dprimitive2d.hxx
new file mode 100644
index 000000000000..d7389bea2bc3
--- /dev/null
+++ b/include/drawinglayer/primitive2d/embedded3dprimitive2d.hxx
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_EMBEDDED3DPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_EMBEDDED3DPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <drawinglayer/primitive3d/baseprimitive3d.hxx>
+#include <drawinglayer/geometry/viewinformation3d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// Embedded3DPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** Embedded3DPrimitive2D class
+
+ This is a helper primitive which allows embedding of single 3D
+ primitives to the 2D primitive logic. It will get the scene it's
+ involved and thus the 3D transformation. With this information it
+ is able to provide 2D range data for a 3D primitive.
+
+ This primitive will not be visualized and decomposes to a yellow
+ 2D rectangle to visualize that this should never be visualized
+ */
+ class DRAWINGLAYER_DLLPUBLIC Embedded3DPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the sequence of 3d primitives
+ primitive3d::Primitive3DSequence mxChildren3D;
+
+ /// the 2D scene object transformation
+ basegfx::B2DHomMatrix maObjectTransformation;
+
+ /// the 3D transformations
+ geometry::ViewInformation3D maViewInformation3D;
+
+ /** if the embedded 3D primitives contain shadow, these parameters are needed
+ to extract the shadow wich is a sequence od 2D primitives and may expand
+ the 2D range. Since every single 3D object in a scene may individually
+ have shadow or not, these values need to be provided and prepared. The shadow
+ distance itself (a 2D transformation) is part of the 3D shadow definition
+ */
+ basegfx::B3DVector maLightNormal;
+ double mfShadowSlant;
+ basegfx::B3DRange maScene3DRange;
+
+ /// the primitiveSequence for on-demand created shadow primitives (see mbShadow3DChecked)
+ Primitive2DSequence maShadowPrimitives;
+
+ /// #i96669# add simple range buffering for this primitive
+ basegfx::B2DRange maB2DRange;
+
+ /// bitfield
+ /** flag if given 3D geometry is already cheched for shadow definitions and 2d shadows
+ are created in maShadowPrimitives
+ */
+ unsigned mbShadow3DChecked : 1;
+
+ /// private helpers
+ bool impGetShadow3D(const geometry::ViewInformation2D& rViewInformation) const;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ Embedded3DPrimitive2D(
+ const primitive3d::Primitive3DSequence& rxChildren3D,
+ const basegfx::B2DHomMatrix& rObjectTransformation,
+ const geometry::ViewInformation3D& rViewInformation3D,
+ const basegfx::B3DVector& rLightNormal,
+ double fShadowSlant,
+ const basegfx::B3DRange& rScene3DRange);
+
+ /// data read access
+ const primitive3d::Primitive3DSequence& getChildren3D() const { return mxChildren3D; }
+ const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
+ const geometry::ViewInformation3D& getViewInformation3D() const { return maViewInformation3D; }
+ const basegfx::B3DVector& getLightNormal() const { return maLightNormal; }
+ double getShadowSlant() const { return mfShadowSlant; }
+ const basegfx::B3DRange& getScene3DRange() const { return maScene3DRange; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_EMBEDDED3DPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/epsprimitive2d.hxx b/include/drawinglayer/primitive2d/epsprimitive2d.hxx
new file mode 100644
index 000000000000..577554481d6e
--- /dev/null
+++ b/include/drawinglayer/primitive2d/epsprimitive2d.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_EPSPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_EPSPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <vcl/gfxlink.hxx>
+#include <vcl/gdimtf.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** EpsPrimitive2D class */
+ class DRAWINGLAYER_DLLPUBLIC EpsPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the geometry definition
+ basegfx::B2DHomMatrix maEpsTransform;
+
+ /// the Eps content definition
+ GfxLink maGfxLink;
+
+ /// the replacement content definition
+ GDIMetaFile maMetaFile;
+
+ protected:
+ /// create local decomposition
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ EpsPrimitive2D(
+ const basegfx::B2DHomMatrix& rEpsTransform,
+ const GfxLink& rGfxLink,
+ const GDIMetaFile& rMetaFile);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getEpsTransform() const { return maEpsTransform; }
+ const GfxLink& getGfxLink() const { return maGfxLink; }
+ const GDIMetaFile& getMetaFile() const { return maMetaFile; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get B2Drange
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_EPSPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/fillbitmapprimitive2d.hxx b/include/drawinglayer/primitive2d/fillbitmapprimitive2d.hxx
new file mode 100644
index 000000000000..0c82458840ad
--- /dev/null
+++ b/include/drawinglayer/primitive2d/fillbitmapprimitive2d.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLBITMAPPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLBITMAPPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <drawinglayer/attribute/fillbitmapattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// FillbitmapPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** FillBitmapPrimitive2D class
+
+ This class defines a bitmap filling for a rectangular area. The
+ Range is defined by the Transformation, the fill by the FillBitmapAttribute.
+ There, the fill consists of a Bitmap (not transparent) defining the fill data
+ and a Point/Vector pair defining the relative position/size [0.0 .. 1.0]
+ inside the area where the bitmap is positioned. A flag defines then if this
+ is tiled or not.
+
+ Renderers should handle this primitive; it has a geometrically correct
+ decomposition, but on pixel oututs the areas where the tiled pieces are
+ aligned tend to show up (one overlapping or empty pixel)
+ */
+ class DRAWINGLAYER_DLLPUBLIC FillBitmapPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the geometric definition
+ basegfx::B2DHomMatrix maTransformation;
+
+ /// the fill attributes
+ attribute::FillBitmapAttribute maFillBitmap;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ FillBitmapPrimitive2D(
+ const basegfx::B2DHomMatrix& rTransformation,
+ const attribute::FillBitmapAttribute& rFillBitmap);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getTransformation() const { return maTransformation; }
+ const attribute::FillBitmapAttribute& getFillBitmap() const { return maFillBitmap; }
+
+ /// compare operator
+ virtual bool operator==( const BasePrimitive2D& rPrimitive ) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLBITMAPPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/fillgradientprimitive2d.hxx b/include/drawinglayer/primitive2d/fillgradientprimitive2d.hxx
new file mode 100644
index 000000000000..0f6c33ae8f95
--- /dev/null
+++ b/include/drawinglayer/primitive2d/fillgradientprimitive2d.hxx
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLGRADIENTPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLGRADIENTPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <drawinglayer/attribute/fillgradientattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx { class B2DPolygon; }
+
+//////////////////////////////////////////////////////////////////////////////
+// FillGradientPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** FillGradientPrimitive2D class
+
+ This class defines a gradient filling for a rectangular area. The
+ Range is defined by the Transformation, the gradient by the FillGradientAttribute.
+
+ The decomposition will deliver the decomposed gradient, e.g. for an ellipse
+ gradient the various ellipses in various color steps will be created.
+
+ I have added functionality to create both versions of filled decompositions:
+ Those who overlap and non-overlapping ones. The overlapping version is the
+ default one since it works with and without AntiAliasing. The non-overlapping
+ version is used in the MetafilePrimitive2D decomposition when the old XOR
+ paint was recorded.
+ */
+ class DRAWINGLAYER_DLLPUBLIC FillGradientPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the geometric definition
+ basegfx::B2DRange maObjectRange;
+
+ /// the gradient definition
+ attribute::FillGradientAttribute maFillGradient;
+
+ /// local helpers
+ void generateMatricesAndColors(
+ std::vector< basegfx::B2DHomMatrix >& rMatrices,
+ std::vector< basegfx::BColor >& rColors) const;
+ Primitive2DSequence createOverlappingFill(
+ const std::vector< basegfx::B2DHomMatrix >& rMatrices,
+ const std::vector< basegfx::BColor >& rColors,
+ const basegfx::B2DPolygon& rUnitPolygon) const;
+ Primitive2DSequence createNonOverlappingFill(
+ const std::vector< basegfx::B2DHomMatrix >& rMatrices,
+ const std::vector< basegfx::BColor >& rColors,
+ const basegfx::B2DPolygon& rUnitPolygon) const;
+
+ protected:
+ /// local helper
+ Primitive2DSequence createFill(bool bOverlapping) const;
+
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ FillGradientPrimitive2D(
+ const basegfx::B2DRange& rObjectRange,
+ const attribute::FillGradientAttribute& rFillGradient);
+
+ /// data read access
+ const basegfx::B2DRange& getObjectRange() const { return maObjectRange; }
+ const attribute::FillGradientAttribute& getFillGradient() const { return maFillGradient; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLGRADIENTPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/fillhatchprimitive2d.hxx b/include/drawinglayer/primitive2d/fillhatchprimitive2d.hxx
new file mode 100644
index 000000000000..b0c27ba89107
--- /dev/null
+++ b/include/drawinglayer/primitive2d/fillhatchprimitive2d.hxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLHATCHPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLHATCHPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <drawinglayer/attribute/fillhatchattribute.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// FillHatchPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** FillHatchPrimitive2D class
+
+ This class defines a hatch filling for a rectangular area. The
+ Range is defined by the Transformation, the hatch by the FillHatchAttribute.
+ If the background is to be filled, a flag in FillHatchAttribute is set and
+ the BColor defines the background color.
+
+ The decomposition will deliver the hatch lines.
+ */
+ class DRAWINGLAYER_DLLPUBLIC FillHatchPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the geometric definition
+ basegfx::B2DRange maObjectRange;
+
+ /// the hatch definition
+ attribute::FillHatchAttribute maFillHatch;
+
+ /// hatch background color (if used)
+ basegfx::BColor maBColor;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ FillHatchPrimitive2D(
+ const basegfx::B2DRange& rObjectRange,
+ const basegfx::BColor& rBColor,
+ const attribute::FillHatchAttribute& rFillHatch);
+
+ /// data read access
+ const basegfx::B2DRange& getObjectRange() const { return maObjectRange; }
+ const attribute::FillHatchAttribute& getFillHatch() const { return maFillHatch; }
+ const basegfx::BColor& getBColor() const { return maBColor; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLHATCHPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/graphicprimitive2d.hxx b/include/drawinglayer/primitive2d/graphicprimitive2d.hxx
new file mode 100644
index 000000000000..75bb6fc99341
--- /dev/null
+++ b/include/drawinglayer/primitive2d/graphicprimitive2d.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GRAPHICPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GRAPHICPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svtools/grfmgr.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** GraphicPrimitive2D class
+
+ Primitive to hold graphics defined by GraphicObject and GraphicAttr
+ combination. This includes MetaFiles and diverse pixel-oriented graphic
+ formats. It even includes animated GIFs, Croppings and other changes
+ defined in GraphicAttr.
+
+ This makes the decomposition contain a wide variety of possibilites,
+ too. From a simple BitmapPrimitive over AnimatedSwitchPrimitive2D,
+ MetafilePrimitive2D (with and without embedding in a masking when e.g.
+ the Metafile is bigger than the geometry) and embeddings in
+ TransformPrimitive2D and MaskPrimitive2D for croppings.
+
+ The primitive geometry area is defined by Transform.
+ */
+ class DRAWINGLAYER_DLLPUBLIC GraphicPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the geometric definition
+ basegfx::B2DHomMatrix maTransform;
+
+ /// the GraphicObject with all it's content possibilities
+ GraphicObject maGraphicObject;
+
+ /// The GraphicAttr with all it's modification possibilities
+ GraphicAttr maGraphicAttr;
+
+ protected:
+ /// local decomposition
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor(s)
+ GraphicPrimitive2D(
+ const basegfx::B2DHomMatrix& rTransform,
+ const GraphicObject& rGraphicObject,
+ const GraphicAttr& rGraphicAttr);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
+ const GraphicObject& getGraphicObject() const { return maGraphicObject; }
+ const GraphicAttr& getGraphicAttr() const { return maGraphicAttr; }
+ bool isTransparent() const;
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GRAPHICPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/gridprimitive2d.hxx b/include/drawinglayer/primitive2d/gridprimitive2d.hxx
new file mode 100644
index 000000000000..3db300ff4da4
--- /dev/null
+++ b/include/drawinglayer/primitive2d/gridprimitive2d.hxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GRIDPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GRIDPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <vcl/bitmapex.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// GridPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** GridPrimitive2D class
+
+ This primitive is specialized to Grid visualisation. The graphic definition
+ (Transform) contains the whole grid area, but will of course be combined
+ with the visible area (Viewport) when decomposed. Also a reolution-dependent
+ point reduction is used to not create too much grid visualisation data. This
+ makes this primitive highly view-dependent and it dynamically buffers
+ the last decomposition dependent from the Viewport used.
+ */
+ class DRAWINGLAYER_DLLPUBLIC GridPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// The geometry definition for the grid area
+ basegfx::B2DHomMatrix maTransform;
+
+ /// grid layout definitions
+ double mfWidth;
+ double mfHeight;
+ double mfSmallestViewDistance;
+ double mfSmallestSubdivisionViewDistance;
+ sal_uInt32 mnSubdivisionsX;
+ sal_uInt32 mnSubdivisionsY;
+
+ /// Grid color for single-pixel grid points
+ basegfx::BColor maBColor;
+
+ /// The Bitmap (with transparence) for grid cross points
+ BitmapEx maCrossMarker;
+
+ /** the last used object to view transformtion and the last Viewport,
+ used from getDecomposition for decide buffering
+ */
+ basegfx::B2DHomMatrix maLastObjectToViewTransformation;
+ basegfx::B2DRange maLastViewport;
+
+ protected:
+ /// create local decomposition
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ GridPrimitive2D(
+ const basegfx::B2DHomMatrix& rTransform,
+ double fWidth,
+ double fHeight,
+ double fSmallestViewDistance,
+ double fSmallestSubdivisionViewDistance,
+ sal_uInt32 nSubdivisionsX,
+ sal_uInt32 nSubdivisionsY,
+ const basegfx::BColor& rBColor,
+ const BitmapEx& rCrossMarker);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
+ double getWidth() const { return mfWidth; }
+ double getHeight() const { return mfHeight; }
+ double getSmallestViewDistance() const { return mfSmallestViewDistance; }
+ double getSmallestSubdivisionViewDistance() const { return mfSmallestSubdivisionViewDistance; }
+ sal_uInt32 getSubdivisionsX() const { return mnSubdivisionsX; }
+ sal_uInt32 getSubdivisionsY() const { return mnSubdivisionsY; }
+ const basegfx::BColor& getBColor() const { return maBColor; }
+ const BitmapEx& getCrossMarker() const { return maCrossMarker; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get 2d range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+
+ /// Overload standard getDecomposition call to be view-dependent here
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GRIDPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/groupprimitive2d.hxx b/include/drawinglayer/primitive2d/groupprimitive2d.hxx
new file mode 100644
index 000000000000..7dab4a628638
--- /dev/null
+++ b/include/drawinglayer/primitive2d/groupprimitive2d.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GROUPPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GROUPPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// GroupPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** GroupPrimitive2D class
+
+ Baseclass for all grouping 2D primitives
+
+ The grouping primitive in it's basic form is capable of holding
+ a child primitive content and returns it on decomposition on default.
+ It is used for two main purposes, but more may apply:
+
+ - to transport extended information, e.g. for text classification,
+ see e.g. TextHierarchy*Primitive2D implementations. Since they
+ decompose to their child content, renderers not aware/interested
+ in that extra information will just ignore these primitives
+
+ - to encapsulate common geometry, e.g. the ShadowPrimitive2D implements
+ applying a generic shadow to a child sequence by adding the needed
+ offset and color stuff in the decomposition
+
+ In most cases the decomposition is straightforward, so by default
+ this primitive will not buffer the result and is not derived from
+ BufferedDecompositionPrimitive2D, but from BasePrimitive2D.
+
+ A renderer has to take GroupPrimitive2D derivations into account which
+ are used to hold a state.
+
+ Current Basic 2D StatePrimitives are:
+
+ - TransparencePrimitive2D (objects with freely defined transparence)
+ - InvertPrimitive2D (for XOR)
+ - MaskPrimitive2D (for masking)
+ - ModifiedColorPrimitive2D (for a stack of color modifications)
+ - TransformPrimitive2D (for a transformation stack)
+ */
+ class DRAWINGLAYER_DLLPUBLIC GroupPrimitive2D : public BasePrimitive2D
+ {
+ private:
+ /// the children. Declared private since this shall never be changed at all after construction
+ Primitive2DSequence maChildren;
+
+ public:
+ /// constructor
+ explicit GroupPrimitive2D(const Primitive2DSequence& rChildren);
+
+ /// data read access
+ const Primitive2DSequence& getChildren() const { return maChildren; }
+
+ /// compare operator
+ virtual bool operator==( const BasePrimitive2D& rPrimitive ) const;
+
+ /// local decomposition. Implementation will just return children
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GROUPPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/helplineprimitive2d.hxx b/include/drawinglayer/primitive2d/helplineprimitive2d.hxx
new file mode 100644
index 000000000000..c9addb8f3810
--- /dev/null
+++ b/include/drawinglayer/primitive2d/helplineprimitive2d.hxx
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HELPLINEPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HELPLINEPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// HelplinePrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** HelplineStyle2D definition
+
+ The available styles of Helplines
+ */
+ enum HelplineStyle2D
+ {
+ HELPLINESTYLE2D_POINT,
+ HELPLINESTYLE2D_LINE
+ };
+
+ /** HelplinePrimitive2D class
+
+ This primitive provides a view-dependent helpline definition. The Helpline
+ is defined by a line equation (Point and vector) and a style. When the style
+ is a line, dependent from Viewport the visible part of that Helpline is
+ constructed. For Point, a cross is constructed. This primitive is highly
+ view-dependent.
+
+ The visualisation uses the two given colors to create a dashed line with
+ the given dash length.
+ */
+ class DRAWINGLAYER_DLLPUBLIC HelplinePrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// Helpline geometry definition
+ basegfx::B2DPoint maPosition;
+ basegfx::B2DVector maDirection;
+ HelplineStyle2D meStyle;
+
+ /// Helpline style definition
+ basegfx::BColor maRGBColA;
+ basegfx::BColor maRGBColB;
+ double mfDiscreteDashLength;
+
+ /** the last used object to view transformtion and the last Viewport,
+ used from getDecomposition for decide buffering
+ */
+ basegfx::B2DHomMatrix maLastObjectToViewTransformation;
+ basegfx::B2DRange maLastViewport;
+
+ protected:
+ /// create local decomposition
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ HelplinePrimitive2D(
+ const basegfx::B2DPoint& rPosition,
+ const basegfx::B2DVector& rDirection,
+ HelplineStyle2D eStyle,
+ const basegfx::BColor& rRGBColA,
+ const basegfx::BColor& aRGBColB,
+ double fDiscreteDashLength);
+
+ /// data read access
+ const basegfx::B2DPoint& getPosition() const { return maPosition; }
+ const basegfx::B2DVector& getDirection() const { return maDirection; }
+ HelplineStyle2D getStyle() const { return meStyle; }
+ const basegfx::BColor& getRGBColA() const { return maRGBColA; }
+ const basegfx::BColor& getRGBColB() const { return maRGBColB; }
+ double getDiscreteDashLength() const { return mfDiscreteDashLength; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+
+ /// Overload standard getDecomposition call to be view-dependent here
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HELPLINEPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx b/include/drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx
new file mode 100644
index 000000000000..35c8de40bc4d
--- /dev/null
+++ b/include/drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HIDDENGEOMETRYPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HIDDENGEOMETRYPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ // This primitive is used to represent geometry for non-visible objects,
+ // e.g. a PresObj's outline. To still be able to use primitives for HitTest
+ // functionality, the 2d decompositions will produce an as much as possible
+ // simplified line geometry encapsulated in this primtive when there is no
+ // line geometry. In a further enchanced version this may change to 'if neither
+ // filled nor lines' creation criteria. The whole primitive decomposes to nothing,
+ // so no one not knowing it will be influenced. Only helper processors for hit test
+ // (and maybe BoundRect extractors) will use it and it's children subcontent.
+ class DRAWINGLAYER_DLLPUBLIC HiddenGeometryPrimitive2D : public GroupPrimitive2D
+ {
+ public:
+ explicit HiddenGeometryPrimitive2D(const Primitive2DSequence& rChildren);
+
+ // despite returning an empty decomposition since it's no visualisation data,
+ // range calculation is intended to use hidden geometry, so
+ // the local implementation will return the children's range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// local decomposition. Implementation will return empty Primitive2DSequence
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ // provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HIDDENGEOMETRYPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/invertprimitive2d.hxx b/include/drawinglayer/primitive2d/invertprimitive2d.hxx
new file mode 100644
index 000000000000..dfff3d9034ba
--- /dev/null
+++ b/include/drawinglayer/primitive2d/invertprimitive2d.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_INVERTPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_INVERTPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** InvertPrimitive2D class
+
+ This is a helper class which encapsulates geometry that should be
+ painted XOR, e.g. old cursor visualisations. It decomposes to
+ it's content, so when not supporting it, the contained geometry
+ will be visualized normally.
+ Unfortunately this is still needed, but hard to support on various
+ systems. XOR painting needs read access to the target, so modern
+ graphic systems tend to not support it anymore.
+ */
+ class DRAWINGLAYER_DLLPUBLIC InvertPrimitive2D : public GroupPrimitive2D
+ {
+ public:
+ /// constructor
+ explicit InvertPrimitive2D(const Primitive2DSequence& rChildren);
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_INVERTPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/markerarrayprimitive2d.hxx b/include/drawinglayer/primitive2d/markerarrayprimitive2d.hxx
new file mode 100644
index 000000000000..b1bca354e60e
--- /dev/null
+++ b/include/drawinglayer/primitive2d/markerarrayprimitive2d.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MARKERARRAYPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MARKERARRAYPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <vcl/bitmapex.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// MarkerArrayPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** MarkerArrayPrimitive2D class
+
+ This primtive defines an array of markers. Their size is defined
+ in pixels and independent from the view transformation which makes
+ this primitive highly view-dependent. It is also transformation
+ invariant, so that the bitmap is always visualized unscaled and
+ unrotated.
+ It is used e.g. for grid position visualisation. The given Bitmap
+ (with transparence) is defined to be visible centered at each of the given
+ positions.
+ It decomposes to the needed number of BitmapPrimitive2D's, so it would
+ be efficient to handle it directly in a renderer.
+ */
+ class DRAWINGLAYER_DLLPUBLIC MarkerArrayPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the positions for the marker
+ std::vector< basegfx::B2DPoint > maPositions;
+
+ /// the marker definintion to visualize
+ BitmapEx maMarker;
+
+ protected:
+ /// create local decomposition
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ MarkerArrayPrimitive2D(
+ const std::vector< basegfx::B2DPoint >& rPositions,
+ const BitmapEx& rMarker);
+
+ /// data read access
+ const std::vector< basegfx::B2DPoint >& getPositions() const { return maPositions; }
+ const BitmapEx& getMarker() const { return maMarker; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MARKERARRAYPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/maskprimitive2d.hxx b/include/drawinglayer/primitive2d/maskprimitive2d.hxx
new file mode 100644
index 000000000000..af5fcd9177d1
--- /dev/null
+++ b/include/drawinglayer/primitive2d/maskprimitive2d.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MASKPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MASKPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** MaskPrimitive2D class
+
+ This is the central masking primitive. It's a grouping
+ primitive and contains a PolyPolygon which defines the visible
+ area. Only visualisation parts of the Child primitive sequence
+ inside of the mask PolyPolygon is defined to be visible.
+
+ This primitive should be handled by a renderer. If it is not handled,
+ it decomposes to it's Child content, and thus the visualisation would
+ contaiun no clips.
+
+ The geometrc range of this primitive is completely defined by the Mask
+ PolyPolygon since by definition nothing outside of the mask is visible.
+ */
+ class DRAWINGLAYER_DLLPUBLIC MaskPrimitive2D : public GroupPrimitive2D
+ {
+ private:
+ /// the mask PolyPolygon
+ basegfx::B2DPolyPolygon maMask;
+
+ public:
+ /// constructor
+ MaskPrimitive2D(
+ const basegfx::B2DPolyPolygon& rMask,
+ const Primitive2DSequence& rChildren);
+
+ /// data read access
+ const basegfx::B2DPolyPolygon& getMask() const { return maMask; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MASKPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/mediaprimitive2d.hxx b/include/drawinglayer/primitive2d/mediaprimitive2d.hxx
new file mode 100644
index 000000000000..df75569ecb64
--- /dev/null
+++ b/include/drawinglayer/primitive2d/mediaprimitive2d.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MEDIAPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MEDIAPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <vcl/graph.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** MediaPrimitive2D class
+
+ This is a unified primitive for Media visualisation, e.g. animations
+ or sounds. It's geometry is defined by Transform. For conveinience,
+ it also contains a discrete border size (aka Pixels) which will be added
+ if used. This makes it a view-dependent primitive. It also gets a filled
+ background and the decomposition will try to create a graphic representation
+ if te content (defined by the URL), e.g. a still frome for animated stuff.
+ */
+ class DRAWINGLAYER_DLLPUBLIC MediaPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the geometry definition
+ basegfx::B2DHomMatrix maTransform;
+
+ /// the content definition
+ OUString maURL;
+
+ /// style: background color
+ basegfx::BColor maBackgroundColor;
+
+ /// discrete border (in 'pixels')
+ sal_uInt32 mnDiscreteBorder;
+
+ const Graphic maSnapshot;
+
+ protected:
+ /// local decomposition
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ MediaPrimitive2D(
+ const basegfx::B2DHomMatrix& rTransform,
+ const OUString& rURL,
+ const basegfx::BColor& rBackgroundColor,
+ sal_uInt32 nDiscreteBorder,
+ const Graphic &rSnapshot);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
+ const OUString& getURL() const { return maURL; }
+ const basegfx::BColor& getBackgroundColor() const { return maBackgroundColor; }
+ sal_uInt32 getDiscreteBorder() const { return mnDiscreteBorder; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MEDIAPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/metafileprimitive2d.hxx b/include/drawinglayer/primitive2d/metafileprimitive2d.hxx
new file mode 100644
index 000000000000..a8e8cf883991
--- /dev/null
+++ b/include/drawinglayer/primitive2d/metafileprimitive2d.hxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_METAFILEPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_METAFILEPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <vcl/gdimtf.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// MetafilePrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** MetafilePrimitive2D class
+
+ This is the MetaFile representing primitive. It's geometry is defined
+ by MetaFileTransform. The content (defined by MetaFile) will be scaled
+ to the geometric definiton by using PrefMapMode and PrefSize of the
+ Metafile.
+
+ It has shown that this not always guarantees that all Metafile content
+ is inside the geometric definition, but this primitive defines that this
+ is the case to allow a getB2DRange implementation. If it cannot be
+ guaranteed that the Metafile is inside the geometric definition, it should
+ be embedded to a MaskPrimitive2D.
+
+ This primitive has no decomposition yet, so when not supported by a renderer,
+ it will not be visualized.
+
+ In the future, a decomposition implementation would be appreciated and would
+ have many advantages; Metafile would no longer have to be rendered by
+ sub-systems and a standard way for converting Metafiles would exist.
+ */
+ class DRAWINGLAYER_DLLPUBLIC MetafilePrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the geometry definition
+ basegfx::B2DHomMatrix maMetaFileTransform;
+
+ /// the content definition
+ GDIMetaFile maMetaFile;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+ public:
+ /// constructor
+ MetafilePrimitive2D(
+ const basegfx::B2DHomMatrix& rMetaFileTransform,
+ const GDIMetaFile& rMetaFile);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getTransform() const { return maMetaFileTransform; }
+ const GDIMetaFile& getMetaFile() const { return maMetaFile; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_METAFILEPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx b/include/drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx
new file mode 100644
index 000000000000..7584cfad27b7
--- /dev/null
+++ b/include/drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MODIFIEDCOLORPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MODIFIEDCOLORPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <basegfx/color/bcolormodifier.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** ModifiedColorPrimitive2D class
+
+ This primitive is a grouping primitive and allows to define
+ how the colors of it's child content shall be modified for
+ visualisation. This can be (and is) used e.g. for generic shadow
+ visualisation by forcing all color usages of the contained
+ sub-content to the shadow color.
+
+ For the possibilities of color modifications, please refer
+ to the basegfx::BColorModifier definitions in basegfx. For
+ processing there is tooling in basegfx to build a stack of
+ BColorModifiers to always be able to proccess the correct
+ colors.
+
+ If a renderer does not handle this primitive, the content will
+ be visualized unchanged.
+ */
+ class DRAWINGLAYER_DLLPUBLIC ModifiedColorPrimitive2D : public GroupPrimitive2D
+ {
+ private:
+ /// The ColorModifier to use
+ basegfx::BColorModifier maColorModifier;
+
+ public:
+ /// constructor
+ ModifiedColorPrimitive2D(
+ const Primitive2DSequence& rChildren,
+ const basegfx::BColorModifier& rColorModifier);
+
+ /// data read access
+ const basegfx::BColorModifier& getColorModifier() const { return maColorModifier; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MODIFIEDCOLORPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/objectinfoprimitive2d.hxx b/include/drawinglayer/primitive2d/objectinfoprimitive2d.hxx
new file mode 100644
index 000000000000..ec5452773751
--- /dev/null
+++ b/include/drawinglayer/primitive2d/objectinfoprimitive2d.hxx
@@ -0,0 +1,73 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_INFOHIERARCHYPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_INFOHIERARCHYPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <tools/string.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** ObjectInfoPrimitive2D class
+
+ Info hierarchy helper class to hold contents like Name, Title and
+ Description which are valid for the child content, e.g. created for
+ primitives based on DrawingLayer objects or SVG parts. It decomposes
+ to it's content, so all direct renderers may ignore it. May e.g.
+ be used when re-creating graphical content from a sequence of primitives
+ */
+ class DRAWINGLAYER_DLLPUBLIC ObjectInfoPrimitive2D : public GroupPrimitive2D
+ {
+ private:
+ OUString maName;
+ OUString maTitle;
+ OUString maDesc;
+
+ public:
+ /// constructor
+ ObjectInfoPrimitive2D(
+ const Primitive2DSequence& rChildren,
+ const OUString& rName,
+ const OUString& rTitle,
+ const OUString& rDesc);
+
+ /// data read access
+ const OUString& getName() const { return maName; }
+ const OUString& getTitle() const { return maTitle; }
+ const OUString& getDesc() const { return maDesc; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_INFOHIERARCHYPRIMITIVE2D_HXX
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/include/drawinglayer/primitive2d/pagepreviewprimitive2d.hxx b/include/drawinglayer/primitive2d/pagepreviewprimitive2d.hxx
new file mode 100644
index 000000000000..5acdf2157f10
--- /dev/null
+++ b/include/drawinglayer/primitive2d/pagepreviewprimitive2d.hxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PAGEPREVIEWPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PAGEPREVIEWPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** PagePreviewPrimitive2D class
+
+ This primitive is needed to have the correct XDrawPage as ViewInformation for decomposing
+ the page contents (given as PageContent here) if these contain e.g.
+ view-dependent (in this case XDrawPage-dependent) text fields like PageNumber. If You want
+ those primitives to be visualized correctly, Your renderer needs to locally correct it's
+ ViewInformation2D to reference the new XDrawPage.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PagePreviewPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /** the XDrawPage visualized by this primitive. When we go forward with primitives
+ this will not only be used by the renderers to provide the correct decompose
+ graphic attribute context, but also to completely create the page's sub-content.
+ */
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > mxDrawPage;
+
+ /// the PageContent
+ Primitive2DSequence maPageContent;
+
+ /// the own geometry
+ basegfx::B2DHomMatrix maTransform;
+
+ /// content width and height
+ double mfContentWidth;
+ double mfContentHeight;
+
+ /// bitfield
+ /// flag to allow keeping the aspect ratio
+ unsigned mbKeepAspectRatio : 1;
+
+ protected:
+ /// local decomposition. Implementation will just return children
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ PagePreviewPrimitive2D(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& rxDrawPage,
+ const basegfx::B2DHomMatrix& rTransform,
+ double fContentWidth,
+ double fContentHeight,
+ const Primitive2DSequence& rPageContent,
+ bool bKeepAspectRatio);
+
+ /// data read access
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& getXDrawPage() const { return mxDrawPage; }
+ const Primitive2DSequence& getPageContent() const { return maPageContent; }
+ const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
+ double getContentWidth() const { return mfContentWidth; }
+ double getContentHeight() const { return mfContentHeight; }
+ bool getKeepAspectRatio() const { return mbKeepAspectRatio; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// own getB2DRange
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PAGEPREVIEWPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/patternfillprimitive2d.hxx b/include/drawinglayer/primitive2d/patternfillprimitive2d.hxx
new file mode 100644
index 000000000000..7787d6f6ba28
--- /dev/null
+++ b/include/drawinglayer/primitive2d/patternfillprimitive2d.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PATTERNFILLPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PATTERNFILLPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** PatternFillPrimitive2D class
+
+ This primitive allows filling a given PolyPolygon with a pattern
+ defined by a sequence of primitives which are mapped to the unit range.
+ The pattern is defined using a reference range which defines a rectangular
+ area relative to the PolyPolygon (in unit coordinates) which is virtually
+ infinitely repeated.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PatternFillPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ const basegfx::B2DPolyPolygon maMask;
+ const Primitive2DSequence maChildren;
+ const basegfx::B2DRange maReferenceRange;
+
+ protected:
+ /// create local decomposition
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ PatternFillPrimitive2D(
+ const basegfx::B2DPolyPolygon& rMask,
+ const Primitive2DSequence& rChildren,
+ const basegfx::B2DRange& rReferenceRange);
+
+ /// data read access
+ const basegfx::B2DPolyPolygon& getMask() const { return maMask; }
+ const Primitive2DSequence& getChildren() const { return maChildren; }
+ const basegfx::B2DRange& getReferenceRange() const { return maReferenceRange; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PATTERNFILLPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/pointarrayprimitive2d.hxx b/include/drawinglayer/primitive2d/pointarrayprimitive2d.hxx
new file mode 100644
index 000000000000..8acb5956f60f
--- /dev/null
+++ b/include/drawinglayer/primitive2d/pointarrayprimitive2d.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POINTARRAYPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POINTARRAYPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// PointArrayPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** PointArrayPrimitive2D class
+
+ This primitive defines single,discrete 'pixels' for the given
+ positions in the given color. This makes it view-dependent since
+ the logic size of a 'pixel' depends on the view transformation.
+
+ This is one of the non-decomposable primitives, so a renderer
+ should proccess it (Currently it is only used for grid visualisation,
+ but this may change).
+ */
+ class DRAWINGLAYER_DLLPUBLIC PointArrayPrimitive2D : public BasePrimitive2D
+ {
+ private:
+ /// the array of positions
+ std::vector< basegfx::B2DPoint > maPositions;
+
+ /// the color to use
+ basegfx::BColor maRGBColor;
+
+ /// #i96669# add simple range buffering for this primitive
+ basegfx::B2DRange maB2DRange;
+
+ public:
+ /// constructor
+ PointArrayPrimitive2D(
+ const std::vector< basegfx::B2DPoint >& rPositions,
+ const basegfx::BColor& rRGBColor);
+
+ /// data read access
+ const std::vector< basegfx::B2DPoint >& getPositions() const { return maPositions; }
+ const basegfx::BColor& getRGBColor() const { return maRGBColor; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POINTARRAYPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/polygonprimitive2d.hxx b/include/drawinglayer/primitive2d/polygonprimitive2d.hxx
new file mode 100644
index 000000000000..09e5b29039b3
--- /dev/null
+++ b/include/drawinglayer/primitive2d/polygonprimitive2d.hxx
@@ -0,0 +1,310 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYGONPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYGONPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <drawinglayer/attribute/lineattribute.hxx>
+#include <drawinglayer/attribute/strokeattribute.hxx>
+#include <drawinglayer/attribute/linestartendattribute.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// PolygonHairlinePrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** PolygonHairlinePrimitive2D class
+
+ This primitive defines a Hairline. Since hairlines are view-dependent,
+ this primitive is view-dependent, too.
+
+ This is one of the non-decomposable primitives, so a renderer
+ should proccess it.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PolygonHairlinePrimitive2D : public BasePrimitive2D
+ {
+ private:
+ /// the hairline geometry
+ basegfx::B2DPolygon maPolygon;
+
+ /// the hairline color
+ basegfx::BColor maBColor;
+
+ public:
+ /// constructor
+ PolygonHairlinePrimitive2D(
+ const basegfx::B2DPolygon& rPolygon,
+ const basegfx::BColor& rBColor);
+
+ /// data read access
+ const basegfx::B2DPolygon& getB2DPolygon() const { return maPolygon; }
+ const basegfx::BColor& getBColor() const { return maBColor; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// PolygonMarkerPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** PolygonMarkerPrimitive2D class
+
+ This primitive defines a two-colored marker hairline which is
+ dashed with the given dash length. Since hairlines are view-dependent,
+ this primitive is view-dependent, too.
+
+ It will be decomposed to the needed PolygonHairlinePrimitive2D if
+ not handled directly by a renderer.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PolygonMarkerPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the marker hairline geometry
+ basegfx::B2DPolygon maPolygon;
+
+ /// the two colors
+ basegfx::BColor maRGBColorA;
+ basegfx::BColor maRGBColorB;
+
+ /// the dash distance in 'pixels'
+ double mfDiscreteDashLength;
+
+ /// decomposition is view-dependent, remember last InverseObjectToViewTransformation
+ basegfx::B2DHomMatrix maLastInverseObjectToViewTransformation;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ PolygonMarkerPrimitive2D(
+ const basegfx::B2DPolygon& rPolygon,
+ const basegfx::BColor& rRGBColorA,
+ const basegfx::BColor& rRGBColorB,
+ double fDiscreteDashLength);
+
+ /// data read access
+ const basegfx::B2DPolygon& getB2DPolygon() const { return maPolygon; }
+ const basegfx::BColor& getRGBColorA() const { return maRGBColorA; }
+ const basegfx::BColor& getRGBColorB() const { return maRGBColorB; }
+ double getDiscreteDashLength() const { return mfDiscreteDashLength; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// get local decomposition. Overloaded since this decomposition is view-dependent
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// PolygonStrokePrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** PolygonStrokePrimitive2D class
+
+ This primitive defines a line with line width, line join, line color
+ and stroke attributes. It will be decomposed dependent on the definition
+ to the needed primitives, e.g. filled PolyPolygons for fat lines.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PolygonStrokePrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the line geometry
+ basegfx::B2DPolygon maPolygon;
+
+ /// the line attributes like width, join and color
+ attribute::LineAttribute maLineAttribute;
+
+ /// the line stroking (if used)
+ attribute::StrokeAttribute maStrokeAttribute;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ PolygonStrokePrimitive2D(
+ const basegfx::B2DPolygon& rPolygon,
+ const attribute::LineAttribute& rLineAttribute,
+ const attribute::StrokeAttribute& rStrokeAttribute);
+
+ /// constructor without stroking
+ PolygonStrokePrimitive2D(
+ const basegfx::B2DPolygon& rPolygon,
+ const attribute::LineAttribute& rLineAttribute);
+
+ /// data read access
+ const basegfx::B2DPolygon& getB2DPolygon() const { return maPolygon; }
+ const attribute::LineAttribute& getLineAttribute() const { return maLineAttribute; }
+ const attribute::StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// PolygonWavePrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** PolygonWavePrimitive2D class
+
+ This primitive defines a waveline based on a PolygonStrokePrimitive2D
+ where the wave is defined by wave width and wave length.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PolygonWavePrimitive2D : public PolygonStrokePrimitive2D
+ {
+ private:
+ /// wave definition
+ double mfWaveWidth;
+ double mfWaveHeight;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ PolygonWavePrimitive2D(
+ const basegfx::B2DPolygon& rPolygon,
+ const attribute::LineAttribute& rLineAttribute,
+ const attribute::StrokeAttribute& rStrokeAttribute,
+ double fWaveWidth,
+ double fWaveHeight);
+
+ /// constructor without stroking
+ PolygonWavePrimitive2D(
+ const basegfx::B2DPolygon& rPolygon,
+ const attribute::LineAttribute& rLineAttribute,
+ double fWaveWidth,
+ double fWaveHeight);
+
+ /// data read access
+ double getWaveWidth() const { return mfWaveWidth; }
+ double getWaveHeight() const { return mfWaveHeight; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// PolygonStrokeArrowPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** PolygonStrokeArrowPrimitive2D class
+
+ This primitive defines a PolygonStrokePrimitive2D which is extended
+ eventually by start and end definitions which are normally used for
+ arrows.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PolygonStrokeArrowPrimitive2D : public PolygonStrokePrimitive2D
+ {
+ private:
+ /// geometric definitions for line start and end
+ attribute::LineStartEndAttribute maStart;
+ attribute::LineStartEndAttribute maEnd;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ PolygonStrokeArrowPrimitive2D(
+ const basegfx::B2DPolygon& rPolygon,
+ const attribute::LineAttribute& rLineAttribute,
+ const attribute::StrokeAttribute& rStrokeAttribute,
+ const attribute::LineStartEndAttribute& rStart,
+ const attribute::LineStartEndAttribute& rEnd);
+
+ /// data read access
+ const attribute::LineStartEndAttribute& getStart() const { return maStart; }
+ const attribute::LineStartEndAttribute& getEnd() const { return maEnd; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYGONPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/polypolygonprimitive2d.hxx b/include/drawinglayer/primitive2d/polypolygonprimitive2d.hxx
new file mode 100644
index 000000000000..f53d4cdf5759
--- /dev/null
+++ b/include/drawinglayer/primitive2d/polypolygonprimitive2d.hxx
@@ -0,0 +1,382 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYPOLYGONPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYPOLYGONPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <drawinglayer/attribute/fillbitmapattribute.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <drawinglayer/attribute/lineattribute.hxx>
+#include <drawinglayer/attribute/strokeattribute.hxx>
+#include <drawinglayer/attribute/linestartendattribute.hxx>
+#include <drawinglayer/attribute/fillgradientattribute.hxx>
+#include <drawinglayer/attribute/fillhatchattribute.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// PolyPolygonHairlinePrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** PolyPolygonHairlinePrimitive2D class
+
+ This primitive defines a multi-PolygonHairlinePrimitive2D and is
+ just for convenience. The definition is not different from the single
+ defined PolygonHairlinePrimitive2Ds.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PolyPolygonHairlinePrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the hairline geometry
+ basegfx::B2DPolyPolygon maPolyPolygon;
+
+ /// the hairline color
+ basegfx::BColor maBColor;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ PolyPolygonHairlinePrimitive2D(const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::BColor& rBColor);
+
+ /// data read access
+ const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
+ const basegfx::BColor& getBColor() const { return maBColor; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// PolyPolygonMarkerPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** PolyPolygonMarkerPrimitive2D class
+
+ This primitive defines a multi-PolygonMarkerPrimitive2D and is
+ just for convenience. The definition is not different from the single
+ defined PolygonMarkerPrimitive2Ds.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PolyPolygonMarkerPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the marker hairline geometry
+ basegfx::B2DPolyPolygon maPolyPolygon;
+
+ /// the two colors
+ basegfx::BColor maRGBColorA;
+ basegfx::BColor maRGBColorB;
+
+ /// the dash distance in 'pixels'
+ double mfDiscreteDashLength;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ PolyPolygonMarkerPrimitive2D(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const basegfx::BColor& rRGBColorA,
+ const basegfx::BColor& rRGBColorB,
+ double fDiscreteDashLength);
+
+ // data read access
+ const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
+ const basegfx::BColor& getRGBColorA() const { return maRGBColorA; }
+ const basegfx::BColor& getRGBColorB() const { return maRGBColorB; }
+ double getDiscreteDashLength() const { return mfDiscreteDashLength; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// PolyPolygonStrokePrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** PolyPolygonStrokePrimitive2D class
+
+ This primitive defines a multi-PolygonStrokePrimitive2D and is
+ just for convenience. The definition is not different from the single
+ defined PolygonStrokePrimitive2Ds.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PolyPolygonStrokePrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the line geometry
+ basegfx::B2DPolyPolygon maPolyPolygon;
+
+ /// the line attributes like width, join and color
+ attribute::LineAttribute maLineAttribute;
+
+ /// the line stroking (if used)
+ attribute::StrokeAttribute maStrokeAttribute;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ PolyPolygonStrokePrimitive2D(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const attribute::LineAttribute& rLineAttribute,
+ const attribute::StrokeAttribute& rStrokeAttribute);
+
+ PolyPolygonStrokePrimitive2D(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const attribute::LineAttribute& rLineAttribute);
+
+ /// data read access
+ const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
+ const attribute::LineAttribute& getLineAttribute() const { return maLineAttribute; }
+ const attribute::StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// PolyPolygonColorPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** PolyPolygonColorPrimitive2D class
+
+ This primitive defines a PolyPolygon filled with a single color.
+ This is one of the non-decomposable primitives, so a renderer
+ should proccess it.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PolyPolygonColorPrimitive2D : public BasePrimitive2D
+ {
+ private:
+ /// the PolyPolygon geometry
+ basegfx::B2DPolyPolygon maPolyPolygon;
+
+ /// the polygon fill color
+ basegfx::BColor maBColor;
+
+ public:
+ /// constructor
+ PolyPolygonColorPrimitive2D(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const basegfx::BColor& rBColor);
+
+ /// data read access
+ const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
+ const basegfx::BColor& getBColor() const { return maBColor; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// PolyPolygonGradientPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** PolyPolygonColorPrimitive2D class
+
+ This primitive defines a PolyPolygon filled with a gradient. The
+ decomosition will create a MaskPrimitive2D containing a
+ FillGradientPrimitive2D.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PolyPolygonGradientPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the PolyPolygon geometry
+ basegfx::B2DPolyPolygon maPolyPolygon;
+
+ /// the gradient definition
+ attribute::FillGradientAttribute maFillGradient;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ PolyPolygonGradientPrimitive2D(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const attribute::FillGradientAttribute& rFillGradient);
+
+ /// data read access
+ const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
+ const attribute::FillGradientAttribute& getFillGradient() const { return maFillGradient; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// PolyPolygonHatchPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** PolyPolygonHatchPrimitive2D class
+
+ This primitive defines a PolyPolygon filled with a hatch. The
+ decomosition will create a MaskPrimitive2D containing a
+ FillHatchPrimitive2D.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PolyPolygonHatchPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the PolyPolygon geometry
+ basegfx::B2DPolyPolygon maPolyPolygon;
+
+ /// the hatch background color (if used)
+ basegfx::BColor maBackgroundColor;
+
+ /// the hatch definition
+ attribute::FillHatchAttribute maFillHatch;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ PolyPolygonHatchPrimitive2D(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const basegfx::BColor& rBackgroundColor,
+ const attribute::FillHatchAttribute& rFillHatch);
+
+ /// data read access
+ const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
+ const basegfx::BColor& getBackgroundColor() const { return maBackgroundColor; }
+ const attribute::FillHatchAttribute& getFillHatch() const { return maFillHatch; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// PolyPolygonBitmapPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** PolyPolygonBitmapPrimitive2D class
+
+ This primitive defines a PolyPolygon filled with bitmap data
+ (including transparence). The decomosition will create a MaskPrimitive2D
+ containing a FillBitmapPrimitive2D.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PolyPolygonBitmapPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the PolyPolygon geometry
+ basegfx::B2DPolyPolygon maPolyPolygon;
+
+ /// the bitmap fill definition (may include tiling)
+ attribute::FillBitmapAttribute maFillBitmap;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ PolyPolygonBitmapPrimitive2D(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const attribute::FillBitmapAttribute& rFillBitmap);
+
+ /// data read access
+ const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
+ const attribute::FillBitmapAttribute& getFillBitmap() const { return maFillBitmap; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYPOLYGONPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/primitivetools2d.hxx b/include/drawinglayer/primitive2d/primitivetools2d.hxx
new file mode 100644
index 000000000000..6ef63f1e916b
--- /dev/null
+++ b/include/drawinglayer/primitive2d/primitivetools2d.hxx
@@ -0,0 +1,192 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVE2DTOOLS_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVE2DTOOLS_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** DiscreteMetricDependentPrimitive2D class
+
+ tooling class for BufferedDecompositionPrimitive2D baseed classes which are view-dependent
+ regarding the size of a discrete unit. The implementation of get2DDecomposition
+ guards the buffered local decomposition and ensures that a create2DDecomposition
+ implementation may use an up-to-date DiscreteUnit accessible using getDiscreteUnit()
+ */
+ class DRAWINGLAYER_DLLPUBLIC DiscreteMetricDependentPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /** the last used fDiscreteUnit definitions for decomposition. Since this
+ is checked and updated from get2DDecomposition() it will be current and
+ usable in create2DDecomposition()
+ */
+ double mfDiscreteUnit;
+
+ public:
+ /// constructor
+ DiscreteMetricDependentPrimitive2D()
+ : BufferedDecompositionPrimitive2D(),
+ mfDiscreteUnit(0.0)
+ {
+ }
+
+ /// data read access
+ double getDiscreteUnit() const { return mfDiscreteUnit; }
+
+ /// get local decomposition. Overloaded since this decomposition is view-dependent
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** ViewportDependentPrimitive2D class
+
+ tooling class for BufferedDecompositionPrimitive2D baseed classes which are view-dependent
+ regarding the viewport. The implementation of get2DDecomposition
+ guards the buffered local decomposition and ensures that a create2DDecomposition
+ implementation may use an up-to-date Viewport accessible using getViewport()
+ */
+ class DRAWINGLAYER_DLLPUBLIC ViewportDependentPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /** the last used Viewport definition for decomposition. Since this
+ is checked and updated from get2DDecomposition() it will be current and
+ usable in create2DDecomposition()
+ */
+ basegfx::B2DRange maViewport;
+
+ public:
+ /// constructor
+ ViewportDependentPrimitive2D()
+ : BufferedDecompositionPrimitive2D(),
+ maViewport()
+ {
+ }
+
+ /// data read access
+ const basegfx::B2DRange& getViewport() const { return maViewport; }
+
+ /// get local decomposition. Overloaded since this decomposition is view-dependent
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** ViewTransformationDependentPrimitive2D class
+
+ tooling class for BufferedDecompositionPrimitive2D based classes which are view-dependent
+ regarding the complete Viewtransformation. The implementation of get2DDecomposition
+ guards the buffered local decomposition and ensures that a create2DDecomposition
+ implementation may use an up-to-date ViewTransformation accessible using getViewTransformation()
+ */
+ class DRAWINGLAYER_DLLPUBLIC ViewTransformationDependentPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /** the last used ViewTransformation definition for decomposition. Since this
+ is checked and updated from get2DDecomposition() it will be current and
+ usable in create2DDecomposition()
+ */
+ basegfx::B2DHomMatrix maViewTransformation;
+
+ public:
+ /// constructor
+ ViewTransformationDependentPrimitive2D()
+ : BufferedDecompositionPrimitive2D(),
+ maViewTransformation()
+ {
+ }
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getViewTransformation() const { return maViewTransformation; }
+
+ /// get local decomposition. Overloaded since this decomposition is view-dependent
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** ObjectAndViewTransformationDependentPrimitive2D class
+
+ tooling class for BufferedDecompositionPrimitive2D based classes which are view-dependent
+ and Object-Transform dependent. The implementation of get2DDecomposition
+ guards the buffered local decomposition and ensures that a create2DDecomposition
+ implementation may use an up-to-date ViewTransformation accessible using getViewTransformation()
+ and an object transformation via getObjectTransformation()
+ */
+ class DRAWINGLAYER_DLLPUBLIC ObjectAndViewTransformationDependentPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /** the last used ViewTransformation and the last ObjectTransformation
+ definition for decomposition. Since this is checked and updated from
+ get2DDecomposition() it will be current and usable in create2DDecomposition()
+ */
+ basegfx::B2DHomMatrix maViewTransformation;
+ basegfx::B2DHomMatrix maObjectTransformation;
+
+ public:
+ /// constructor
+ ObjectAndViewTransformationDependentPrimitive2D()
+ : BufferedDecompositionPrimitive2D(),
+ maViewTransformation(),
+ maObjectTransformation()
+ {
+ }
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getViewTransformation() const { return maViewTransformation; }
+ const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
+
+ /// get local decomposition. Overloaded since this decomposition is view-dependent
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVE2DTOOLS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/sceneprimitive2d.hxx b/include/drawinglayer/primitive2d/sceneprimitive2d.hxx
new file mode 100644
index 000000000000..d865ba15161a
--- /dev/null
+++ b/include/drawinglayer/primitive2d/sceneprimitive2d.hxx
@@ -0,0 +1,159 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SCENEPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SCENEPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <drawinglayer/primitive3d/baseprimitive3d.hxx>
+#include <drawinglayer/geometry/viewinformation3d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <vcl/bitmapex.hxx>
+#include <drawinglayer/attribute/sdrsceneattribute3d.hxx>
+#include <drawinglayer/attribute/sdrlightingattribute3d.hxx>
+#include <drawinglayer/attribute/sdrlightattribute3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** ScenePrimitive2D class
+
+ This primitive defines a 3D scene as a 2D primitive and is the anchor point
+ for a 3D visualisation. The decomposition is view-dependent and will try to
+ re-use already rendered 3D content.
+
+ The rendering is done using the default-3D renderer from basegfx which supports
+ AntiAliasing.
+
+ The 2D primitive's geometric range is defined completely by the
+ ObjectTransformation combined with evtl. 2D shadows from the 3D objects. The
+ shadows of 3D objects are 2D polygons, projected with the 3D transformation.
+
+ This is the class a renderer may process directly when he wants to implement
+ an own (e.g. system-specific) 3D renderer.
+ */
+ class DRAWINGLAYER_DLLPUBLIC ScenePrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the 3D geometry definition
+ primitive3d::Primitive3DSequence mxChildren3D;
+
+ /// 3D scene attribute set
+ attribute::SdrSceneAttribute maSdrSceneAttribute;
+
+ /// lighting attribute set
+ attribute::SdrLightingAttribute maSdrLightingAttribute;
+
+ /// object transformation for scene for 2D definition
+ basegfx::B2DHomMatrix maObjectTransformation;
+
+ /// scene transformation set and object transformation
+ geometry::ViewInformation3D maViewInformation3D;
+
+ /// the primitiveSequence for on-demand created shadow primitives (see mbShadow3DChecked)
+ Primitive2DSequence maShadowPrimitives;
+
+ /// bitfield
+ /** flag if given 3D geometry is already cheched for shadow definitions and 2d shadows
+ are created in maShadowPrimitives
+ */
+ unsigned mbShadow3DChecked : 1;
+
+ /// the last used NewDiscreteSize and NewUnitVisiblePart definitions for decomposition
+ double mfOldDiscreteSizeX;
+ double mfOldDiscreteSizeY;
+ basegfx::B2DRange maOldUnitVisiblePart;
+
+ /** the last created BitmapEx, e.g. for fast HitTest. This does not really need
+ memory since BitmapEx is internally RefCounted
+ */
+ BitmapEx maOldRenderedBitmap;
+
+ /// private helpers
+ bool impGetShadow3D(const geometry::ViewInformation2D& rViewInformation) const;
+ void calculateDiscreteSizes(
+ const geometry::ViewInformation2D& rViewInformation,
+ basegfx::B2DRange& rDiscreteRange,
+ basegfx::B2DRange& rVisibleDiscreteRange,
+ basegfx::B2DRange& rUnitVisibleRange) const;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// public helpers
+ /** Geometry extractor. Shadow will be added as in create2DDecomposition, but
+ the 3D content is not converted to a bitmap visualisation but to projected 2D gemetry. This
+ helper is useful e.g. for Contour extraction or HitTests.
+ */
+ Primitive2DSequence getGeometry2D() const;
+ Primitive2DSequence getShadow2D(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /** Fast HitTest which uses the last buffered BitmapEx from the last
+ rendered area if available. The return value describes if the check
+ could be done with the current information, so do NOT use o_rResult
+ when it returns false. o_rResult will be changed on return true and
+ then contains a definitive answer if content of this scene is hit or
+ not. On return false, it is normally necessary to use the geometric
+ HitTest (see CutFindProcessor usages). The given HitPoint
+ has to be in logic coordinates in scene's ObjectCoordinateSystem.
+ */
+ bool tryToCheckLastVisualisationDirectHit(const basegfx::B2DPoint& rLogicHitPoint, bool& o_rResult) const;
+
+ /// constructor
+ ScenePrimitive2D(
+ const primitive3d::Primitive3DSequence& rxChildren3D,
+ const attribute::SdrSceneAttribute& rSdrSceneAttribute,
+ const attribute::SdrLightingAttribute& rSdrLightingAttribute,
+ const basegfx::B2DHomMatrix& rObjectTransformation,
+ const geometry::ViewInformation3D& rViewInformation3D);
+
+ /// data read access
+ const primitive3d::Primitive3DSequence& getChildren3D() const { return mxChildren3D; }
+ const attribute::SdrSceneAttribute& getSdrSceneAttribute() const { return maSdrSceneAttribute; }
+ const attribute::SdrLightingAttribute& getSdrLightingAttribute() const { return maSdrLightingAttribute; }
+ const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
+ const geometry::ViewInformation3D& getViewInformation3D() const { return maViewInformation3D; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+
+ /// get local decomposition. Overloaded since this decomposition is view-dependent
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SCENEPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/sdrdecompositiontools2d.hxx b/include/drawinglayer/primitive2d/sdrdecompositiontools2d.hxx
new file mode 100644
index 000000000000..5ac29383ff76
--- /dev/null
+++ b/include/drawinglayer/primitive2d/sdrdecompositiontools2d.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SDRDECOMPOSITIONTOOLS2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SDRDECOMPOSITIONTOOLS2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx {
+ class B2DPolyPolygon;
+ class B2DHomMatrix;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ // helpers to create HitTestPrimitives Line
+ Primitive2DReference DRAWINGLAYER_DLLPUBLIC createHiddenGeometryPrimitives2D(
+ bool bFilled,
+ const basegfx::B2DHomMatrix& rMatrix);
+
+ Primitive2DReference DRAWINGLAYER_DLLPUBLIC createHiddenGeometryPrimitives2D(
+ bool bFilled,
+ const basegfx::B2DPolyPolygon& rPolygon);
+
+ Primitive2DReference DRAWINGLAYER_DLLPUBLIC createHiddenGeometryPrimitives2D(
+ bool bFilled,
+ const basegfx::B2DRange& rRange);
+
+ Primitive2DReference DRAWINGLAYER_DLLPUBLIC createHiddenGeometryPrimitives2D(
+ bool bFilled,
+ const basegfx::B2DRange& rRange,
+ const basegfx::B2DHomMatrix& rMatrix);
+
+ Primitive2DReference DRAWINGLAYER_DLLPUBLIC createHiddenGeometryPrimitives2D(
+ bool bFilled,
+ const basegfx::B2DPolyPolygon& rPolygon,
+ const basegfx::B2DHomMatrix& rMatrix);
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SDRDECOMPOSITIONTOOLS2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/shadowprimitive2d.hxx b/include/drawinglayer/primitive2d/shadowprimitive2d.hxx
new file mode 100644
index 000000000000..956d1a3e2d76
--- /dev/null
+++ b/include/drawinglayer/primitive2d/shadowprimitive2d.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SHADOWPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SHADOWPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** ShadowPrimitive2D class
+
+ This primitive defines a generic shadow geometry construction
+ for 2D objects. It decomposes to a TransformPrimitive2D embedded
+ into a ModifiedColorPrimitive2D.
+
+ It's for primtive usage convenience, so that not everyone has
+ to implement the generic shadow construction by himself.
+
+ The same geometry as sequence of primitives is used as geometry and
+ as shadow. Since these are RefCounted Uno-Api objects, no extra objects
+ are needed for the shadow itself; all the local decompositions of the
+ original geometry can be reused from the renderer for shadow visualisation.
+ */
+ class DRAWINGLAYER_DLLPUBLIC ShadowPrimitive2D : public GroupPrimitive2D
+ {
+ private:
+ /// the shadow transformation, normally just an offset
+ basegfx::B2DHomMatrix maShadowTransform;
+
+ /// the shadow color to which all geometry is to be forced
+ basegfx::BColor maShadowColor;
+
+ public:
+ /// constructor
+ ShadowPrimitive2D(
+ const basegfx::B2DHomMatrix& rShadowTransform,
+ const basegfx::BColor& rShadowColor,
+ const Primitive2DSequence& rChildren);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getShadowTransform() const { return maShadowTransform; }
+ const basegfx::BColor& getShadowColor() const { return maShadowColor; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// create decomposition
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SHADOWPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/structuretagprimitive2d.hxx b/include/drawinglayer/primitive2d/structuretagprimitive2d.hxx
new file mode 100644
index 000000000000..bc2396e5ab23
--- /dev/null
+++ b/include/drawinglayer/primitive2d/structuretagprimitive2d.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_STRUCTURETAGPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_STRUCTURETAGPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <vcl/pdfwriter.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** StructureTagPrimitive2D class
+
+ This class is used to provode simple support for adding grouped
+ pdf writer structured element information like used in sd from
+ unomodel.cxx where a ViewObjectContactRedirector is used to add
+ such information for diverse objects.
+ This primitive encapsulates these and the VCLPdfRenderer uses it
+ to apply the needed infos directly to the pdf export in a compatible
+ way.
+ If a renderer ignores this, it just decomposes to it's child
+ content.
+ */
+ class DRAWINGLAYER_DLLPUBLIC StructureTagPrimitive2D : public GroupPrimitive2D
+ {
+ private:
+ /// the PDF structure element this grouping represents
+ vcl::PDFWriter::StructElement maStructureElement;
+
+ public:
+ /// constructor
+ StructureTagPrimitive2D(
+ const vcl::PDFWriter::StructElement& rStructureElement,
+ const Primitive2DSequence& rChildren);
+
+ /// data read access
+ const vcl::PDFWriter::StructElement& getStructureElement() const { return maStructureElement; }
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_STRUCTURETAGPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/svggradientprimitive2d.hxx b/include/drawinglayer/primitive2d/svggradientprimitive2d.hxx
new file mode 100644
index 000000000000..0e7dab93ff14
--- /dev/null
+++ b/include/drawinglayer/primitive2d/svggradientprimitive2d.hxx
@@ -0,0 +1,413 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SVGGRADIENTPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SVGGRADIENTPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <drawinglayer/primitive2d/primitivetools2d.hxx>
+#include <vector>
+
+//////////////////////////////////////////////////////////////////////////////
+// SvgGradientEntry class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /// a single GradientStop defining a color and opacity at a distance
+ class SvgGradientEntry
+ {
+ private:
+ double mfOffset;
+ basegfx::BColor maColor;
+ double mfOpacity;
+
+ public:
+ SvgGradientEntry(double fOffset, const basegfx::BColor& rColor = basegfx::BColor(0.0, 0.0, 0.0), double fOpacity = 1.0)
+ : mfOffset(fOffset),
+ maColor(rColor),
+ mfOpacity(fOpacity)
+ {
+ }
+
+ double getOffset() const { return mfOffset; }
+ const basegfx::BColor& getColor() const { return maColor; }
+ double getOpacity() const { return mfOpacity; }
+
+ bool operator==(const SvgGradientEntry& rCompare) const
+ {
+ return (getOffset() == rCompare.getOffset()
+ && getColor() == getColor()
+ && getOpacity() == getOpacity());
+ }
+
+ bool operator<(const SvgGradientEntry& rCompare) const
+ {
+ return getOffset() < rCompare.getOffset();
+ }
+ };
+
+ typedef ::std::vector< SvgGradientEntry > SvgGradientEntryVector;
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// SvgGradientHelper class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ enum SpreadMethod
+ {
+ Spread_pad = 0,
+ Spread_reflect,
+ Spread_repeat
+ };
+
+ /* helper for linear and radial gradient, both get derived from this
+ to share common definitions and functionality
+ **/
+ class SvgGradientHelper
+ {
+ private:
+ /// geometric definition, the geometry to be filled
+ basegfx::B2DPolyPolygon maPolyPolygon;
+
+ /// the gradient definition
+ SvgGradientEntryVector maGradientEntries;
+
+ /// start and/or center point
+ basegfx::B2DPoint maStart;
+
+ /// how to spread
+ SpreadMethod maSpreadMethod;
+
+ /// bitfield
+ bool mbPreconditionsChecked : 1;
+ bool mbCreatesContent : 1;
+ bool mbSingleEntry : 1;
+ bool mbFullyOpaque : 1;
+
+ // true = interpret in unit coordinate system -> object aspect ratio will scale result
+ // false = interpret in object coordinate system -> object aspect ratio will not scale result
+ // (related to SVG's gradientUnits (userSpaceOnUse|objectBoundingBox)
+ bool mbUseUnitCoordinates : 1;
+
+ protected:
+ /// local helpers
+ Primitive2DSequence createSingleGradientEntryFill() const;
+ virtual void createAtom(
+ Primitive2DVector& rTargetColor,
+ Primitive2DVector& rTargetOpacity,
+ const SvgGradientEntry& rFrom,
+ const SvgGradientEntry& rTo,
+ sal_Int32 nOffset) const = 0;
+ double createRun(
+ Primitive2DVector& rTargetColor,
+ Primitive2DVector& rTargetOpacity,
+ double fPos,
+ double fMax,
+ const SvgGradientEntryVector& rEntries,
+ sal_Int32 nOffset) const;
+ virtual void checkPreconditions();
+ Primitive2DSequence createResult(
+ const Primitive2DVector& rTargetColor,
+ const Primitive2DVector& rTargetOpacity,
+ const basegfx::B2DHomMatrix& rUnitGradientToObject,
+ bool bInvert = false) const;
+ bool getCreatesContent() const { return mbCreatesContent; }
+ bool getSingleEntry() const { return mbSingleEntry; }
+ void setSingleEntry() { mbSingleEntry = true; }
+ bool getPreconditionsChecked() const { return mbPreconditionsChecked; }
+ bool getFullyOpaque() const { return mbFullyOpaque; }
+
+ public:
+ /// constructor
+ SvgGradientHelper(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const SvgGradientEntryVector& rGradientEntries,
+ const basegfx::B2DPoint& rStart,
+ bool bUseUnitCoordinates,
+ SpreadMethod aSpreadMethod = Spread_pad);
+ virtual ~SvgGradientHelper() {}
+
+ /// data read access
+ const basegfx::B2DPolyPolygon& getPolyPolygon() const { return maPolyPolygon; }
+ const SvgGradientEntryVector& getGradientEntries() const { return maGradientEntries; }
+ const basegfx::B2DPoint& getStart() const { return maStart; }
+ bool getUseUnitCoordinates() const { return mbUseUnitCoordinates; }
+ SpreadMethod getSpreadMethod() const { return maSpreadMethod; }
+
+ /// compare operator
+ bool equalTo(const SvgGradientHelper& rSvgGradientHelper) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// SvgLinearGradientPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /// the basic linear gradient primitive
+ class DRAWINGLAYER_DLLPUBLIC SvgLinearGradientPrimitive2D : public BufferedDecompositionPrimitive2D, public SvgGradientHelper
+ {
+ private:
+ /// the end point for linear gradient
+ basegfx::B2DPoint maEnd;
+
+ protected:
+ /// local helpers
+ virtual void createAtom(
+ Primitive2DVector& rTargetColor,
+ Primitive2DVector& rTargetOpacity,
+ const SvgGradientEntry& rFrom,
+ const SvgGradientEntry& rTo,
+ sal_Int32 nOffset) const;
+ virtual void checkPreconditions();
+
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ SvgLinearGradientPrimitive2D(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const SvgGradientEntryVector& rGradientEntries,
+ const basegfx::B2DPoint& rStart,
+ const basegfx::B2DPoint& rEnd,
+ bool bUseUnitCoordinates,
+ SpreadMethod aSpreadMethod = Spread_pad);
+ virtual ~SvgLinearGradientPrimitive2D();
+
+ /// data read access
+ const basegfx::B2DPoint& getEnd() const { return maEnd; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// SvgRadialGradientPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /// the basic radial gradient primitive
+ class DRAWINGLAYER_DLLPUBLIC SvgRadialGradientPrimitive2D : public BufferedDecompositionPrimitive2D, public SvgGradientHelper
+ {
+ private:
+ /// the geometric definition
+ double mfRadius;
+
+ /// Focal only used when focal is set at all, see constructors
+ basegfx::B2DPoint maFocal;
+ basegfx::B2DVector maFocalVector;
+ double maFocalLength;
+
+ // internal helper for case Spread_reflect
+ SvgGradientEntryVector maMirroredGradientEntries;
+
+ /// bitfield
+ bool mbFocalSet : 1;
+
+ /// local helpers
+ const SvgGradientEntryVector& getMirroredGradientEntries() const;
+ void createMirroredGradientEntries();
+
+ protected:
+ /// local helpers
+ virtual void createAtom(
+ Primitive2DVector& rTargetColor,
+ Primitive2DVector& rTargetOpacity,
+ const SvgGradientEntry& rFrom,
+ const SvgGradientEntry& rTo,
+ sal_Int32 nOffset) const;
+ virtual void checkPreconditions();
+
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ SvgRadialGradientPrimitive2D(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const SvgGradientEntryVector& rGradientEntries,
+ const basegfx::B2DPoint& rStart,
+ double fRadius,
+ bool bUseUnitCoordinates,
+ SpreadMethod aSpreadMethod = Spread_pad,
+ const basegfx::B2DPoint* pFocal = 0);
+ virtual ~SvgRadialGradientPrimitive2D();
+
+ /// data read access
+ double getRadius() const { return mfRadius; }
+ const basegfx::B2DPoint& getFocal() const { return maFocal; }
+ bool isFocalSet() const { return mbFocalSet; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// SvgLinearAtomPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /* basic primitive for a single linear GradientRun in unit coordiantes.
+ It's derived from DiscreteMetricDependentPrimitive2D to allow view-dependent
+ decompositions allowing reduced color steps
+ **/
+ class DRAWINGLAYER_DLLPUBLIC SvgLinearAtomPrimitive2D : public DiscreteMetricDependentPrimitive2D
+ {
+ private:
+ /// the geometric definition in unit coordiantes
+ basegfx::BColor maColorA;
+ basegfx::BColor maColorB;
+ double mfOffsetA;
+ double mfOffsetB;
+
+ protected:
+
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ SvgLinearAtomPrimitive2D(
+ const basegfx::BColor& aColorA, double fOffsetA,
+ const basegfx::BColor& aColorB, double fOffsetB);
+
+ /// data read access
+ const basegfx::BColor& getColorA() const { return maColorA; }
+ const basegfx::BColor& getColorB() const { return maColorB; }
+ double getOffsetA() const { return mfOffsetA; }
+ double getOffsetB() const { return mfOffsetB; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// SvgRadialAtomPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /* basic primitive for a single radial GradientRun in unit coordiantes.
+ It's derived from DiscreteMetricDependentPrimitive2D to allow view-dependent
+ decompositions allowing reduced color steps
+ **/
+ class DRAWINGLAYER_DLLPUBLIC SvgRadialAtomPrimitive2D : public DiscreteMetricDependentPrimitive2D
+ {
+ private:
+ /// the geometric definition in unit coordiantes
+ basegfx::BColor maColorA;
+ basegfx::BColor maColorB;
+ double mfScaleA;
+ double mfScaleB;
+
+ // helper to hold translation vectors when given (for focal)
+ struct VectorPair
+ {
+ basegfx::B2DVector maTranslateA;
+ basegfx::B2DVector maTranslateB;
+
+ VectorPair(const basegfx::B2DVector& rTranslateA, const basegfx::B2DVector& rTranslateB)
+ : maTranslateA(rTranslateA),
+ maTranslateB(rTranslateB)
+ {
+ }
+ };
+
+ /// Only used when focal is set
+ VectorPair* mpTranslate;
+
+ protected:
+
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ SvgRadialAtomPrimitive2D(
+ const basegfx::BColor& aColorA, double fScaleA, const basegfx::B2DVector& rTranslateA,
+ const basegfx::BColor& aColorB, double fScaleB, const basegfx::B2DVector& rTranslateB);
+ SvgRadialAtomPrimitive2D(
+ const basegfx::BColor& aColorA, double fScaleA,
+ const basegfx::BColor& aColorB, double fScaleB);
+ virtual ~SvgRadialAtomPrimitive2D();
+
+ /// data read access
+ const basegfx::BColor& getColorA() const { return maColorA; }
+ const basegfx::BColor& getColorB() const { return maColorB; }
+ double getScaleA() const { return mfScaleA; }
+ double getScaleB() const { return mfScaleB; }
+ bool isTranslateSet() const { return (0 != mpTranslate); }
+ basegfx::B2DVector getTranslateA() const { if(mpTranslate) return mpTranslate->maTranslateA; return basegfx::B2DVector(); }
+ basegfx::B2DVector getTranslateB() const { if(mpTranslate) return mpTranslate->maTranslateB; return basegfx::B2DVector(); }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SVGGRADIENTPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/textbreakuphelper.hxx b/include/drawinglayer/primitive2d/textbreakuphelper.hxx
new file mode 100644
index 000000000000..4a3996353a93
--- /dev/null
+++ b/include/drawinglayer/primitive2d/textbreakuphelper.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTBREAKUPHELPER_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTBREAKUPHELPER_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <drawinglayer/primitive2d/textprimitive2d.hxx>
+#include <drawinglayer/primitive2d/textlayoutdevice.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ enum BreakupUnit
+ {
+ BreakupUnit_character,
+ BreakupUnit_word,
+ BreakupUnit_sentence
+ };
+
+ class DRAWINGLAYER_DLLPUBLIC TextBreakupHelper
+ {
+ private:
+ const TextSimplePortionPrimitive2D& mrSource;
+ Primitive2DSequence mxResult;
+ TextLayouterDevice maTextLayouter;
+ basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose maDecTrans;
+
+ /// bitfield
+ bool mbNoDXArray : 1;
+
+ /// create a portion from nIndex to nLength and append to rTempResult
+ void breakupPortion(Primitive2DVector& rTempResult, sal_uInt32 nIndex, sal_uInt32 nLength, bool bWordLineMode);
+
+ /// breakup complete primitive
+ void breakup(BreakupUnit aBreakupUnit);
+
+ protected:
+ /// allow user callback to allow changes to the new TextTransformation. Default
+ /// does nothing. Retval defines if a primitive gets created, e.g. return false
+ /// to suppress creation
+ virtual bool allowChange(sal_uInt32 nCount, basegfx::B2DHomMatrix& rNewTransform, sal_uInt32 nIndex, sal_uInt32 nLength);
+
+ /// allow read access to evtl. useful local parts
+ const TextLayouterDevice& getTextLayouter() const { return maTextLayouter; }
+ const basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose& getDecTrans() const { return maDecTrans; }
+ const TextSimplePortionPrimitive2D& getSource() const { return mrSource; }
+
+ public:
+ TextBreakupHelper(const TextSimplePortionPrimitive2D& rSource);
+ virtual ~TextBreakupHelper();
+
+ /// get result
+ const Primitive2DSequence& getResult(BreakupUnit aBreakupUnit = BreakupUnit_character) const;
+ };
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTBREAKUPHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx b/include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx
new file mode 100644
index 000000000000..506510958848
--- /dev/null
+++ b/include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx
@@ -0,0 +1,147 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTDECORATEDPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTDECORATEDPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/textprimitive2d.hxx>
+#include <drawinglayer/primitive2d/textenumsprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+namespace basegfx { namespace tools {
+ class B2DHomMatrixBufferedOnDemandDecompose;
+}}
+
+namespace com { namespace sun { namespace star { namespace i18n {
+ struct Boundary;
+}}}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** TextDecoratedPortionPrimitive2D class
+
+ This primitive expands the TextSimplePortionPrimitive2D by common
+ decorations used in the office. It can be decomposed and will create
+ a TextSimplePortionPrimitive2D and all the contained decorations (if used)
+ as geometry.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TextDecoratedPortionPrimitive2D : public TextSimplePortionPrimitive2D
+ {
+ private:
+ /// decoration definitions
+ basegfx::BColor maOverlineColor;
+ basegfx::BColor maTextlineColor;
+ TextLine meFontOverline;
+ TextLine meFontUnderline;
+ TextStrikeout meTextStrikeout;
+ TextEmphasisMark meTextEmphasisMark;
+ TextRelief meTextRelief;
+
+ /// bitfield
+ unsigned mbUnderlineAbove : 1;
+ unsigned mbWordLineMode : 1;
+ unsigned mbEmphasisMarkAbove : 1;
+ unsigned mbEmphasisMarkBelow : 1;
+ unsigned mbShadow : 1;
+
+ /// helper methods
+ void impCreateGeometryContent(
+ std::vector< Primitive2DReference >& rTarget,
+ basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose& rDecTrans,
+ const String& rText,
+ xub_StrLen aTextPosition,
+ xub_StrLen aTextLength,
+ const ::std::vector< double >& rDXArray,
+ const attribute::FontAttribute& rFontAttribute) const;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ TextDecoratedPortionPrimitive2D(
+
+ /// TextSimplePortionPrimitive2D parameters
+ const basegfx::B2DHomMatrix& rNewTransform,
+ const String& rText,
+ xub_StrLen aTextPosition,
+ xub_StrLen aTextLength,
+ const ::std::vector< double >& rDXArray,
+ const attribute::FontAttribute& rFontAttribute,
+ const ::com::sun::star::lang::Locale& rLocale,
+ const basegfx::BColor& rFontColor,
+
+ /// local parameters
+ const basegfx::BColor& rOverlineColor,
+ const basegfx::BColor& rTextlineColor,
+ TextLine eFontOverline = TEXT_LINE_NONE,
+ TextLine eFontUnderline = TEXT_LINE_NONE,
+ bool bUnderlineAbove = false,
+ TextStrikeout eTextStrikeout = TEXT_STRIKEOUT_NONE,
+ bool bWordLineMode = false,
+ TextEmphasisMark eTextEmphasisMark = TEXT_EMPHASISMARK_NONE,
+ bool bEmphasisMarkAbove = true,
+ bool bEmphasisMarkBelow = false,
+ TextRelief eTextRelief = TEXT_RELIEF_NONE,
+ bool bShadow = false);
+
+ /// data read access
+ TextLine getFontOverline() const { return meFontOverline; }
+ TextLine getFontUnderline() const { return meFontUnderline; }
+ TextStrikeout getTextStrikeout() const { return meTextStrikeout; }
+ TextEmphasisMark getTextEmphasisMark() const { return meTextEmphasisMark; }
+ TextRelief getTextRelief() const { return meTextRelief; }
+ const basegfx::BColor& getOverlineColor() const { return maOverlineColor; }
+ const basegfx::BColor& getTextlineColor() const { return maTextlineColor; }
+ bool getUnderlineAbove() const { return mbUnderlineAbove; }
+ bool getWordLineMode() const { return mbWordLineMode; }
+ bool getEmphasisMarkAbove() const { return mbEmphasisMarkAbove; }
+ bool getEmphasisMarkBelow() const { return mbEmphasisMarkBelow; }
+ bool getShadow() const { return mbShadow; }
+
+ /// check if this needs to be a TextDecoratedPortionPrimitive2D or
+ /// if a TextSimplePortionPrimitive2D would be suficcient
+ bool decoratedIsNeeded() const;
+
+ /// compare operator
+ virtual bool operator==( const BasePrimitive2D& rPrimitive ) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTDECORATEDPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/texteffectprimitive2d.hxx b/include/drawinglayer/primitive2d/texteffectprimitive2d.hxx
new file mode 100644
index 000000000000..01fff05473d5
--- /dev/null
+++ b/include/drawinglayer/primitive2d/texteffectprimitive2d.hxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTEFFECTPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTEFFECTPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** TextEffectStyle2D definition */
+ enum TextEffectStyle2D
+ {
+ TEXTEFFECTSTYLE2D_RELIEF_EMBOSSED_DEFAULT,
+ TEXTEFFECTSTYLE2D_RELIEF_ENGRAVED_DEFAULT,
+ TEXTEFFECTSTYLE2D_RELIEF_EMBOSSED,
+ TEXTEFFECTSTYLE2D_RELIEF_ENGRAVED,
+ TEXTEFFECTSTYLE2D_OUTLINE
+ };
+
+ /** TextEffectPrimitive2D class
+
+ This primitive embeds text primitives (normally, as can be seen can
+ also be used for any other primitives) which have some TextEffect applied
+ and create the needed geometry and embedding on decomposition.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TextEffectPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the text (or other) content
+ Primitive2DSequence maTextContent;
+
+ /// the style to apply, the direction and the rotation center
+ const basegfx::B2DPoint maRotationCenter;
+ double mfDirection;
+ TextEffectStyle2D meTextEffectStyle2D;
+
+ /** the last used object to view transformtion used from getDecomposition
+ for decide buffering
+ */
+ basegfx::B2DHomMatrix maLastObjectToViewTransformation;
+
+ protected:
+ /// create local decomposition
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// construcor
+ TextEffectPrimitive2D(
+ const Primitive2DSequence& rTextContent,
+ const basegfx::B2DPoint& rRotationCenter,
+ double fDirection,
+ TextEffectStyle2D eTextEffectStyle2D);
+
+ /// data read access
+ const Primitive2DSequence& getTextContent() const { return maTextContent; }
+ const basegfx::B2DPoint& getRotationCenter() const { return maRotationCenter; }
+ double getDirection() const { return mfDirection; }
+ TextEffectStyle2D getTextEffectStyle2D() const { return meTextEffectStyle2D; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /** own get range implementation to solve more effective. Content is by definition displaced
+ by a fixed discrete unit, thus the contained geometry needs only once be asked for it's
+ own basegfx::B2DRange
+ */
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+
+ /// Overload standard getDecomposition call to be view-dependent here
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTEFFECTPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/textenumsprimitive2d.hxx b/include/drawinglayer/primitive2d/textenumsprimitive2d.hxx
new file mode 100644
index 000000000000..36531e6fce16
--- /dev/null
+++ b/include/drawinglayer/primitive2d/textenumsprimitive2d.hxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTENUMSPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTENUMSPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <vcl/vclenum.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** TextLine definition
+
+ This is used for both underline and overline
+ */
+ enum TextLine
+ {
+ TEXT_LINE_NONE,
+ TEXT_LINE_SINGLE,
+ TEXT_LINE_DOUBLE,
+ TEXT_LINE_DOTTED,
+ TEXT_LINE_DASH,
+ TEXT_LINE_LONGDASH,
+ TEXT_LINE_DASHDOT,
+ TEXT_LINE_DASHDOTDOT,
+ TEXT_LINE_SMALLWAVE,
+ TEXT_LINE_WAVE,
+ TEXT_LINE_DOUBLEWAVE,
+ TEXT_LINE_BOLD,
+ TEXT_LINE_BOLDDOTTED,
+ TEXT_LINE_BOLDDASH,
+ TEXT_LINE_BOLDLONGDASH,
+ TEXT_LINE_BOLDDASHDOT,
+ TEXT_LINE_BOLDDASHDOTDOT,
+ TEXT_LINE_BOLDWAVE
+ };
+
+ /** helper to convert LineStyle */
+ TextLine DRAWINGLAYER_DLLPUBLIC mapFontUnderlineToTextLine(FontUnderline eLineStyle);
+ FontUnderline DRAWINGLAYER_DLLPUBLIC mapTextLineToFontUnderline(TextLine eLineStyle);
+
+ /** FontStrikeout definition */
+ enum TextStrikeout
+ {
+ TEXT_STRIKEOUT_NONE,
+ TEXT_STRIKEOUT_SINGLE,
+ TEXT_STRIKEOUT_DOUBLE,
+ TEXT_STRIKEOUT_BOLD,
+ TEXT_STRIKEOUT_SLASH,
+ TEXT_STRIKEOUT_X
+ };
+
+ /** helper to convert FontStrikeout */
+ TextStrikeout DRAWINGLAYER_DLLPUBLIC mapFontStrikeoutToTextStrikeout(::FontStrikeout eFontStrikeout);
+ ::FontStrikeout DRAWINGLAYER_DLLPUBLIC mapTextStrikeoutToFontStrikeout(TextStrikeout eFontStrikeout);
+
+ /** TextEmphasisMark definition */
+ enum TextEmphasisMark
+ {
+ TEXT_EMPHASISMARK_NONE,
+ TEXT_EMPHASISMARK_DOT,
+ TEXT_EMPHASISMARK_CIRCLE,
+ TEXT_EMPHASISMARK_DISC,
+ TEXT_EMPHASISMARK_ACCENT
+ };
+
+ /** TextRelief definition */
+ enum TextRelief
+ {
+ TEXT_RELIEF_NONE,
+ TEXT_RELIEF_EMBOSSED,
+ TEXT_RELIEF_ENGRAVED
+ };
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTENUMSPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx b/include/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx
new file mode 100644
index 000000000000..e9fb01f094ff
--- /dev/null
+++ b/include/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx
@@ -0,0 +1,212 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTHIERARCHYPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTHIERARCHYPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <tools/string.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** TextHierarchyLinePrimitive2D class
+
+ Text format hierarchy helper class. It decomposes to it's
+ content, so all direct renderers may ignore it. If You need
+ to know more about line hierarchies You may react on it and
+ also need to take care that the source of data uses it.
+
+ This primitive encapsulates text lines.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TextHierarchyLinePrimitive2D : public GroupPrimitive2D
+ {
+ private:
+ public:
+ /// constructor
+ explicit TextHierarchyLinePrimitive2D(const Primitive2DSequence& rChildren);
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** TextHierarchyBulletPrimitive2D class
+
+ This primitive encapsulates text bullets.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TextHierarchyBulletPrimitive2D : public GroupPrimitive2D
+ {
+ private:
+ public:
+ /// constructor
+ explicit TextHierarchyBulletPrimitive2D(const Primitive2DSequence& rChildren);
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** TextHierarchyParagraphPrimitive2D class
+
+ This primitive encapsulates text paragraphs.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TextHierarchyParagraphPrimitive2D : public GroupPrimitive2D
+ {
+ private:
+ public:
+ /// constructor
+ explicit TextHierarchyParagraphPrimitive2D(const Primitive2DSequence& rChildren);
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** TextHierarchyBlockPrimitive2D class
+
+ This primitive encapsulates text blocks.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TextHierarchyBlockPrimitive2D : public GroupPrimitive2D
+ {
+ private:
+ public:
+ /// constructor
+ explicit TextHierarchyBlockPrimitive2D(const Primitive2DSequence& rChildren);
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** FieldType definition */
+ enum FieldType
+ {
+ /** unspecified. If more info is needed for a FieldType,
+ create a new type and it's handling
+ */
+ FIELD_TYPE_COMMON,
+
+ /** uses "FIELD_SEQ_BEGIN;PageField" -> special handling */
+ FIELD_TYPE_PAGE,
+
+ /** uses URL as string -> special handling */
+ FIELD_TYPE_URL
+ };
+
+ /** TextHierarchyFieldPrimitive2D class
+
+ This primitive encapsulates text fields.
+ Also: This type uses a type enum to transport the encapsulated field
+ type. Also added is a String which is type-dependent. E.g. for URL
+ fields, it contains the URL.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TextHierarchyFieldPrimitive2D : public GroupPrimitive2D
+ {
+ private:
+ FieldType meType;
+ OUString maString;
+
+ public:
+ /// constructor
+ TextHierarchyFieldPrimitive2D(
+ const Primitive2DSequence& rChildren,
+ const FieldType& rFieldType,
+ const OUString& rString);
+
+ /// data read access
+ FieldType getType() const { return meType; }
+ const OUString& getString() const { return maString; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** TextHierarchyEditPrimitive2D class
+
+ #i97628#
+ Primitive to encapsulate text from an active text edit; some
+ renderers need to suppress this output due to painting the
+ edited text in e.g. an OutlinerEditView. It's derived from
+ GroupPrimitive2D, so the implicit decomposition will use the
+ content. To suppress, this primitive needs to be parsed by
+ the renderer without taking any action.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TextHierarchyEditPrimitive2D : public GroupPrimitive2D
+ {
+ private:
+ public:
+ /// constructor
+ explicit TextHierarchyEditPrimitive2D(const Primitive2DSequence& rChildren);
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTHIERARCHYPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/textlayoutdevice.hxx b/include/drawinglayer/primitive2d/textlayoutdevice.hxx
new file mode 100644
index 000000000000..a0338a371aad
--- /dev/null
+++ b/include/drawinglayer/primitive2d/textlayoutdevice.hxx
@@ -0,0 +1,155 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_TEXTLAYOUTDEVICE_HXX
+#define INCLUDED_DRAWINGLAYER_TEXTLAYOUTDEVICE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <tools/solar.h>
+#include <tools/poly.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <vector>
+#include <com/sun/star/lang/Locale.hpp>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+class VirtualDevice;
+class Font;
+class String;
+class OutputDevice;
+class GDIMetaFile;
+
+namespace drawinglayer { namespace attribute {
+ class FontAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+// access to one global impTimedRefDev incarnation in namespace drawinglayer::primitive
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** TextLayouterDevice class
+
+ This helper class exists to isolate all accesses to VCL
+ text formatting/handling functionality for primitive implementations.
+ When in the future FontHandling may move to an own library independent
+ from VCL, primitives will be prepared.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TextLayouterDevice
+ {
+ /// internally used VirtualDevice
+ VirtualDevice& mrDevice;
+
+ public:
+ /// constructor/destructor
+ TextLayouterDevice();
+ ~TextLayouterDevice();
+
+ /// tooling methods
+ void setFont(const Font& rFont);
+ void setFontAttribute(
+ const attribute::FontAttribute& rFontAttribute,
+ double fFontScaleX,
+ double fFontScaleY,
+ const ::com::sun::star::lang::Locale & rLocale);
+
+ double getTextHeight() const;
+ double getOverlineHeight() const;
+ double getOverlineOffset() const;
+ double getUnderlineHeight() const;
+ double getUnderlineOffset() const;
+ double getStrikeoutOffset() const;
+
+ double getTextWidth(
+ const String& rText,
+ sal_uInt32 nIndex,
+ sal_uInt32 nLength) const;
+
+ bool getTextOutlines(
+ basegfx::B2DPolyPolygonVector&,
+ const String& rText,
+ sal_uInt32 nIndex,
+ sal_uInt32 nLength,
+ const ::std::vector< double >& rDXArray) const;
+
+ basegfx::B2DRange getTextBoundRect(
+ const String& rText,
+ sal_uInt32 nIndex,
+ sal_uInt32 nLength) const;
+
+ double getFontAscent() const;
+ double getFontDescent() const;
+
+ void addTextRectActions(
+ const Rectangle& rRectangle,
+ const String& rText,
+ sal_uInt16 nStyle,
+ GDIMetaFile& rGDIMetaFile) const;
+
+ ::std::vector< double > getTextArray(
+ const String& rText,
+ sal_uInt32 nIndex,
+ sal_uInt32 nLength) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// helper methods for vcl font handling
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** Create a VCL-Font based on the definitions in FontAttribute
+ and the given FontScaling. The FontScaling defines the FontHeight
+ (fFontScaleY) and the FontWidth (fFontScaleX). The combination of
+ both defines FontStretching, where no stretching happens at
+ fFontScaleY == fFontScaleX
+ */
+ Font DRAWINGLAYER_DLLPUBLIC getVclFontFromFontAttribute(
+ const attribute::FontAttribute& rFontAttribute,
+ double fFontScaleX,
+ double fFontScaleY,
+ double fFontRotation,
+ const ::com::sun::star::lang::Locale & rLocale);
+
+ /** Generate FontAttribute DataSet derived from the given VCL-Font.
+ The FontScaling with fFontScaleY, fFontScaleX relationship (see
+ above) will be set in return parameter o_rSize to allow further
+ processing
+ */
+ attribute::FontAttribute DRAWINGLAYER_DLLPUBLIC getFontAttributeFromVclFont(
+ basegfx::B2DVector& o_rSize,
+ const Font& rFont,
+ bool bRTL,
+ bool bBiDiStrong);
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_DRAWINGLAYER_TEXTLAYOUTDEVICE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/textlineprimitive2d.hxx b/include/drawinglayer/primitive2d/textlineprimitive2d.hxx
new file mode 100644
index 000000000000..6bcca85a8bc2
--- /dev/null
+++ b/include/drawinglayer/primitive2d/textlineprimitive2d.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTLINEPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTLINEPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <drawinglayer/primitive2d/textenumsprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class DRAWINGLAYER_DLLPUBLIC TextLinePrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// geometric definitions
+ basegfx::B2DHomMatrix maObjectTransformation;
+ double mfWidth;
+ double mfOffset;
+ double mfHeight;
+
+ /// decoration definitions
+ TextLine meTextLine;
+ basegfx::BColor maLineColor;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ TextLinePrimitive2D(
+ const basegfx::B2DHomMatrix& rObjectTransformation,
+ double fWidth,
+ double fOffset,
+ double fHeight,
+ TextLine eTextLine,
+ const basegfx::BColor& rLineColor);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
+ double getWidth() const { return mfWidth; }
+ double getOffset() const { return mfOffset; }
+ double getHeight() const { return mfHeight; }
+ TextLine getTextLine() const { return meTextLine; }
+ const basegfx::BColor& getLineColor() const { return maLineColor; }
+
+ /// compare operator
+ virtual bool operator==( const BasePrimitive2D& rPrimitive ) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTLINEPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/textprimitive2d.hxx b/include/drawinglayer/primitive2d/textprimitive2d.hxx
new file mode 100644
index 000000000000..5a12e2bc678f
--- /dev/null
+++ b/include/drawinglayer/primitive2d/textprimitive2d.hxx
@@ -0,0 +1,181 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <tools/string.hxx>
+#include <vcl/font.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <vector>
+#include <com/sun/star/lang/Locale.hpp>
+#include <drawinglayer/attribute/fontattribute.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+class OutputDevice;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** TextSimplePortionPrimitive2D class
+
+ This is the basic primitive for representing a text portion. It contains
+ all needed information. If it is not handled by a renderer, it's decomposition
+ will provide the text PolyPolygon outlines as filled polygons, correctly
+ transformed.
+
+ To get better text quality, it is suggested to handle tis primitive directly
+ in a renderer. In that case, e.g. hintings on the system can be supported.
+
+ @param maTextTransform
+ The text transformation contains the text start position (always baselined)
+ as translation, the FontSize as scale (where width relative to height defines
+ font scaling and width == height means no font scaling) and the font rotation
+ and shear.
+ When shear is used and a renderer does not support it, it may be better to use
+ the decomposition which will do everything correctly. Same is true for mirroring
+ which would be expressed as negative scalings.
+
+ @param rText
+ The text to be used. Only a part may be used, but a bigger part of the string
+ may be necessary for correct layouting (e.g. international)
+
+ @param aTextPosition
+ The index to the first character to use from rText
+
+ @param aTextLength
+ The number of characters to use from rText
+
+ @param rDXArray
+ The distances between the characters. This parameter may be empty, in that case
+ the renderer is responsible to do something useful. If it is given, it has to be of
+ the size aTextLength. Its values are in logical coordinates and describe the
+ distance for each character to use. This is independent from the font width which
+ is given with maTextTransform. The first value is the offset to use from the start
+ point in FontCoordinateSystem X-Direction (given by maTextTransform) to the start
+ point of the second character
+
+ @param rFontAttribute
+ The font definition
+
+ @param rLocale
+ The locale to use
+
+ @param rFontColor
+ The font color to use
+ */
+ class DRAWINGLAYER_DLLPUBLIC TextSimplePortionPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// text transformation (FontCoordinateSystem)
+ basegfx::B2DHomMatrix maTextTransform;
+
+ /// The text, used from maTextPosition up to maTextPosition + maTextLength
+ String maText;
+
+ /// The index from where on maText is used
+ xub_StrLen maTextPosition;
+
+ /// The length for maText usage, starting from maTextPosition
+ xub_StrLen maTextLength;
+
+ /// The DX array in logic units
+ ::std::vector< double > maDXArray;
+
+ /// The font definition
+ attribute::FontAttribute maFontAttribute;
+
+ /// The Locale for the text
+ ::com::sun::star::lang::Locale maLocale;
+
+ /// font color
+ basegfx::BColor maFontColor;
+
+ /// #i96669# internal: add simple range buffering for this primitive
+ basegfx::B2DRange maB2DRange;
+ bool mbFilled; // Whether to fill a given width with the text
+ long mnWidthToFill; // the width to fill
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ TextSimplePortionPrimitive2D(
+ const basegfx::B2DHomMatrix& rNewTransform,
+ const String& rText,
+ xub_StrLen aTextPosition,
+ xub_StrLen aTextLength,
+ const ::std::vector< double >& rDXArray,
+ const attribute::FontAttribute& rFontAttribute,
+ const ::com::sun::star::lang::Locale& rLocale,
+ const basegfx::BColor& rFontColor,
+ bool bFilled = false,
+ long nWidthToFill = 0);
+
+ /// helpers
+ /** get text outlines as polygons and their according ObjectTransformation. Handles all
+ the necessary VCL outline extractins, scaling adaptions and other stuff.
+ */
+ void getTextOutlinesAndTransformation(basegfx::B2DPolyPolygonVector& rTarget, basegfx::B2DHomMatrix& rTransformation) const;
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getTextTransform() const { return maTextTransform; }
+ const String& getText() const { return maText; }
+ xub_StrLen getTextPosition() const { return maTextPosition; }
+ xub_StrLen getTextLength() const { return maTextLength; }
+ const ::std::vector< double >& getDXArray() const { return maDXArray; }
+ const attribute::FontAttribute& getFontAttribute() const { return maFontAttribute; }
+ const ::com::sun::star::lang::Locale& getLocale() const { return maLocale; }
+ const basegfx::BColor& getFontColor() const { return maFontColor; }
+ bool isFilled() const { return mbFilled; }
+ long getWidthToFill() const { return mnWidthToFill; }
+
+ /// compare operator
+ virtual bool operator==( const BasePrimitive2D& rPrimitive ) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+
+ /// small helper to have a compare operator for Locale
+ bool DRAWINGLAYER_DLLPUBLIC LocalesAreEqual(const ::com::sun::star::lang::Locale& rA, const ::com::sun::star::lang::Locale& rB);
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/textstrikeoutprimitive2d.hxx b/include/drawinglayer/primitive2d/textstrikeoutprimitive2d.hxx
new file mode 100644
index 000000000000..216fe740933a
--- /dev/null
+++ b/include/drawinglayer/primitive2d/textstrikeoutprimitive2d.hxx
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTSTRIKEOUTPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTSTRIKEOUTPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <drawinglayer/primitive2d/textenumsprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <drawinglayer/attribute/fontattribute.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class DRAWINGLAYER_DLLPUBLIC BaseTextStrikeoutPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// geometric definitions
+ basegfx::B2DHomMatrix maObjectTransformation;
+ double mfWidth;
+
+ /// decoration definitions
+ basegfx::BColor maFontColor;
+
+ public:
+ /// constructor
+ BaseTextStrikeoutPrimitive2D(
+ const basegfx::B2DHomMatrix& rObjectTransformation,
+ double fWidth,
+ const basegfx::BColor& rFontColor);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
+ double getWidth() const { return mfWidth; }
+ const basegfx::BColor& getFontColor() const { return maFontColor; }
+
+ /// compare operator
+ virtual bool operator==( const BasePrimitive2D& rPrimitive ) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class DRAWINGLAYER_DLLPUBLIC TextCharacterStrikeoutPrimitive2D : public BaseTextStrikeoutPrimitive2D
+ {
+ private:
+ sal_Unicode maStrikeoutChar;
+ attribute::FontAttribute maFontAttribute;
+ ::com::sun::star::lang::Locale maLocale;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ TextCharacterStrikeoutPrimitive2D(
+ const basegfx::B2DHomMatrix& rObjectTransformation,
+ double fWidth,
+ const basegfx::BColor& rFontColor,
+ sal_Unicode aStrikeoutChar,
+ const attribute::FontAttribute& rFontAttribute,
+ const ::com::sun::star::lang::Locale& rLocale);
+
+ /// data read access
+ sal_Unicode getStrikeoutChar() const { return maStrikeoutChar; }
+ const attribute::FontAttribute& getFontAttribute() const { return maFontAttribute; }
+ const ::com::sun::star::lang::Locale& getLocale() const { return maLocale; }
+
+ /// compare operator
+ virtual bool operator==( const BasePrimitive2D& rPrimitive ) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class DRAWINGLAYER_DLLPUBLIC TextGeometryStrikeoutPrimitive2D : public BaseTextStrikeoutPrimitive2D
+ {
+ private:
+ double mfHeight;
+ double mfOffset;
+ TextStrikeout meTextStrikeout;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ TextGeometryStrikeoutPrimitive2D(
+ const basegfx::B2DHomMatrix& rObjectTransformation,
+ double fWidth,
+ const basegfx::BColor& rFontColor,
+ double fHeight,
+ double fOffset,
+ TextStrikeout eTextStrikeout);
+
+ /// data read access
+ double getHeight() const { return mfHeight; }
+ double getOffset() const { return mfOffset; }
+ TextStrikeout getTextStrikeout() const { return meTextStrikeout; }
+
+ /// compare operator
+ virtual bool operator==( const BasePrimitive2D& rPrimitive ) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTSTRIKEOUTPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/transformprimitive2d.hxx b/include/drawinglayer/primitive2d/transformprimitive2d.hxx
new file mode 100644
index 000000000000..e58c530fa71f
--- /dev/null
+++ b/include/drawinglayer/primitive2d/transformprimitive2d.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TRANSFORMPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TRANSFORMPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** TransformPrimitive2D class
+
+ This is one of the basic grouping primitives and it provides
+ embedding a sequence of primitives (a geometry) into a
+ transformation. All renderers have to handle this, usually by
+ building a current transformation stack (linear combination)
+ and applying this to all to-be-rendered geometry. If not handling
+ this, the output will be mostly wrong since this primitive is
+ widely used.
+
+ It does transform by embedding an existing geometry into a
+ transformation as Child-content. This allows re-usage of the
+ refcounted Uno-Api primitives and their existung, buffered
+ decompositions.
+
+ It could e.g. be used to show a single object geometry in 1000
+ different, transformed states without the need to create those
+ thousand primitive contents.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TransformPrimitive2D : public GroupPrimitive2D
+ {
+ private:
+ // the transformation to apply to the child geometry
+ basegfx::B2DHomMatrix maTransformation;
+
+ public:
+ /// constructor
+ TransformPrimitive2D(
+ const basegfx::B2DHomMatrix& rTransformation,
+ const Primitive2DSequence& rChildren);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getTransformation() const { return maTransformation; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TRANSFORMPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/transparenceprimitive2d.hxx b/include/drawinglayer/primitive2d/transparenceprimitive2d.hxx
new file mode 100644
index 000000000000..1c742da909d3
--- /dev/null
+++ b/include/drawinglayer/primitive2d/transparenceprimitive2d.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TRANSPARENCEPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TRANSPARENCEPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** TransparencePrimitive2D class
+
+ This is the basic primitive for applying freely defined transparence
+ to freely defined content. The basic idea is to associate a content
+ which is defined as a sequence of primitives and hold as child content
+ in the GroupPrimitive2D with a transparence channel also defined as a sequence
+ of primitives and hold in the transparence member.
+
+ The basic definition is to use the transparence content as transparence-Mask by
+ interpreting the transparence-content not as RGB, but as Luminance transparence mask
+ using the common RGB_to_luminance definition as e.g. used by VCL.
+
+ The defining geometry is the Range of the child primitive sequence,
+ this means the renderers will/shall use this geometric information for
+ rendering, not the transparent one. The transparent one should/will be clipped
+ accordingly.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TransparencePrimitive2D : public GroupPrimitive2D
+ {
+ private:
+ /// The transparence-Mask who's RGB-Values are interpreted as Luminance
+ Primitive2DSequence maTransparence;
+
+ public:
+ /** constructor
+
+ @param rChildren
+ The content which is defined to have a transparency. The
+ range of this primitive is defined by this content
+
+ @param rTransparence
+ The definition of the Transparence-channel for this primitive. It
+ will be interpreted as mask by interpreting as gray values
+ using the common RGB_to_luminance definitions
+ */
+ TransparencePrimitive2D(
+ const Primitive2DSequence& rChildren,
+ const Primitive2DSequence& rTransparence);
+
+ /// data read access
+ const Primitive2DSequence& getTransparence() const { return maTransparence; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TRANSPARENCEPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx b/include/drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx
new file mode 100644
index 000000000000..e30de32107f6
--- /dev/null
+++ b/include/drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_UNIFIEDTRANSPARENCEPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_UNIFIEDTRANSPARENCEPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** UnifiedTransparencePrimitive2D class
+
+ This primitive encapsualtes a child hierarchy and defines
+ that it shall be visualized with the given transparency. That
+ transparency is unique for all contained geometry, so that
+ e.g. overlapping polygons in the child geometry will not show
+ regions of combined transparency, but be all rendered with the
+ defined, single transparency.
+ */
+ class DRAWINGLAYER_DLLPUBLIC UnifiedTransparencePrimitive2D : public GroupPrimitive2D
+ {
+ private:
+ /// the unified transparence
+ double mfTransparence;
+
+ public:
+ /// constructor
+ UnifiedTransparencePrimitive2D(
+ const Primitive2DSequence& rChildren,
+ double fTransparence);
+
+ /// data read access
+ double getTransparence() const { return mfTransparence; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// own getB2DRange implementation to include transparent geometries to BoundRect calculations
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// create decomposition
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_UNIFIEDTRANSPARENCEPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/wallpaperprimitive2d.hxx b/include/drawinglayer/primitive2d/wallpaperprimitive2d.hxx
new file mode 100644
index 000000000000..0e370b74dab0
--- /dev/null
+++ b/include/drawinglayer/primitive2d/wallpaperprimitive2d.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_WALLPAPERPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_WALLPAPERPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/primitivetools2d.hxx>
+#include <vcl/bitmapex.hxx>
+#include <vcl/wall.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** WallpaperBitmapPrimitive2D class
+
+ This is a specialized primtive for the Wallpaper definitions included in
+ VCL and Metafiles. The extraordinary about the bitmap definition part of
+ the Wallpaper is that it uses PIXEL size of the given Bitmap and not
+ the logic and/or discrete size derived by PrefMapMode/PrefSize methods.
+ To emulate this, a ViewTransformation dependent primitive is needed which
+ takes over the correct scaling(s).
+
+ Since a specialized primitive is needed anyways, i opted to also add the
+ layouting which is dependent from WallpaperStyle; thus it does not need
+ to be handled anywhere else in the future.
+ */
+ class DRAWINGLAYER_DLLPUBLIC WallpaperBitmapPrimitive2D : public ViewTransformationDependentPrimitive2D
+ {
+ private:
+ basegfx::B2DRange maObjectRange;
+ BitmapEx maBitmapEx;
+ WallpaperStyle meWallpaperStyle;
+
+ protected:
+ /// create local decomposition
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ WallpaperBitmapPrimitive2D(
+ const basegfx::B2DRange& rObjectRange,
+ const BitmapEx& rBitmapEx,
+ WallpaperStyle eWallpaperStyle);
+
+ /// data read access
+ const basegfx::B2DRange& getLocalObjectRange() const { return maObjectRange; }
+ const BitmapEx& getBitmapEx() const { return maBitmapEx ; }
+ WallpaperStyle getWallpaperStyle() const { return meWallpaperStyle; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get B2Drange
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_WALLPAPERPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/wrongspellprimitive2d.hxx b/include/drawinglayer/primitive2d/wrongspellprimitive2d.hxx
new file mode 100644
index 000000000000..cafd40f40aa3
--- /dev/null
+++ b/include/drawinglayer/primitive2d/wrongspellprimitive2d.hxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_WRONGSPELLPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_WRONGSPELLPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// WrongSpellPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** WrongSpellPrimitive2D class
+
+ This is a helper primitive to hold evtl. WrongSpell visualisations
+ in the sequence of primitives. The primitive holds this information
+ separated form the TextPortions to where it belongs to tot expand the
+ TextSimplePortionPrimitive2D more as needed.
+
+ A renderer who does not want to visualize this (if contained at all)
+ can detect and ignore this primitive. If it's decomposition is used,
+ it will be visualized as red wavelines.
+
+ The geometric definition defines a line on the X-Axis (no Y-coordinates)
+ which will when transformed by Transformation, create the coordinate data.
+ */
+ class DRAWINGLAYER_DLLPUBLIC WrongSpellPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// geometry definition
+ basegfx::B2DHomMatrix maTransformation;
+ double mfStart;
+ double mfStop;
+
+ /// color (usually red)
+ basegfx::BColor maColor;
+
+ protected:
+ /// create local decomposition
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ WrongSpellPrimitive2D(
+ const basegfx::B2DHomMatrix& rTransformation,
+ double fStart,
+ double fStop,
+ const basegfx::BColor& rColor);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getTransformation() const { return maTransformation; }
+ double getStart() const { return mfStart; }
+ double getStop() const { return mfStop; }
+ const basegfx::BColor& getColor() const { return maColor; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_WRONGSPELLPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/baseprimitive3d.hxx b/include/drawinglayer/primitive3d/baseprimitive3d.hxx
new file mode 100644
index 000000000000..974c47d9e485
--- /dev/null
+++ b/include/drawinglayer/primitive3d/baseprimitive3d.hxx
@@ -0,0 +1,213 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_BASEPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_BASEPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <cppuhelper/compbase1.hxx>
+#include <boost/utility.hpp>
+#include <com/sun/star/graphic/XPrimitive3D.hpp>
+#include <comphelper/broadcasthelper.hxx>
+#include <basegfx/range/b3drange.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+/** defines for DeclPrimitrive3DIDBlock and ImplPrimitrive3DIDBlock
+ Added to be able to simply change identification stuff later, e.g. add
+ a identification string and/or ID to the interface and to the implementation
+ ATM used to delclare implement getPrimitive3DID()
+ */
+
+#define DeclPrimitrive3DIDBlock() \
+ virtual sal_uInt32 getPrimitive3DID() const;
+
+#define ImplPrimitrive3DIDBlock(TheClass, TheID) \
+ sal_uInt32 TheClass::getPrimitive3DID() const { return TheID; }
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace drawinglayer { namespace geometry {
+ class ViewInformation3D;
+}}
+
+namespace drawinglayer { namespace primitive3d {
+ /// typedefs for basePrimitive3DImplBase, Primitive3DSequence and Primitive3DReference
+ typedef cppu::WeakComponentImplHelper1< ::com::sun::star::graphic::XPrimitive3D > BasePrimitive3DImplBase;
+ typedef ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XPrimitive3D > Primitive3DReference;
+ typedef ::com::sun::star::uno::Sequence< Primitive3DReference > Primitive3DSequence;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+// basePrimitive3D class
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** BasePrimitive3D class
+
+ Baseclass for all C++ implementations of com::sun::star::graphic::XPrimitive2D
+
+ The description/functionality is identical with the 2D case in baseprimitive2d.hxx,
+ please see there for detailed information.
+
+ Current Basic 3D Primitives are:
+
+ - PolygonHairlinePrimitive3D (for 3D hairlines)
+ - PolyPolygonMaterialPrimitive3D (for 3D filled plane polygons)
+
+ That's all for 3D!
+ */
+ class DRAWINGLAYER_DLLPUBLIC BasePrimitive3D
+ : private boost::noncopyable,
+ protected comphelper::OBaseMutex,
+ public BasePrimitive3DImplBase
+ {
+ private:
+ protected:
+ public:
+ // constructor/destructor
+ BasePrimitive3D();
+ virtual ~BasePrimitive3D();
+
+ /** the ==operator is mainly needed to allow testing newly-created high level primitives against their last
+ incarnation which buffers/holds the decompositionsThe default implementation
+ uses getPrimitive3DID()-calls to test if it's the same ID at last. Overloaded implementation are then
+ based on this implementation.
+ */
+ virtual bool operator==( const BasePrimitive3D& rPrimitive ) const;
+ bool operator!=( const BasePrimitive3D& rPrimitive ) const { return !operator==(rPrimitive); }
+
+ /** This method is for places where using the C++ implementation directly is possible. The subprocessing
+ and range merging is more efficient when working directly on basegfx::B3DRange. The default implementation
+ will use getDecomposition results to create the range
+ */
+ virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /** provide unique ID for fast identifying of known primitive implementations in renderers. These use
+ the defines from primitivetypes3d.hxx to define unique IDs.
+ */
+ virtual sal_uInt32 getPrimitive3DID() const = 0;
+
+ /// The default implementation returns an empty sequence
+ virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+ //
+ // Methods from XPrimitive3D
+ //
+
+ /** The getDecomposition implementation for UNO API will use getDecomposition from this implementation. It
+ will get the ViewInformation from the ViewParameters for that purpose
+ */
+ virtual Primitive3DSequence SAL_CALL getDecomposition( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rViewParameters ) throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** the getRange default implemenation will use getDecomposition to create the range information from merging
+ getRange results from the single local decomposition primitives.
+ */
+ virtual ::com::sun::star::geometry::RealRectangle3D SAL_CALL getRange( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rViewParameters ) throw ( ::com::sun::star::uno::RuntimeException );
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// BufferedDecompositionPrimitive3D class
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** BufferedDecompositionPrimitive3D class
+
+ Baseclass for all C++ implementations of com::sun::star::graphic::XPrimitive2D
+
+ The description/functionality is identical with the 2D case in baseprimitive2d.hxx,
+ please see there for detailed information
+ */
+ class DRAWINGLAYER_DLLPUBLIC BufferedDecompositionPrimitive3D
+ : public BasePrimitive3D
+ {
+ private:
+ /// a sequence used for buffering the last create3DDecomposition() result
+ Primitive3DSequence maBuffered3DDecomposition;
+
+ protected:
+ /** access methods to maBuffered3DDecomposition. The usage of this methods may allow
+ later thread-safe stuff to be added if needed. Only to be used by getDecomposition()
+ implementations for buffering the last decomposition.
+ */
+ const Primitive3DSequence& getBuffered3DDecomposition() const { return maBuffered3DDecomposition; }
+ void setBuffered3DDecomposition(const Primitive3DSequence& rNew) { maBuffered3DDecomposition = rNew; }
+
+ /** method which is to be used to implement the local decomposition of a 2D primitive. The default
+ implementation will just return an empty decomposition
+ */
+ virtual Primitive3DSequence create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+ public:
+ // constructor
+ BufferedDecompositionPrimitive3D();
+
+ /** The getDecomposition default implementation will on demand use create3DDecomposition() if
+ maBuffered3DDecomposition is empty. It will set maBuffered3DDecomposition to this obtained decomposition
+ to buffer it. If the decomposition is also ViewInformation-dependent, this method needs to be
+ overloaded and the ViewInformation for the last decomposition needs to be remembered, too, and
+ be used in the next call to decide if the buffered decomposition may be reused or not.
+ */
+ virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// tooling
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /// get B3DRange from a given Primitive3DReference
+ basegfx::B3DRange DRAWINGLAYER_DLLPUBLIC getB3DRangeFromPrimitive3DReference(const Primitive3DReference& rCandidate, const geometry::ViewInformation3D& aViewInformation);
+
+ /// get range3D from a given Primitive3DSequence
+ basegfx::B3DRange DRAWINGLAYER_DLLPUBLIC getB3DRangeFromPrimitive3DSequence(const Primitive3DSequence& rCandidate, const geometry::ViewInformation3D& aViewInformation);
+
+ /** compare two Primitive2DReferences for equality, including trying to get implementations (BasePrimitive2D)
+ and using compare operator
+ */
+ bool DRAWINGLAYER_DLLPUBLIC arePrimitive3DReferencesEqual(const Primitive3DReference& rA, const Primitive3DReference& rB);
+
+ /// compare two Primitive3DReferences for equality, uses arePrimitive3DReferencesEqual internally
+ bool DRAWINGLAYER_DLLPUBLIC arePrimitive3DSequencesEqual(const Primitive3DSequence& rA, const Primitive3DSequence& rB);
+
+ /// concatenate sequence
+ void DRAWINGLAYER_DLLPUBLIC appendPrimitive3DSequenceToPrimitive3DSequence(Primitive3DSequence& rDest, const Primitive3DSequence& rSource);
+
+ /// concatenate single Primitive3D
+ void DRAWINGLAYER_DLLPUBLIC appendPrimitive3DReferenceToPrimitive3DSequence(Primitive3DSequence& rDest, const Primitive3DReference& rSource);
+
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_BASEPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx b/include/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx
new file mode 100644
index 000000000000..3be15ad5e8bb
--- /dev/null
+++ b/include/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_PRIMITIVETYPES3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_PRIMITIVETYPES3D_HXX
+
+//////////////////////////////////////////////////////////////////////////////
+// define ranges for other libraries
+
+#define PRIMITIVE3D_ID_RANGE_DRAWINGLAYER (0 << 16)
+
+//////////////////////////////////////////////////////////////////////////////
+// local primitives
+
+#define PRIMITIVE3D_ID_GROUPPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 0)
+#define PRIMITIVE3D_ID_HATCHTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 1)
+#define PRIMITIVE3D_ID_MODIFIEDCOLORPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 2)
+#define PRIMITIVE3D_ID_POLYGONHAIRLINEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 3)
+#define PRIMITIVE3D_ID_POLYGONSTROKEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 4)
+#define PRIMITIVE3D_ID_POLYGONTUBEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 5)
+#define PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 6)
+#define PRIMITIVE3D_ID_SDRCUBEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 7)
+#define PRIMITIVE3D_ID_SDREXTRUDEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 8)
+#define PRIMITIVE3D_ID_SDRLATHEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 9)
+#define PRIMITIVE3D_ID_SDRPOLYPOLYGONPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 10)
+#define PRIMITIVE3D_ID_SDRSPHEREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 11)
+#define PRIMITIVE3D_ID_SHADOWPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 12)
+#define PRIMITIVE3D_ID_UNIFIEDTRANSPARENCETEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 13)
+#define PRIMITIVE3D_ID_GRADIENTTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 14)
+#define PRIMITIVE3D_ID_BITMAPTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 15)
+#define PRIMITIVE3D_ID_TRANSPARENCETEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 16)
+#define PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 17)
+#define PRIMITIVE3D_ID_HIDDENGEOMETRYPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 18)
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_PRIMITIVETYPES3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/groupprimitive3d.hxx b/include/drawinglayer/primitive3d/groupprimitive3d.hxx
new file mode 100644
index 000000000000..d8d3f5b77446
--- /dev/null
+++ b/include/drawinglayer/primitive3d/groupprimitive3d.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_GROUPPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_GROUPPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/baseprimitive3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** GroupPrimitive3D class
+
+ Baseclass for all grouping 3D primitives
+
+ The description/functionality is identical with the 2D case in groupprimitive2d.hxx,
+ please see there for detailed information.
+
+ Current Basic 3D StatePrimitives are:
+
+ - ModifiedColorPrimitive3D (for a stack of color modifications)
+ - ShadowPrimitive3D (for 3D objects with shadow; this is a special case
+ since the shadow of a 3D primitive is a 2D primitive set)
+ - TexturePrimitive3D (with the following variations)
+ - GradientTexturePrimitive3D (for 3D gradient fill)
+ - BitmapTexturePrimitive3D (for 3D Bitmap fill)
+ - TransparenceTexturePrimitive3D (for 3D transparence)
+ - HatchTexturePrimitive3D (for 3D hatch fill)
+ - TransformPrimitive3D (for a transformation stack)
+ */
+ class DRAWINGLAYER_DLLPUBLIC GroupPrimitive3D : public BasePrimitive3D
+ {
+ private:
+ /// the children. Declared private since this shall never be changed at all after construction
+ Primitive3DSequence maChildren;
+
+ public:
+ /// constructor
+ explicit GroupPrimitive3D(const Primitive3DSequence& rChildren);
+
+ /// data read access
+ Primitive3DSequence getChildren() const { return maChildren; }
+
+ /// compare operator
+ virtual bool operator==( const BasePrimitive3D& rPrimitive ) const;
+
+ /// local decomposition. Implementation will just return children
+ virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_GROUPPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx b/include/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx
new file mode 100644
index 000000000000..981027a1615b
--- /dev/null
+++ b/include/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HATCHTEXTUREPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HATCHTEXTUREPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/textureprimitive3d.hxx>
+#include <drawinglayer/attribute/fillhatchattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** HatchTexturePrimitive3D class
+
+ HatchTexturePrimitive3D is derived from GroupPrimitive3D, but implements
+ a decomposition which is complicated enough for buffering. Since the group
+ primitive has no default buffering, it is necessary here to add a local
+ buffering mechanism for the decomposition
+ */
+ class DRAWINGLAYER_DLLPUBLIC HatchTexturePrimitive3D : public TexturePrimitive3D
+ {
+ private:
+ /// the hatch definition
+ attribute::FillHatchAttribute maHatch;
+
+ /// the buffered decomposed hatch
+ Primitive3DSequence maBuffered3DDecomposition;
+
+ protected:
+ /// helper: local decomposition
+ Primitive3DSequence impCreate3DDecomposition() const;
+
+ /// local access methods to maBufferedDecomposition
+ const Primitive3DSequence& getBuffered3DDecomposition() const { return maBuffered3DDecomposition; }
+ void setBuffered3DDecomposition(const Primitive3DSequence& rNew) { maBuffered3DDecomposition = rNew; }
+
+ public:
+ /// constructor
+ HatchTexturePrimitive3D(
+ const attribute::FillHatchAttribute& rHatch,
+ const Primitive3DSequence& rChildren,
+ const basegfx::B2DVector& rTextureSize,
+ bool bModulate,
+ bool bFilter);
+
+ /// data read access
+ const attribute::FillHatchAttribute& getHatch() const { return maHatch; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+
+ /// local decomposition.
+ virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HATCHTEXTUREPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/hiddengeometryprimitive3d.hxx b/include/drawinglayer/primitive3d/hiddengeometryprimitive3d.hxx
new file mode 100644
index 000000000000..7fe7359b4824
--- /dev/null
+++ b/include/drawinglayer/primitive3d/hiddengeometryprimitive3d.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HIDDENGEOMETRYPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HIDDENGEOMETRYPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/groupprimitive3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ // This primitive is used to represent geometry for non-visible objects,
+ // e.g. a 3D cube without fill attributes. To still be able to use
+ // primitives for HitTest functionality, the 3d decompositions produce
+ // an as much as possible simplified fill geometry encapsulated in this
+ // primtive when there is no fill geometry. Currently, the 3d hit test
+ // uses only areas, so maybe in a further enchanced version this will change
+ // to 'if neither filled nor lines' creation criteria. The whole primitive
+ // decomposes to nothing, so no one not knowing it will be influenced. Only
+ // helper processors for hit test (and maybe BoundRect extractors) will
+ // use it and it's children subcontent.
+ class DRAWINGLAYER_DLLPUBLIC HiddenGeometryPrimitive3D : public GroupPrimitive3D
+ {
+ public:
+ explicit HiddenGeometryPrimitive3D(const Primitive3DSequence& rChildren);
+
+ // despite returning an empty decomposition since it's no visualisation data,
+ // range calculation is intended to use hidden geometry, so
+ // the local implementation will return the children's range
+ virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /// The default implementation returns an empty sequence
+ virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+ // provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HIDDENGEOMETRYPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx b/include/drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx
new file mode 100644
index 000000000000..0e5fe4329e12
--- /dev/null
+++ b/include/drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_MODIFIEDCOLORPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_MODIFIEDCOLORPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/groupprimitive3d.hxx>
+#include <basegfx/color/bcolormodifier.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** ModifiedColorPrimitive3D class
+
+ This primitive is a grouping primitive and allows to define
+ how the colors of it's child content shall be modified for
+ visualisation. Please see the ModifiedColorPrimitive2D
+ description for more info.
+ */
+ class DRAWINGLAYER_DLLPUBLIC ModifiedColorPrimitive3D : public GroupPrimitive3D
+ {
+ private:
+ /// The ColorModifier to use
+ basegfx::BColorModifier maColorModifier;
+
+ public:
+ /// constructor
+ ModifiedColorPrimitive3D(
+ const Primitive3DSequence& rChildren,
+ const basegfx::BColorModifier& rColorModifier);
+
+ /// data read access
+ const basegfx::BColorModifier& getColorModifier() const { return maColorModifier; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_MODIFIEDCOLORPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/polygonprimitive3d.hxx b/include/drawinglayer/primitive3d/polygonprimitive3d.hxx
new file mode 100644
index 000000000000..62fb60265732
--- /dev/null
+++ b/include/drawinglayer/primitive3d/polygonprimitive3d.hxx
@@ -0,0 +1,129 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYGONPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYGONPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/baseprimitive3d.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/polygon/b3dpolygon.hxx>
+#include <drawinglayer/attribute/lineattribute.hxx>
+#include <drawinglayer/attribute/strokeattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** PolygonHairlinePrimitive3D class
+
+ This primitive defines a Hairline in 3D. Since hairlines are view-dependent,
+ this primitive is view-dependent, too.
+
+ This is one of the non-decomposable 3D primitives, so a renderer
+ should proccess it.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PolygonHairlinePrimitive3D : public BasePrimitive3D
+ {
+ private:
+ /// the hairline geometry
+ basegfx::B3DPolygon maPolygon;
+
+ /// the hairline color
+ basegfx::BColor maBColor;
+
+ public:
+ /// constructor
+ PolygonHairlinePrimitive3D(
+ const basegfx::B3DPolygon& rPolygon,
+ const basegfx::BColor& rBColor);
+
+ /// data read access
+ const basegfx::B3DPolygon& getB3DPolygon() const { return maPolygon; }
+ const basegfx::BColor& getBColor() const { return maBColor; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** PolygonStrokePrimitive3D class
+
+ This primitive defines a 3D line with line width, line join, line color
+ and stroke attributes. It will be decomposed dependent on the definition
+ to the needed primitives, e.g. filled Tubes for fat lines.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PolygonStrokePrimitive3D : public BufferedDecompositionPrimitive3D
+ {
+ private:
+ /// the line geometry
+ basegfx::B3DPolygon maPolygon;
+
+ /// the line attributes like width, join and color
+ attribute::LineAttribute maLineAttribute;
+
+ /// the line stroking (if used)
+ attribute::StrokeAttribute maStrokeAttribute;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive3DSequence create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+ public:
+ /// constructor
+ PolygonStrokePrimitive3D(
+ const basegfx::B3DPolygon& rPolygon,
+ const attribute::LineAttribute& rLineAttribute,
+ const attribute::StrokeAttribute& rStrokeAttribute);
+
+ /// data read access
+ basegfx::B3DPolygon getB3DPolygon() const { return maPolygon; }
+ const attribute::LineAttribute& getLineAttribute() const { return maLineAttribute; }
+ const attribute::StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYGONPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/polygontubeprimitive3d.hxx b/include/drawinglayer/primitive3d/polygontubeprimitive3d.hxx
new file mode 100644
index 000000000000..56f7dc4b4d4a
--- /dev/null
+++ b/include/drawinglayer/primitive3d/polygontubeprimitive3d.hxx
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYGONTUBEPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYGONTUBEPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/polygonprimitive3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx {
+ class B3DPolyPolygon;
+ class B3DHomMatrix;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** PolygonStrokePrimitive3D class
+
+ This 3D primitive extends a 3D hairline to a 3D tube which is
+ e.g. used for fat lines in 3D. It's decomposition will create all
+ 3D objects needed for the line tubes and the edge roundings
+ in full 3D.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PolygonTubePrimitive3D : public PolygonHairlinePrimitive3D
+ {
+ private:
+ /// hold the last decompositon since it's expensive
+ Primitive3DSequence maLast3DDecomposition;
+
+ /// visualisation parameters
+ double mfRadius;
+ double mfDegreeStepWidth;
+ double mfMiterMinimumAngle;
+ basegfx::B2DLineJoin maLineJoin;
+ com::sun::star::drawing::LineCap maLineCap;
+
+ protected:
+ /** access methods to maLast3DDecomposition. The usage of this methods may allow
+ later thread-safe stuff to be added if needed. Only to be used by getDecomposition()
+ implementations for buffering the last decomposition.
+ */
+ const Primitive3DSequence& getLast3DDecomposition() const { return maLast3DDecomposition; }
+ void setLast3DDecomposition(const Primitive3DSequence& rNew) { maLast3DDecomposition = rNew; }
+
+ /// local decomposition.
+ Primitive3DSequence impCreate3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+ public:
+ /// constructor
+ PolygonTubePrimitive3D(
+ const basegfx::B3DPolygon& rPolygon,
+ const basegfx::BColor& rBColor,
+ double fRadius,
+ basegfx::B2DLineJoin aLineJoin,
+ com::sun::star::drawing::LineCap aLineCap,
+ double fDegreeStepWidth = 10.0 * F_PI180,
+ double fMiterMinimumAngle = 15.0 * F_PI180);
+
+ /// data read access
+ double getRadius() const { return mfRadius; }
+ double getDegreeStepWidth() const { return mfDegreeStepWidth; }
+ double getMiterMinimumAngle() const { return mfMiterMinimumAngle; }
+ basegfx::B2DLineJoin getLineJoin() const { return maLineJoin; }
+ com::sun::star::drawing::LineCap getLineCap() const { return maLineCap; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+
+ /** local decomposition. Use own buffering since we are not derived from
+ BufferedDecompositionPrimitive3D
+ */
+ virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYGONTUBEPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/polypolygonprimitive3d.hxx b/include/drawinglayer/primitive3d/polypolygonprimitive3d.hxx
new file mode 100644
index 000000000000..7f916afe978c
--- /dev/null
+++ b/include/drawinglayer/primitive3d/polypolygonprimitive3d.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYPOLYGONPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYPOLYGONPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/baseprimitive3d.hxx>
+#include <basegfx/polygon/b3dpolypolygon.hxx>
+#include <drawinglayer/attribute/materialattribute3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** PolyPolygonMaterialPrimitive3D class
+
+ This primitive defines a planar 3D PolyPolygon filled with a single color.
+ This is one of the non-decomposable primitives, so a renderer
+ should proccess it.
+
+ It is assumed here that the PolyPolgon is a single plane in 3D.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PolyPolygonMaterialPrimitive3D : public BasePrimitive3D
+ {
+ private:
+ /// the PolyPolygon geometry
+ basegfx::B3DPolyPolygon maPolyPolygon;
+
+ /// the fill parameters
+ attribute::MaterialAttribute3D maMaterial;
+
+ /// bitfield
+ unsigned mbDoubleSided : 1;
+
+ public:
+ /// constructor
+ PolyPolygonMaterialPrimitive3D(
+ const basegfx::B3DPolyPolygon& rPolyPolygon,
+ const attribute::MaterialAttribute3D& rMaterial,
+ bool bDoubleSided);
+
+ /// data read access
+ const basegfx::B3DPolyPolygon& getB3DPolyPolygon() const { return maPolyPolygon; }
+ const attribute::MaterialAttribute3D& getMaterial() const { return maMaterial; }
+ bool getDoubleSided() const { return mbDoubleSided; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYPOLYGONPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx b/include/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx
new file mode 100644
index 000000000000..513d120c5343
--- /dev/null
+++ b/include/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRCUBEPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRCUBEPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/sdrprimitive3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** SdrCubePrimitive3D class
+
+ This 3D primitive expands the SdrPrimitive3D to a 3D cube definition.
+ The cube is implicitely in unit coordinates and the given transformation
+ defines it's geometry in space.
+ */
+ class DRAWINGLAYER_DLLPUBLIC SdrCubePrimitive3D : public SdrPrimitive3D
+ {
+ protected:
+ /// local decomposition.
+ virtual Primitive3DSequence create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+ public:
+ /// constructor
+ SdrCubePrimitive3D(
+ const basegfx::B3DHomMatrix& rTransform,
+ const basegfx::B2DVector& rTextureSize,
+ const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute,
+ const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute);
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRCUBEPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/sdrdecompositiontools3d.hxx b/include/drawinglayer/primitive3d/sdrdecompositiontools3d.hxx
new file mode 100644
index 000000000000..ffe0e2cea676
--- /dev/null
+++ b/include/drawinglayer/primitive3d/sdrdecompositiontools3d.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRDECOMPOSITIONTOOLS3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRDECOMPOSITIONTOOLS3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/baseprimitive3d.hxx>
+#include <com/sun/star/drawing/TextureProjectionMode.hpp>
+#include <vector>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx {
+ class B3DPolygon;
+ class B3DPolyPolygon;
+ class B3DHomMatrix;
+ class B2DVector;
+}
+
+namespace drawinglayer { namespace attribute {
+ class SdrLineAttribute;
+ class SdrFillAttribute;
+ class Sdr3DObjectAttribute;
+ class FillGradientAttribute;
+ class SdrShadowAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ // #i98295#
+ basegfx::B3DRange DRAWINGLAYER_DLLPUBLIC getRangeFrom3DGeometry(::std::vector< basegfx::B3DPolyPolygon >& rFill);
+ void DRAWINGLAYER_DLLPUBLIC applyNormalsKindSphereTo3DGeometry(::std::vector< basegfx::B3DPolyPolygon >& rFill, const basegfx::B3DRange& rRange);
+ void DRAWINGLAYER_DLLPUBLIC applyNormalsKindFlatTo3DGeometry(::std::vector< basegfx::B3DPolyPolygon >& rFill);
+ void DRAWINGLAYER_DLLPUBLIC applyNormalsInvertTo3DGeometry(::std::vector< basegfx::B3DPolyPolygon >& rFill);
+
+ // #i98314#
+ void DRAWINGLAYER_DLLPUBLIC applyTextureTo3DGeometry(
+ ::com::sun::star::drawing::TextureProjectionMode eModeX,
+ ::com::sun::star::drawing::TextureProjectionMode eModeY,
+ ::std::vector< basegfx::B3DPolyPolygon >& rFill,
+ const basegfx::B3DRange& rRange,
+ const basegfx::B2DVector& rTextureSize);
+
+ Primitive3DSequence DRAWINGLAYER_DLLPUBLIC create3DPolyPolygonLinePrimitives(
+ const basegfx::B3DPolyPolygon& rUnitPolyPolygon,
+ const basegfx::B3DHomMatrix& rObjectTransform,
+ const attribute::SdrLineAttribute& rLine);
+
+ Primitive3DSequence DRAWINGLAYER_DLLPUBLIC create3DPolyPolygonFillPrimitives(
+ const ::std::vector< basegfx::B3DPolyPolygon >& r3DPolyPolygonVector,
+ const basegfx::B3DHomMatrix& rObjectTransform,
+ const basegfx::B2DVector& rTextureSize,
+ const attribute::Sdr3DObjectAttribute& aSdr3DObjectAttribute,
+ const attribute::SdrFillAttribute& rFill,
+ const attribute::FillGradientAttribute& rFillGradient);
+
+ Primitive3DSequence DRAWINGLAYER_DLLPUBLIC createShadowPrimitive3D(
+ const Primitive3DSequence& rSource,
+ const attribute::SdrShadowAttribute& rShadow,
+ bool bShadow3D);
+
+ Primitive3DSequence DRAWINGLAYER_DLLPUBLIC createHiddenGeometryPrimitives3D(
+ const ::std::vector< basegfx::B3DPolyPolygon >& r3DPolyPolygonVector,
+ const basegfx::B3DHomMatrix& rObjectTransform,
+ const basegfx::B2DVector& rTextureSize,
+ const attribute::Sdr3DObjectAttribute& aSdr3DObjectAttribute);
+
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_DRAWINGLAYER_PRIMITIVE3D_SDRDECOMPOSITIONTOOLS3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/sdrextrudelathetools3d.hxx b/include/drawinglayer/primitive3d/sdrextrudelathetools3d.hxx
new file mode 100644
index 000000000000..d741b4c1b223
--- /dev/null
+++ b/include/drawinglayer/primitive3d/sdrextrudelathetools3d.hxx
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDELATHETOOLS3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDELATHETOOLS3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <basegfx/polygon/b3dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <vector>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace drawinglayer { namespace geometry {
+ class ViewInformation3D;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** SliceType3D definition */
+ enum SliceType3D
+ {
+ SLICETYPE3D_REGULAR, // normal geoemtry Slice3D
+ SLICETYPE3D_FRONTCAP, // front cap
+ SLICETYPE3D_BACKCAP // back cap
+ };
+
+ /// class to hold one Slice3D
+ class DRAWINGLAYER_DLLPUBLIC Slice3D
+ {
+ protected:
+ basegfx::B3DPolyPolygon maPolyPolygon;
+ SliceType3D maSliceType;
+
+ public:
+ Slice3D(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const basegfx::B3DHomMatrix& aTransform,
+ SliceType3D aSliceType = SLICETYPE3D_REGULAR)
+ : maPolyPolygon(basegfx::tools::createB3DPolyPolygonFromB2DPolyPolygon(rPolyPolygon)),
+ maSliceType(aSliceType)
+ {
+ maPolyPolygon.transform(aTransform);
+ }
+
+ explicit Slice3D(
+ const basegfx::B3DPolyPolygon& rPolyPolygon,
+ SliceType3D aSliceType = SLICETYPE3D_REGULAR)
+ : maPolyPolygon(rPolyPolygon),
+ maSliceType(aSliceType)
+ {
+ }
+
+ // data access
+ const basegfx::B3DPolyPolygon& getB3DPolyPolygon() const { return maPolyPolygon; }
+ SliceType3D getSliceType() const { return maSliceType; }
+ };
+
+ /// typedef for a group of Slice3Ds
+ typedef ::std::vector< Slice3D > Slice3DVector;
+
+ /// helpers for creation
+ void DRAWINGLAYER_DLLPUBLIC createLatheSlices(
+ Slice3DVector& rSliceVector,
+ const basegfx::B2DPolyPolygon& rSource,
+ double fBackScale,
+ double fDiagonal,
+ double fRotation,
+ sal_uInt32 nSteps,
+ bool bCharacterMode,
+ bool bCloseFront,
+ bool bCloseBack);
+
+ void DRAWINGLAYER_DLLPUBLIC createExtrudeSlices(
+ Slice3DVector& rSliceVector,
+ const basegfx::B2DPolyPolygon& rSource,
+ double fBackScale,
+ double fDiagonal,
+ double fDepth,
+ bool bCharacterMode,
+ bool bCloseFront,
+ bool bCloseBack);
+
+ /// helpers for geometry extraction
+ basegfx::B3DPolyPolygon DRAWINGLAYER_DLLPUBLIC extractHorizontalLinesFromSlice(const Slice3DVector& rSliceVector, bool bCloseHorLines);
+ basegfx::B3DPolyPolygon DRAWINGLAYER_DLLPUBLIC extractVerticalLinesFromSlice(const Slice3DVector& rSliceVector);
+
+ void DRAWINGLAYER_DLLPUBLIC extractPlanesFromSlice(
+ ::std::vector< basegfx::B3DPolyPolygon >& rFill,
+ const Slice3DVector& rSliceVector,
+ bool bCreateNormals,
+ bool bSmoothHorizontalNormals,
+ bool bSmoothNormals,
+ bool bSmoothLids,
+ bool bClosed,
+ double fSmoothNormalsMix,
+ double fSmoothLidsMix,
+ bool bCreateTextureCoordinates,
+ const basegfx::B2DHomMatrix& rTexTransform);
+
+ void DRAWINGLAYER_DLLPUBLIC createReducedOutlines(
+ const geometry::ViewInformation3D& rViewInformation,
+ const basegfx::B3DHomMatrix& rObjectTransform,
+ const basegfx::B3DPolygon& rLoopA,
+ const basegfx::B3DPolygon& rLoopB,
+ basegfx::B3DPolyPolygon& rTarget);
+
+ } // end of namespace overlay
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDELATHETOOLS3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx b/include/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx
new file mode 100644
index 000000000000..055e7e71dd4c
--- /dev/null
+++ b/include/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx
@@ -0,0 +1,129 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDEPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDEPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/sdrprimitive3d.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** SdrExtrudePrimitive3D class
+
+ This 3D primitive expands the SdrPrimitive3D to a 3D extrude definition.
+ The given 2D PolyPolygon geometry is imagined as lying on the XY-plane in 3D
+ and gets extruded in Z-Direction by Depth.
+
+ Various possibilities e.g. for creating diagonals (edge roudings in 3D)
+ and similar are given.
+
+ The decomposition will create all necessary 3D planes for visualisation.
+ */
+ class DRAWINGLAYER_DLLPUBLIC SdrExtrudePrimitive3D : public SdrPrimitive3D
+ {
+ private:
+ /// geometry helper for slices
+ basegfx::B2DPolyPolygon maCorrectedPolyPolygon;
+ Slice3DVector maSlices;
+
+ /// primitive geometry data
+ basegfx::B2DPolyPolygon maPolyPolygon;
+ double mfDepth;
+ double mfDiagonal;
+ double mfBackScale;
+
+ /// decomposition data when ReducedLineGeometry is used, see get3DDecomposition
+ geometry::ViewInformation3D* mpLastRLGViewInformation;
+
+ /// bitfield
+ unsigned mbSmoothNormals : 1; // Plane self
+ unsigned mbSmoothHorizontalNormals : 1; // always
+ unsigned mbSmoothLids : 1; // Front/back
+ unsigned mbCharacterMode : 1;
+ unsigned mbCloseFront : 1;
+ unsigned mbCloseBack : 1;
+
+ /// create slices
+ void impCreateSlices();
+
+ /// get (evtl. create) slices
+ const Slice3DVector& getSlices() const;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive3DSequence create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+ public:
+ /// constructor
+ SdrExtrudePrimitive3D(
+ const basegfx::B3DHomMatrix& rTransform,
+ const basegfx::B2DVector& rTextureSize,
+ const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute,
+ const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute,
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ double fDepth,
+ double fDiagonal,
+ double fBackScale,
+ bool bSmoothNormals,
+ bool bSmoothHorizontalNormals,
+ bool bSmoothLids,
+ bool bCharacterMode,
+ bool bCloseFront,
+ bool bCloseBack);
+ virtual ~SdrExtrudePrimitive3D();
+
+ /// data read access
+ const basegfx::B2DPolyPolygon& getPolyPolygon() const { return maPolyPolygon; }
+ double getDepth() const { return mfDepth; }
+ double getDiagonal() const { return mfDiagonal; }
+ double getBackScale() const { return mfBackScale; }
+ bool getSmoothNormals() const { return mbSmoothNormals; }
+ bool getSmoothHorizontalNormals() const { return mbSmoothHorizontalNormals; }
+ bool getSmoothLids() const { return mbSmoothLids; }
+ bool getCharacterMode() const { return mbCharacterMode; }
+ bool getCloseFront() const { return mbCloseFront; }
+ bool getCloseBack() const { return mbCloseBack; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /// Overloaded to allow for reduced line mode to decide if to buffer decomposition or not
+ virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDEPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx b/include/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx
new file mode 100644
index 000000000000..7632e8e5985c
--- /dev/null
+++ b/include/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx
@@ -0,0 +1,147 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRLATHEPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRLATHEPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/sdrprimitive3d.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** SdrLathePrimitive3D class
+
+ This 3D primitive expands the SdrPrimitive3D to a 3D rotation definition.
+ The given 2D PolyPolygon geometry is imagined as lying on the XY-plane in 3D
+ and gets rotated around the Y-Axis.
+
+ Various possibilities e.g. for creating diagonals (edge roudings in 3D)
+ and similar are given.
+
+ The decomposition will create all necessary 3D planes for visualisation.
+ */
+ class DRAWINGLAYER_DLLPUBLIC SdrLathePrimitive3D : public SdrPrimitive3D
+ {
+ private:
+ /// geometry helper for slices
+ basegfx::B2DPolyPolygon maCorrectedPolyPolygon;
+ Slice3DVector maSlices;
+
+ /// primitive geometry data
+ basegfx::B2DPolyPolygon maPolyPolygon;
+ sal_uInt32 mnHorizontalSegments;
+ sal_uInt32 mnVerticalSegments;
+ double mfDiagonal;
+ double mfBackScale;
+ double mfRotation;
+
+ /// decomposition data when ReducedLineGeometry is used, see get3DDecomposition
+ geometry::ViewInformation3D* mpLastRLGViewInformation;
+
+ /// bitfield
+ unsigned mbSmoothNormals : 1; // Plane self
+ unsigned mbSmoothHorizontalNormals : 1; // always
+ unsigned mbSmoothLids : 1; // Front/back
+ unsigned mbCharacterMode : 1;
+ unsigned mbCloseFront : 1;
+ unsigned mbCloseBack : 1;
+
+ /// create slices
+ void impCreateSlices();
+
+ /// get (evtl. create) slices
+ const Slice3DVector& getSlices() const;
+
+ protected:
+ /// local helpers
+ void impCreateOutlines(
+ const geometry::ViewInformation3D& rViewInformation,
+ const basegfx::B3DPolygon& rLoopA,
+ const basegfx::B3DPolygon& rLoopB,
+ basegfx::B3DPolyPolygon& rTarget) const;
+
+ bool impHasCutWith(
+ const basegfx::B2DPolygon& rPoly,
+ const basegfx::B2DPoint& rStart,
+ const basegfx::B2DPoint& rEnd) const;
+
+ /// local decomposition.
+ virtual Primitive3DSequence create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+ public:
+ /// constructor
+ SdrLathePrimitive3D(
+ const basegfx::B3DHomMatrix& rTransform,
+ const basegfx::B2DVector& rTextureSize,
+ const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute,
+ const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute,
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ sal_uInt32 nHorizontalSegments,
+ sal_uInt32 nVerticalSegments,
+ double fDiagonal,
+ double fBackScale,
+ double fRotation,
+ bool bSmoothNormals,
+ bool bSmoothHorizontalNormals,
+ bool bSmoothLids,
+ bool bCharacterMode,
+ bool bCloseFront,
+ bool bCloseBack);
+ virtual ~SdrLathePrimitive3D();
+
+ /// data read access
+ const basegfx::B2DPolyPolygon& getPolyPolygon() const { return maPolyPolygon; }
+ sal_uInt32 getHorizontalSegments() const { return mnHorizontalSegments; }
+ sal_uInt32 getVerticalSegments() const { return mnVerticalSegments; }
+ double getDiagonal() const { return mfDiagonal; }
+ double getBackScale() const { return mfBackScale; }
+ double getRotation() const { return mfRotation; }
+ bool getSmoothNormals() const { return mbSmoothNormals; }
+ bool getSmoothHorizontalNormals() const { return mbSmoothHorizontalNormals; }
+ bool getSmoothLids() const { return mbSmoothLids; }
+ bool getCharacterMode() const { return mbCharacterMode; }
+ bool getCloseFront() const { return mbCloseFront; }
+ bool getCloseBack() const { return mbCloseBack; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /// Overloaded to allow for reduced line mode to decide if to buffer decomposition or not
+ virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRLATHEPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx b/include/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx
new file mode 100644
index 000000000000..2d9976224e6b
--- /dev/null
+++ b/include/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRPOLYPOLYGONPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRPOLYPOLYGONPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/sdrprimitive3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** SdrPolyPolygonPrimitive3D class
+
+ This 3D primitive defines a PolyPolgon in space which may have
+ Line- and FillStyles and extra 3D surface attributes. It is assumed
+ that the given 3D PolyPolgon (which may contain texture and normal
+ information) is planar in 3D.
+
+ The decomposition will include all needed 3D data for visualisation,
+ including FatLines and fill styles.
+ */
+ class DRAWINGLAYER_DLLPUBLIC SdrPolyPolygonPrimitive3D : public SdrPrimitive3D
+ {
+ private:
+ /// the planar polyPolygon evtl with normals and texture coordinates
+ basegfx::B3DPolyPolygon maPolyPolygon3D;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive3DSequence create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+ public:
+ /// constructor
+ SdrPolyPolygonPrimitive3D(
+ const basegfx::B3DPolyPolygon& rPolyPolygon3D,
+ const basegfx::B3DHomMatrix& rTransform,
+ const basegfx::B2DVector& rTextureSize,
+ const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute,
+ const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute);
+
+ /// data access
+ const basegfx::B3DPolyPolygon& getPolyPolygon3D() const { return maPolyPolygon3D; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRPOLYPOLYGONPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/sdrprimitive3d.hxx b/include/drawinglayer/primitive3d/sdrprimitive3d.hxx
new file mode 100644
index 000000000000..6563f5172f67
--- /dev/null
+++ b/include/drawinglayer/primitive3d/sdrprimitive3d.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/baseprimitive3d.hxx>
+#include <basegfx/matrix/b3dhommatrix.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <drawinglayer/attribute/sdrallattribute3d.hxx>
+#include <drawinglayer/primitive3d/sdrextrudelathetools3d.hxx>
+#include <drawinglayer/attribute/sdrobjectattribute3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ /** SdrPrimitive3D class
+
+ Base class for the more complicated geometric primitives, so
+ derive from buffered primitive to allow overloading of
+ create3DDecomposition there.
+ */
+ namespace primitive3d
+ {
+ class DRAWINGLAYER_DLLPUBLIC SdrPrimitive3D : public BufferedDecompositionPrimitive3D
+ {
+ private:
+ /// object surface attributes
+ basegfx::B3DHomMatrix maTransform;
+ basegfx::B2DVector maTextureSize;
+ attribute::SdrLineFillShadowAttribute3D maSdrLFSAttribute;
+ attribute::Sdr3DObjectAttribute maSdr3DObjectAttribute;
+
+ protected:
+ /** Standard implementation for primitive3D which
+ will use maTransform as range and expand by evtl. line width / 2
+ */
+ basegfx::B3DRange getStandard3DRange() const;
+
+ /** implementation for primitive3D which
+ will use given Slice3Ds and expand by evtl. line width / 2
+ */
+ basegfx::B3DRange get3DRangeFromSlices(const Slice3DVector& rSlices) const;
+
+ public:
+ /// constructor
+ SdrPrimitive3D(
+ const basegfx::B3DHomMatrix& rTransform,
+ const basegfx::B2DVector& rTextureSize,
+ const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute,
+ const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute);
+
+ /// data read access
+ const basegfx::B3DHomMatrix& getTransform() const { return maTransform; }
+ const basegfx::B2DVector& getTextureSize() const { return maTextureSize; }
+ const attribute::SdrLineFillShadowAttribute3D& getSdrLFSAttribute() const { return maSdrLFSAttribute; }
+ const attribute::Sdr3DObjectAttribute getSdr3DObjectAttribute() const { return maSdr3DObjectAttribute; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx b/include/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx
new file mode 100644
index 000000000000..48e7ee42ceb2
--- /dev/null
+++ b/include/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRSPHEREPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRSPHEREPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/sdrprimitive3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** SdrSpherePrimitive3D class
+
+ This 3D primitive expands the SdrPrimitive3D to a 3D sphere definition.
+ The sphere is implicitely in unit coordinates and the given transformation
+ defines it's geometry in space.
+ */
+ class DRAWINGLAYER_DLLPUBLIC SdrSpherePrimitive3D : public SdrPrimitive3D
+ {
+ private:
+ /// additional geometry definitions
+ sal_uInt32 mnHorizontalSegments;
+ sal_uInt32 mnVerticalSegments;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive3DSequence create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+ public:
+ /// constructor
+ SdrSpherePrimitive3D(
+ const basegfx::B3DHomMatrix& rTransform,
+ const basegfx::B2DVector& rTextureSize,
+ const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute,
+ const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute,
+ sal_uInt32 nHorizontalSegments,
+ sal_uInt32 nVerticalSegments);
+
+ /// data read access
+ sal_uInt32 getHorizontalSegments() const { return mnHorizontalSegments; }
+ sal_uInt32 getVerticalSegments() const { return mnVerticalSegments; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRSPHEREPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/shadowprimitive3d.hxx b/include/drawinglayer/primitive3d/shadowprimitive3d.hxx
new file mode 100644
index 000000000000..76be7e7742f4
--- /dev/null
+++ b/include/drawinglayer/primitive3d/shadowprimitive3d.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SHADOWPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SHADOWPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/groupprimitive3d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** ShadowPrimitive3D class
+
+ This 3D grouping primitive is used to define a shadow for
+ 3d geometry by embedding it. The shadow of 3D objects are
+ 2D polygons, so the shadow transformation is a 2D transformation.
+
+ If the Shadow3D flag is set, the shadow definition has to be
+ combined with the scene and camera definition to create the correct
+ projected shadow 2D-Polygons.
+ */
+ class DRAWINGLAYER_DLLPUBLIC ShadowPrimitive3D : public GroupPrimitive3D
+ {
+ protected:
+ /// 2D shadow definition
+ basegfx::B2DHomMatrix maShadowTransform;
+ basegfx::BColor maShadowColor;
+ double mfShadowTransparence;
+
+ /// bitfield
+ unsigned mbShadow3D : 1;
+
+ public:
+ /// constructor
+ ShadowPrimitive3D(
+ const basegfx::B2DHomMatrix& rShadowTransform,
+ const basegfx::BColor& rShadowColor,
+ double fShadowTransparence,
+ bool bShadow3D,
+ const Primitive3DSequence& rChildren);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getShadowTransform() const { return maShadowTransform; }
+ const basegfx::BColor& getShadowColor() const { return maShadowColor; }
+ double getShadowTransparence() const { return mfShadowTransparence; }
+ bool getShadow3D() const { return mbShadow3D; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SHADOWPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/textureprimitive3d.hxx b/include/drawinglayer/primitive3d/textureprimitive3d.hxx
new file mode 100644
index 000000000000..1ce8e9bcd57c
--- /dev/null
+++ b/include/drawinglayer/primitive3d/textureprimitive3d.hxx
@@ -0,0 +1,230 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_TEXTUREPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_TEXTUREPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/groupprimitive3d.hxx>
+#include <drawinglayer/attribute/fillbitmapattribute.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <drawinglayer/attribute/fillgradientattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** TexturePrimitive3D class
+
+ This 3D grouping primitive is used to define a texture for
+ 3d geometry by embedding it. It is used as bae class for
+ extended texture definitions
+ */
+ class DRAWINGLAYER_DLLPUBLIC TexturePrimitive3D : public GroupPrimitive3D
+ {
+ private:
+ /// texture geometry definition
+ basegfx::B2DVector maTextureSize;
+
+ /// bitfield
+ /// flag if texture shall be modulated with white interpolated color
+ unsigned mbModulate : 1;
+
+ /// flag if texture shall be filtered
+ unsigned mbFilter : 1;
+
+ public:
+ /// constructor
+ TexturePrimitive3D(
+ const Primitive3DSequence& rChildren,
+ const basegfx::B2DVector& rTextureSize,
+ bool bModulate,
+ bool bFilter);
+
+ /// data read access
+ const basegfx::B2DVector& getTextureSize() const { return maTextureSize; }
+ bool getModulate() const { return mbModulate; }
+ bool getFilter() const { return mbFilter; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** UnifiedTransparenceTexturePrimitive3D class
+
+ This 3D primitive expands TexturePrimitive3D to a unified
+ transparence texture definition. All 3D primitives
+ embedded here will be shown with the given transparency.
+ */
+ class DRAWINGLAYER_DLLPUBLIC UnifiedTransparenceTexturePrimitive3D : public TexturePrimitive3D
+ {
+ private:
+ /// transparency definition
+ double mfTransparence;
+
+ public:
+ /// constructor
+ UnifiedTransparenceTexturePrimitive3D(
+ double fTransparence,
+ const Primitive3DSequence& rChildren);
+
+ /// data read access
+ double getTransparence() const { return mfTransparence; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+
+ /// own getB3DRange implementation to include transparent geometries to BoundRect calculations
+ virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /// local decomposition.
+ virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** GradientTexturePrimitive3D class
+
+ This 3D primitive expands TexturePrimitive3D to a gradient texture
+ definition. All 3D primitives embedded here will be shown with the
+ defined gradient.
+ */
+ class DRAWINGLAYER_DLLPUBLIC GradientTexturePrimitive3D : public TexturePrimitive3D
+ {
+ private:
+ /// the gradient definition
+ attribute::FillGradientAttribute maGradient;
+
+ public:
+ /// constructor
+ GradientTexturePrimitive3D(
+ const attribute::FillGradientAttribute& rGradient,
+ const Primitive3DSequence& rChildren,
+ const basegfx::B2DVector& rTextureSize,
+ bool bModulate,
+ bool bFilter);
+
+ /// data read access
+ const attribute::FillGradientAttribute& getGradient() const { return maGradient; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** BitmapTexturePrimitive3D class
+
+ This 3D primitive expands TexturePrimitive3D to a bitmap texture
+ definition. All 3D primitives embedded here will be shown with the
+ defined bitmap (maybe tiled if defined).
+ */
+ class DRAWINGLAYER_DLLPUBLIC BitmapTexturePrimitive3D : public TexturePrimitive3D
+ {
+ private:
+ /// bitmap fill attribute
+ attribute::FillBitmapAttribute maFillBitmapAttribute;
+
+ public:
+ /// constructor
+ BitmapTexturePrimitive3D(
+ const attribute::FillBitmapAttribute& rFillBitmapAttribute,
+ const Primitive3DSequence& rChildren,
+ const basegfx::B2DVector& rTextureSize,
+ bool bModulate,
+ bool bFilter);
+
+ /// data read access
+ const attribute::FillBitmapAttribute& getFillBitmapAttribute() const { return maFillBitmapAttribute; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** TransparenceTexturePrimitive3D class
+
+ This 3D primitive expands TexturePrimitive3D to a transparence texture
+ definition. For transparence definition, a gradient is used. The values in
+ that gradient will be interpreted as luminance Transparence-Values. All 3D
+ primitives embedded here will be shown with the defined transparence.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TransparenceTexturePrimitive3D : public GradientTexturePrimitive3D
+ {
+ public:
+ /// constructor
+ TransparenceTexturePrimitive3D(
+ const attribute::FillGradientAttribute& rGradient,
+ const Primitive3DSequence& rChildren,
+ const basegfx::B2DVector& rTextureSize);
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_TEXTUREPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/transformprimitive3d.hxx b/include/drawinglayer/primitive3d/transformprimitive3d.hxx
new file mode 100644
index 000000000000..85a88a330d77
--- /dev/null
+++ b/include/drawinglayer/primitive3d/transformprimitive3d.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_TRANSFORMPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_TRANSFORMPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/groupprimitive3d.hxx>
+#include <basegfx/matrix/b3dhommatrix.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** TransformPrimitive3D class
+
+ This is one of the basic grouping 3D primitives and it provides
+ embedding a sequence of primitives (a geometry) into a
+ 3D transformation.
+
+ Please see the description for TransformPrimitive2D since these
+ primitives are pretty similar.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TransformPrimitive3D : public GroupPrimitive3D
+ {
+ private:
+ // the 3D transformation to apply
+ basegfx::B3DHomMatrix maTransformation;
+
+ public:
+ /// constructor
+ TransformPrimitive3D(
+ const basegfx::B3DHomMatrix& rTransformation,
+ const Primitive3DSequence& rChildren);
+
+ /// data read access
+ const basegfx::B3DHomMatrix& getTransformation() const { return maTransformation; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_TRANSFORMPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor2d/baseprocessor2d.hxx b/include/drawinglayer/processor2d/baseprocessor2d.hxx
new file mode 100644
index 000000000000..62a0f874a9ae
--- /dev/null
+++ b/include/drawinglayer/processor2d/baseprocessor2d.hxx
@@ -0,0 +1,196 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_BASEPROCESSOR2D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_BASEPROCESSOR2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <drawinglayer/geometry/viewinformation2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor2d
+ {
+ /** BaseProcessor2D class
+
+ Baseclass for all C++ implementations of instances which process
+ primitives.
+
+ Instances which process primitives can be renderers, but also stuff
+ for HitTests, BoundRect calculations and/or animation processing. The
+ main usage are renderers, but they are supposed to handle any primitive
+ processing.
+
+ The base implementation is constructed with a ViewInformation2D which
+ is accessible throughout the processor implementations. The idea is
+ to construct any processor with a given ViewInformation2D. To be able
+ to handle primitives which need to change the current transformation
+ (as e.g. TransformPrimitive2D) it is allowed for the processor implementation
+ to change tis local value using updateViewInformation.
+
+ The basic processing method is process(..) which gets handed over the
+ sequence of primitives to process. For convenience of the C++ implementations,
+ the default implementation of process(..) maps all accesses to primitives to
+ single calls to processBasePrimitive2D(..) where the primitive in question is
+ already casted to the C++ implementation class.
+
+ The process(..) implementation makes a complete iteration over the given
+ sequence of primitives. If the Primitive is not derived from BasePrimitive2D
+ and thus not part of the C++ implementations, it converts ViewInformation2D
+ to the corresponding API implementation (an uno::Sequence< beans::PropertyValue >)
+ and recursively calls the method process(..) at the primitive with the decomposition
+ derived from that primitive. This is the preparation to handle unknown implementations
+ of the com::sun::star::graphic::XPrimitive2D interface in the future.
+
+ So, to implement a basic processor, it is necessary to overload and implement the
+ processBasePrimitive2D(..) method. A minimal renderer has to support the
+ Basic Primitives (see baseprimitive2d.hxx) and the Grouping Primitives (see
+ groupprimitive2d.hxx). These are (currently):
+
+ Basic Primitives:
+
+ - BitmapPrimitive2D (bitmap data, evtl. with transparence)
+ - PointArrayPrimitive2D (single points)
+ - PolygonHairlinePrimitive2D (hairline curves/polygons)
+ - PolyPolygonColorPrimitive2D (colored polygons)
+
+ Grouping Primitives:
+
+ - TransparencePrimitive2D (objects with freely defined transparence)
+ - InvertPrimitive2D (for XOR)
+ - MaskPrimitive2D (for masking)
+ - ModifiedColorPrimitive2D (for a stack of color modifications)
+ - TransformPrimitive2D (for a transformation stack)
+
+ A processor doing so is a minimal processor. Of course a processor may
+ handle any higher-level prmitive (that has a decomposition implementation)
+ for more direct data access or performance reasons, too.
+
+ The main part of a processBasePrimitive2D implementation is a switch..case
+ construct, looking like the following:
+
+ void foo::processBasePrimitive2D(const BasePrimitive2D& rCandidate)
+ {
+ switch(rCandidate.getPrimitive2DID())
+ {
+ case PRIMITIVE2D_ID_??? :
+ {
+ // process PRIMITIVE2D_ID_??? here...
+
+ ...
+
+ break;
+ }
+
+ ...
+
+ default :
+ {
+ // process recursively
+ process(rCandidate.get2DDecomposition(getViewInformation2D()));
+ break;
+ }
+ }
+ }
+
+ The default case makes the processor work with all complex primitives
+ by recursively using their decomposition.
+
+ You can also add a case for ignoring primitives by using:
+
+ case PRIMITIVE2D_ID_...IGNORE.A.. :
+ case PRIMITIVE2D_ID_...IGNORE.B.. :
+ case PRIMITIVE2D_ID_...IGNORE.C.. :
+ {
+ // ignore these primitives by neither processing nor
+ // recursively processing their decomposition
+ break;
+ }
+
+ Another useful case is embedding the processing of a complex primitive by
+ bracketing it with some actions:
+
+ case PRIMITIVE2D_ID_SOME_TEXT :
+ {
+ // encapsulate e.g. with changing local varibles, e.g.
+ // sometimes it's good to know if a basic primitive is
+ // part of a text, especially when not handling the text
+ // self but by purpose want to handle the decomposed
+ // geometries in the processor
+ startText();
+ process(rCandidate.get2DDecomposition(getViewInformation2D()));
+ endText();
+ break;
+ }
+
+ As an example a processor collecting the outlines of a sequence of primitives
+ only needs to handle some Basic Primitives and create outline and collect
+ outline polygons e.g. for primitives with area like BitmapPrimitive2D (a
+ rectangle) and PolyPolygonColorPrimitive2D. When also handling the Grouping
+ Primitives MaskPrimitive2D (e.g. ignoring it's content, using the mask polyPolygon)
+ and TransformPrimitive2D (to have the correct local transformation), a processor
+ creating the outline can be written using just four (4) primitives. As a tipp, it can
+ be helpful to add many for the purpose not interesting higher level primitives
+ to not force their decomposition to be created and/or parsed.
+ */
+ class DRAWINGLAYER_DLLPUBLIC BaseProcessor2D
+ {
+ private:
+ /// The ViewInformation2D itself. It's private to isolate accesses to it
+ geometry::ViewInformation2D maViewInformation2D;
+
+ protected:
+ /* access method to allow the implementations to change the current
+ ViewInformation2D if needed. This allows isolating these accesses
+ later if needed
+ */
+ void updateViewInformation(const geometry::ViewInformation2D& rViewInformation2D)
+ {
+ maViewInformation2D = rViewInformation2D;
+ }
+
+ /* as tooling, the process() implementation takes over API handling and calls this
+ virtual render method when the primitive implementation is BasePrimitive2D-based.
+ Default implementation does nothing
+ */
+ virtual void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate);
+
+ public:
+ /// constructor/destructor
+ explicit BaseProcessor2D(const geometry::ViewInformation2D& rViewInformation);
+ virtual ~BaseProcessor2D();
+
+ /// the central processing method
+ virtual void process(const primitive2d::Primitive2DSequence& rSource);
+
+ /// data read access
+ const geometry::ViewInformation2D& getViewInformation2D() const { return maViewInformation2D; }
+ };
+ } // end of namespace processor2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PROCESSOR2D_BASEPROCESSOR2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor2d/canvasprocessor.hxx b/include/drawinglayer/processor2d/canvasprocessor.hxx
new file mode 100644
index 000000000000..5dea3b450c19
--- /dev/null
+++ b/include/drawinglayer/processor2d/canvasprocessor.hxx
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _DRAWINGLAYER_PROCESSOR_CANVASPROCESSOR_HXX
+#define _DRAWINGLAYER_PROCESSOR_CANVASPROCESSOR_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/processor2d/baseprocessor2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/color/bcolormodifier.hxx>
+#include <svtools/optionsdrawinglayer.hxx>
+#include <com/sun/star/rendering/ViewState.hpp>
+#include <com/sun/star/rendering/RenderState.hpp>
+#include <i18nlangtag/lang.h>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <vcl/mapmod.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// forward declaration
+
+namespace basegfx {
+ class BColor;
+ class B2DPolygon;
+}
+
+namespace com { namespace sun { namespace star { namespace rendering {
+ class XCanvas;
+ class XPolyPolygon2D;
+}}}}
+
+namespace drawinglayer { namespace primitive2d {
+ class MaskPrimitive2D;
+ class MetafilePrimitive2D;
+ class TextSimplePortionPrimitive2D;
+ class BitmapPrimitive2D;
+ class TransparencePrimitive2D;
+ class PolygonStrokePrimitive2D;
+ class FillBitmapPrimitive2D;
+ class UnifiedTransparencePrimitive2D;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor2d
+ {
+ /** canvasProcessor2D class
+
+ A basic implementation of a renderer for com::sun::star::rendering::XCanvas
+ as a target
+ */
+ class DRAWINGLAYER_DLLPUBLIC canvasProcessor2D : public BaseProcessor2D
+ {
+ private:
+ // the (current) destination OutDev and canvas
+ OutputDevice* mpOutputDevice;
+ com::sun::star::uno::Reference< com::sun::star::rendering::XCanvas > mxCanvas;
+ com::sun::star::rendering::ViewState maViewState;
+ com::sun::star::rendering::RenderState maRenderState;
+
+ // the modifiedColorPrimitive stack
+ basegfx::BColorModifierStack maBColorModifierStack;
+
+ // SvtOptionsDrawinglayer incarnation to react on diverse settings
+ const SvtOptionsDrawinglayer maDrawinglayerOpt;
+
+ // the current clipping PolyPolygon from MaskPrimitive2D, always in
+ // object coordinates
+ basegfx::B2DPolyPolygon maClipPolyPolygon;
+
+ // determined LanguageType
+ LanguageType meLang;
+
+ // as tooling, the process() implementation takes over API handling and calls this
+ // virtual render method when the primitive implementation is BasePrimitive2D-based.
+ virtual void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate);
+
+ // direct primitive renderer support
+ void impRenderMaskPrimitive2D(const primitive2d::MaskPrimitive2D& rMaskCandidate);
+ void impRenderMetafilePrimitive2D(const primitive2d::MetafilePrimitive2D& rMetaCandidate);
+ void impRenderTextSimplePortionPrimitive2D(const primitive2d::TextSimplePortionPrimitive2D& rTextCandidate);
+ void impRenderBitmapPrimitive2D(const primitive2d::BitmapPrimitive2D& rBitmapCandidate);
+ void impRenderTransparencePrimitive2D(const primitive2d::TransparencePrimitive2D& rTransparenceCandidate);
+ void impRenderPolygonStrokePrimitive2D(const primitive2d::PolygonStrokePrimitive2D& rPolygonStrokePrimitive);
+ void impRenderFillBitmapPrimitive2D(const primitive2d::FillBitmapPrimitive2D& rFillBitmapPrimitive2D);
+ void impRenderUnifiedTransparencePrimitive2D(const primitive2d::UnifiedTransparencePrimitive2D& rUniTransparenceCandidate);
+
+ public:
+ canvasProcessor2D(
+ const geometry::ViewInformation2D& rViewInformation,
+ OutputDevice& rOutDev);
+ virtual ~canvasProcessor2D();
+
+ // access to Drawinglayer configuration options
+ const SvtOptionsDrawinglayer& getOptionsDrawinglayer() const { return maDrawinglayerOpt; }
+ };
+ } // end of namespace processor2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_DRAWINGLAYER_PROCESSOR_CANVASPROCESSOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor2d/contourextractor2d.hxx b/include/drawinglayer/processor2d/contourextractor2d.hxx
new file mode 100644
index 000000000000..af390a8cd7b7
--- /dev/null
+++ b/include/drawinglayer/processor2d/contourextractor2d.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_CONTOUREXTRACTOR2D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_CONTOUREXTRACTOR2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/processor2d/baseprocessor2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor2d
+ {
+ /** ContourExtractor2D class
+
+ A processor who extracts the contour of the primtives feeded to it
+ in the single local PolyPolygon
+ */
+ class DRAWINGLAYER_DLLPUBLIC ContourExtractor2D : public BaseProcessor2D
+ {
+ private:
+ /// the extracted contour
+ basegfx::B2DPolyPolygonVector maExtractedContour;
+
+ /// bitfield
+ bool mbExtractFillOnly : 1;
+
+ /// tooling methods
+ void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate);
+
+ public:
+ explicit ContourExtractor2D(
+ const geometry::ViewInformation2D& rViewInformation,
+ bool bExtractFillOnly);
+
+ virtual ~ContourExtractor2D();
+
+ const basegfx::B2DPolyPolygonVector& getExtractedContour() const { return maExtractedContour; }
+ };
+ } // end of namespace processor2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_CONTOUREXTRACTOR2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor2d/hittestprocessor2d.hxx b/include/drawinglayer/processor2d/hittestprocessor2d.hxx
new file mode 100644
index 000000000000..fc2ab3252558
--- /dev/null
+++ b/include/drawinglayer/processor2d/hittestprocessor2d.hxx
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_HITTESTPROCESSOR2D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_HITTESTPROCESSOR2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/processor2d/baseprocessor2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+namespace basegfx { class B2DPolygon; }
+namespace basegfx { class B2DPolyPolygon; }
+namespace drawinglayer { namespace primitive2d { class ScenePrimitive2D; }}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor2d
+ {
+ /** HitTestProcessor2D class
+
+ This processor implements a HitTest with the feeded primitives,
+ given tolerance and extras
+ */
+ class DRAWINGLAYER_DLLPUBLIC HitTestProcessor2D : public BaseProcessor2D
+ {
+ private:
+ /// discrete HitTest position
+ basegfx::B2DPoint maDiscreteHitPosition;
+
+ /// discrete HitTolerance
+ double mfDiscreteHitTolerance;
+
+ /// bitfield
+ unsigned mbHit : 1;
+ unsigned mbHitToleranceUsed : 1;
+
+ /* this flag decides if primitives which are embedded to an
+ UnifiedTransparencePrimitive2D and are invisible will be taken into account for
+ HitTesting or not. Those primitives are created for objects which are else
+ completely invisible and normally their content exists of hairline
+ primitives describing the object's contour
+ */
+ unsigned mbUseInvisiblePrimitiveContent : 1;
+
+ /// flag to concentraze on text hits only
+ unsigned mbHitTextOnly : 1;
+
+ /// tooling methods
+ void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate);
+ bool checkHairlineHitWithTolerance(
+ const basegfx::B2DPolygon& rPolygon,
+ double fDiscreteHitTolerance);
+ bool checkFillHitWithTolerance(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ double fDiscreteHitTolerance);
+ void check3DHit(const primitive2d::ScenePrimitive2D& rCandidate);
+
+ public:
+ HitTestProcessor2D(
+ const geometry::ViewInformation2D& rViewInformation,
+ const basegfx::B2DPoint& rLogicHitPosition,
+ double fLogicHitTolerance,
+ bool bHitTextOnly);
+ virtual ~HitTestProcessor2D();
+
+ /// data write access
+ void setUseInvisiblePrimitiveContent(bool bNew)
+ {
+ if((bool)mbUseInvisiblePrimitiveContent != bNew) mbUseInvisiblePrimitiveContent = bNew;
+ }
+
+ /// data read access
+ const basegfx::B2DPoint& getDiscreteHitPosition() const { return maDiscreteHitPosition; }
+ double getDiscreteHitTolerance() const { return mfDiscreteHitTolerance; }
+ bool getHit() const { return mbHit; }
+ bool getHitToleranceUsed() const { return mbHitToleranceUsed; }
+ bool getUseInvisiblePrimitiveContent() const { return mbUseInvisiblePrimitiveContent;}
+ bool getHitTextOnly() const { return mbHitTextOnly; }
+ };
+ } // end of namespace processor2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_HITTESTPROCESSOR2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor2d/linegeometryextractor2d.hxx b/include/drawinglayer/processor2d/linegeometryextractor2d.hxx
new file mode 100644
index 000000000000..4905f4062c5f
--- /dev/null
+++ b/include/drawinglayer/processor2d/linegeometryextractor2d.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_LINEGEOMETRYEXTRACTOR2D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_LINEGEOMETRYEXTRACTOR2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/processor2d/baseprocessor2d.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor2d
+ {
+ /** LineGeometryExtractor2D class
+
+ This processor can extract the line geometry from feeded primpitives. The
+ hairlines and the fille geometry from fat lines are separated.
+ */
+ class DRAWINGLAYER_DLLPUBLIC LineGeometryExtractor2D : public BaseProcessor2D
+ {
+ private:
+ basegfx::B2DPolygonVector maExtractedHairlines;
+ basegfx::B2DPolyPolygonVector maExtractedLineFills;
+
+ /// bitfield
+ unsigned mbInLineGeometry : 1;
+
+ /// tooling methods
+ void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate);
+
+ public:
+ LineGeometryExtractor2D(const geometry::ViewInformation2D& rViewInformation);
+ virtual ~LineGeometryExtractor2D();
+
+ const basegfx::B2DPolygonVector& getExtractedHairlines() const { return maExtractedHairlines; }
+ const basegfx::B2DPolyPolygonVector& getExtractedLineFills() const { return maExtractedLineFills; }
+ };
+ } // end of namespace processor2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_LINEGEOMETRYEXTRACTOR2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor2d/objectinfoextractor2d.hxx b/include/drawinglayer/processor2d/objectinfoextractor2d.hxx
new file mode 100644
index 000000000000..42f4fb3970de
--- /dev/null
+++ b/include/drawinglayer/processor2d/objectinfoextractor2d.hxx
@@ -0,0 +1,61 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_OBJECTINFOEXTRACTOR2D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_OBJECTINFOEXTRACTOR2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <drawinglayer/processor2d/baseprocessor2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer { namespace primitive2d { class ObjectInfoPrimitive2D; }}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor2d
+ {
+ /** ObjectInfoPrimitiveExtractor2D class
+
+ A processor to find the first incarnation of ObjectInfoPrimitive2D
+ in a given hierarchy
+ */
+ class DRAWINGLAYER_DLLPUBLIC ObjectInfoPrimitiveExtractor2D : public BaseProcessor2D
+ {
+ private:
+ /// the target
+ const primitive2d::ObjectInfoPrimitive2D* mpFound;
+
+ /// tooling methods
+ void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate);
+
+ public:
+ ObjectInfoPrimitiveExtractor2D(const geometry::ViewInformation2D& rViewInformation);
+ virtual ~ObjectInfoPrimitiveExtractor2D();
+
+ const primitive2d::ObjectInfoPrimitive2D* getResult() const { return mpFound; }
+ };
+ } // end of namespace processor2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_OBJECTINFOEXTRACTOR2D_HXX
+
+// eof
diff --git a/include/drawinglayer/processor2d/processorfromoutputdevice.hxx b/include/drawinglayer/processor2d/processorfromoutputdevice.hxx
new file mode 100644
index 000000000000..cd149db71e6d
--- /dev/null
+++ b/include/drawinglayer/processor2d/processorfromoutputdevice.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _PROCESSOR_FROM_OUTPUTDEVICE_HXX
+#define _PROCESSOR_FROM_OUTPUTDEVICE_HXX
+
+#include <drawinglayer/geometry/viewinformation2d.hxx>
+#include "drawinglayer/drawinglayerdllapi.h"
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class OutputDevice;
+
+namespace drawinglayer { namespace processor2d {
+ class BaseProcessor2D;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor2d
+ {
+ // create a mating VCL-Provessor for given OutputDevice. This includes
+ // looking for MetaFile-recording. The returned renderer changes owner,
+ // deletion is duty of the caller
+ DRAWINGLAYER_DLLPUBLIC drawinglayer::processor2d::BaseProcessor2D* createBaseProcessor2DFromOutputDevice(
+ OutputDevice& rTargetOutDev,
+ const drawinglayer::geometry::ViewInformation2D& rViewInformation2D);
+
+ } // end of namespace processor2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_PROCESSOR_FROM_OUTPUTDEVICE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor2d/textaspolygonextractor2d.hxx b/include/drawinglayer/processor2d/textaspolygonextractor2d.hxx
new file mode 100644
index 000000000000..239e624ccced
--- /dev/null
+++ b/include/drawinglayer/processor2d/textaspolygonextractor2d.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_TEXTASPOLYGONEXTRACTOR2D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_TEXTASPOLYGONEXTRACTOR2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/processor2d/baseprocessor2d.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/color/bcolormodifier.hxx>
+#include <vector>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor2d
+ {
+ /// helper data structure for returning the result
+ struct DRAWINGLAYER_DLLPUBLIC TextAsPolygonDataNode
+ {
+ private:
+ basegfx::B2DPolyPolygon maB2DPolyPolygon;
+ basegfx::BColor maBColor;
+ bool mbIsFilled;
+
+ public:
+ TextAsPolygonDataNode(
+ const basegfx::B2DPolyPolygon& rB2DPolyPolygon,
+ const basegfx::BColor& rBColor,
+ bool bIsFilled)
+ : maB2DPolyPolygon(rB2DPolyPolygon),
+ maBColor(rBColor),
+ mbIsFilled(bIsFilled)
+ {
+ }
+
+ // data read access
+ const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maB2DPolyPolygon; }
+ const basegfx::BColor& getBColor() const { return maBColor; }
+ bool getIsFilled() const { return mbIsFilled; }
+ };
+
+ /// typedef for a vector of that helper data
+ typedef ::std::vector< TextAsPolygonDataNode > TextAsPolygonDataNodeVector;
+
+ /** TextAsPolygonExtractor2D class
+
+ This processor extracts text in the feeded primitives to filled polygons
+ */
+ class DRAWINGLAYER_DLLPUBLIC TextAsPolygonExtractor2D : public BaseProcessor2D
+ {
+ private:
+ // extraction target
+ TextAsPolygonDataNodeVector maTarget;
+
+ // the modifiedColorPrimitive stack
+ basegfx::BColorModifierStack maBColorModifierStack;
+
+ // flag if we are in a decomposed text
+ sal_uInt32 mnInText;
+
+ // tooling methods
+ void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate);
+
+ public:
+ explicit TextAsPolygonExtractor2D(const geometry::ViewInformation2D& rViewInformation);
+ virtual ~TextAsPolygonExtractor2D();
+
+ // data read access
+ const TextAsPolygonDataNodeVector& getTarget() const { return maTarget; }
+ };
+ } // end of namespace processor2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_TEXTASPOLYGONEXTRACTOR2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor2d/vclmetafileprocessor2d.hxx b/include/drawinglayer/processor2d/vclmetafileprocessor2d.hxx
new file mode 100644
index 000000000000..fa85105939c8
--- /dev/null
+++ b/include/drawinglayer/processor2d/vclmetafileprocessor2d.hxx
@@ -0,0 +1,151 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLMETAFILEPROCESSOR2D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLMETAFILEPROCESSOR2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/processor2d/vclprocessor2d.hxx>
+#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// vcl::PDFExtOutDevData support
+
+#include <vcl/pdfextoutdevdata.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+class GDIMetaFile;
+class Rectangle;
+class Gradient;
+class SvtGraphicFill;
+class SvtGraphicStroke;
+
+namespace drawinglayer { namespace attribute {
+ class FillGradientAttribute;
+ class LineAttribute;
+ class StrokeAttribute;
+ class LineStartEndAttribute;
+}}
+
+namespace basegfx {
+ class BColor;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor2d
+ {
+ /** VclMetafileProcessor2D class
+
+ This processor derived from VclProcessor2D is the base class for rendering
+ all feeded primitives to a classical VCL-Metafile, including all over the
+ time grown extra data in comments and PDF exception data creations. Also
+ printing needs some exception stuff.
+
+ All in all it is needed to emulate the old ::paint output from the old
+ Drawinglayer as long as exporters and/or filters still use the Metafile
+ and the extra-data added to it (which can be seen mostly as 'extensions'
+ or simply as 'hacks').
+ */
+ class DRAWINGLAYER_DLLPUBLIC VclMetafileProcessor2D : public VclProcessor2D
+ {
+ private:
+ /// local helper(s)
+ Rectangle impDumpToMetaFile(
+ const primitive2d::Primitive2DSequence& rContent,
+ GDIMetaFile& o_rContentMetafile);
+ void impConvertFillGradientAttributeToVCLGradient(
+ Gradient& o_rVCLGradient,
+ const attribute::FillGradientAttribute& rFiGrAtt,
+ bool bIsTransparenceGradient);
+ void impStartSvtGraphicFill(SvtGraphicFill* pSvtGraphicFill);
+ void impEndSvtGraphicFill(SvtGraphicFill* pSvtGraphicFill);
+ SvtGraphicStroke* impTryToCreateSvtGraphicStroke(
+ const basegfx::B2DPolygon& rB2DPolygon,
+ const basegfx::BColor* pColor,
+ const attribute::LineAttribute* pLineAttribute,
+ const attribute::StrokeAttribute* pStrokeAttribute,
+ const attribute::LineStartEndAttribute* pStart,
+ const attribute::LineStartEndAttribute* pEnd);
+ void impStartSvtGraphicStroke(SvtGraphicStroke* pSvtGraphicStroke);
+ void impEndSvtGraphicStroke(SvtGraphicStroke* pSvtGraphicStroke);
+
+ /// Convert the fWidth to the same space as its coordinates.
+ double getTransformedLineWidth( double fWidth ) const;
+
+ /// the current clipping PolyPolygon from MaskPrimitive2D
+ basegfx::B2DPolyPolygon maClipPolyPolygon;
+
+ /// the target MetaFile
+ GDIMetaFile* mpMetaFile;
+
+ /* do not allow embedding SvtGraphicFills into each other,
+ use a counter to prevent that
+ */
+ sal_uInt32 mnSvtGraphicFillCount;
+
+ /// same for SvtGraphicStroke
+ sal_uInt32 mnSvtGraphicStrokeCount;
+
+ /* hold the last unified transparence value to have it handy
+ on SvtGraphicStroke creation
+ */
+ double mfCurrentUnifiedTransparence;
+
+ /* break iterator support
+ made static so it only needs to be fetched once, even with many single
+ constructed VclMetafileProcessor2D. It's still incarnated on demand,
+ but exists for OOo runtime now by purpose.
+ */
+ static ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > mxBreakIterator;
+
+ /* vcl::PDFExtOutDevData support
+ For the first step, some extra actions at vcl::PDFExtOutDevData need to
+ be emulated with the VclMetafileProcessor2D. These are potentially temporarily
+ since PDF export may use PrimitiveSequences one day directly.
+ */
+ vcl::PDFExtOutDevData* mpPDFExtOutDevData;
+
+ protected:
+ /* the local processor for BasePrinitive2D-Implementation based primitives,
+ called from the common process()-implementation
+ */
+ virtual void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate);
+
+ public:
+ /// constructor/destructor
+ VclMetafileProcessor2D(
+ const geometry::ViewInformation2D& rViewInformation,
+ OutputDevice& rOutDev);
+ virtual ~VclMetafileProcessor2D();
+ };
+ } // end of namespace processor2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLMETAFILEPROCESSOR2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor2d/vclpixelprocessor2d.hxx b/include/drawinglayer/processor2d/vclpixelprocessor2d.hxx
new file mode 100644
index 000000000000..c3003f096467
--- /dev/null
+++ b/include/drawinglayer/processor2d/vclpixelprocessor2d.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLPIXELPROCESSOR2D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLPIXELPROCESSOR2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/processor2d/vclprocessor2d.hxx>
+#include <vcl/outdev.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor2d
+ {
+ /** VclPixelProcessor2D class
+
+ This processor derived from VclProcessor2D is the base class for rendering
+ all feeded primitives to a VCL Window. It is the currently used renderer
+ for all VCL editing output from the DrawingLayer.
+ */
+ class DRAWINGLAYER_DLLPUBLIC VclPixelProcessor2D : public VclProcessor2D
+ {
+ private:
+ protected:
+ /* the local processor for BasePrinitive2D-Implementation based primitives,
+ called from the common process()-implementation
+ */
+ virtual void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate);
+
+ public:
+ /// constructor/destructor
+ VclPixelProcessor2D(
+ const geometry::ViewInformation2D& rViewInformation,
+ OutputDevice& rOutDev);
+ virtual ~VclPixelProcessor2D();
+ };
+ } // end of namespace processor2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLPIXELPROCESSOR2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor2d/vclprocessor2d.hxx b/include/drawinglayer/processor2d/vclprocessor2d.hxx
new file mode 100644
index 000000000000..32dafbc42b0a
--- /dev/null
+++ b/include/drawinglayer/processor2d/vclprocessor2d.hxx
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLPROCESSOR2D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLPROCESSOR2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/processor2d/baseprocessor2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/color/bcolormodifier.hxx>
+#include <svtools/optionsdrawinglayer.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+class OutputDevice;
+
+namespace drawinglayer { namespace primitive2d {
+ class TextSimplePortionPrimitive2D;
+ class PolygonHairlinePrimitive2D;
+ class BitmapPrimitive2D;
+ class FillBitmapPrimitive2D;
+ class PolyPolygonGradientPrimitive2D;
+ class PolyPolygonBitmapPrimitive2D;
+ class PolyPolygonColorPrimitive2D;
+ class MetafilePrimitive2D;
+ class MaskPrimitive2D;
+ class UnifiedTransparencePrimitive2D;
+ class TransparencePrimitive2D;
+ class TransformPrimitive2D;
+ class MarkerArrayPrimitive2D;
+ class PointArrayPrimitive2D;
+ class ModifiedColorPrimitive2D;
+ class PolygonStrokePrimitive2D;
+ class ControlPrimitive2D;
+ class PagePreviewPrimitive2D;
+ class EpsPrimitive2D;
+ class SvgLinearAtomPrimitive2D;
+ class SvgRadialAtomPrimitive2D;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor2d
+ {
+ /** VclProcessor2D class
+
+ This processor is the base class for VCL-Based processors. It has no
+ processBasePrimitive2D implementation and thus is not usable directly.
+ */
+ class DRAWINGLAYER_DLLPUBLIC VclProcessor2D : public BaseProcessor2D
+ {
+ protected:
+ // the destination OutDev
+ OutputDevice* mpOutputDevice;
+
+ // the modifiedColorPrimitive stack
+ basegfx::BColorModifierStack maBColorModifierStack;
+
+ // the current transformation. Since VCL pixel renderer transforms to pixels
+ // and VCL MetaFile renderer to World (logic) coordinates, the local
+ // ViewInformation2D cannot directly be used, but needs to be kept up to date
+ basegfx::B2DHomMatrix maCurrentTransformation;
+
+ // SvtOptionsDrawinglayer incarnation to react on diverse settings
+ const SvtOptionsDrawinglayer maDrawinglayerOpt;
+
+ // stack value (increment and decrement) to count how deep we are in
+ // PolygonStrokePrimitive2D's decompositions (normally only one)
+ sal_uInt32 mnPolygonStrokePrimitive2D;
+
+ //////////////////////////////////////////////////////////////////////////////
+ // common VCL rendering support
+
+ void RenderTextSimpleOrDecoratedPortionPrimitive2D(const primitive2d::TextSimplePortionPrimitive2D& rTextCandidate);
+ void RenderPolygonHairlinePrimitive2D(const primitive2d::PolygonHairlinePrimitive2D& rPolygonCandidate, bool bPixelBased);
+ void RenderBitmapPrimitive2D(const primitive2d::BitmapPrimitive2D& rBitmapCandidate);
+ void RenderFillBitmapPrimitive2D(const primitive2d::FillBitmapPrimitive2D& rFillBitmapCandidate);
+ void RenderPolyPolygonGradientPrimitive2D(const primitive2d::PolyPolygonGradientPrimitive2D& rPolygonCandidate);
+ void RenderPolyPolygonBitmapPrimitive2D(const primitive2d::PolyPolygonBitmapPrimitive2D& rPolygonCandidate);
+ void RenderPolyPolygonColorPrimitive2D(const primitive2d::PolyPolygonColorPrimitive2D& rPolygonCandidate);
+ void RenderMetafilePrimitive2D(const primitive2d::MetafilePrimitive2D& rPolygonCandidate);
+ void RenderMaskPrimitive2DPixel(const primitive2d::MaskPrimitive2D& rMaskCandidate);
+ void RenderModifiedColorPrimitive2D(const primitive2d::ModifiedColorPrimitive2D& rModifiedCandidate);
+ void RenderUnifiedTransparencePrimitive2D(const primitive2d::UnifiedTransparencePrimitive2D& rTransCandidate);
+ void RenderTransparencePrimitive2D(const primitive2d::TransparencePrimitive2D& rTransCandidate);
+ void RenderTransformPrimitive2D(const primitive2d::TransformPrimitive2D& rTransformCandidate);
+ void RenderPagePreviewPrimitive2D(const primitive2d::PagePreviewPrimitive2D& rPagePreviewCandidate);
+ void RenderMarkerArrayPrimitive2D(const primitive2d::MarkerArrayPrimitive2D& rMarkerArrayCandidate);
+ void RenderPointArrayPrimitive2D(const primitive2d::PointArrayPrimitive2D& rPointArrayCandidate);
+ void RenderPolygonStrokePrimitive2D(const primitive2d::PolygonStrokePrimitive2D& rPolygonStrokeCandidate);
+ void RenderEpsPrimitive2D(const primitive2d::EpsPrimitive2D& rEpsPrimitive2D);
+ void RenderSvgLinearAtomPrimitive2D(const primitive2d::SvgLinearAtomPrimitive2D& rCandidate);
+ void RenderSvgRadialAtomPrimitive2D(const primitive2d::SvgRadialAtomPrimitive2D& rCandidate);
+
+ /////////////////////////////////////////////////////////////////////////////
+ // DrawMode adaption support
+ void adaptLineToFillDrawMode() const;
+ void adaptTextToFillDrawMode() const;
+
+ public:
+ // constructor/destructor
+ VclProcessor2D(
+ const geometry::ViewInformation2D& rViewInformation,
+ OutputDevice& rOutDev);
+ virtual ~VclProcessor2D();
+
+ // access to Drawinglayer configuration options
+ const SvtOptionsDrawinglayer& getOptionsDrawinglayer() const { return maDrawinglayerOpt; }
+ };
+ } // end of namespace processor2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLPROCESSOR2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor3d/baseprocessor3d.hxx b/include/drawinglayer/processor3d/baseprocessor3d.hxx
new file mode 100644
index 000000000000..834779982ba5
--- /dev/null
+++ b/include/drawinglayer/processor3d/baseprocessor3d.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR3D_BASEPROCESSOR3D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR3D_BASEPROCESSOR3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/baseprimitive3d.hxx>
+#include <drawinglayer/geometry/viewinformation3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor3d
+ {
+ /** BaseProcessor3D class
+
+ Baseclass for all C++ implementations of instances which process
+ primitives.
+
+ Please have a look at baseprocessor2d.hxx for more comments.
+ */
+ class DRAWINGLAYER_DLLPUBLIC BaseProcessor3D
+ {
+ private:
+ geometry::ViewInformation3D maViewInformation3D;
+
+ protected:
+ void updateViewInformation(const geometry::ViewInformation3D& rViewInformation3D)
+ {
+ maViewInformation3D = rViewInformation3D;
+ }
+
+ /* as tooling, the process() implementation takes over API handling and calls this
+ virtual render method when the primitive implementation is BasePrimitive3D-based.
+ Default implementation does nothing
+ */
+ virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate);
+
+ public:
+ explicit BaseProcessor3D(const geometry::ViewInformation3D& rViewInformation);
+ virtual ~BaseProcessor3D();
+
+ // the central processing method
+ virtual void process(const primitive3d::Primitive3DSequence& rSource);
+
+ // data access
+ const geometry::ViewInformation3D& getViewInformation3D() const { return maViewInformation3D; }
+ };
+ } // end of namespace processor3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_DRAWINGLAYER_PROCESSOR3D_BASEPROCESSOR3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor3d/cutfindprocessor3d.hxx b/include/drawinglayer/processor3d/cutfindprocessor3d.hxx
new file mode 100644
index 000000000000..2b4714ca3054
--- /dev/null
+++ b/include/drawinglayer/processor3d/cutfindprocessor3d.hxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR3D_CUTFINDPROCESSOR3D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR3D_CUTFINDPROCESSOR3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/processor3d/defaultprocessor3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor3d
+ {
+ /** CutFindProcessor class
+
+ This processor extracts all cuts of 3D plane geometries in the feeded primitives
+ with the given cut vector, based on the ViewInformation3D given.
+ */
+ class DRAWINGLAYER_DLLPUBLIC CutFindProcessor : public BaseProcessor3D
+ {
+ private:
+ /// the start and stop point for the cut vector
+ basegfx::B3DPoint maFront;
+ basegfx::B3DPoint maBack;
+
+ /// the found cut points
+ ::std::vector< basegfx::B3DPoint > maResult;
+
+ /* #i102956# the transformation change from TransformPrimitive3D processings
+ needs to be remembered to be able to transform found cuts to the
+ basic coordinate system the processor starts with
+ */
+ basegfx::B3DHomMatrix maCombinedTransform;
+
+ /// bitfield
+ bool mbAnyHit : 1;
+
+ /* this flag decides if primitives which are invisible will be taken into account for
+ HitTesting or not.
+ */
+ bool mbUseInvisiblePrimitiveContent : 1;
+
+ /* as tooling, the process() implementation takes over API handling and calls this
+ virtual render method when the primitive implementation is BasePrimitive3D-based.
+ */
+ virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate);
+
+ public:
+ CutFindProcessor(const geometry::ViewInformation3D& rViewInformation,
+ const basegfx::B3DPoint& rFront,
+ const basegfx::B3DPoint& rBack,
+ bool bAnyHit);
+
+ /// data write access
+ void setUseInvisiblePrimitiveContent(bool bNew)
+ {
+ if((bool)mbUseInvisiblePrimitiveContent != bNew) mbUseInvisiblePrimitiveContent = bNew;
+ }
+
+ /// data read access
+ const ::std::vector< basegfx::B3DPoint >& getCutPoints() const { return maResult; }
+ bool getAnyHit() const { return mbAnyHit; }
+ bool getUseInvisiblePrimitiveContent() const { return mbUseInvisiblePrimitiveContent;}
+ };
+ } // end of namespace processor3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PROCESSOR3D_CUTFINDPROCESSOR3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor3d/defaultprocessor3d.hxx b/include/drawinglayer/processor3d/defaultprocessor3d.hxx
new file mode 100644
index 000000000000..010fba3b1f1d
--- /dev/null
+++ b/include/drawinglayer/processor3d/defaultprocessor3d.hxx
@@ -0,0 +1,158 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR3D_DEFAULTPROCESSOR3D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR3D_DEFAULTPROCESSOR3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/processor3d/baseprocessor3d.hxx>
+#include <basegfx/matrix/b3dhommatrix.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/color/bcolormodifier.hxx>
+#include <svtools/optionsdrawinglayer.hxx>
+#include <boost/shared_ptr.hpp>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx {
+ class BZPixelRaster;
+ class B3DPolygon;
+ class B3DPolyPolygon;
+}
+
+namespace drawinglayer { namespace attribute {
+ class SdrSceneAttribute;
+ class SdrLightingAttribute;
+ class MaterialAttribute3D;
+}}
+
+namespace drawinglayer { namespace primitive3d {
+ class PolygonHairlinePrimitive3D;
+ class PolyPolygonMaterialPrimitive3D;
+ class GradientTexturePrimitive3D;
+ class HatchTexturePrimitive3D;
+ class BitmapTexturePrimitive3D;
+ class TransformPrimitive3D;
+ class ModifiedColorPrimitive3D;
+}}
+
+namespace drawinglayer { namespace texture {
+ class GeoTexSvx;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor3d
+ {
+ /** DefaultProcessor3D class
+
+ This processor renders all feeded primitives to a 2D raster where for all
+ primitives the two basic methods rasterconvertB3DPolygon for hairlines and
+ rasterconvertB3DPolyPolygon for filled geometry is called. It is a beseclass to
+ e.g. base a Z-Buffer supported renderer on the 3D primitive processing.
+ */
+ class DRAWINGLAYER_DLLPUBLIC DefaultProcessor3D : public BaseProcessor3D
+ {
+ protected:
+ /// read-only scene infos (normal handling, etc...)
+ const attribute::SdrSceneAttribute& mrSdrSceneAttribute;
+
+ /// read-only light infos (lights, etc...)
+ const attribute::SdrLightingAttribute& mrSdrLightingAttribute;
+
+ /// renderer range. Need to be correctly set by the derived implementations
+ /// normally the (0, 0, W, H) range from mpBZPixelRaster
+ basegfx::B2DRange maRasterRange;
+
+ /// the modifiedColorPrimitive stack
+ basegfx::BColorModifierStack maBColorModifierStack;
+
+ /// the current active texture
+ boost::shared_ptr< texture::GeoTexSvx > mpGeoTexSvx;
+
+ /// the current active transparence texture
+ boost::shared_ptr< texture::GeoTexSvx > mpTransparenceGeoTexSvx;
+
+ /// SvtOptionsDrawinglayer incarnation to react on diverse settings
+ const SvtOptionsDrawinglayer maDrawinglayerOpt;
+
+ /// counter for entered transparence textures
+ sal_uInt32 mnTransparenceCounter;
+
+ /// bitfield
+ unsigned mbModulate : 1;
+ unsigned mbFilter : 1;
+ unsigned mbSimpleTextureActive : 1;
+
+ //////////////////////////////////////////////////////////////////////////////
+ // rendering support
+
+ void impRenderGradientTexturePrimitive3D(const primitive3d::GradientTexturePrimitive3D& rPrimitive, bool bTransparence);
+ void impRenderHatchTexturePrimitive3D(const primitive3d::HatchTexturePrimitive3D& rPrimitive);
+ void impRenderBitmapTexturePrimitive3D(const primitive3d::BitmapTexturePrimitive3D& rPrimitive);
+ void impRenderModifiedColorPrimitive3D(const primitive3d::ModifiedColorPrimitive3D& rModifiedCandidate);
+ void impRenderPolygonHairlinePrimitive3D(const primitive3d::PolygonHairlinePrimitive3D& rPrimitive);
+ void impRenderPolyPolygonMaterialPrimitive3D(const primitive3d::PolyPolygonMaterialPrimitive3D& rPrimitive);
+ void impRenderTransformPrimitive3D(const primitive3d::TransformPrimitive3D& rTransformCandidate);
+
+ //////////////////////////////////////////////////////////////////////////////
+ // rasterconversions for filled and non-filled polygons. These NEED to be
+ // implemented from derivations
+
+ virtual void rasterconvertB3DPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolygon& rHairline) const = 0;
+ virtual void rasterconvertB3DPolyPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolyPolygon& rFill) const = 0;
+
+ // the processing method for a single, known primitive
+ virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rBasePrimitive);
+
+ public:
+ DefaultProcessor3D(
+ const geometry::ViewInformation3D& rViewInformation,
+ const attribute::SdrSceneAttribute& rSdrSceneAttribute,
+ const attribute::SdrLightingAttribute& rSdrLightingAttribute);
+ virtual ~DefaultProcessor3D();
+
+ /// data read access
+ const attribute::SdrSceneAttribute& getSdrSceneAttribute() const { return mrSdrSceneAttribute; }
+ const attribute::SdrLightingAttribute& getSdrLightingAttribute() const { return mrSdrLightingAttribute; }
+
+ /// data read access renderer stuff
+ const basegfx::BColorModifierStack& getBColorModifierStack() const { return maBColorModifierStack; }
+ const boost::shared_ptr< texture::GeoTexSvx >& getGeoTexSvx() const { return mpGeoTexSvx; }
+ const boost::shared_ptr< texture::GeoTexSvx >& getTransparenceGeoTexSvx() const { return mpTransparenceGeoTexSvx; }
+ sal_uInt32 getTransparenceCounter() const { return mnTransparenceCounter; }
+ bool getModulate() const { return mbModulate; }
+ bool getFilter() const { return mbFilter; }
+ bool getSimpleTextureActive() const { return mbSimpleTextureActive; }
+
+ /// access to Drawinglayer configuration options
+ const SvtOptionsDrawinglayer& getOptionsDrawinglayer() const { return maDrawinglayerOpt; }
+ };
+ } // end of namespace processor3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PROCESSOR3D_DEFAULTPROCESSOR3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor3d/geometry2dextractor.hxx b/include/drawinglayer/processor3d/geometry2dextractor.hxx
new file mode 100644
index 000000000000..d85e6843f54d
--- /dev/null
+++ b/include/drawinglayer/processor3d/geometry2dextractor.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR3D_GEOMETRY2DEXTRACTOR_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR3D_GEOMETRY2DEXTRACTOR_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/processor3d/baseprocessor3d.hxx>
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/matrix/b3dhommatrix.hxx>
+#include <basegfx/color/bcolormodifier.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor3d
+ {
+ /** Geometry2DExtractingProcessor class
+
+ This processor extracts the 2D geometry (projected geometry) of all feeded primitives.
+ It is e.g. used as sub-processor for contour extraction where 3D geometry is only
+ useful as 2D projected geometry.
+ */
+ class DRAWINGLAYER_DLLPUBLIC Geometry2DExtractingProcessor : public BaseProcessor3D
+ {
+ private:
+ /// result holding vector (2D)
+ primitive2d::Primitive2DSequence maPrimitive2DSequence;
+
+ /// object transformation for scene for 2d definition
+ basegfx::B2DHomMatrix maObjectTransformation;
+
+ /// the modifiedColorPrimitive stack
+ basegfx::BColorModifierStack maBColorModifierStack;
+
+ /* as tooling, the process() implementation takes over API handling and calls this
+ virtual render method when the primitive implementation is BasePrimitive3D-based.
+ */
+ virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate);
+
+ public:
+ Geometry2DExtractingProcessor(
+ const geometry::ViewInformation3D& rViewInformation,
+ const basegfx::B2DHomMatrix& rObjectTransformation);
+
+ // data read access
+ const primitive2d::Primitive2DSequence& getPrimitive2DSequence() const { return maPrimitive2DSequence; }
+ const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
+ const basegfx::BColorModifierStack& getBColorModifierStack() const { return maBColorModifierStack; }
+ };
+ } // end of namespace processor3d
+} // end of namespace drawinglayer
+
+#endif //INCLUDED_DRAWINGLAYER_PROCESSOR3D_GEOMETRY2DEXTRACTOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor3d/shadow3dextractor.hxx b/include/drawinglayer/processor3d/shadow3dextractor.hxx
new file mode 100644
index 000000000000..183d61271c83
--- /dev/null
+++ b/include/drawinglayer/processor3d/shadow3dextractor.hxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR3D_SHADOW3DEXTRACTOR_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR3D_SHADOW3DEXTRACTOR_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/processor3d/baseprocessor3d.hxx>
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b3dhommatrix.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b3dpolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b3dpolypolygon.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor3d
+ {
+ /** Shadow3DExtractingProcessor class
+
+ This processor extracts the 2D shadow geometry (projected geometry) of all feeded primitives.
+ It is used to create the shadow of 3D objects which consists of 2D geometry. It needs quite
+ some data to do so since we do not only offer flat projected 2D shadow, but also projections
+ dependent on the light source
+ */
+ class DRAWINGLAYER_DLLPUBLIC Shadow3DExtractingProcessor : public BaseProcessor3D
+ {
+ private:
+ /// result holding vector (2D) and target vector for stacking (inited to &maPrimitive2DSequence)
+ primitive2d::Primitive2DVector maPrimitive2DSequence;
+ primitive2d::Primitive2DVector* mpPrimitive2DSequence;
+
+ /// object transformation for scene for 2d definition
+ basegfx::B2DHomMatrix maObjectTransformation;
+
+ /// prepared data (transformations) for 2D/3D shadow calculations
+ basegfx::B3DHomMatrix maWorldToEye;
+ basegfx::B3DHomMatrix maEyeToView;
+ basegfx::B3DVector maLightNormal;
+ basegfx::B3DVector maShadowPlaneNormal;
+ basegfx::B3DPoint maPlanePoint;
+ double mfLightPlaneScalar;
+
+ /* the shadow color used for sub-primitives. Can stay at black since
+ the encapsulating 2d shadow primitive will contain the color
+ */
+ basegfx::BColor maPrimitiveColor;
+
+ /// bitfield
+ /// flag if shadow plane projection preparation leaded to valid results
+ unsigned mbShadowProjectionIsValid : 1;
+
+ /// flag if conversion is switched on
+ unsigned mbConvert : 1;
+
+ /// flag if conversion shall use projection
+ unsigned mbUseProjection : 1;
+
+ /// local helpers
+ basegfx::B2DPolygon impDoShadowProjection(const basegfx::B3DPolygon& rSource);
+ basegfx::B2DPolyPolygon impDoShadowProjection(const basegfx::B3DPolyPolygon& rSource);
+
+ /* as tooling, the process() implementation takes over API handling and calls this
+ virtual render method when the primitive implementation is BasePrimitive3D-based.
+ */
+ virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate);
+
+ public:
+ Shadow3DExtractingProcessor(
+ const geometry::ViewInformation3D& rViewInformation,
+ const basegfx::B2DHomMatrix& rObjectTransformation,
+ const basegfx::B3DVector& rLightNormal,
+ double fShadowSlant,
+ const basegfx::B3DRange& rContained3DRange);
+ virtual ~Shadow3DExtractingProcessor();
+
+ /// data read access
+ const primitive2d::Primitive2DSequence getPrimitive2DSequence() const;
+ const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
+ const basegfx::B3DHomMatrix& getWorldToEye() const { return maWorldToEye; }
+ const basegfx::B3DHomMatrix& getEyeToView() const { return maEyeToView; }
+ };
+ } // end of namespace processor3d
+} // end of namespace drawinglayer
+
+#endif //_DRAWINGLAYER_PROCESSOR3D_SHADOW3DEXTRACTOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor3d/zbufferprocessor3d.hxx b/include/drawinglayer/processor3d/zbufferprocessor3d.hxx
new file mode 100644
index 000000000000..8570809b465d
--- /dev/null
+++ b/include/drawinglayer/processor3d/zbufferprocessor3d.hxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR3D_ZBUFFERPROCESSOR3D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR3D_ZBUFFERPROCESSOR3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/processor3d/defaultprocessor3d.hxx>
+#include <vcl/bitmapex.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx {
+ class BZPixelRaster;
+}
+
+namespace drawinglayer {
+ namespace attribute {
+ class SdrSceneAttribute;
+ class SdrLightingAttribute;
+ class MaterialAttribute3D;
+ }
+ namespace geometry {
+ class ViewInformation2D;
+ }
+}
+
+class ZBufferRasterConverter3D;
+class RasterPrimitive3D;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor3d
+ {
+ /** ZBufferProcessor3D class
+
+ This 3D renderer derived from DefaultProcessor3D renders all feeded primitives to a 2D
+ raster bitmap using a Z-Buffer based approach. It is able to supersample and to handle
+ transparent content.
+ */
+ class DRAWINGLAYER_DLLPUBLIC ZBufferProcessor3D : public DefaultProcessor3D
+ {
+ private:
+ /// the raster target, a Z-Buffer
+ basegfx::BZPixelRaster* mpBZPixelRaster;
+
+ /// inverse of EyeToView for rasterconversion with evtl. Phong shading
+ basegfx::B3DHomMatrix maInvEyeToView;
+
+ /// The raster converter for Z-Buffer
+ ZBufferRasterConverter3D* mpZBufferRasterConverter3D;
+
+ /* AA value. Defines how many oversmples will be used in X and Y. Values 0, 1
+ will switch it off while e.g. 2 will use 2x2 pixels for each pixel to create
+ */
+ sal_uInt16 mnAntiAlialize;
+
+ /* remembered RasterPrimitive3D's which need to be painted back to front
+ for transparent 3D parts
+ */
+ std::vector< RasterPrimitive3D >* mpRasterPrimitive3Ds;
+
+ //////////////////////////////////////////////////////////////////////////////
+ // rasterconversions for filled and non-filled polygons
+
+ virtual void rasterconvertB3DPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolygon& rHairline) const;
+ virtual void rasterconvertB3DPolyPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolyPolygon& rFill) const;
+
+ public:
+ ZBufferProcessor3D(
+ const geometry::ViewInformation3D& rViewInformation3D,
+ const geometry::ViewInformation2D& rViewInformation2D,
+ const attribute::SdrSceneAttribute& rSdrSceneAttribute,
+ const attribute::SdrLightingAttribute& rSdrLightingAttribute,
+ double fSizeX,
+ double fSizeY,
+ const basegfx::B2DRange& rVisiblePart,
+ sal_uInt16 nAntiAlialize);
+ virtual ~ZBufferProcessor3D();
+
+ void finish();
+
+ /// get the result as bitmapEx
+ BitmapEx getBitmapEx() const;
+ };
+ } // end of namespace processor3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PROCESSOR3D_ZBUFFERPROCESSOR3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/texture/texture.hxx b/include/drawinglayer/texture/texture.hxx
new file mode 100644
index 000000000000..5d1751d70889
--- /dev/null
+++ b/include/drawinglayer/texture/texture.hxx
@@ -0,0 +1,260 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_TEXTURE_TEXTURE_HXX
+#define INCLUDED_DRAWINGLAYER_TEXTURE_TEXTURE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/tools/gradienttools.hxx>
+#include <vector>
+
+//////////////////////////////////////////////////////////////////////////////
+namespace drawinglayer
+{
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvx
+ {
+ public:
+ GeoTexSvx();
+ virtual ~GeoTexSvx();
+
+ // compare operator
+ virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const;
+ bool operator!=(const GeoTexSvx& rGeoTexSvx) const { return !operator==(rGeoTexSvx); }
+
+ // virtual base methods
+ virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices);
+ virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
+ virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const;
+ };
+ } // end of namespace texture
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradient : public GeoTexSvx
+ {
+ protected:
+ basegfx::ODFGradientInfo maGradientInfo;
+ basegfx::B2DRange maTargetRange;
+ basegfx::BColor maStart;
+ basegfx::BColor maEnd;
+ double mfBorder;
+
+ // helpers
+ void impAppendMatrix(::std::vector< basegfx::B2DHomMatrix >& rMatrices, const basegfx::B2DRange& rRange);
+ void impAppendColorsRadial(::std::vector< basegfx::BColor >& rColors);
+
+ public:
+ GeoTexSvxGradient(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder);
+ virtual ~GeoTexSvxGradient();
+
+ // compare operator
+ virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const;
+
+ // virtual base methods
+ virtual void appendColors(::std::vector< basegfx::BColor >& rColors) = 0;
+
+ // data access
+ const basegfx::BColor& getStart() const { return maStart; }
+ const basegfx::BColor& getEnd() const { return maEnd; }
+ };
+ } // end of namespace texture
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientLinear : public GeoTexSvxGradient
+ {
+ public:
+ GeoTexSvxGradientLinear(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fAngle);
+ virtual ~GeoTexSvxGradientLinear();
+
+ virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices);
+ virtual void appendColors(::std::vector< basegfx::BColor >& rColors);
+ virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
+ };
+ } // end of namespace texture
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientAxial : public GeoTexSvxGradient
+ {
+ public:
+ GeoTexSvxGradientAxial(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fAngle);
+ virtual ~GeoTexSvxGradientAxial();
+
+ virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices);
+ virtual void appendColors(::std::vector< basegfx::BColor >& rColors);
+ virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
+ };
+ } // end of namespace texture
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientRadial : public GeoTexSvxGradient
+ {
+ public:
+ GeoTexSvxGradientRadial(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fOffsetX, double fOffsetY);
+ virtual ~GeoTexSvxGradientRadial();
+
+ virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices);
+ virtual void appendColors(::std::vector< basegfx::BColor >& rColors);
+ virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
+ };
+ } // end of namespace texture
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientElliptical : public GeoTexSvxGradient
+ {
+ public:
+ GeoTexSvxGradientElliptical(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fOffsetX, double fOffsetY, double fAngle);
+ virtual ~GeoTexSvxGradientElliptical();
+
+ virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices);
+ virtual void appendColors(::std::vector< basegfx::BColor >& rColors);
+ virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
+ };
+ } // end of namespace texture
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientSquare : public GeoTexSvxGradient
+ {
+ public:
+ GeoTexSvxGradientSquare(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fOffsetX, double fOffsetY, double fAngle);
+ virtual ~GeoTexSvxGradientSquare();
+
+ virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices);
+ virtual void appendColors(::std::vector< basegfx::BColor >& rColors);
+ virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
+ };
+ } // end of namespace texture
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientRect : public GeoTexSvxGradient
+ {
+ public:
+ GeoTexSvxGradientRect(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fOffsetX, double fOffsetY, double fAngle);
+ virtual ~GeoTexSvxGradientRect();
+
+ virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices);
+ virtual void appendColors(::std::vector< basegfx::BColor >& rColors);
+ virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
+ };
+ } // end of namespace texture
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxHatch : public GeoTexSvx
+ {
+ protected:
+ basegfx::B2DHomMatrix maTextureTransform;
+ basegfx::B2DHomMatrix maBackTextureTransform;
+ double mfDistance;
+ double mfAngle;
+ sal_uInt32 mnSteps;
+
+ public:
+ GeoTexSvxHatch(const basegfx::B2DRange& rTargetRange, double fDistance, double fAngle);
+ virtual ~GeoTexSvxHatch();
+
+ // compare operator
+ virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const;
+
+ virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices);
+ double getDistanceToHatch(const basegfx::B2DPoint& rUV) const;
+ };
+ } // end of namespace texture
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxTiled : public GeoTexSvx
+ {
+ protected:
+ basegfx::B2DPoint maTopLeft;
+ basegfx::B2DVector maSize;
+
+ public:
+ GeoTexSvxTiled(const basegfx::B2DPoint& rTopLeft, const basegfx::B2DVector& rSize);
+ virtual ~GeoTexSvxTiled();
+
+ // compare operator
+ virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const;
+
+ virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices);
+ };
+ } // end of namespace texture
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_DRAWINGLAYER_TEXTURE_TEXTURE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/texture/texture3d.hxx b/include/drawinglayer/texture/texture3d.hxx
new file mode 100644
index 000000000000..713cea76c928
--- /dev/null
+++ b/include/drawinglayer/texture/texture3d.hxx
@@ -0,0 +1,159 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_TEXTURE_TEXTURE3D_HXX
+#define INCLUDED_DRAWINGLAYER_TEXTURE_TEXTURE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/texture/texture.hxx>
+#include <vcl/bitmap.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+namespace drawinglayer { namespace primitive3d {
+ class HatchTexturePrimitive3D;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxMono : public GeoTexSvx
+ {
+ protected:
+ basegfx::BColor maSingleColor;
+ double mfOpacity;
+
+ public:
+ GeoTexSvxMono(const basegfx::BColor& rSingleColor, double fOpacity);
+
+ // compare operator
+ virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const;
+ virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
+ virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const;
+ };
+ } // end of namespace texture
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxBitmap : public GeoTexSvx
+ {
+ protected:
+ Bitmap maBitmap;
+ BitmapReadAccess* mpRead;
+ basegfx::B2DPoint maTopLeft;
+ basegfx::B2DVector maSize;
+ double mfMulX;
+ double mfMulY;
+
+ // helpers
+ bool impIsValid(const basegfx::B2DPoint& rUV, sal_Int32& rX, sal_Int32& rY) const;
+
+ public:
+ GeoTexSvxBitmap(const Bitmap& rBitmap, const basegfx::B2DPoint& rTopLeft, const basegfx::B2DVector& rSize);
+ virtual ~GeoTexSvxBitmap();
+ virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
+ virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const;
+ };
+ } // end of namespace texture
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxBitmapTiled : public GeoTexSvxBitmap
+ {
+ protected:
+ // helpers
+ basegfx::B2DPoint impGetCorrected(const basegfx::B2DPoint& rUV) const
+ {
+ double fX(fmod(rUV.getX() - maTopLeft.getX(), maSize.getX()));
+ double fY(fmod(rUV.getY() - maTopLeft.getY(), maSize.getY()));
+
+ if(fX < 0.0)
+ {
+ fX += maSize.getX();
+ }
+
+ if(fY < 0.0)
+ {
+ fY += maSize.getY();
+ }
+
+ return basegfx::B2DPoint(fX + maTopLeft.getX(), fY + maTopLeft.getY());
+ }
+
+ public:
+ GeoTexSvxBitmapTiled(const Bitmap& rBitmap, const basegfx::B2DPoint& rTopLeft, const basegfx::B2DVector& rSize);
+ virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
+ virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const;
+ };
+ } // end of namespace texture
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxMultiHatch : public GeoTexSvx
+ {
+ protected:
+ basegfx::BColor maColor;
+ double mfLogicPixelSize;
+ GeoTexSvxHatch* mp0;
+ GeoTexSvxHatch* mp1;
+ GeoTexSvxHatch* mp2;
+
+ // bitfield
+ unsigned mbFillBackground : 1;
+
+ // helpers
+ bool impIsOnHatch(const basegfx::B2DPoint& rUV) const;
+
+ public:
+ GeoTexSvxMultiHatch(const primitive3d::HatchTexturePrimitive3D& rPrimitive, double fLogicPixelSize);
+ virtual ~GeoTexSvxMultiHatch();
+ virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
+ virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const;
+
+ // dada access
+ bool getFillBackground() const { return mbFillBackground; }
+ };
+ } // end of namespace texture
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_TEXTURE_TEXTURE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/tools/converters.hxx b/include/drawinglayer/tools/converters.hxx
new file mode 100644
index 000000000000..5bc9ddbb18e4
--- /dev/null
+++ b/include/drawinglayer/tools/converters.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_TOOLS_CONVERTERS_HXX
+#define INCLUDED_DRAWINGLAYER_TOOLS_CONVERTERS_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <vcl/bitmapex.hxx>
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace tools
+ {
+ BitmapEx DRAWINGLAYER_DLLPUBLIC convertToBitmapEx(
+ const drawinglayer::primitive2d::Primitive2DSequence& rSeq,
+ const geometry::ViewInformation2D& rViewInformation2D,
+ sal_uInt32 nDiscreteWidth,
+ sal_uInt32 nDiscreteHeight,
+ sal_uInt32 nMaxQuadratPixels);
+
+ } // end of namespace tools
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_TOOLS_CONVERTERS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/AccessibleComponentBase.hxx b/include/editeng/AccessibleComponentBase.hxx
new file mode 100644
index 000000000000..ea292e0e439c
--- /dev/null
+++ b/include/editeng/AccessibleComponentBase.hxx
@@ -0,0 +1,141 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef _SVX_ACCESSIBILITY_ACCESSIBLE_EXTENDED_COMPONENT_BASE_HXX
+#define _SVX_ACCESSIBILITY_ACCESSIBLE_EXTENDED_COMPONENT_BASE_HXX
+
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp>
+#include <com/sun/star/awt/XFocusListener.hpp>
+#include "editeng/editengdllapi.h"
+
+namespace accessibility {
+
+/** @descr
+ This base class provides (will provice) a base implementation of the
+ <type>XAccessibleComponent</type> and the
+ <type>XAccessibleExtendedComponent</type> for all shapes. For
+ more detailed documentation about the methods refer to the interface
+ descriptions of <type>XAccessible</type>,
+ <type>XAccessibleContext</type>, <type>XInterface</type>,
+ <type>XServiceInfo</type>, and <type>XTypeProvider</type>.
+*/
+class EDITENG_DLLPUBLIC AccessibleComponentBase
+ : public ::com::sun::star::accessibility::XAccessibleExtendedComponent
+{
+public:
+ //===== internal ========================================================
+ AccessibleComponentBase (void);
+ virtual ~AccessibleComponentBase (void);
+
+
+ //===== XAccessibleComponent ================================================
+
+ /** The default implementation uses the result of
+ <member>getBounds</member> to determine whether the given point lies
+ inside this object.
+ */
+ virtual sal_Bool SAL_CALL containsPoint (
+ const ::com::sun::star::awt::Point& aPoint)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** The default implementation returns an empty reference.
+ */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleAtPoint (
+ const ::com::sun::star::awt::Point& aPoint)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** The default implementation returns an empty rectangle.
+ */
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** The default implementation uses the result of
+ <member>getBounds</member> to determine the location.
+ */
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** The default implementation returns an empty position, i.e. the
+ * result of the default constructor of <type>com::sun::star::awt::Point</type>.
+ */
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** The default implementation uses the result of
+ <member>getBounds</member> to determine the size.
+ */
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** The default implementation ignores this call.
+ */
+ virtual void SAL_CALL addFocusListener (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XFocusListener >& xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** The default implementation ignores this call.
+ */
+ virtual void SAL_CALL removeFocusListener (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XFocusListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** The default implementation does nothing.
+ */
+ virtual void SAL_CALL grabFocus (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Returns black as the default foreground color.
+ */
+ virtual sal_Int32 SAL_CALL getForeground (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Returns white as the default background color.
+ */
+ virtual sal_Int32 SAL_CALL getBackground (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== XAccessibleExtendedComponent ====================================
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL
+ getFont (void)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getTitledBorderText (void)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getToolTipText (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ //===== XTypeProvider ===================================================
+
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL
+ getTypes (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/AccessibleContextBase.hxx b/include/editeng/AccessibleContextBase.hxx
new file mode 100644
index 000000000000..574582a68ae1
--- /dev/null
+++ b/include/editeng/AccessibleContextBase.hxx
@@ -0,0 +1,388 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_ACCESSIBILITY_ACCESSIBLE_CONTEXT_BASE_HXX
+#define _SVX_ACCESSIBILITY_ACCESSIBLE_CONTEXT_BASE_HXX
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/accessibility/XAccessibleStateSet.hpp>
+#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
+#include <com/sun/star/accessibility/AccessibleEventObject.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/IllegalAccessibleComponentStateException.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <cppuhelper/weak.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <osl/mutex.hxx>
+#include <cppuhelper/compbase4.hxx>
+#include <editeng/editengdllapi.h>
+
+
+namespace accessibility {
+
+struct MutexOwner {mutable ::osl::Mutex maMutex;};
+
+/** @descr
+ This base class provides an implementation of the
+ <type>AccessibleContext</type> service. Appart from the
+ <type>XXAccessible<type> and <type>XAccessibleContextContext</type>
+ interfaces it supports the <type>XServiceInfo</type> interface.
+*/
+class EDITENG_DLLPUBLIC AccessibleContextBase
+ : public MutexOwner,
+ public cppu::PartialWeakComponentImplHelper4<
+ ::com::sun::star::accessibility::XAccessible,
+ ::com::sun::star::accessibility::XAccessibleContext,
+ ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
+ ::com::sun::star::lang::XServiceInfo
+ >
+{
+public:
+
+ //===== internal ========================================================
+
+ /** The origin of the accessible name or description.
+ */
+ enum StringOrigin {
+ ManuallySet,
+ FromShape,
+ AutomaticallyCreated,
+ NotSet
+ };
+
+ AccessibleContextBase (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& rxParent,
+ const sal_Int16 aRole);
+ virtual ~AccessibleContextBase (void);
+
+
+ /** Call all accessiblity event listeners to inform them about the
+ specified event.
+ @param aEventId
+ Id of the event type.
+ @param rNewValue
+ New value of the modified attribute. Pass empty structure if
+ not applicable.
+ @param rOldValue
+ Old value of the modified attribute. Pass empty structure if
+ not applicable.
+ */
+ void CommitChange (sal_Int16 aEventId,
+ const ::com::sun::star::uno::Any& rNewValue,
+ const ::com::sun::star::uno::Any& rOldValue);
+
+ /** Set a new description and, provided that the new name differs from
+ the old one, broadcast an accessibility event.
+ @param rsDescription
+ The new description.
+ @param eDescriptionOrigin
+ The origin of the description. This is used to determine
+ whether the given description overrules the existing one. An
+ origin with a lower numerical value overrides one with a higher
+ value.
+ */
+ void SetAccessibleDescription (
+ const OUString& rsDescription,
+ StringOrigin eDescriptionOrigin)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Set a new description and, provided that the new name differs from
+ the old one, broadcast an accessibility event.
+ @param rsName
+ The new name.
+ @param eNameOrigin
+ The origin of the name. This is used to determine whether the
+ given name overrules the existing one. An origin with a lower
+ numerical value overrides one with a higher value.
+ */
+ void SetAccessibleName (
+ const OUString& rsName,
+ StringOrigin eNameOrigin)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Set the specified state (turn it on) and send events to all
+ listeners to inform them of the change.
+
+ @param aState
+ The state to turn on.
+
+ @return
+ If the specified state changed its value due to this call
+ <TRUE/> is returned, otherwise <FALSE/>.
+ */
+ virtual sal_Bool SetState (sal_Int16 aState);
+
+ /** Reset the specified state (turn it off) and send events to all
+ listeners to inform them of the change.
+
+ @param aState
+ The state to turn off.
+
+ @return
+ If the specified state changed its value due to this call
+ <TRUE/> is returned, otherwise <FALSE/>.
+ */
+ virtual sal_Bool ResetState (sal_Int16 aState);
+
+ /** Return the state of the specified state.
+
+ @param aState
+ The state for which to return its value.
+
+ @return
+ A value of <TRUE/> indicates that the state is set. A <FALSE/>
+ value indicates an unset state.
+ */
+ sal_Bool GetState (sal_Int16 aState);
+
+ /** Replace the current relation set with the specified one. Send
+ events for relations that are not in both sets.
+
+ @param rRelationSet
+ The new relation set that replaces the old one.
+ */
+ virtual void SetRelationSet (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleRelationSet>& rxRelationSet)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ //===== XAccessible =====================================================
+
+ /// Return the XAccessibleContext.
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL
+ getAccessibleContext (void) throw (::com::sun::star::uno::RuntimeException);
+
+
+ //===== XAccessibleContext ==============================================
+
+ /// Return the number of currently visible children.
+ virtual sal_Int32 SAL_CALL
+ getAccessibleChildCount (void) throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return the specified child or throw exception.
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
+ getAccessibleChild (sal_Int32 nIndex)
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ /// Return a reference to the parent.
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
+ getAccessibleParent (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return this objects index among the parents children.
+ virtual sal_Int32 SAL_CALL
+ getAccessibleIndexInParent (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return this object's role.
+ virtual sal_Int16 SAL_CALL
+ getAccessibleRole (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return this object's description.
+ virtual OUString SAL_CALL
+ getAccessibleDescription (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return the object's current name.
+ virtual OUString SAL_CALL
+ getAccessibleName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return NULL to indicate that an empty relation set.
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
+ getAccessibleRelationSet (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return the set of current states.
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
+ getAccessibleStateSet (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Return the parents locale or throw exception if this object has no
+ parent yet/anymore.
+ */
+ virtual ::com::sun::star::lang::Locale SAL_CALL
+ getLocale (void)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::accessibility::IllegalAccessibleComponentStateException);
+
+ //===== XAccessibleEventBroadcaster ========================================
+
+ virtual void SAL_CALL
+ addAccessibleEventListener (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleEventListener >& xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ removeAccessibleEventListener (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleEventListener >& xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ //===== XServiceInfo ====================================================
+
+ /** Returns an identifier for the implementation of this object.
+ */
+ virtual OUString SAL_CALL
+ getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Return whether the specified service is supported by this class.
+ */
+ virtual sal_Bool SAL_CALL
+ supportsService (const OUString& sServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Returns a list of all supported services. In this case that is just
+ the AccessibleContext service.
+ */
+ virtual ::com::sun::star::uno::Sequence< OUString> SAL_CALL
+ getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ //===== XTypeProvider ===================================================
+
+ /** Returns a sequence of all supported interfaces.
+ */
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL
+ getTypes (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Returns a implementation id.
+ */
+ virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL
+ getImplementationId (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ /** The state set.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleStateSet> mxStateSet;
+
+ /** The relation set. Relations can be set or removed by calling the
+ <member>AddRelation</member> and <member>RemoveRelation</member> methods.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleRelationSet> mxRelationSet;
+
+ // This method is called from the component helper base class while disposing.
+ virtual void SAL_CALL disposing (void);
+
+ /** Create the accessible object's name. This method may be called more
+ than once for a single object.
+ @return
+ The returned string is a unique (among the accessible object's
+ siblings) name.
+ */
+ virtual OUString CreateAccessibleName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Create the accessible object's descriptive string. May be called
+ more than once.
+ @return
+ Descriptive string. Not necessarily unique.
+ */
+ virtual OUString
+ CreateAccessibleDescription (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ void FireEvent (const ::com::sun::star::accessibility::AccessibleEventObject& aEvent);
+
+ /** Check whether or not the object has been disposed (or is in the
+ state of beeing disposed). If that is the case then
+ DisposedException is thrown to inform the (indirect) caller of the
+ foul deed.
+ */
+ void ThrowIfDisposed (void)
+ throw (::com::sun::star::lang::DisposedException);
+
+ /** Check whether or not the object has been disposed (or is in the
+ state of beeing disposed).
+
+ @return TRUE, if the object is disposed or in the course
+ of being disposed. Otherwise, FALSE is returned.
+ */
+ sal_Bool IsDisposed (void);
+
+ /** sets the role as returned by XaccessibleContext::getAccessibleRole
+
+ <p>Caution: This is only to be used in the construction phase (means within
+ the ctor or late ctor), <em>never</em> when the object is still alive and part
+ of an Accessibility hierarchy.</p>
+ */
+ void SetAccessibleRole( sal_Int16 _nRole );
+
+private:
+ /// Reference to the parent object.
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> mxParent;
+
+ /** Description of this object. This is not a constant because it can
+ be set from the outside. Furthermore, it changes according the the
+ draw page's display mode.
+ */
+ OUString msDescription;
+
+ /** The origin of the description is used to determine whether new
+ descriptions given to the SetAccessibleDescription is ignored or
+ whether that replaces the old value in msDescription.
+ */
+ StringOrigin meDescriptionOrigin;
+
+ /** Name of this object. It changes according the draw page's
+ display mode.
+ */
+ OUString msName;
+
+ /** The origin of the name is used to determine whether new
+ name given to the SetAccessibleName is ignored or
+ whether that replaces the old value in msName.
+ */
+ StringOrigin meNameOrigin;
+
+ /** client id in the AccessibleEventNotifier queue
+ */
+ sal_uInt32 mnClientId;
+
+ /** This is the role of this object.
+ */
+ sal_Int16 maRole;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/AccessibleEditableTextPara.hxx b/include/editeng/AccessibleEditableTextPara.hxx
new file mode 100644
index 000000000000..5f245d0786f5
--- /dev/null
+++ b/include/editeng/AccessibleEditableTextPara.hxx
@@ -0,0 +1,386 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_ACCESSIBLE_EDITABLE_TEXT_PARA_HXX
+#define _SVX_ACCESSIBLE_EDITABLE_TEXT_PARA_HXX
+
+#include <tools/gen.hxx>
+#include <tools/string.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <cppuhelper/compbase9.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/accessibility/XAccessibleEditableText.hpp>
+#include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp>
+#include <com/sun/star/accessibility/XAccessibleHypertext.hpp>
+#include <com/sun/star/accessibility/XAccessibleMultiLineText.hpp>
+
+#include <comphelper/accessibletexthelper.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include "editeng/AccessibleParaManager.hxx"
+#include "editeng/AccessibleImageBullet.hxx"
+#include "editeng/unoedprx.hxx"
+#include "editeng/editengdllapi.h"
+
+namespace accessibility
+{
+ typedef ::cppu::PartialWeakComponentImplHelper9< ::com::sun::star::accessibility::XAccessible,
+ ::com::sun::star::accessibility::XAccessibleContext,
+ ::com::sun::star::accessibility::XAccessibleComponent,
+ ::com::sun::star::accessibility::XAccessibleEditableText,
+ ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
+ ::com::sun::star::accessibility::XAccessibleTextAttributes,
+ ::com::sun::star::accessibility::XAccessibleHypertext,
+ ::com::sun::star::accessibility::XAccessibleMultiLineText,
+ ::com::sun::star::lang::XServiceInfo > AccessibleTextParaInterfaceBase;
+
+ /** This class implements the actual text paragraphs for the EditEngine/Outliner UAA
+ */
+ class EDITENG_DLLPUBLIC AccessibleEditableTextPara : public ::comphelper::OBaseMutex, public AccessibleTextParaInterfaceBase, public ::comphelper::OCommonAccessibleText
+ {
+
+ protected:
+ // override OCommonAccessibleText methods
+ virtual OUString implGetText();
+ virtual ::com::sun::star::lang::Locale implGetLocale();
+ virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex );
+ virtual void implGetParagraphBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nIndex );
+ virtual void implGetLineBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nIndex );
+
+ public:
+ /// Create accessible object for given parent
+ // #i27138#
+ // - add parameter <_pParaManager> (default value NULL)
+ // This has to be the instance of <AccessibleParaManager>, which
+ // created and manages this accessible paragraph.
+ AccessibleEditableTextPara ( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rParent,
+ const AccessibleParaManager* _pParaManager = NULL );
+
+ virtual ~AccessibleEditableTextPara ();
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface (const ::com::sun::star::uno::Type & rType) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessible
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole() throw (::com::sun::star::uno::RuntimeException);
+ /// Maximal length of text returned by getAccessibleDescription()
+ enum { MaxDescriptionLen = 40 };
+ virtual OUString SAL_CALL getAccessibleDescription() throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getAccessibleName() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale() throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleEventBroadcaster
+ virtual void SAL_CALL addAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleComponent
+ virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleText (this comes implicitely inherited by XAccessibleEditableText AND by XAccessibleMultiLineText)
+ virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleEditableText
+ virtual sal_Bool SAL_CALL cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL pasteText( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL deleteText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL insertText( const OUString& sText, sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL replaceText( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const OUString& sReplacement ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setAttributes( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aAttributeSet ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setText( const OUString& sText ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleTextAttributes
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getDefaultAttributes( const ::com::sun::star::uno::Sequence< OUString >& RequestedAttributes ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getRunAttributes( ::sal_Int32 Index, const ::com::sun::star::uno::Sequence< OUString >& RequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleHypertext
+ virtual ::sal_Int32 SAL_CALL getHyperLinkCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleHyperlink > SAL_CALL getHyperLink( ::sal_Int32 nLinkIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getHyperLinkIndex( ::sal_Int32 nCharIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleMultiLineText
+ virtual ::sal_Int32 SAL_CALL getLineNumberAtIndex( ::sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtLineNumber( ::sal_Int32 nLineNo ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtLineWithCaret( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getNumberOfLineWithCaret( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName (void) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService (const OUString& sServiceName) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< OUString> SAL_CALL getSupportedServiceNames (void) throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceName
+ virtual OUString SAL_CALL getServiceName (void) throw (::com::sun::star::uno::RuntimeException);
+
+ /** Set the current index in the accessibility parent
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ void SetIndexInParent( sal_Int32 nIndex );
+
+ /** Get the current index in the accessibility parent
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ sal_Int32 GetIndexInParent() const;
+
+ /** Set the current paragraph number
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ void SetParagraphIndex( sal_Int32 nIndex );
+
+ /** Query the current paragraph number (0 - nParas-1)
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ sal_Int32 GetParagraphIndex() const SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ /** Set the edit engine offset
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ void SetEEOffset( const Point& rOffset );
+
+ /** Set the EditEngine offset
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ void SetEditSource( SvxEditSourceAdapter* pEditSource );
+
+ /** Dispose this object
+
+ Notifies and deregisters the listeners, drops all references.
+ */
+ void Dispose();
+
+ /// Calls all Listener objects to tell them the change. Don't hold locks when calling this!
+ virtual void FireEvent(const sal_Int16 nEventId, const ::com::sun::star::uno::Any& rNewValue = ::com::sun::star::uno::Any(), const ::com::sun::star::uno::Any& rOldValue = ::com::sun::star::uno::Any() ) const;
+
+ /// Sets the given state on the internal state set and fires STATE_CHANGE event. Don't hold locks when calling this!
+ void SetState( const sal_Int16 nStateId );
+ /// Unsets the given state on the internal state set and fires STATE_CHANGE event. Don't hold locks when calling this!
+ void UnSetState( const sal_Int16 nStateId );
+
+ static Rectangle LogicToPixel( const Rectangle& rRect, const MapMode& rMapMode, SvxViewForwarder& rForwarder );
+
+ SvxEditSourceAdapter& GetEditSource() const SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ /** Query the SvxTextForwarder for EditEngine access.
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ SvxAccessibleTextAdapter& GetTextForwarder() const SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ /** Query the SvxViewForwarder for EditEngine access.
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ SvxViewForwarder& GetViewForwarder() const SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ /** Query whether a GetEditViewForwarder( sal_False ) will return a forwarder
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ sal_Bool HaveEditView() const;
+
+ /** Query the SvxEditViewForwarder for EditEngine access.
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ SvxAccessibleTextEditViewAdapter& GetEditViewForwarder( sal_Bool bCreate = sal_False ) const SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ /** Send a TEXT_CHANGED event for this paragraph
+
+ This method internally caters for calculating text
+ differences, and sends the appropriate Anys in the
+ Accessibility::TEXT_CHANGED event
+ */
+ void TextChanged();
+
+ private:
+
+ // declared, but not defined
+ AccessibleEditableTextPara( const AccessibleEditableTextPara& );
+ AccessibleEditableTextPara& operator= ( const AccessibleEditableTextPara& );
+
+ /** Calculate character range of similar attributes
+
+ @param nStartIndex
+ Therein, the start of the character range with the same attributes is returned
+
+ @param nEndIndex
+ Therein, the end (exclusively) of the character range with the same attributes is returned
+
+ @param nIndex
+ The character index at where to look for similar character attributes
+
+ @return sal_False, if the method was not able to determine the range
+ */
+ sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_Int32 nIndex );
+
+ // syntactic sugar for FireEvent
+ void GotPropertyEvent( const ::com::sun::star::uno::Any& rNewValue, const sal_Int16 nEventId ) const;
+ void LostPropertyEvent( const ::com::sun::star::uno::Any& rOldValue, const sal_Int16 nEventId ) const;
+
+ int getNotifierClientId() const;
+
+ /// Do we have children? This is the case for image bullets
+ sal_Bool HaveChildren();
+
+ const Point& GetEEOffset() const;
+
+ // Get text from forwarder
+ String GetTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) SAL_THROW((::com::sun::star::uno::RuntimeException));
+ sal_uInt16 GetTextLen() const SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ /** Get the current selection of this paragraph
+
+ @return sal_False, if nothing in this paragraph is selected
+ */
+ sal_Bool GetSelection( sal_uInt16& nStartPos, sal_uInt16& nEndPos ) SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ /** create selection from Accessible selection.
+
+ */
+ ESelection MakeSelection( sal_Int32 nStartEEIndex, sal_Int32 nEndEEIndex );
+ ESelection MakeSelection( sal_Int32 nEEIndex );
+ ESelection MakeCursor( sal_Int32 nEEIndex );
+
+ // check whether index value is within permitted range
+
+ /// Check whether 0<=nIndex<=n-1
+ void CheckIndex( sal_Int32 nIndex ) SAL_THROW((::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException));
+ /// Check whether 0<=nIndex<=n
+ void CheckPosition( sal_Int32 nIndex ) SAL_THROW((::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException));
+ /// Check whether 0<=nStart<=n and 0<=nEnd<=n
+ void CheckRange( sal_Int32 nStart, sal_Int32 nEnd ) SAL_THROW((::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException));
+
+ // the paragraph index in the edit engine (guarded by solar mutex)
+ sal_Int32 mnParagraphIndex;
+
+ // our current index in the parent (guarded by solar mutex)
+ sal_Int32 mnIndexInParent;
+
+ // the current edit source (guarded by solar mutex)
+ SvxEditSourceAdapter* mpEditSource;
+
+ // the possible child (for image bullets, guarded by solar mutex)
+ typedef WeakCppRef < ::com::sun::star::accessibility::XAccessible, AccessibleImageBullet > WeakBullet;
+ WeakBullet maImageBullet;
+
+ // the last string used for an Accessibility::TEXT_CHANGED event (guarded by solar mutex)
+ OUString maLastTextString;
+
+ // the offset of the underlying EditEngine from the shape/cell (guarded by solar mutex)
+ Point maEEOffset;
+
+ // the current state set (updated from SetState/UnSetState and guarded by solar mutex)
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > mxStateSet;
+
+ /// The shape we're the accessible for (unguarded)
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxParent;
+
+ /// Our listeners (guarded by maMutex)
+ int mnNotifierClientId;
+
+ // Text paragraphs should provide FLOWS_TO and FLOWS_FROM relations (#i27138#)
+ // the paragraph manager, which created this instance - is NULL, if
+ // instance isn't created by AccessibleParaManager.
+ // Needed for method <getAccessibleRelationSet()> to retrieve predecessor
+ // paragraph and the successor paragraph.
+ const AccessibleParaManager* mpParaManager;
+ };
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/AccessibleImageBullet.hxx b/include/editeng/AccessibleImageBullet.hxx
new file mode 100644
index 000000000000..9d852962e9e6
--- /dev/null
+++ b/include/editeng/AccessibleImageBullet.hxx
@@ -0,0 +1,219 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_ACCESSIBLE_IMAGE_BULLET_HXX
+#define _SVX_ACCESSIBLE_IMAGE_BULLET_HXX
+
+#include <tools/gen.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <cppuhelper/implbase5.hxx>
+
+#include <cppuhelper/interfacecontainer.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include "editeng/AccessibleParaManager.hxx"
+#include <editeng/unoedsrc.hxx>
+
+namespace accessibility
+{
+ typedef ::cppu::WeakImplHelper5< ::com::sun::star::accessibility::XAccessible,
+ ::com::sun::star::accessibility::XAccessibleContext,
+ ::com::sun::star::accessibility::XAccessibleComponent,
+ ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
+ ::com::sun::star::lang::XServiceInfo > AccessibleImageBulletInterfaceBase;
+
+ /** This class implements the image bullets for the EditEngine/Outliner UAA
+ */
+ class AccessibleImageBullet : public AccessibleImageBulletInterfaceBase
+ {
+
+ public:
+ /// Create accessible object for given parent
+ AccessibleImageBullet ( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rParent );
+
+ virtual ~AccessibleImageBullet ();
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface (const ::com::sun::star::uno::Type & rType) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessible
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole() throw (::com::sun::star::uno::RuntimeException);
+ /// Maximal length of text returned by getAccessibleDescription()
+ enum { MaxDescriptionLen = 40 };
+ virtual OUString SAL_CALL getAccessibleDescription() throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getAccessibleName() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale() throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleEventBroadcaster
+ virtual void SAL_CALL addAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleComponent
+ virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName (void) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService (const OUString& sServiceName) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< OUString> SAL_CALL getSupportedServiceNames (void) throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceName
+ virtual OUString SAL_CALL getServiceName (void) throw (::com::sun::star::uno::RuntimeException);
+
+ /** Set the current index in the accessibility parent
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ void SetIndexInParent( sal_Int32 nIndex );
+
+ /** Set the edit engine offset
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ void SetEEOffset( const Point& rOffset );
+
+ /** Set the EditEngine offset
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ void SetEditSource( SvxEditSource* pEditSource );
+
+ /** Dispose this object
+
+ Notifies and deregisters the listeners, drops all references.
+ */
+ void Dispose();
+
+ /** Set the current paragraph number
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ void SetParagraphIndex( sal_Int32 nIndex );
+
+ /** Query the current paragraph number (0 - nParas-1)
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ sal_Int32 GetParagraphIndex() const SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ /// Calls all Listener objects to tell them the change. Don't hold locks when calling this!
+ virtual void FireEvent(const sal_Int16 nEventId, const ::com::sun::star::uno::Any& rNewValue = ::com::sun::star::uno::Any(), const ::com::sun::star::uno::Any& rOldValue = ::com::sun::star::uno::Any() ) const;
+
+ private:
+
+ // declared, but not defined
+ AccessibleImageBullet( const AccessibleImageBullet& );
+ AccessibleImageBullet& operator= ( const AccessibleImageBullet& );
+
+ // syntactic sugar for FireEvent
+ void GotPropertyEvent( const ::com::sun::star::uno::Any& rNewValue, const sal_Int16 nEventId ) const;
+ void LostPropertyEvent( const ::com::sun::star::uno::Any& rOldValue, const sal_Int16 nEventId ) const;
+
+ // maintain state set and send STATE_CHANGE events
+ void SetState( const sal_Int16 nStateId );
+ void UnSetState( const sal_Int16 nStateId );
+
+ SvxEditSource& GetEditSource() const SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ int getNotifierClientId() const;
+
+ /** Query the SvxTextForwarder for EditEngine access.
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ SvxTextForwarder& GetTextForwarder() const SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ /** Query the SvxViewForwarder for EditEngine access.
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ SvxViewForwarder& GetViewForwarder() const SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ const Point& GetEEOffset() const;
+
+ // the paragraph index in the edit engine (guarded by solar mutex)
+ sal_Int32 mnParagraphIndex;
+
+ // our current index in the parent (guarded by solar mutex)
+ sal_Int32 mnIndexInParent;
+
+ // the current edit source (guarded by solar mutex)
+ SvxEditSource* mpEditSource;
+
+ // the offset of the underlying EditEngine from the shape/cell (guarded by solar mutex)
+ Point maEEOffset;
+
+ // the current state set (updated from SetState/UnSetState and guarded by solar mutex)
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > mxStateSet;
+
+ mutable osl::Mutex maMutex;
+
+ /// The shape we're the accessible for (unguarded)
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxParent;
+
+ /// Our listeners (guarded by maMutex)
+ int mnNotifierClientId;
+ };
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/AccessibleParaManager.hxx b/include/editeng/AccessibleParaManager.hxx
new file mode 100644
index 000000000000..90bc3d8a111d
--- /dev/null
+++ b/include/editeng/AccessibleParaManager.hxx
@@ -0,0 +1,334 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_ACCESSIBLE_PARA_MANAGER_HXX
+#define _SVX_ACCESSIBLE_PARA_MANAGER_HXX
+
+#include <vector>
+#include <algorithm>
+#include <functional>
+#include <utility>
+#include <tools/gen.hxx>
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include "editeng/editengdllapi.h"
+
+class SvxEditSourceAdapter;
+
+namespace accessibility
+{
+ class AccessibleEditableTextPara;
+
+ /** Helper class for WeakCppRef
+
+ This class is returned by WeakChild::get() and contains a hard
+ reference and a reference to the c++ object. This combination
+ prevents the c++ object from destruction during usage. Hold
+ this object only as long as absolutely necessary, prevents
+ referenced object from vanishing otherwise
+ */
+ template < class UnoType, class CppType > class HardCppRef
+ {
+ public:
+
+ typedef UnoType UnoInterfaceType;
+ typedef CppType InterfaceType;
+
+ HardCppRef( const ::com::sun::star::uno::WeakReference< UnoInterfaceType >& xRef, InterfaceType* rImpl ) :
+ mxRef( xRef ),
+ mpImpl( rImpl )
+ {
+ }
+
+ /** Query whether the reference is still valid.
+
+ Hands off also from the implementation pointer if this
+ returns sal_False!
+ */
+ sal_Bool is() const { return mxRef.is(); }
+ InterfaceType* operator->() const { return mpImpl; }
+ InterfaceType& operator*() const { return *mpImpl; }
+ ::com::sun::star::uno::Reference< UnoInterfaceType >& getRef() { return mxRef; }
+ const ::com::sun::star::uno::Reference< UnoInterfaceType >& getRef() const { return mxRef; }
+
+ // default copy constructor and assignment will do
+ // HardCppRef( const HardCppRef& );
+ // HardCppRef& operator= ( const HardCppRef& );
+
+ private:
+
+ // the interface, hard reference to prevent object from vanishing
+ ::com::sun::star::uno::Reference< UnoInterfaceType > mxRef;
+
+ // the c++ object, for our internal stuff
+ InterfaceType* mpImpl;
+
+ };
+
+ /** Helper class for weak object references plus implementation
+
+ This class combines a weak reference (to facilitate automatic
+ object disposal if user drops last reference) and hard
+ reference to the c++ class (for fast access and bypassing of
+ the UNO interface)
+ */
+ template < class UnoType, class CppType > class WeakCppRef
+ {
+ public:
+
+ typedef UnoType UnoInterfaceType;
+ typedef CppType InterfaceType;
+ typedef HardCppRef< UnoInterfaceType, InterfaceType > HardRefType;
+
+ WeakCppRef() : maWeakRef(), maUnsafeRef( NULL ) {}
+ WeakCppRef( InterfaceType& rImpl ) :
+ maWeakRef( ::com::sun::star::uno::Reference< UnoInterfaceType >( rImpl, ::com::sun::star::uno::UNO_QUERY ) ),
+ maUnsafeRef( &rImpl )
+ {
+ }
+
+ WeakCppRef( HardRefType& rImpl ) :
+ maWeakRef( rImpl.getRef() ),
+ maUnsafeRef( rImpl.operator->() )
+ {
+ }
+
+ // get object with c++ object and hard reference (which
+ // prevents the c++ object from destruction during use)
+ HardRefType get() const { return HardRefType( maWeakRef, maUnsafeRef ); }
+
+ // default copy constructor and assignment will do
+ // WeakCppRef( const WeakCppRef& );
+ // WeakCppRef& operator= ( const WeakCppRef& );
+
+ private:
+
+ // the interface, hold weakly
+ ::com::sun::star::uno::WeakReference< UnoInterfaceType > maWeakRef;
+
+ // hard ref to c++ class, _only_ valid if maWeakRef.is() is true
+ InterfaceType* maUnsafeRef;
+ };
+
+
+ /** This class manages the paragraphs of an AccessibleTextHelper
+
+ To facilitate automatic deletion of paragraphs no longer used,
+ this class uses the WeakCppRef helper to hold the objects weakly.
+ */
+ class EDITENG_DLLPUBLIC AccessibleParaManager
+ {
+ public:
+ typedef WeakCppRef < ::com::sun::star::accessibility::XAccessible, AccessibleEditableTextPara > WeakPara;
+ typedef ::std::pair< WeakPara, ::com::sun::star::awt::Rectangle > WeakChild;
+ typedef ::std::pair< ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > , ::com::sun::star::awt::Rectangle > Child;
+ typedef ::std::vector< WeakChild > VectorOfChildren;
+ typedef ::std::vector< sal_Int16 > VectorOfStates;
+
+ AccessibleParaManager();
+ ~AccessibleParaManager();
+
+ /** Sets a vector of additional accessible states.
+
+ The states are passed to every created child object
+ (text paragraph). The state values are defined in
+ com::sun::star::accessibility::AccessibleStateType.
+ */
+ void SetAdditionalChildStates( const VectorOfStates& rChildStates );
+
+ /** Set the number of paragraphs
+
+ @param nNumPara
+ The total number of paragraphs the EditEngine currently
+ has (_not_ the number of currently visible children)
+ */
+ void SetNum( sal_Int32 nNumParas );
+
+ /** Get the number of paragraphs currently possible */
+ sal_uInt32 GetNum() const;
+
+ // iterators
+ VectorOfChildren::iterator begin();
+ VectorOfChildren::iterator end();
+ VectorOfChildren::const_iterator begin() const;
+ VectorOfChildren::const_iterator end() const;
+
+ // dealing with single paragraphs (release reference, return reference etc)
+ void Release( sal_uInt32 nPara );
+ /// Set focus to given child
+ void SetFocus( sal_Int32 nChild );
+
+ void FireEvent( sal_uInt32 nPara,
+ const sal_Int16 nEventId,
+ const ::com::sun::star::uno::Any& rNewValue = ::com::sun::star::uno::Any(),
+ const ::com::sun::star::uno::Any& rOldValue = ::com::sun::star::uno::Any() ) const;
+
+ static sal_Bool IsReferencable( WeakPara::HardRefType aChild );
+ sal_Bool IsReferencable( sal_uInt32 nChild ) const;
+ static void ShutdownPara( const WeakChild& rChild );
+
+ Child CreateChild( sal_Int32 nChild,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& xFrontEnd,
+ SvxEditSourceAdapter& rEditSource,
+ sal_uInt32 nParagraphIndex );
+
+ WeakChild GetChild( sal_uInt32 nParagraphIndex ) const;
+
+ // forwarder to all paragraphs
+ /// Make all children active and editable (or off)
+ void SetActive( sal_Bool bActive = sal_True );
+ /// Set state of all children
+ void SetState( const sal_Int16 nStateId );
+ /// Unset state of all children
+ void UnSetState( const sal_Int16 nStateId );
+ /// Set offset to edit engine for all children
+ void SetEEOffset ( const Point& rOffset );
+ /// Dispose all living children
+ void Dispose ();
+
+ // forwarder to given paragraphs
+ //------------------------------------------------------------------------
+ /** Release the given range of paragraphs
+
+ All ranges have the meaning [start,end), similar to STL
+
+ @param nStartPara
+ Index of paragraph to start with releasing
+
+ @param nEndPara
+ Index of first paragraph to stop with releasing
+ */
+ void Release( sal_uInt32 nStartPara, sal_uInt32 nEndPara );
+
+ /** Fire event for the given range of paragraphs
+
+ All ranges have the meaning [start,end), similar to STL
+
+ @param nStartPara
+ Index of paragraph to start with event firing
+
+ @param nEndPara
+ Index of first paragraph to stop with event firing
+ */
+ void FireEvent( sal_uInt32 nStartPara,
+ sal_uInt32 nEndPara,
+ const sal_Int16 nEventId,
+ const ::com::sun::star::uno::Any& rNewValue = ::com::sun::star::uno::Any(),
+ const ::com::sun::star::uno::Any& rOldValue = ::com::sun::star::uno::Any() ) const;
+
+ /** Functor adapter for ForEach template
+
+ Adapts giving functor such that only the paragraph objects
+ are accessed and the fact that our children are held
+ weakly is hidden
+
+ The functor must provide the following method:
+ void operator() ( AccessibleEditablePara& )
+
+ */
+ template < typename Functor > class WeakChildAdapter : public ::std::unary_function< const WeakChild&, void >
+ {
+ public:
+ WeakChildAdapter( Functor& rFunctor ) : mrFunctor(rFunctor) {}
+ void operator()( const WeakChild& rPara )
+ {
+ // retrieve hard reference from weak one
+ WeakPara::HardRefType aHardRef( rPara.first.get() );
+
+ if( aHardRef.is() )
+ mrFunctor( *aHardRef );
+ }
+
+ private:
+ Functor& mrFunctor;
+ };
+
+ /** Adapter for unary member functions
+
+ Since STL's binder don't work with const& arguments (and
+ BOOST's neither, at least on MSVC), have to provide our
+ own adapter for unary member functions.
+
+ Create with pointer to member function of
+ AccessibleEditableTextPara and the corresponding argument.
+ */
+ template < typename Argument > class MemFunAdapter : public ::std::unary_function< const WeakChild&, void >
+ {
+ public:
+ typedef void (::accessibility::AccessibleEditableTextPara::*FunctionPointer)( Argument );
+
+ MemFunAdapter( FunctionPointer aFunPtr, Argument aArg ) : maFunPtr(aFunPtr), maArg(aArg) {}
+ void operator()( const WeakChild& rPara )
+ {
+ // retrieve hard reference from weak one
+ WeakPara::HardRefType aHardRef( rPara.first.get() );
+
+ if( aHardRef.is() )
+ (*aHardRef.*maFunPtr)( maArg );
+ }
+
+ private:
+ FunctionPointer maFunPtr;
+ Argument maArg;
+ };
+
+ /** Generic algorithm on given paragraphs
+
+ Convenience method, that already adapts the given functor with WeakChildAdapter
+ */
+ template < typename Functor > void ForEach( Functor& rFunctor )
+ {
+ ::std::for_each( begin(), end(), WeakChildAdapter< Functor >(rFunctor) );
+ }
+
+ private:
+ /// Set state on given child
+ void SetState( sal_Int32 nChild, const sal_Int16 nStateId );
+ /// Unset state on given child
+ void UnSetState( sal_Int32 nChild, const sal_Int16 nStateId );
+ /// Init child with default state (as stored in previous SetFocus and SetActive calls)
+ void InitChild( AccessibleEditableTextPara& rChild,
+ SvxEditSourceAdapter& rEditSource,
+ sal_Int32 nChild,
+ sal_uInt32 nParagraphIndex ) const;
+
+ // vector the size of the paragraph number of the underlying EditEngine
+ VectorOfChildren maChildren;
+
+ /// Additional states that will be set at every created child object.
+ VectorOfStates maChildStates;
+
+ // cache EE offset for child creation
+ Point maEEOffset;
+
+ // which child currently has the focus (-1 for none)
+ sal_Int32 mnFocusedChild;
+
+ // whether children are active and editable
+ sal_Bool mbActive;
+ };
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/AccessibleSelectionBase.hxx b/include/editeng/AccessibleSelectionBase.hxx
new file mode 100644
index 000000000000..7935d5dd1ae2
--- /dev/null
+++ b/include/editeng/AccessibleSelectionBase.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_ACCESSIBILITY_ACCESSIBLE_SELECTION_BASE_HXX
+#define _SVX_ACCESSIBILITY_ACCESSIBLE_SELECTION_BASE_HXX
+
+#include <comphelper/accessibleselectionhelper.hxx>
+#include "editeng/editengdllapi.h"
+
+namespace accessibility
+{
+/** @descr
+ This base class provides a base implementation of the
+ <type>XAccessibleSelection</type> interface.
+ The following methods have to be implemented if this
+ class is used:
+
+ <method>implGetMutex</method>,
+ <method>implGetAccessibleContext</method>,
+ <method>implIsSelected</method>,
+ <method>implSelect</method>,
+*/
+ class EDITENG_DLLPUBLIC AccessibleSelectionBase : public ::comphelper::OCommonAccessibleSelection,
+ public ::com::sun::star::accessibility::XAccessibleSelection
+ {
+ protected:
+
+ virtual ::osl::Mutex& implGetMutex() = 0;
+
+ public:
+
+ // XAccessibleSelection - default implementations
+ virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ public:
+
+ AccessibleSelectionBase();
+ virtual ~AccessibleSelectionBase();
+ };
+
+}
+
+#endif // _SVX_ACCESSIBILITY_ACCESSIBLE_SELECTION_BASE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/AccessibleStaticTextBase.hxx b/include/editeng/AccessibleStaticTextBase.hxx
new file mode 100644
index 000000000000..8ca75d7a5766
--- /dev/null
+++ b/include/editeng/AccessibleStaticTextBase.hxx
@@ -0,0 +1,277 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_ACCESSILE_STATIC_TEXT_BASE_HXX_
+#define _SVX_ACCESSILE_STATIC_TEXT_BASE_HXX_
+
+#include <memory>
+#include <tools/gen.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleText.hpp>
+#include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp>
+#include <com/sun/star/accessibility/TextSegment.hpp>
+#include "editeng/editengdllapi.h"
+
+
+class SvxEditSource;
+class SvxEditViewForwarder;
+
+namespace accessibility
+{
+
+ class AccessibleStaticTextBase_Impl;
+
+ typedef ::cppu::ImplHelper2<
+ ::com::sun::star::accessibility::XAccessibleText,
+ ::com::sun::star::accessibility::XAccessibleTextAttributes > AccessibleStaticTextBase_BASE;
+
+ /** Helper class for objects containing EditEngine/Outliner text
+
+ This class implements the XAccessibleText interface for static
+ text, somewhat similar to the children of the
+ AccessibleTextHelper class. Currently, there are no children,
+ i.e. the whole text is presented in one big chunk. This might
+ change in the future, if a need for image bullets should
+ arise. These, by convention, would be represented as children
+ of the text.
+
+ You have to implement the SvxEditSource, SvxTextForwarder,
+ SvxViewForwarder and SvxEditViewForwarder interfaces in order
+ to enable your object to cooperate with this
+ class. SvxTextForwarder encapsulates the fact that text
+ objects do not necessarily have an EditEngine at their
+ disposal, SvxViewForwarder and SvxEditViewForwarder do the
+ same for the document and the edit view. The three mentioned
+ forwarder objects are not stored by the AccessibleTextHelper,
+ but fetched every time from the SvxEditSource. So you are best
+ off making your SvxEditSource::Get*Forwarder methods cache the
+ current forwarder.
+
+ As this class is intended for static (i.e. non-changing) text
+ only, no event broadcasting is necessary. You must handle
+ visibility by yourself, the bounding boxes returned by
+ getCharacterBounds() are relative to your accessibility
+ object.
+
+ @attention All public non-UNO methods (those are the uppercase
+ ones) must not be called with any mutex hold, except when
+ calling from the main thread (with holds the solar mutex),
+ unless stated otherwise. This is because they themselves might
+ need the solar mutex in addition to the object mutex, and the
+ ordering of the locking must be: first solar mutex, then
+ object mutex. Furthermore, state change events might be fired
+ internally.
+
+ @derive Use this class as a base for objects containing static
+ edit engine text. To avoid overwriting every interface method
+ to intercept derived object defunc state, just set NULL as the
+ edit source. Every interface method will then properly throw
+ an exception.
+ */
+ class EDITENG_DLLPUBLIC AccessibleStaticTextBase : public AccessibleStaticTextBase_BASE
+ {
+
+ public:
+ /** Create accessible text object for given edit source
+
+ @param pEditSource
+ The edit source to use. Object ownership is transferred
+ from the caller to the callee. The object listens on the
+ SvxEditSource for object disposal, so no provisions have
+ to be taken if the caller destroys the data (e.g. the
+ model) contained in the given SvxEditSource.
+
+ */
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ explicit AccessibleStaticTextBase( ::std::auto_ptr< SvxEditSource > pEditSource );
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+ virtual ~AccessibleStaticTextBase();
+
+ private:
+
+ // declared, but not defined
+ EDITENG_DLLPRIVATE AccessibleStaticTextBase( const AccessibleStaticTextBase& );
+ // declared, but not defined
+ EDITENG_DLLPRIVATE AccessibleStaticTextBase& operator= ( const AccessibleStaticTextBase& );
+
+ public:
+ /** Query the current edit source
+
+ @attention This method returns by reference, so you are
+ responsible for serialization (typically, you aquired the
+ solar mutex when calling this method). Thus, the method
+ should only be called from the main office thread.
+
+ */
+ virtual const SvxEditSource& GetEditSource() const SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ /** Set the current edit source
+
+ @attention You are required to have the solar mutex
+ locked, when calling this method. Thus, the method should
+ only be called from the main office thread.
+
+ The EditSource set here is required to broadcast out the
+ following hints: EDITSOURCE_HINT_PARASMOVED,
+ EDITSOURCE_HINT_SELECTIONCHANGED, TEXT_HINT_MODIFIED,
+ TEXT_HINT_PARAINSERTED, TEXT_HINT_PARAREMOVED,
+ TEXT_HINT_TEXTHEIGHTCHANGED,
+ TEXT_HINT_VIEWSCROLLED. Otherwise, not all state changes
+ will get noticed by the accessibility object. Further
+ more, when the corresponding core object or the model is
+ dying, either the edit source must be set to NULL or it
+ has to broadcast a SFX_HINT_DYING hint.
+
+ This class does not have a dispose method, since it is not
+ a UNO component. Nevertheless, it holds C++ references to
+ several core objects, so you should issue a
+ SetEditSource(::std::auto_ptr<SvxEditSource>(NULL)) in
+ your dispose() method.
+
+ @param pEditSource
+ The new edit source to set. Object ownership is transferred
+ from the caller to the callee.
+ */
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ virtual void SetEditSource( ::std::auto_ptr< SvxEditSource > pEditSource ) SAL_THROW((::com::sun::star::uno::RuntimeException));
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+
+ /** Set the event source
+
+ @attention When setting a reference here, you should call
+ Dispose() when you as the owner are disposing, since until
+ then this object will hold that reference
+
+ @param rInterface
+ The interface that should be set as the source for
+ accessibility events sent by this object.
+ */
+ virtual void SetEventSource( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rInterface );
+
+ /** Get the event source
+
+ @return the interface that is set as the source for
+ accessibility events sent by this object.
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetEventSource() const;
+
+ /** Set offset of EditEngine from parent
+
+ @attention You are required to have the solar mutex
+ locked, when calling this method. Thus, the method should
+ only be called from the main office thread.
+
+ If the origin of the underlying EditEngine does
+ not correspond to the upper left corner of the object
+ using this class, you have to specify the offset.
+
+ @param rPoint
+ The offset in screen coordinates (i.e. pixel)
+ */
+ virtual void SetOffset( const Point& rPoint );
+
+ /** Query offset of EditEngine from parent
+
+ @return the offset in screen coordinates (i.e. pixel)
+ */
+ virtual Point GetOffset() const;
+
+ /** Update the visible children
+
+ As this class currently does not represent any content
+ using children, this does nothing at the moment.
+
+ @attention You are required to have the solar mutex
+ locked, when calling this method. Thus, the method should
+ only be called from the main office thread.
+
+ This method reevaluates the visibility of all
+ children. Call this method if your visibility state has
+ changed somehow, e.g. if the visible area has changed and
+ the AccessibleStaticTextHelper isn't notified
+ internally. Normally, there should not be a need to call
+ this method.
+ */
+ virtual void UpdateChildren() SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ /** Drop all references and enter disposed state
+
+ This method drops all references to external objects (also
+ the event source reference set via SetEventSource()) and
+ sets the object into the disposed state (i.e. the methods
+ return default values or throw a uno::DisposedException
+ exception).
+ */
+ virtual void Dispose();
+
+ // XAccessibleText interface implementation
+ virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException);
+ /// This will only work with a functional SvxEditViewForwarder, i.e. an EditEngine/Outliner in edit mode
+ virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ /// This will only work with a functional SvxEditViewForwarder, i.e. an EditEngine/Outliner in edit mode
+ virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleTextAttributes
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getDefaultAttributes( const ::com::sun::star::uno::Sequence< OUString >& RequestedAttributes ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getRunAttributes( sal_Int32 Index, const ::com::sun::star::uno::Sequence< OUString >& RequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // child-related methods from XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // child-related methods from XAccessibleComponent
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+
+ protected:
+ Rectangle GetParagraphBoundingBox() const;
+
+ private:
+
+ /// @dyn
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ const std::auto_ptr< AccessibleStaticTextBase_Impl > mpImpl;
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+
+ };
+
+} // end of namespace accessibility
+
+#endif /* _SVX_ACCESSILE_STATIC_TEXT_BASE_HXX_ */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/AccessibleStringWrap.hxx b/include/editeng/AccessibleStringWrap.hxx
new file mode 100644
index 000000000000..cae879f95a1a
--- /dev/null
+++ b/include/editeng/AccessibleStringWrap.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _ACCESSIBLESTRINGWRAP_HXX
+#define _ACCESSIBLESTRINGWRAP_HXX
+
+#include <sal/types.h>
+#include <tools/string.hxx>
+
+#include <editeng/editengdllapi.h>
+
+class OutputDevice;
+class SvxFont;
+class Rectangle;
+class Point;
+
+//------------------------------------------------------------------------
+//
+// AccessibleStringWrap declaration
+//
+//------------------------------------------------------------------------
+
+class AccessibleStringWrap
+{
+public:
+
+ EDITENG_DLLPUBLIC AccessibleStringWrap( OutputDevice& rDev, SvxFont& rFont, const String& rText );
+
+ EDITENG_DLLPUBLIC sal_Bool GetCharacterBounds( sal_Int32 nIndex, Rectangle& rRect );
+ EDITENG_DLLPUBLIC sal_Int32 GetIndexAtPoint( const Point& rPoint );
+
+private:
+
+ OutputDevice& mrDev;
+ SvxFont& mrFont;
+ String maText;
+};
+
+#endif /* _ACCESSIBLESTRINGWRAP_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/LatinLookupTree.hxx b/include/editeng/LatinLookupTree.hxx
new file mode 100644
index 000000000000..9407780f5b80
--- /dev/null
+++ b/include/editeng/LatinLookupTree.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef LATINLOOKUPTREE_HXX
+#define LATINLOOKUPTREE_HXX
+
+#include <editeng/LookupTree.hxx>
+#include <editeng/TreeHead.hxx>
+#include <editeng/editengdllapi.h>
+
+/**
+ * LatinLookupTree implements a tree that is optimized for storing and looking
+ * up words that mainly consist of roman characters, although any other
+ * language can be handled, too.
+ */
+class EDITENG_DLLPUBLIC LatinLookupTree : public LookupTree, public TreeHead
+{
+public:
+
+ explicit LatinLookupTree(OUString sLanguage);
+ ~LatinLookupTree();
+
+
+ /* =================== Implemented Virtuals From LookupTree =================== */
+ void returnToRoot();
+ void gotoNode(OUString sNode);
+ void advance(const sal_Unicode a);
+ void goBack();
+ void insert(OUString sKey, const int nProbability = 1);
+ void insert(const int nProbability = 1);
+ void remove(OUString sKey);
+ OUString suggestAutoCompletion() const;
+ void clear();
+
+ /* =================== Implemented Virtuals From Node =================== */
+ bool isSeparatedlyHandled(const sal_Unicode cKey) const;
+ Node*& getChildRef(const sal_Unicode cKey, bool bCreatePlaceholder = false);
+ void evaluateSeparateStorage(int& nSuggest, Node*& pSuggest) const;
+ void freeMemory();
+
+
+ /* =================== Implemented Virtual From TreeHead =================== */
+ Node* newNode(Node* pParent, const sal_Unicode cKey, const int nProbability = 0);
+
+ /* =================== Member Variables =================== */
+ // position of lower case letter 'a' within the selected char encoding.
+ static const unsigned int our_nLowerCaseA;
+
+ // position of upper case letter 'A' within the selected char encoding.
+ static const unsigned int our_nUpperCaseA;
+
+private:
+ Node* m_pLeaves[52]; // handles [a-z] and [A-Z]
+};
+
+#endif // LATINLOOKUPTREE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/LatinTreeNode.hxx b/include/editeng/LatinTreeNode.hxx
new file mode 100644
index 000000000000..5e406858697c
--- /dev/null
+++ b/include/editeng/LatinTreeNode.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef LATINTREENODE_HXX
+#define LATINTREENODE_HXX
+
+#include <editeng/Node.hxx>
+
+/**
+ * LatinTreeNode represents a node within a LatinLookupTree. As en external
+ * caller, you should never have to do anything with this class directly.
+ * Use the class LatinLookupTree instead for constructing a new tree.
+ */
+class LatinTreeNode : public Node
+{
+public:
+ explicit LatinTreeNode(TreeHead *pHead, Node* pParent, const sal_Unicode cKey, const int nProbability = 0);
+ ~LatinTreeNode();
+
+ /* =================== Implemented Virtuals From Node =================== */
+ bool isSeparatedlyHandled(const sal_Unicode cKey) const;
+ Node*& getChildRef(const sal_Unicode cKey, bool bCreatePlaceholder = false);
+ void evaluateSeparateStorage(int& nSuggest, Node*& pSuggest) const;
+ void freeMemory();
+
+private:
+ Node* m_pLeaves[26]; // handles [a-z]
+};
+
+#endif // LATINTREENODE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/LookupTree.hxx b/include/editeng/LookupTree.hxx
new file mode 100644
index 000000000000..95abcf25d6f8
--- /dev/null
+++ b/include/editeng/LookupTree.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef LOOKUPTREE_H
+#define LOOKUPTREE_H
+
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <editeng/editengdllapi.h>
+
+/** LookupTree is an interface class that allows for unified access to tree
+ * structures used for storing dictionnary words as well as their respective
+ * probabilities.
+ * It allows you to insert or remove words from the tree, navigate threw the
+ * tree along its branches and request for a suggestion for autocompletion
+ * according to the position within the tree.
+ * It also allows you to attribute a specific language to each tree so that
+ * it is possible to serve the correct auto completions even within a document
+ * that contains content in more than one language.
+ */
+class EDITENG_DLLPUBLIC LookupTree
+{
+public:
+ explicit inline LookupTree(OUString sLanguage);
+ virtual ~LookupTree() {}
+
+ inline OUString language() const;
+
+ // Resets the current item to root.
+ virtual void returnToRoot() = 0;
+
+ // Advances from the root position key by key towards the node keyed with
+ // the last char of sKey.
+ virtual void gotoNode(OUString sNode) = 0;
+
+ // Advances from the current position towards the node keyed with cKey.
+ virtual void advance(const sal_Unicode cKey) = 0;
+
+ // Sets the focus to the parent of the current node. Removes the current
+ // node if it is invalid.
+ virtual void goBack() = 0;
+
+ // Inserts a complete keyword starting from the root node of the tree.
+ // Does not change the current position within the tree.
+ virtual void insert(OUString sKey, const int nProbability = 1) = 0;
+
+ // Inserts a keyword with the given probability at the current position
+ // within the tree. Does not change the current position within the tree.
+ virtual void insert(const int nProbability = 1) = 0;
+
+ // Removes a complete keyword starting from the root node of the tree.
+ // Does not change the current position within the tree.
+ virtual void remove(OUString sKey) = 0;
+
+ // Returns the suggested autocompletion for the current location within
+ // the tree.
+ virtual OUString suggestAutoCompletion() const = 0;
+
+ // Clears the tree and removes any information it contains.
+ virtual void clear() = 0;
+
+
+private:
+ const OUString m_sLanguage; // language handled by this tree
+};
+
+LookupTree::LookupTree(OUString sLanguage) :
+ m_sLanguage( sLanguage )
+{
+}
+
+OUString LookupTree::language() const
+{
+ return m_sLanguage;
+}
+
+#endif // LOOKUPTREE_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/Node.hxx b/include/editeng/Node.hxx
new file mode 100644
index 000000000000..3159e48a99b7
--- /dev/null
+++ b/include/editeng/Node.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef NODE_HXX
+#define NODE_HXX
+
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <list>
+
+class TreeHead;
+
+/**
+ * Node represents a node within a LookupTree. As en external caller, you
+ * should never have to do anything with this class directly.
+ * Use any of the classes derived from LookupTree instead for constructing a
+ * new tree.
+ */
+class Node
+{
+public:
+ //explicit Node(TreeHead* const pHead);
+ explicit Node(TreeHead* const pHead, Node* const pParent = NULL,
+ const sal_Unicode cKey = 0, const int nProbability = 0);
+
+ virtual ~Node();
+
+ // Removes the specified child from this node. Make sure you may remove it
+ // before doing so.
+ void removeChild(Node*& pChild);
+
+ // Inserts a complete keyword starting from this node of the tree.
+ void insertKey(OUString sKey, const int nProbability);
+ // Removes a complete keyword starting from this node of the tree.
+ void removeKey(OUString sKey);
+
+ // Returns the child node keyed with cKey.
+ Node* advanceKey(const sal_Unicode cKey);
+
+ // Use this to inform a parent about its child having changed.
+ // Call this only with nProbability = 0 if you have made sure the node can
+ // be removed.
+ void childHasChanged(Node* pChild, const int nProbability, bool bAllowRemoval = false);
+
+ // Rechose the node that is suggested for auto-completion
+ void reevaluateSuggestion(bool& bNodeProbabilityChanged);
+
+
+ /* =================== Virtuals =================== */
+ virtual bool isSeparatedlyHandled(const sal_Unicode cKey) const = 0;
+
+ // Returns a reference to the pointer to the child node for the requested
+ // char. Returns NULL if no such child could be found.
+ // IMPORTANT: In the latter case, you may NOT overwrite the return value,
+ // if you did not set bCreatePlaceholder to true.
+ virtual Node*& getChildRef(const sal_Unicode cKey, bool bCreatePlaceholder = false) = 0;
+
+ // Sets nSuggest to the highest probability within the subtree and pSuggest
+ // to point to the (first) node with this probability.
+ virtual void evaluateSeparateStorage(int& nSuggest, Node*& pSuggest) const = 0;
+
+ // Removes all child nodes and clears all memory.
+ virtual void freeMemory() = 0;
+
+ /* =================== Member Variables =================== */
+ const sal_Unicode m_cKey; // the char represented by this node
+ int m_nKeyProbability; // the number of occurrences of this key
+
+ // the highest KeyProbability in the tree sprouting from this node
+ int m_nHighestProbaInSubtree;
+
+ Node* const m_pParent; // the parent of this node
+ Node* m_pSuggest; // next node in chain to the suggested autocompletion
+
+ TreeHead* const m_pHead; // head of the tree
+
+ unsigned short m_nChildren; // the number of children of the node
+ std::list<Node*> m_lChildren; // all chars not handled by array
+
+ // Allows returning a reference to a valid Null pointer. May NOT be overwritten.
+ static Node* our_pNodeNullPointer;
+};
+
+#endif // NODE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/SpellPortions.hxx b/include/editeng/SpellPortions.hxx
new file mode 100644
index 000000000000..f96a14b0f557
--- /dev/null
+++ b/include/editeng/SpellPortions.hxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVX_SPELL_PORTIONS_HXX
+#define SVX_SPELL_PORTIONS_HXX
+
+#include <i18nlangtag/lang.h>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/linguistic2/SingleProofreadingError.hpp>
+#include <com/sun/star/linguistic2/XProofreader.hpp>
+#include <vector>
+
+namespace com{ namespace sun{ namespace star{ namespace linguistic2{
+ class XSpellAlternatives;
+}}}}
+
+namespace svx{
+/** contains a portion of text that has the same language attributes applied
+ and belongs to the same script type.
+ */
+struct SpellPortion
+{
+ /** contains the text of the portion.
+ */
+ OUString sText;
+ /** Marks the portion as field, footnote symbol or any other special content that
+ should be protected against unintentional deletion.
+ */
+ bool bIsField;
+ /** Marks the portion hidden content that should not be touched by spell checking
+ and not be removed like redlines. The creator of the portions has to take care
+ for them.
+ */
+ bool bIsHidden;
+ /** contains the language applied to the text. It has to match the script type.
+ */
+ LanguageType eLanguage;
+ /** for wrong words this reference is filled with the error information otherwise
+ it's an empty reference
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSpellAlternatives> xAlternatives;
+ /** determines whether the error type is a grammar error
+ */
+ bool bIsGrammarError;
+ /** contains the grammar error information
+ */
+ com::sun::star::linguistic2::SingleProofreadingError aGrammarError;
+ /** provides access to the grammar checker interface
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XProofreader > xGrammarChecker;
+ /** marks portion as to-be-ignored. This is a return parameter.
+ */
+ /** contains the proposed dialog title if the proof reading component provides one.
+ */
+ OUString sDialogTitle;
+
+ bool bIgnoreThisError;
+ SpellPortion() :
+ bIsField(false),
+ bIsHidden(false),
+ eLanguage(LANGUAGE_DONTKNOW),
+ bIsGrammarError(false),
+ bIgnoreThisError(false)
+ {
+ aGrammarError.nErrorStart = aGrammarError.nErrorLength = aGrammarError.nErrorType = 0;
+ }
+};
+typedef std::vector<SpellPortion> SpellPortions;
+}//namespace svx
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/TreeHead.hxx b/include/editeng/TreeHead.hxx
new file mode 100644
index 000000000000..12c8b33c8d66
--- /dev/null
+++ b/include/editeng/TreeHead.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef TREEHEAD_HXX
+#define TREEHEAD_HXX
+
+#include <editeng/Node.hxx>
+
+/**
+ * Represents the root node of a LookupTree.
+ */
+class TreeHead : public Node
+{
+public:
+ explicit inline TreeHead();
+ virtual ~TreeHead() {}
+
+ /* =================== Virtuals =================== */
+ virtual Node* newNode(Node* pParent, const sal_Unicode cKey, const int nProbability = 0) = 0;
+
+ /* =================== Member Variables =================== */
+ Node* m_pCurrent; // current location within the tree
+};
+
+TreeHead::TreeHead() :
+ Node( this ),
+ m_pCurrent( this )
+{
+}
+
+#endif // TREEHEAD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/UnoForbiddenCharsTable.hxx b/include/editeng/UnoForbiddenCharsTable.hxx
new file mode 100644
index 000000000000..9fea61b9084c
--- /dev/null
+++ b/include/editeng/UnoForbiddenCharsTable.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_UNOFORBIDDENCHARSTABLE_HXX_
+#define _SVX_UNOFORBIDDENCHARSTABLE_HXX_
+
+#include <com/sun/star/i18n/XForbiddenCharacters.hpp>
+#include <com/sun/star/linguistic2/XSupportedLocales.hpp>
+#include <rtl/ref.hxx>
+
+#include <cppuhelper/implbase2.hxx>
+#include "editeng/editengdllapi.h"
+
+class SvxForbiddenCharactersTable;
+
+class EDITENG_DLLPUBLIC SvxUnoForbiddenCharsTable : public cppu::WeakImplHelper2<
+ com::sun::star::i18n::XForbiddenCharacters,
+ com::sun::star::linguistic2::XSupportedLocales>
+{
+protected:
+ /** this virtual function is called if the forbidden characters are changed */
+ virtual void onChange();
+
+ rtl::Reference<SvxForbiddenCharactersTable> mxForbiddenChars;
+
+public:
+ SvxUnoForbiddenCharsTable(rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars);
+ ~SvxUnoForbiddenCharsTable();
+
+ // XForbiddenCharacters
+ virtual com::sun::star::i18n::ForbiddenCharacters SAL_CALL getForbiddenCharacters( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::container::NoSuchElementException, com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasForbiddenCharacters( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setForbiddenCharacters( const com::sun::star::lang::Locale& rLocale, const com::sun::star::i18n::ForbiddenCharacters& rForbiddenCharacters ) throw(com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeForbiddenCharacters( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException);
+
+ // XSupportedLocales
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > SAL_CALL getLocales( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasLocale( const ::com::sun::star::lang::Locale& aLocale ) throw (::com::sun::star::uno::RuntimeException);
+};
+
+#endif // _SVX_UNOFORBIDDENCHARSTABLE_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/acorrcfg.hxx b/include/editeng/acorrcfg.hxx
new file mode 100644
index 000000000000..3c3321ccfc2d
--- /dev/null
+++ b/include/editeng/acorrcfg.hxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVXACCFG_HXX
+#define _SVXACCFG_HXX
+
+#include "editeng/editengdllapi.h"
+#include <unotools/configitem.hxx>
+
+class SvxAutoCorrect;
+class SvxAutoCorrCfg;
+class EDITENG_DLLPUBLIC SvxBaseAutoCorrCfg : public utl::ConfigItem
+{
+ SvxAutoCorrCfg& rParent;
+ com::sun::star::uno::Sequence<OUString> GetPropertyNames();
+
+public:
+ SvxBaseAutoCorrCfg(SvxAutoCorrCfg& rParent);
+ ~SvxBaseAutoCorrCfg();
+
+ void Load(sal_Bool bInit);
+ virtual void Commit();
+ virtual void Notify( const com::sun::star::uno::Sequence<OUString>& aPropertyNames);
+ void SetModified() {ConfigItem::SetModified();}
+};
+
+class EDITENG_DLLPUBLIC SvxSwAutoCorrCfg : public utl::ConfigItem
+{
+ SvxAutoCorrCfg& rParent;
+ com::sun::star::uno::Sequence<OUString> GetPropertyNames();
+
+public:
+ SvxSwAutoCorrCfg(SvxAutoCorrCfg& rParent);
+ ~SvxSwAutoCorrCfg();
+
+ void Load(sal_Bool bInit);
+ virtual void Commit();
+ virtual void Notify( const com::sun::star::uno::Sequence<OUString>& aPropertyNames);
+ void SetModified() {ConfigItem::SetModified();}
+};
+/*--------------------------------------------------------------------
+ Description: Configuration for Auto Correction
+ --------------------------------------------------------------------*/
+class EDITENG_DLLPUBLIC SvxAutoCorrCfg
+{
+ friend class SvxBaseAutoCorrCfg;
+ friend class SvxSwAutoCorrCfg;
+
+ SvxAutoCorrect* pAutoCorrect;
+
+ SvxBaseAutoCorrCfg aBaseConfig;
+ SvxSwAutoCorrCfg aSwConfig;
+
+ // Flags for Autotext:
+ sal_Bool bFileRel;
+ sal_Bool bNetRel;
+ // Help tip for Autotext as you type
+ sal_Bool bAutoTextTip;
+ sal_Bool bAutoTextPreview;
+ sal_Bool bAutoFmtByInput;
+ sal_Bool bSearchInAllCategories;
+
+public:
+ void SetModified()
+ {
+ aBaseConfig.SetModified();
+ aSwConfig.SetModified();
+ }
+ void Commit()
+ {
+ aBaseConfig.Commit();
+ aSwConfig.Commit();
+ }
+
+ SvxAutoCorrect* GetAutoCorrect() { return pAutoCorrect; }
+ const SvxAutoCorrect* GetAutoCorrect() const { return pAutoCorrect; }
+ // the pointer is transferred to the possession of the ConfigItems!
+ void SetAutoCorrect( SvxAutoCorrect* );
+
+ sal_Bool IsAutoFmtByInput() const { return bAutoFmtByInput; }
+ void SetAutoFmtByInput( sal_Bool bSet ) { bAutoFmtByInput = bSet;aSwConfig.SetModified();}
+
+ sal_Bool IsSaveRelFile() const { return bFileRel; }
+ void SetSaveRelFile( sal_Bool bSet ) { bFileRel = bSet; aSwConfig.SetModified(); }
+
+ sal_Bool IsSaveRelNet() const { return bNetRel; }
+ void SetSaveRelNet( sal_Bool bSet ) { bNetRel = bSet; aSwConfig.SetModified();}
+
+ sal_Bool IsAutoTextPreview() const {return bAutoTextPreview;}
+ void SetAutoTextPreview(sal_Bool bSet) {bAutoTextPreview = bSet; aSwConfig.SetModified();}
+
+ sal_Bool IsAutoTextTip() const { return bAutoTextTip; }
+ void SetAutoTextTip(sal_Bool bSet ) { bAutoTextTip = bSet;aSwConfig.SetModified();}
+
+ sal_Bool IsSearchInAllCategories() const { return bSearchInAllCategories;}
+ void SetSearchInAllCategories(sal_Bool bSet ) { bSearchInAllCategories = bSet; aSwConfig.SetModified(); }
+
+ SvxAutoCorrCfg();
+ virtual ~SvxAutoCorrCfg();
+ static SvxAutoCorrCfg& Get();
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/adjustitem.hxx b/include/editeng/adjustitem.hxx
new file mode 100644
index 000000000000..e19907cd1737
--- /dev/null
+++ b/include/editeng/adjustitem.hxx
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_ADJITEM_HXX
+#define _SVX_ADJITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/svxenum.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxAdjustItem ---------------------------------------------------
+
+/*
+[Description]
+This item describes the row orientation.
+*/
+#define ADJUST_LASTBLOCK_VERSION ((sal_uInt16)0x0001)
+
+class EDITENG_DLLPUBLIC SvxAdjustItem : public SfxEnumItemInterface
+{
+ sal_Bool bLeft : 1;
+ sal_Bool bRight : 1;
+ sal_Bool bCenter : 1;
+ sal_Bool bBlock : 1;
+
+ // only activ when bBlock
+ sal_Bool bOneBlock : 1;
+ sal_Bool bLastCenter : 1;
+ sal_Bool bLastBlock : 1;
+
+ friend SvStream& operator<<( SvStream&, SvxAdjustItem& ); //$ ostream
+public:
+ TYPEINFO();
+
+ SvxAdjustItem( const SvxAdjust eAdjst /*= SVX_ADJUST_LEFT*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+ virtual sal_uInt16 GetValueCount() const;
+ virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const;
+ virtual sal_uInt16 GetEnumValue() const;
+ virtual void SetEnumValue( sal_uInt16 nNewVal );
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+
+ inline void SetOneWord( const SvxAdjust eType )
+ {
+ bOneBlock = eType == SVX_ADJUST_BLOCK;
+ }
+
+ inline void SetLastBlock( const SvxAdjust eType )
+ {
+ bLastBlock = eType == SVX_ADJUST_BLOCK;
+ bLastCenter = eType == SVX_ADJUST_CENTER;
+ }
+
+ inline void SetAdjust( const SvxAdjust eType )
+ {
+ bLeft = eType == SVX_ADJUST_LEFT;
+ bRight = eType == SVX_ADJUST_RIGHT;
+ bCenter = eType == SVX_ADJUST_CENTER;
+ bBlock = eType == SVX_ADJUST_BLOCK;
+ }
+
+ inline SvxAdjust GetLastBlock() const
+ {
+ SvxAdjust eRet = SVX_ADJUST_LEFT;
+
+ if ( bLastBlock )
+ eRet = SVX_ADJUST_BLOCK;
+ else if( bLastCenter )
+ eRet = SVX_ADJUST_CENTER;
+ return eRet;
+ }
+
+ inline SvxAdjust GetOneWord() const
+ {
+ SvxAdjust eRet = SVX_ADJUST_LEFT;
+
+ if ( bBlock && bOneBlock )
+ eRet = SVX_ADJUST_BLOCK;
+ return eRet;
+ }
+
+ inline SvxAdjust GetAdjust() const
+ {
+ SvxAdjust eRet = SVX_ADJUST_LEFT;
+
+ if ( bRight )
+ eRet = SVX_ADJUST_RIGHT;
+ else if ( bCenter )
+ eRet = SVX_ADJUST_CENTER;
+ else if ( bBlock )
+ eRet = SVX_ADJUST_BLOCK;
+ return eRet;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/autokernitem.hxx b/include/editeng/autokernitem.hxx
new file mode 100644
index 000000000000..6d849dc39d23
--- /dev/null
+++ b/include/editeng/autokernitem.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_AKRNITEM_HXX
+#define _SVX_AKRNITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxAutoKernItem -------------------------------------------------
+
+/*
+ [Description]
+ Attribute for Pair-Kerning.
+*/
+
+class EDITENG_DLLPUBLIC SvxAutoKernItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+
+ SvxAutoKernItem( const sal_Bool bAutoKern /*= sal_False*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ inline SvxAutoKernItem& operator=(const SvxAutoKernItem& rAutoKern)
+ {
+ SetValue( rAutoKern.GetValue() );
+ return *this;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/blinkitem.hxx b/include/editeng/blinkitem.hxx
new file mode 100644
index 000000000000..0d495e6e100e
--- /dev/null
+++ b/include/editeng/blinkitem.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_BLNKITEM_HXX
+#define _SVX_BLNKITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxBlinkItem -------------------------------------------------
+
+/*
+ [Description]
+ This item describes, whether to flash.
+*/
+
+class EDITENG_DLLPUBLIC SvxBlinkItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+
+ SvxBlinkItem( const sal_Bool bBlink /*= sal_False*/, const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ inline SvxBlinkItem& operator=(const SvxBlinkItem& rBlink) {
+ SetValue(rBlink.GetValue());
+ return *this;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/borderline.hxx b/include/editeng/borderline.hxx
new file mode 100644
index 000000000000..067e216aaa9a
--- /dev/null
+++ b/include/editeng/borderline.hxx
@@ -0,0 +1,169 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVX_BORDERLINE_HXX
+#define SVX_BORDERLINE_HXX
+
+#include <com/sun/star/table/BorderLineStyle.hpp>
+
+#include <tools/color.hxx>
+#include <svl/poolitem.hxx>
+#include <editeng/editengdllapi.h>
+#include <svtools/ctrlbox.hxx>
+
+// Line defaults in twips (former Writer defaults):
+
+#define DEF_LINE_WIDTH_0 1
+#define DEF_LINE_WIDTH_1 20
+#define DEF_LINE_WIDTH_2 50
+#define DEF_LINE_WIDTH_3 80
+#define DEF_LINE_WIDTH_4 100
+#define DEF_LINE_WIDTH_5 10
+
+// ============================================================================
+
+namespace editeng {
+
+ // values from ::com::sun::star::table::BorderLineStyle
+ typedef sal_Int16 SvxBorderStyle;
+
+ // convert border style between Word formats and LO
+ SvxBorderStyle EDITENG_DLLPUBLIC ConvertBorderStyleFromWord(int);
+ /// convert border width in twips between Word formats and LO
+ double EDITENG_DLLPUBLIC ConvertBorderWidthToWord(SvxBorderStyle, double);
+ double EDITENG_DLLPUBLIC ConvertBorderWidthFromWord(SvxBorderStyle,
+ double, int);
+
+ class EDITENG_DLLPUBLIC SvxBorderLine
+ {
+ protected:
+ Color aColor;
+
+ long m_nWidth;
+ bool m_bMirrorWidths;
+ BorderWidthImpl m_aWidthImpl;
+ long m_nMult;
+ long m_nDiv;
+
+ SvxBorderStyle m_nStyle;
+ sal_uInt16 nOutWidth;
+ sal_uInt16 nInWidth;
+ sal_uInt16 nDistance;
+
+ bool m_bUseLeftTop;
+ Color (*m_pColorOutFn)( Color );
+ Color (*m_pColorInFn)( Color );
+ Color (*m_pColorGapFn)( Color );
+
+ public:
+ SvxBorderLine( const Color *pCol = 0,
+ long nWidth = 0, SvxBorderStyle nStyle =
+ ::com::sun::star::table::BorderLineStyle::SOLID,
+ bool bUseLeftTop = false,
+ Color (*pColorOutFn)( Color ) = &darkColor,
+ Color (*pColorInFn)( Color ) = &darkColor,
+ Color (*pColorGapFn)( Color ) = NULL );
+ SvxBorderLine( const SvxBorderLine& r );
+
+ SvxBorderLine& operator=( const SvxBorderLine& r );
+
+ const Color& GetColor() const { return aColor; }
+ Color GetColorOut( bool bLeftOrTop = true ) const;
+ Color GetColorIn( bool bLeftOrTop = true ) const;
+ bool HasGapColor() const { return m_pColorGapFn != NULL; }
+ Color GetColorGap() const;
+
+ void SetWidth( long nWidth = 0 ) { m_nWidth = nWidth; }
+ /** Guess the style and width from the three lines widths values.
+
+ When the value of nStyle is SvxBorderLine::DOUBLE, the style set will be guessed
+ using the three values to match the best possible style among the following:
+ - SvxBorderLine::DOUBLE
+ - SvxBorderLine::THINTHICK_SMALLGAP
+ - SvxBorderLine::THINTHICK_MEDIUMGAP
+ - SvxBorderLine::THINTHICK_LARGEGAP
+ - SvxBorderLine::THICKTHIN_SMALLGAP
+ - SvxBorderLine::THICKTHIN_MEDIUMGAP
+ - SvxBorderLine::THICKTHIN_LARGEGAP
+
+ If no styles matches the width, then the width is set to 0.
+
+ There is one known case that could fit several styles: \a nIn = \a nDist = 0.75 pt,
+ \a nOut = 1.5 pt. This case fits SvxBorderLine::THINTHICK_SMALLGAP and
+ SvxBorderLine::THINTHICK_MEDIUMGAP with a 1.5 pt width and
+ SvxBorderLine::THINTHICK_LARGEGAP with a 0.75 pt width. The same case happens
+ also for thick-thin styles.
+
+ \param nStyle the border style used to guess the width.
+ \param nIn the width of the inner line in 1th pt
+ \param nOut the width of the outer line in 1th pt
+ \param nDist the width of the gap between the lines in 1th pt
+ */
+ void GuessLinesWidths( SvxBorderStyle nStyle, sal_uInt16 nOut, sal_uInt16 nIn = 0, sal_uInt16 nDist = 0 );
+
+ // TODO Hacky method to mirror lines in only a few cases
+ void SetMirrorWidths( bool bMirror = true ) { m_bMirrorWidths = bMirror; }
+ long GetWidth( ) const { return m_nWidth; }
+ sal_uInt16 GetOutWidth() const;
+ sal_uInt16 GetInWidth() const;
+ sal_uInt16 GetDistance() const;
+
+ SvxBorderStyle GetBorderLineStyle() const { return m_nStyle; }
+
+ void SetColor( const Color &rColor ) { aColor = rColor; }
+ void SetColorOutFn( Color (*pColorOutFn)( Color ) ) { m_pColorOutFn = pColorOutFn; }
+ void SetColorInFn( Color (*pColorInFn)( Color ) ) { m_pColorInFn = pColorInFn; }
+ void SetColorGapFn( Color (*pColorGapFn)( Color ) ) { m_pColorGapFn = pColorGapFn; }
+ void SetUseLeftTop( bool bUseLeftTop ) { m_bUseLeftTop = bUseLeftTop; }
+ void SetBorderLineStyle( SvxBorderStyle nNew );
+ void ScaleMetrics( long nMult, long nDiv );
+
+ sal_Bool operator==( const SvxBorderLine &rCmp ) const;
+
+ String GetValueString( SfxMapUnit eSrcUnit, SfxMapUnit eDestUnit,
+ const IntlWrapper* pIntl,
+ sal_Bool bMetricStr = sal_False ) const;
+
+ bool HasPriority( const SvxBorderLine& rOtherLine ) const;
+
+ bool isEmpty() const {
+ return m_aWidthImpl.IsEmpty()
+ || m_nStyle == ::com::sun::star::table::BorderLineStyle::NONE
+ || m_nWidth == 0;
+ }
+ bool isDouble() const { return m_aWidthImpl.IsDouble(); }
+ sal_uInt16 GetScaledWidth() const { return GetOutWidth() + GetInWidth() + GetDistance(); }
+
+ static Color darkColor( Color aMain );
+ static Color lightColor( Color aMain );
+
+ static Color threeDLightColor( Color aMain );
+ static Color threeDMediumColor( Color aMain );
+ static Color threeDDarkColor( Color aMain );
+
+ static BorderWidthImpl getWidthImpl( SvxBorderStyle nStyle );
+ };
+
+// ============================================================================
+
+} // namespace editeng
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/boxitem.hxx b/include/editeng/boxitem.hxx
new file mode 100644
index 000000000000..256663c961e9
--- /dev/null
+++ b/include/editeng/boxitem.hxx
@@ -0,0 +1,226 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_BOXITEM_HXX
+#define _SVX_BOXITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <editeng/borderline.hxx>
+#include <editeng/editengdllapi.h>
+#include <com/sun/star/table/BorderLine2.hpp>
+
+
+// class SvxBoxItem ------------------------------------------------------
+
+/* [Description]
+
+ This item describes a border attribute
+ (all four edges and the inward distance)
+*/
+
+#define BOX_LINE_TOP ((sal_uInt16)0)
+#define BOX_LINE_BOTTOM ((sal_uInt16)1)
+#define BOX_LINE_LEFT ((sal_uInt16)2)
+#define BOX_LINE_RIGHT ((sal_uInt16)3)
+
+/**
+This version causes SvxBoxItem to store the 4 cell spacing distances separately
+when serializing to stream.
+*/
+#define BOX_4DISTS_VERSION ((sal_uInt16)1)
+/**
+This version causes SvxBoxItem to store the styles for its border lines when
+serializing to stream.
+*/
+#define BOX_BORDER_STYLE_VERSION ((sal_uInt16)2)
+
+class EDITENG_DLLPUBLIC SvxBoxItem : public SfxPoolItem
+{
+ editeng::SvxBorderLine *pTop,
+ *pBottom,
+ *pLeft,
+ *pRight;
+ sal_uInt16 nTopDist,
+ nBottomDist,
+ nLeftDist,
+ nRightDist;
+
+public:
+ TYPEINFO();
+
+ explicit SvxBoxItem( const sal_uInt16 nId );
+ SvxBoxItem( const SvxBoxItem &rCpy );
+ ~SvxBoxItem();
+ SvxBoxItem &operator=( const SvxBoxItem& rBox );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+
+ virtual bool ScaleMetrics( long nMult, long nDiv );
+ virtual bool HasMetrics() const;
+
+ const editeng::SvxBorderLine* GetTop() const { return pTop; }
+ const editeng::SvxBorderLine* GetBottom() const { return pBottom; }
+ const editeng::SvxBorderLine* GetLeft() const { return pLeft; }
+ const editeng::SvxBorderLine* GetRight() const { return pRight; }
+
+ const editeng::SvxBorderLine* GetLine( sal_uInt16 nLine ) const;
+
+ //The Pointers are being copied!
+ void SetLine( const editeng::SvxBorderLine* pNew, sal_uInt16 nLine );
+
+ sal_uInt16 GetDistance( sal_uInt16 nLine ) const;
+ sal_uInt16 GetDistance() const;
+
+ void SetDistance( sal_uInt16 nNew, sal_uInt16 nLine );
+ inline void SetDistance( sal_uInt16 nNew );
+
+ // Line width plus Space plus inward distance
+ //bIgnoreLine = TRUE -> Also return distance, when no Line is set
+ sal_uInt16 CalcLineSpace( sal_uInt16 nLine, sal_Bool bIgnoreLine = sal_False ) const;
+ static com::sun::star::table::BorderLine2 SvxLineToLine( const editeng::SvxBorderLine* pLine, sal_Bool bConvert );
+ static sal_Bool LineToSvxLine(const ::com::sun::star::table::BorderLine& rLine, editeng::SvxBorderLine& rSvxLine, sal_Bool bConvert);
+ static sal_Bool LineToSvxLine(const ::com::sun::star::table::BorderLine2& rLine, editeng::SvxBorderLine& rSvxLine, sal_Bool bConvert);
+};
+
+inline void SvxBoxItem::SetDistance( sal_uInt16 nNew )
+{
+ nTopDist = nBottomDist = nLeftDist = nRightDist = nNew;
+}
+
+// class SvxBoxInfoItem --------------------------------------------------
+
+/* [Description]
+
+ Another item for the border. This item has only limited functionality.
+ On one hand, the general Dialog is told by the item which options it
+ should offer. On the other hand, this attribute may be used to
+ transported the borderline for the inner horizontal and vertical lines.
+*/
+
+#define BOXINFO_LINE_HORI ((sal_uInt16)0)
+#define BOXINFO_LINE_VERT ((sal_uInt16)1)
+
+#define VALID_TOP 0x01
+#define VALID_BOTTOM 0x02
+#define VALID_LEFT 0x04
+#define VALID_RIGHT 0x08
+#define VALID_HORI 0x10
+#define VALID_VERT 0x20
+#define VALID_DISTANCE 0x40
+#define VALID_DISABLE 0x80
+
+class EDITENG_DLLPUBLIC SvxBoxInfoItem : public SfxPoolItem
+{
+ editeng::SvxBorderLine* pHori; //inner horizontal Line
+ editeng::SvxBorderLine* pVert; //inner vertical Line
+
+ bool mbEnableHor; /// true = Enable inner horizontal line.
+ bool mbEnableVer; /// true = Enable inner vertical line.
+
+ /*
+ Currently only for StarWriter: distance inward from SvxBoxItem. If the
+ distance is requested, then the field for the distance from the dialog be
+ activated. nDefDist is regarded as a default value. If any line is
+ turned on or will be turned on it must this distance be set to default.
+ bMinDist indicates whether the user can go below this value or not.
+ With NDIST is the current distance from the app transported back and
+ forth to the dialogue.
+ */
+
+ sal_Bool bDist :1; // TRUE, Unlock Distance.
+ sal_Bool bMinDist :1; // TRUE, Going below minimum Distance is prohibited
+
+ sal_uInt8 nValidFlags; // 0000 0000
+ // ³³³³ ³³³ÀÄ VALID_TOP
+ // ³³³³ ³³ÀÄÄ VALID_BOTTOM
+ // ³³³³ ³ÀÄÄÄ VALID_LEFT
+ // ³³³³ ÀÄÄÄÄ VALID_RIGHT
+ // ³³³ÀÄÄÄÄÄÄ VALID_HORI
+ // ³³ÀÄÄÄÄÄÄÄ VALID_VERT
+ // ³ÀÄÄÄÄÄÄÄÄ VALID_DIST
+ // ÀÄÄÄÄÄÄÄÄÄ VALID_DISABLE
+
+ sal_uInt16 nDefDist; // The default or minimum distance.
+
+public:
+ TYPEINFO();
+
+ explicit SvxBoxInfoItem( const sal_uInt16 nId );
+ SvxBoxInfoItem( const SvxBoxInfoItem &rCpy );
+ ~SvxBoxInfoItem();
+ SvxBoxInfoItem &operator=( const SvxBoxInfoItem &rCpy );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
+ virtual bool ScaleMetrics( long nMult, long nDiv );
+ virtual bool HasMetrics() const;
+
+ const editeng::SvxBorderLine* GetHori() const { return pHori; }
+ const editeng::SvxBorderLine* GetVert() const { return pVert; }
+
+ //The Pointers are being copied!
+ void SetLine( const editeng::SvxBorderLine* pNew, sal_uInt16 nLine );
+
+ sal_Bool IsTable() const { return mbEnableHor && mbEnableVer; }
+ void SetTable( sal_Bool bNew ) { mbEnableHor = mbEnableVer = bNew; }
+
+ inline bool IsHorEnabled() const { return mbEnableHor; }
+ inline void EnableHor( bool bEnable ) { mbEnableHor = bEnable; }
+ inline bool IsVerEnabled() const { return mbEnableVer; }
+ inline void EnableVer( bool bEnable ) { mbEnableVer = bEnable; }
+
+ sal_Bool IsDist() const { return bDist; }
+ void SetDist( sal_Bool bNew ) { bDist = bNew; }
+ sal_Bool IsMinDist() const { return bMinDist; }
+ void SetMinDist( sal_Bool bNew ) { bMinDist = bNew; }
+ sal_uInt16 GetDefDist() const { return nDefDist; }
+ void SetDefDist( sal_uInt16 nNew ) { nDefDist = nNew; }
+
+ sal_Bool IsValid( sal_uInt8 nValid ) const
+ { return ( nValidFlags & nValid ) == nValid; }
+ void SetValid( sal_uInt8 nValid, sal_Bool bValid = sal_True )
+ { bValid ? ( nValidFlags |= nValid )
+ : ( nValidFlags &= ~nValid ); }
+ void ResetFlags();
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/brushitem.hxx b/include/editeng/brushitem.hxx
new file mode 100644
index 000000000000..069a3b7f636a
--- /dev/null
+++ b/include/editeng/brushitem.hxx
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_BRSHITEM_HXX
+#define _SVX_BRSHITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <vcl/wall.hxx>
+#include <tools/link.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxBrushItem ----------------------------------------------------
+
+class Graphic;
+class GraphicObject;
+class CntWallpaperItem;
+
+#define BRUSH_GRAPHIC_VERSION ((sal_uInt16)0x0001)
+
+enum SvxGraphicPosition
+{
+ GPOS_NONE,
+ GPOS_LT, GPOS_MT, GPOS_RT,
+ GPOS_LM, GPOS_MM, GPOS_RM,
+ GPOS_LB, GPOS_MB, GPOS_RB,
+ GPOS_AREA, GPOS_TILED
+};
+
+#define PARA_DEST_PARA 0
+#define PARA_DEST_CHAR 1
+
+class SvxBrushItem_Impl;
+class EDITENG_DLLPUBLIC SvxBrushItem : public SfxPoolItem
+{
+ Color aColor;
+ SvxBrushItem_Impl* pImpl;
+ String* pStrLink;
+ String* pStrFilter;
+ SvxGraphicPosition eGraphicPos;
+ sal_Bool bLoadAgain;
+
+ void ApplyGraphicTransparency_Impl();
+ DECL_STATIC_LINK( SvxBrushItem, DoneHdl_Impl, void *);
+ // wird nur von Create benutzt
+ SvxBrushItem( SvStream& rStrm,
+ sal_uInt16 nVersion, sal_uInt16 nWhich );
+
+public:
+ TYPEINFO();
+
+ explicit SvxBrushItem( sal_uInt16 nWhich );
+ SvxBrushItem( const Color& rColor, sal_uInt16 nWhich );
+
+ SvxBrushItem( const Graphic& rGraphic,
+ SvxGraphicPosition ePos, sal_uInt16 nWhich );
+ SvxBrushItem( const GraphicObject& rGraphicObj,
+ SvxGraphicPosition ePos, sal_uInt16 nWhich );
+ SvxBrushItem( const String& rLink, const String& rFilter,
+ SvxGraphicPosition ePos, sal_uInt16 nWhich );
+ SvxBrushItem( const SvxBrushItem& );
+ SvxBrushItem( const CntWallpaperItem&, sal_uInt16 nWhich );
+
+ ~SvxBrushItem();
+
+public:
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream&, sal_uInt16 nVersion ) const;
+ virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+
+ const Color& GetColor() const { return aColor; }
+ Color& GetColor() { return aColor; }
+ void SetColor( const Color& rCol) { aColor = rCol; }
+
+ void SetDoneLink( const Link& rLink );
+
+ SvxGraphicPosition GetGraphicPos() const { return eGraphicPos; }
+
+ void PurgeMedium() const;
+
+ const Graphic* GetGraphic() const;
+ const GraphicObject* GetGraphicObject() const;
+ const String* GetGraphicLink() const { return pStrLink; }
+ const String* GetGraphicFilter() const { return pStrFilter; }
+
+ void SetGraphicPos( SvxGraphicPosition eNew );
+ void SetGraphic( const Graphic& rNew );
+ void SetGraphicObject( const GraphicObject& rNewObj );
+ void SetGraphicLink( const String& rNew );
+ void SetGraphicFilter( const String& rNew );
+
+ SvxBrushItem& operator=( const SvxBrushItem& rItem);
+
+ static SvxGraphicPosition WallpaperStyle2GraphicPos( WallpaperStyle eStyle );
+ static WallpaperStyle GraphicPos2WallpaperStyle( SvxGraphicPosition ePos );
+};
+
+#endif // #ifndef _SVX_BRSHITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/bulletitem.hxx b/include/editeng/bulletitem.hxx
new file mode 100644
index 000000000000..345cf3ff7639
--- /dev/null
+++ b/include/editeng/bulletitem.hxx
@@ -0,0 +1,146 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_BULITEM_HXX
+#define _SVX_BULITEM_HXX
+
+#include "editeng/editengdllapi.h"
+
+
+// define ----------------------------------------------------------------
+
+// Styles
+#define BS_ABC_BIG 0
+#define BS_ABC_SMALL 1
+#define BS_ROMAN_BIG 2
+#define BS_ROMAN_SMALL 3
+#define BS_123 4
+#define BS_NONE 5
+#define BS_BULLET 6
+#define BS_BMP 128
+
+// Justification
+#define BJ_HLEFT 0x01
+#define BJ_HRIGHT 0x02
+#define BJ_HCENTER 0x04
+#define BJ_VTOP 0x08
+#define BJ_VBOTTOM 0x10
+#define BJ_VCENTER 0x20
+
+// Valid-Bits
+// First, only the values that are changed by the dialogue ...
+#define VALID_FONTCOLOR 0x0001
+#define VALID_FONTNAME 0x0002
+#define VALID_SYMBOL 0x0004
+#define VALID_BITMAP 0x0008
+#define VALID_SCALE 0x0010
+#define VALID_START 0x0020
+#define VALID_STYLE 0x0040
+#define VALID_PREVTEXT 0x0080
+#define VALID_FOLLOWTEXT 0x0100
+#include <svl/poolitem.hxx>
+#include <vcl/font.hxx>
+#include <svtools/grfmgr.hxx>
+
+// class SvxBulletItem ---------------------------------------------------
+
+class EDITENG_DLLPUBLIC SvxBulletItem : public SfxPoolItem
+{
+ Font aFont;
+ GraphicObject* pGraphicObject;
+ String aPrevText;
+ String aFollowText;
+ sal_uInt16 nStart;
+ sal_uInt16 nStyle;
+ long nWidth;
+ sal_uInt16 nScale;
+ sal_Unicode cSymbol;
+ sal_uInt8 nJustify;
+ sal_uInt16 nValidMask; // Only temporary for GetAttribs / setAttribs,
+ // because of the large Bullets
+
+#ifdef _SVX_BULITEM_CXX
+ void SetDefaultFont_Impl();
+ void SetDefaults_Impl();
+#endif
+
+public:
+ TYPEINFO();
+
+ explicit SvxBulletItem( sal_uInt16 nWhich = 0 );
+ explicit SvxBulletItem( SvStream& rStrm, sal_uInt16 nWhich = 0 );
+ SvxBulletItem( const SvxBulletItem& );
+ ~SvxBulletItem();
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream&, sal_uInt16 nVersion ) const;
+ virtual SvStream& Store( SvStream & , sal_uInt16 nItemVersion ) const;
+
+ String GetFullText() const;
+ sal_Unicode GetSymbol() const { return cSymbol; }
+ String GetPrevText() const { return aPrevText; }
+ String GetFollowText() const { return aFollowText; }
+
+ sal_uInt16 GetStart() const { return nStart; }
+ long GetWidth() const { return nWidth; }
+ sal_uInt16 GetStyle() const { return nStyle; }
+ sal_uInt8 GetJustification() const { return nJustify; }
+ Font GetFont() const { return aFont; }
+ sal_uInt16 GetScale() const { return nScale; }
+
+ const GraphicObject& GetGraphicObject() const;
+ void SetGraphicObject( const GraphicObject& rGraphicObject );
+
+ void SetSymbol( sal_Unicode c) { cSymbol = c; }
+ void SetPrevText( const String& rStr) { aPrevText = rStr;}
+ void SetFollowText(const String& rStr) { aFollowText=rStr;}
+
+ void SetStart( sal_uInt16 nNew ) { nStart = nNew; }
+ void SetWidth( long nNew ) { nWidth = nNew; }
+ void SetStyle( sal_uInt16 nNew ) { nStyle = nNew; }
+ void SetJustification( sal_uInt8 nNew ) { nJustify = nNew; }
+ void SetFont( const Font& rNew) { aFont = rNew; }
+ void SetScale( sal_uInt16 nNew ) { nScale = nNew; }
+
+ virtual sal_uInt16 GetVersion(sal_uInt16 nFileVersion) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ static void StoreFont( SvStream&, const Font& );
+ static Font CreateFont( SvStream&, sal_uInt16 nVer );
+
+ sal_uInt16& GetValidMask() { return nValidMask; }
+ sal_uInt16 GetValidMask() const { return nValidMask; }
+ sal_uInt16 IsValid( sal_uInt16 nFlag ) const { return nValidMask & nFlag; }
+ void SetValid( sal_uInt16 nFlag, sal_Bool bValid )
+ {
+ if ( bValid )
+ nValidMask |= nFlag;
+ else
+ nValidMask &= ~nFlag;
+ }
+ void CopyValidProperties( const SvxBulletItem& rCopyFrom );
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/charhiddenitem.hxx b/include/editeng/charhiddenitem.hxx
new file mode 100644
index 000000000000..651bdc240ef1
--- /dev/null
+++ b/include/editeng/charhiddenitem.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_CHARHIDDENITEM_HXX
+#define _SVX_CHARHIDDENITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <svl/eitem.hxx>
+#include "editeng/editengdllapi.h"
+
+// class SvxCharHiddenItem -------------------------------------------------
+/* [Description]
+
+ This item marks text as hidden
+*/
+
+class EDITENG_DLLPUBLIC SvxCharHiddenItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+
+ SvxCharHiddenItem( const sal_Bool bHidden /*= sal_False*/, const sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ inline SvxCharHiddenItem& operator=(const SvxCharHiddenItem& rHidden) {
+ SetValue(rHidden.GetValue());
+ return *this;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/charreliefitem.hxx b/include/editeng/charreliefitem.hxx
new file mode 100644
index 000000000000..5bc6c589d02d
--- /dev/null
+++ b/include/editeng/charreliefitem.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_CHARRELIEFITEM_HXX
+#define _SVX_CHARRELIEFITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <vcl/fntstyle.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxCharRotateItem ----------------------------------------------
+
+/* [Description]
+
+ This item defines a character relief and has currently the values
+ emboss, relief.
+*/
+
+class EDITENG_DLLPUBLIC SvxCharReliefItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+
+ SvxCharReliefItem( FontRelief eValue /*= RELIEF_NONE*/,
+ const sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream & rStrm, sal_uInt16 nIVer) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+
+ virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const;
+ virtual sal_uInt16 GetValueCount() const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper * = 0 ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ inline SvxCharReliefItem& operator=( const SvxCharReliefItem& rItem )
+ {
+ SetValue( rItem.GetValue() );
+ return *this;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/charrotateitem.hxx b/include/editeng/charrotateitem.hxx
new file mode 100644
index 000000000000..7845ab69ccd8
--- /dev/null
+++ b/include/editeng/charrotateitem.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_CHARROTATEITEM_HXX
+#define _SVX_CHARROTATEITEM_HXX
+
+#include <svl/intitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxCharRotateItem ----------------------------------------------
+
+/* [Description]
+
+ This item defines a character rotation value (0,1 degree). Currently
+ character can only be rotated 90,0 and 270,0 degrees.
+ The flag FitToLine defines only a UI-Information -
+ if true it must also create a SvxCharScaleItem.
+
+*/
+
+class EDITENG_DLLPUBLIC SvxCharRotateItem : public SfxUInt16Item
+{
+ sal_Bool bFitToLine;
+public:
+ TYPEINFO();
+
+ SvxCharRotateItem( sal_uInt16 nValue /*= 0*/,
+ sal_Bool bFitIntoLine /*= sal_False*/,
+ const sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream & rStrm, sal_uInt16 nIVer) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper * = 0 ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ inline SvxCharRotateItem& operator=( const SvxCharRotateItem& rItem )
+ {
+ SetValue( rItem.GetValue() );
+ SetFitToLine( rItem.IsFitToLine() );
+ return *this;
+ }
+
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ // our currently only degree values
+ void SetTopToBotton() { SetValue( 2700 ); }
+ void SetBottomToTop() { SetValue( 900 ); }
+ sal_Bool IsTopToBotton() const { return 2700 == GetValue(); }
+ sal_Bool IsBottomToTop() const { return 900 == GetValue(); }
+
+ sal_Bool IsFitToLine() const { return bFitToLine; }
+ void SetFitToLine( sal_Bool b ) { bFitToLine = b; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/charscaleitem.hxx b/include/editeng/charscaleitem.hxx
new file mode 100644
index 000000000000..7d9b38761852
--- /dev/null
+++ b/include/editeng/charscaleitem.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_CHARSCALEITEM_HXX
+#define _SVX_CHARSCALEITEM_HXX
+
+#include <svl/intitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxCharScaleItem ----------------------------------------------
+
+/* [Description]
+
+ This item defines a character scaling factor as percent value.
+ A value of 100 is identical to 100% and means normal width
+ A value of 50 is identical to 50% and means 1/2 width.
+
+*/
+
+class EDITENG_DLLPUBLIC SvxCharScaleWidthItem : public SfxUInt16Item
+{
+public:
+ TYPEINFO();
+
+ SvxCharScaleWidthItem( sal_uInt16 nValue /*= 100*/,
+ const sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper * = 0 ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ inline SvxCharScaleWidthItem& operator=(const SvxCharScaleWidthItem& rItem )
+ {
+ SetValue( rItem.GetValue() );
+ return *this;
+ }
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/charsetcoloritem.hxx b/include/editeng/charsetcoloritem.hxx
new file mode 100644
index 000000000000..6fc197fb1394
--- /dev/null
+++ b/include/editeng/charsetcoloritem.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_CSCOITEM_HXX
+#define _SVX_CSCOITEM_HXX
+
+#include <tools/string.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxCharSetColorItem ---------------------------------------------
+
+/* [Description]
+
+ Is only needed internally in the reader of Writer.
+*/
+
+class EDITENG_DLLPUBLIC SvxCharSetColorItem : public SvxColorItem
+{
+ rtl_TextEncoding eFrom;
+public:
+ TYPEINFO();
+
+ explicit SvxCharSetColorItem( const sal_uInt16 nId );
+ SvxCharSetColorItem( const Color& aColor, const rtl_TextEncoding eFrom,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+
+ inline rtl_TextEncoding& GetCharSet() { return eFrom; }
+ inline rtl_TextEncoding GetCharSet() const { return eFrom; }
+
+ inline SvxCharSetColorItem& operator=(const SvxCharSetColorItem& rColor)
+ {
+ SetValue( rColor.GetValue() );
+ eFrom = rColor.GetCharSet();
+ return *this;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/cmapitem.hxx b/include/editeng/cmapitem.hxx
new file mode 100644
index 000000000000..f7326758befc
--- /dev/null
+++ b/include/editeng/cmapitem.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_CMAPITEM_HXX
+#define _SVX_CMAPITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/svxenum.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxCaseMapItem --------------------------------------------------
+
+/* [Description]
+
+ This item describe the font type (uppercase, small caps ,...).
+*/
+
+class EDITENG_DLLPUBLIC SvxCaseMapItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+
+ SvxCaseMapItem( const SvxCaseMap eMap /*= SVX_CASEMAP_NOT_MAPPED*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem + SfxEnumItem
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+ virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const;
+ virtual sal_uInt16 GetValueCount() const;
+
+ // MS VC4.0 kommt durcheinander
+ void SetValue( sal_uInt16 nNewVal )
+ {SfxEnumItem::SetValue(nNewVal); }
+
+ inline SvxCaseMapItem& operator=(const SvxCaseMapItem& rMap)
+ {
+ SetValue( rMap.GetValue() );
+ return *this;
+ }
+
+ // enum cast
+ SvxCaseMap GetCaseMap() const
+ { return (SvxCaseMap)GetValue(); }
+ void SetCaseMap( SvxCaseMap eNew )
+ { SetValue( (sal_uInt16)eNew ); }
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/colritem.hxx b/include/editeng/colritem.hxx
new file mode 100644
index 000000000000..954fcd3b6ba0
--- /dev/null
+++ b/include/editeng/colritem.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_COLRITEM_HXX
+#define _SVX_COLRITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <tools/color.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxColorItem ----------------------------------------------------
+
+/* [Description]
+
+ This item describes a color.
+*/
+
+#define VERSION_USEAUTOCOLOR 1
+
+class EDITENG_DLLPUBLIC SvxColorItem : public SfxPoolItem
+{
+private:
+ Color mColor;
+
+public:
+ TYPEINFO();
+
+ explicit SvxColorItem( const sal_uInt16 nId );
+ SvxColorItem( const Color& aColor, const sal_uInt16 nId );
+ SvxColorItem( SvStream& rStrm, const sal_uInt16 nId );
+ SvxColorItem( const SvxColorItem& rCopy );
+ ~SvxColorItem();
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+
+ inline SvxColorItem& operator=(const SvxColorItem& rColor)
+ {
+ SetValue( rColor.GetValue() );
+ return *this;
+ }
+
+ const Color& GetValue() const
+ {
+ return mColor;
+ }
+ void SetValue( const Color& rNewCol );
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/contouritem.hxx b/include/editeng/contouritem.hxx
new file mode 100644
index 000000000000..316f21fc774e
--- /dev/null
+++ b/include/editeng/contouritem.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef __EDITENG_CONTOUR_ITEM_HXX__
+#define __EDITENG_CONTOUR_ITEM_HXX__
+
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxContourItem --------------------------------------------------
+
+/* [Description]
+ This item describes, if contour is employed.
+*/
+
+class EDITENG_DLLPUBLIC SvxContourItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+
+ SvxContourItem( const sal_Bool bContoured /*= sal_False*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ inline SvxContourItem& operator=(const SvxContourItem& rCont)
+ {
+ SetValue(rCont.GetValue());
+ return *this;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/crossedoutitem.hxx b/include/editeng/crossedoutitem.hxx
new file mode 100644
index 000000000000..6628609e060e
--- /dev/null
+++ b/include/editeng/crossedoutitem.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_CRSDITEM_HXX
+#define _SVX_CRSDITEM_HXX
+
+#include <vcl/vclenum.hxx>
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxCrossedOutItem -----------------------------------------------
+
+/* [Description]
+ This item describes, whether and how it is striked out.
+*/
+
+class EDITENG_DLLPUBLIC SvxCrossedOutItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+
+ SvxCrossedOutItem( const FontStrikeout eSt /*= STRIKEOUT_NONE*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+ virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const;
+ virtual sal_uInt16 GetValueCount() const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ // MS VC4.0 messes things up
+ void SetValue( sal_uInt16 nNewVal )
+ {SfxEnumItem::SetValue(nNewVal); }
+
+ virtual int HasBoolValue() const;
+ virtual sal_Bool GetBoolValue() const;
+ virtual void SetBoolValue( sal_Bool bVal );
+
+ inline SvxCrossedOutItem& operator=(const SvxCrossedOutItem& rCross)
+ {
+ SetValue( rCross.GetValue() );
+ return *this;
+ }
+
+ // enum cast
+ FontStrikeout GetStrikeout() const
+ { return (FontStrikeout)GetValue(); }
+ void SetStrikeout( FontStrikeout eNew )
+ { SetValue( (sal_uInt16)eNew ); }
+};
+
+#endif // #ifndef _SVX_CRSDITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/editdata.hxx b/include/editeng/editdata.hxx
new file mode 100644
index 000000000000..9b6d9e7005c3
--- /dev/null
+++ b/include/editeng/editdata.hxx
@@ -0,0 +1,368 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+// MyEDITDATA, wegen exportiertem EditData
+#ifndef _MyEDITDATA_HXX
+#define _MyEDITDATA_HXX
+
+#include <tools/string.hxx>
+#include "editeng/editengdllapi.h"
+
+class SfxItemSet;
+class SfxPoolItem;
+class SvParser;
+class SvxFieldItem;
+
+enum EETextFormat { EE_FORMAT_TEXT = 0x20, EE_FORMAT_RTF, EE_FORMAT_BIN = 0x31, EE_FORMAT_HTML, EE_FORMAT_XML };
+enum EEHorizontalTextDirection { EE_HTEXTDIR_DEFAULT, EE_HTEXTDIR_L2R, EE_HTEXTDIR_R2L };
+enum EESelectionMode { EE_SELMODE_STD, EE_SELMODE_TXTONLY, EE_SELMODE_HIDDEN };
+ // EE_SELMODE_HIDDEN can be used to completely hide the selection. This is useful e.g. when you want show the selection
+ // only as long as your window (which the edit view works on) has the focus
+enum EESpellState { EE_SPELL_OK, EE_SPELL_NOLANGUAGE, EE_SPELL_LANGUAGENOTINSTALLED, EE_SPELL_NOSPELLER, EE_SPELL_ERRORFOUND };
+enum EVAnchorMode {
+ ANCHOR_TOP_LEFT, ANCHOR_VCENTER_LEFT, ANCHOR_BOTTOM_LEFT,
+ ANCHOR_TOP_HCENTER, ANCHOR_VCENTER_HCENTER, ANCHOR_BOTTOM_HCENTER,
+ ANCHOR_TOP_RIGHT, ANCHOR_VCENTER_RIGHT, ANCHOR_BOTTOM_RIGHT };
+
+#define EE_PARA_NOT_FOUND 0xFFFF
+#define EE_PARA_APPEND 0xFFFF
+#define EE_PARA_ALL 0xFFFF
+#define EE_INDEX_NOT_FOUND 0xFFFF
+
+EDITENG_DLLPUBLIC extern const size_t EE_APPEND;
+
+// Error messages for Read / Write Method
+#define EE_READWRITE_OK (SVSTREAM_OK)
+#define EE_READWRITE_WRONGFORMAT (SVSTREAM_ERRBASE_USER+1)
+#define EE_READWRITE_GENERALERROR (SVSTREAM_ERRBASE_USER+2)
+
+#define EDITUNDO_START 100
+#define EDITUNDO_REMOVECHARS 100
+#define EDITUNDO_CONNECTPARAS 101
+#define EDITUNDO_REMOVEFEATURE 102
+#define EDITUNDO_MOVEPARAGRAPHS 103
+#define EDITUNDO_INSERTFEATURE 104
+#define EDITUNDO_SPLITPARA 105
+#define EDITUNDO_INSERTCHARS 106
+#define EDITUNDO_DELCONTENT 107
+#define EDITUNDO_DELETE 108
+#define EDITUNDO_CUT 109
+#define EDITUNDO_PASTE 110
+#define EDITUNDO_INSERT 111
+#define EDITUNDO_SRCHANDREPL 112
+#define EDITUNDO_MOVEPARAS 113
+#define EDITUNDO_PARAATTRIBS 114
+#define EDITUNDO_ATTRIBS 115
+#define EDITUNDO_DRAGANDDROP 116
+#define EDITUNDO_READ 117
+#define EDITUNDO_STYLESHEET 118
+#define EDITUNDO_REPLACEALL 119
+#define EDITUNDO_STRETCH 120
+#define EDITUNDO_RESETATTRIBS 121
+#define EDITUNDO_INDENTBLOCK 122
+#define EDITUNDO_UNINDENTBLOCK 123
+#define EDITUNDO_MARKSELECTION 124
+#define EDITUNDO_TRANSLITERATE 125
+#define EDITUNDO_END 125
+
+#define EDITUNDO_USER 200
+
+class EditView;
+class EditEngine;
+class ImpEditView;
+class ImpEditEngine;
+class EditTextObject;
+class SfxStyleSheet;
+
+#define RGCHK_NONE 0 // No correction of ViusArea when scrolling
+#define RGCHK_NEG 1 // No negative ViusArea when scrolling
+#define RGCHK_PAPERSZ1 2 // VisArea must be within paper width, Text Size
+
+struct EPosition
+{
+ sal_uInt16 nPara;
+ xub_StrLen nIndex;
+
+ EPosition() :
+ nPara( EE_PARA_NOT_FOUND ),
+ nIndex( EE_INDEX_NOT_FOUND )
+ {
+ }
+
+ EPosition( sal_uInt16 nPara_, xub_StrLen nPos_ ) :
+ nPara( nPara_ ),
+ nIndex( nPos_ )
+ {
+ }
+};
+
+struct ESelection
+{
+ sal_uInt16 nStartPara;
+ xub_StrLen nStartPos;
+ sal_uInt16 nEndPara;
+ xub_StrLen nEndPos;
+
+ ESelection() : nStartPara( 0 ), nStartPos( 0 ), nEndPara( 0 ), nEndPos( 0 ) {}
+
+ ESelection( sal_uInt16 nStPara, xub_StrLen nStPos, sal_uInt16 nEPara, xub_StrLen nEPos ) :
+ nStartPara( nStPara ),
+ nStartPos( nStPos ),
+ nEndPara( nEPara ),
+ nEndPos( nEPos )
+ {
+ }
+
+ ESelection( sal_uInt16 nPara, xub_StrLen nPos ) :
+ nStartPara( nPara ),
+ nStartPos( nPos ),
+ nEndPara( nPara ),
+ nEndPos( nPos )
+ {
+ }
+
+ void Adjust();
+ sal_Bool IsEqual( const ESelection& rS ) const;
+ sal_Bool IsLess( const ESelection& rS ) const;
+ sal_Bool IsGreater( const ESelection& rS ) const;
+ sal_Bool IsZero() const;
+ sal_Bool HasRange() const;
+};
+
+inline sal_Bool ESelection::HasRange() const
+{
+ return ( nStartPara != nEndPara ) || ( nStartPos != nEndPos );
+}
+
+inline sal_Bool ESelection::IsZero() const
+{
+ return ( ( nStartPara == 0 ) && ( nStartPos == 0 ) &&
+ ( nEndPara == 0 ) && ( nEndPos == 0 ) );
+}
+
+inline sal_Bool ESelection::IsEqual( const ESelection& rS ) const
+{
+ return ( ( nStartPara == rS.nStartPara ) && ( nStartPos == rS.nStartPos ) &&
+ ( nEndPara == rS.nEndPara ) && ( nEndPos == rS.nEndPos ) );
+}
+
+inline sal_Bool ESelection::IsLess( const ESelection& rS ) const
+{
+ // The selection must be adjusted.
+ // => Only check if end of 'this' < Start of rS
+
+ if ( ( nEndPara < rS.nStartPara ) ||
+ ( ( nEndPara == rS.nStartPara ) && ( nEndPos < rS.nStartPos ) && !IsEqual( rS ) ) )
+ {
+ return sal_True;
+ }
+ return sal_False;
+}
+
+inline sal_Bool ESelection::IsGreater( const ESelection& rS ) const
+{
+ // The selection must be adjusted.
+ // => Only check if end of 'this' < Start of rS
+
+ if ( ( nStartPara > rS.nEndPara ) ||
+ ( ( nStartPara == rS.nEndPara ) && ( nStartPos > rS.nEndPos ) && !IsEqual( rS ) ) )
+ {
+ return sal_True;
+ }
+ return sal_False;
+}
+
+inline void ESelection::Adjust()
+{
+ sal_Bool bSwap = sal_False;
+ if ( nStartPara > nEndPara )
+ bSwap = sal_True;
+ else if ( ( nStartPara == nEndPara ) && ( nStartPos > nEndPos ) )
+ bSwap = sal_True;
+
+ if ( bSwap )
+ {
+ sal_uInt16 nSPar = nStartPara; sal_uInt16 nSPos = nStartPos;
+ nStartPara = nEndPara; nStartPos = nEndPos;
+ nEndPara = nSPar; nEndPos = nSPos;
+ }
+}
+
+struct EDITENG_DLLPUBLIC EFieldInfo
+{
+ SvxFieldItem* pFieldItem;
+ String aCurrentText;
+ EPosition aPosition;
+
+ EFieldInfo();
+ EFieldInfo( const SvxFieldItem& rFieldItem, sal_uInt16 nPara, sal_uInt16 nPos );
+ ~EFieldInfo();
+
+ EFieldInfo( const EFieldInfo& );
+ EFieldInfo& operator= ( const EFieldInfo& );
+};
+
+// -----------------------------------------------------------------------
+
+enum ImportState {
+ RTFIMP_START, RTFIMP_END, // only pParser, nPara, nIndex
+ RTFIMP_NEXTTOKEN, RTFIMP_UNKNOWNATTR, // nToken+nTokenValue
+ RTFIMP_SETATTR, // pAttrs
+ RTFIMP_INSERTTEXT, // aText
+ RTFIMP_INSERTPARA, // -
+ HTMLIMP_START, HTMLIMP_END, // only pParser, nPara, nIndex
+ HTMLIMP_NEXTTOKEN, HTMLIMP_UNKNOWNATTR, // nToken
+ HTMLIMP_SETATTR, // pAttrs
+ HTMLIMP_INSERTTEXT, // aText
+ HTMLIMP_INSERTPARA, HTMLIMP_INSERTFIELD // -
+ };
+
+struct ImportInfo
+{
+ SvParser* pParser;
+ ESelection aSelection;
+ ImportState eState;
+
+ int nToken;
+ short nTokenValue;
+
+ String aText;
+
+ void* pAttrs; // RTF: SvxRTFItemStackType*, HTML: SfxItemSet*
+
+ ImportInfo( ImportState eState, SvParser* pPrsrs, const ESelection& rSel );
+ ~ImportInfo();
+};
+
+struct ParagraphInfos
+{
+ ParagraphInfos()
+ : nParaHeight( 0 )
+ , nLines( 0 )
+ , nFirstLineStartX( 0 )
+ , nFirstLineOffset( 0 )
+ , nFirstLineHeight( 0 )
+ , nFirstLineTextHeight ( 0 )
+ , nFirstLineMaxAscent( 0 )
+ , bValid( 0 )
+ {}
+ sal_uInt16 nParaHeight;
+ sal_uInt16 nLines;
+
+ sal_uInt16 nFirstLineStartX;
+
+ sal_uInt16 nFirstLineOffset;
+ sal_uInt16 nFirstLineHeight;
+ sal_uInt16 nFirstLineTextHeight;
+ sal_uInt16 nFirstLineMaxAscent;
+
+ sal_Bool bValid; // A query during formatting is not valid!
+};
+
+struct EECharAttrib
+{
+ const SfxPoolItem* pAttr;
+
+ sal_uInt16 nPara;
+ xub_StrLen nStart;
+ xub_StrLen nEnd;
+};
+
+struct MoveParagraphsInfo
+{
+ sal_uInt16 nStartPara;
+ sal_uInt16 nEndPara;
+ sal_uInt16 nDestPara;
+
+ MoveParagraphsInfo( sal_uInt16 nS, sal_uInt16 nE, sal_uInt16 nD )
+ { nStartPara = nS; nEndPara = nE; nDestPara = nD; }
+};
+
+#define EE_ACTION_PASTE 1
+#define EE_ACTION_DROP 2
+
+struct PasteOrDropInfos
+{
+ sal_uInt16 nAction;
+ sal_uInt16 nStartPara;
+ sal_uInt16 nEndPara;
+
+ PasteOrDropInfos() : nAction(0), nStartPara(0xFFFF), nEndPara(0xFFFF) {}
+};
+
+enum EENotifyType
+{
+ /// EditEngine text was modified
+ EE_NOTIFY_TEXTMODIFIED,
+
+ /// A paragraph was inserted into the EditEngine
+ EE_NOTIFY_PARAGRAPHINSERTED,
+
+ /// A paragraph was removed from the EditEngine
+ EE_NOTIFY_PARAGRAPHREMOVED,
+
+ /// Multiple paragraphs have been removed from the EditEngine
+ EE_NOTIFY_PARAGRAPHSMOVED,
+
+ /// The height of at least one paragraph has changed
+ EE_NOTIFY_TEXTHEIGHTCHANGED,
+
+ /// The view area of the EditEngine scrolled
+ EE_NOTIFY_TEXTVIEWSCROLLED,
+
+ /// The selection and/or the cursor position has changed
+ EE_NOTIFY_TEXTVIEWSELECTIONCHANGED,
+
+ /** Denotes the beginning of a collected amount of EditEngine
+ notification events. This event itself is not queued, but sent
+ immediately
+ */
+ EE_NOTIFY_BLOCKNOTIFICATION_START,
+
+ /** Denotes the end of a collected amount of EditEngine
+ notification events. After this event, the queue is empty, and
+ a high-level operation such as "insert paragraph" is finished
+ */
+ EE_NOTIFY_BLOCKNOTIFICATION_END,
+
+ /// Denotes the beginning of a high-level action triggered by a key press
+ EE_NOTIFY_INPUT_START,
+
+ /// Denotes the end of a high-level action triggered by a key press
+ EE_NOTIFY_INPUT_END
+};
+
+struct EENotify
+{
+ EENotifyType eNotificationType;
+ EditEngine* pEditEngine;
+ EditView* pEditView;
+
+ sal_uInt16 nParagraph; // only valid in PARAGRAPHINSERTED/EE_NOTIFY_PARAGRAPHREMOVED
+
+ sal_uInt16 nParam1;
+ sal_uInt16 nParam2;
+
+ EENotify( EENotifyType eType )
+ { eNotificationType = eType; pEditEngine = NULL; pEditView = NULL; nParagraph = EE_PARA_NOT_FOUND; nParam1 = 0; nParam2 = 0; }
+};
+
+#endif // _MyEDITDATA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx
new file mode 100644
index 000000000000..83ba64342443
--- /dev/null
+++ b/include/editeng/editeng.hxx
@@ -0,0 +1,586 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+// MyEDITENG, due to exported EditEng
+#ifndef _MyEDITENG_HXX
+#define _MyEDITENG_HXX
+
+#include <rtl/ref.hxx>
+#include <vector>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/i18n/WordType.hpp>
+#include <com/sun/star/i18n/CharacterIteratorMode.hpp>
+
+#include <rsc/rscsfx.hxx>
+#include <editeng/editdata.hxx>
+#include <i18nlangtag/lang.h>
+#include "editeng/editengdllapi.h"
+
+#include <tools/rtti.hxx> // due to typedef TypeId
+
+#include <editeng/eedata.hxx>
+
+namespace com { namespace sun { namespace star {
+ namespace linguistic2 {
+ class XSpellChecker1;
+ class XHyphenator;
+ }
+ namespace datatransfer {
+ class XTransferable;
+ }
+ namespace lang {
+ struct Locale;
+ }
+}}}
+
+namespace svx {
+struct SpellPortion;
+typedef std::vector<SpellPortion> SpellPortions;
+}
+
+namespace svl { class IUndoManager; }
+namespace basegfx { class B2DPolyPolygon; }
+
+class ImpEditEngine;
+class EditView;
+class OutputDevice;
+class EditUndo;
+class SvxFont;
+class SfxItemPool;
+class SfxStyleSheet;
+class String;
+class SfxStyleSheetPool;
+class SvxSearchItem;
+class SvxFieldItem;
+class SvxCharSetColorItem;
+class SfxUndoAction;
+class MapMode;
+class Color;
+class Font;
+class KeyEvent;
+class PolyPolygon;
+class Size;
+class Point;
+class Rectangle;
+class SvStream;
+class Link;
+class OutputDevice;
+class Window;
+class SfxPoolItem;
+class SvxNumBulletItem;
+class SvxBulletItem;
+class SvxLRSpaceItem;
+class SvKeyValueIterator;
+class SvxForbiddenCharactersTable;
+class SvxNumberFormat;
+class FontList;
+class SvxFieldData;
+class ContentNode;
+class ParaPortion;
+class EditSelection;
+class EditPaM;
+class EditLine;
+class InternalEditStatus;
+class EditSelectionEngine;
+class EditDoc;
+struct PasteOrDropInfos;
+class Range;
+struct EPaM;
+class DeletedNodeInfo;
+class ParaPortionList;
+
+//////////////////////////////////////////////////////////////////////////////
+
+/** values for GetAttribs
+*/
+const sal_uInt8 EditEngineAttribs_All = 0; /// returns all attributes even when theire not set
+const sal_uInt8 EditEngineAttribs_HardAndPara = 1; /// returns all attributes set on paragraph and on portions
+const sal_uInt8 EditEngineAttribs_OnlyHard = 2; /// returns only attributes hard set on portions
+
+#define GETATTRIBS_STYLESHEET (sal_uInt8)0x01
+#define GETATTRIBS_PARAATTRIBS (sal_uInt8)0x02
+#define GETATTRIBS_CHARATTRIBS (sal_uInt8)0x04
+#define GETATTRIBS_ALL (sal_uInt8)0xFF
+
+class EDITENG_DLLPUBLIC EditEngine
+{
+ friend class EditView;
+ friend class ImpEditView;
+ friend class EditDbg;
+ friend class Outliner;
+
+public:
+ typedef std::vector<EditView*> ViewsType;
+
+private:
+ ImpEditEngine* pImpEditEngine;
+
+ EDITENG_DLLPRIVATE EditEngine( const EditEngine& );
+ EDITENG_DLLPRIVATE EditEngine& operator=( const EditEngine& );
+ EDITENG_DLLPRIVATE sal_uInt8 PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pView, Window* pFrameWin = NULL );
+
+ EDITENG_DLLPRIVATE void CursorMoved(ContentNode* pPrevNode);
+ EDITENG_DLLPRIVATE void CheckIdleFormatter();
+ EDITENG_DLLPRIVATE bool IsIdleFormatterActive() const;
+ EDITENG_DLLPRIVATE ParaPortion* FindParaPortion(ContentNode* pNode);
+ EDITENG_DLLPRIVATE const ParaPortion* FindParaPortion(ContentNode* pNode) const;
+ EDITENG_DLLPRIVATE const ParaPortion* GetPrevVisPortion(const ParaPortion* pCurPortion) const;
+
+ EDITENG_DLLPRIVATE com::sun::star::uno::Reference<
+ com::sun::star::datatransfer::XTransferable>
+ CreateTransferable(const EditSelection& rSelection);
+
+ EDITENG_DLLPRIVATE EditSelection InsertText(
+ com::sun::star::uno::Reference<com::sun::star::datatransfer::XTransferable >& rxDataObj,
+ const String& rBaseURL, const EditPaM& rPaM, bool bUseSpecial);
+
+ EDITENG_DLLPRIVATE EditPaM EndOfWord(
+ const EditPaM& rPaM, sal_Int16 nWordType = com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES);
+
+ EDITENG_DLLPRIVATE EditPaM GetPaM(const Point& aDocPos, bool bSmart = true);
+
+ EDITENG_DLLPRIVATE EditSelection SelectWord(
+ const EditSelection& rCurSelection,
+ sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES,
+ bool bAcceptStartOfWord = true);
+
+ EDITENG_DLLPRIVATE long GetXPos(
+ const ParaPortion* pParaPortion, const EditLine* pLine, sal_uInt16 nIndex, bool bPreferPortionStart = false) const;
+
+ EDITENG_DLLPRIVATE Range GetLineXPosStartEnd(
+ const ParaPortion* pParaPortion, const EditLine* pLine) const;
+
+ EDITENG_DLLPRIVATE sal_uInt16 GetOnePixelInRef() const;
+ EDITENG_DLLPRIVATE InternalEditStatus& GetInternalEditStatus();
+
+ EDITENG_DLLPRIVATE void HandleBeginPasteOrDrop(PasteOrDropInfos& rInfos);
+ EDITENG_DLLPRIVATE void HandleEndPasteOrDrop(PasteOrDropInfos& rInfos);
+ EDITENG_DLLPRIVATE bool HasText() const;
+ EDITENG_DLLPRIVATE const EditSelectionEngine& GetSelectionEngine() const;
+ EDITENG_DLLPRIVATE void SetInSelectionMode(bool b);
+
+protected:
+
+
+public:
+ EditEngine( SfxItemPool* pItemPool );
+ virtual ~EditEngine();
+
+ const SfxItemSet& GetEmptyItemSet();
+
+ void SetDefTab( sal_uInt16 nDefTab );
+
+ void SetRefDevice( OutputDevice* pRefDef );
+ OutputDevice* GetRefDevice() const;
+
+ void SetRefMapMode( const MapMode& rMapMode );
+ MapMode GetRefMapMode();
+
+ void SetUpdateMode( sal_Bool bUpdate );
+ sal_Bool GetUpdateMode() const;
+
+ void SetBackgroundColor( const Color& rColor );
+ Color GetBackgroundColor() const;
+ Color GetAutoColor() const;
+ void EnableAutoColor( sal_Bool b );
+ void ForceAutoColor( sal_Bool b );
+ sal_Bool IsForceAutoColor() const;
+
+ void InsertView(EditView* pEditView, size_t nIndex = EE_APPEND);
+ EditView* RemoveView( EditView* pEditView );
+ EditView* RemoveView(size_t nIndex = EE_APPEND);
+ EditView* GetView(size_t nIndex = 0) const;
+ size_t GetViewCount() const;
+ sal_Bool HasView( EditView* pView ) const;
+ EditView* GetActiveView() const;
+ void SetActiveView(EditView* pView);
+
+ void SetPaperSize( const Size& rSize );
+ const Size& GetPaperSize() const;
+
+ void SetVertical( bool bVertical );
+ bool IsVertical() const;
+
+ void SetFixedCellHeight( sal_Bool bUseFixedCellHeight );
+
+ void SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir );
+ EEHorizontalTextDirection GetDefaultHorizontalTextDirection() const;
+
+ sal_uInt16 GetScriptType( const ESelection& rSelection ) const;
+ LanguageType GetLanguage(const EditPaM& rPaM) const;
+ LanguageType GetLanguage( sal_uInt16 nPara, sal_uInt16 nPos ) const;
+
+ void TransliterateText( const ESelection& rSelection, sal_Int32 nTransliterationMode );
+ EditSelection TransliterateText( const EditSelection& rSelection, sal_Int32 nTransliterationMode );
+
+ void SetAsianCompressionMode( sal_uInt16 nCompression );
+
+ void SetKernAsianPunctuation( sal_Bool bEnabled );
+
+ void SetAddExtLeading( sal_Bool b );
+
+ void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon );
+ void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon);
+ void ClearPolygon();
+
+ const Size& GetMinAutoPaperSize() const;
+ void SetMinAutoPaperSize( const Size& rSz );
+
+ const Size& GetMaxAutoPaperSize() const;
+ void SetMaxAutoPaperSize( const Size& rSz );
+
+ OUString GetText( LineEnd eEnd = LINEEND_LF ) const;
+ String GetText( const ESelection& rSelection, const LineEnd eEnd = LINEEND_LF ) const;
+ sal_uInt32 GetTextLen() const;
+ sal_uInt32 GetTextHeight() const;
+ sal_uInt32 GetTextHeightNTP() const;
+ sal_uInt32 CalcTextWidth();
+
+ String GetText( sal_uInt16 nParagraph ) const;
+ xub_StrLen GetTextLen( sal_uInt16 nParagraph ) const;
+ sal_uInt32 GetTextHeight( sal_uInt16 nParagraph ) const;
+
+ sal_uInt16 GetParagraphCount() const;
+
+ sal_uInt16 GetLineCount( sal_uInt16 nParagraph ) const;
+ xub_StrLen GetLineLen( sal_uInt16 nParagraph, sal_uInt16 nLine ) const;
+ void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const;
+ sal_uInt16 GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const;
+ sal_uInt32 GetLineHeight( sal_uInt16 nParagraph, sal_uInt16 nLine = 0 );
+ ParagraphInfos GetParagraphInfos( sal_uInt16 nPara );
+ sal_uInt16 FindParagraph( long nDocPosY );
+ EPosition FindDocPosition( const Point& rDocPos ) const;
+ Rectangle GetCharacterBounds( const EPosition& rPos ) const;
+
+ String GetWord( sal_uInt16 nPara, xub_StrLen nIndex );
+
+ ESelection GetWord( const ESelection& rSelection, sal_uInt16 nWordType ) const;
+
+ void Clear();
+ void SetText( const OUString& rStr );
+
+ EditTextObject* CreateTextObject();
+ EditTextObject* CreateTextObject( sal_uInt16 nPara, sal_uInt16 nParas = 1 );
+ EditTextObject* CreateTextObject( const ESelection& rESelection );
+ void SetText( const EditTextObject& rTextObject );
+
+ void RemoveParagraph( sal_uInt16 nPara );
+ void InsertParagraph( sal_uInt16 nPara, const EditTextObject& rTxtObj );
+ void InsertParagraph( sal_uInt16 nPara, const String& rText);
+
+ void SetText( sal_uInt16 nPara, const String& rText);
+
+ virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet );
+ virtual const SfxItemSet& GetParaAttribs( sal_uInt16 nPara ) const;
+
+ void GetCharAttribs( sal_uInt16 nPara, std::vector<EECharAttrib>& rLst ) const;
+
+ SfxItemSet GetAttribs( sal_uInt16 nPara, sal_uInt16 nStart, sal_uInt16 nEnd, sal_uInt8 nFlags = 0xFF ) const;
+ SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = EditEngineAttribs_All );
+
+ sal_Bool HasParaAttrib( sal_uInt16 nPara, sal_uInt16 nWhich ) const;
+ const SfxPoolItem& GetParaAttrib( sal_uInt16 nPara, sal_uInt16 nWhich );
+
+ Font GetStandardFont( sal_uInt16 nPara );
+ SvxFont GetStandardSvxFont( sal_uInt16 nPara );
+
+ void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich );
+
+ void ShowParagraph( sal_uInt16 nParagraph, sal_Bool bShow = sal_True );
+
+ ::svl::IUndoManager&
+ GetUndoManager();
+ void UndoActionStart( sal_uInt16 nId );
+ void UndoActionStart(sal_uInt16 nId, const ESelection& rSel);
+ void UndoActionEnd( sal_uInt16 nId );
+ sal_Bool IsInUndo();
+
+ void EnableUndo( sal_Bool bEnable );
+ sal_Bool IsUndoEnabled();
+
+ /** returns the value last used for bTryMerge while calling ImpEditEngine::InsertUndo
+ This is currently used in a bad but needed hack to get undo actions merged in the
+ OutlineView in impress. Do not use it unless you want to sell your soul too! */
+ bool HasTriedMergeOnLastAddUndo() const;
+
+ void ClearModifyFlag();
+ void SetModified();
+ sal_Bool IsModified() const;
+
+ void SetModifyHdl( const Link& rLink );
+ Link GetModifyHdl() const;
+
+ sal_Bool IsInSelectionMode() const;
+
+ void StripPortions();
+ void GetPortions( sal_uInt16 nPara, std::vector<sal_uInt16>& rList );
+
+ long GetFirstLineStartX( sal_uInt16 nParagraph );
+ Point GetDocPosTopLeft( sal_uInt16 nParagraph );
+ Point GetDocPos( const Point& rPaperPos ) const;
+ sal_Bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder = 0 );
+
+ // StartDocPos corrresponds to VisArea.TopLeft().
+ void Draw( OutputDevice* pOutDev, const Rectangle& rOutRect );
+ void Draw( OutputDevice* pOutDev, const Rectangle& rOutRect, const Point& rStartDocPos );
+ void Draw( OutputDevice* pOutDev, const Rectangle& rOutRect, const Point& rStartDocPos, sal_Bool bClip );
+ void Draw( OutputDevice* pOutDev, const Point& rStartPos, short nOrientation = 0 );
+
+// sal_uInt32: Error code of the stream.
+ sal_uLong Read( SvStream& rInput, const String& rBaseURL, EETextFormat, SvKeyValueIterator* pHTTPHeaderAttrs = NULL );
+ sal_uLong Write( SvStream& rOutput, EETextFormat );
+
+ void SetStatusEventHdl( const Link& rLink );
+ Link GetStatusEventHdl() const;
+
+ void SetNotifyHdl( const Link& rLink );
+ Link GetNotifyHdl() const;
+
+ void SetImportHdl( const Link& rLink );
+ Link GetImportHdl() const;
+
+ // Do not evaluate font formatting => For Outliner
+ sal_Bool IsFlatMode() const;
+ void SetFlatMode( sal_Bool bFlat );
+
+ void SetControlWord( sal_uInt32 nWord );
+ sal_uInt32 GetControlWord() const;
+
+ void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel );
+ void QuickRemoveCharAttribs( sal_uInt16 nPara, sal_uInt16 nWhich = 0 );
+ void QuickMarkInvalid( const ESelection& rSel );
+ void QuickFormatDoc( sal_Bool bFull = sal_False );
+ void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel );
+ void QuickInsertLineBreak( const ESelection& rSel );
+ void QuickInsertText( const String& rText, const ESelection& rSel );
+ void QuickDelete( const ESelection& rSel );
+ void QuickMarkToBeRepainted( sal_uInt16 nPara );
+
+ void SetGlobalCharStretching( sal_uInt16 nX = 100, sal_uInt16 nY = 100 );
+ void GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY ) const;
+
+ void SetEditTextObjectPool( SfxItemPool* pPool );
+ SfxItemPool* GetEditTextObjectPool() const;
+
+ void SetStyleSheetPool( SfxStyleSheetPool* pSPool );
+ SfxStyleSheetPool* GetStyleSheetPool();
+
+ void SetStyleSheet(const EditSelection& aSel, SfxStyleSheet* pStyle);
+ void SetStyleSheet( sal_uInt16 nPara, SfxStyleSheet* pStyle );
+ const SfxStyleSheet* GetStyleSheet( sal_uInt16 nPara ) const;
+ SfxStyleSheet* GetStyleSheet( sal_uInt16 nPara );
+
+ void SetWordDelimiters( const String& rDelimiters );
+ String GetWordDelimiters() const;
+
+ void EraseVirtualDevice();
+
+ void SetSpeller( ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 > &xSpeller );
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 >
+ GetSpeller();
+ void SetHyphenator( ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenator >& xHyph );
+
+ void SetForbiddenCharsTable( rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars );
+
+ void SetDefaultLanguage( LanguageType eLang );
+ LanguageType GetDefaultLanguage() const;
+
+ sal_Bool HasOnlineSpellErrors() const;
+ void CompleteOnlineSpelling();
+
+ sal_Bool ShouldCreateBigTextObject() const;
+
+ // For fast Pre-Test without view:
+ EESpellState HasSpellErrors();
+ sal_Bool HasText( const SvxSearchItem& rSearchItem );
+
+ //initialize sentence spelling
+ void StartSpelling(EditView& rEditView, sal_Bool bMultipleDoc);
+ //spell and return a sentence
+ bool SpellSentence(EditView& rEditView, ::svx::SpellPortions& rToFill, bool bIsGrammarChecking );
+ // put spell position to start of current sentence
+ void PutSpellingToSentenceStart( EditView& rEditView );
+ //applies a changed sentence
+ void ApplyChangedSentence(EditView& rEditView, const ::svx::SpellPortions& rNewPortions, bool bRecheck );
+
+ // for text conversion (see also HasSpellErrors)
+ sal_Bool HasConvertibleTextPortion( LanguageType nLang );
+ virtual sal_Bool ConvertNextDocument();
+
+ bool UpdateFields();
+ bool UpdateFieldsOnly();
+ void RemoveFields( sal_Bool bKeepFieldText, TypeId aType = NULL );
+
+ sal_uInt16 GetFieldCount( sal_uInt16 nPara ) const;
+ EFieldInfo GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const;
+
+ sal_Bool IsRightToLeft( sal_uInt16 nPara ) const;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >
+ CreateTransferable( const ESelection& rSelection ) const;
+
+ // MT: Can't create new virtual functions like for ParagraphInserted/Deleted, musst be compatible in SRC638, change later...
+ void SetBeginMovingParagraphsHdl( const Link& rLink );
+ void SetEndMovingParagraphsHdl( const Link& rLink );
+ void SetBeginPasteOrDropHdl( const Link& rLink );
+ void SetEndPasteOrDropHdl( const Link& rLink );
+
+ virtual void PaintingFirstLine( sal_uInt16 nPara, const Point& rStartPos, long nBaseLineY, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev );
+ virtual void ParagraphInserted( sal_uInt16 nNewParagraph );
+ virtual void ParagraphDeleted( sal_uInt16 nDeletedParagraph );
+ virtual void ParagraphConnected( sal_uInt16 nLeftParagraph, sal_uInt16 nRightParagraph );
+ virtual void ParaAttribsChanged( sal_uInt16 nParagraph );
+ virtual void StyleSheetChanged( SfxStyleSheet* pStyle );
+ virtual void ParagraphHeightChanged( sal_uInt16 nPara );
+
+ virtual void DrawingText(
+ const Point& rStartPos, const String& rText, sal_uInt16 nTextStart, sal_uInt16 nTextLen, const sal_Int32* pDXArray,
+ const SvxFont& rFont, sal_uInt16 nPara, xub_StrLen nIndex, sal_uInt8 nRightToLeft,
+ const EEngineData::WrongSpellVector* pWrongSpellVector,
+ const SvxFieldData* pFieldData,
+ bool bEndOfLine,
+ bool bEndOfParagraph,
+ bool bEndOfBullet,
+ const ::com::sun::star::lang::Locale* pLocale,
+ const Color& rOverlineColor,
+ const Color& rTextLineColor);
+
+ virtual void DrawingTab(
+ const Point& rStartPos, long nWidth, const String& rChar,
+ const SvxFont& rFont, sal_uInt16 nPara, xub_StrLen nIndex, sal_uInt8 nRightToLeft,
+ bool bEndOfLine,
+ bool bEndOfParagraph,
+ const Color& rOverlineColor,
+ const Color& rTextLineColor);
+ virtual String GetUndoComment( sal_uInt16 nUndoId ) const;
+ virtual sal_Bool FormattingParagraph( sal_uInt16 nPara );
+ virtual sal_Bool SpellNextDocument();
+ virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos );
+ virtual void FieldSelected( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos );
+ virtual String CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos, Color*& rTxtColor, Color*& rFldColor );
+
+ // to be overloaded if access to bullet information needs to be provided
+ virtual const SvxNumberFormat * GetNumberFormat( sal_uInt16 nPara ) const;
+
+ virtual Rectangle GetBulletArea( sal_uInt16 nPara );
+
+ static SfxItemPool* CreatePool( sal_Bool bLoadRefCounts = sal_True );
+ static SfxItemPool& GetGlobalItemPool();
+ static sal_Bool DoesKeyChangeText( const KeyEvent& rKeyEvent );
+ static sal_Bool DoesKeyMoveCursor( const KeyEvent& rKeyEvent );
+ static sal_Bool IsSimpleCharInput( const KeyEvent& rKeyEvent );
+ static void SetFontInfoInItemSet( SfxItemSet& rItemSet, const Font& rFont );
+ static void SetFontInfoInItemSet( SfxItemSet& rItemSet, const SvxFont& rFont );
+ static Font CreateFontFromItemSet( const SfxItemSet& rItemSet, sal_uInt16 nScriptType );
+ static SvxFont CreateSvxFontFromItemSet( const SfxItemSet& rItemSet );
+ static sal_Bool IsPrintable( sal_Unicode c ) { return ( ( c >= 32 ) && ( c != 127 ) ); }
+ static sal_Bool HasValidData( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& rTransferable );
+
+ /** sets a link that is called at the beginning of a drag operation at an edit view */
+ void SetBeginDropHdl( const Link& rLink );
+ Link GetBeginDropHdl() const;
+
+ /** sets a link that is called at the end of a drag operation at an edit view */
+ void SetEndDropHdl( const Link& rLink );
+ Link GetEndDropHdl() const;
+
+ /// specifies if auto-correction should capitalize the first word or not (default is on)
+ void SetFirstWordCapitalization( sal_Bool bCapitalize );
+
+ EditDoc& GetEditDoc();
+ const EditDoc& GetEditDoc() const;
+
+ ParaPortionList& GetParaPortions();
+ const ParaPortionList& GetParaPortions() const;
+
+ bool IsFormatted() const;
+ bool IsImportHandlerSet() const;
+ bool IsImportRTFStyleSheetsSet() const;
+
+ void CallImportHandler(ImportInfo& rInfo);
+
+ void ParaAttribsToCharAttribs(ContentNode* pNode);
+
+ EditPaM CreateEditPaM(const EPaM& rEPaM);
+ EditPaM ConnectParagraphs(
+ ContentNode* pLeft, ContentNode* pRight, bool bBackward = false);
+
+ EditPaM InsertField(const EditSelection& rEditSelection, const SvxFieldItem& rFld);
+ EditPaM InsertText(const EditSelection& aCurEditSelection, const String& rStr);
+ EditSelection InsertText(const EditTextObject& rTextObject, const EditSelection& rSel);
+ EditPaM InsertParaBreak(
+ const EditSelection& rEditSelection, bool bKeepEndingAttribs = true);
+ EditPaM InsertLineBreak(const EditSelection& rEditSelection);
+
+ EditPaM CursorLeft(
+ const EditPaM& rPaM, sal_uInt16 nCharacterIteratorMode = com::sun::star::i18n::CharacterIteratorMode::SKIPCELL);
+ EditPaM CursorRight(
+ const EditPaM& rPaM, sal_uInt16 nCharacterIteratorMode = com::sun::star::i18n::CharacterIteratorMode::SKIPCELL);
+
+ void SeekCursor(
+ ContentNode* pNode, sal_uInt16 nPos, SvxFont& rFont, OutputDevice* pOut = NULL, sal_uInt16 nIgnoreWhich = 0);
+
+ EditPaM DeleteSelection(const EditSelection& rSel);
+
+ ESelection CreateESelection(const EditSelection& rSel);
+ EditSelection CreateSelection(const ESelection& rSel);
+
+ const SfxItemSet& GetBaseParaAttribs(sal_uInt16 nPara) const;
+ void SetParaAttribsOnly(sal_uInt16 nPara, const SfxItemSet& rSet);
+ void SetAttribs(const EditSelection& rSel, const SfxItemSet& rSet, sal_uInt8 nSpecial = 0);
+
+ String GetSelected(const EditSelection& rSel, const LineEnd eParaSep = LINEEND_LF) const;
+ EditPaM DeleteSelected(const EditSelection& rSel);
+
+ sal_uInt16 GetScriptType(const EditSelection& rSel) const;
+
+ void RemoveParaPortion(size_t nNode);
+
+ void SetCallParaInsertedOrDeleted(bool b);
+ bool IsCallParaInsertedOrDeleted() const;
+
+ void AppendDeletedNodeInfo(DeletedNodeInfo* pInfo);
+ void UpdateSelections();
+
+ void InsertContent(ContentNode* pNode, sal_uInt16 nPos);
+ EditPaM SplitContent(sal_uInt16 nNode, sal_uInt16 nSepPos);
+ EditPaM ConnectContents(sal_uInt16 nLeftNode, bool bBackward);
+
+ EditPaM InsertFeature(const EditSelection& rEditSelection, const SfxPoolItem& rItem);
+
+ EditSelection MoveParagraphs(const Range& rParagraphs, sal_uInt16 nNewPos, EditView* pCurView);
+
+ void RemoveCharAttribs(sal_uInt16 nPara, sal_uInt16 nWhich = 0, bool bRemoveFeatures = false);
+ void RemoveCharAttribs(const EditSelection& rSel, bool bRemoveParaAttribs, sal_uInt16 nWhich = 0);
+
+ ViewsType& GetEditViews();
+ const ViewsType& GetEditViews() const;
+
+ void SetUndoMode(bool b);
+ void FormatAndUpdate(EditView* pCurView = NULL);
+
+ bool Undo(EditView* pView);
+ bool Redo(EditView* pView);
+};
+
+#endif // _MyEDITENG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/editengdllapi.h b/include/editeng/editengdllapi.h
new file mode 100644
index 000000000000..ce764e81fece
--- /dev/null
+++ b/include/editeng/editengdllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENGDLLAPI_H
+#define INCLUDED_EDITENGDLLAPI_H
+
+#include "sal/types.h"
+
+#if defined(EDITENG_DLLIMPLEMENTATION)
+#define EDITENG_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define EDITENG_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define EDITENG_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/editerr.hxx b/include/editeng/editerr.hxx
new file mode 100644
index 000000000000..d262057763e7
--- /dev/null
+++ b/include/editeng/editerr.hxx
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _EDIT_ERR_HRC
+#define _EDIT_ERR_HRC
+
+#include <tools/errcode.hxx>
+
+#define ERRCODE_SVX_LINGU_LANGUAGENOTEXISTS (2UL | ERRCODE_AREA_SVX)
+
+#define ERRCODE_SVX_GRAPHIC_WRONG_FILEFORMAT (8UL | ERRCODE_AREA_SVX | \
+ ERRCODE_CLASS_READ )
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/editids.hrc b/include/editeng/editids.hrc
new file mode 100644
index 000000000000..7dbaae890a51
--- /dev/null
+++ b/include/editeng/editids.hrc
@@ -0,0 +1,236 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _EDIT_SVXIDS_HRC
+#define _EDIT_SVXIDS_HRC
+
+#include <svl/solar.hrc>
+
+#define SID_ATTR_BRUSH ( SID_SVX_START + 1 )
+#define SID_ATTR_TABSTOP ( SID_SVX_START + 2 )
+#define SID_ATTR_TABSTOP_DEFAULTS ( SID_SVX_START + 3 )
+#define SID_ATTR_TABSTOP_POS ( SID_SVX_START + 4 )
+#define SID_ATTR_TABSTOP_OFFSET ( SID_SVX_START + 5 )
+#define SID_ATTR_CHAR ( SID_SVX_START + 6 )
+#define SID_ATTR_CHAR_FONT ( SID_SVX_START + 7 )
+#define SID_ATTR_CHAR_POSTURE ( SID_SVX_START + 8 )
+#define SID_ATTR_CHAR_WEIGHT ( SID_SVX_START + 9 )
+#define SID_ATTR_CHAR_SHADOWED ( SID_SVX_START + 10 )
+#define SID_ATTR_CHAR_WORDLINEMODE ( SID_SVX_START + 11 )
+#define SID_ATTR_CHAR_CONTOUR ( SID_SVX_START + 12 )
+#define SID_ATTR_CHAR_STRIKEOUT ( SID_SVX_START + 13 )
+#define SID_ATTR_CHAR_UNDERLINE ( SID_SVX_START + 14 )
+#define SID_ATTR_CHAR_FONTHEIGHT ( SID_SVX_START + 15 )
+#define SID_ATTR_CHAR_PROPSIZE ( SID_SVX_START + 16 )
+#define SID_ATTR_CHAR_COLOR ( SID_SVX_START + 17 )
+#define SID_ATTR_CHAR_KERNING ( SID_SVX_START + 18 )
+#define SID_ATTR_CHAR_CASEMAP ( SID_SVX_START + 19 )
+#define SID_ATTR_CHAR_LANGUAGE ( SID_SVX_START + 20 )
+#define SID_ATTR_CHAR_ESCAPEMENT ( SID_SVX_START + 21 )
+#define SID_ATTR_CHAR_FONTLIST ( SID_SVX_START + 22 )
+#define SID_ATTR_BORDER_OUTER ( SID_SVX_START + 24 )
+#define SID_ATTR_BORDER_SHADOW ( SID_SVX_START + 25 )
+#define SID_ATTR_PARA ( SID_SVX_START + 26 )
+#define SID_ATTR_PARA_ADJUST ( SID_SVX_START + 27 )
+#define SID_ATTR_PARA_ADJUST_LEFT ( SID_SVX_START + 28 )
+#define SID_ATTR_PARA_ADJUST_RIGHT ( SID_SVX_START + 29 )
+#define SID_ATTR_PARA_ADJUST_CENTER ( SID_SVX_START + 30 )
+#define SID_ATTR_PARA_ADJUST_BLOCK ( SID_SVX_START + 31 )
+#define SID_ATTR_PARA_ADJUST_BLOCKLINE ( SID_SVX_START + 32 )
+#define SID_ATTR_PARA_LINESPACE ( SID_SVX_START + 33 )
+#define SID_ATTR_PARA_LINESPACE_10 ( SID_SVX_START + 34 )
+#define SID_ATTR_PARA_LINESPACE_15 ( SID_SVX_START + 35 )
+#define SID_ATTR_PARA_LINESPACE_20 ( SID_SVX_START + 36 )
+#define SID_ATTR_PARA_PAGEBREAK ( SID_SVX_START + 37 )
+#define SID_ATTR_PARA_HYPHENZONE ( SID_SVX_START + 38 )
+#define SID_ATTR_PARA_SPLIT ( SID_SVX_START + 39 )
+#define SID_ATTR_PARA_ORPHANS ( SID_SVX_START + 40 )
+#define SID_ATTR_PARA_WIDOWS ( SID_SVX_START + 41 )
+#define SID_ATTR_PARA_ULSPACE ( SID_SVX_START + 42 )
+#define SID_ATTR_PARA_LRSPACE ( SID_SVX_START + 43 )
+#define SID_ATTR_LRSPACE ( SID_SVX_START + 48 )
+#define SID_ATTR_ULSPACE ( SID_SVX_START + 49 )
+#define SID_ATTR_CHAR_MAPTYPE ( SID_SVX_START + 64 )
+#define SID_ATTR_PARA_MODEL ( SID_SVX_START + 65 )
+#define SID_ATTR_PARA_KEEP ( SID_SVX_START + 66 )
+#define SID_ATTR_CHAR_AUTOKERN ( SID_SVX_START + 67 )
+#define SID_ATTR_PARA_BULLET ( SID_SVX_START + 250 )
+#define SID_ATTR_PARA_OUTLLEVEL ( SID_SVX_START + 300 )
+#define SID_FIELD ( SID_SVX_START + 363 )
+#define SID_ATTR_PARA_REGISTER ( SID_SVX_START + 413 )
+#define SID_ATTR_PARA_PAGENUM ( SID_SVX_START + 457 )
+#define SID_ATTR_PARA_NUMRULE ( SID_SVX_START + 587 )
+#define SID_ATTR_BRUSH_CHAR ( SID_SVX_START + 591 )
+#define SID_ATTR_NUMBERING_RULE ( SID_SVX_START + 855 )
+#define SID_ATTR_CHAR_CHARSETCOLOR ( SID_SVX_START + 877 )
+#define SID_ATTR_CHAR_CJK_FONT ( SID_SVX_START + 887 )
+#define SID_ATTR_CHAR_CJK_FONTHEIGHT ( SID_SVX_START + 888 )
+#define SID_ATTR_CHAR_CJK_LANGUAGE ( SID_SVX_START + 889 )
+#define SID_ATTR_CHAR_CJK_POSTURE ( SID_SVX_START + 890 )
+#define SID_ATTR_CHAR_CJK_WEIGHT ( SID_SVX_START + 891 )
+#define SID_ATTR_CHAR_CTL_FONT ( SID_SVX_START + 892 )
+#define SID_ATTR_CHAR_CTL_FONTHEIGHT ( SID_SVX_START + 893 )
+#define SID_ATTR_CHAR_CTL_LANGUAGE ( SID_SVX_START + 894 )
+#define SID_ATTR_CHAR_CTL_POSTURE ( SID_SVX_START + 895 )
+#define SID_ATTR_CHAR_CTL_WEIGHT ( SID_SVX_START + 896 )
+#define SID_ATTR_CHAR_TWO_LINES ( SID_SVX_START + 897 )
+#define SID_ATTR_CHAR_CJK_RUBY ( SID_SVX_START + 898 )
+#define SID_ATTR_CHAR_EMPHASISMARK ( SID_SVX_START + 899 )
+#define SID_ATTR_CHAR_SCRIPTTYPE ( SID_SVX_START + 900 )
+#define SID_ATTR_PARA_SCRIPTSPACE ( SID_SVX_START + 901 )
+#define SID_ATTR_PARA_HANGPUNCTUATION ( SID_SVX_START + 902 )
+#define SID_ATTR_PARA_FORBIDDEN_RULES ( SID_SVX_START + 903 )
+#define SID_ATTR_CHAR_VERTICAL ( SID_SVX_START + 905 )
+#define SID_ATTR_CHAR_ROTATED ( SID_SVX_START + 910 )
+#define SID_ATTR_CHAR_SCALEWIDTH ( SID_SVX_START + 911 )
+#define SID_ATTR_CHAR_WIDTH_FIT_TO_LINE ( SID_SVX_START + 919 )
+#define SID_ATTR_CHAR_RELIEF ( SID_SVX_START + 920 )
+#define SID_PARA_VERTALIGN ( SID_SVX_START + 925 )
+#define SID_ATTR_FRAMEDIRECTION ( SID_SVX_START + 944 )
+#define SID_ATTR_PARA_SNAPTOGRID ( SID_SVX_START + 945 )
+#define SID_ATTR_PARA_LRSPACE_VERTICAL ( SID_SVX_START + 947 )
+#define SID_ATTR_PARA_LEFT_TO_RIGHT ( SID_SVX_START + 950 )
+#define SID_ATTR_PARA_RIGHT_TO_LEFT ( SID_SVX_START + 951 )
+#define SID_ATTR_CHAR_HIDDEN ( SID_SVX_START + 989 )
+#define SID_ATTR_CHAR_LATIN_FONT ( SID_SVX_START + 994 )
+#define SID_ATTR_CHAR_LATIN_FONTHEIGHT ( SID_SVX_START + 995 )
+#define SID_ATTR_CHAR_LATIN_LANGUAGE ( SID_SVX_START + 996 )
+#define SID_ATTR_CHAR_LATIN_POSTURE ( SID_SVX_START + 997 )
+#define SID_ATTR_CHAR_LATIN_WEIGHT ( SID_SVX_START + 998 )
+#define SID_ATTR_PARA_OUTLINE_LEVEL ( SID_SVX_START + 1121 )
+#define SID_ATTR_CHAR_PREVIEW_FONT ( SID_SVX_START + 1122 )
+#define SID_ATTR_CHAR_ENDPREVIEW_FONT ( SID_SVX_START + 1123 )
+
+
+// this ID didn't exist prior to the svx split
+#define SID_ATTR_CHAR_OVERLINE ( SID_EDIT_START + 68 )
+#define SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD ( SID_EDIT_START + 69 )
+#define SID_ATTR_ALIGN_VER_JUSTIFY_METHOD ( SID_EDIT_START + 70 )
+#define SID_ATTR_ALIGN_HOR_JUSTIFY ( SID_EDIT_START + 71 )
+#define SID_ATTR_ALIGN_VER_JUSTIFY ( SID_EDIT_START + 72 )
+
+/*
+// planned, but not doable: changing value of SIDs will break code that uses them for WhichRanges
+#define SID_PARA_VERTALIGN ( SID_EDIT_START )
+#define SID_ATTR_BORDER_OUTER ( SID_EDIT_START + 1 )
+#define SID_ATTR_BORDER_SHADOW ( SID_EDIT_START + 2 )
+#define SID_ATTR_BRUSH ( SID_EDIT_START + 3 )
+#define SID_ATTR_BRUSH_CHAR ( SID_EDIT_START + 4 )
+
+
+#define SID_FIELD ( SID_EDIT_START + 7 )
+#define SID_ATTR_FRAMEDIRECTION ( SID_EDIT_START + 8 )
+#define SID_ATTR_PARA ( SID_EDIT_START + 9 )
+#define SID_ATTR_PARA_ADJUST ( SID_EDIT_START + 10 )
+#define SID_ATTR_PARA_ADJUST_LEFT ( SID_EDIT_START + 11 )
+#define SID_ATTR_PARA_BULLET ( SID_EDIT_START + 12 )
+#define SID_ATTR_PARA_OUTLLEVEL ( SID_EDIT_START + 13 )
+#define SID_ATTR_PARA_REGISTER ( SID_EDIT_START + 14 )
+#define SID_ATTR_PARA_PAGENUM ( SID_EDIT_START + 15 )
+#define SID_ATTR_PARA_NUMRULE ( SID_EDIT_START + 16 )
+#define SID_ATTR_PARA_SCRIPTSPACE ( SID_EDIT_START + 17 )
+#define SID_ATTR_PARA_HANGPUNCTUATION ( SID_EDIT_START + 18 )
+#define SID_ATTR_PARA_FORBIDDEN_RULES ( SID_EDIT_START + 19 )
+#define SID_ATTR_PARA_SNAPTOGRID ( SID_EDIT_START + 20 )
+#define SID_ATTR_PARA_LRSPACE_VERTICAL ( SID_EDIT_START + 21 )
+#define SID_ATTR_PARA_LEFT_TO_RIGHT ( SID_EDIT_START + 22 )
+#define SID_ATTR_PARA_RIGHT_TO_LEFT ( SID_EDIT_START + 23 )
+#define SID_ATTR_PARA_OUTLINE_LEVEL ( SID_EDIT_START + 24 )
+#define SID_ATTR_PARA_ADJUST_RIGHT ( SID_EDIT_START + 25 )
+#define SID_ATTR_PARA_ADJUST_CENTER ( SID_EDIT_START + 26 )
+#define SID_ATTR_PARA_ADJUST_BLOCK ( SID_EDIT_START + 27 )
+#define SID_ATTR_PARA_ADJUST_BLOCKLINE ( SID_EDIT_START + 28 )
+#define SID_ATTR_PARA_LINESPACE ( SID_EDIT_START + 29 )
+#define SID_ATTR_PARA_LINESPACE_10 ( SID_EDIT_START + 30 )
+#define SID_ATTR_PARA_LINESPACE_15 ( SID_EDIT_START + 31 )
+#define SID_ATTR_PARA_LINESPACE_20 ( SID_EDIT_START + 32 )
+#define SID_ATTR_PARA_PAGEBREAK ( SID_EDIT_START + 33 )
+#define SID_ATTR_PARA_HYPHENZONE ( SID_EDIT_START + 34 )
+#define SID_ATTR_PARA_SPLIT ( SID_EDIT_START + 35 )
+#define SID_ATTR_PARA_ORPHANS ( SID_EDIT_START + 36 )
+#define SID_ATTR_PARA_WIDOWS ( SID_EDIT_START + 37 )
+#define SID_ATTR_PARA_ULSPACE ( SID_EDIT_START + 38 )
+#define SID_ATTR_PARA_LRSPACE ( SID_EDIT_START + 39 )
+#define SID_ATTR_PARA_MODEL ( SID_EDIT_START + 40 )
+#define SID_ATTR_PARA_KEEP ( SID_EDIT_START + 41 )
+#define SID_ATTR_NUMBERING_RULE ( SID_EDIT_START + 42 )
+#define SID_ATTR_LRSPACE ( SID_EDIT_START + 43 )
+#define SID_ATTR_ULSPACE ( SID_EDIT_START + 44 )
+#define SID_ATTR_TABSTOP ( SID_EDIT_START + 45 )
+#define SID_ATTR_TABSTOP_DEFAULTS ( SID_EDIT_START + 46 )
+#define SID_ATTR_TABSTOP_POS ( SID_EDIT_START + 47 )
+#define SID_ATTR_TABSTOP_OFFSET ( SID_EDIT_START + 48 )
+#define SID_ATTR_CHAR ( SID_EDIT_START + 49 )
+#define SID_ATTR_CHAR_FONT ( SID_EDIT_START + 50 )
+#define SID_ATTR_CHAR_POSTURE ( SID_EDIT_START + 51 )
+#define SID_ATTR_CHAR_WEIGHT ( SID_EDIT_START + 52 )
+#define SID_ATTR_CHAR_SHADOWED ( SID_EDIT_START + 53 )
+#define SID_ATTR_CHAR_WORDLINEMODE ( SID_EDIT_START + 54 )
+#define SID_ATTR_CHAR_CONTOUR ( SID_EDIT_START + 55 )
+#define SID_ATTR_CHAR_STRIKEOUT ( SID_EDIT_START + 56 )
+#define SID_ATTR_CHAR_UNDERLINE ( SID_EDIT_START + 57 )
+#define SID_ATTR_CHAR_FONTHEIGHT ( SID_EDIT_START + 58 )
+#define SID_ATTR_CHAR_PROPSIZE ( SID_EDIT_START + 59 )
+#define SID_ATTR_CHAR_COLOR ( SID_EDIT_START + 60 )
+#define SID_ATTR_CHAR_KERNING ( SID_EDIT_START + 61 )
+#define SID_ATTR_CHAR_CASEMAP ( SID_EDIT_START + 62 )
+#define SID_ATTR_CHAR_LANGUAGE ( SID_EDIT_START + 63 )
+#define SID_ATTR_CHAR_ESCAPEMENT ( SID_EDIT_START + 64 )
+#define SID_ATTR_CHAR_FONTLIST ( SID_EDIT_START + 65 )
+#define SID_ATTR_CHAR_MAPTYPE ( SID_EDIT_START + 66 )
+#define SID_ATTR_CHAR_AUTOKERN ( SID_EDIT_START + 67 )
+#define SID_ATTR_CHAR_OVERLINE ( SID_EDIT_START + 68 )
+#define SID_ATTR_CHAR_CHARSETCOLOR ( SID_EDIT_START + 69 )
+#define SID_ATTR_CHAR_CJK_FONT ( SID_EDIT_START + 70 )
+#define SID_ATTR_CHAR_CJK_FONTHEIGHT ( SID_EDIT_START + 71 )
+#define SID_ATTR_CHAR_CJK_LANGUAGE ( SID_EDIT_START + 72 )
+#define SID_ATTR_CHAR_CJK_POSTURE ( SID_EDIT_START + 73 )
+#define SID_ATTR_CHAR_CJK_WEIGHT ( SID_EDIT_START + 74 )
+#define SID_ATTR_CHAR_CTL_FONT ( SID_EDIT_START + 75 )
+#define SID_ATTR_CHAR_CTL_FONTHEIGHT ( SID_EDIT_START + 76 )
+#define SID_ATTR_CHAR_CTL_LANGUAGE ( SID_EDIT_START + 77 )
+#define SID_ATTR_CHAR_CTL_POSTURE ( SID_EDIT_START + 78 )
+#define SID_ATTR_CHAR_CTL_WEIGHT ( SID_EDIT_START + 79 )
+#define SID_ATTR_CHAR_TWO_LINES ( SID_EDIT_START + 80 )
+#define SID_ATTR_CHAR_CJK_RUBY ( SID_EDIT_START + 81 )
+#define SID_ATTR_CHAR_EMPHASISMARK ( SID_EDIT_START + 82 )
+#define SID_ATTR_CHAR_SCRIPTTYPE ( SID_EDIT_START + 83 )
+#define SID_ATTR_CHAR_VERTICAL ( SID_EDIT_START + 84 )
+#define SID_ATTR_CHAR_ROTATED ( SID_EDIT_START + 85 )
+#define SID_ATTR_CHAR_SCALEWIDTH ( SID_EDIT_START + 86 )
+#define SID_ATTR_CHAR_WIDTH_FIT_TO_LINE ( SID_EDIT_START + 87 )
+#define SID_ATTR_CHAR_RELIEF ( SID_EDIT_START + 88 )
+#define SID_ATTR_CHAR_HIDDEN ( SID_EDIT_START + 89 )
+#define SID_ATTR_CHAR_LATIN_FONT ( SID_EDIT_START + 90 )
+#define SID_ATTR_CHAR_LATIN_FONTHEIGHT ( SID_EDIT_START + 91 )
+#define SID_ATTR_CHAR_LATIN_LANGUAGE ( SID_EDIT_START + 92 )
+#define SID_ATTR_CHAR_LATIN_POSTURE ( SID_EDIT_START + 93 )
+#define SID_ATTR_CHAR_LATIN_WEIGHT ( SID_EDIT_START + 94 )
+*/
+
+#if 94 > (SID_EDIT_END-SID_EDIT_START)
+#error Resource-Ueberlauf in #line, #file
+#endif
+
+#define SID_DRAW_TEXT_VERTICAL SID_ATTR_CHAR_VERTICAL
+
+#endif
+
+// ******************************************************************* EOF
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/editobj.hxx b/include/editeng/editobj.hxx
new file mode 100644
index 000000000000..16bc0be626e5
--- /dev/null
+++ b/include/editeng/editobj.hxx
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _EDITOBJ_HXX
+#define _EDITOBJ_HXX
+
+#include <tools/stream.hxx>
+#include <tools/debug.hxx>
+#include <rsc/rscsfx.hxx>
+#include <svl/itemset.hxx>
+#include "svl/itempool.hxx"
+#include <editeng/eeitem.hxx>
+#include <editeng/editdata.hxx>
+#include "editeng/editengdllapi.h"
+#include "editeng/macros.hxx"
+
+#include <com/sun/star/text/textfield/Type.hpp>
+
+#include <vector>
+
+DBG_NAMEEX( EE_EditTextObject )
+
+class SfxItemPool;
+class SfxStyleSheetPool;
+class SvxFieldItem;
+class SvxFieldData;
+
+namespace editeng {
+
+class FieldUpdater;
+class FieldUpdaterImpl;
+
+}
+
+class EditTextObjectImpl;
+
+class EDITENG_DLLPUBLIC EditTextObject : public SfxItemPoolUser
+{
+ friend class EditTextObjectImpl;
+ friend class editeng::FieldUpdaterImpl;
+ friend class ImpEditEngine;
+
+ EditTextObjectImpl* mpImpl;
+
+ EDITENG_DLLPRIVATE EditTextObject& operator=( const EditTextObject& );
+
+ EditTextObject(); // disabled
+
+ EditTextObject( SfxItemPool* pPool );
+
+ void StoreData( SvStream& rStrm ) const;
+ void CreateData( SvStream& rStrm );
+
+public:
+ EditTextObject( const EditTextObject& r );
+ virtual ~EditTextObject();
+
+ sal_uInt16 GetUserType() const; // For OutlinerMode, it can however not save in compatible format
+ void SetUserType( sal_uInt16 n );
+
+ bool IsVertical() const;
+ void SetVertical( bool bVertical );
+
+ sal_uInt16 GetScriptType() const;
+
+ EditTextObject* Clone() const;
+
+ bool Store( SvStream& rOStream ) const;
+
+ static EditTextObject* Create(
+ SvStream& rIStream, SfxItemPool* pGlobalTextObjectPool = NULL );
+
+ size_t GetParagraphCount() const;
+
+ String GetText(size_t nPara) const;
+
+ void ClearPortionInfo();
+
+ bool HasOnlineSpellErrors() const;
+
+ void GetCharAttribs( sal_uInt16 nPara, std::vector<EECharAttrib>& rLst ) const;
+
+ bool RemoveCharAttribs( sal_uInt16 nWhich = 0 );
+
+ bool IsFieldObject() const;
+ const SvxFieldItem* GetField() const;
+ const SvxFieldData* GetFieldData(size_t nPara, size_t nPos, sal_Int32 nType) const;
+ bool HasField( sal_Int32 nType = com::sun::star::text::textfield::Type::UNSPECIFIED ) const;
+
+ const SfxItemSet& GetParaAttribs(size_t nPara) const;
+
+ void GetStyleSheet(size_t nPara, String& rName, SfxStyleFamily& eFamily) const;
+ void SetStyleSheet(size_t nPara, const String& rName, const SfxStyleFamily& eFamily);
+ bool ChangeStyleSheets(
+ const XubString& rOldName, SfxStyleFamily eOldFamily, const XubString& rNewName, SfxStyleFamily eNewFamily );
+ void ChangeStyleSheetName( SfxStyleFamily eFamily, const XubString& rOldName, const XubString& rNewName );
+
+ editeng::FieldUpdater GetFieldUpdater();
+
+ bool operator==( const EditTextObject& rCompare ) const;
+
+ // #i102062#
+ bool isWrongListEqual(const EditTextObject& rCompare) const;
+
+ virtual void ObjectInDestruction(const SfxItemPool& rSfxItemPool);
+
+#if DEBUG_EDIT_ENGINE
+ void Dump() const;
+#endif
+};
+
+#endif // _EDITOBJ_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/editrids.hrc b/include/editeng/editrids.hrc
new file mode 100644
index 000000000000..04ec3b6eccc7
--- /dev/null
+++ b/include/editeng/editrids.hrc
@@ -0,0 +1,395 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _EDIT_RIDS_HRC
+#define _EDIT_RIDS_HRC
+
+#include <svl/solar.hrc>
+
+// strings also used in cui
+#define RID_SVXSTR_PAPERBIN_SETTINGS (RID_EDIT_START)
+#define RID_SVXSTR_PAPERBIN (RID_EDIT_START + 1)
+
+#define RID_OUTLUNDO_EXPAND (RID_EDIT_START + 2)
+#define RID_OUTLUNDO_COLLAPSE (RID_EDIT_START + 3)
+#define RID_OUTLUNDO_ATTR (RID_EDIT_START + 4)
+#define RID_OUTLUNDO_INSERT (RID_EDIT_START + 5)
+#define RID_OUTLUNDO_DEPTH (RID_EDIT_START + 6)
+#define RID_OUTLUNDO_HEIGHT (RID_EDIT_START + 7)
+
+// strings for items
+
+#define RID_SVXITEMS_FRMDIR_BEGIN (RID_EDIT_START + 9)
+#define RID_SVXITEMS_FRMDIR_HORI_LEFT_TOP (RID_EDIT_START + 9)
+#define RID_SVXITEMS_FRMDIR_HORI_RIGHT_TOP (RID_EDIT_START + 10)
+#define RID_SVXITEMS_FRMDIR_VERT_TOP_RIGHT (RID_EDIT_START + 11)
+#define RID_SVXITEMS_FRMDIR_VERT_TOP_LEFT (RID_EDIT_START + 12)
+#define RID_SVXITEMS_FRMDIR_ENVIRONMENT (RID_EDIT_START + 13)
+// RID_SVXITEMS_FRMDIR_END (RID_EDIT_START + 14)
+
+#define RID_SVXITEMS_TRUE (RID_EDIT_START + 15)
+#define RID_SVXITEMS_FALSE (RID_EDIT_START + 16)
+#define RID_SVXITEMS_BORDER_COMPLETE (RID_EDIT_START + 17)
+#define RID_SVXITEMS_BORDER_TOP (RID_EDIT_START + 18)
+#define RID_SVXITEMS_BORDER_BOTTOM (RID_EDIT_START + 19)
+#define RID_SVXITEMS_BORDER_LEFT (RID_EDIT_START + 20)
+#define RID_SVXITEMS_BORDER_RIGHT (RID_EDIT_START + 21)
+#define RID_SVXITEMS_BORDER_DISTANCE (RID_EDIT_START + 22)
+#define RID_SVXITEMS_BORDER_NONE (RID_EDIT_START + 23)
+
+#define RID_SVXITEMS_TRANSPARENT_TRUE (RID_EDIT_START + 24)
+#define RID_SVXITEMS_TRANSPARENT_FALSE (RID_EDIT_START + 25)
+#define RID_SVXITEMS_OPAQUE_TRUE (RID_EDIT_START + 26)
+#define RID_SVXITEMS_OPAQUE_FALSE (RID_EDIT_START + 27)
+
+#define RID_SVXITEMS_SHADOW_COMPLETE (RID_EDIT_START + 28)
+#define RID_SVXITEMS_GRAPHIC (RID_EDIT_START + 29)
+#define RID_SVXITEMS_LINES (RID_EDIT_START + 30)
+#define RID_SVXITEMS_ORPHANS_COMPLETE (RID_EDIT_START + 31)
+#define RID_SVXITEMS_WIDOWS_COMPLETE (RID_EDIT_START + 32)
+#define RID_SVXITEMS_PAGEMODEL_COMPLETE (RID_EDIT_START + 33)
+
+#define RID_SVXITEMS_SHADOWED_TRUE (RID_EDIT_START + 34)
+#define RID_SVXITEMS_SHADOWED_FALSE (RID_EDIT_START + 35)
+#define RID_SVXITEMS_AUTOKERN_TRUE (RID_EDIT_START + 36)
+#define RID_SVXITEMS_AUTOKERN_FALSE (RID_EDIT_START + 37)
+#define RID_SVXITEMS_WORDLINE_TRUE (RID_EDIT_START + 38)
+#define RID_SVXITEMS_WORDLINE_FALSE (RID_EDIT_START + 39)
+#define RID_SVXITEMS_CONTOUR_TRUE (RID_EDIT_START + 40)
+#define RID_SVXITEMS_CONTOUR_FALSE (RID_EDIT_START + 41)
+#define RID_SVXITEMS_NOLINEBREAK_TRUE (RID_EDIT_START + 42)
+#define RID_SVXITEMS_NOLINEBREAK_FALSE (RID_EDIT_START + 43)
+#define RID_SVXITEMS_NOHYPHEN_TRUE (RID_EDIT_START + 44)
+#define RID_SVXITEMS_NOHYPHEN_FALSE (RID_EDIT_START + 45)
+#define RID_SVXITEMS_FMTKEEP_TRUE (RID_EDIT_START + 46)
+#define RID_SVXITEMS_FMTKEEP_FALSE (RID_EDIT_START + 47)
+#define RID_SVXITEMS_FMTSPLIT_TRUE (RID_EDIT_START + 48)
+#define RID_SVXITEMS_FMTSPLIT_FALSE (RID_EDIT_START + 49)
+#define RID_SVXITEMS_PRINT_TRUE (RID_EDIT_START + 50)
+#define RID_SVXITEMS_PRINT_FALSE (RID_EDIT_START + 51)
+#define RID_SVXITEMS_PROT_POS_TRUE (RID_EDIT_START + 52)
+#define RID_SVXITEMS_PROT_POS_FALSE (RID_EDIT_START + 53)
+#define RID_SVXITEMS_PROT_SIZE_TRUE (RID_EDIT_START + 54)
+#define RID_SVXITEMS_PROT_SIZE_FALSE (RID_EDIT_START + 55)
+#define RID_SVXITEMS_PROT_CONTENT_TRUE (RID_EDIT_START + 56)
+#define RID_SVXITEMS_PROT_CONTENT_FALSE (RID_EDIT_START + 57)
+#define RID_SVXITEMS_ULSPACE_UPPER (RID_EDIT_START + 58)
+#define RID_SVXITEMS_ULSPACE_LOWER (RID_EDIT_START + 59)
+#define RID_SVXITEMS_LRSPACE_LEFT (RID_EDIT_START + 60)
+#define RID_SVXITEMS_LRSPACE_FLINE (RID_EDIT_START + 62)
+#define RID_SVXITEMS_LRSPACE_RIGHT (RID_EDIT_START + 63)
+#define RID_SVXITEMS_SIZE_WIDTH (RID_EDIT_START + 64)
+#define RID_SVXITEMS_SIZE_HEIGHT (RID_EDIT_START + 65)
+#define RID_SVXITEMS_PAGE_END_TRUE (RID_EDIT_START + 66)
+#define RID_SVXITEMS_PAGE_END_FALSE (RID_EDIT_START + 67)
+#define RID_SVXITEMS_HYPHEN_TRUE (RID_EDIT_START + 68)
+#define RID_SVXITEMS_HYPHEN_FALSE (RID_EDIT_START + 69)
+#define RID_SVXITEMS_HYPHEN_MINLEAD (RID_EDIT_START + 70)
+#define RID_SVXITEMS_HYPHEN_MINTRAIL (RID_EDIT_START + 71)
+#define RID_SVXITEMS_HYPHEN_MAX (RID_EDIT_START + 72)
+#define RID_SVXITEMS_HNGPNCT_OFF (RID_EDIT_START + 73)
+#define RID_SVXITEMS_HNGPNCT_ON (RID_EDIT_START + 74)
+#define RID_SVXITEMS_FORBIDDEN_RULE_OFF (RID_EDIT_START + 75)
+#define RID_SVXITEMS_FORBIDDEN_RULE_ON (RID_EDIT_START + 76)
+#define RID_SVXITEMS_SCRPTSPC_OFF (RID_EDIT_START + 77)
+#define RID_SVXITEMS_SCRPTSPC_ON (RID_EDIT_START + 78)
+#define RID_SVXITEMS_CHARSCALE_OFF (RID_EDIT_START + 79)
+#define RID_SVXITEMS_CHARSCALE (RID_EDIT_START + 80)
+#define RID_SVXITEMS_CHARROTATE_OFF (RID_EDIT_START + 81)
+#define RID_SVXITEMS_CHARROTATE (RID_EDIT_START + 82)
+#define RID_SVXITEMS_CHARROTATE_FITLINE (RID_EDIT_START + 83)
+
+#define RID_SVXITEMS_RELIEF_BEGIN (RID_EDIT_START + 85)
+#define RID_SVXITEMS_RELIEF_NONE (RID_EDIT_START + 85)
+#define RID_SVXITEMS_RELIEF_EMBOSSED (RID_EDIT_START + 86)
+#define RID_SVXITEMS_RELIEF_ENGRAVED (RID_EDIT_START + 87)
+// RID_SVXITEMS_RELIEF_END (RID_EDIT_START + 88)
+
+// HM_ERR
+#define RID_SVXSTR_HMERR_THESAURUS (RID_EDIT_START + 89)
+
+// enum FontEmphasisMark ---------------------------------------------------
+#define RID_SVXITEMS_EMPHASIS_BEGIN_STYLE (RID_EDIT_START + 90)
+#define RID_SVXITEMS_EMPHASIS_NONE_STYLE (RID_EDIT_START + 90)
+#define RID_SVXITEMS_EMPHASIS_DOT_STYLE (RID_EDIT_START + 91)
+#define RID_SVXITEMS_EMPHASIS_CIRCLE_STYLE (RID_EDIT_START + 92)
+#define RID_SVXITEMS_EMPHASIS_DISC_STYLE (RID_EDIT_START + 93)
+#define RID_SVXITEMS_EMPHASIS_ACCENT_STYLE (RID_EDIT_START + 94)
+
+#define RID_SVXITEMS_EMPHASIS_ABOVE_POS (RID_EDIT_START + 95)
+#define RID_SVXITEMS_EMPHASIS_BELOW_POS (RID_EDIT_START + 96)
+
+// enum ESCAPEMENT -------------------------------------------------------
+#define RID_SVXITEMS_ESCAPEMENT_BEGIN (RID_EDIT_START + 97)
+#define RID_SVXITEMS_ESCAPEMENT_OFF (RID_EDIT_START + 97)
+#define RID_SVXITEMS_ESCAPEMENT_SUPER (RID_EDIT_START + 98)
+#define RID_SVXITEMS_ESCAPEMENT_SUB (RID_EDIT_START + 99)
+#define RID_SVXITEMS_ESCAPEMENT_AUTO (RID_EDIT_START + 100)
+
+// enum CASEMAP ----------------------------------------------------------
+#define RID_SVXITEMS_CASEMAP_BEGIN (RID_EDIT_START + 101)
+#define RID_SVXITEMS_CASEMAP_NONE (RID_EDIT_START + 101)
+#define RID_SVXITEMS_CASEMAP_VERSALIEN (RID_EDIT_START + 102)
+#define RID_SVXITEMS_CASEMAP_GEMEINE (RID_EDIT_START + 103)
+#define RID_SVXITEMS_CASEMAP_TITEL (RID_EDIT_START + 104)
+#define RID_SVXITEMS_CASEMAP_KAPITAELCHEN (RID_EDIT_START + 105)
+
+#define RID_SVXITEMS_KERNING_COMPLETE (RID_EDIT_START + 106)
+#define RID_SVXITEMS_KERNING_EXPANDED (RID_EDIT_START + 107)
+#define RID_SVXITEMS_KERNING_CONDENSED (RID_EDIT_START + 108)
+
+#define RID_SVXITEMS_BLINK_TRUE (RID_EDIT_START + 109)
+#define RID_SVXITEMS_BLINK_FALSE (RID_EDIT_START + 110)
+
+#define RID_SVXITEMS_TWOLINES_OFF (RID_EDIT_START + 111)
+#define RID_SVXITEMS_TWOLINES (RID_EDIT_START + 112)
+
+// enum FontStrikeout ----------------------------------------------------
+#define RID_SVXITEMS_STRIKEOUT_BEGIN (RID_EDIT_START + 113)
+#define RID_SVXITEMS_STRIKEOUT_NONE (RID_EDIT_START + 113)
+#define RID_SVXITEMS_STRIKEOUT_SINGLE (RID_EDIT_START + 114)
+#define RID_SVXITEMS_STRIKEOUT_DOUBLE (RID_EDIT_START + 115)
+#define RID_SVXITEMS_STRIKEOUT_BOLD (RID_EDIT_START + 117)
+#define RID_SVXITEMS_STRIKEOUT_SLASH (RID_EDIT_START + 118)
+#define RID_SVXITEMS_STRIKEOUT_X (RID_EDIT_START + 119)
+
+// enum FontUnderline - used for overline --------------------------------
+#define RID_SVXITEMS_OL_BEGIN (RID_EDIT_START + 120)
+#define RID_SVXITEMS_OL_NONE (RID_EDIT_START + 120)
+#define RID_SVXITEMS_OL_SINGLE (RID_EDIT_START + 121)
+#define RID_SVXITEMS_OL_DOUBLE (RID_EDIT_START + 122)
+#define RID_SVXITEMS_OL_DOTTED (RID_EDIT_START + 123)
+#define RID_SVXITEMS_OL_DONTKNOW (RID_EDIT_START + 124)
+#define RID_SVXITEMS_OL_DASH (RID_EDIT_START + 125)
+#define RID_SVXITEMS_OL_LONGDASH (RID_EDIT_START + 126)
+#define RID_SVXITEMS_OL_DASHDOT (RID_EDIT_START + 127)
+#define RID_SVXITEMS_OL_DASHDOTDOT (RID_EDIT_START + 128)
+#define RID_SVXITEMS_OL_SMALLWAVE (RID_EDIT_START + 129)
+#define RID_SVXITEMS_OL_WAVE (RID_EDIT_START + 130)
+#define RID_SVXITEMS_OL_DOUBLEWAVE (RID_EDIT_START + 131)
+#define RID_SVXITEMS_OL_BOLD (RID_EDIT_START + 132)
+#define RID_SVXITEMS_OL_BOLDDOTTED (RID_EDIT_START + 133)
+#define RID_SVXITEMS_OL_BOLDDASH (RID_EDIT_START + 134)
+#define RID_SVXITEMS_OL_BOLDLONGDASH (RID_EDIT_START + 135)
+#define RID_SVXITEMS_OL_BOLDDASHDOT (RID_EDIT_START + 136)
+#define RID_SVXITEMS_OL_BOLDDASHDOTDOT (RID_EDIT_START + 137)
+#define RID_SVXITEMS_OL_BOLDWAVE (RID_EDIT_START + 138)
+
+// enum FontUnderline - used for underline -------------------------------
+#define RID_SVXITEMS_UL_BEGIN (RID_EDIT_START + 139)
+#define RID_SVXITEMS_UL_NONE (RID_EDIT_START + 139)
+#define RID_SVXITEMS_UL_SINGLE (RID_EDIT_START + 140)
+#define RID_SVXITEMS_UL_DOUBLE (RID_EDIT_START + 141)
+#define RID_SVXITEMS_UL_DOTTED (RID_EDIT_START + 142)
+#define RID_SVXITEMS_UL_DONTKNOW (RID_EDIT_START + 143)
+#define RID_SVXITEMS_UL_DASH (RID_EDIT_START + 144)
+#define RID_SVXITEMS_UL_LONGDASH (RID_EDIT_START + 145)
+#define RID_SVXITEMS_UL_DASHDOT (RID_EDIT_START + 146)
+#define RID_SVXITEMS_UL_DASHDOTDOT (RID_EDIT_START + 147)
+#define RID_SVXITEMS_UL_SMALLWAVE (RID_EDIT_START + 148)
+#define RID_SVXITEMS_UL_WAVE (RID_EDIT_START + 149)
+#define RID_SVXITEMS_UL_DOUBLEWAVE (RID_EDIT_START + 150)
+#define RID_SVXITEMS_UL_BOLD (RID_EDIT_START + 151)
+#define RID_SVXITEMS_UL_BOLDDOTTED (RID_EDIT_START + 152)
+#define RID_SVXITEMS_UL_BOLDDASH (RID_EDIT_START + 153)
+#define RID_SVXITEMS_UL_BOLDLONGDASH (RID_EDIT_START + 154)
+#define RID_SVXITEMS_UL_BOLDDASHDOT (RID_EDIT_START + 155)
+#define RID_SVXITEMS_UL_BOLDDASHDOTDOT (RID_EDIT_START + 156)
+#define RID_SVXITEMS_UL_BOLDWAVE (RID_EDIT_START + 157)
+
+// enum FontWeight -------------------------------------------------------
+#define RID_SVXITEMS_WEIGHT_BEGIN (RID_EDIT_START + 158)
+#define RID_SVXITEMS_WEIGHT_DONTKNOW (RID_EDIT_START + 158)
+#define RID_SVXITEMS_WEIGHT_THIN (RID_EDIT_START + 159)
+#define RID_SVXITEMS_WEIGHT_ULTRALIGHT (RID_EDIT_START + 160)
+#define RID_SVXITEMS_WEIGHT_LIGHT (RID_EDIT_START + 161)
+#define RID_SVXITEMS_WEIGHT_SEMILIGHT (RID_EDIT_START + 162)
+#define RID_SVXITEMS_WEIGHT_NORMAL (RID_EDIT_START + 163)
+#define RID_SVXITEMS_WEIGHT_MEDIUM (RID_EDIT_START + 164)
+#define RID_SVXITEMS_WEIGHT_SEMIBOLD (RID_EDIT_START + 165)
+#define RID_SVXITEMS_WEIGHT_BOLD (RID_EDIT_START + 166)
+#define RID_SVXITEMS_WEIGHT_ULTRABOLD (RID_EDIT_START + 167)
+#define RID_SVXITEMS_WEIGHT_BLACK (RID_EDIT_START + 168)
+
+// enum FontItalic -------------------------------------------------------
+#define RID_SVXITEMS_ITALIC_NONE (RID_EDIT_START + 206)
+#define RID_SVXITEMS_ITALIC_OBLIQUE (RID_EDIT_START + 207)
+#define RID_SVXITEMS_ITALIC_NORMAL (RID_EDIT_START + 208)
+
+// enum SvxAdjust -----------------------------------------------------------
+#define RID_SVXITEMS_ADJUST_BEGIN (RID_EDIT_START + 209)
+#define RID_SVXITEMS_ADJUST_LEFT (RID_EDIT_START + 209)
+#define RID_SVXITEMS_ADJUST_RIGHT (RID_EDIT_START + 210)
+#define RID_SVXITEMS_ADJUST_BLOCK (RID_EDIT_START + 211)
+#define RID_SVXITEMS_ADJUST_CENTER (RID_EDIT_START + 212)
+#define RID_SVXITEMS_ADJUST_BLOCKLINE (RID_EDIT_START + 213)
+
+#define RID_SVXITEMS_TAB_DECIMAL_CHAR (RID_EDIT_START + 214)
+#define RID_SVXITEMS_TAB_FILL_CHAR (RID_EDIT_START + 215)
+
+#define RID_SVXITEMS_TAB_ADJUST_BEGIN (RID_EDIT_START + 217)
+#define RID_SVXITEMS_TAB_ADJUST_LEFT (RID_EDIT_START + 217)
+#define RID_SVXITEMS_TAB_ADJUST_RIGHT (RID_EDIT_START + 218)
+#define RID_SVXITEMS_TAB_ADJUST_DECIMAL (RID_EDIT_START + 219)
+#define RID_SVXITEMS_TAB_ADJUST_CENTER (RID_EDIT_START + 220)
+#define RID_SVXITEMS_TAB_ADJUST_DEFAULT (RID_EDIT_START + 221)
+
+// enum SvxBreak ------------------------------------------------------------
+#define RID_SVXITEMS_BREAK_BEGIN (RID_EDIT_START + 222)
+#define RID_SVXITEMS_BREAK_NONE (RID_EDIT_START + 222)
+#define RID_SVXITEMS_BREAK_COLUMN_BEFORE (RID_EDIT_START + 223)
+#define RID_SVXITEMS_BREAK_COLUMN_AFTER (RID_EDIT_START + 224)
+#define RID_SVXITEMS_BREAK_COLUMN_BOTH (RID_EDIT_START + 225)
+#define RID_SVXITEMS_BREAK_PAGE_BEFORE (RID_EDIT_START + 226)
+#define RID_SVXITEMS_BREAK_PAGE_AFTER (RID_EDIT_START + 227)
+#define RID_SVXITEMS_BREAK_PAGE_BOTH (RID_EDIT_START + 228)
+
+// enum SvxShadowLocation ---------------------------------------------------
+#define RID_SVXITEMS_SHADOW_BEGIN (RID_EDIT_START + 229)
+#define RID_SVXITEMS_SHADOW_NONE (RID_EDIT_START + 229)
+#define RID_SVXITEMS_SHADOW_TOPLEFT (RID_EDIT_START + 230)
+#define RID_SVXITEMS_SHADOW_TOPRIGHT (RID_EDIT_START + 231)
+#define RID_SVXITEMS_SHADOW_BOTTOMLEFT (RID_EDIT_START + 232)
+#define RID_SVXITEMS_SHADOW_BOTTOMRIGHT (RID_EDIT_START + 233)
+
+// Border lines
+#define RID_SOLID (RID_EDIT_START + 234)
+#define RID_DOTTED (RID_EDIT_START + 235)
+#define RID_DASHED (RID_EDIT_START + 236)
+#define RID_DOUBLE (RID_EDIT_START + 237)
+#define RID_THINTHICK_SMALLGAP (RID_EDIT_START + 238)
+#define RID_THINTHICK_MEDIUMGAP (RID_EDIT_START + 239)
+#define RID_THINTHICK_LARGEGAP (RID_EDIT_START + 240)
+#define RID_THICKTHIN_SMALLGAP (RID_EDIT_START + 241)
+#define RID_THICKTHIN_MEDIUMGAP (RID_EDIT_START + 242)
+#define RID_THICKTHIN_LARGEGAP (RID_EDIT_START + 243)
+#define RID_EMBOSSED (RID_EDIT_START + 244)
+#define RID_ENGRAVED (RID_EDIT_START + 245)
+#define RID_OUTSET (RID_EDIT_START + 246)
+#define RID_INSET (RID_EDIT_START + 247)
+
+// Metric-Text
+#define RID_SVXITEMS_METRIC_MM (RID_EDIT_START + 250)
+#define RID_SVXITEMS_METRIC_CM (RID_EDIT_START + 251)
+#define RID_SVXITEMS_METRIC_INCH (RID_EDIT_START + 252)
+#define RID_SVXITEMS_METRIC_POINT (RID_EDIT_START + 253)
+#define RID_SVXITEMS_METRIC_TWIP (RID_EDIT_START + 254)
+#define RID_SVXITEMS_METRIC_PIXEL (RID_EDIT_START + 255)
+
+// enum ColorName -----------------------------------------------------------
+#define RID_SVXITEMS_COLOR_BEGIN (RID_EDIT_START + 256)
+#define RID_SVXITEMS_COLOR (RID_EDIT_START + 256)
+#define RID_SVXITEMS_COLOR_BLACK (RID_EDIT_START + 257)
+#define RID_SVXITEMS_COLOR_BLUE (RID_EDIT_START + 258)
+#define RID_SVXITEMS_COLOR_GREEN (RID_EDIT_START + 259)
+#define RID_SVXITEMS_COLOR_CYAN (RID_EDIT_START + 260)
+#define RID_SVXITEMS_COLOR_RED (RID_EDIT_START + 261)
+#define RID_SVXITEMS_COLOR_MAGENTA (RID_EDIT_START + 262)
+#define RID_SVXITEMS_COLOR_BROWN (RID_EDIT_START + 263)
+#define RID_SVXITEMS_COLOR_GRAY (RID_EDIT_START + 264)
+#define RID_SVXITEMS_COLOR_LIGHTGRAY (RID_EDIT_START + 265)
+#define RID_SVXITEMS_COLOR_LIGHTBLUE (RID_EDIT_START + 266)
+#define RID_SVXITEMS_COLOR_LIGHTGREEN (RID_EDIT_START + 267)
+#define RID_SVXITEMS_COLOR_LIGHTCYAN (RID_EDIT_START + 268)
+#define RID_SVXITEMS_COLOR_LIGHTRED (RID_EDIT_START + 269)
+#define RID_SVXITEMS_COLOR_LIGHTMAGENTA (RID_EDIT_START + 270)
+#define RID_SVXITEMS_COLOR_YELLOW (RID_EDIT_START + 271)
+#define RID_SVXITEMS_COLOR_WHITE (RID_EDIT_START + 272)
+#define RID_SVXITEMS_COLOR_MENUBAR (RID_EDIT_START + 273)
+#define RID_SVXITEMS_COLOR_MENUBARTEXT (RID_EDIT_START + 274)
+#define RID_SVXITEMS_COLOR_POPUPMENU (RID_EDIT_START + 275)
+#define RID_SVXITEMS_COLOR_POPUPMENUTEXT (RID_EDIT_START + 276)
+#define RID_SVXITEMS_COLOR_WINDOWTEXT (RID_EDIT_START + 277)
+#define RID_SVXITEMS_COLOR_WINDOWWORKSPACE (RID_EDIT_START + 278)
+#define RID_SVXITEMS_COLOR_HIGHLIGHT (RID_EDIT_START + 279)
+#define RID_SVXITEMS_COLOR_HIGHLIGHTTEXT (RID_EDIT_START + 280)
+#define RID_SVXITEMS_COLOR_3DTEXT (RID_EDIT_START + 281)
+#define RID_SVXITEMS_COLOR_3DFACE (RID_EDIT_START + 282)
+#define RID_SVXITEMS_COLOR_3DLIGHT (RID_EDIT_START + 283)
+#define RID_SVXITEMS_COLOR_3DSHADOW (RID_EDIT_START + 284)
+#define RID_SVXITEMS_COLOR_SCROLLBAR (RID_EDIT_START + 285)
+#define RID_SVXITEMS_COLOR_FIELD (RID_EDIT_START + 286)
+#define RID_SVXITEMS_COLOR_FIELDTEXT (RID_EDIT_START + 287)
+
+
+#define RID_SVXITEMS_PARASNAPTOGRID_ON (RID_EDIT_START + 288)
+#define RID_SVXITEMS_PARASNAPTOGRID_OFF (RID_EDIT_START + 289)
+
+#define RID_SVXITEMS_PARAVERTALIGN_AUTO (RID_EDIT_START + 290)
+#define RID_SVXITEMS_PARAVERTALIGN_BASELINE (RID_EDIT_START + 291)
+#define RID_SVXITEMS_PARAVERTALIGN_TOP (RID_EDIT_START + 292)
+#define RID_SVXITEMS_PARAVERTALIGN_CENTER (RID_EDIT_START + 293)
+#define RID_SVXITEMS_PARAVERTALIGN_BOTTOM (RID_EDIT_START + 294)
+
+#define RID_SVXITEMS_CHARHIDDEN_FALSE (RID_EDIT_START + 295)
+#define RID_SVXITEMS_CHARHIDDEN_TRUE (RID_EDIT_START + 296)
+
+// strings for error messsages in dictionary updates
+#define RID_SVXSTR_DIC_ERR_UNKNOWN (RID_EDIT_START + 297)
+#define RID_SVXSTR_DIC_ERR_FULL (RID_EDIT_START + 298)
+#define RID_SVXSTR_DIC_ERR_READONLY (RID_EDIT_START + 299)
+
+// ResIds fuer HM-QueryBoxen und Error-Strings
+#define RID_SVXQB_BW_CONTINUE (RID_EDIT_START + 300)
+#define RID_SVXQB_CONTINUE (RID_EDIT_START + 301)
+
+// EditEngine
+#define RID_EDITUNDO_DEL (RID_EDIT_START + 302)
+#define RID_EDITUNDO_MOVE (RID_EDIT_START + 303)
+#define RID_EDITUNDO_INSERT (RID_EDIT_START + 304)
+#define RID_EDITUNDO_REPLACE (RID_EDIT_START + 305)
+#define RID_EDITUNDO_SETATTRIBS (RID_EDIT_START + 306)
+#define RID_EDITUNDO_SETSTYLE (RID_EDIT_START + 307)
+#define RID_EDITUNDO_RESETATTRIBS (RID_EDIT_START + 308)
+#define RID_EDITUNDO_INDENT (RID_EDIT_START + 309)
+#define RID_EDITUNDO_TRANSLITERATE (RID_EDIT_START + 310)
+#define RID_MENU_SPELL (RID_EDIT_START + 311)
+#define RID_STR_PARAGRAPH (RID_EDIT_START + 312)
+#define RID_STR_WORD (RID_EDIT_START + 313)
+#define RID_SVXSTR_A11Y_IMAGEBULLET_DESCRIPTION (RID_EDIT_START + 314)
+#define RID_SVXSTR_A11Y_IMAGEBULLET_NAME (RID_EDIT_START + 315)
+
+// enum SvxCellHorJustify
+#define RID_SVXITEMS_HORJUST_STANDARD (RID_EDIT_START + 316)
+#define RID_SVXITEMS_HORJUST_LEFT (RID_EDIT_START + 317)
+#define RID_SVXITEMS_HORJUST_CENTER (RID_EDIT_START + 318)
+#define RID_SVXITEMS_HORJUST_RIGHT (RID_EDIT_START + 319)
+#define RID_SVXITEMS_HORJUST_BLOCK (RID_EDIT_START + 320)
+#define RID_SVXITEMS_HORJUST_REPEAT (RID_EDIT_START + 321)
+
+// enum SvxCellVerJustify
+#define RID_SVXITEMS_VERJUST_STANDARD (RID_EDIT_START + 322)
+#define RID_SVXITEMS_VERJUST_TOP (RID_EDIT_START + 323)
+#define RID_SVXITEMS_VERJUST_CENTER (RID_EDIT_START + 324)
+#define RID_SVXITEMS_VERJUST_BOTTOM (RID_EDIT_START + 325)
+
+// enum SvxCellJustifyMethod
+#define RID_SVXITEMS_JUSTMETHOD_AUTO (RID_EDIT_START + 326)
+#define RID_SVXITEMS_JUSTMETHOD_DISTRIBUTE (RID_EDIT_START + 327)
+
+#if 327 > (RID_EDIT_END-RID_EDIT_START)
+#error Resource-Ueberlauf in #line, #file
+#endif
+
+
+
+#endif
+
+// ******************************************************************* EOF
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/editstat.hxx b/include/editeng/editstat.hxx
new file mode 100644
index 000000000000..175267938c91
--- /dev/null
+++ b/include/editeng/editstat.hxx
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _EDITSTAT_HXX
+#define _EDITSTAT_HXX
+
+#include <tools/string.hxx>
+#include <i18nlangtag/lang.h>
+
+#define EE_CNTRL_USECHARATTRIBS 0x00000001 // Use of hard character attributes
+#define EE_CNTRL_USEPARAATTRIBS 0x00000002 // Using paragraph attributes.
+#define EE_CNTRL_CRSRLEFTPARA 0x00000004 // Cursor is moved to another paragraph
+#define EE_CNTRL_DOIDLEFORMAT 0x00000008 // Formatting idle
+#define EE_CNTRL_PASTESPECIAL 0x00000010 // Allow PasteSpecial
+#define EE_CNTRL_AUTOINDENTING 0x00000020 // Automatic indenting
+#define EE_CNTRL_UNDOATTRIBS 0x00000040 // Undo for Attributes....
+#define EE_CNTRL_ONECHARPERLINE 0x00000080 // One character per line
+#define EE_CNTRL_NOCOLORS 0x00000100 // Engine: No Color
+#define EE_CNTRL_OUTLINER 0x00000200 // Special treatment Outliner/Outline mode
+#define EE_CNTRL_OUTLINER2 0x00000400 // Special treatment Outliner/Page
+#define EE_CNTRL_ALLOWBIGOBJS 0x00000800 // Portion info in text object
+#define EE_CNTRL_ONLINESPELLING 0x00001000 // During the edit Spelling
+#define EE_CNTRL_STRETCHING 0x00002000 // Stretch mode
+#define EE_CNTRL_MARKFIELDS 0x00004000 // Mark Fields with color
+#define EE_CNTRL_URLSFXEXECUTE 0x00008000 // !!!OLD!!!: SFX-URL-Execute.
+#define EE_CNTRL_RESTOREFONT 0x00010000 // Restore Font in OutDev
+#define EE_CNTRL_RTFSTYLESHEETS 0x00020000 // Use Stylesheets when imported
+//#define EE_CNTRL_NOREDLINES 0x00040000 // No RedLines when OnlineSpellError /* removed #i91949 */
+#define EE_CNTRL_AUTOCORRECT 0x00080000 // AutoCorrect
+#define EE_CNTRL_AUTOCOMPLETE 0x00100000 // AutoComplete
+#define EE_CNTRL_AUTOPAGESIZEX 0x00200000 // Adjust paper width to Text
+#define EE_CNTRL_AUTOPAGESIZEY 0x00400000 // Adjust paper height to Text
+#define EE_CNTRL_AUTOPAGESIZE (EE_CNTRL_AUTOPAGESIZEX|EE_CNTRL_AUTOPAGESIZEY)
+#define EE_CNTRL_TABINDENTING 0x00800000 // Indent with tab
+#define EE_CNTRL_FORMAT100 0x01000000 // Always format to 100%
+#define EE_CNTRL_ULSPACESUMMATION 0x02000000 // MS Compat: sum SA and SB, not maximum value
+#define EE_CNTRL_ULSPACEFIRSTPARA 0x04000000 // MS Compat: evaluate also at the first paragraph
+
+#define EV_CNTRL_AUTOSCROLL 0x00000001 // Auto scrolling horizontally
+#define EV_CNTRL_BIGSCROLL 0x00000002 // Scroll further to the cursor
+#define EV_CNTRL_ENABLEPASTE 0x00000004 // Enable Paste
+#define EV_CNTRL_SINGLELINEPASTE 0x00000008 // View: Paste in input line ...
+#define EV_CNTRL_OVERWRITE 0x00000010 // Overwrite mode
+#define EV_CNTRL_INVONEMORE 0x00000020 // Invalidate one pixel more
+#define EV_CNTRL_AUTOSIZEX 0x00000040 // Automatically adapt to text width
+#define EV_CNTRL_AUTOSIZEY 0x00000080 // Automatically adapt to Text width
+#define EV_CNTRL_AUTOSIZE (EV_CNTRL_AUTOSIZEX|EV_CNTRL_AUTOSIZEY)
+
+#define EE_STAT_HSCROLL 0x00000001
+#define EE_STAT_VSCROLL 0x00000002
+#define EE_STAT_CURSOROUT 0x00000004
+#define EE_STAT_CRSRMOVEFAIL 0x00000008
+#define EE_STAT_CRSRLEFTPARA 0x00000010
+#define EE_STAT_TEXTWIDTHCHANGED 0x00000020
+#define EE_STAT_TEXTHEIGHTCHANGED 0x00000040
+#define EE_STAT_WRONGWORDCHANGED 0x00000080
+// #define EE_STAT_MODIFIED 0x00000100
+
+/*
+ EE_STAT_CRSRLEFTPARA at the time cursor movement and the enter.
+*/
+
+inline void SetFlags( sal_uLong& rBits, const sal_uInt32 nMask, bool bOn )
+{
+ if ( bOn )
+ rBits |= nMask;
+ else
+ rBits &= ~nMask;
+}
+
+class EditStatus
+{
+protected:
+ sal_uLong nStatusBits;
+ sal_uLong nControlBits;
+ sal_uInt16 nPrevPara; // for EE_STAT_CRSRLEFTPARA
+
+public:
+ EditStatus() { nStatusBits = 0; nControlBits = 0; nPrevPara = 0xFFFF; }
+
+ void Clear() { nStatusBits = 0; }
+ void SetControlBits( sal_uLong nMask, bool bOn )
+ { SetFlags( nControlBits, nMask, bOn ); }
+
+ sal_uLong GetStatusWord() const { return nStatusBits; }
+ sal_uLong& GetStatusWord() { return nStatusBits; }
+
+ sal_uLong GetControlWord() const { return nControlBits; }
+ sal_uLong& GetControlWord() { return nControlBits; }
+
+ sal_uInt16 GetPrevParagraph() const { return nPrevPara; }
+ sal_uInt16& GetPrevParagraph() { return nPrevPara; }
+};
+
+#define SPELLCMD_IGNOREWORD 0x0001
+#define SPELLCMD_STARTSPELLDLG 0x0002
+#define SPELLCMD_ADDTODICTIONARY 0x0003
+#define SPELLCMD_WORDLANGUAGE 0x0004
+#define SPELLCMD_PARALANGUAGE 0x0005
+
+struct SpellCallbackInfo
+{
+ sal_uInt16 nCommand;
+ String aWord;
+ LanguageType eLanguage;
+
+ SpellCallbackInfo( sal_uInt16 nCMD, const String& rWord )
+ : aWord( rWord )
+ {
+ nCommand = nCMD;
+ eLanguage = LANGUAGE_DONTKNOW;
+ }
+
+ SpellCallbackInfo( sal_uInt16 nCMD, LanguageType eLang )
+ {
+ nCommand = nCMD;
+ eLanguage = eLang;
+ }
+};
+
+#endif // _EDITSTAT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/editund2.hxx b/include/editeng/editund2.hxx
new file mode 100644
index 000000000000..2312aee93c79
--- /dev/null
+++ b/include/editeng/editund2.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _EDITUND2_HXX
+#define _EDITUND2_HXX
+
+#include "editeng/editengdllapi.h"
+#include <svl/undo.hxx>
+
+class EditEngine;
+
+class EDITENG_DLLPRIVATE EditUndoManager : public SfxUndoManager
+{
+ using SfxUndoManager::Undo;
+ using SfxUndoManager::Redo;
+
+ EditEngine* mpEditEngine;
+public:
+ EditUndoManager(EditEngine* pEE);
+
+ virtual sal_Bool Undo();
+ virtual sal_Bool Redo();
+};
+
+// -----------------------------------------------------------------------
+// EditUndo
+// ------------------------------------------------------------------------
+class EDITENG_DLLPUBLIC EditUndo : public SfxUndoAction
+{
+private:
+ sal_uInt16 nId;
+ EditEngine* mpEditEngine;
+
+public:
+ EditUndo(sal_uInt16 nI, EditEngine* pEE);
+ virtual ~EditUndo();
+
+ EditEngine* GetEditEngine();
+
+ virtual void Undo() = 0;
+ virtual void Redo() = 0;
+
+ virtual sal_Bool CanRepeat(SfxRepeatTarget&) const;
+ virtual OUString GetComment() const;
+ virtual sal_uInt16 GetId() const;
+};
+
+#endif // _EDITUND2_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx
new file mode 100644
index 000000000000..a2f5ce8a3d65
--- /dev/null
+++ b/include/editeng/editview.hxx
@@ -0,0 +1,247 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+// MyEDITVIEW, due to exported EditView
+#ifndef _MyEDITVIEW_HXX
+#define _MyEDITVIEW_HXX
+
+#include <com/sun/star/i18n/WordType.hpp>
+
+#include <rsc/rscsfx.hxx>
+#include <i18nlangtag/lang.h>
+#include <tools/color.hxx>
+#include <tools/gen.hxx>
+
+class EditEngine;
+class ImpEditEngine;
+class ImpEditView;
+class SvxSearchItem;
+class SvxFieldItem;
+class Window;
+class Pointer;
+class Cursor;
+class KeyEvent;
+class MouseEvent;
+class DropEvent;
+class CommandEvent;
+class Rectangle;
+class Link;
+class Pair;
+class Point;
+class Range;
+class SvStream;
+class SvKeyValueIterator;
+class SfxStyleSheet;
+class Font;
+class FontList;
+class OutputDevice;
+
+#include <editeng/editdata.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include "editeng/editengdllapi.h"
+
+namespace com {
+namespace sun {
+namespace star {
+namespace datatransfer {
+ class XTransferable;
+}
+namespace linguistic2 {
+ class XSpellChecker1;
+ class XLanguageGuessing;
+}
+}}}
+
+class EDITENG_DLLPUBLIC EditView
+{
+ friend class EditEngine;
+ friend class ImpEditEngine;
+ friend class EditSelFunctionSet;
+
+public: // Needed for Undo
+ ImpEditView* GetImpEditView() const { return pImpEditView; }
+ ImpEditEngine* GetImpEditEngine() const;
+
+private:
+ ImpEditView* pImpEditView;
+ String aDicNameSingle;
+
+ EDITENG_DLLPRIVATE EditView( const EditView& );
+ EDITENG_DLLPRIVATE EditView& operator=( const EditView& );
+
+public:
+ EditView( EditEngine* pEng, Window* pWindow );
+ virtual ~EditView();
+
+ void SetEditEngine( EditEngine* pEditEngine );
+ EditEngine* GetEditEngine() const;
+
+ void SetWindow( Window* pWin );
+ Window* GetWindow() const;
+
+ void Paint( const Rectangle& rRect, OutputDevice* pTargetDevice = 0 );
+ void Invalidate();
+ Pair Scroll( long nHorzScroll, long nVertScroll, sal_uInt8 nRangeCheck = RGCHK_NEG );
+
+ void ShowCursor( sal_Bool bGotoCursor = sal_True, sal_Bool bForceVisCursor = sal_True );
+ void HideCursor();
+
+ void SetSelectionMode( EESelectionMode eMode );
+
+ void SetReadOnly( sal_Bool bReadOnly );
+ sal_Bool IsReadOnly() const;
+
+ sal_Bool HasSelection() const;
+ ESelection GetSelection() const;
+ void SetSelection( const ESelection& rNewSel );
+ sal_Bool SelectCurrentWord( sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES );
+
+ sal_Bool IsInsertMode() const;
+ void SetInsertMode( sal_Bool bInsert );
+
+ void ReplaceSelected( const String& rStr );
+ String GetSelected();
+ void DeleteSelected();
+
+ sal_uInt16 GetSelectedScriptType() const;
+
+ // VisArea position of the Output window.
+ // A size change also affects the VisArea
+ void SetOutputArea( const Rectangle& rRect );
+ const Rectangle& GetOutputArea() const;
+
+ // Document position.
+ // A size change also affects the VisArea
+ void SetVisArea( const Rectangle& rRect );
+ const Rectangle& GetVisArea() const;
+
+ const Pointer& GetPointer() const;
+
+ Cursor* GetCursor() const;
+
+ void InsertText( const String& rNew, sal_Bool bSelect = sal_False );
+
+ sal_Bool PostKeyEvent( const KeyEvent& rKeyEvent, Window* pFrameWin = NULL );
+
+ sal_Bool MouseButtonUp( const MouseEvent& rMouseEvent );
+ sal_Bool MouseButtonDown( const MouseEvent& rMouseEvent );
+ sal_Bool MouseMove( const MouseEvent& rMouseEvent );
+ void Command( const CommandEvent& rCEvt );
+
+ void Cut();
+ void Copy();
+ void Paste();
+ void PasteSpecial();
+
+ void Undo();
+ void Redo();
+
+ // especially for Oliver Specht
+ Point GetWindowPosTopLeft( sal_uInt16 nParagraph );
+ void MoveParagraphs( Range aParagraphs, sal_uInt16 nNewPos );
+ void MoveParagraphs( long nDiff );
+
+ const SfxItemSet& GetEmptyItemSet();
+ SfxItemSet GetAttribs();
+ void SetAttribs( const SfxItemSet& rSet );
+ void RemoveAttribs( sal_Bool bRemoveParaAttribs = sal_False, sal_uInt16 nWhich = 0 );
+ void RemoveCharAttribs( sal_uInt16 nPara, sal_uInt16 nWhich = 0 );
+ void RemoveAttribsKeepLanguages( sal_Bool bRemoveParaAttribs = sal_False );
+
+ sal_uLong Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, sal_Bool bSelect = sal_False, SvKeyValueIterator* pHTTPHeaderAttrs = NULL );
+
+ void SetBackgroundColor( const Color& rColor );
+ Color GetBackgroundColor() const;
+
+ void SetControlWord( sal_uInt32 nWord );
+ sal_uInt32 GetControlWord() const;
+
+ EditTextObject* CreateTextObject();
+ void InsertText( const EditTextObject& rTextObject );
+ void InsertText( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > xDataObj, const String& rBaseURL, sal_Bool bUseSpecial );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > GetTransferable();
+
+ // An EditView, so that when TRUE the update will be free from flickering:
+ void SetEditEngineUpdateMode( sal_Bool bUpdate );
+ void ForceUpdate();
+
+ const SfxStyleSheet* GetStyleSheet() const;
+ SfxStyleSheet* GetStyleSheet();
+
+ void SetAnchorMode( EVAnchorMode eMode );
+ EVAnchorMode GetAnchorMode() const;
+
+ void CompleteAutoCorrect( Window* pFrameWin = NULL );
+
+ EESpellState StartSpeller( sal_Bool bMultipleDoc = sal_False );
+ EESpellState StartThesaurus();
+ sal_uInt16 StartSearchAndReplace( const SvxSearchItem& rSearchItem );
+
+ // for text conversion
+ void StartTextConversion( LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont, sal_Int32 nOptions, sal_Bool bIsInteractive, sal_Bool bMultipleDoc );
+ sal_Bool HasConvertibleTextPortion( LanguageType nLang );
+
+ void TransliterateText( sal_Int32 nTransliterationMode );
+
+ sal_Bool IsCursorAtWrongSpelledWord( sal_Bool bMarkIfWrong = sal_False );
+ sal_Bool IsWrongSpelledWordAtPos( const Point& rPosPixel, sal_Bool bMarkIfWrong = sal_False );
+ void ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack = 0 );
+
+ void InsertField( const SvxFieldItem& rFld );
+ const SvxFieldItem* GetFieldUnderMousePointer() const;
+ const SvxFieldItem* GetFieldUnderMousePointer( sal_uInt16& nPara, xub_StrLen& nPos ) const;
+ const SvxFieldItem* GetField( const Point& rPos, sal_uInt16* pnPara = NULL, xub_StrLen* pnPos = NULL ) const;
+
+ const SvxFieldItem* GetFieldAtSelection() const;
+
+ void SetInvalidateMore( sal_uInt16 nPixel );
+ sal_uInt16 GetInvalidateMore() const;
+
+ // grows or shrinks the font height for the current selection
+ void ChangeFontSize( bool bGrow, const FontList* pList );
+
+ static bool ChangeFontSize( bool bGrow, SfxItemSet& rSet, const FontList* pFontList );
+
+ String GetSurroundingText() const;
+ Selection GetSurroundingTextSelection() const;
+
+ /** Tries to determine the language of 'rText', returning a matching known
+ locale if possible, or a fallback, or LANGUAGE_NONE if nothing found or
+ matched.
+
+ @param bIsParaText
+ If TRUE, rText is a paragraph and the language is obtained by
+ passing the text to xLangGuess.
+ IF FALSE, a language match is tried for, in order,
+ 1. the default document language (non-CTL, non-CJK, aka LATIN)
+ 2. the UI language (Tools->Options->LanguageSettings->Languages User Interface)
+ 3. the locale (Tools->Options->LanguageSettings->Languages Locale)
+ 4. en-US
+ If nothing matched, LANGUAGE_NONE is returned.
+ */
+ static LanguageType CheckLanguage(
+ const OUString &rText,
+ com::sun::star::uno::Reference< com::sun::star::linguistic2::XSpellChecker1 > xSpell,
+ com::sun::star::uno::Reference< com::sun::star::linguistic2::XLanguageGuessing > xLangGuess,
+ bool bIsParaText );
+};
+
+#endif // _MyEDITVIEW_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/edtdlg.hxx b/include/editeng/edtdlg.hxx
new file mode 100644
index 000000000000..7c998dfa637b
--- /dev/null
+++ b/include/editeng/edtdlg.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _EDT_ABSTDLG_HXX
+#define _EDT_ABSTDLG_HXX
+
+#include <tools/solar.h>
+#include <tools/string.hxx>
+#include <editeng/editengdllapi.h>
+#include <i18nlangtag/lang.h>
+#include <com/sun/star/uno/Reference.hxx>
+#include <vcl/abstdlg.hxx>
+#include <editeng/hangulhanja.hxx>
+
+namespace com { namespace sun { namespace star { namespace linguistic2
+{
+ class XThesaurus;
+ class XHyphenator;
+} } } }
+
+class Window;
+class ResId;
+class Link;
+class SvxSpellWrapper;
+
+class AbstractThesaurusDialog : public VclAbstractDialog
+{
+public:
+ virtual String GetWord() = 0;
+ virtual sal_uInt16 GetLanguage() const = 0;
+ virtual Window* GetWindow() = 0;
+};
+
+class AbstractHyphenWordDialog : public VclAbstractDialog
+{
+public:
+ virtual void SelLeft() = 0;
+ virtual void SelRight() = 0;
+ virtual Window* GetWindow() = 0;
+};
+
+class AbstractHangulHanjaConversionDialog : public VclAbstractTerminatedDialog
+{
+ public:
+ virtual void EnableRubySupport( bool _bVal ) = 0;
+ virtual void SetByCharacter( bool _bByCharacter ) = 0;
+ virtual void SetConversionDirectionState( bool _bTryBothDirections, editeng::HangulHanjaConversion::ConversionDirection _ePrimaryConversionDirection ) = 0;
+ virtual void SetConversionFormat( editeng::HangulHanjaConversion::ConversionFormat _eType ) = 0;
+ virtual void SetOptionsChangedHdl( const Link& _rHdl ) = 0;
+ virtual void SetIgnoreHdl( const Link& _rHdl ) = 0;
+ virtual void SetIgnoreAllHdl( const Link& _rHdl ) = 0;
+ virtual void SetChangeHdl( const Link& _rHdl ) = 0;
+ virtual void SetChangeAllHdl( const Link& _rHdl ) = 0;
+ virtual void SetClickByCharacterHdl( const Link& _rHdl ) = 0;
+ virtual void SetConversionFormatChangedHdl( const Link& _rHdl ) = 0;
+ virtual void SetFindHdl( const Link& _rHdl ) = 0;
+ virtual bool GetUseBothDirections() const= 0;
+ virtual editeng::HangulHanjaConversion::ConversionDirection GetDirection( editeng::HangulHanjaConversion::ConversionDirection _eDefaultDirection ) const = 0;
+ virtual void SetCurrentString(
+ const String& _rNewString,
+ const ::com::sun::star::uno::Sequence< OUString >& _rSuggestions,
+ bool _bOriginatesFromDocument = true )=0;
+ virtual String GetCurrentString( ) const =0;
+ virtual editeng::HangulHanjaConversion::ConversionFormat GetConversionFormat( ) const =0;
+ virtual void FocusSuggestion( )= 0;
+ virtual String GetCurrentSuggestion( ) const =0;
+};
+
+class EDITENG_DLLPUBLIC EditAbstractDialogFactory : virtual public VclAbstractDialogFactory
+{
+public:
+ virtual ~EditAbstractDialogFactory(); // needed for export of vtable
+ static EditAbstractDialogFactory* Create();
+ virtual AbstractThesaurusDialog* CreateThesaurusDialog( Window*, ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XThesaurus > xThesaurus,
+ const String &rWord, sal_Int16 nLanguage ) = 0;
+
+ virtual AbstractHyphenWordDialog* CreateHyphenWordDialog( Window*,
+ const String &rWord, LanguageType nLang,
+ ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenator > &xHyphen,
+ SvxSpellWrapper* pWrapper ) = 0;
+ virtual AbstractHangulHanjaConversionDialog * CreateHangulHanjaConversionDialog( Window* _pParent,
+ editeng::HangulHanjaConversion::ConversionDirection _ePrimaryDirection ) = 0;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/eedata.hxx b/include/editeng/eedata.hxx
new file mode 100644
index 000000000000..1332c56f4a54
--- /dev/null
+++ b/include/editeng/eedata.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _EEDATA_HXX
+#define _EEDATA_HXX
+
+//////////////////////////////////////////////////////////////////////////////
+// extended data definitions for EditEngine portion stripping (StripPortions()
+// support). These may be mapped to some primitive definitions from Drawinglayer
+// later.
+#include <vector>
+
+namespace EEngineData
+{
+ // spell checking wrong vector containing the redlining data
+ class WrongSpellClass
+ {
+ public:
+ sal_uInt32 nStart;
+ sal_uInt32 nEnd;
+
+ WrongSpellClass(sal_uInt32 nS, sal_uInt32 nE) : nStart(nS), nEnd(nE) {}
+ };
+
+ typedef std::vector< WrongSpellClass > WrongSpellVector;
+
+ // text marking vector containing the EOC, EOW and EOS TEXT definitions
+ enum TextMarkingType
+ {
+ EndOfCaracter = 0,
+ EndOfWord = 1,
+ EndOfSentence = 2
+ };
+
+ class TextMarkingClass
+ {
+ public:
+ TextMarkingType eType;
+ sal_uInt32 nIndex;
+
+ TextMarkingClass(TextMarkingType eT, sal_uInt32 nI) : eType(eT), nIndex(nI) {}
+ };
+
+ typedef std::vector< TextMarkingClass > TextMarkingVector;
+
+} // end of namespace EditEngine
+
+#endif // _EEDATA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/eeitem.hxx b/include/editeng/eeitem.hxx
new file mode 100644
index 000000000000..04ce68ce1ef5
--- /dev/null
+++ b/include/editeng/eeitem.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef EEITEM_HXX
+#define EEITEM_HXX
+
+#include <svl/solar.hrc>
+
+#define EE_ITEMS_START (OWN_ATTR_VALUE_END+1)
+
+// Paragraph attributes:
+#define EE_PARA_START (EE_ITEMS_START+0)
+#define EE_PARA_WRITINGDIR (EE_ITEMS_START+0)
+#define EE_PARA_XMLATTRIBS (EE_ITEMS_START+1)
+#define EE_PARA_HANGINGPUNCTUATION (EE_ITEMS_START+2)
+#define EE_PARA_FORBIDDENRULES (EE_ITEMS_START+3)
+#define EE_PARA_ASIANCJKSPACING (EE_ITEMS_START+4)
+#define EE_PARA_NUMBULLET (EE_ITEMS_START+5)
+#define EE_PARA_HYPHENATE (EE_ITEMS_START+6)
+#define EE_PARA_BULLETSTATE (EE_ITEMS_START+7)
+#define EE_PARA_OUTLLRSPACE (EE_ITEMS_START+8)
+#define EE_PARA_OUTLLEVEL (EE_ITEMS_START+9)
+#define EE_PARA_BULLET (EE_ITEMS_START+10)
+#define EE_PARA_LRSPACE (EE_ITEMS_START+11)
+#define EE_PARA_ULSPACE (EE_ITEMS_START+12)
+#define EE_PARA_SBL (EE_ITEMS_START+13)
+#define EE_PARA_JUST (EE_ITEMS_START+14)
+#define EE_PARA_TABS (EE_ITEMS_START+15)
+#define EE_PARA_JUST_METHOD (EE_ITEMS_START+16)
+#define EE_PARA_VER_JUST (EE_ITEMS_START+17)
+#define EE_PARA_END (EE_ITEMS_START+17)
+
+// Character attributes:
+#define EE_CHAR_START (EE_ITEMS_START+18)
+#define EE_CHAR_COLOR (EE_ITEMS_START+18)
+#define EE_CHAR_FONTINFO (EE_ITEMS_START+19)
+#define EE_CHAR_FONTHEIGHT (EE_ITEMS_START+20)
+#define EE_CHAR_FONTWIDTH (EE_ITEMS_START+21)
+#define EE_CHAR_WEIGHT (EE_ITEMS_START+22)
+#define EE_CHAR_UNDERLINE (EE_ITEMS_START+23)
+#define EE_CHAR_STRIKEOUT (EE_ITEMS_START+24)
+#define EE_CHAR_ITALIC (EE_ITEMS_START+25)
+#define EE_CHAR_OUTLINE (EE_ITEMS_START+26)
+#define EE_CHAR_SHADOW (EE_ITEMS_START+27)
+#define EE_CHAR_ESCAPEMENT (EE_ITEMS_START+28)
+#define EE_CHAR_PAIRKERNING (EE_ITEMS_START+29)
+#define EE_CHAR_KERNING (EE_ITEMS_START+30)
+#define EE_CHAR_WLM (EE_ITEMS_START+31)
+#define EE_CHAR_LANGUAGE (EE_ITEMS_START+32)
+#define EE_CHAR_LANGUAGE_CJK (EE_ITEMS_START+33)
+#define EE_CHAR_LANGUAGE_CTL (EE_ITEMS_START+34)
+#define EE_CHAR_FONTINFO_CJK (EE_ITEMS_START+35)
+#define EE_CHAR_FONTINFO_CTL (EE_ITEMS_START+36)
+#define EE_CHAR_FONTHEIGHT_CJK (EE_ITEMS_START+37)
+#define EE_CHAR_FONTHEIGHT_CTL (EE_ITEMS_START+38)
+#define EE_CHAR_WEIGHT_CJK (EE_ITEMS_START+39)
+#define EE_CHAR_WEIGHT_CTL (EE_ITEMS_START+40)
+#define EE_CHAR_ITALIC_CJK (EE_ITEMS_START+41)
+#define EE_CHAR_ITALIC_CTL (EE_ITEMS_START+42)
+#define EE_CHAR_EMPHASISMARK (EE_ITEMS_START+43)
+#define EE_CHAR_RELIEF (EE_ITEMS_START+44)
+#define EE_CHAR_RUBI_DUMMY (EE_ITEMS_START+45)
+#define EE_CHAR_XMLATTRIBS (EE_ITEMS_START+46)
+#define EE_CHAR_OVERLINE (EE_ITEMS_START+47)
+#define EE_CHAR_END (EE_ITEMS_START+47)
+
+
+#define EE_FEATURE_START (EE_ITEMS_START+48)
+#define EE_FEATURE_TAB (EE_ITEMS_START+48)
+#define EE_FEATURE_LINEBR (EE_ITEMS_START+49)
+#define EE_FEATURE_NOTCONV (EE_ITEMS_START+50)
+#define EE_FEATURE_FIELD (EE_ITEMS_START+51)
+#define EE_FEATURE_END (EE_ITEMS_START+51)
+
+#define EE_ITEMS_END (EE_ITEMS_START+51)
+
+#define EDITITEMCOUNT ( EE_ITEMS_END - EE_ITEMS_START + 1 )
+
+#endif // _EEITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/eeitemid.hxx b/include/editeng/eeitemid.hxx
new file mode 100644
index 000000000000..8230387048ff
--- /dev/null
+++ b/include/editeng/eeitemid.hxx
@@ -0,0 +1,129 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _EEITEMID_HXX
+#define _EEITEMID_HXX
+
+#include <editeng/eeitem.hxx>
+
+#ifdef ITEMID_FONT
+#undef ITEMID_FONT
+#endif
+#ifdef ITEMID_FONTHEIGHT
+#undef ITEMID_FONTHEIGHT
+#endif
+#ifdef ITEMID_COLOR
+#undef ITEMID_COLOR
+#endif
+#ifdef ITEMID_WEIGHT
+#undef ITEMID_WEIGHT
+#endif
+#ifdef ITEMID_POSTURE
+#undef ITEMID_POSTURE
+#endif
+#ifdef ITEMID_SHADOWED
+#undef ITEMID_SHADOWED
+#endif
+#ifdef ITEMID_CONTOUR
+#undef ITEMID_CONTOUR
+#endif
+#ifdef ITEMID_CROSSEDOUT
+#undef ITEMID_CROSSEDOUT
+#endif
+#ifdef ITEMID_UNDERLINE
+#undef ITEMID_UNDERLINE
+#endif
+#ifdef ITEMID_OVERLINE
+#undef ITEMID_OVERLINE
+#endif
+#ifdef ITEMID_LANGUAGE
+#undef ITEMID_LANGUAGE
+#endif
+#ifdef ITEMID_ADJUST
+#undef ITEMID_ADJUST
+#endif
+#ifdef ITEMID_WORDLINEMODE
+#undef ITEMID_WORDLINEMODE
+#endif
+#ifdef ITEMID_CHARSETCOLOR
+#undef ITEMID_CHARSETCOLOR
+#endif
+#ifdef ITEMID_SEARCH
+#undef ITEMID_SEARCH
+#endif
+#ifdef ITEMID_BRUSH
+#undef ITEMID_BRUSH
+#endif
+
+// Character Attributes....
+#define ITEMID_FONT EE_CHAR_FONTINFO
+#define ITEMID_POSTURE EE_CHAR_ITALIC
+#define ITEMID_WEIGHT EE_CHAR_WEIGHT
+#define ITEMID_SHADOWED EE_CHAR_SHADOW
+#define ITEMID_CONTOUR EE_CHAR_OUTLINE
+#define ITEMID_CROSSEDOUT EE_CHAR_STRIKEOUT
+#define ITEMID_UNDERLINE EE_CHAR_UNDERLINE
+#define ITEMID_OVERLINE EE_CHAR_OVERLINE
+#define ITEMID_FONTHEIGHT EE_CHAR_FONTHEIGHT
+#define ITEMID_CHARSCALE_W EE_CHAR_FONTWIDTH
+#define ITEMID_COLOR EE_CHAR_COLOR
+#define ITEMID_WORDLINEMODE EE_CHAR_WLM
+#define ITEMID_PROPSIZE 0
+#define ITEMID_CHARSETCOLOR 0 // EE_FEATURE_NOTCONV
+#define ITEMID_CASEMAP 0
+#define ITEMID_LANGUAGE 0
+#define ITEMID_ESCAPEMENT EE_CHAR_ESCAPEMENT
+#define ITEMID_NOLINEBREAK 0
+#define ITEMID_NOHYPHENHERE 0
+#define ITEMID_AUTOKERN EE_CHAR_PAIRKERNING
+#define ITEMID_KERNING EE_CHAR_KERNING
+#define ITEMID_EMPHASISMARK EE_CHAR_EMPHASISMARK
+#define ITEMID_CHARRELIEF EE_CHAR_RELIEF
+
+// Paragraph Attributes
+#define ITEMID_SCRIPTSPACE EE_PARA_ASIANCJKSPACING
+#define ITEMID_ADJUST EE_PARA_JUST
+#define ITEMID_LINESPACING EE_PARA_SBL
+#define ITEMID_WIDOWS 0
+#define ITEMID_ORPHANS 0
+#define ITEMID_HYPHENZONE 0
+
+#define ITEMID_TABSTOP EE_PARA_TABS
+
+#define ITEMID_PAPERBIN 0
+#define ITEMID_LRSPACE EE_PARA_LRSPACE
+#define ITEMID_ULSPACE EE_PARA_ULSPACE
+#define ITEMID_FRAMEDIR EE_PARA_WRITINGDIR
+#define ITEMID_PRINT 0
+#define ITEMID_OPAQUE 0
+#define ITEMID_PROTECT 0
+#define ITEMID_BACKGROUND 0
+#define ITEMID_SHADOW 0
+#define ITEMID_MACRO 0
+#define ITEMID_BOX 0
+#define ITEMID_BOXINFO 0
+#define ITEMID_BRUSH 0
+
+#define ITEMID_FIELD EE_FEATURE_FIELD
+
+#define ITEMID_SEARCH 0
+
+#endif //_EEITEMID_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/eerdll.hxx b/include/editeng/eerdll.hxx
new file mode 100644
index 000000000000..2d6ba34976fa
--- /dev/null
+++ b/include/editeng/eerdll.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _EERDLL_HXX
+#define _EERDLL_HXX
+
+class GlobalEditData;
+
+#include <tools/resid.hxx>
+#include <tools/shl.hxx>
+#include <editeng/editengdllapi.h>
+
+class EDITENG_DLLPUBLIC EditResId: public ResId
+{
+public:
+ EditResId( sal_uInt16 nId );
+};
+
+class EditDLL
+{
+ ResMgr* pResMgr;
+ GlobalEditData* pGlobalData;
+
+public:
+ EditDLL();
+ ~EditDLL();
+
+ ResMgr* GetResMgr() const { return pResMgr; }
+ GlobalEditData* GetGlobalData() const { return pGlobalData; }
+ static EditDLL& Get();
+};
+
+#define EE_DLL() EditDLL::Get()
+
+#define EE_RESSTR(x) EditResId(x).toString()
+
+#endif //_EERDLL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/emphasismarkitem.hxx b/include/editeng/emphasismarkitem.hxx
new file mode 100644
index 000000000000..1be4b0a7ce7d
--- /dev/null
+++ b/include/editeng/emphasismarkitem.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_EMPHITEM_HXX
+#define _SVX_EMPHITEM_HXX
+
+#include <vcl/vclenum.hxx>
+#include <svl/intitem.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxEmphasisMarkItem ----------------------------------------------
+
+/* [Description]
+
+ This item describes the Font emphasis.
+*/
+
+class EDITENG_DLLPUBLIC SvxEmphasisMarkItem : public SfxUInt16Item
+{
+public:
+ TYPEINFO();
+
+ SvxEmphasisMarkItem( const FontEmphasisMark eVal /*= EMPHASISMARK_NONE*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem + SfxEnumItem
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ inline SvxEmphasisMarkItem& operator=(const SvxEmphasisMarkItem& rItem )
+ {
+ SetValue( rItem.GetValue() );
+ return *this;
+ }
+
+ // enum cast
+ FontEmphasisMark GetEmphasisMark() const
+ { return (FontEmphasisMark)GetValue(); }
+ void SetEmphasisMark( FontEmphasisMark eNew )
+ { SetValue( (sal_uInt16)eNew ); }
+};
+
+#endif // #ifndef _SVX_EMPHITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/escapementitem.hxx b/include/editeng/escapementitem.hxx
new file mode 100644
index 000000000000..53fcb736f971
--- /dev/null
+++ b/include/editeng/escapementitem.hxx
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_ESCPITEM_HXX
+#define _SVX_ESCPITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/svxenum.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxEscapementItem -----------------------------------------------
+
+#define DFLT_ESC_SUPER 33 // 1/3
+#define DFLT_ESC_SUB -33 // also 1/3 previously 8/100
+#define DFLT_ESC_PROP 58
+#define DFLT_ESC_AUTO_SUPER 101
+#define DFLT_ESC_AUTO_SUB -101
+
+/* [Description]
+
+ This item describes the writing position.
+*/
+
+class EDITENG_DLLPUBLIC SvxEscapementItem : public SfxEnumItemInterface
+{
+ short nEsc;
+ sal_uInt8 nProp;
+public:
+ TYPEINFO();
+
+ explicit SvxEscapementItem( const sal_uInt16 nId );
+ SvxEscapementItem( const SvxEscapement eEscape,
+ const sal_uInt16 nId );
+ SvxEscapementItem( const short nEsc, const sal_uInt8 nProp,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+
+ inline void SetEscapement( const SvxEscapement eNew )
+ {
+ if( SVX_ESCAPEMENT_OFF == eNew )
+ nEsc = 0, nProp = 100;
+ else
+ if( SVX_ESCAPEMENT_SUPERSCRIPT == eNew )
+ nEsc = DFLT_ESC_SUPER, nProp = DFLT_ESC_PROP;
+ else
+ nEsc = DFLT_ESC_SUB, nProp = DFLT_ESC_PROP;
+ }
+ inline SvxEscapement GetEscapement() const { return static_cast< SvxEscapement >( GetEnumValue() ); }
+
+ inline short &GetEsc() { return nEsc; }
+ inline short GetEsc() const { return nEsc; }
+
+ inline sal_uInt8 &GetProp() { return nProp; }
+ inline sal_uInt8 GetProp() const { return nProp; }
+
+ inline SvxEscapementItem& operator=(const SvxEscapementItem& rEsc)
+ {
+ nEsc = rEsc.GetEsc();
+ nProp = rEsc.GetProp();
+ return *this;
+ }
+
+ virtual sal_uInt16 GetValueCount() const;
+ virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const;
+ virtual sal_uInt16 GetEnumValue() const;
+ virtual void SetEnumValue( sal_uInt16 nNewVal );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/fhgtitem.hxx b/include/editeng/fhgtitem.hxx
new file mode 100644
index 000000000000..60f417428827
--- /dev/null
+++ b/include/editeng/fhgtitem.hxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_FHGTITEM_HXX
+#define _SVX_FHGTITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxFontHeightItem -----------------------------------------------
+
+// Warning: twips values
+
+/* [Description]
+
+ This item describes the font height
+*/
+
+#define FONTHEIGHT_16_VERSION ((sal_uInt16)0x0001)
+#define FONTHEIGHT_UNIT_VERSION ((sal_uInt16)0x0002)
+
+class EDITENG_DLLPUBLIC SvxFontHeightItem : public SfxPoolItem
+{
+ sal_uInt32 nHeight;
+ sal_uInt16 nProp; // default 100%
+ SfxMapUnit ePropUnit; // Percent, Twip, ...
+public:
+ TYPEINFO();
+
+ SvxFontHeightItem( const sal_uLong nSz /*= 240*/, const sal_uInt16 nPropHeight /*= 100*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nItemVersion) const;
+ virtual bool ScaleMetrics( long nMult, long nDiv );
+ virtual bool HasMetrics() const;
+
+ inline SvxFontHeightItem& operator=(const SvxFontHeightItem& rSize)
+ {
+ SetHeightValue( rSize.GetHeight() );
+ SetProp( rSize.GetProp(), ePropUnit );
+ return *this;
+ }
+
+ void SetHeight( sal_uInt32 nNewHeight, const sal_uInt16 nNewProp = 100,
+ SfxMapUnit eUnit = SFX_MAPUNIT_RELATIVE );
+
+ void SetHeight( sal_uInt32 nNewHeight, sal_uInt16 nNewProp,
+ SfxMapUnit eUnit, SfxMapUnit eCoreUnit );
+
+ sal_uInt32 GetHeight() const { return nHeight; }
+
+ void SetHeightValue( sal_uInt32 nNewHeight )
+ {
+ DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
+ nHeight = nNewHeight;
+ }
+
+ void SetProp( const sal_uInt16 nNewProp,
+ SfxMapUnit eUnit = SFX_MAPUNIT_RELATIVE )
+ {
+ DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
+ nProp = nNewProp;
+ ePropUnit = eUnit;
+ }
+
+ sal_uInt16 GetProp() const { return nProp; }
+
+ SfxMapUnit GetPropUnit() const { return ePropUnit; } // Percent, Twip, ...
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/fieldupdater.hxx b/include/editeng/fieldupdater.hxx
new file mode 100644
index 000000000000..8ddab5ecf91e
--- /dev/null
+++ b/include/editeng/fieldupdater.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef __EDITENG_FIELDUPDATER_HXX__
+#define __EDITENG_FIELDUPDATER_HXX__
+
+#include "editengdllapi.h"
+
+class EditTextObject;
+
+namespace editeng {
+
+class FieldUpdaterImpl;
+
+/**
+ * Wrapper for EditTextObject to handle updating of fields without exposing
+ * the internals of EditTextObject structure.
+ */
+class EDITENG_DLLPUBLIC FieldUpdater
+{
+ FieldUpdaterImpl* mpImpl;
+
+ FieldUpdater(); // disabled
+public:
+ FieldUpdater(EditTextObject& rObj);
+ FieldUpdater(const FieldUpdater& r);
+ ~FieldUpdater();
+
+ /**
+ * Set a new table ID to all table fields.
+ *
+ * @param nTab new table ID
+ */
+ void updateTableFields(int nTab);
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/flditem.hxx b/include/editeng/flditem.hxx
new file mode 100644
index 000000000000..37f42a37c217
--- /dev/null
+++ b/include/editeng/flditem.hxx
@@ -0,0 +1,420 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_FLDITEM_HXX
+#define _SVX_FLDITEM_HXX
+
+#include <i18nlangtag/lang.h>
+#include <tools/time.hxx>
+#include <tools/date.hxx>
+#include <svl/poolitem.hxx>
+#include <tools/pstm.hxx>
+#include "editeng/editengdllapi.h"
+
+#include <com/sun/star/text/textfield/Type.hpp>
+
+#include <boost/noncopyable.hpp>
+
+namespace com { namespace sun { namespace star { namespace text {
+
+class XTextContent;
+
+}}}}
+
+class SvNumberFormatter;
+class MetaAction;
+
+// class SvxFieldItem ---------------------------------------------------
+
+
+
+class EDITENG_DLLPUBLIC SvxFieldData : public SvPersistBase
+{
+public:
+ static const sal_Int32 UNKNOWN_FIELD;
+
+ static SvxFieldData* Create(const com::sun::star::uno::Reference<com::sun::star::text::XTextContent>& xContent);
+
+ SV_DECL_PERSIST1( SvxFieldData, SvPersistBase, com::sun::star::text::textfield::Type::UNSPECIFIED)
+
+ SvxFieldData();
+ virtual ~SvxFieldData();
+
+ virtual SvxFieldData* Clone() const;
+ virtual int operator==( const SvxFieldData& ) const;
+
+ virtual MetaAction* createBeginComment() const;
+ virtual MetaAction* createEndComment() const;
+};
+
+/**
+ * This item stores a field (SvxFieldData). The field is controlled by or
+ * belongs to the item. The field itself is determined by a derivation from
+ * SvxFieldData (RTTI)
+ */
+class EDITENG_DLLPUBLIC SvxFieldItem : public SfxPoolItem
+{
+private:
+ SvxFieldData* pField;
+
+ EDITENG_DLLPRIVATE SvxFieldItem( SvxFieldData* pField, const sal_uInt16 nId );
+
+public:
+ TYPEINFO();
+
+ SvxFieldItem( const SvxFieldData& rField, const sal_uInt16 nId );
+ SvxFieldItem( const SvxFieldItem& rItem );
+ ~SvxFieldItem();
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream&, sal_uInt16 nVer ) const;
+ virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const;
+
+ const SvxFieldData* GetField() const { return pField; }
+ static SvClassManager& GetClassManager();
+};
+
+// =================================================================
+// The following are the derivatives of SvxFieldData ...
+// =================================================================
+
+enum SvxDateType { SVXDATETYPE_FIX, SVXDATETYPE_VAR };
+enum SvxDateFormat { SVXDATEFORMAT_APPDEFAULT = 0, // Set as in App
+ SVXDATEFORMAT_SYSTEM, // Set as in System
+ SVXDATEFORMAT_STDSMALL,
+ SVXDATEFORMAT_STDBIG,
+ SVXDATEFORMAT_A, // 13.02.96
+ SVXDATEFORMAT_B, // 13.02.1996
+ SVXDATEFORMAT_C, // 13.Feb 1996
+ SVXDATEFORMAT_D, // 13.February 1996
+ SVXDATEFORMAT_E, // Tue, 13.February 1996
+ SVXDATEFORMAT_F // Tuesday, 13.February 1996
+ };
+
+class EDITENG_DLLPUBLIC SvxDateField : public SvxFieldData
+{
+ sal_uInt32 nFixDate;
+ SvxDateType eType;
+ SvxDateFormat eFormat;
+
+public:
+ SV_DECL_PERSIST1( SvxDateField, SvxFieldData, com::sun::star::text::textfield::Type::DATE )
+
+ SvxDateField();
+ explicit SvxDateField( const Date& rDate,
+ SvxDateType eType = SVXDATETYPE_VAR,
+ SvxDateFormat eFormat = SVXDATEFORMAT_STDSMALL );
+
+ sal_uInt32 GetFixDate() const { return nFixDate; }
+ void SetFixDate( const Date& rDate ) { nFixDate = rDate.GetDate(); }
+
+ SvxDateType GetType() const { return eType; }
+ void SetType( SvxDateType eTp ) { eType = eTp; }
+
+ SvxDateFormat GetFormat() const { return eFormat; }
+ void SetFormat( SvxDateFormat eFmt ) { eFormat = eFmt; }
+
+ // If eLanguage==LANGUAGE_DONTKNOW the language/country
+ // used in number formatter initialization is taken.
+ OUString GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLanguage ) const;
+ static OUString GetFormatted( Date& rDate, SvxDateFormat eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage );
+
+ virtual SvxFieldData* Clone() const;
+ virtual int operator==( const SvxFieldData& ) const;
+
+ virtual MetaAction* createBeginComment() const;
+};
+
+
+enum SvxURLFormat { SVXURLFORMAT_APPDEFAULT = 0, // Set as in App
+ SVXURLFORMAT_URL, // Represent URL
+ SVXURLFORMAT_REPR // Constitute repraesentation
+ };
+
+class EDITENG_DLLPUBLIC SvxURLField : public SvxFieldData
+{
+private:
+ SvxURLFormat eFormat;
+ OUString aURL; // URL-Address
+ OUString aRepresentation; // What is shown
+ OUString aTargetFrame; // In what Frame
+
+public:
+ SV_DECL_PERSIST1( SvxURLField, SvxFieldData, com::sun::star::text::textfield::Type::URL )
+
+ SvxURLField();
+ SvxURLField( const OUString& rURL, const OUString& rRepres, SvxURLFormat eFmt = SVXURLFORMAT_URL );
+
+ const OUString& GetURL() const { return aURL; }
+ void SetURL( const OUString& rURL ) { aURL = rURL; }
+
+ const OUString& GetRepresentation() const { return aRepresentation; }
+ void SetRepresentation( const OUString& rRep ) { aRepresentation= rRep; }
+
+ const OUString& GetTargetFrame() const { return aTargetFrame; }
+ void SetTargetFrame( const OUString& rFrm ) { aTargetFrame = rFrm; }
+
+ SvxURLFormat GetFormat() const { return eFormat; }
+ void SetFormat( SvxURLFormat eFmt ) { eFormat = eFmt; }
+
+ virtual SvxFieldData* Clone() const;
+ virtual int operator==( const SvxFieldData& ) const;
+
+ virtual MetaAction* createBeginComment() const;
+};
+
+class EDITENG_DLLPUBLIC SvxPageField : public SvxFieldData
+{
+public:
+ SV_DECL_PERSIST1( SvxPageField, SvxFieldData, com::sun::star::text::textfield::Type::PAGE )
+ SvxPageField();
+
+ virtual SvxFieldData* Clone() const;
+ virtual int operator==( const SvxFieldData& ) const;
+
+ virtual MetaAction* createBeginComment() const;
+};
+
+class EDITENG_DLLPUBLIC SvxPagesField : public SvxFieldData
+{
+public:
+ SV_DECL_PERSIST1( SvxPagesField, SvxFieldData, com::sun::star::text::textfield::Type::PAGES )
+ SvxPagesField();
+
+ virtual SvxFieldData* Clone() const;
+ virtual int operator==( const SvxFieldData& ) const;
+};
+
+class EDITENG_DLLPUBLIC SvxTimeField : public SvxFieldData
+{
+public:
+ SV_DECL_PERSIST1( SvxTimeField, SvxFieldData, com::sun::star::text::textfield::Type::TIME )
+ SvxTimeField();
+
+ virtual SvxFieldData* Clone() const;
+ virtual int operator==( const SvxFieldData& ) const;
+
+ virtual MetaAction* createBeginComment() const;
+};
+
+class EDITENG_DLLPUBLIC SvxFileField : public SvxFieldData
+{
+public:
+ SV_DECL_PERSIST1( SvxFileField, SvxFieldData, com::sun::star::text::textfield::Type::DOCINFO_TITLE )
+ SvxFileField();
+
+ virtual SvxFieldData* Clone() const;
+ virtual int operator==( const SvxFieldData& ) const;
+};
+
+class EDITENG_DLLPUBLIC SvxTableField : public SvxFieldData
+{
+ int mnTab;
+public:
+ SV_DECL_PERSIST1( SvxTableField, SvxFieldData, com::sun::star::text::textfield::Type::TABLE )
+ SvxTableField();
+ explicit SvxTableField(int nTab);
+
+ void SetTab(int nTab);
+ int GetTab() const;
+
+ virtual SvxFieldData* Clone() const;
+ virtual int operator==( const SvxFieldData& ) const;
+};
+
+
+enum SvxTimeType { SVXTIMETYPE_FIX, SVXTIMETYPE_VAR };
+enum SvxTimeFormat { SVXTIMEFORMAT_APPDEFAULT = 0, // Set as in App
+ SVXTIMEFORMAT_SYSTEM, // Set as in System
+ SVXTIMEFORMAT_STANDARD,
+ SVXTIMEFORMAT_24_HM, // 13:49
+ SVXTIMEFORMAT_24_HMS, // 13:49:38
+ SVXTIMEFORMAT_24_HMSH, // 13:49:38.78
+ SVXTIMEFORMAT_12_HM, // 01:49
+ SVXTIMEFORMAT_12_HMS, // 01:49:38
+ SVXTIMEFORMAT_12_HMSH, // 01:49:38.78
+ SVXTIMEFORMAT_AM_HM, // 01:49 PM
+ SVXTIMEFORMAT_AM_HMS, // 01:49:38 PM
+ SVXTIMEFORMAT_AM_HMSH // 01:49:38.78 PM
+ };
+
+class EDITENG_DLLPUBLIC SvxExtTimeField : public SvxFieldData
+{
+private:
+ sal_uInt32 nFixTime;
+ SvxTimeType eType;
+ SvxTimeFormat eFormat;
+
+public:
+ SV_DECL_PERSIST1( SvxExtTimeField, SvxFieldData, com::sun::star::text::textfield::Type::EXTENDED_TIME )
+ SvxExtTimeField();
+ explicit SvxExtTimeField( const Time& rTime,
+ SvxTimeType eType = SVXTIMETYPE_VAR,
+ SvxTimeFormat eFormat = SVXTIMEFORMAT_STANDARD );
+
+ sal_uInt32 GetFixTime() const { return nFixTime; }
+ void SetFixTime( const Time& rTime ) { nFixTime = rTime.GetTime(); }
+
+ SvxTimeType GetType() const { return eType; }
+ void SetType( SvxTimeType eTp ) { eType = eTp; }
+
+ SvxTimeFormat GetFormat() const { return eFormat; }
+ void SetFormat( SvxTimeFormat eFmt ) { eFormat = eFmt; }
+
+ // If eLanguage==LANGUAGE_DONTKNOW the language/country
+ // used in number formatter initialization is taken.
+ OUString GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLanguage ) const;
+ static OUString GetFormatted( Time& rTime, SvxTimeFormat eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage );
+
+ virtual SvxFieldData* Clone() const;
+ virtual int operator==( const SvxFieldData& ) const;
+
+ virtual MetaAction* createBeginComment() const;
+};
+
+
+enum SvxFileType { SVXFILETYPE_FIX, SVXFILETYPE_VAR };
+enum SvxFileFormat { SVXFILEFORMAT_NAME_EXT = 0, // File name with Extension
+ SVXFILEFORMAT_FULLPATH, // full path
+ SVXFILEFORMAT_PATH, // only path
+ SVXFILEFORMAT_NAME // only file name
+ };
+
+
+
+class EDITENG_DLLPUBLIC SvxExtFileField : public SvxFieldData
+{
+private:
+ OUString aFile;
+ SvxFileType eType;
+ SvxFileFormat eFormat;
+
+public:
+ SV_DECL_PERSIST1( SvxExtFileField, SvxFieldData, com::sun::star::text::textfield::Type::EXTENDED_FILE )
+ SvxExtFileField();
+ explicit SvxExtFileField( const OUString& rString,
+ SvxFileType eType = SVXFILETYPE_VAR,
+ SvxFileFormat eFormat = SVXFILEFORMAT_FULLPATH );
+
+ OUString GetFile() const { return aFile; }
+ void SetFile( const OUString& rString ) { aFile = rString; }
+
+ SvxFileType GetType() const { return eType; }
+ void SetType( SvxFileType eTp ) { eType = eTp; }
+
+ SvxFileFormat GetFormat() const { return eFormat; }
+ void SetFormat( SvxFileFormat eFmt ) { eFormat = eFmt; }
+
+ OUString GetFormatted() const;
+
+ virtual SvxFieldData* Clone() const;
+ virtual int operator==( const SvxFieldData& ) const;
+};
+
+
+enum SvxAuthorType { SVXAUTHORTYPE_FIX, SVXAUTHORTYPE_VAR };
+enum SvxAuthorFormat { SVXAUTHORFORMAT_FULLNAME = 0, // full name
+ SVXAUTHORFORMAT_NAME, // Only Last name
+ SVXAUTHORFORMAT_FIRSTNAME, // Only first name
+ SVXAUTHORFORMAT_SHORTNAME // Initials
+ };
+
+class EDITENG_DLLPUBLIC SvxAuthorField : public SvxFieldData
+{
+private:
+ OUString aName;
+ OUString aFirstName;
+ OUString aShortName;
+ SvxAuthorType eType;
+ SvxAuthorFormat eFormat;
+
+public:
+ SV_DECL_PERSIST1( SvxAuthorField, SvxFieldData, com::sun::star::text::textfield::Type::AUTHOR )
+ SvxAuthorField();
+ SvxAuthorField(
+ const OUString& rFirstName,
+ const OUString& rLastName,
+ const OUString& rShortName,
+ SvxAuthorType eType = SVXAUTHORTYPE_VAR,
+ SvxAuthorFormat eFormat = SVXAUTHORFORMAT_FULLNAME );
+
+ OUString GetName() const { return aName; }
+ void SetName( const OUString& rString ) { aName = rString; }
+
+ OUString GetFirstName() const { return aFirstName; }
+ void SetFirstName( const OUString& rString ) { aFirstName = rString; }
+
+ OUString GetShortName() const { return aShortName; }
+ void SetShortName( const OUString& rString ) { aShortName = rString; }
+
+ SvxAuthorType GetType() const { return eType; }
+ void SetType( SvxAuthorType eTp ) { eType = eTp; }
+
+ SvxAuthorFormat GetFormat() const { return eFormat; }
+ void SetFormat( SvxAuthorFormat eFmt ) { eFormat = eFmt; }
+
+ OUString GetFormatted() const;
+
+ virtual SvxFieldData* Clone() const;
+ virtual int operator==( const SvxFieldData& ) const;
+};
+
+/** this field is used as a placeholder for a header&footer in impress. The actual
+ value is stored at the page */
+class EDITENG_DLLPUBLIC SvxHeaderField : public SvxFieldData
+{
+public:
+ SV_DECL_PERSIST1( SvxHeaderField, SvxFieldData, com::sun::star::text::textfield::Type::PRESENTATION_HEADER )
+ SvxHeaderField();
+
+ virtual SvxFieldData* Clone() const;
+ virtual int operator==( const SvxFieldData& ) const;
+};
+
+/** this field is used as a placeholder for a header&footer in impress. The actual
+ value is stored at the page */
+class EDITENG_DLLPUBLIC SvxFooterField : public SvxFieldData
+{
+public:
+ SV_DECL_PERSIST1( SvxFooterField, SvxFieldData, com::sun::star::text::textfield::Type::PRESENTATION_FOOTER )
+ SvxFooterField();
+ virtual SvxFieldData* Clone() const;
+ virtual int operator==( const SvxFieldData& ) const;
+};
+
+/** this field is used as a placeholder for a header&footer in impress. The actual
+ value is stored at the page */
+class EDITENG_DLLPUBLIC SvxDateTimeField : public SvxFieldData
+{
+public:
+ SV_DECL_PERSIST1( SvxDateTimeField, SvxFieldData, com::sun::star::text::textfield::Type::PRESENTATION_DATE_TIME )
+ SvxDateTimeField();
+
+ static OUString GetFormatted( Date& rDate, Time& rTime, int eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage );
+
+ virtual SvxFieldData* Clone() const;
+ virtual int operator==( const SvxFieldData& ) const;
+};
+
+
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/flstitem.hxx b/include/editeng/flstitem.hxx
new file mode 100644
index 000000000000..f298732e25e4
--- /dev/null
+++ b/include/editeng/flstitem.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_FLSTITEM_HXX
+#define _SVX_FLSTITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include "editeng/editengdllapi.h"
+
+// class SvxFontListItem -------------------------------------------------
+
+class FontList;
+
+/*
+ [Description]
+
+ This item serves as a transport medium for a font list. The font list is
+ not copied and not deleted!
+*/
+
+class EDITENG_DLLPUBLIC SvxFontListItem : public SfxPoolItem
+{
+private:
+ const FontList* pFontList;
+ com::sun::star::uno::Sequence< OUString > aFontNameSeq;
+
+public:
+ TYPEINFO();
+
+ SvxFontListItem( const FontList* pFontLst,
+ const sal_uInt16 nId );
+ SvxFontListItem( const SvxFontListItem& rItem );
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ const FontList* GetFontList() const { return pFontList; }
+};
+
+
+
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/fontitem.hxx b/include/editeng/fontitem.hxx
new file mode 100644
index 000000000000..e9d14755906e
--- /dev/null
+++ b/include/editeng/fontitem.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_FONTITEM_HXX
+#define _SVX_FONTITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <tools/string.hxx>
+#include <vcl/font.hxx>
+#include "editeng/editengdllapi.h"
+
+class SvXMLUnitConverter;
+
+// class SvxFontItem -----------------------------------------------------
+
+/* [Description]
+
+ This item describes a Font.
+*/
+
+class EDITENG_DLLPUBLIC SvxFontItem : public SfxPoolItem
+{
+ String aFamilyName;
+ String aStyleName;
+ FontFamily eFamily;
+ FontPitch ePitch;
+ rtl_TextEncoding eTextEncoding;
+
+ static sal_Bool bEnableStoreUnicodeNames;
+
+public:
+ TYPEINFO();
+
+ explicit SvxFontItem( const sal_uInt16 nId );
+ SvxFontItem( const FontFamily eFam, const String& rFamilyName,
+ const String& rStyleName,
+ const FontPitch eFontPitch /*= PITCH_DONTKNOW*/,
+ const rtl_TextEncoding eFontTextEncoding /*= RTL_TEXTENCODING_DONTKNOW*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ // Access methods:
+ void SetFamilyName( const String& rFamilyName ) { aFamilyName = rFamilyName; }
+ inline const String &GetFamilyName() const { return aFamilyName; }
+
+ void SetStyleName(const String &rStyleName ) { aStyleName = rStyleName; }
+ inline const String &GetStyleName() const { return aStyleName; }
+
+ void SetFamily( FontFamily _eFamily ) { eFamily = _eFamily; }
+ inline FontFamily GetFamily() const { return eFamily; }
+
+ void SetPitch(FontPitch _ePitch ) { ePitch = _ePitch; }
+ inline FontPitch GetPitch() const { return ePitch; }
+
+ void SetCharSet(rtl_TextEncoding _eEncoding) { eTextEncoding = _eEncoding; }
+
+ inline rtl_TextEncoding GetCharSet() const { return eTextEncoding; }
+
+ SvxFontItem& operator=(const SvxFontItem& rFont);
+
+ static void EnableStoreUnicodeNames( sal_Bool bEnable );
+
+};
+
+EDITENG_DLLPUBLIC void GetDefaultFonts( SvxFontItem& rLatin, SvxFontItem& rAsian,
+ SvxFontItem& rComplex );
+
+#endif // #ifndef _SVX_FONTITEM_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/forbiddencharacterstable.hxx b/include/editeng/forbiddencharacterstable.hxx
new file mode 100644
index 000000000000..14556fd0ceda
--- /dev/null
+++ b/include/editeng/forbiddencharacterstable.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _FORBIDDENCHARACTERSTABLE_HXX
+#define _FORBIDDENCHARACTERSTABLE_HXX
+
+#include <salhelper/simplereferenceobject.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/i18n/ForbiddenCharacters.hpp>
+#include "editeng/editengdllapi.h"
+#include <map>
+
+namespace com {
+namespace sun {
+namespace star {
+namespace uno {
+ class XComponentContext;
+}}}}
+
+class EDITENG_DLLPUBLIC SvxForbiddenCharactersTable : public salhelper::SimpleReferenceObject
+{
+public:
+ typedef std::map<sal_uInt16, com::sun::star::i18n::ForbiddenCharacters> Map;
+private:
+ Map maMap;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+
+public:
+ SvxForbiddenCharactersTable( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext);
+ ~SvxForbiddenCharactersTable() {}
+
+ Map& GetMap() { return maMap; }
+ const com::sun::star::i18n::ForbiddenCharacters* GetForbiddenCharacters( sal_uInt16 nLanguage, sal_Bool bGetDefault );
+ void SetForbiddenCharacters( sal_uInt16 nLanguage , const com::sun::star::i18n::ForbiddenCharacters& );
+ void ClearForbiddenCharacters( sal_uInt16 nLanguage );
+};
+
+#endif // _FORBIDDENCHARACTERSTABLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/forbiddenruleitem.hxx b/include/editeng/forbiddenruleitem.hxx
new file mode 100644
index 000000000000..2d15a3d00bf3
--- /dev/null
+++ b/include/editeng/forbiddenruleitem.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_FORBIDDENRULEITEM_HXX
+#define _SVX_FORBIDDENRULEITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxForbiddenRuleItem -----------------------------------------
+
+/* [Description]
+
+ This item describe how to handle the last character of a line.
+*/
+
+class EDITENG_DLLPUBLIC SvxForbiddenRuleItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+
+ SvxForbiddenRuleItem( sal_Bool bOn /*= sal_False*/,
+ const sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper * = 0 ) const;
+
+ inline SvxForbiddenRuleItem& operator=(
+ const SvxForbiddenRuleItem& rItem )
+ {
+ SetValue( rItem.GetValue() );
+ return *this;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/formatbreakitem.hxx b/include/editeng/formatbreakitem.hxx
new file mode 100644
index 000000000000..229e1d05f55f
--- /dev/null
+++ b/include/editeng/formatbreakitem.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_BRKITEM_HXX
+#define _SVX_BRKITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/svxenum.hxx>
+#include <editeng/editengdllapi.h>
+
+
+// class SvxFmtBreakItem -------------------------------------------------
+
+/* [Description]
+
+ This item Describes a wrap-attribute
+ Automatic?, Page or column break, before or after?
+*/
+#define FMTBREAK_NOAUTO ((sal_uInt16)0x0001)
+
+class EDITENG_DLLPUBLIC SvxFmtBreakItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+
+ inline SvxFmtBreakItem( const SvxBreak eBrk /*= SVX_BREAK_NONE*/,
+ const sal_uInt16 nWhich );
+ inline SvxFmtBreakItem( const SvxFmtBreakItem& rBreak );
+ inline SvxFmtBreakItem& operator=( const SvxFmtBreakItem& rCpy );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+ virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+ virtual SfxPoolItem* Create( SvStream&, sal_uInt16 ) const;
+ virtual sal_uInt16 GetValueCount() const;
+
+ // MS VC4.0 messes things up
+ void SetValue( sal_uInt16 nNewVal )
+ {SfxEnumItem::SetValue(nNewVal); }
+ SvxBreak GetBreak() const { return SvxBreak( GetValue() ); }
+ void SetBreak( const SvxBreak eNew )
+ { SetValue( (sal_uInt16)eNew ); }
+};
+
+
+inline SvxFmtBreakItem::SvxFmtBreakItem( const SvxBreak eBreak,
+ const sal_uInt16 _nWhich ) :
+ SfxEnumItem( _nWhich, (sal_uInt16)eBreak )
+{}
+
+inline SvxFmtBreakItem::SvxFmtBreakItem( const SvxFmtBreakItem& rBreak ) :
+ SfxEnumItem( rBreak )
+{}
+
+inline SvxFmtBreakItem& SvxFmtBreakItem::operator=(
+ const SvxFmtBreakItem& rBreak )
+{
+ SetValue( rBreak.GetValue() );
+ return *this;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/frmdir.hxx b/include/editeng/frmdir.hxx
new file mode 100644
index 000000000000..f687c32c5610
--- /dev/null
+++ b/include/editeng/frmdir.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_FRMDIR_HXX
+#define _SVX_FRMDIR_HXX
+
+// ----------------------------------------------------------------------------
+
+/** Defines possible text directions in frames. */
+enum SvxFrameDirection
+{
+ /** Horizontal, from left to right, from top to bottom
+ (typical for western languages). */
+ FRMDIR_HORI_LEFT_TOP,
+
+ /** Horizontal, from right to left, from top to bottom
+ (typical for ararbic/hebrew languages). */
+ FRMDIR_HORI_RIGHT_TOP,
+
+ /** Vertical, from top to bottom, from right to left
+ (typical for asian languages). */
+ FRMDIR_VERT_TOP_RIGHT,
+
+ /** Vertical, from top to bottom, from left to right
+ (typical for mongol language). */
+ FRMDIR_VERT_TOP_LEFT,
+
+ /** Use the value from the environment, can only be used in frames. */
+ FRMDIR_ENVIRONMENT
+};
+
+// ----------------------------------------------------------------------------
+
+#endif // #ifndef _SVX_FRMDIR_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/frmdiritem.hxx b/include/editeng/frmdiritem.hxx
new file mode 100644
index 000000000000..6ea04dc66f09
--- /dev/null
+++ b/include/editeng/frmdiritem.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_FRMDIRITEM_HXX
+#define _SVX_FRMDIRITEM_HXX
+
+#include <svl/intitem.hxx>
+#include <editeng/frmdir.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxFrameDirectionItem ----------------------------------------------
+
+/* [Description]
+
+ This item defines a frame direction, which place the content inside
+ a frame. It exist different kind of directions which are used to the
+ layout text for Western, CJK and CTL languages.
+*/
+
+class EDITENG_DLLPUBLIC SvxFrameDirectionItem : public SfxUInt16Item
+{
+public:
+ TYPEINFO();
+
+ SvxFrameDirectionItem( SvxFrameDirection nValue /*= FRMDIR_HORI_LEFT_TOP*/,
+ sal_uInt16 nWhich );
+ virtual ~SvxFrameDirectionItem();
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream & rStrm, sal_uInt16 nIVer) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper * = 0 ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ inline SvxFrameDirectionItem& operator=( const SvxFrameDirectionItem& rItem )
+ {
+ SetValue( rItem.GetValue() );
+ return *this;
+ }
+};
+
+#endif // #ifndef _SVX_FRMDIRITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/fwdtitem.hxx b/include/editeng/fwdtitem.hxx
new file mode 100644
index 000000000000..73f897ffc06d
--- /dev/null
+++ b/include/editeng/fwdtitem.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_FWDTITEM_HXX
+#define _SVX_FWDTITEM_HXX
+
+#include <svl/poolitem.hxx>
+
+
+// class SvxFontWidthItem -----------------------------------------------
+
+
+/* [Description]
+
+ This item describes the font width.
+*/
+
+class SvxFontWidthItem : public SfxPoolItem
+{
+ sal_uInt16 nWidth; // 0 = default
+ sal_uInt16 nProp; // default 100%
+public:
+ TYPEINFO();
+
+ SvxFontWidthItem( const sal_uInt16 nSz /*= 0*/,
+ const sal_uInt16 nPropWidth /*= 100*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+ virtual bool ScaleMetrics( long nMult, long nDiv );
+ virtual bool HasMetrics() const;
+
+ inline SvxFontWidthItem& operator=(const SvxFontWidthItem& rItem )
+ {
+ SetWidthValue( rItem.GetWidth() );
+ SetProp( rItem.GetProp() );
+ return *this;
+ }
+
+ void SetWidth( sal_uInt16 nNewWidth, const sal_uInt16 nNewProp = 100 )
+ {
+ DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
+ nWidth = sal_uInt16(( (sal_uInt32)nNewWidth * nNewProp ) / 100 );
+ nProp = nNewProp;
+ }
+
+ sal_uInt16 GetWidth() const { return nWidth; }
+
+ void SetWidthValue( sal_uInt16 nNewWidth )
+ {
+ DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
+ nWidth = nNewWidth;
+ }
+
+ void SetProp( const sal_uInt16 nNewProp )
+ {
+ DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
+ nProp = nNewProp;
+ }
+
+ sal_uInt16 GetProp() const { return nProp; }
+};
+
+
+
+
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/hangulhanja.hxx b/include/editeng/hangulhanja.hxx
new file mode 100644
index 000000000000..014dc3e229a9
--- /dev/null
+++ b/include/editeng/hangulhanja.hxx
@@ -0,0 +1,288 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef SVX_HANGUL_HANJA_CONVERSION_HXX
+#define SVX_HANGUL_HANJA_CONVERSION_HXX
+
+#include <vcl/window.hxx>
+#include <memory>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include "editeng/editengdllapi.h"
+#include <i18nlangtag/mslangid.hxx>
+
+//.............................................................................
+namespace editeng
+{
+//.............................................................................
+
+ class HangulHanjaConversion_Impl;
+
+ //=========================================================================
+ //= HangulHanjaConversion
+ //=========================================================================
+ /** encapsulates Hangul-Hanja conversion functionality
+
+ <p>terminology:
+ <ul><li>A <b>text <em>portion</em></b> is some (potentially large) piece of text
+ which is to be analyzed for convertible sub-strings.</li>
+ <li>A <b>text <em>unit</em></b> is a sub string in a text portion, which is
+ to be converted as a whole.</li>
+ </ul>
+ For instance, you could have two independent selections within your document, which are then
+ two text portions. A text unit would be single Hangul/Hanja words within a portion, or even
+ single Hangul syllabills when "replace by character" is enabled.
+ </p>
+ */
+ class EDITENG_DLLPUBLIC HangulHanjaConversion
+ {
+ friend class HangulHanjaConversion_Impl;
+
+ public:
+ enum ReplacementAction
+ {
+ eExchange, // simply exchange one text with another
+ eReplacementBracketed, // keep the original, and put the replacement in brackets after it
+ eOriginalBracketed, // replace the original text, but put it in brackeds after the replacement
+ eReplacementAbove, // keep the original, and put the replacement text as ruby text above it
+ eOriginalAbove, // replace the original text, but put it as ruby text above it
+ eReplacementBelow, // keep the original, and put the replacement text as ruby text below it
+ eOriginalBelow // replace the original text, but put it as ruby text below it
+ };
+
+ enum ConversionType // does not specify direction...
+ {
+ eConvHangulHanja, // Korean Hangul/Hanja conversion
+ eConvSimplifiedTraditional // Chinese simplified / Chinese traditional conversion
+ };
+
+ // Note: conversion direction for eConvSimplifiedTraditional is
+ // specified by source language.
+ // This one is for Hangul/Hanja where source and target language
+ // are the same.
+ enum ConversionDirection
+ {
+ eHangulToHanja,
+ eHanjaToHangul
+ };
+
+ enum ConversionFormat
+ {
+ eSimpleConversion, // used for simplified / traditional Chinese as well
+ eHangulBracketed,
+ eHanjaBracketed,
+ eRubyHanjaAbove,
+ eRubyHanjaBelow,
+ eRubyHangulAbove,
+ eRubyHangulBelow
+ };
+
+ private:
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ ::std::auto_ptr< HangulHanjaConversion_Impl > m_pImpl;
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+
+ // used to set initial values of m_pImpl object from saved ones
+ static bool m_bUseSavedValues; // defines if the followng two values should be used for initialization
+ static bool m_bTryBothDirectionsSave;
+ static ConversionDirection m_ePrimaryConversionDirectionSave;
+
+ // Forbidden and not implemented.
+ HangulHanjaConversion (const HangulHanjaConversion &);
+ HangulHanjaConversion & operator= (const HangulHanjaConversion &);
+
+ public:
+ HangulHanjaConversion(
+ Window* _pUIParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::lang::Locale& _rSourceLocale,
+ const ::com::sun::star::lang::Locale& _rTargetLocale,
+ const Font* _pTargetFont,
+ sal_Int32 nOptions,
+ bool _bIsInteractive
+ );
+
+ virtual ~HangulHanjaConversion( );
+
+ // converts the whole document
+ void ConvertDocument();
+
+ LanguageType GetSourceLanguage() const;
+ LanguageType GetTargetLanguage() const;
+ const Font * GetTargetFont() const;
+ sal_Int32 GetConversionOptions() const;
+ bool IsInteractive() const;
+
+ // chinese text conversion
+ static inline bool IsSimplified( LanguageType nLang );
+ static inline bool IsTraditional( LanguageType nLang );
+ static inline bool IsChinese( LanguageType nLang );
+
+ // used to specify that the conversion direction states from the
+ // last incarnation should be used as
+ // initial conversion direction for the next incarnation.
+ // (A hack used to transport a state information from
+ // one incarnation to the next. Used in Writers text conversion...)
+ static void SetUseSavedConversionDirectionState( bool bVal );
+ static bool IsUseSavedConversionDirectionState();
+
+ protected:
+ /** retrieves the next text portion which is to be analyzed
+
+ <p>pseudo-abstract, needs to be overridden</p>
+
+ @param _rNextPortion
+ upon return, this must contain the next text portion
+ @param _rLangOfPortion
+ upon return, this must contain the language for the found text portion.
+ (necessary for Chinese translation since there are 5 language variants
+ too look for even if the 'source' language usually is only 'simplified'
+ or 'traditional'.)
+ */
+ virtual void GetNextPortion(
+ OUString& /* [out] */ _rNextPortion,
+ LanguageType& /* [out] */ _rLangOfPortion,
+ bool /* [in] */ _bAllowImplicitChangesForNotConvertibleText ) = 0;
+
+ /** announces a new "current unit"
+
+ <p>This will be called whenever it is necessary to interactively ask the user for
+ a conversion. In such a case, a range within the current portion (see <member>GetNextPortion</member>)
+ is presented to the user for chosing a substitution. Additionally, this method is called,
+ so that derived classes can e.g. highlight this text range in a document view.</p>
+
+ <p>Note that the indexes are relative to the most recent replace action. See
+ <member>ReplaceUnit</member> for details.</p>
+
+ @param _nUnitStart
+ the start index of the unit
+
+ @param _nUnitEnd
+ the start index (exclusively!) of the unit.
+
+ @param _bAllowImplicitChangesForNotConvertibleText
+ allows implicit changes other than the text itself for the
+ text parts not being convertible.
+ Used for chinese translation to attribute all not convertible
+ text (e.g. western text, empty paragraphs, spaces, ...) to
+ the target language and target font of the conversion.
+ This is to ensure that after the conversion any new text entered
+ anywhere in the document will have the target language (of course
+ CJK Language only) and target font (CJK font only) set.
+
+ @see GetNextPortion
+ */
+ virtual void HandleNewUnit( const sal_Int32 _nUnitStart, const sal_Int32 _nUnitEnd ) = 0;
+
+ /** replaces a text unit within a text portion with a new text
+
+ <p>pseudo-abstract, needs to be overridden</p>
+
+ <p>Note an important thing about the indicies: They are always relative to the <em>previous
+ call</em> of ReplaceUnit. This means whe you get a call to ReplaceUnit, and replace some text
+ in your document, than you have to remember the document position immediately <em>behind</em>
+ the changed text. In a next call to ReplaceUnit, an index of <em>0</em> will denote exactly
+ this position behind the previous replacement<br/>
+ The reaons for this is that this class here does not know anything about your document structure,
+ so after a replacement took place, it's impossible to address anything in the range from the
+ beginning of the portion up to the replaced text.<br/>
+ In the very first call to ReplaceUnit, an index of <em>0</em> denotes the very first position of
+ the current portion.</p>
+
+ <p>If the language of the text to be replaced is different from
+ the target language (as given by 'GetTargetLanguage') for example
+ when converting simplified Chinese from/to traditional Chinese
+ the language attribute of the new text has to be changed as well,
+ **and** the font is to be set to the default (document) font for
+ that language.</p>
+
+ @param _nUnitStart
+ the start index of the range to replace
+
+ @param _nUnitEnd
+ the end index (exclusively!) of the range to replace. E.g., an index
+ pair (4,5) indicates a range of length 1.
+
+ @param _rOrigText
+ the original text to be replaced (as returned by GetNextPortion).
+ Since in Chinese conversion the original text is needed as well
+ in order to only do the minimal necassry text changes and to keep
+ as much attributes as possible this is supplied here as well.
+
+ @param _rReplaceWith
+ The replacement text
+
+ @param _rOffsets
+ An sequence matching the indices (characters) of _rReplaceWith
+ to the indices of the characters in the original text they are
+ replacing.
+ This is necessary since some portions of the text may get
+ converted in portions of different length than the original.
+ The sequence will be empty if all conversions in the text are
+ of equal length. That is if always the character at index i in
+ _rOffsets is replacing the character at index i in the original
+ text for all valid index values of i.
+
+ @param _eAction
+ replacement action to take
+
+ @param pNewUnitLanguage
+ if the replacement unit is required to have a new language that
+ is specified here. If the language is to be left unchanged this
+ is the 0 pointer.
+ */
+ virtual void ReplaceUnit(
+ const sal_Int32 _nUnitStart, const sal_Int32 _nUnitEnd,
+ const OUString& _rOrigText,
+ const OUString& _rReplaceWith,
+ const ::com::sun::star::uno::Sequence< sal_Int32 > &_rOffsets,
+ ReplacementAction _eAction,
+ LanguageType *pNewUnitLanguage
+ ) = 0;
+
+ /** specifies if rubies are supported by the document implementing
+ this class.
+
+ @return
+ <TRUE/> if rubies are supported.
+ */
+ virtual bool HasRubySupport() const = 0;
+ };
+
+ bool HangulHanjaConversion::IsSimplified( LanguageType nLang )
+ {
+ return MsLangId::isSimplifiedChinese(nLang);
+ }
+
+ bool HangulHanjaConversion::IsTraditional( LanguageType nLang )
+ {
+ return MsLangId::isTraditionalChinese(nLang);
+ }
+
+ bool HangulHanjaConversion::IsChinese( LanguageType nLang )
+ {
+ return MsLangId::isChinese(nLang);
+ }
+//.............................................................................
+} // namespace svx
+//.............................................................................
+
+#endif // SVX_HANGUL_HANJA_CONVERSION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/hngpnctitem.hxx b/include/editeng/hngpnctitem.hxx
new file mode 100644
index 000000000000..4454faab0b76
--- /dev/null
+++ b/include/editeng/hngpnctitem.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_HNGPNCTITEM_HXX
+#define _SVX_HNGPNCTITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxHangingPunctuationItem -----------------------------------------
+
+/* [Description]
+
+ This item describe how to handle the last character of a line.
+*/
+
+class EDITENG_DLLPUBLIC SvxHangingPunctuationItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+
+ SvxHangingPunctuationItem( sal_Bool bOn /*= sal_False*/,
+ const sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper * = 0 ) const;
+
+ inline SvxHangingPunctuationItem& operator=(
+ const SvxHangingPunctuationItem& rItem )
+ {
+ SetValue( rItem.GetValue() );
+ return *this;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/hyphenzoneitem.hxx b/include/editeng/hyphenzoneitem.hxx
new file mode 100644
index 000000000000..3f0682096772
--- /dev/null
+++ b/include/editeng/hyphenzoneitem.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_HYZNITEM_HXX
+#define _SVX_HYZNITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxHyphenZoneItem -----------------------------------------------
+
+/* [Description]
+
+ This item describes a hyphenation attribute (automatic?, number of
+ characters at the end of the line and start).
+*/
+
+class EDITENG_DLLPUBLIC SvxHyphenZoneItem : public SfxPoolItem
+{
+ sal_Bool bHyphen: 1;
+ sal_Bool bPageEnd: 1;
+ sal_uInt8 nMinLead;
+ sal_uInt8 nMinTrail;
+ sal_uInt8 nMaxHyphens;
+
+ friend SvStream & operator<<( SvStream & aS, SvxHyphenZoneItem & );
+
+public:
+ TYPEINFO();
+
+ SvxHyphenZoneItem( const sal_Bool bHyph /*= sal_False*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
+
+ inline void SetHyphen( const sal_Bool bNew ) { bHyphen = bNew; }
+ inline sal_Bool IsHyphen() const { return bHyphen; }
+
+ inline void SetPageEnd( const sal_Bool bNew ) { bPageEnd = bNew; }
+ inline sal_Bool IsPageEnd() const { return bPageEnd; }
+
+ inline sal_uInt8 &GetMinLead() { return nMinLead; }
+ inline sal_uInt8 GetMinLead() const { return nMinLead; }
+
+ inline sal_uInt8 &GetMinTrail() { return nMinTrail; }
+ inline sal_uInt8 GetMinTrail() const { return nMinTrail; }
+
+ inline sal_uInt8 &GetMaxHyphens() { return nMaxHyphens; }
+ inline sal_uInt8 GetMaxHyphens() const { return nMaxHyphens; }
+
+ inline SvxHyphenZoneItem &operator=( const SvxHyphenZoneItem &rNew )
+ {
+ bHyphen = rNew.IsHyphen();
+ bPageEnd = rNew.IsPageEnd();
+ nMinLead = rNew.GetMinLead();
+ nMinTrail = rNew.GetMinTrail();
+ nMaxHyphens = rNew.GetMaxHyphens();
+ return *this;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/itemtype.hxx b/include/editeng/itemtype.hxx
new file mode 100644
index 000000000000..422cb3b9e22e
--- /dev/null
+++ b/include/editeng/itemtype.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_ITEMTYPE_HXX
+#define _SVX_ITEMTYPE_HXX
+
+#include <editeng/editrids.hrc>
+#include <editeng/eerdll.hxx>
+
+// forward ---------------------------------------------------------------
+#include <tools/string.hxx>
+#include <tools/resid.hxx>
+#include <tools/bigint.hxx>
+#include <svl/poolitem.hxx>
+#include <tools/shl.hxx>
+#include "editeng/editengdllapi.h"
+
+class Color;
+class IntlWrapper;
+// static and prototypes -------------------------------------------------
+
+static const sal_Unicode cpDelim[] = { ',' , ' ', '\0' };
+
+EDITENG_DLLPUBLIC String GetSvxString( sal_uInt16 nId );
+EDITENG_DLLPUBLIC String GetMetricText( long nVal, SfxMapUnit eSrcUnit, SfxMapUnit eDestUnit, const IntlWrapper * pIntl );
+String GetColorString( const Color& rCol );
+EDITENG_DLLPUBLIC sal_uInt16 GetMetricId( SfxMapUnit eUnit );
+
+// -----------------------------------------------------------------------
+
+inline String GetBoolString( sal_Bool bVal )
+{
+ return EE_RESSTR(bVal ? RID_SVXITEMS_TRUE : RID_SVXITEMS_FALSE);
+}
+
+// -----------------------------------------------------------------------
+
+inline long Scale( long nVal, long nMult, long nDiv )
+{
+ BigInt aVal( nVal );
+ aVal *= nMult;
+ aVal += nDiv/2;
+ aVal /= nDiv;
+ return aVal;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/justifyitem.hxx b/include/editeng/justifyitem.hxx
new file mode 100644
index 000000000000..cfbdcff00a65
--- /dev/null
+++ b/include/editeng/justifyitem.hxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __EDITENG_JUSTIFYITEM_HXX__
+#define __EDITENG_JUSTIFYITEM_HXX__
+
+#include "editeng/editengdllapi.h"
+#include "editeng/svxenum.hxx"
+#include <svl/eitem.hxx>
+#include <sal/types.h>
+
+class EDITENG_DLLPUBLIC SvxHorJustifyItem: public SfxEnumItem
+{
+public:
+ TYPEINFO();
+
+ explicit SvxHorJustifyItem( const sal_uInt16 nId );
+
+ SvxHorJustifyItem(
+ const SvxCellHorJustify eJustify /*= SVX_HOR_JUSTIFY_STANDARD*/,
+ const sal_uInt16 nId );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual sal_uInt16 GetValueCount() const;
+ virtual String GetValueText( sal_uInt16 nVal ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const;
+
+ inline SvxHorJustifyItem& operator=(const SvxHorJustifyItem& rHorJustify)
+ {
+ SetValue( rHorJustify.GetValue() );
+ return *this;
+ }
+};
+
+//------------------------------------------------------------------------
+
+class EDITENG_DLLPUBLIC SvxVerJustifyItem: public SfxEnumItem
+{
+public:
+ TYPEINFO();
+
+ explicit SvxVerJustifyItem( const sal_uInt16 nId );
+
+ SvxVerJustifyItem(
+ const SvxCellVerJustify eJustify /*= SVX_VER_JUSTIFY_STANDARD*/,
+ const sal_uInt16 nId );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual sal_uInt16 GetValueCount() const;
+ virtual String GetValueText( sal_uInt16 nVal ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const;
+
+ inline SvxVerJustifyItem& operator=(const SvxVerJustifyItem& rVerJustify)
+ {
+ SetValue( rVerJustify.GetValue() );
+ return *this;
+ }
+};
+
+//------------------------------------------------------------------------
+
+class EDITENG_DLLPUBLIC SvxJustifyMethodItem: public SfxEnumItem
+{
+public:
+ SvxJustifyMethodItem(
+ const SvxCellJustifyMethod eMethod,
+ const sal_uInt16 nId );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual sal_uInt16 GetValueCount() const;
+ virtual String GetValueText( sal_uInt16 nVal ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const;
+
+ SvxJustifyMethodItem& operator=(const SvxJustifyMethodItem& r);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/keepitem.hxx b/include/editeng/keepitem.hxx
new file mode 100644
index 000000000000..57e8fe022af4
--- /dev/null
+++ b/include/editeng/keepitem.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_KEEPITEM_HXX
+#define _SVX_KEEPITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+
+// class SvxFmtKeepItem ------------------------------------------------
+
+/* [Description]
+
+ This item describes a logical variable "keep paragraphs together?".
+*/
+
+class EDITENG_DLLPUBLIC SvxFmtKeepItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+
+ inline SvxFmtKeepItem( const sal_Bool bKeep /*= sal_False*/,
+ const sal_uInt16 _nWhich );
+ inline SvxFmtKeepItem& operator=( const SvxFmtKeepItem& rSplit );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream&, sal_uInt16 ) const;
+ virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+};
+
+inline SvxFmtKeepItem::SvxFmtKeepItem( const sal_Bool bKeep, const sal_uInt16 _nWhich ) :
+ SfxBoolItem( _nWhich, bKeep )
+{}
+
+inline SvxFmtKeepItem& SvxFmtKeepItem::operator=( const SvxFmtKeepItem& rKeep )
+{
+ SetValue( rKeep.GetValue() );
+ return *this;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/kernitem.hxx b/include/editeng/kernitem.hxx
new file mode 100644
index 000000000000..1b5f937afc01
--- /dev/null
+++ b/include/editeng/kernitem.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_KERNITEM_HXX
+#define _SVX_KERNITEM_HXX
+
+#include <svl/intitem.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxKerningItem --------------------------------------------------
+
+// Note: Twips value
+// Twips: 0 = no kerning
+
+/* [Description]
+
+ This item describes the kerning.
+*/
+
+class EDITENG_DLLPUBLIC SvxKerningItem : public SfxInt16Item
+{
+public:
+ TYPEINFO();
+
+ SvxKerningItem( const short nKern /*= 0*/, const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+ virtual bool ScaleMetrics( long nMult, long nDiv );
+ virtual bool HasMetrics() const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ inline SvxKerningItem& operator=(const SvxKerningItem& rKern) {
+ SetValue( rKern.GetValue() );
+ return *this;
+ }
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/langitem.hxx b/include/editeng/langitem.hxx
new file mode 100644
index 000000000000..e1231cded21c
--- /dev/null
+++ b/include/editeng/langitem.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_LANGITEM_HXX
+#define _SVX_LANGITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <i18nlangtag/lang.h>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxLanguageItem -------------------------------------------------
+
+/* [Description]
+
+ This item describes a Language.
+*/
+
+class EDITENG_DLLPUBLIC SvxLanguageItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+
+ SvxLanguageItem( const LanguageType eLang /*= LANGUAGE_GERMAN*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+ virtual sal_uInt16 GetValueCount() const;
+
+ inline SvxLanguageItem& operator=(const SvxLanguageItem& rLang)
+ {
+ SetValue( rLang.GetValue() );
+ return *this;
+ }
+
+ // enum cast
+ LanguageType GetLanguage() const
+ { return (LanguageType)GetValue(); }
+ void SetLanguage( const LanguageType eLang )
+ { SetValue( (sal_uInt16)eLang ); }
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/lcolitem.hxx b/include/editeng/lcolitem.hxx
new file mode 100644
index 000000000000..5b97c52d6c6d
--- /dev/null
+++ b/include/editeng/lcolitem.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_LCOLITEM_HXX
+#define _SVX_LCOLITEM_HXX
+
+#include <editeng/colritem.hxx>
+#include <editeng/editengdllapi.h>
+
+/*
+ * Dummy item for ToolBox controller:
+ *
+ */
+
+class EDITENG_DLLPUBLIC SvxLineColorItem : public SvxColorItem
+{
+public:
+ TYPEINFO();
+
+ explicit SvxLineColorItem( const sal_uInt16 nId );
+ SvxLineColorItem( const SvxLineColorItem& rCopy );
+ ~SvxLineColorItem();
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper * pIntlWrapper = 0 )
+ const;
+
+ inline SvxLineColorItem& operator=(const SvxLineColorItem& rColor)
+ { return (SvxLineColorItem&)SvxColorItem::
+ operator=((const SvxColorItem&)rColor); }
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/lineitem.hxx b/include/editeng/lineitem.hxx
new file mode 100644
index 000000000000..07ad4da38bc5
--- /dev/null
+++ b/include/editeng/lineitem.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_BOLNITEM_HXX
+#define _SVX_BOLNITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include "editeng/editengdllapi.h"
+
+
+
+// class SvxLineItem -----------------------------------------------------
+
+
+/*
+[Description]
+This Item transports a editeng::SvxBorderLine.
+*/
+
+namespace editeng {
+ class SvxBorderLine;
+}
+
+class EDITENG_DLLPUBLIC SvxLineItem : public SfxPoolItem
+{
+public:
+ TYPEINFO();
+
+ explicit SvxLineItem( const sal_uInt16 nId );
+ SvxLineItem( const SvxLineItem& rCpy );
+ ~SvxLineItem();
+ SvxLineItem &operator=( const SvxLineItem& rLine );
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
+ virtual bool ScaleMetrics( long nMult, long nDiv );
+ virtual bool HasMetrics() const;
+
+ const editeng::SvxBorderLine* GetLine () const { return pLine; }
+ void SetLine ( const editeng::SvxBorderLine *pNew );
+
+private:
+ editeng::SvxBorderLine* pLine;
+};
+
+
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/lrspitem.hxx b/include/editeng/lrspitem.hxx
new file mode 100644
index 000000000000..a7e95ccb6e63
--- /dev/null
+++ b/include/editeng/lrspitem.hxx
@@ -0,0 +1,165 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_LRSPITEM_HXX
+#define _SVX_LRSPITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <editeng/editengdllapi.h>
+
+
+// class SvxLRSpaceItem --------------------------------------------------
+
+/* [Description]
+
+ Left/Right margin and first line indent
+
+ SvxLRSpaceItem offers two interfaces for views from the left margin and
+ first line indent. The get methods return the member, with the layout also
+ as expected: the left edge shifts to the negative first line indent to the
+ left. The SetTxt/Gettxt methods assume that the left side represents the
+ 0 coordinate for the first line indent:
+
+ UI UI LAYOUT UI/TEXT UI/TEXT (Where?)
+ SetTxtLeft SetTxtFirst GetLeft GetTxtLeft GetTxtFirst (What?)
+ 500 -500 0 500 -500 (How much?)
+ 500 0 500 500 0
+ 500 +500 500 500 +500
+ 700 -500 200 700 -500
+*/
+
+#define LRSPACE_16_VERSION ((sal_uInt16)0x0001)
+#define LRSPACE_TXTLEFT_VERSION ((sal_uInt16)0x0002)
+#define LRSPACE_AUTOFIRST_VERSION ((sal_uInt16)0x0003)
+#define LRSPACE_NEGATIVE_VERSION ((sal_uInt16)0x0004)
+
+class EDITENG_DLLPUBLIC SvxLRSpaceItem : public SfxPoolItem
+{
+ short nFirstLineOfst; // First-line indent _always_ relative to nTxtLeft
+ long nTxtLeft; // We spend a sal_uInt16
+ long nLeftMargin; // nLeft or the negative first-line indent
+ long nRightMargin; // The unproblematic right edge
+
+ sal_uInt16 nPropFirstLineOfst, nPropLeftMargin, nPropRightMargin;
+ sal_Bool bAutoFirst : 1; // Automatic calculation of the first line indent
+
+ void AdjustLeft(); // nLeftMargin and nTxtLeft are being adjusted.
+
+public:
+ TYPEINFO();
+
+ explicit SvxLRSpaceItem( const sal_uInt16 nId );
+ SvxLRSpaceItem( const long nLeft, const long nRight,
+ const long nTLeft /*= 0*/, const short nOfset /*= 0*/,
+ const sal_uInt16 nId );
+ inline SvxLRSpaceItem& operator=( const SvxLRSpaceItem &rCpy );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+ virtual bool ScaleMetrics( long nMult, long nDiv );
+ virtual bool HasMetrics() const;
+
+ // Die "Layout-Schnittstelle":
+ inline void SetLeft ( const long nL, const sal_uInt16 nProp = 100 );
+ inline void SetRight( const long nR, const sal_uInt16 nProp = 100 );
+
+ // Query/direct setting of the absolute values
+ inline long GetLeft() const { return nLeftMargin; }
+ inline long GetRight() const { return nRightMargin;}
+ inline void SetLeftValue( const long nL ) { nTxtLeft = nLeftMargin = nL; }
+ inline void SetRightValue( const long nR ) { nRightMargin = nR; }
+ inline sal_Bool IsAutoFirst() const { return bAutoFirst; }
+ inline void SetAutoFirst( const sal_Bool bNew ) { bAutoFirst = bNew; }
+
+ // Query/Setting the percentage values
+ inline void SetPropLeft( const sal_uInt16 nProp = 100 )
+ { nPropLeftMargin = nProp; }
+ inline void SetPropRight( const sal_uInt16 nProp = 100 )
+ { nPropRightMargin = nProp;}
+ inline sal_uInt16 GetPropLeft() const { return nPropLeftMargin; }
+ inline sal_uInt16 GetPropRight() const { return nPropRightMargin;}
+
+ // The UI/text interface:
+ inline void SetTxtLeft( const long nL, const sal_uInt16 nProp = 100 );
+ inline long GetTxtLeft() const { return nTxtLeft; }
+
+ inline void SetTxtFirstLineOfst( const short nF, const sal_uInt16 nProp = 100 );
+ inline short GetTxtFirstLineOfst() const { return nFirstLineOfst; }
+ inline void SetPropTxtFirstLineOfst( const sal_uInt16 nProp = 100 )
+ { nPropFirstLineOfst = nProp; }
+ inline sal_uInt16 GetPropTxtFirstLineOfst() const
+ { return nPropFirstLineOfst; }
+ inline void SetTxtFirstLineOfstValue( const short nValue )
+ { nFirstLineOfst = nValue; }
+};
+
+inline SvxLRSpaceItem &SvxLRSpaceItem::operator=( const SvxLRSpaceItem &rCpy )
+{
+ nFirstLineOfst = rCpy.nFirstLineOfst;
+ nTxtLeft = rCpy.nTxtLeft;
+ nLeftMargin = rCpy.nLeftMargin;
+ nRightMargin = rCpy.nRightMargin;
+ nPropFirstLineOfst = rCpy.nPropFirstLineOfst;
+ nPropLeftMargin = rCpy.nPropLeftMargin;
+ nPropRightMargin = rCpy.nPropRightMargin;
+ bAutoFirst = rCpy.bAutoFirst;
+ return *this;
+}
+
+inline void SvxLRSpaceItem::SetLeft( const long nL, const sal_uInt16 nProp )
+{
+ nLeftMargin = (nL * nProp) / 100;
+ nTxtLeft = nLeftMargin;
+ nPropLeftMargin = nProp;
+}
+inline void SvxLRSpaceItem::SetRight( const long nR, const sal_uInt16 nProp )
+{
+ nRightMargin = (nR * nProp) / 100;
+ nPropRightMargin = nProp;
+}
+inline void SvxLRSpaceItem::SetTxtFirstLineOfst( const short nF,
+ const sal_uInt16 nProp )
+{
+ nFirstLineOfst = short((long(nF) * nProp ) / 100);
+ nPropFirstLineOfst = nProp;
+ AdjustLeft();
+}
+
+inline void SvxLRSpaceItem::SetTxtLeft( const long nL, const sal_uInt16 nProp )
+{
+ nTxtLeft = (nL * nProp) / 100;
+ nPropLeftMargin = nProp;
+ AdjustLeft();
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/lspcitem.hxx b/include/editeng/lspcitem.hxx
new file mode 100644
index 000000000000..de0a163e34e6
--- /dev/null
+++ b/include/editeng/lspcitem.hxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_LSPCITEM_HXX
+#define _SVX_LSPCITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/svxenum.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxLineSpacingItem ----------------------------------------------
+
+/* [Description]
+ This item describes the distance between the lines.
+*/
+
+#define LINE_SPACE_DEFAULT_HEIGHT 200
+class EDITENG_DLLPUBLIC SvxLineSpacingItem : public SfxEnumItemInterface
+{
+ friend SvStream& operator<<( SvStream&, SvxLineSpacingItem& ); //$ ostream
+
+ short nInterLineSpace;
+ sal_uInt16 nLineHeight;
+ sal_uInt8 nPropLineSpace;
+ SvxLineSpace eLineSpace;
+ SvxInterLineSpace eInterLineSpace;
+
+public:
+ TYPEINFO();
+
+ // The writer relies on a default height of 200! Actually, I would
+ // initialize all values to 0, but who can ignore the consequences in
+ // writer? => Rather have a crooked vales as the default, but the
+ // programmer sees that there's something special happening.
+
+ SvxLineSpacingItem( sal_uInt16 nHeight /*= LINE_SPACE_DEFAULT_HEIGHT*/, const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
+
+ // Methods to query and edit. InterlineSpace is added to the height.
+ inline short GetInterLineSpace() const { return nInterLineSpace; }
+ inline void SetInterLineSpace( const short nSpace )
+ {
+ nInterLineSpace = nSpace;
+ eInterLineSpace = SVX_INTER_LINE_SPACE_FIX;
+ }
+
+ // Determines the absolute or minimum row height.
+ inline sal_uInt16 GetLineHeight() const { return nLineHeight; }
+ inline void SetLineHeight( const sal_uInt16 nHeight )
+ {
+ nLineHeight = nHeight;
+ eLineSpace = SVX_LINE_SPACE_MIN;
+ }
+
+ // To increase or decrease the row height.
+ sal_uInt8 GetPropLineSpace() const { return nPropLineSpace; }
+ inline void SetPropLineSpace( const sal_uInt8 nProp )
+ {
+ nPropLineSpace = nProp;
+ eInterLineSpace = SVX_INTER_LINE_SPACE_PROP;
+ }
+
+ inline SvxLineSpace &GetLineSpaceRule() { return eLineSpace; }
+ inline SvxLineSpace GetLineSpaceRule() const { return eLineSpace; }
+
+ inline SvxInterLineSpace &GetInterLineSpaceRule() { return eInterLineSpace; }
+ inline SvxInterLineSpace GetInterLineSpaceRule() const { return eInterLineSpace; }
+
+ virtual sal_uInt16 GetValueCount() const;
+ virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const;
+ virtual sal_uInt16 GetEnumValue() const;
+ virtual void SetEnumValue( sal_uInt16 nNewVal );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/macros.hxx b/include/editeng/macros.hxx
new file mode 100644
index 000000000000..c667cfd6e8b8
--- /dev/null
+++ b/include/editeng/macros.hxx
@@ -0,0 +1,17 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef __EDITENGINE_MACROS_HXX__
+#define __EDITENGINE_MACROS_HXX__
+
+#define DEBUG_EDIT_ENGINE 0
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/measfld.hxx b/include/editeng/measfld.hxx
new file mode 100644
index 000000000000..040560397dd0
--- /dev/null
+++ b/include/editeng/measfld.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _EDIT_MEASFIELD_HXX
+#define _EDIT_MEASFIELD_HXX
+
+#include <editeng/eeitem.hxx>
+
+#ifndef _FLDITEM_HXX
+#ifndef ITEMID_FIELD
+#include <editeng/editdata.hxx> /* this include is needed due to EE_FEATURE_FIELD */
+#define ITEMID_FIELD EE_FEATURE_FIELD /* is needed for #include <editeng/flditem.hxx> */
+#endif
+#include <editeng/flditem.hxx>
+#endif
+#include "editeng/editengdllapi.h"
+
+#include <com/sun/star/text/textfield/Type.hpp>
+
+class SdrMeasureObj;
+
+enum SdrMeasureFieldKind {SDRMEASUREFIELD_VALUE,SDRMEASUREFIELD_UNIT,SDRMEASUREFIELD_ROTA90BLANCS};
+
+class EDITENG_DLLPUBLIC SdrMeasureField: public SvxFieldData {
+ SdrMeasureFieldKind eMeasureFieldKind;
+public:
+ SV_DECL_PERSIST1(SdrMeasureField,SvxFieldData,com::sun::star::text::textfield::Type::MEASURE)
+ SdrMeasureField(): eMeasureFieldKind(SDRMEASUREFIELD_VALUE) {}
+ SdrMeasureField(SdrMeasureFieldKind eNewKind): eMeasureFieldKind(eNewKind) {}
+ virtual ~SdrMeasureField();
+ virtual SvxFieldData* Clone() const;
+ virtual int operator==(const SvxFieldData&) const;
+ SdrMeasureFieldKind GetMeasureFieldKind() const { return eMeasureFieldKind; }
+ void SetMeasureFieldKind(SdrMeasureFieldKind eNewKind) { eMeasureFieldKind=eNewKind; }
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif //_SVDFIELD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/memberids.hrc b/include/editeng/memberids.hrc
new file mode 100644
index 000000000000..1dbe7ba9da5f
--- /dev/null
+++ b/include/editeng/memberids.hrc
@@ -0,0 +1,185 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _EDT_UNOMID_HXX
+#define _EDT_UNOMID_HXX
+
+#include <svl/memberid.hrc>
+
+#define MID_LOCATION 0x3c
+#define MID_TRANSPARENT 0x4b
+#define MID_BG_COLOR 0x22
+#define MID_FLAGS 0x2e
+#define MID_DISTANCE 0x29
+#define MID_FG_COLOR 0x2c
+#define MID_OUTER_WIDTH 0x41
+#define MID_INNER_WIDTH 0x35
+#define MID_LINESPACE 0x3b
+#define MID_LINE_STYLE 0x90
+
+
+//NameOrIndex
+#define MID_NAME 16
+#define MID_GRAFURL 32
+
+// SvxPageModelItem
+#define MID_AUTO 1
+
+// SvxTabStop
+#define MID_TABSTOPS 0
+#define MID_STD_TAB 1
+
+//SvxHyphenZoneItem
+#define MID_IS_HYPHEN 0
+#define MID_HYPHEN_MIN_LEAD 1
+#define MID_HYPHEN_MIN_TRAIL 2
+#define MID_HYPHEN_MAX_HYPHENS 3
+
+// SvxBoxInfoItem
+#define MID_HORIZONTAL 1
+#define MID_VERTICAL 2
+#define MID_VALIDFLAGS 4
+
+//AdjustItem
+#define MID_PARA_ADJUST 0
+#define MID_LAST_LINE_ADJUST 1
+#define MID_EXPAND_SINGLE 2
+
+//SvxFontItem
+// Don't use 0 as it used for the whole struct
+#define MID_FONT_FAMILY_NAME 1
+#define MID_FONT_STYLE_NAME 2
+#define MID_FONT_FAMILY 3
+#define MID_FONT_CHAR_SET 4
+#define MID_FONT_PITCH 5
+
+// SvxCharReliefItem
+#define MID_RELIEF 0
+
+//SvxCharRotateItem
+#define MID_ROTATE 0
+#define MID_FITTOLINE 1
+
+//SvxExcapementItem
+#define MID_ESC 0
+#define MID_ESC_HEIGHT 1
+#define MID_AUTO_ESC 2
+
+//SvxFontWidthItem
+#define MID_FONTWIDTH 0
+#define MID_FONTWIDTH_PROP 1
+
+//SvxFontHeightItem
+#define MID_FONTHEIGHT 1
+#define MID_FONTHEIGHT_PROP 2
+#define MID_FONTHEIGHT_DIFF 3
+
+//SvxTextLineItem
+#define MID_TEXTLINED 0
+#define MID_TL_STYLE 1
+#define MID_TL_COLOR 2
+#define MID_TL_HASCOLOR 3
+
+//SvxCrossedOutItem
+#define MID_CROSSED_OUT 0
+#define MID_CROSS_OUT 1
+
+//SvxPostureItem
+#define MID_ITALIC 0
+#define MID_POSTURE 1
+
+//SvxBoolItem
+#define MID_BOLD 0
+#define MID_WEIGHT 1
+
+//SvxLanguageItem
+#define MID_LANG_INT 0
+#define MID_LANG_LOCALE 1
+
+//SvxEmphasisMarkItem
+#define MID_EMPHASIS 0
+
+//SvxTwoLinesItem
+#define MID_TWOLINES 0
+#define MID_START_BRACKET 1
+#define MID_END_BRACKET 2
+
+//ULSpaceItem
+#define MID_UP_MARGIN 3
+#define MID_LO_MARGIN 4
+#define MID_UP_REL_MARGIN 5
+#define MID_LO_REL_MARGIN 6
+#define MID_CTX_MARGIN 7
+
+//LRSpaceItem
+#define MID_L_MARGIN 4
+#define MID_R_MARGIN 5
+#define MID_L_REL_MARGIN 6
+#define MID_R_REL_MARGIN 7
+#define MID_FIRST_LINE_INDENT 8
+#define MID_FIRST_LINE_REL_INDENT 9
+#define MID_FIRST_AUTO 10
+#define MID_TXT_LMARGIN 11
+
+//ProtectItem
+#define MID_PROTECT_CONTENT 0
+#define MID_PROTECT_SIZE 1
+#define MID_PROTECT_POSITION 2
+
+//SvxBoxItem
+#define LEFT_BORDER 1
+#define RIGHT_BORDER 2
+#define TOP_BORDER 3
+#define BOTTOM_BORDER 4
+#define BORDER_DISTANCE 5
+#define LEFT_BORDER_DISTANCE 6
+#define RIGHT_BORDER_DISTANCE 7
+#define TOP_BORDER_DISTANCE 8
+#define BOTTOM_BORDER_DISTANCE 9
+#define MID_LEFT_BORDER 10
+#define MID_RIGHT_BORDER 11
+#define MID_TOP_BORDER 12
+#define MID_BOTTOM_BORDER 13
+#define LINE_STYLE 14
+#define LINE_WIDTH 15
+
+//BrushItem
+#define MID_BACK_COLOR 0
+#define MID_GRAPHIC_POSITION 1
+#define MID_GRAPHIC_LINK 2
+#define MID_GRAPHIC 3
+#define MID_GRAPHIC_TRANSPARENT 4
+#define MID_GRAPHIC_URL 5
+#define MID_GRAPHIC_FILTER 6
+#define MID_GRAPHIC_REPEAT 7
+#define MID_GRAPHIC_TRANSPARENCY 8
+#define MID_BACK_COLOR_R_G_B 9
+#define MID_BACK_COLOR_TRANSPARENCY 10
+
+//SvxFmtBreakItem
+#define MID_BREAK_BEFORE 0
+#define MID_BREAK_AFTER 1
+
+// SvxHorJustifyItem
+#define MID_HORJUST_HORJUST 0
+#define MID_HORJUST_ADJUST 1
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/mutxhelp.hxx b/include/editeng/mutxhelp.hxx
new file mode 100644
index 000000000000..14b36347b74d
--- /dev/null
+++ b/include/editeng/mutxhelp.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_MUTXHELP_HXX
+#define _SVX_MUTXHELP_HXX
+
+#include <osl/mutex.hxx>
+
+class SvxMutexHelper
+{
+private:
+ ::osl::Mutex maMutex;
+
+public:
+ ::osl::Mutex& getMutex() { return maMutex; }
+};
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/nhypitem.hxx b/include/editeng/nhypitem.hxx
new file mode 100644
index 000000000000..51942c318bbd
--- /dev/null
+++ b/include/editeng/nhypitem.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_NHYPITEM_HXX
+#define _SVX_NHYPITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxNoHyphenItem -------------------------------------------------
+class EDITENG_DLLPUBLIC SvxNoHyphenItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+
+ SvxNoHyphenItem( const sal_Bool bHyphen /*= sal_True*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ inline SvxNoHyphenItem& operator=(const SvxNoHyphenItem& rNHH)
+ {
+ SetValue( rNHH.GetValue() );
+ return *this;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/nlbkitem.hxx b/include/editeng/nlbkitem.hxx
new file mode 100644
index 000000000000..209b0539ba07
--- /dev/null
+++ b/include/editeng/nlbkitem.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_NLBKITEM_HXX
+#define _SVX_NLBKITEM_HXX
+
+#include <svl/eitem.hxx>
+#include "editeng/editengdllapi.h"
+
+// class SvxNoLinebreakItem ----------------------------------------------
+class EDITENG_DLLPUBLIC SvxNoLinebreakItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+
+ SvxNoLinebreakItem( const sal_Bool bBreak /*= sal_True*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ inline SvxNoLinebreakItem& operator=(const SvxNoLinebreakItem& rLB)
+ {
+ SetValue( rLB.GetValue() );
+ return *this;
+ }
+};
+
+
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/numdef.hxx b/include/editeng/numdef.hxx
new file mode 100644
index 000000000000..28f94d2d3ae5
--- /dev/null
+++ b/include/editeng/numdef.hxx
@@ -0,0 +1,23 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#define SVX_MAX_NUM 10 // max. possible numbering level
+#define SVX_DEF_BULLET (0xF000 + 149)// Character for lists
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/numitem.hxx b/include/editeng/numitem.hxx
new file mode 100644
index 000000000000..9f88e79de0ec
--- /dev/null
+++ b/include/editeng/numitem.hxx
@@ -0,0 +1,356 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_NUMITEM_HXX
+#define _SVX_NUMITEM_HXX
+
+#include <tools/link.hxx>
+#include <tools/string.hxx>
+#include <svl/poolitem.hxx>
+#include <editeng/svxenum.hxx>
+#include <tools/gen.hxx>
+#include <editeng/numdef.hxx>
+#include <tools/color.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/style/NumberingType.hpp>
+#include <unotools/fontcvt.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvxBrushItem;
+class Font;
+class Graphic;
+class SvxNodeNum;
+namespace com{namespace sun{ namespace star{
+ namespace text{
+ class XNumberingFormatter;
+ }
+}}}
+
+// -----------------------------------------------------------------------
+//Feature-Flags (only sal_uInt16!)
+#define NUM_CONTINUOUS 0x0001 // consecutive numbers possible?
+#define NUM_CHAR_TEXT_DISTANCE 0x0002 // Distance Symbol<->Text?
+#define NUM_CHAR_STYLE 0x0004 // Character styles?
+#define NUM_BULLET_REL_SIZE 0x0008 // relative bullet size?
+#define NUM_BULLET_COLOR 0x0010 // Bullet color
+#define NUM_SYMBOL_ALIGNMENT 0x0040 // alignment to be shown in the options
+#define NUM_NO_NUMBERS 0x0080 // Numbering are not allowed
+#define NUM_ENABLE_LINKED_BMP 0x0100 // linked bitmaps are available
+#define NUM_ENABLE_EMBEDDED_BMP 0x0200 // embedded bitmaps are available
+
+#define SVX_NO_NUM 200 // Marker for no numbering
+#define SVX_NO_NUMLEVEL 0x20
+
+#define LINK_TOKEN 0x80 //indicate linked bitmaps - for use in dialog only
+class EDITENG_DLLPUBLIC SvxNumberType
+{
+ static sal_Int32 nRefCount;
+ static com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter> xFormatter;
+
+ sal_Int16 nNumType;
+ sal_Bool bShowSymbol; // Also show Symbol ?
+
+public:
+ explicit SvxNumberType(sal_Int16 nType = com::sun::star::style::NumberingType::ARABIC);
+ SvxNumberType(const SvxNumberType& rType);
+ ~SvxNumberType();
+
+ String GetNumStr( sal_uLong nNo ) const;
+ String GetNumStr( sal_uLong nNo, const com::sun::star::lang::Locale& rLocale ) const;
+
+ void SetNumberingType(sal_Int16 nSet) {nNumType = nSet;}
+ sal_Int16 GetNumberingType() const {return nNumType;}
+
+ void SetShowSymbol(sal_Bool bSet) {bShowSymbol = bSet;}
+ sal_Bool IsShowSymbol()const{return bShowSymbol;}
+
+ sal_Bool IsTxtFmt() const
+ {
+ return com::sun::star::style::NumberingType::NUMBER_NONE != nNumType &&
+ com::sun::star::style::NumberingType::CHAR_SPECIAL != nNumType &&
+ com::sun::star::style::NumberingType::BITMAP != nNumType;
+ }
+};
+
+class EDITENG_DLLPUBLIC SvxNumberFormat : public SvxNumberType
+{
+public:
+ enum SvxNumPositionAndSpaceMode
+ {
+ LABEL_WIDTH_AND_POSITION,
+ LABEL_ALIGNMENT
+ };
+ enum LabelFollowedBy
+ {
+ LISTTAB,
+ SPACE,
+ NOTHING
+ };
+
+private:
+ OUString sPrefix;
+ OUString sSuffix;
+
+ SvxAdjust eNumAdjust;
+
+ sal_uInt8 nInclUpperLevels; // Take over numbers from the previous level.
+ sal_uInt16 nStart; // Start of counting
+
+ sal_Unicode cBullet; // Symbol
+ sal_uInt16 nBulletRelSize; // percentage size of bullets
+ Color nBulletColor; // Bullet color
+
+ // mode indicating, if the position and spacing of the list label is
+ // determined by the former attributes (nFirstLineOffset, nAbsLSpace,
+ // nLSpace and nCharTextDistance) called position and spacing via label
+ // width and position (LABEL_WIDTH_AND_POSITION) or by the new attributes
+ // (meLabelFollowedBy, mnListtabPos, mnFirstLineIndent and mnIndentAt)
+ // called position and spacing via label alignment.
+ // Note 1: Attribute <eNumAdjust> is relevant for both modes.
+ // Note 2: The values of the former attributes are treated as 0, if mode
+ // LABEL_ALIGNMENT is active.
+ SvxNumPositionAndSpaceMode mePositionAndSpaceMode;
+
+ short nFirstLineOffset; // First line indent
+ short nAbsLSpace; // Distance Border<->Number
+ short nLSpace; // relative to the previous indentation
+ short nCharTextDistance; // Distance Number<->Text
+
+ // specifies what follows the list label before the text of the first line
+ // of the list item starts
+ LabelFollowedBy meLabelFollowedBy;
+ // specifies an additional list tab stop position for meLabelFollowedBy = LISTTAB
+ long mnListtabPos;
+ // specifies the first line indent
+ long mnFirstLineIndent;
+ // specifies the indent before the text, e.g. in L2R-layout the left margin
+ long mnIndentAt;
+
+ SvxBrushItem* pGraphicBrush;
+ sal_Int16 eVertOrient; // vertical alignment of a bitmap
+
+ Size aGraphicSize; // Always! in 1/100 mm
+ Font* pBulletFont; // Pointer to the bullet font
+
+ String sCharStyleName; // Character Style
+
+ DECL_STATIC_LINK( SvxNumberFormat, GraphicArrived, void * );
+ virtual void NotifyGraphicArrived();
+public:
+ explicit SvxNumberFormat( sal_Int16 nNumberingType,
+ SvxNumPositionAndSpaceMode ePositionAndSpaceMode = LABEL_WIDTH_AND_POSITION );
+ SvxNumberFormat(const SvxNumberFormat& rFormat);
+ SvxNumberFormat( SvStream & rStream );
+
+ virtual ~SvxNumberFormat();
+
+ SvStream& Store(SvStream &rStream, FontToSubsFontConverter pConverter);
+ SvxNumberFormat* Create(SvStream& rStream );
+
+ SvxNumberFormat& operator=( const SvxNumberFormat& );
+ sal_Bool operator==( const SvxNumberFormat& ) const;
+ sal_Bool operator!=( const SvxNumberFormat& rFmt) const {return !(*this == rFmt);}
+
+ void SetNumAdjust(SvxAdjust eSet) {eNumAdjust = eSet;}
+ SvxAdjust GetNumAdjust() const {return eNumAdjust;}
+ void SetPrefix(const OUString& rSet) { sPrefix = rSet;}
+ const OUString& GetPrefix() const { return sPrefix;}
+ void SetSuffix(const OUString& rSet) { sSuffix = rSet;}
+ const OUString& GetSuffix() const { return sSuffix;}
+
+ void SetCharFmtName(const String& rSet){ sCharStyleName = rSet; }
+ virtual const String& GetCharFmtName()const;
+
+ void SetBulletFont(const Font* pFont);
+ const Font* GetBulletFont() const {return pBulletFont;}
+ void SetBulletChar(sal_Unicode cSet){cBullet = cSet;}
+ sal_Unicode GetBulletChar()const {return cBullet;}
+ void SetBulletRelSize(sal_uInt16 nSet) {nBulletRelSize = nSet;}
+ sal_uInt16 GetBulletRelSize() const { return nBulletRelSize;}
+ void SetBulletColor(Color nSet){nBulletColor = nSet;}
+ Color GetBulletColor()const {return nBulletColor;}
+
+ void SetIncludeUpperLevels( sal_uInt8 nSet ) { nInclUpperLevels = nSet;}
+ sal_uInt8 GetIncludeUpperLevels()const { return nInclUpperLevels;}
+ void SetStart(sal_uInt16 nSet) {nStart = nSet;}
+ sal_uInt16 GetStart() const {return nStart;}
+
+ virtual void SetGraphicBrush( const SvxBrushItem* pBrushItem, const Size* pSize = 0, const sal_Int16* pOrient = 0);
+ const SvxBrushItem* GetBrush() const {return pGraphicBrush;}
+ void SetGraphic( const String& rName );
+ virtual void SetVertOrient(sal_Int16 eSet);
+ virtual sal_Int16 GetVertOrient() const;
+ void SetGraphicSize(const Size& rSet) {aGraphicSize = rSet;}
+ const Size& GetGraphicSize() const {return aGraphicSize;}
+
+ SvxNumPositionAndSpaceMode GetPositionAndSpaceMode() const;
+ void SetPositionAndSpaceMode( SvxNumPositionAndSpaceMode ePositionAndSpaceMode );
+
+ void SetLSpace(short nSet) {nLSpace = nSet;}
+ short GetLSpace() const;
+ void SetAbsLSpace(short nSet) {nAbsLSpace = nSet;}
+ short GetAbsLSpace() const;
+ void SetFirstLineOffset(short nSet) { nFirstLineOffset = nSet;}
+ short GetFirstLineOffset() const;
+ void SetCharTextDistance(short nSet) { nCharTextDistance = nSet; }
+ short GetCharTextDistance() const;
+
+ void SetLabelFollowedBy( const LabelFollowedBy eLabelFollowedBy );
+ LabelFollowedBy GetLabelFollowedBy() const;
+ void SetListtabPos( const long nListtabPos );
+ long GetListtabPos() const;
+ void SetFirstLineIndent( const long nFirstLineIndent );
+ long GetFirstLineIndent() const;
+ void SetIndentAt( const long nIndentAt );
+ long GetIndentAt() const;
+
+ static Size GetGraphicSizeMM100(const Graphic* pGraphic);
+ static String CreateRomanString( sal_uLong nNo, sal_Bool bUpper );
+};
+
+enum SvxNumRuleType
+{
+ SVX_RULETYPE_NUMBERING,
+ SVX_RULETYPE_OUTLINE_NUMBERING,
+ SVX_RULETYPE_PRESENTATION_NUMBERING,
+ SVX_RULETYPE_END
+};
+
+class EDITENG_DLLPUBLIC SvxNumRule
+{
+ sal_uInt16 nLevelCount; // Number of supported levels
+ sal_uInt32 nFeatureFlags; // What is supported?
+ SvxNumRuleType eNumberingType; // Type of numbering
+ sal_Bool bContinuousNumbering; // sequential numbering
+
+ SvxNumberFormat* aFmts[SVX_MAX_NUM];
+ sal_Bool aFmtsSet[SVX_MAX_NUM]; // Flags indicating valid levels
+
+ static sal_Int32 nRefCount;
+ com::sun::star::lang::Locale aLocale;
+public:
+ SvxNumRule( sal_uLong nFeatures,
+ sal_uInt16 nLevels,
+ sal_Bool bCont,
+ SvxNumRuleType eType = SVX_RULETYPE_NUMBERING,
+ SvxNumberFormat::SvxNumPositionAndSpaceMode
+ eDefaultNumberFormatPositionAndSpaceMode
+ = SvxNumberFormat::LABEL_WIDTH_AND_POSITION );
+ SvxNumRule(const SvxNumRule& rCopy);
+ SvxNumRule(SvStream &rStream);
+ virtual ~SvxNumRule();
+
+ int operator==( const SvxNumRule& ) const;
+ int operator!=( const SvxNumRule& rRule ) const {return !(*this == rRule);}
+
+ SvxNumRule& operator=( const SvxNumRule& );
+
+ SvStream& Store(SvStream &rStream);
+ SvxNumRule* Create(SvStream &rStream);
+ const SvxNumberFormat* Get(sal_uInt16 nLevel)const;
+ const SvxNumberFormat& GetLevel(sal_uInt16 nLevel)const;
+ void SetLevel(sal_uInt16 nLevel, const SvxNumberFormat& rFmt, sal_Bool bIsValid = sal_True);
+ void SetLevel(sal_uInt16 nLevel, const SvxNumberFormat* pFmt);
+
+ sal_Bool IsContinuousNumbering()const
+ {return bContinuousNumbering;}
+ void SetContinuousNumbering(sal_Bool bSet)
+ {bContinuousNumbering = bSet;}
+
+ sal_uInt16 GetLevelCount() const {return nLevelCount;}
+ sal_Bool IsFeatureSupported(sal_uInt32 nFeature) const
+ {return 0 != (nFeatureFlags & nFeature);}
+ sal_uInt32 GetFeatureFlags() const {return nFeatureFlags;}
+ void SetFeatureFlag( sal_uInt32 nFlag, sal_Bool bSet = sal_True ) { if(bSet) nFeatureFlags |= nFlag; else nFeatureFlags &= ~nFlag; }
+
+ String MakeNumString( const SvxNodeNum&, sal_Bool bInclStrings = sal_True ) const;
+
+ SvxNumRuleType GetNumRuleType() const { return eNumberingType; }
+ void SetNumRuleType( const SvxNumRuleType& rType ) { eNumberingType = rType; }
+
+ sal_Bool UnLinkGraphics();
+};
+
+class EDITENG_DLLPUBLIC SvxNumBulletItem : public SfxPoolItem
+{
+ SvxNumRule* pNumRule;
+public:
+ explicit SvxNumBulletItem(SvxNumRule& rRule);
+ SvxNumBulletItem(SvxNumRule& rRule, sal_uInt16 nWhich );
+ SvxNumBulletItem(const SvxNumBulletItem& rCopy);
+ virtual ~SvxNumBulletItem();
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &rStream, sal_uInt16 nItemVersion) const;
+ sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+ virtual SvStream& Store(SvStream &rStream, sal_uInt16 nItemVersion ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ SvxNumRule* GetNumRule() const {return pNumRule;}
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+};
+
+class SvxNodeNum
+{
+ sal_uInt16 nLevelVal[ SVX_MAX_NUM ]; // Numbers of all levels
+ sal_uInt16 nSetValue; // predetermined number
+ sal_uInt8 nMyLevel; // Current Level
+ sal_Bool bStartNum; // Restart numbering
+
+public:
+ explicit inline SvxNodeNum( sal_uInt8 nLevel = SVX_NO_NUM, sal_uInt16 nSetVal = USHRT_MAX );
+ inline SvxNodeNum& operator=( const SvxNodeNum& rCpy );
+
+ sal_uInt8 GetLevel() const { return nMyLevel; }
+ void SetLevel( sal_uInt8 nVal ) { nMyLevel = nVal; }
+
+ sal_Bool IsStart() const { return bStartNum; }
+ void SetStart( sal_Bool bFlag = sal_True ) { bStartNum = bFlag; }
+
+ sal_uInt16 GetSetValue() const { return nSetValue; }
+ void SetSetValue( sal_uInt16 nVal ) { nSetValue = nVal; }
+
+ const sal_uInt16* GetLevelVal() const { return nLevelVal; }
+ sal_uInt16* GetLevelVal() { return nLevelVal; }
+};
+
+SvxNodeNum::SvxNodeNum( sal_uInt8 nLevel, sal_uInt16 nSetVal )
+ : nSetValue( nSetVal ), nMyLevel( nLevel ), bStartNum( sal_False )
+{
+ memset( nLevelVal, 0, sizeof( nLevelVal ) );
+}
+
+inline SvxNodeNum& SvxNodeNum::operator=( const SvxNodeNum& rCpy )
+{
+ nSetValue = rCpy.nSetValue;
+ nMyLevel = rCpy.nMyLevel;
+ bStartNum = rCpy.bStartNum;
+
+ memcpy( nLevelVal, rCpy.nLevelVal, sizeof( nLevelVal ) );
+ return *this;
+}
+
+SvxNumRule* SvxConvertNumRule( const SvxNumRule* pRule, sal_uInt16 nLevel, SvxNumRuleType eType );
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/opaqitem.hxx b/include/editeng/opaqitem.hxx
new file mode 100644
index 000000000000..7780c4237c5d
--- /dev/null
+++ b/include/editeng/opaqitem.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_OPAQITEM_HXX
+#define _SVX_OPAQITEM_HXX
+
+#include <svl/eitem.hxx>
+#include "editeng/editengdllapi.h"
+
+class SvXMLUnitConverter;
+
+// class SvxOpaqueItem ---------------------------------------------------
+
+
+/* [Description]
+
+ This item describes a logical variable "Opaque yes or no."
+*/
+
+class EDITENG_DLLPUBLIC SvxOpaqueItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+
+ explicit SvxOpaqueItem( const sal_uInt16 nId , const sal_Bool bOpa = sal_True );
+ inline SvxOpaqueItem &operator=( const SvxOpaqueItem &rCpy );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+};
+
+inline SvxOpaqueItem::SvxOpaqueItem( const sal_uInt16 nId, const sal_Bool bOpa )
+ : SfxBoolItem( nId, bOpa )
+{}
+
+inline SvxOpaqueItem &SvxOpaqueItem::operator=( const SvxOpaqueItem &rCpy )
+{
+ SetValue( rCpy.GetValue() );
+ return *this;
+}
+
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/optitems.hxx b/include/editeng/optitems.hxx
new file mode 100644
index 000000000000..34970ebbc42c
--- /dev/null
+++ b/include/editeng/optitems.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _EDITENG_OPTITEMS_HXX
+#define _EDITENG_OPTITEMS_HXX
+
+#include <svl/poolitem.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <editeng/editengdllapi.h>
+
+// forward ---------------------------------------------------------------
+namespace com { namespace sun { namespace star {
+namespace linguistic2{
+ class XSpellChecker1;
+}}}}
+
+
+// class SfxSpellCheckItem -----------------------------------------------
+
+class EDITENG_DLLPUBLIC SfxSpellCheckItem: public SfxPoolItem
+{
+public:
+ TYPEINFO();
+
+ SfxSpellCheckItem( ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 > &xChecker,
+ sal_uInt16 nWhich );
+ SfxSpellCheckItem( const SfxSpellCheckItem& rItem );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 >
+ GetXSpellChecker() const { return xSpellCheck; }
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 > xSpellCheck;
+};
+
+
+// class SfxHyphenRegionItem ---------------------------------------------
+
+class EDITENG_DLLPUBLIC SfxHyphenRegionItem: public SfxPoolItem
+{
+ sal_uInt8 nMinLead;
+ sal_uInt8 nMinTrail;
+
+public:
+ TYPEINFO();
+
+ SfxHyphenRegionItem( const sal_uInt16 nId );
+ SfxHyphenRegionItem( const SfxHyphenRegionItem& rItem );
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream& rStrm, sal_uInt16 nVer ) const;
+ virtual SvStream& Store( SvStream& rStrm, sal_uInt16 ) const;
+
+ inline sal_uInt8 &GetMinLead() { return nMinLead; }
+ inline sal_uInt8 GetMinLead() const { return nMinLead; }
+
+ inline sal_uInt8 &GetMinTrail() { return nMinTrail; }
+ inline sal_uInt8 GetMinTrail() const { return nMinTrail; }
+
+ inline SfxHyphenRegionItem& operator=( const SfxHyphenRegionItem& rNew )
+ {
+ nMinLead = rNew.GetMinLead();
+ nMinTrail = rNew.GetMinTrail();
+ return *this;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/orphitem.hxx b/include/editeng/orphitem.hxx
new file mode 100644
index 000000000000..60ef8520c677
--- /dev/null
+++ b/include/editeng/orphitem.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_ORPHITEM_HXX
+#define _SVX_ORPHITEM_HXX
+
+#include <svl/intitem.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxOrphansItem --------------------------------------------------
+
+/* [Description]
+
+ This item describes the number of lines for the orphans system.
+*/
+
+class EDITENG_DLLPUBLIC SvxOrphansItem: public SfxByteItem
+{
+ friend SvStream & operator<<( SvStream & aS, SvxOrphansItem & );
+public:
+ TYPEINFO();
+
+ SvxOrphansItem( const sal_uInt8 nL /*= 0*/, const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ inline SvxOrphansItem& operator=( const SvxOrphansItem& rOrphans )
+ {
+ SetValue( rOrphans.GetValue() );
+ return *this;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
new file mode 100644
index 000000000000..e2f208e9b824
--- /dev/null
+++ b/include/editeng/outliner.hxx
@@ -0,0 +1,1001 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _OUTLINER_HXX
+#define _OUTLINER_HXX
+
+#include <tools/gen.hxx>
+#include <tools/string.hxx>
+
+#include <svl/brdcst.hxx>
+
+#include <editeng/editdata.hxx>
+#include <i18nlangtag/lang.h>
+#include <tools/color.hxx>
+#include <tools/contnr.hxx>
+#include <vcl/graph.hxx>
+#include <tools/link.hxx>
+#include <rsc/rscsfx.hxx>
+#include "editeng/editengdllapi.h"
+#include <com/sun/star/lang/Locale.hpp>
+
+#include <svtools/grfmgr.hxx>
+
+#include <tools/rtti.hxx> // due to typedef TypeId
+#include <vector>
+
+class OutlinerEditEng;
+class Outliner;
+class EditView;
+class EditUndo;
+class ParagraphList;
+class OutlinerParaObject;
+class SvStream;
+class SvxBulletItem;
+class SvxFont;
+class SvxSearchItem;
+class SvxFieldItem;
+class Window;
+class KeyEvent;
+class MouseEvent;
+class Pointer;
+class CommandEvent;
+class MapMode;
+class OutputDevice;
+class PolyPolygon;
+class SfxStyleSheetPool;
+class SfxStyleSheet;
+class SfxItemPool;
+class SfxItemSet;
+class SvxNumBulletItem;
+class SvxNumberFormat;
+class SvxLRSpaceItem;
+class EditEngine;
+class SvKeyValueIterator;
+class SvxForbiddenCharactersTable;
+
+namespace svl
+{
+ class IUndoManager;
+}
+
+#include <com/sun/star/uno/Reference.h>
+
+#include <rtl/ref.hxx>
+#include <editeng/svxfont.hxx>
+#include <editeng/eedata.hxx>
+#include <editeng/paragraphdata.hxx>
+
+class SvxFieldData;
+//////////////////////////////////////////////////////////////////////////////
+
+namespace com { namespace sun { namespace star { namespace linguistic2 {
+ class XSpellChecker1;
+ class XHyphenator;
+}}}}
+namespace svx{
+struct SpellPortion;
+typedef std::vector<SpellPortion> SpellPortions;
+}
+
+namespace basegfx { class B2DPolyPolygon; }
+
+// internal use only!
+#define PARAFLAG_DROPTARGET 0x1000
+#define PARAFLAG_DROPTARGET_EMPTY 0x2000
+#define PARAFLAG_HOLDDEPTH 0x4000
+#define PARAFLAG_SETBULLETTEXT 0x8000
+#define PARAFLAG_ISPAGE 0x0100
+
+// Undo-Action-Ids
+#define OLUNDO_DEPTH EDITUNDO_USER
+// #define OLUNDO_HEIGHT EDITUNDO_USER+1
+#define OLUNDO_EXPAND EDITUNDO_USER+2
+#define OLUNDO_COLLAPSE EDITUNDO_USER+3
+// #define OLUNDO_REMOVE EDITUNDO_USER+4
+#define OLUNDO_ATTR EDITUNDO_USER+5
+#define OLUNDO_INSERT EDITUNDO_USER+6
+// #define OLUNDO_MOVEPARAGRAPHS EDITUNDO_USER+7
+#define OLUNDO_CHECKPARA EDITUNDO_USER+8
+
+class Paragraph : protected ParagraphData
+{
+private:
+ friend class Outliner;
+ friend class ParagraphList;
+ friend class OutlinerView;
+ friend class OutlinerParaObject;
+ friend class OutlinerEditEng;
+ friend class OutlinerUndoCheckPara;
+ friend class OutlinerUndoChangeParaFlags;
+
+ Paragraph& operator=(const Paragraph& rPara );
+
+ sal_uInt16 nFlags;
+ OUString aBulText;
+ Size aBulSize;
+ sal_Bool bVisible;
+
+ sal_Bool IsVisible() const { return bVisible; }
+ void SetText( const OUString& rText ) { aBulText = rText; aBulSize.Width() = -1; }
+ void Invalidate() { aBulSize.Width() = -1; }
+ void SetDepth( sal_Int16 nNewDepth ) { nDepth = nNewDepth; aBulSize.Width() = -1; }
+ const OUString& GetText() const { return aBulText; }
+
+ Paragraph( sal_Int16 nDepth );
+ Paragraph( const Paragraph& );
+ Paragraph( const ParagraphData& );
+ ~Paragraph();
+
+ sal_Int16 GetDepth() const { return nDepth; }
+
+ sal_Int16 GetNumberingStartValue() const { return mnNumberingStartValue; }
+ void SetNumberingStartValue( sal_Int16 nNumberingStartValue );
+
+ sal_Bool IsParaIsNumberingRestart() const { return mbParaIsNumberingRestart; }
+ void SetParaIsNumberingRestart( sal_Bool bParaIsNumberingRestart );
+
+ void SetFlag( sal_uInt16 nFlag ) { nFlags |= nFlag; }
+ void RemoveFlag( sal_uInt16 nFlag ) { nFlags &= ~nFlag; }
+ bool HasFlag( sal_uInt16 nFlag ) const { return (nFlags & nFlag) != 0; }
+};
+
+struct ParaRange
+{
+ sal_uInt16 nStartPara;
+ sal_uInt16 nEndPara;
+
+ ParaRange( sal_uInt16 nS, sal_uInt16 nE ) { nStartPara = nS, nEndPara = nE; }
+
+ void Adjust();
+ sal_uInt16 Len() const { return 1 + ( ( nEndPara > nStartPara ) ? (nEndPara-nStartPara) : (nStartPara-nEndPara) ); }
+};
+
+inline void ParaRange::Adjust()
+{
+ if ( nStartPara > nEndPara )
+ {
+ sal_uInt16 nTmp = nStartPara;
+ nStartPara = nEndPara;
+ nEndPara = nTmp;
+ }
+}
+
+class EDITENG_DLLPUBLIC OutlinerView
+{
+ friend class Outliner;
+
+private:
+
+ Outliner* pOwner;
+ EditView* pEditView;
+
+ // Drag & Drop
+ sal_Bool bBeginDragAtMove_OLDMEMBER;
+ sal_Bool bInDragMode;
+ Point aDDStartPosRef;
+ Point aDDStartPosPix;
+ sal_uLong nDDStartPara;
+ sal_uLong nDDStartParaVisChildCount;
+ sal_uLong nDDCurPara;
+ sal_uInt16 nDDStartDepth;
+ sal_uInt16 nDDCurDepth;
+ sal_uInt16 nDDMaxDepth;
+ sal_Bool bDDChangingDepth;
+ sal_Bool bDDCursorVisible;
+ long* pHorTabArrDoc;
+ long nDDScrollLRBorderWidthWin; // Left Right
+ long nDDScrollTBBorderWidthWin; // Top Bottom
+ long nDDScrollLROffs;
+ long nDDScrollTDOffs;
+
+ void* pDummy;
+ sal_uLong nDummy;
+
+ enum MouseTarget {
+ MouseText = 0,
+ MouseBullet = 1,
+ MouseHypertext = 2, // Outside OutputArea
+ MouseOutside = 3, // Outside OutputArea
+ MouseDontKnow = 4
+ };
+ MouseTarget OLD_ePrevMouseTarget;
+
+#ifdef _OUTLINER_CXX
+
+ EDITENG_DLLPRIVATE void ImplExpandOrCollaps( sal_uInt16 nStartPara, sal_uInt16 nEndPara, sal_Bool bExpand );
+
+ EDITENG_DLLPRIVATE sal_uLong ImpCheckMousePos( const Point& rPosPixel, MouseTarget& reTarget);
+ EDITENG_DLLPRIVATE void ImpToggleExpand( Paragraph* pParentPara );
+ EDITENG_DLLPRIVATE ParaRange ImpGetSelectedParagraphs( sal_Bool bIncludeHiddenChildren );
+
+ EDITENG_DLLPRIVATE Pointer ImpGetMousePointer( MouseTarget eTarget );
+ EDITENG_DLLPRIVATE sal_uInt16 ImpInitPaste( sal_uLong& rStart );
+ EDITENG_DLLPRIVATE void ImpPasted( sal_uLong nStart, sal_uLong nPrevParaCount, sal_uInt16 nSize);
+ EDITENG_DLLPRIVATE sal_uInt16 ImpCalcSelectedPages( sal_Bool bIncludeFirstSelected );
+ EDITENG_DLLPRIVATE sal_Bool ImpIsIndentingPages();
+
+#endif
+
+public:
+ OutlinerView( Outliner* pOut, Window* pWindow );
+ virtual ~OutlinerView();
+
+ EditView& GetEditView() const { return *pEditView; }
+
+ void Scroll( long nHorzScroll, long nVertScroll );
+
+ void Paint( const Rectangle& rRect, OutputDevice* pTargetDevice = 0 );
+ sal_Bool PostKeyEvent( const KeyEvent& rKEvt, Window* pFrameWin = NULL );
+ sal_Bool MouseButtonDown( const MouseEvent& );
+ sal_Bool MouseButtonUp( const MouseEvent& );
+ sal_Bool MouseMove( const MouseEvent& );
+
+ void ShowCursor( sal_Bool bGotoCursor = sal_True );
+ void HideCursor();
+
+ Outliner* GetOutliner() const { return pOwner; }
+
+ void SetWindow( Window* pWindow );
+ Window* GetWindow() const;
+
+ void SetReadOnly( sal_Bool bReadOnly );
+ sal_Bool IsReadOnly() const;
+
+ void SetOutputArea( const Rectangle& rRect );
+ Rectangle GetOutputArea() const;
+
+ Rectangle GetVisArea() const;
+
+ void CreateSelectionList (std::vector<Paragraph*> &aSelList) ;
+
+ // Retruns the number of selected paragraphs
+ sal_uLong Select( Paragraph* pParagraph,
+ sal_Bool bSelect=sal_True,
+ sal_Bool bWChildren=sal_True);
+
+ String GetSelected() const;
+ void SelectRange( sal_uLong nFirst, sal_uInt16 nCount );
+ void SetAttribs( const SfxItemSet& );
+ void Indent( short nDiff );
+ void AdjustDepth( short nDX ); // Later replace with Indent!
+
+ sal_Bool AdjustHeight( long nDY );
+
+ sal_uLong Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, sal_Bool bSelect = sal_False, SvKeyValueIterator* pHTTPHeaderAttrs = NULL );
+
+ void InsertText( const String& rNew, sal_Bool bSelect = sal_False );
+ void InsertText( const OutlinerParaObject& rParaObj );
+ void Expand();
+ void Collapse();
+ void ExpandAll();
+ void CollapseAll();
+
+ void SetBackgroundColor( const Color& rColor );
+ Color GetBackgroundColor();
+
+ SfxItemSet GetAttribs();
+
+ void Cut();
+ void Copy();
+ void Paste();
+ void PasteSpecial();
+
+ const SfxStyleSheet* GetStyleSheet() const;
+ SfxStyleSheet* GetStyleSheet();
+
+ void SetControlWord( sal_uLong nWord );
+ sal_uLong GetControlWord() const;
+
+ void SetAnchorMode( EVAnchorMode eMode );
+ EVAnchorMode GetAnchorMode() const;
+
+ Pointer GetPointer( const Point& rPosPixel );
+ void Command( const CommandEvent& rCEvt );
+
+ EESpellState StartSpeller( sal_Bool bMultipleDoc = sal_False );
+ EESpellState StartThesaurus();
+ sal_uInt16 StartSearchAndReplace( const SvxSearchItem& rSearchItem );
+
+ // for text conversion
+ void StartTextConversion( LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont, sal_Int32 nOptions, sal_Bool bIsInteractive, sal_Bool bMultipleDoc );
+
+ void TransliterateText( sal_Int32 nTransliterationMode );
+
+ ESelection GetSelection();
+
+ sal_uInt16 GetSelectedScriptType() const;
+
+ void SetVisArea( const Rectangle& rRect );
+ void SetSelection( const ESelection& );
+
+ void RemoveAttribs( sal_Bool bRemoveParaAttribs = sal_False, sal_uInt16 nWhich = 0, sal_Bool bKeepLanguages = sal_False );
+ void RemoveAttribsKeepLanguages( sal_Bool bRemoveParaAttribs );
+ sal_Bool HasSelection() const;
+
+ void InsertField( const SvxFieldItem& rFld );
+ const SvxFieldItem* GetFieldUnderMousePointer() const;
+ const SvxFieldItem* GetFieldAtSelection() const;
+
+ /** enables numbering for the selected paragraphs if the numbering of the first paragraph is off
+ or disables numbering for the selected paragraphs if the numbering of the first paragraph is on
+ */
+ void ToggleBullets();
+
+ /** enables numbering for the selected paragraphs that are not enabled and ignore all selected
+ paragraphs that already have numbering enabled.
+ */
+ void EnableBullets();
+
+ sal_Bool IsCursorAtWrongSpelledWord( sal_Bool bMarkIfWrong = sal_False );
+ sal_Bool IsWrongSpelledWordAtPos( const Point& rPosPixel, sal_Bool bMarkIfWrong = sal_False );
+ void ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack = 0 );
+
+ void SetInvalidateMore( sal_uInt16 nPixel );
+ sal_uInt16 GetInvalidateMore() const;
+
+ String GetSurroundingText() const;
+ Selection GetSurroundingTextSelection() const;
+};
+
+
+// some thesaurus functionality to avoid code duplication in different projects...
+bool EDITENG_DLLPUBLIC GetStatusValueForThesaurusFromContext( String &rStatusVal, LanguageType &rLang, const EditView &rEditView );
+void EDITENG_DLLPUBLIC ReplaceTextWithSynonym( EditView &rEditView, const String &rSynonmText );
+
+typedef ::std::vector< OutlinerView* > ViewList;
+
+class EDITENG_DLLPUBLIC DrawPortionInfo
+{
+public:
+ const Point& mrStartPos;
+ const String& mrText;
+ sal_uInt16 mnTextStart;
+ sal_uInt16 mnTextLen;
+ sal_uInt16 mnPara;
+ xub_StrLen mnIndex;
+ const SvxFont& mrFont;
+ const sal_Int32* mpDXArray;
+
+ const EEngineData::WrongSpellVector* mpWrongSpellVector;
+ const SvxFieldData* mpFieldData;
+ const ::com::sun::star::lang::Locale* mpLocale;
+ const Color maOverlineColor;
+ const Color maTextLineColor;
+
+ sal_uInt8 mnBiDiLevel;
+
+ bool mbFilled;
+ long mnWidthToFill;
+
+ // bitfield
+ unsigned mbEndOfLine : 1;
+ unsigned mbEndOfParagraph : 1;
+ unsigned mbEndOfBullet : 1;
+
+ sal_uInt8 GetBiDiLevel() const { return mnBiDiLevel; }
+ sal_Bool IsRTL() const { return mnBiDiLevel % 2 ? sal_True : sal_False; }
+
+ DrawPortionInfo(
+ const Point& rPos,
+ const String& rTxt,
+ sal_uInt16 nTxtStart,
+ sal_uInt16 nTxtLen,
+ const SvxFont& rFnt,
+ sal_uInt16 nPar,
+ xub_StrLen nIdx,
+ const sal_Int32* pDXArr,
+ const EEngineData::WrongSpellVector* pWrongSpellVector,
+ const SvxFieldData* pFieldData,
+ const ::com::sun::star::lang::Locale* pLocale,
+ const Color& rOverlineColor,
+ const Color& rTextLineColor,
+ sal_uInt8 nBiDiLevel,
+ bool bFilled,
+ long nWidthToFill,
+ bool bEndOfLine,
+ bool bEndOfParagraph,
+ bool bEndOfBullet)
+ : mrStartPos(rPos),
+ mrText(rTxt),
+ mnTextStart(nTxtStart),
+ mnTextLen(nTxtLen),
+ mnPara(nPar),
+ mnIndex(nIdx),
+ mrFont(rFnt),
+ mpDXArray(pDXArr),
+ mpWrongSpellVector(pWrongSpellVector),
+ mpFieldData(pFieldData),
+ mpLocale(pLocale),
+ maOverlineColor(rOverlineColor),
+ maTextLineColor(rTextLineColor),
+ mnBiDiLevel(nBiDiLevel),
+ mbFilled( bFilled ),
+ mnWidthToFill( nWidthToFill ),
+ mbEndOfLine(bEndOfLine),
+ mbEndOfParagraph(bEndOfParagraph),
+ mbEndOfBullet(bEndOfBullet)
+ {}
+};
+
+class EDITENG_DLLPUBLIC DrawBulletInfo
+{
+public:
+ const GraphicObject maBulletGraphicObject;
+ Point maBulletPosition;
+ Size maBulletSize;
+
+ DrawBulletInfo(
+ const GraphicObject& rBulletGraphicObject,
+ const Point& rBulletPosition,
+ const Size& rBulletSize)
+ : maBulletGraphicObject(rBulletGraphicObject),
+ maBulletPosition(rBulletPosition),
+ maBulletSize(rBulletSize)
+ {}
+};
+
+struct EDITENG_DLLPUBLIC PaintFirstLineInfo
+{
+ sal_uInt16 mnPara;
+ const Point& mrStartPos;
+ long mnBaseLineY;
+ const Point& mrOrigin;
+ short mnOrientation;
+ OutputDevice* mpOutDev;
+
+ PaintFirstLineInfo( sal_uInt16 nPara, const Point& rStartPos, long nBaseLineY, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev )
+ : mnPara( nPara ), mrStartPos( rStartPos ), mnBaseLineY( nBaseLineY ), mrOrigin( rOrigin ), mnOrientation( nOrientation ), mpOutDev( pOutDev )
+ {}
+};
+
+class SdrPage;
+
+class EditFieldInfo
+{
+private:
+ Outliner* pOutliner;
+ const SvxFieldItem& rFldItem;
+
+ Color* pTxtColor;
+ Color* pFldColor;
+
+ String aRepresentation;
+
+ sal_uInt16 nPara;
+ xub_StrLen nPos;
+ sal_Bool bSimpleClick;
+
+ EditFieldInfo();
+ EditFieldInfo( const EditFieldInfo& );
+
+ SdrPage* mpSdrPage;
+
+public:
+ EditFieldInfo( Outliner* pOutl, const SvxFieldItem& rFItem, sal_uInt16 nPa, xub_StrLen nPo )
+ : rFldItem( rFItem )
+ {
+ pOutliner = pOutl;
+ nPara = nPa; nPos = nPo;
+ pTxtColor = 0; pFldColor = 0; bSimpleClick = sal_False;
+ mpSdrPage = 0;
+ }
+ ~EditFieldInfo()
+ {
+ delete pTxtColor;
+ delete pFldColor;
+ }
+
+ Outliner* GetOutliner() const { return pOutliner; }
+
+ const SvxFieldItem& GetField() const { return rFldItem; }
+
+ Color* GetTxtColor() const { return pTxtColor; }
+ void SetTxtColor( const Color& rColor )
+ { delete pTxtColor; pTxtColor = new Color( rColor ); }
+
+ Color* GetFldColor() const { return pFldColor; }
+ void SetFldColor( const Color& rColor )
+ { delete pFldColor; pFldColor = new Color( rColor ); }
+ void ClearFldColor()
+ { delete pFldColor; pFldColor = 0; }
+
+ sal_uInt16 GetPara() const { return nPara; }
+ xub_StrLen GetPos() const { return nPos; }
+
+ sal_Bool IsSimpleClick() const { return bSimpleClick; }
+ void SetSimpleClick( sal_Bool bSimple ) { bSimpleClick = bSimple; }
+
+ const String& GetRepresentation() const { return aRepresentation; }
+ String& GetRepresentation() { return aRepresentation; }
+ void SetRepresentation( const String& rStr ) { aRepresentation = rStr; }
+
+ void SetSdrPage( SdrPage* pPage ) { mpSdrPage = pPage; }
+ SdrPage* GetSdrPage() const { return mpSdrPage; }
+};
+
+struct EBulletInfo
+{
+ sal_Bool bVisible;
+ sal_uInt16 nType; // see SvxNumberType
+ String aText;
+ SvxFont aFont;
+ Graphic aGraphic;
+ sal_uInt16 nParagraph;
+ Rectangle aBounds;
+
+ EBulletInfo() : bVisible( sal_False ), nType( 0 ), nParagraph( EE_PARA_NOT_FOUND ) {}
+};
+
+#define OUTLINERMODE_DONTKNOW 0x0000
+#define OUTLINERMODE_TEXTOBJECT 0x0001
+#define OUTLINERMODE_TITLEOBJECT 0x0002
+#define OUTLINERMODE_OUTLINEOBJECT 0x0003
+#define OUTLINERMODE_OUTLINEVIEW 0x0004
+
+#define OUTLINERMODE_USERMASK 0x00FF
+
+#define OUTLINERMODE_SUBTITLE (0x0100|OUTLINERMODE_TEXTOBJECT)
+#define OUTLINERMODE_NOTE (0x0200|OUTLINERMODE_TEXTOBJECT)
+
+class EDITENG_DLLPUBLIC Outliner : public SfxBroadcaster
+{
+ friend class OutlinerView;
+ friend class OutlinerEditEng;
+ friend class OutlinerParaObject;
+ friend class OLUndoExpand;
+ friend class OutlinerUndoChangeDepth;
+ friend class OutlinerUndoCheckPara;
+ friend class OutlinerUndoChangeParaFlags;
+
+ OutlinerEditEng* pEditEngine;
+
+ ParagraphList* pParaList;
+ ViewList aViewList;
+
+ Paragraph* pHdlParagraph;
+ sal_uLong mnFirstSelPage;
+ Link aDrawPortionHdl;
+ Link aDrawBulletHdl;
+ Link aExpandHdl;
+ Link aParaInsertedHdl;
+ Link aParaRemovingHdl;
+ Link aDepthChangedHdl;
+ Link aWidthArrReqHdl;
+ Link aBeginMovingHdl;
+ Link aEndMovingHdl;
+ Link aIndentingPagesHdl;
+ Link aRemovingPagesHdl;
+ Link aFieldClickedHdl;
+ Link aCalcFieldValueHdl;
+ Link maPaintFirstLineHdl;
+ Link maBeginPasteOrDropHdl;
+ Link maEndPasteOrDropHdl;
+
+ sal_Int16 nDepthChangedHdlPrevDepth;
+ sal_uInt16 mnDepthChangeHdlPrevFlags;
+ sal_Int16 nMaxDepth;
+ const sal_Int16 nMinDepth;
+ sal_uInt16 nFirstPage;
+
+ sal_uInt16 nOutlinerMode;
+
+ sal_Bool bIsExpanding; // Only valid in Expand/Collaps-Hdl, reset
+ sal_Bool bFirstParaIsEmpty;
+ sal_Bool bBlockInsCallback;
+ sal_Bool bStrippingPortions;
+ sal_Bool bPasting;
+
+ sal_uLong nDummy;
+
+#ifdef _OUTLINER_CXX
+
+ DECL_LINK( ParaVisibleStateChangedHdl, Paragraph* );
+ DECL_LINK( BeginMovingParagraphsHdl, void* );
+ DECL_LINK( EndMovingParagraphsHdl, MoveParagraphsInfo* );
+ DECL_LINK( BeginPasteOrDropHdl, PasteOrDropInfos* );
+ DECL_LINK( EndPasteOrDropHdl, PasteOrDropInfos* );
+ DECL_LINK( EditEngineNotifyHdl, EENotify* );
+ void ImplCheckParagraphs( sal_uInt16 nStart, sal_uInt16 nEnd );
+ sal_Bool ImplHasBullet( sal_uInt16 nPara ) const;
+ Size ImplGetBulletSize( sal_uInt16 nPara );
+ sal_uInt16 ImplGetNumbering( sal_uInt16 nPara, const SvxNumberFormat* pParaFmt );
+ void ImplCalcBulletText( sal_uInt16 nPara, sal_Bool bRecalcLevel, sal_Bool bRecalcChildren );
+ String ImplGetBulletText( sal_uInt16 nPara );
+ void ImplCheckNumBulletItem( sal_uInt16 nPara );
+ void ImplInitDepth( sal_uInt16 nPara, sal_Int16 nDepth, sal_Bool bCreateUndo, sal_Bool bUndoAction = sal_False );
+ void ImplSetLevelDependendStyleSheet( sal_uInt16 nPara, SfxStyleSheet* pLevelStyle = NULL );
+
+ void ImplBlockInsertionCallbacks( sal_Bool b );
+
+ void ImplCheckStyleSheet( sal_uInt16 nPara, sal_Bool bReplaceExistingStyle );
+ void ImpRecalcBulletIndent( sal_uLong nPara );
+
+ const SvxBulletItem& ImpGetBullet( sal_uLong nPara, sal_uInt16& );
+ void ImpFilterIndents( sal_uLong nFirstPara, sal_uLong nLastPara );
+ bool ImpConvertEdtToOut( sal_uInt32 nPara, EditView* pView = 0 );
+
+ void ImpTextPasted( sal_uLong nStartPara, sal_uInt16 nCount );
+ long ImpCalcMaxBulletWidth( sal_uInt16 nPara, const SvxBulletItem& rBullet );
+ Font ImpCalcBulletFont( sal_uInt16 nPara ) const;
+ Rectangle ImpCalcBulletArea( sal_uInt16 nPara, sal_Bool bAdjust, sal_Bool bReturnPaperPos );
+ long ImpGetTextIndent( sal_uLong nPara );
+ sal_Bool ImpCanIndentSelectedPages( OutlinerView* pCurView );
+ sal_Bool ImpCanDeleteSelectedPages( OutlinerView* pCurView );
+ sal_Bool ImpCanDeleteSelectedPages( OutlinerView* pCurView, sal_uInt16 nFirstPage, sal_uInt16 nPages );
+
+ sal_uInt16 ImplGetOutlinerMode() const { return nOutlinerMode & OUTLINERMODE_USERMASK; }
+ void ImplCheckDepth( sal_Int16& rnDepth ) const;
+#endif
+
+protected:
+ void ParagraphInserted( sal_uInt16 nParagraph );
+ void ParagraphDeleted( sal_uInt16 nParagraph );
+ void ParaAttribsChanged( sal_uInt16 nParagraph );
+
+ virtual void StyleSheetChanged( SfxStyleSheet* pStyle );
+
+ void InvalidateBullet( Paragraph* pPara, sal_uLong nPara );
+ void PaintBullet( sal_uInt16 nPara, const Point& rStartPos,
+ const Point& rOrigin, short nOrientation,
+ OutputDevice* pOutDev );
+
+ // used by OutlinerEditEng. Allows Outliner objects to provide
+ // bullet access to the EditEngine.
+ virtual const SvxNumberFormat* GetNumberFormat( sal_uInt16 nPara ) const;
+
+public:
+
+ Outliner( SfxItemPool* pPool, sal_uInt16 nOutlinerMode );
+ virtual ~Outliner();
+
+ void Init( sal_uInt16 nOutlinerMode );
+ sal_uInt16 GetMode() const { return nOutlinerMode; }
+
+ void SetVertical( sal_Bool bVertical );
+ sal_Bool IsVertical() const;
+
+ void SetFixedCellHeight( sal_Bool bUseFixedCellHeight );
+
+ void SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir );
+ EEHorizontalTextDirection GetDefaultHorizontalTextDirection() const;
+
+ sal_uInt16 GetScriptType( const ESelection& rSelection ) const;
+ LanguageType GetLanguage( sal_uInt16 nPara, sal_uInt16 nPos ) const;
+
+ void SetAsianCompressionMode( sal_uInt16 nCompressionMode );
+
+ void SetKernAsianPunctuation( sal_Bool bEnabled );
+
+ void SetAddExtLeading( sal_Bool b );
+
+ size_t InsertView( OutlinerView* pView, size_t nIndex = size_t(-1) );
+ OutlinerView* RemoveView( OutlinerView* pView );
+ OutlinerView* RemoveView( size_t nIndex );
+ OutlinerView* GetView( size_t nIndex ) const;
+ size_t GetViewCount() const;
+
+ Paragraph* Insert( const String& rText, sal_uLong nAbsPos = CONTAINER_APPEND, sal_Int16 nDepth = 0 );
+ void SetText( const OutlinerParaObject& );
+ void AddText( const OutlinerParaObject& );
+ void SetText( const String& rText, Paragraph* pParagraph );
+ String GetText( Paragraph* pPara, sal_uLong nParaCount=1 ) const;
+
+ OutlinerParaObject* CreateParaObject( sal_uInt16 nStartPara = 0, sal_uInt16 nParaCount = 0xFFFF ) const;
+
+ const SfxItemSet& GetEmptyItemSet() const;
+
+ void SetRefMapMode( const MapMode& );
+ MapMode GetRefMapMode() const;
+
+ void SetBackgroundColor( const Color& rColor );
+ Color GetBackgroundColor() const;
+
+ sal_Int16 GetMinDepth() const { return -1; }
+
+ void SetMaxDepth( sal_Int16 nDepth, sal_Bool bCheckParas = sal_False );
+ sal_Int16 GetMaxDepth() const { return nMaxDepth; }
+
+ void SetUpdateMode( sal_Bool bUpdate );
+ sal_Bool GetUpdateMode() const;
+
+ void Clear();
+
+ void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich );
+
+ sal_uLong GetParagraphCount() const;
+ Paragraph* GetParagraph( sal_uLong nAbsPos ) const;
+
+ sal_Bool HasParent( Paragraph* pParagraph ) const;
+ sal_Bool HasChildren( Paragraph* pParagraph ) const;
+ sal_uLong GetChildCount( Paragraph* pParent ) const;
+ sal_Bool IsExpanded( Paragraph* pPara ) const;
+ Paragraph* GetParent( Paragraph* pParagraph ) const;
+ sal_uLong GetAbsPos( Paragraph* pPara );
+
+ sal_Int16 GetDepth( sal_uLong nPara ) const;
+ void SetDepth( Paragraph* pParagraph, sal_Int16 nNewDepth );
+
+ sal_Bool IsVisible( Paragraph* pPara ) const { return pPara->IsVisible(); }
+
+ void EnableUndo( sal_Bool bEnable );
+ sal_Bool IsUndoEnabled() const;
+ void UndoActionStart( sal_uInt16 nId );
+ void UndoActionEnd( sal_uInt16 nId );
+ void InsertUndo( EditUndo* pUndo );
+ sal_Bool IsInUndo();
+
+ void ClearModifyFlag();
+ sal_Bool IsModified() const;
+
+ Paragraph* GetHdlParagraph() const { return pHdlParagraph; }
+ sal_Bool IsExpanding() const { return bIsExpanding; }
+
+ virtual void ExpandHdl();
+ void SetExpandHdl( const Link& rLink ) { aExpandHdl = rLink; }
+ Link GetExpandHdl() const { return aExpandHdl; }
+
+ virtual void ParagraphInsertedHdl();
+ void SetParaInsertedHdl(const Link& rLink){aParaInsertedHdl=rLink;}
+ Link GetParaInsertedHdl() const { return aParaInsertedHdl; }
+
+ virtual void ParagraphRemovingHdl();
+ void SetParaRemovingHdl(const Link& rLink){aParaRemovingHdl=rLink;}
+ Link GetParaRemovingHdl() const { return aParaRemovingHdl; }
+
+ virtual void DepthChangedHdl();
+ void SetDepthChangedHdl(const Link& rLink){aDepthChangedHdl=rLink;}
+ Link GetDepthChangedHdl() const { return aDepthChangedHdl; }
+ sal_Int16 GetPrevDepth() const { return nDepthChangedHdlPrevDepth; }
+ sal_uInt16 GetPrevFlags() const { return mnDepthChangeHdlPrevFlags; }
+
+ virtual long RemovingPagesHdl( OutlinerView* );
+ void SetRemovingPagesHdl(const Link& rLink){aRemovingPagesHdl=rLink;}
+ Link GetRemovingPagesHdl() const { return aRemovingPagesHdl; }
+ virtual long IndentingPagesHdl( OutlinerView* );
+ void SetIndentingPagesHdl(const Link& rLink){aIndentingPagesHdl=rLink;}
+ Link GetIndentingPagesHdl() const { return aIndentingPagesHdl; }
+ // valid only in the two upper handlers
+ sal_uInt16 GetSelPageCount() const { return nDepthChangedHdlPrevDepth; }
+
+ // valid only in the two upper handlers
+ sal_uLong GetFirstSelPage() const { return mnFirstSelPage; }
+
+ void SetCalcFieldValueHdl(const Link& rLink ) { aCalcFieldValueHdl= rLink; }
+ Link GetCalcFieldValueHdl() const { return aCalcFieldValueHdl; }
+
+ void SetFieldClickedHdl(const Link& rLink ) { aFieldClickedHdl= rLink; }
+ Link GetFieldClickedHdl() const { return aFieldClickedHdl; }
+
+ void SetDrawPortionHdl(const Link& rLink){aDrawPortionHdl=rLink;}
+ Link GetDrawPortionHdl() const { return aDrawPortionHdl; }
+
+ void SetDrawBulletHdl(const Link& rLink){aDrawBulletHdl=rLink;}
+ Link GetDrawBulletHdl() const { return aDrawBulletHdl; }
+
+ void SetPaintFirstLineHdl(const Link& rLink) { maPaintFirstLineHdl = rLink; }
+ Link GetPaintFirstLineHdl() const { return maPaintFirstLineHdl; }
+
+ void SetModifyHdl( const Link& rLink );
+ Link GetModifyHdl() const;
+
+ void SetNotifyHdl( const Link& rLink );
+
+ void SetStatusEventHdl( const Link& rLink );
+ Link GetStatusEventHdl() const;
+
+ void Draw( OutputDevice* pOutDev, const Rectangle& rOutRect );
+ void Draw( OutputDevice* pOutDev, const Point& rStartPos, short nOrientation = 0 );
+
+ const Size& GetPaperSize() const;
+ void SetPaperSize( const Size& rSize );
+
+ void SetFirstPageNumber( sal_uInt16 n ) { nFirstPage = n; }
+ sal_uInt16 GetFirstPageNumber() const { return nFirstPage; }
+
+ void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon );
+ void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon);
+ void ClearPolygon();
+
+ const Size& GetMinAutoPaperSize() const;
+ void SetMinAutoPaperSize( const Size& rSz );
+
+ const Size& GetMaxAutoPaperSize() const;
+ void SetMaxAutoPaperSize( const Size& rSz );
+
+ void SetDefTab( sal_uInt16 nTab );
+
+ sal_Bool IsFlatMode() const;
+ void SetFlatMode( sal_Bool bFlat );
+
+ void EnableAutoColor( sal_Bool b );
+
+ void ForceAutoColor( sal_Bool b );
+ sal_Bool IsForceAutoColor() const;
+
+ EBulletInfo GetBulletInfo( sal_uInt16 nPara );
+
+ void SetWordDelimiters( const String& rDelimiters );
+ String GetWordDelimiters() const;
+ String GetWord( sal_uInt16 nPara, xub_StrLen nIndex );
+
+ void StripPortions();
+
+ virtual void DrawingText(
+ const Point& rStartPos, const String& rText, sal_uInt16 nTextStart, sal_uInt16 nTextLen,
+ const sal_Int32* pDXArray, const SvxFont& rFont, sal_uInt16 nPara, xub_StrLen nIndex, sal_uInt8 nRightToLeft,
+ const EEngineData::WrongSpellVector* pWrongSpellVector,
+ const SvxFieldData* pFieldData,
+ bool bEndOfLine,
+ bool bEndOfParagraph,
+ bool bEndOfBullet,
+ const ::com::sun::star::lang::Locale* pLocale,
+ const Color& rOverlineColor,
+ const Color& rTextLineColor);
+
+ virtual void DrawingTab(
+ const Point& rStartPos, long nWidth, const String& rChar,
+ const SvxFont& rFont, sal_uInt16 nPara, xub_StrLen nIndex, sal_uInt8 nRightToLeft,
+ bool bEndOfLine,
+ bool bEndOfParagraph,
+ const Color& rOverlineColor,
+ const Color& rTextLineColor);
+
+ Size CalcTextSize();
+ Size CalcTextSizeNTP();
+
+ void SetStyleSheetPool( SfxStyleSheetPool* pSPool );
+ SfxStyleSheetPool* GetStyleSheetPool();
+
+ sal_Bool IsInSelectionMode() const;
+
+ void SetStyleSheet( sal_uLong nPara, SfxStyleSheet* pStyle );
+ SfxStyleSheet* GetStyleSheet( sal_uLong nPara );
+
+ void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& );
+ SfxItemSet GetParaAttribs( sal_uInt16 nPara );
+
+ void Remove( Paragraph* pPara, sal_uLong nParaCount );
+ sal_Bool Expand( Paragraph* );
+ sal_Bool Collapse( Paragraph* );
+
+ void SetParaFlag( Paragraph* pPara, sal_uInt16 nFlag );
+ bool HasParaFlag( const Paragraph* pPara, sal_uInt16 nFlag ) const;
+
+ // Returns an array containing the widths of the Bullet Indentations
+ // Last value must be -1. Is deleted by the outliner.
+ Link GetWidthArrReqHdl() const{ return aWidthArrReqHdl; }
+ void SetWidthArrReqHdl(const Link& rLink){aWidthArrReqHdl=rLink; }
+
+ void SetControlWord( sal_uLong nWord );
+ sal_uLong GetControlWord() const;
+
+ Link GetBeginMovingHdl() const { return aBeginMovingHdl; }
+ void SetBeginMovingHdl(const Link& rLink) {aBeginMovingHdl=rLink;}
+ Link GetEndMovingHdl() const {return aEndMovingHdl;}
+ void SetEndMovingHdl( const Link& rLink){aEndMovingHdl=rLink;}
+
+ sal_uLong GetLineCount( sal_uLong nParagraph ) const;
+ sal_uInt16 GetLineLen( sal_uLong nParagraph, sal_uInt16 nLine ) const;
+ sal_uLong GetLineHeight( sal_uLong nParagraph, sal_uLong nLine = 0 );
+
+ // nFormat must be a value from the enum EETextFormat (due to CLOOKS)
+ sal_uLong Read( SvStream& rInput, const String& rBaseURL, sal_uInt16, SvKeyValueIterator* pHTTPHeaderAttrs = NULL );
+
+ ::svl::IUndoManager&
+ GetUndoManager();
+
+ void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel );
+ void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel );
+ void QuickInsertLineBreak( const ESelection& rSel );
+
+ // Only for EditEngine mode
+ void QuickInsertText( const String& rText, const ESelection& rSel );
+ void QuickDelete( const ESelection& rSel );
+ void QuickRemoveCharAttribs( sal_uInt16 nPara, sal_uInt16 nWhich = 0 );
+ void QuickFormatDoc( sal_Bool bFull = sal_False );
+
+ sal_Bool UpdateFields();
+ void RemoveFields( sal_Bool bKeepFieldText, TypeId aType = NULL );
+
+ virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos );
+ virtual void FieldSelected( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos );
+ virtual String CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos, Color*& rTxtColor, Color*& rFldColor );
+
+ void SetSpeller( ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 > &xSpeller );
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 >
+ GetSpeller();
+ void SetHyphenator( ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenator >& xHyph );
+
+ void SetForbiddenCharsTable( rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars );
+
+ // Depricated
+ void SetDefaultLanguage( LanguageType eLang );
+ LanguageType GetDefaultLanguage() const;
+
+ void CompleteOnlineSpelling();
+
+ EESpellState HasSpellErrors();
+ sal_Bool HasText( const SvxSearchItem& rSearchItem );
+ virtual sal_Bool SpellNextDocument();
+
+ // for text conversion
+ sal_Bool HasConvertibleTextPortion( LanguageType nLang );
+ virtual sal_Bool ConvertNextDocument();
+
+ void SetEditTextObjectPool( SfxItemPool* pPool );
+ SfxItemPool* GetEditTextObjectPool() const;
+
+ void SetRefDevice( OutputDevice* pRefDev );
+ OutputDevice* GetRefDevice() const;
+
+ sal_uLong GetTextHeight() const;
+ sal_uLong GetTextHeight( sal_uLong nParagraph ) const;
+ Point GetDocPosTopLeft( sal_uLong nParagraph );
+ Point GetDocPos( const Point& rPaperPos ) const;
+ sal_Bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder = 0 );
+ sal_Bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder, sal_Bool* pbBuuletPos );
+
+ void SetGlobalCharStretching( sal_uInt16 nX = 100, sal_uInt16 nY = 100 );
+ void GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY ) const;
+ void EraseVirtualDevice();
+
+ sal_Bool ShouldCreateBigTextObject() const;
+
+ const EditEngine& GetEditEngine() const { return *((EditEngine*)pEditEngine); }
+
+ // this is needed for StarOffice Api
+ void SetLevelDependendStyleSheet( sal_uInt16 nPara );
+
+ sal_uInt16 GetOutlinerMode() const { return nOutlinerMode & OUTLINERMODE_USERMASK; }
+
+ void StartSpelling(EditView& rEditView, sal_Bool bMultipleDoc);
+ // spell and return a sentence
+ bool SpellSentence(EditView& rEditView, ::svx::SpellPortions& rToFill, bool bIsGrammarChecking );
+ // put spell position to start of current sentence
+ void PutSpellingToSentenceStart( EditView& rEditView );
+ // applies a changed sentence
+ void ApplyChangedSentence(EditView& rEditView, const ::svx::SpellPortions& rNewPortions, bool bRecheck );
+
+ /** sets a link that is called at the beginning of a drag operation at an edit view */
+ void SetBeginDropHdl( const Link& rLink );
+
+ /** sets a link that is called at the end of a drag operation at an edit view */
+ void SetEndDropHdl( const Link& rLink );
+
+ /** sets a link that is called before a drop or paste operation. */
+ void SetBeginPasteOrDropHdl( const Link& rLink );
+ Link GetBeginPasteOrDropHdl() const { return maBeginPasteOrDropHdl; }
+
+ /** sets a link that is called after a drop or paste operation. */
+ void SetEndPasteOrDropHdl( const Link& rLink );
+ Link GetEndPasteOrDropHdl() const { return maEndPasteOrDropHdl; }
+
+ virtual sal_Int16 GetNumberingStartValue( sal_uInt16 nPara );
+ virtual void SetNumberingStartValue( sal_uInt16 nPara, sal_Int16 nNumberingStartValue );
+
+ virtual sal_Bool IsParaIsNumberingRestart( sal_uInt16 nPara );
+ virtual void SetParaIsNumberingRestart( sal_uInt16 nPara, sal_Bool bParaIsNumberingRestart );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/outlobj.hxx b/include/editeng/outlobj.hxx
new file mode 100644
index 000000000000..73eb9b5b96d5
--- /dev/null
+++ b/include/editeng/outlobj.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _OUTLOBJ_HXX
+#define _OUTLOBJ_HXX
+
+//////////////////////////////////////////////////////////////////////////////
+
+#include <tools/solar.h>
+#include <tools/string.hxx>
+#include <rsc/rscsfx.hxx>
+#include <editeng/paragraphdata.hxx>
+#include "editeng/editengdllapi.h"
+
+class EditTextObject;
+class ImplOutlinerParaObject;
+
+//////////////////////////////////////////////////////////////////////////////
+
+class EDITENG_DLLPUBLIC OutlinerParaObject
+{
+private:
+ ImplOutlinerParaObject* mpImplOutlinerParaObject;
+
+ void ImplMakeUnique();
+
+public:
+ // constructors/destructor
+ OutlinerParaObject(
+ const EditTextObject& rEditTextObject,
+ const ParagraphDataVector& rParagraphDataVector = ParagraphDataVector(),
+ bool bIsEditDoc = true);
+ OutlinerParaObject(const OutlinerParaObject& rCandidate);
+ ~OutlinerParaObject();
+
+ // assignment operator
+ OutlinerParaObject& operator=(const OutlinerParaObject& rCandidate);
+
+ // compare operator
+ bool operator==(const OutlinerParaObject& rCandidate) const;
+ bool operator!=(const OutlinerParaObject& rCandidate) const { return !operator==(rCandidate); }
+
+ // #i102062#
+ bool isWrongListEqual(const OutlinerParaObject& rCompare) const;
+
+ // outliner mode access
+ sal_uInt16 GetOutlinerMode() const;
+ void SetOutlinerMode(sal_uInt16 nNew);
+
+ // vertical access
+ bool IsVertical() const;
+ void SetVertical(bool bNew);
+
+ // data read access
+ sal_uInt32 Count() const;
+ sal_Int16 GetDepth(sal_uInt16 nPara) const;
+ const EditTextObject& GetTextObject() const;
+ bool IsEditDoc() const;
+ const ParagraphData& GetParagraphData(sal_uInt32 nIndex) const;
+
+ // portion info support
+ void ClearPortionInfo();
+
+ // StyleSheet support
+ bool ChangeStyleSheets(const OUString& rOldName, SfxStyleFamily eOldFamily,
+ const OUString& rNewName, SfxStyleFamily eNewFamily);
+ void ChangeStyleSheetName(SfxStyleFamily eFamily, const OUString& rOldName,
+ const OUString& rNewName);
+ void SetStyleSheets(sal_uInt16 nLevel, const OUString rNewName,
+ const SfxStyleFamily& rNewFamily);
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/paperinf.hxx b/include/editeng/paperinf.hxx
new file mode 100644
index 000000000000..2c53ca554122
--- /dev/null
+++ b/include/editeng/paperinf.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_PAPERINF_HXX
+#define _SVX_PAPERINF_HXX
+
+// INCLUDE ---------------------------------------------------------------
+
+#include <vcl/print.hxx>
+#include <vcl/mapmod.hxx>
+#include <editeng/svxenum.hxx>
+#include "editeng/editengdllapi.h"
+
+// forward ---------------------------------------------------------------
+
+class Printer;
+class Size;
+class String;
+
+// class SvxPaperInfo -----------------------------------------------------
+
+class EDITENG_DLLPUBLIC SvxPaperInfo
+{
+public:
+ static Size GetDefaultPaperSize( MapUnit eUnit = MAP_TWIP );
+ static Size GetPaperSize( Paper ePaper, MapUnit eUnit = MAP_TWIP );
+ static Size GetPaperSize( const Printer* pPrinter );
+ static Paper GetSvxPaper( const Size &rSize, MapUnit eUnit = MAP_TWIP, bool bSloppy = sal_False );
+ static long GetSloppyPaperDimension( long nSize, MapUnit eUnit = MAP_TWIP );
+ static String GetName( Paper ePaper );
+};
+
+// INLINE -----------------------------------------------------------------
+
+inline Size &Swap(Size &rSize)
+{
+ const long lVal = rSize.Width();
+ rSize.Width() = rSize.Height();
+ rSize.Height() = lVal;
+ return rSize;
+}
+
+inline Size &LandscapeSwap(Size &rSize)
+{
+ if ( rSize.Height() > rSize.Width() )
+ Swap( rSize );
+ return rSize;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/paragraphdata.hxx b/include/editeng/paragraphdata.hxx
new file mode 100644
index 000000000000..81d12bb00a2f
--- /dev/null
+++ b/include/editeng/paragraphdata.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _PARAGRAPH_DATA_HXX
+#define _PARAGRAPH_DATA_HXX
+
+#include <tools/solar.h>
+#include <vector>
+
+//////////////////////////////////////////////////////////////////////////////
+// Only for internal use, oder some kind like hPara for the few
+// functions where you need it outside ( eg. moving paragraphs... )
+//
+// Unfortunately NOT only local (formally in outliner.hxx), but also
+// used in outlobj.hxx. Moved to own header
+
+class ParagraphData
+{
+ friend class Paragraph;
+ friend class OutlinerParaObject;
+
+protected:
+ sal_Int16 nDepth;
+ sal_Int16 mnNumberingStartValue;
+ sal_Bool mbParaIsNumberingRestart;
+
+public:
+ ParagraphData( const ParagraphData& );
+ ParagraphData();
+
+ ParagraphData& operator=( const ParagraphData& );
+
+ // compare operator
+ bool operator==(const ParagraphData& rCandidate) const;
+
+ // data read access
+ sal_Int16 getDepth() const { return nDepth; }
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+typedef ::std::vector< ParagraphData > ParagraphDataVector;
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // _PARAGRAPH_DATA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/paravertalignitem.hxx b/include/editeng/paravertalignitem.hxx
new file mode 100644
index 000000000000..ab65b8994325
--- /dev/null
+++ b/include/editeng/paravertalignitem.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_PARAVERTALIGNITEM_HXX
+#define _SVX_PARAVERTALIGNITEM_HXX
+
+#include <svl/intitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxParaVertAlignItem ----------------------------------------------
+
+/* [Description]
+
+ This item defines the character alignment in the lines of a paragraph.
+ Currently the alignment can be none (i.e. baseline), top, center or bottom.
+
+*/
+
+class EDITENG_DLLPUBLIC SvxParaVertAlignItem : public SfxUInt16Item
+{
+public:
+ enum { AUTOMATIC, BASELINE, TOP, CENTER, BOTTOM };
+ TYPEINFO();
+
+ SvxParaVertAlignItem( sal_uInt16 nValue /*= 0*/,
+ const sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream & rStrm, sal_uInt16 nIVer) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper * = 0 ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ inline SvxParaVertAlignItem& operator=( const SvxParaVertAlignItem& rItem )
+ {
+ SetValue( rItem.GetValue() );
+ return *this;
+ }
+
+ virtual int operator==( const SfxPoolItem& ) const;
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/pbinitem.hxx b/include/editeng/pbinitem.hxx
new file mode 100644
index 000000000000..38630c78f86c
--- /dev/null
+++ b/include/editeng/pbinitem.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_PBINITEM_HXX
+#define _SVX_PBINITEM_HXX
+
+#include <svl/intitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// define ----------------------------------------------------------------
+
+#define PAPERBIN_PRINTER_SETTINGS ((sal_uInt8)0xFF)
+
+// class SvxPaperBinItem -------------------------------------------------
+
+/* [Description]
+
+ This item describes selecting a paper tray of the printer.
+*/
+
+class EDITENG_DLLPUBLIC SvxPaperBinItem : public SfxByteItem
+{
+public:
+ TYPEINFO();
+
+ explicit inline SvxPaperBinItem( const sal_uInt16 nId ,
+ const sal_uInt8 nTray = PAPERBIN_PRINTER_SETTINGS );
+ inline SvxPaperBinItem &operator=( const SvxPaperBinItem &rCpy );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream &, sal_uInt16 ) const;
+ virtual SvStream& Store( SvStream &, sal_uInt16 nItemVersion ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+};
+
+inline SvxPaperBinItem::SvxPaperBinItem( const sal_uInt16 nId, const sal_uInt8 nT )
+ : SfxByteItem( nId, nT )
+{}
+
+inline SvxPaperBinItem &SvxPaperBinItem::operator=(
+ const SvxPaperBinItem &rCpy )
+{
+ SetValue( rCpy.GetValue() );
+ return *this;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/pgrditem.hxx b/include/editeng/pgrditem.hxx
new file mode 100644
index 000000000000..9c4c47cce882
--- /dev/null
+++ b/include/editeng/pgrditem.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_PGRDITEM_HXX
+#define _SVX_PGRDITEM_HXX
+
+#include <svl/eitem.hxx>
+#include "editeng/editengdllapi.h"
+
+// class SvxParaGridItem -------------------------------------------------
+
+
+/* [Description]
+
+ Paragraph snap to grid
+*/
+
+class EDITENG_DLLPUBLIC SvxParaGridItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+
+ SvxParaGridItem( const sal_Bool bSnapToGrid /*= sal_True*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+};
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/pmdlitem.hxx b/include/editeng/pmdlitem.hxx
new file mode 100644
index 000000000000..55fee950d8f0
--- /dev/null
+++ b/include/editeng/pmdlitem.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_PMDLITEM_HXX
+#define _SVX_PMDLITEM_HXX
+
+#include <svl/stritem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxPageModelItem ------------------------------------------------
+
+/* [Description]
+
+ This item contains a name of a page template.
+*/
+
+class EDITENG_DLLPUBLIC SvxPageModelItem : public SfxStringItem
+{
+private:
+ sal_Bool bAuto;
+
+public:
+ TYPEINFO();
+
+ explicit inline SvxPageModelItem( sal_uInt16 nWh );
+ inline SvxPageModelItem( const String& rModel, sal_Bool bA /*= sal_False*/,
+ sal_uInt16 nWh );
+ inline SvxPageModelItem& operator=( const SvxPageModelItem& rModel );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+ sal_Bool IsAuto() const { return bAuto; }
+};
+
+inline SvxPageModelItem::SvxPageModelItem( sal_uInt16 nWh )
+ : bAuto( sal_False )
+{
+ SetWhich( nWh );
+}
+
+inline SvxPageModelItem::SvxPageModelItem( const String& rModel, sal_Bool bA,
+ sal_uInt16 nWh ) :
+ SfxStringItem( nWh, rModel ),
+ bAuto( bA )
+{}
+
+inline SvxPageModelItem& SvxPageModelItem::operator=( const SvxPageModelItem& rModel )
+{
+ SetValue( rModel.GetValue() );
+ return *this;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/postitem.hxx b/include/editeng/postitem.hxx
new file mode 100644
index 000000000000..e547d5a5e438
--- /dev/null
+++ b/include/editeng/postitem.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_POSTITEM_HXX
+#define _SVX_POSTITEM_HXX
+
+#include <vcl/vclenum.hxx>
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxPostureItem --------------------------------------------------
+
+/* [Description]
+
+ This item describes the font setting (Italic)
+*/
+
+class EDITENG_DLLPUBLIC SvxPostureItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+
+ SvxPostureItem( const FontItalic ePost /*= ITALIC_NONE*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem + SwEnumItem
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+ virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const;
+ virtual sal_uInt16 GetValueCount() const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual int HasBoolValue() const;
+ virtual sal_Bool GetBoolValue() const;
+ virtual void SetBoolValue( sal_Bool bVal );
+
+ inline SvxPostureItem& operator=(const SvxPostureItem& rPost) {
+ SetValue( rPost.GetValue() );
+ return *this;
+ }
+
+ // enum cast
+ FontItalic GetPosture() const
+ { return (FontItalic)GetValue(); }
+ void SetPosture( FontItalic eNew )
+ { SetValue( (sal_uInt16)eNew ); }
+};
+
+#endif // #ifndef _SVX_POSTITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/prntitem.hxx b/include/editeng/prntitem.hxx
new file mode 100644
index 000000000000..050131953dc3
--- /dev/null
+++ b/include/editeng/prntitem.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_PRNTITEM_HXX
+#define _SVX_PRNTITEM_HXX
+
+#include <svl/eitem.hxx>
+#include "editeng/editengdllapi.h"
+
+
+
+// class SvxPrintItem ----------------------------------------------------
+
+
+/* [Description]
+
+ This item describes a logical variable "Print yes or no".
+*/
+
+
+class EDITENG_DLLPUBLIC SvxPrintItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+
+ explicit SvxPrintItem( const sal_uInt16 nId , const sal_Bool bPrt = sal_True );
+ inline SvxPrintItem &operator=( const SvxPrintItem &rCpy );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+};
+
+inline SvxPrintItem::SvxPrintItem( const sal_uInt16 nId, const sal_Bool bPrt )
+ : SfxBoolItem( nId, bPrt )
+{}
+
+inline SvxPrintItem &SvxPrintItem::operator=( const SvxPrintItem &rCpy )
+{
+ SetValue( rCpy.GetValue() );
+ return *this;
+}
+
+
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/protitem.hxx b/include/editeng/protitem.hxx
new file mode 100644
index 000000000000..37f2bec77998
--- /dev/null
+++ b/include/editeng/protitem.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_PROTITEM_HXX
+#define _SVX_PROTITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include "editeng/editengdllapi.h"
+
+class SvXMLUnitConverter;
+
+// class SvxProtectItem --------------------------------------------------
+
+
+/* [Description]
+
+ This item describes, if content, size or position should be protected.
+*/
+
+class EDITENG_DLLPUBLIC SvxProtectItem : public SfxPoolItem
+{
+ sal_Bool bCntnt :1; // Content protected
+ sal_Bool bSize :1; // Size protected
+ sal_Bool bPos :1; // Position protected
+
+public:
+ TYPEINFO();
+
+ explicit inline SvxProtectItem( const sal_uInt16 nId );
+ inline SvxProtectItem &operator=( const SvxProtectItem &rCpy );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
+
+ sal_Bool IsCntntProtected() const { return bCntnt; }
+ sal_Bool IsSizeProtected() const { return bSize; }
+ sal_Bool IsPosProtected() const { return bPos; }
+ void SetCntntProtect( sal_Bool bNew ) { bCntnt = bNew; }
+ void SetSizeProtect ( sal_Bool bNew ) { bSize = bNew; }
+ void SetPosProtect ( sal_Bool bNew ) { bPos = bNew; }
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+};
+
+inline SvxProtectItem::SvxProtectItem( const sal_uInt16 nId )
+ : SfxPoolItem( nId )
+{
+ bCntnt = bSize = bPos = sal_False;
+}
+
+inline SvxProtectItem &SvxProtectItem::operator=( const SvxProtectItem &rCpy )
+{
+ bCntnt = rCpy.IsCntntProtected();
+ bSize = rCpy.IsSizeProtected();
+ bPos = rCpy.IsPosProtected();
+ return *this;
+}
+
+
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/prszitem.hxx b/include/editeng/prszitem.hxx
new file mode 100644
index 000000000000..d89669d8eca2
--- /dev/null
+++ b/include/editeng/prszitem.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_PRSZITEM_HXX
+#define _SVX_PRSZITEM_HXX
+
+#include <svl/intitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxPropSizeItem -------------------------------------------------
+
+/* [Description]
+
+ This item describes the relative Font Size.
+*/
+
+class EDITENG_DLLPUBLIC SvxPropSizeItem : public SfxUInt16Item
+{
+public:
+ TYPEINFO();
+
+ SvxPropSizeItem( const sal_uInt16 nPercent /*= 100*/,
+ const sal_uInt16 nID );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ inline SvxPropSizeItem& operator=(const SvxPropSizeItem& rPropSize)
+ {
+ SetValue( rPropSize.GetValue() );
+ return *this;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/rsiditem.hxx b/include/editeng/rsiditem.hxx
new file mode 100644
index 000000000000..e98fb8e4e129
--- /dev/null
+++ b/include/editeng/rsiditem.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * [ Copyright (C) 2009 Tzvetelina Tzeneva <tzvetelina@gmail.com> (initial developer) ]
+ */
+#ifndef _SVX_RSIDITEM_HXX
+#define _SVX_RSIDITEM_HXX
+
+#include <svl/intitem.hxx>
+#include "editeng/editengdllapi.h"
+
+//----------------------
+// SvxRsidItem
+//----------------------
+
+class EDITENG_DLLPUBLIC SvxRsidItem : public SfxUInt32Item
+{
+public:
+ TYPEINFO();
+
+ SvxRsidItem( sal_uInt32 nRsid, sal_uInt16 nId ) : SfxUInt32Item( nId, nRsid ) {}
+ SvxRsidItem( SvStream& rIn, sal_uInt16 nId ) : SfxUInt32Item( nId, rIn ) {}
+
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = NULL ) const;
+ virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+};
+
+#endif // _SVX_RSIDITEM_HXX
diff --git a/include/editeng/scriptspaceitem.hxx b/include/editeng/scriptspaceitem.hxx
new file mode 100644
index 000000000000..f58234baf042
--- /dev/null
+++ b/include/editeng/scriptspaceitem.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_SRIPTSPACEITEM_HXX
+#define _SVX_SRIPTSPACEITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxScriptSpaceItem ----------------------------------------------
+
+/* [Description]
+
+ This item describe the script type of the selected text and is only
+ used for the user interface.
+*/
+
+class EDITENG_DLLPUBLIC SvxScriptSpaceItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+
+ SvxScriptSpaceItem( sal_Bool bOn /*= sal_False*/,
+ const sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper * = 0 ) const;
+
+ inline SvxScriptSpaceItem& operator=(const SvxScriptSpaceItem& rItem )
+ {
+ SetValue( rItem.GetValue() );
+ return *this;
+ }
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/scripttypeitem.hxx b/include/editeng/scripttypeitem.hxx
new file mode 100644
index 000000000000..a50f82d9d951
--- /dev/null
+++ b/include/editeng/scripttypeitem.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_SCRIPTTYPEITEM_HXX
+#define _SVX_SCRIPTTYPEITEM_HXX
+
+#include <svl/intitem.hxx>
+#include <svl/languageoptions.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxScriptTypeItem ----------------------------------------------
+
+/* [Description]
+
+ This item describes the script type of the selected text and is only
+ used for the user interface.
+*/
+
+EDITENG_DLLPUBLIC sal_uInt16 GetI18NScriptTypeOfLanguage( sal_uInt16 nLang );
+sal_uInt16 GetItemScriptType( short nI18NType );
+short GetI18NScriptType( sal_uInt16 nItemType );
+
+class EDITENG_DLLPUBLIC SvxScriptTypeItem : public SfxUInt16Item
+{
+public:
+ TYPEINFO();
+
+ explicit SvxScriptTypeItem( sal_uInt16 nType = SCRIPTTYPE_LATIN );
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+
+};
+
+class EDITENG_DLLPUBLIC SvxScriptSetItem : public SfxSetItem
+{
+public:
+ TYPEINFO();
+
+ SvxScriptSetItem( sal_uInt16 nSlotId, SfxItemPool& rPool );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream &, sal_uInt16 nVersion ) const;
+
+ static const SfxPoolItem* GetItemOfScriptSet( const SfxItemSet& rSet,
+ sal_uInt16 nWhich );
+ inline const SfxPoolItem* GetItemOfScriptSet( sal_uInt16 _nWhich ) const
+ { return SvxScriptSetItem::GetItemOfScriptSet( GetItemSet(), _nWhich ); }
+
+ static const SfxPoolItem* GetItemOfScript( sal_uInt16 nSlotId, const SfxItemSet& rSet, sal_uInt16 nScript );
+
+ const SfxPoolItem* GetItemOfScript( sal_uInt16 nScript ) const;
+
+ void PutItemForScriptType( sal_uInt16 nScriptType, const SfxPoolItem& rItem );
+
+ static void GetWhichIds( sal_uInt16 nSlotId, const SfxItemSet& rSet, sal_uInt16& rLatin, sal_uInt16& rAsian, sal_uInt16& rComplex);
+
+ void GetWhichIds( sal_uInt16& rLatin, sal_uInt16& rAsian, sal_uInt16& rComplex) const;
+
+ static void GetSlotIds( sal_uInt16 nSlotId, sal_uInt16& rLatin, sal_uInt16& rAsian,
+ sal_uInt16& rComplex );
+ inline void GetSlotIds( sal_uInt16& rLatin, sal_uInt16& rAsian,
+ sal_uInt16& rComplex ) const
+ { GetSlotIds( Which(), rLatin, rAsian, rComplex ); }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/shaditem.hxx b/include/editeng/shaditem.hxx
new file mode 100644
index 000000000000..e76c77a7ec4e
--- /dev/null
+++ b/include/editeng/shaditem.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_SHADITEM_HXX
+#define _SVX_SHADITEM_HXX
+
+#include <tools/color.hxx>
+#include <svl/eitem.hxx>
+#include <editeng/svxenum.hxx>
+#include <editeng/editengdllapi.h>
+
+
+// class SvxShadowItem ---------------------------------------------------
+
+/* [Description]
+
+ This item describes the shadow attribute (color, width and position).
+*/
+
+#define SHADOW_TOP ((sal_uInt16)0)
+#define SHADOW_BOTTOM ((sal_uInt16)1)
+#define SHADOW_LEFT ((sal_uInt16)2)
+#define SHADOW_RIGHT ((sal_uInt16)3)
+
+class EDITENG_DLLPUBLIC SvxShadowItem : public SfxEnumItemInterface
+{
+ Color aShadowColor;
+ sal_uInt16 nWidth;
+ SvxShadowLocation eLocation;
+public:
+ TYPEINFO();
+
+ explicit SvxShadowItem( const sal_uInt16 nId ,
+ const Color *pColor = 0, const sal_uInt16 nWidth = 100 /*5pt*/,
+ const SvxShadowLocation eLoc = SVX_SHADOW_NONE );
+
+ inline SvxShadowItem& operator=( const SvxShadowItem& rFmtShadow );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
+ virtual bool ScaleMetrics( long nMult, long nDiv );
+ virtual bool HasMetrics() const;
+
+ const Color& GetColor() const { return aShadowColor;}
+ void SetColor( const Color &rNew ) { aShadowColor = rNew; }
+
+ sal_uInt16 GetWidth() const { return nWidth; }
+ SvxShadowLocation GetLocation() const { return eLocation; }
+
+ void SetWidth( sal_uInt16 nNew ) { nWidth = nNew; }
+ void SetLocation( SvxShadowLocation eNew ) { eLocation = eNew; }
+
+ // Calculate width of the shadow on the page.
+ sal_uInt16 CalcShadowSpace( sal_uInt16 nShadow ) const;
+
+ virtual sal_uInt16 GetValueCount() const;
+ virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const;
+ virtual sal_uInt16 GetEnumValue() const;
+ virtual void SetEnumValue( sal_uInt16 nNewVal );
+};
+
+inline SvxShadowItem &SvxShadowItem::operator=( const SvxShadowItem& rFmtShadow )
+{
+ aShadowColor = rFmtShadow.aShadowColor;
+ nWidth = rFmtShadow.GetWidth();
+ eLocation = rFmtShadow.GetLocation();
+ return *this;
+}
+
+#endif // #ifndef _SVX_SHADITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/shdditem.hxx b/include/editeng/shdditem.hxx
new file mode 100644
index 000000000000..d738a8794f5f
--- /dev/null
+++ b/include/editeng/shdditem.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_SHDDITEM_HXX
+#define _SVX_SHDDITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxShadowedItem -------------------------------------------------
+
+/* [Description]
+
+ This item describes, whether and how it is shaded.
+*/
+
+class EDITENG_DLLPUBLIC SvxShadowedItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+
+ SvxShadowedItem( const sal_Bool bShadowed /*= sal_False*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ inline SvxShadowedItem& operator=(const SvxShadowedItem& rShadow) {
+ SetValue(rShadow.GetValue());
+ return *this;
+ }
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/sizeitem.hxx b/include/editeng/sizeitem.hxx
new file mode 100644
index 000000000000..df70d40c47cf
--- /dev/null
+++ b/include/editeng/sizeitem.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_SIZEITEM_HXX
+#define _SVX_SIZEITEM_HXX
+
+#include <tools/gen.hxx>
+#include <svl/poolitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxSizeItem -----------------------------------------------------
+
+/* [Description]
+
+ This item describes a two-dimensional size.
+*/
+
+class EDITENG_DLLPUBLIC SvxSizeItem : public SfxPoolItem
+{
+
+ Size aSize;
+
+public:
+ TYPEINFO();
+
+ explicit SvxSizeItem( const sal_uInt16 nId );
+ SvxSizeItem( const sal_uInt16 nId, const Size& rSize);
+
+ inline SvxSizeItem& operator=( const SvxSizeItem &rCpy );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
+ virtual bool ScaleMetrics( long nMult, long nDiv );
+ virtual bool HasMetrics() const;
+
+ const Size& GetSize() const { return aSize; }
+ void SetSize(const Size& rSize) { aSize = rSize; }
+};
+
+inline SvxSizeItem& SvxSizeItem::operator=( const SvxSizeItem &rCpy )
+{
+ aSize = rCpy.aSize;
+ return *this;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/spltitem.hxx b/include/editeng/spltitem.hxx
new file mode 100644
index 000000000000..a7a0a9f0665c
--- /dev/null
+++ b/include/editeng/spltitem.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_SPLTITEM_HXX
+#define _SVX_SPLTITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxFmtSplitItem -------------------------------------------------
+
+/* [Description]
+
+ This item describes a logical variable "split paragraph yes or no".
+*/
+
+class EDITENG_DLLPUBLIC SvxFmtSplitItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+ ~SvxFmtSplitItem();
+
+ inline SvxFmtSplitItem( const sal_Bool bSplit /*= sal_True*/,
+ const sal_uInt16 nWh );
+ inline SvxFmtSplitItem& operator=( const SvxFmtSplitItem& rSplit );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream&, sal_uInt16 ) const;
+ virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+};
+
+inline SvxFmtSplitItem::SvxFmtSplitItem( const sal_Bool bSplit, const sal_uInt16 nWh ) :
+ SfxBoolItem( nWh, bSplit )
+{}
+
+inline SvxFmtSplitItem& SvxFmtSplitItem::operator=(
+ const SvxFmtSplitItem& rSplit )
+{
+ SetValue( rSplit.GetValue() );
+ return *this;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/splwrap.hxx b/include/editeng/splwrap.hxx
new file mode 100644
index 000000000000..d4c9b8da8732
--- /dev/null
+++ b/include/editeng/splwrap.hxx
@@ -0,0 +1,151 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_SPLWRAP_HXX
+#define _SVX_SPLWRAP_HXX
+
+#include <editeng/svxenum.hxx>
+#include <tools/string.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include "editeng/editengdllapi.h"
+
+// forward ---------------------------------------------------------------
+
+namespace com { namespace sun { namespace star { namespace linguistic2 {
+ class XDictionary;
+ class XSpellChecker1;
+ class XHyphenator;
+}}}}
+
+class Window;
+
+// misc functions ---------------------------------------------------------------
+
+void EDITENG_DLLPUBLIC SvxPrepareAutoCorrect( String &rOldText, String &rNewText );
+
+/*--------------------------------------------------------------------
+ Description: The SpellWrapper
+ --------------------------------------------------------------------*/
+
+class EDITENG_DLLPUBLIC SvxSpellWrapper {
+private:
+ friend class SvxSpellCheckDialog;
+ friend class SvxHyphenWordDialog;
+ friend struct SvxHyphenWordDialog_Impl;
+
+ Window* pWin;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > xLast; // result of last spelling/hyphenation attempt
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 > xSpell;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenator > xHyph;
+ sal_uInt16 nOldLang; // Set Language, only call SetLanguage on changes
+ sal_Bool bOtherCntnt : 1; // set => Check special sections initially
+ sal_Bool bDialog : 1; // Is pWin the Svx...Dialog?
+ sal_Bool bHyphen : 1; // Split instead of spell checking
+ sal_Bool bAuto : 1; // AutoCorrect available?
+ sal_Bool bReverse : 1; // Reverse spell check
+ sal_Bool bStartDone : 1; // Beginning already corrected
+ sal_Bool bEndDone : 1; // End part already corrected
+ sal_Bool bStartChk : 1; // Examine the beginning
+ sal_Bool bRevAllowed : 1; // Reverse spell check prohibited
+ sal_Bool bAllRight : 1; // Record wrong words in the dedicated
+ // dictionary and do not start the dialog.
+
+ EDITENG_DLLPRIVATE sal_Bool SpellNext(); // select next area
+ sal_Bool FindSpellError(); // Check for errors (over areas)
+
+public:
+ SvxSpellWrapper( Window* pWn,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 > &xSpellChecker,
+ const sal_Bool bStart = sal_False, const sal_Bool bIsAllRight = sal_False,
+ const sal_Bool bOther = sal_False, const sal_Bool bRevAllow = sal_True );
+ SvxSpellWrapper( Window* pWn,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenator > &xHyphenator,
+ const sal_Bool bStart = sal_False, const sal_Bool bOther = sal_False );
+
+ virtual ~SvxSpellWrapper();
+
+ static sal_Int16 CheckSpellLang(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 > xSpell,
+ sal_Int16 nLang );
+ static sal_Int16 CheckHyphLang(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenator > xHyph,
+ sal_Int16 nLang );
+
+ static void ShowLanguageErrors();
+
+ void SpellDocument(); // Perform Spell Checking
+ inline sal_Bool IsStartDone(){ return bStartDone; }
+ inline sal_Bool IsEndDone(){ return bEndDone; }
+ inline sal_Bool IsReverse(){ return bReverse; }
+ inline sal_Bool IsDialog(){ return bDialog; } // SvxSpellCheckDialog OnScreen
+ inline sal_Bool IsHyphen(){ return bHyphen; } // Split instead of Spell check
+ inline void SetHyphen( const sal_Bool bNew = sal_True ){ bHyphen = bNew; }
+ inline ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 >
+ GetXSpellChecker() { return xSpell; }
+ inline ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenator >
+ GetXHyphenator() { return xHyph; }
+ inline sal_Bool IsAllRight() { return bAllRight; }
+ inline Window* GetWin() { return pWin; }
+ // can possibly be omitted in ONE_LINGU:
+ inline void SetOldLang( const sal_uInt16 nNew ){ nOldLang = nNew; }
+ // can possibly be omitted in ONE_LINGU:
+ inline void ChangeLanguage( const sal_uInt16 nNew ) // call SetLanguage if needed.
+ { if ( nNew != nOldLang ) { SetLanguage( nNew ); nOldLang = nNew; } }
+ inline void EnableAutoCorrect() { bAuto = sal_True; }
+
+protected:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >
+ GetLast() { return xLast; }
+ void SetLast(const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > &xNewLast)
+ { xLast = xNewLast; }
+ virtual sal_Bool SpellMore(); // examine further documents?
+ virtual sal_Bool HasOtherCnt(); // Are there any special areas?
+ virtual void SpellStart( SvxSpellArea eSpell ); // Preparing the area
+ virtual sal_Bool SpellContinue(); // Check Areas
+ // Result available through GetLast
+ virtual void ReplaceAll( const String &rNewText, sal_Int16 nLanguage ); //Replace word from the replace list
+ virtual void StartThesaurus( const String &rWord, sal_uInt16 nLang );
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XDictionary >
+ GetAllRightDic() const;
+ virtual void SpellEnd(); // Finish area
+ virtual void ScrollArea(); // Set ScrollArea
+ // Replace word
+ virtual void ChangeWord( const String& rNewWord, const sal_uInt16 nLang );
+ // Wort via Thesaurus ersetzen
+ virtual void ChangeThesWord( const String& rNewWord );
+ virtual void SetLanguage( const sal_uInt16 nLang ); // Change Language
+ virtual void AutoCorrect( const String& rAktStr, const String& rNewStr );
+ virtual void InsertHyphen( const sal_uInt16 nPos ); // Insert hyphen
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/svxacorr.hxx b/include/editeng/svxacorr.hxx
new file mode 100644
index 000000000000..4f54d8f2f11b
--- /dev/null
+++ b/include/editeng/svxacorr.hxx
@@ -0,0 +1,441 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef EE_SVXACORR_HXX
+#define EE_SVXACORR_HXX
+
+#include <com/sun/star/embed/XStorage.hpp>
+
+#include <o3tl/sorted_vector.hxx>
+#include <tools/rtti.hxx>
+#include <i18nlangtag/lang.h>
+#include <tools/time.hxx>
+#include <tools/date.hxx>
+#include <tools/string.hxx>
+#include <editeng/swafopt.hxx>
+#include "editeng/editengdllapi.h"
+
+#include <map>
+#include <set>
+#include <boost/unordered_map.hpp>
+#include <boost/ptr_container/ptr_map.hpp>
+
+class CharClass;
+class SfxPoolItem;
+class SvxAutoCorrect;
+class SfxObjectShell;
+class SotStorageRef;
+class SotStorage;
+class Window;
+
+struct CompareSvStringsISortDtor
+{
+ bool operator()( String* const& lhs, String* const& rhs ) const
+ {
+ return lhs->CompareIgnoreCaseToAscii( *rhs ) == COMPARE_LESS;
+ }
+};
+
+class SvStringsISortDtor
+ : public o3tl::sorted_vector<String*, CompareSvStringsISortDtor>
+{
+public:
+ ~SvStringsISortDtor() { DeleteAndDestroyAll(); }
+};
+
+// Auto correct flags
+const long CptlSttSntnc = 0x00000001; // Capital letters at the beginning of a sentence
+const long CptlSttWrd = 0x00000002; // not two Capital letters at the beginning of a word
+const long AddNonBrkSpace = 0x00000004; // Add non breaking space before :;?!%
+const long ChgOrdinalNumber = 0x00000008; // Ordinal-Number 1st, 2nd,..
+const long ChgToEnEmDash = 0x00000010; // - -> Endash/Emdash
+const long ChgWeightUnderl = 0x00000020; // * -> Bold, _ -> Underscore
+const long SetINetAttr = 0x00000040; // Set INetAttribut
+const long Autocorrect = 0x00000080; // Call AutoCorrect
+const long ChgQuotes = 0x00000100; // replace double quotes
+const long SaveWordCplSttLst= 0x00000200; // Save Auto correction of Capital letter at beginning of sentence.
+const long SaveWordWrdSttLst= 0x00000400; // Save Auto correction of 2 Capital letter at beginning of word.
+const long IgnoreDoubleSpace= 0x00000800; // Ignore 2 Spaces
+const long ChgSglQuotes = 0x00001000; // Replace simple quotes
+const long CorrectCapsLock = 0x00002000; // Correct accidental use of cAPS LOCK key
+
+const long ChgWordLstLoad = 0x20000000; // Replacement list loaded
+const long CplSttLstLoad = 0x40000000; // Exception list for Capital letters Start loaded
+const long WrdSttLstLoad = 0x80000000; // Exception list for Word Start loaded
+
+// TODO: handle unicodes > U+FFFF and check users of this class
+
+// only a mapping class
+class EDITENG_DLLPUBLIC SvxAutoCorrDoc
+{
+public:
+ SvxAutoCorrDoc() {}
+ virtual ~SvxAutoCorrDoc();
+
+ virtual sal_Bool Delete( xub_StrLen nStt, xub_StrLen nEnd ) = 0;
+ virtual sal_Bool Insert( xub_StrLen nPos, const String& rTxt ) = 0;
+ virtual sal_Bool Replace( xub_StrLen nPos, const String& rTxt ) = 0;
+ virtual sal_Bool ReplaceRange( xub_StrLen nPos, xub_StrLen nLen, const String& rTxt ) = 0;
+
+ virtual sal_Bool SetAttr( xub_StrLen nStt, xub_StrLen nEnd, sal_uInt16 nSlotId,
+ SfxPoolItem& ) = 0;
+
+ virtual sal_Bool SetINetAttr( xub_StrLen nStt, xub_StrLen nEnd, const String& rURL ) = 0;
+
+ // Return the text of a previous paragraph. This must not be empty!
+ // If no paragraph exits or just an empty one, then return 0.
+ // The flag indicates:
+ // TRUE: before the normal insertion position (TRUE)
+ // FALSE: in which the corrected word was inserted.
+ // (Does not to have to be the same paragraph !!!!)
+ virtual const String* GetPrevPara( sal_Bool bAtNormalPos ) = 0;
+
+ virtual sal_Bool ChgAutoCorrWord( xub_StrLen& rSttPos, xub_StrLen nEndPos,
+ SvxAutoCorrect& rACorrect,
+ const String** ppPara ) = 0;
+ // Is called after the change of the signs by the functions
+ // - FnCptlSttWrd
+ // - FnCptlSttSntnc
+ // As an option, the words can then be inserted into the exception lists.
+ virtual void SaveCpltSttWord( sal_uLong nFlag, xub_StrLen nPos,
+ const String& rExceptWord,
+ sal_Unicode cChar );
+
+ // which language at the position?
+ virtual LanguageType GetLanguage( xub_StrLen nPos, sal_Bool bPrevPara = sal_False ) const;
+};
+
+
+class EDITENG_DLLPUBLIC SvxAutocorrWord
+{
+ String sShort, sLong;
+ sal_Bool bIsTxtOnly; // Is pure ASCII - Text
+public:
+ SvxAutocorrWord( const String& rS, const String& rL, sal_Bool bFlag = sal_True )
+ : sShort( rS ), sLong( rL ), bIsTxtOnly( bFlag )
+ {}
+
+ const String& GetShort() const { return sShort; }
+ const String& GetLong() const { return sLong; }
+ sal_Bool IsTextOnly() const { return bIsTxtOnly; }
+};
+
+struct CompareSvxAutocorrWordList
+{
+ bool operator()( SvxAutocorrWord* const& lhs, SvxAutocorrWord* const& rhs ) const;
+};
+
+typedef std::set<SvxAutocorrWord*, CompareSvxAutocorrWordList> SvxAutocorrWordList_Set;
+typedef ::boost::unordered_map< OUString, SvxAutocorrWord *,
+ OUStringHash > SvxAutocorrWordList_Hash;
+
+class EDITENG_DLLPUBLIC SvxAutocorrWordList
+{
+ // only one of these contains the data
+ mutable SvxAutocorrWordList_Set maSet;
+ mutable SvxAutocorrWordList_Hash maHash; // key is 'Short'
+
+ bool WordMatches(const SvxAutocorrWord *pFnd,
+ const String &rTxt,
+ xub_StrLen &rStt,
+ xub_StrLen nEndPos) const;
+public:
+ // free any objects still in the set
+ ~SvxAutocorrWordList();
+ void DeleteAndDestroyAll();
+ bool Insert(SvxAutocorrWord *pWord);
+ SvxAutocorrWord* FindAndRemove(SvxAutocorrWord *pWord);
+ void LoadEntry(String sWrong, String sRight, sal_Bool bOnlyTxt);
+ bool empty() const;
+
+ typedef std::vector<SvxAutocorrWord *> Content;
+ Content getSortedContent() const;
+
+ const SvxAutocorrWord* SearchWordsInList(const String& rTxt, xub_StrLen& rStt, xub_StrLen nEndPos) const;
+};
+
+class EDITENG_DLLPUBLIC SvxAutoCorrectLanguageLists
+{
+ String sShareAutoCorrFile, sUserAutoCorrFile;
+ // If the AutoCorr file is newer
+ Date aModifiedDate;
+ Time aModifiedTime, aLastCheckTime;
+
+ SvStringsISortDtor* pCplStt_ExcptLst;
+ SvStringsISortDtor* pWrdStt_ExcptLst;
+ SvxAutocorrWordList* pAutocorr_List;
+ SvxAutoCorrect& rAutoCorrect;
+
+ long nFlags;
+
+ sal_Bool IsFileChanged_Imp();
+ void LoadXMLExceptList_Imp( SvStringsISortDtor*& rpLst,
+ const sal_Char* pStrmName,
+ SotStorageRef& rStg);
+ void SaveExceptList_Imp( const SvStringsISortDtor& rLst,
+ const sal_Char* pStrmName,
+ SotStorageRef& rStg,
+ sal_Bool bConvert = sal_False);
+
+ sal_Bool MakeBlocklist_Imp( SotStorage& rStg );
+ void RemoveStream_Imp( const String& rName );
+ void MakeUserStorage_Impl();
+
+public:
+ SvxAutoCorrectLanguageLists( SvxAutoCorrect& rParent,
+ const String& rShareAutoCorrectFile,
+ const String& rUserAutoCorrectFile);
+ ~SvxAutoCorrectLanguageLists();
+
+ // Load, Set, Get - the replacement list
+ SvxAutocorrWordList* LoadAutocorrWordList();
+ void SetAutocorrWordList( SvxAutocorrWordList* pList );
+ const SvxAutocorrWordList* GetAutocorrWordList();
+
+ // Load, Set, Get - the exception list for Capital letter at the
+ // beginning of a sentence
+ SvStringsISortDtor* LoadCplSttExceptList();
+ void SaveCplSttExceptList();
+ void SetCplSttExceptList( SvStringsISortDtor* pList );
+ SvStringsISortDtor* GetCplSttExceptList();
+ sal_Bool AddToCplSttExceptList(const String& rNew);
+
+ // Load, Set, Get the exception list for 2 Capital letters at the
+ // beginning of a word.
+ SvStringsISortDtor* LoadWrdSttExceptList();
+ void SaveWrdSttExceptList();
+ void SetWrdSttExceptList( SvStringsISortDtor* pList );
+ SvStringsISortDtor* GetWrdSttExceptList();
+ sal_Bool AddToWrdSttExceptList(const String& rNew);
+
+ // Save word substitutions:
+ // Store these directly in the storage. The word list is updated
+ // accordingly!
+ // - pure Text
+ sal_Bool PutText( const String& rShort, const String& rLong );
+ // - Text with attribution (only the SWG - SWG format!)
+ sal_Bool PutText( const String& rShort, SfxObjectShell& );
+ // - Deleting an entry
+ sal_Bool DeleteText( const String& rShort );
+ // - Make combined changes in one pass
+ sal_Bool MakeCombinedChanges( std::vector<SvxAutocorrWord>& aNewEntries, std::vector<SvxAutocorrWord>& aDeleteEntries );
+};
+
+class EDITENG_DLLPUBLIC SvxAutoCorrect
+{
+ friend class SvxAutoCorrectLanguageLists;
+
+ String sShareAutoCorrFile, sUserAutoCorrFile;
+
+ SvxSwAutoFmtFlags aSwFlags; // StarWriter AutoFormat Flags
+
+ // all languages in a table
+ boost::ptr_map<LanguageType, SvxAutoCorrectLanguageLists>* pLangTable;
+ std::map<LanguageType, long> aLastFileTable;
+ CharClass* pCharClass;
+
+ bool bRunNext;
+
+ LanguageType eCharClassLang;
+
+ long nFlags;
+ sal_Unicode cStartDQuote, cEndDQuote, cStartSQuote, cEndSQuote,
+ cEmDash, cEnDash;
+
+
+ // private methods
+ SvxAutoCorrectLanguageLists& _GetLanguageList( LanguageType eLang );
+
+ void _GetCharClass( LanguageType eLang );
+
+protected:
+ // - Text with attribution (only the SWG - SWG format!)
+ // rShort is the stream name - encrypted!
+ virtual sal_Bool PutText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rStg, const String& rFileName, const String& rShort, SfxObjectShell& ,
+ String& );
+
+ // required language in the table add if possible only when the file exists
+ sal_Bool CreateLanguageFile(LanguageType eLang, sal_Bool bNewFile = sal_True);
+ // - Return the replacement text (only for SWG format, all others can be
+ // taken from the word list!)
+ // rShort is the stream name - encrypted!
+public:
+
+ sal_Unicode GetQuote( sal_Unicode cInsChar, sal_Bool bSttQuote,
+ LanguageType eLang ) const;
+ virtual sal_Bool GetLongText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rStg, const String& rFileName, const String& rShort, String& rLong );
+
+ TYPEINFO();
+
+ SvxAutoCorrect( const String& rShareAutocorrFile,
+ const String& rUserAutocorrFile );
+ SvxAutoCorrect( const SvxAutoCorrect& );
+ virtual ~SvxAutoCorrect();
+
+ // Execute an AutoCorrect.
+ // Returns what has been executed, according to the above flags
+ sal_uLong AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt,
+ xub_StrLen nPos, sal_Unicode cInsChar, sal_Bool bInsert, Window* pFrameWin = NULL );
+
+ // Return for the autotext expansion the previous word,
+ // AutoCorrect - corresponding algorithm
+ sal_Bool GetPrevAutoCorrWord( SvxAutoCorrDoc& rDoc, const String& rTxt,
+ xub_StrLen nPos, String& rWord ) const;
+
+ // Search for or or the words in the replacement table.
+ // rText - check in this text the words of the list
+ // rStt - the detected starting position
+ // nEnd - to check position - as of this item forward
+ // rLang - Input: in which language is searched
+ // Output: in which "language list" was it found
+ const SvxAutocorrWord* SearchWordsInList( const String& rTxt,
+ xub_StrLen& rStt, xub_StrLen nEndPos,
+ SvxAutoCorrDoc& rDoc,
+ LanguageType& rLang );
+
+ // Query/Set the Character for the Quote substitution
+ sal_Unicode GetStartSingleQuote() const { return cStartSQuote; }
+ sal_Unicode GetEndSingleQuote() const { return cEndSQuote; }
+ sal_Unicode GetStartDoubleQuote() const { return cStartDQuote; }
+ sal_Unicode GetEndDoubleQuote() const { return cEndDQuote; }
+
+ void SetStartSingleQuote( const sal_Unicode cStart ) { cStartSQuote = cStart; }
+ void SetEndSingleQuote( const sal_Unicode cEnd ) { cEndSQuote = cEnd; }
+ void SetStartDoubleQuote( const sal_Unicode cStart ) { cStartDQuote = cStart; }
+ void SetEndDoubleQuote( const sal_Unicode cEnd ) { cEndDQuote = cEnd; }
+
+ String GetQuote( SvxAutoCorrDoc& rDoc, xub_StrLen nInsPos,
+ sal_Unicode cInsChar, sal_Bool bSttQuote );
+ void InsertQuote( SvxAutoCorrDoc& rDoc, xub_StrLen nInsPos,
+ sal_Unicode cInsChar, sal_Bool bSttQuote, sal_Bool bIns );
+
+ // Query/Set the name of the AutoCorrect file
+ // the default is "autocorr.dat"
+ String GetAutoCorrFileName( LanguageType eLang = LANGUAGE_SYSTEM,
+ sal_Bool bNewFile = sal_False,
+ sal_Bool bTstUserExist = sal_False ) const;
+
+ // Query/Set the current settings of AutoCorrect
+ long GetFlags() const { return nFlags; }
+ inline SvxSwAutoFmtFlags& GetSwFlags() { return aSwFlags;}
+ sal_Bool IsAutoCorrFlag( long nFlag ) const
+ { return nFlags & nFlag ? sal_True : sal_False; }
+ void SetAutoCorrFlag( long nFlag, sal_Bool bOn = sal_True );
+
+ // Load, Set, Get - the replacement list
+ SvxAutocorrWordList* LoadAutocorrWordList(
+ LanguageType eLang = LANGUAGE_SYSTEM )
+ { return _GetLanguageList( eLang ).LoadAutocorrWordList(); }
+ const SvxAutocorrWordList* GetAutocorrWordList(
+ LanguageType eLang = LANGUAGE_SYSTEM )
+ { return _GetLanguageList( eLang ).GetAutocorrWordList(); }
+
+ // Save word substitutions:
+ // Save these directly in the storage. The word list is updated
+ // accordingly!
+ // - pure Text
+ sal_Bool PutText( const String& rShort, const String& rLong, LanguageType eLang = LANGUAGE_SYSTEM );
+ // - Text with attribution (only in the SWG - SWG format!)
+ sal_Bool PutText( const String& rShort, SfxObjectShell& rShell,
+ LanguageType eLang = LANGUAGE_SYSTEM )
+ { return _GetLanguageList( eLang ).PutText(rShort, rShell ); }
+
+ sal_Bool MakeCombinedChanges( std::vector<SvxAutocorrWord>& aNewEntries,
+ std::vector<SvxAutocorrWord>& aDeleteEntries,
+ LanguageType eLang = LANGUAGE_SYSTEM );
+
+ // Load, Set, Get - the exception list for capital letters at the
+ // beginning of a sentence
+ void SaveCplSttExceptList( LanguageType eLang = LANGUAGE_SYSTEM );
+ SvStringsISortDtor* LoadCplSttExceptList(
+ LanguageType eLang = LANGUAGE_SYSTEM)
+ { return _GetLanguageList( eLang ).LoadCplSttExceptList(); }
+ const SvStringsISortDtor* GetCplSttExceptList(
+ LanguageType eLang = LANGUAGE_SYSTEM )
+ { return _GetLanguageList( eLang ).GetCplSttExceptList(); }
+
+ // Adds a single word. The list will be immediately written to the file!
+ sal_Bool AddCplSttException( const String& rNew,
+ LanguageType eLang = LANGUAGE_SYSTEM );
+
+ // Load, Set, Get the exception list for 2 Capital letters at the
+ // beginning of a word.
+ void SaveWrdSttExceptList( LanguageType eLang = LANGUAGE_SYSTEM );
+ SvStringsISortDtor* LoadWrdSttExceptList(
+ LanguageType eLang = LANGUAGE_SYSTEM )
+ { return _GetLanguageList( eLang ).LoadWrdSttExceptList(); }
+ const SvStringsISortDtor* GetWrdSttExceptList(
+ LanguageType eLang = LANGUAGE_SYSTEM )
+ { return _GetLanguageList( eLang ).GetWrdSttExceptList(); }
+ // Adds a single word. The list will be immediately written to the file!
+ sal_Bool AddWrtSttException( const String& rNew, LanguageType eLang = LANGUAGE_SYSTEM);
+
+ // Search through the Languages for the entry
+ sal_Bool FindInWrdSttExceptList( LanguageType eLang, const String& sWord );
+ sal_Bool FindInCplSttExceptList( LanguageType eLang, const String& sWord,
+ sal_Bool bAbbreviation = sal_False);
+
+ // Methods for the auto-correction
+ sal_Bool FnCptlSttWrd( SvxAutoCorrDoc&, const String&,
+ xub_StrLen nSttPos, xub_StrLen nEndPos,
+ LanguageType eLang = LANGUAGE_SYSTEM );
+ sal_Bool FnChgOrdinalNumber( SvxAutoCorrDoc&, const String&,
+ xub_StrLen nSttPos, xub_StrLen nEndPos,
+ LanguageType eLang = LANGUAGE_SYSTEM );
+ sal_Bool FnChgToEnEmDash( SvxAutoCorrDoc&, const String&,
+ xub_StrLen nSttPos, xub_StrLen nEndPos,
+ LanguageType eLang = LANGUAGE_SYSTEM );
+ sal_Bool FnAddNonBrkSpace( SvxAutoCorrDoc&, const String&,
+ xub_StrLen nSttPos, xub_StrLen nEndPos,
+ LanguageType eLang = LANGUAGE_SYSTEM );
+ sal_Bool FnSetINetAttr( SvxAutoCorrDoc&, const String&,
+ xub_StrLen nSttPos, xub_StrLen nEndPos,
+ LanguageType eLang = LANGUAGE_SYSTEM );
+ sal_Bool FnChgWeightUnderl( SvxAutoCorrDoc&, const String&,
+ xub_StrLen nSttPos, xub_StrLen nEndPos,
+ LanguageType eLang = LANGUAGE_SYSTEM );
+ sal_Bool FnCptlSttSntnc( SvxAutoCorrDoc&, const String&, sal_Bool bNormalPos,
+ xub_StrLen nSttPos, xub_StrLen nEndPos,
+ LanguageType eLang = LANGUAGE_SYSTEM);
+ bool FnCorrectCapsLock( SvxAutoCorrDoc&, const String&,
+ xub_StrLen nSttPos, xub_StrLen nEndPos,
+ LanguageType eLang = LANGUAGE_SYSTEM );
+
+ bool HasRunNext() { return bRunNext; }
+
+ static long GetDefaultFlags();
+
+// returns sal_True for characters where the function
+// 'SvxAutoCorrect::AutoCorrect' should be called.
+// (used to avoid occasional 'collisions' with (Thai) input-sequence-checking)
+ static sal_Bool IsAutoCorrectChar( sal_Unicode cChar );
+
+ sal_Bool NeedsHardspaceAutocorr( sal_Unicode cChar );
+
+ CharClass& GetCharClass( LanguageType eLang )
+ {
+ if( !pCharClass || eLang != eCharClassLang )
+ _GetCharClass( eLang );
+ return *pCharClass;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/svxenum.hxx b/include/editeng/svxenum.hxx
new file mode 100644
index 000000000000..2759bebcd0ea
--- /dev/null
+++ b/include/editeng/svxenum.hxx
@@ -0,0 +1,239 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_SVXENUM_HXX
+#define _SVX_SVXENUM_HXX
+
+// -----------------------------------------------------------------------
+
+enum SvxCaseMap
+{
+ SVX_CASEMAP_NOT_MAPPED,
+ SVX_CASEMAP_VERSALIEN,
+ SVX_CASEMAP_GEMEINE,
+ SVX_CASEMAP_TITEL,
+ SVX_CASEMAP_KAPITAELCHEN,
+ SVX_CASEMAP_END
+};
+
+enum SvxEscapement
+{
+ SVX_ESCAPEMENT_OFF,
+ SVX_ESCAPEMENT_SUPERSCRIPT,
+ SVX_ESCAPEMENT_SUBSCRIPT,
+ SVX_ESCAPEMENT_END
+};
+
+enum SvxShadowLocation
+{
+ SVX_SHADOW_NONE,
+ SVX_SHADOW_TOPLEFT,
+ SVX_SHADOW_TOPRIGHT,
+ SVX_SHADOW_BOTTOMLEFT,
+ SVX_SHADOW_BOTTOMRIGHT,
+ SVX_SHADOW_END
+};
+
+enum SvxTabAdjust
+{
+ SVX_TAB_ADJUST_LEFT = 0,
+ SVX_TAB_ADJUST_RIGHT,
+ SVX_TAB_ADJUST_DECIMAL,
+ SVX_TAB_ADJUST_CENTER,
+ SVX_TAB_ADJUST_DEFAULT,
+ SVX_TAB_ADJUST_END
+};
+
+enum SvxLineSpace
+{
+ SVX_LINE_SPACE_AUTO,
+ SVX_LINE_SPACE_FIX,
+ SVX_LINE_SPACE_MIN,
+ SVX_LINE_SPACE_END
+};
+
+enum SvxInterLineSpace
+{
+ SVX_INTER_LINE_SPACE_OFF,
+ SVX_INTER_LINE_SPACE_PROP,
+ SVX_INTER_LINE_SPACE_FIX,
+ SVX_INTER_LINE_SPACE_END
+};
+
+enum SvxAdjust
+{
+ SVX_ADJUST_LEFT,
+ SVX_ADJUST_RIGHT,
+ SVX_ADJUST_BLOCK,
+ SVX_ADJUST_CENTER,
+ SVX_ADJUST_BLOCKLINE,
+ SVX_ADJUST_END
+};
+
+enum SvxSpecialLineSpace
+{
+ SVX_LINESPACE_USER,
+ SVX_LINESPACE_ONE_LINE,
+ SVX_LINESPACE_ONE_POINT_FIVE_LINES,
+ SVX_LINESPACE_TWO_LINES,
+ SVX_LINESPACE_END
+};
+
+enum SvxBreak
+{
+ SVX_BREAK_NONE,
+ SVX_BREAK_COLUMN_BEFORE,
+ SVX_BREAK_COLUMN_AFTER,
+ SVX_BREAK_COLUMN_BOTH,
+ SVX_BREAK_PAGE_BEFORE,
+ SVX_BREAK_PAGE_AFTER,
+ SVX_BREAK_PAGE_BOTH,
+ SVX_BREAK_END
+};
+
+enum SvxCellHorJustify
+{
+ SVX_HOR_JUSTIFY_STANDARD,
+ SVX_HOR_JUSTIFY_LEFT,
+ SVX_HOR_JUSTIFY_CENTER,
+ SVX_HOR_JUSTIFY_RIGHT,
+ SVX_HOR_JUSTIFY_BLOCK,
+ SVX_HOR_JUSTIFY_REPEAT
+};
+
+enum SvxCellJustifyMethod
+{
+ SVX_JUSTIFY_METHOD_AUTO,
+ SVX_JUSTIFY_METHOD_DISTRIBUTE
+};
+
+enum SvxCellVerJustify
+{
+ SVX_VER_JUSTIFY_STANDARD,
+ SVX_VER_JUSTIFY_TOP,
+ SVX_VER_JUSTIFY_CENTER,
+ SVX_VER_JUSTIFY_BOTTOM,
+ SVX_VER_JUSTIFY_BLOCK
+};
+
+enum SvxCellOrientation
+{
+ SVX_ORIENTATION_STANDARD,
+ SVX_ORIENTATION_TOPBOTTOM,
+ SVX_ORIENTATION_BOTTOMTOP,
+ SVX_ORIENTATION_STACKED
+};
+
+enum SvxDrawToolEnum
+{
+ SVX_SNAP_DRAW_SELECT,
+ //
+ SVX_SNAP_DRAW_LINE,
+ SVX_SNAP_DRAW_RECT,
+ SVX_SNAP_DRAW_ELLIPSE,
+ SVX_SNAP_DRAW_POLYGON_NOFILL,
+ SVX_SNAP_DRAW_BEZIER_NOFILL,
+ SVX_SNAP_DRAW_FREELINE_NOFILL,
+ SVX_SNAP_DRAW_ARC,
+ SVX_SNAP_DRAW_PIE,
+ SVX_SNAP_DRAW_CIRCLECUT,
+ SVX_SNAP_DRAW_TEXT,
+ SVX_SNAP_DRAW_TEXT_VERTICAL,
+ SVX_SNAP_DRAW_TEXT_MARQUEE,
+ SVX_SNAP_DRAW_CAPTION,
+ SVX_SNAP_DRAW_CAPTION_VERTICAL
+};
+
+enum SvxDrawAlignEnum
+{
+ SVX_OBJECT_ALIGN_LEFT,
+ SVX_OBJECT_ALIGN_CENTER,
+ SVX_OBJECT_ALIGN_RIGHT,
+ SVX_OBJECT_ALIGN_UP,
+ SVX_OBJECT_ALIGN_MIDDLE,
+ SVX_OBJECT_ALIGN_DOWN
+};
+
+enum SvxDrawBezierEnum
+{
+ SVX_BEZIER_MOVE,
+ SVX_BEZIER_INSERT,
+ SVX_BEZIER_DELETE,
+ SVX_BEZIER_CUTLINE,
+ SVX_BEZIER_CONVERT,
+ SVX_BEZIER_EDGE,
+ SVX_BEZIER_SMOOTH,
+ SVX_BEZIER_SYMMTR,
+ SVX_BEZIER_CLOSE,
+ SVX_BEZIER_ELIMINATE_POINTS
+};
+
+enum SvxSpellArea
+{
+ SVX_SPELL_BODY = 0,
+ SVX_SPELL_BODY_END,
+ SVX_SPELL_BODY_START,
+ SVX_SPELL_OTHER
+};
+
+enum SvxFrameAnchor
+{
+ SVX_FLY_AT_CNTNT, // Paragraph-based frame
+ SVX_FLY_IN_CNTNT, // Character-based frame
+ SVX_FLY_PAGE // Page-based frame
+};
+
+enum SvxExtNumType
+{
+ SVX_NUM_CHARS_UPPER_LETTER, // Counts from a-z, aa - az, ba - bz, ...
+ SVX_NUM_CHARS_LOWER_LETTER,
+ SVX_NUM_ROMAN_UPPER,
+ SVX_NUM_ROMAN_LOWER,
+ SVX_NUM_ARABIC,
+ SVX_NUM_NUMBER_NONE,
+ SVX_NUM_CHAR_SPECIAL, // Bullet
+ SVX_NUM_PAGEDESC, // Numbering from the page template
+ SVX_NUM_BITMAP,
+ SVX_NUM_CHARS_UPPER_LETTER_N, // Counts from a-z, aa-zz, aaa-zzz
+ SVX_NUM_CHARS_LOWER_LETTER_N,
+ SVX_NUM_TRANSLITERATION,
+ SVX_NUM_NATIVE_NUMBERING,
+ SVX_NUM_FULL_WIDTH_ARABIC,
+ SVX_NUM_CIRCLE_NUMBER,
+ SVX_NUM_NUMBER_LOWER_ZH,
+ SVX_NUM_NUMBER_UPPER_ZH,
+ SVX_NUM_NUMBER_UPPER_ZH_TW,
+ SVX_NUM_TIAN_GAN_ZH,
+ SVX_NUM_DI_ZI_ZH,
+ SVX_NUM_NUMBER_TRADITIONAL_JA,
+ SVX_NUM_AIU_FULLWIDTH_JA,
+ SVX_NUM_AIU_HALFWIDTH_JA,
+ SVX_NUM_IROHA_FULLWIDTH_JA,
+ SVX_NUM_IROHA_HALFWIDTH_JA
+};
+
+enum SvxCompareMode
+{
+ SVX_CMP_AUTO = 0,
+ SVX_CMP_BY_WORD,
+ SVX_CMP_BY_CHAR
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/svxfont.hxx b/include/editeng/svxfont.hxx
new file mode 100644
index 000000000000..858157453aa1
--- /dev/null
+++ b/include/editeng/svxfont.hxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_SVXFONT_HXX
+#define _SVX_SVXFONT_HXX
+
+#include <limits.h> // USHRT_MAX
+#include <editeng/svxenum.hxx>
+#include <i18nlangtag/lang.h>
+#include <vcl/font.hxx>
+#include "editeng/editengdllapi.h"
+
+// Percentage of height of lower case small capital letters compared to upper case letters
+// See i#1526# for full explanation
+#define SMALL_CAPS_PERCENTAGE 80
+
+class SvxDoCapitals;
+class OutputDevice;
+class Printer;
+class Point;
+class Rectangle;
+class Size;
+
+class EDITENG_DLLPUBLIC SvxFont : public Font
+{
+ LanguageType eLang; // Language
+ SvxCaseMap eCaseMap; // Text Markup
+ short nEsc; // Degree of Superscript/Subscript
+ sal_uInt8 nPropr; // Degree of reduction of the font height
+ short nKern; // Kerning in Pt
+
+public:
+ SvxFont();
+ SvxFont( const Font &rFont );
+ SvxFont( const SvxFont &rFont );
+
+ // Methods for Superscript/Subscript
+ inline short GetEscapement() const { return nEsc; }
+ inline void SetEscapement( const short nNewEsc ) { nEsc = nNewEsc; }
+
+ inline sal_uInt8 GetPropr() const { return nPropr; }
+ inline void SetPropr( const sal_uInt8 nNewPropr ) { nPropr = nNewPropr; }
+ inline void SetProprRel( const sal_uInt8 nNewPropr )
+ { SetPropr( (sal_uInt8)( (long)nNewPropr * (long)nPropr / 100L ) ); }
+
+ // Kerning
+ inline short GetFixKerning() const { return nKern; }
+ inline void SetFixKerning( const short nNewKern ) { nKern = nNewKern; }
+
+ inline SvxCaseMap GetCaseMap() const { return eCaseMap; }
+ inline void SetCaseMap( const SvxCaseMap eNew ) { eCaseMap = eNew; }
+
+ inline LanguageType GetLanguage() const { return eLang; }
+ inline void SetLanguage( const LanguageType eNewLan )
+ { eLang = eNewLan; Font::SetLanguage(eNewLan); }
+
+ // Is-Methods:
+ inline sal_Bool IsCaseMap() const { return SVX_CASEMAP_NOT_MAPPED != eCaseMap; }
+ inline sal_Bool IsCapital() const { return SVX_CASEMAP_KAPITAELCHEN == eCaseMap; }
+ inline sal_Bool IsKern() const { return 0 != nKern; }
+ inline sal_Bool IsEsc() const { return 0 != nEsc; }
+
+ // Consider Upper case, Lower case letters etc.
+ OUString CalcCaseMap(const OUString &rTxt) const;
+
+ // Handle upper case letters
+ void DoOnCapitals( SvxDoCapitals &rDo,
+ const sal_uInt16 nPartLen = USHRT_MAX ) const;
+
+ void SetPhysFont( OutputDevice *pOut ) const;
+ Font ChgPhysFont( OutputDevice *pOut ) const;
+
+ Size GetCapitalSize( const OutputDevice *pOut, const String &rTxt,
+ const sal_uInt16 nIdx, const sal_uInt16 nLen) const;
+ void DrawCapital( OutputDevice *pOut, const Point &rPos, const String &rTxt,
+ const sal_uInt16 nIdx, const sal_uInt16 nLen ) const;
+
+ Size GetPhysTxtSize( const OutputDevice *pOut, const String &rTxt,
+ const sal_uInt16 nIdx, const sal_uInt16 nLen ) const;
+
+ Size GetPhysTxtSize( const OutputDevice *pOut, const String &rTxt );
+
+ Size GetTxtSize( const OutputDevice *pOut, const String &rTxt,
+ const sal_uInt16 nIdx = 0, const sal_uInt16 nLen = STRING_LEN ) const;
+
+ void QuickDrawText( OutputDevice *pOut, const Point &rPos, const String &rTxt,
+ const sal_uInt16 nIdx = 0, const sal_uInt16 nLen = STRING_LEN, const sal_Int32* pDXArray = NULL ) const;
+
+ Size QuickGetTextSize( const OutputDevice *pOut, const String &rTxt,
+ const sal_uInt16 nIdx, const sal_uInt16 nLen, sal_Int32* pDXArray = NULL ) const;
+
+ void DrawPrev( OutputDevice* pOut, Printer* pPrinter,
+ const Point &rPos, const String &rTxt,
+ const sal_uInt16 nIdx = 0, const sal_uInt16 nLen = STRING_LEN ) const;
+
+ static void DrawArrow( OutputDevice &rOut, const Rectangle& rRect,
+ const Size& rSize, const Color& rCol, sal_Bool bLeft );
+ SvxFont& operator=( const SvxFont& rFont );
+ SvxFont& operator=( const Font& rFont );
+};
+
+#endif // #ifndef _SVX_SVXFONT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/svxrtf.hxx b/include/editeng/svxrtf.hxx
new file mode 100644
index 000000000000..84c00a28634b
--- /dev/null
+++ b/include/editeng/svxrtf.hxx
@@ -0,0 +1,424 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVXRTF_HXX
+#define _SVXRTF_HXX
+
+#include <tools/string.hxx>
+#include <svl/itemset.hxx>
+#include <svtools/parrtf.hxx>
+
+#include <editeng/editengdllapi.h>
+
+#include <deque>
+#include <utility>
+#include <vector>
+#include "boost/ptr_container/ptr_map.hpp"
+#include "boost/ptr_container/ptr_vector.hpp"
+
+class Font;
+class Color;
+class Graphic;
+class DateTime;
+struct SvxRTFStyleType;
+class SvxRTFItemStackType;
+class SvxRTFItemStackList : public boost::ptr_vector<SvxRTFItemStackType> {};
+
+namespace com { namespace sun { namespace star {
+ namespace document {
+ class XDocumentProperties;
+ }
+ namespace util {
+ struct DateTime;
+ }
+} } }
+
+
+// Mapper-Classes for the various requirements on Document positions
+// Swg - NodePosition is a SwIndex, which is used internally
+// EditEngine - ULONG to list of paragraphs
+// .....
+
+class SvxNodeIdx
+{
+public:
+ virtual ~SvxNodeIdx() {}
+ virtual sal_uLong GetIdx() const = 0;
+ virtual SvxNodeIdx* Clone() const = 0; // Cloning itself
+};
+
+class SvxPosition
+{
+public:
+ virtual ~SvxPosition() {}
+
+ virtual sal_uLong GetNodeIdx() const = 0;
+ virtual xub_StrLen GetCntIdx() const = 0;
+
+ virtual SvxPosition* Clone() const = 0; // Cloning itself
+ virtual SvxNodeIdx* MakeNodeIdx() const = 0; // Cloning NodeIndex
+};
+
+
+typedef Color* ColorPtr;
+typedef std::deque< ColorPtr > SvxRTFColorTbl;
+typedef boost::ptr_map<short, Font> SvxRTFFontTbl;
+typedef boost::ptr_map<sal_uInt16, SvxRTFStyleType> SvxRTFStyleTbl;
+
+// SvxRTFItemStack can't be "std::stack< SvxRTFItemStackType* >" type, because
+// the methods are using operator[] in sw/source/filter/rtf/rtftbl.cxx file
+typedef std::deque< SvxRTFItemStackType* > SvxRTFItemStack;
+
+// own helper classes for the RTF Parser
+struct SvxRTFStyleType
+{
+ SfxItemSet aAttrSet; // the attributes of Style (+ derivate!)
+ String sName;
+ sal_uInt16 nBasedOn, nNext;
+ sal_Bool bBasedOnIsSet;
+ sal_uInt8 nOutlineNo;
+ sal_Bool bIsCharFmt;
+
+ SvxRTFStyleType( SfxItemPool& rPool, const sal_uInt16* pWhichRange );
+};
+
+
+// Here are the IDs for all character attributes, which can be detected by
+// SvxParser and can be set in a SfxItemSet. The IDs are set correctly throught
+// the SlotIds from POOL.
+struct RTFPlainAttrMapIds
+{
+ sal_uInt16 nCaseMap,
+ nBgColor,
+ nColor,
+ nContour,
+ nCrossedOut,
+ nEscapement,
+ nFont,
+ nFontHeight,
+ nKering,
+ nLanguage,
+ nPosture,
+ nShadowed,
+ nUnderline,
+ nOverline,
+ nWeight,
+ nWordlineMode,
+ nAutoKerning,
+ nCJKFont,
+ nCJKFontHeight,
+ nCJKLanguage,
+ nCJKPosture,
+ nCJKWeight,
+ nCTLFont,
+ nCTLFontHeight,
+ nCTLLanguage,
+ nCTLPosture,
+ nCTLWeight,
+ nEmphasis,
+ nTwoLines,
+ nCharScaleX,
+ nHorzVert,
+ nRuby,
+ nRelief,
+ nHidden
+ ;
+ RTFPlainAttrMapIds( const SfxItemPool& rPool );
+};
+
+// Here are the IDs for all paragraph attributes, which can be detected by
+// SvxParser and can be set in a SfxItemSet. The IDs are set correctly throught
+// the SlotIds from POOL.
+struct RTFPardAttrMapIds
+{
+ sal_uInt16 nLinespacing,
+ nAdjust,
+ nTabStop,
+ nHyphenzone,
+ nLRSpace,
+ nULSpace,
+ nBrush,
+ nBox,
+ nShadow,
+ nOutlineLvl,
+ nSplit,
+ nKeep,
+ nFontAlign,
+ nScriptSpace,
+ nHangPunct,
+ nForbRule,
+ nDirection
+ ;
+ RTFPardAttrMapIds( const SfxItemPool& rPool );
+};
+
+
+
+// -----------------------------------------------------------------------
+
+
+class EDITENG_DLLPUBLIC SvxRTFParser : public SvRTFParser
+{
+ SvStream &rStrm;
+ SvxRTFColorTbl aColorTbl;
+ SvxRTFFontTbl aFontTbl;
+ SvxRTFStyleTbl aStyleTbl;
+ SvxRTFItemStack aAttrStack;
+ SvxRTFItemStackList aAttrSetList;
+
+ std::vector<sal_uInt16> aPlainMap;
+ std::vector<sal_uInt16> aPardMap;
+ std::vector<sal_uInt16> aWhichMap;
+ String sBaseURL;
+
+ SvxPosition* pInsPos;
+ SfxItemPool* pAttrPool;
+ Color* pDfltColor;
+ Font* pDfltFont;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XDocumentProperties> m_xDocProps;
+ SfxItemSet *pRTFDefaults;
+
+ long nVersionNo;
+ int nDfltFont;
+
+ sal_Bool bNewDoc : 1; // sal_False - Reading in an existing
+ sal_Bool bNewGroup : 1; // sal_True - there was an opening parenthesis
+ sal_Bool bIsSetDfltTab : 1; // sal_True - DefTab was loaded
+ sal_Bool bChkStyleAttr : 1; // sal_True - StyleSheets are evaluated
+ sal_Bool bCalcValue : 1; // sal_True - Twip values adapt to App
+ sal_Bool bPardTokenRead : 1; // sal_True - Token \pard was detected
+ sal_Bool bReadDocInfo : 1; // sal_True - DocInfo to read
+ sal_Bool bIsLeftToRightDef : 1; // sal_True - in LeftToRight char run def.
+ // sal_False - in RightToLeft char run def.
+ sal_Bool bIsInReadStyleTab : 1; // sal_True - in ReadStyleTable
+
+ void ClearColorTbl();
+ void ClearFontTbl();
+ void ClearStyleTbl();
+ void ClearAttrStack();
+
+ SvxRTFItemStackType* _GetAttrSet( int bCopyAttr=sal_False ); // Create new ItemStackType:s
+ void _ClearStyleAttr( SvxRTFItemStackType& rStkType );
+
+ // Sets all the attributes that are different from the current
+ void SetAttrSet( SfxItemSet& rAttrSet, SvxPosition& rSttPos );
+ void SetAttrSet( SvxRTFItemStackType &rSet );
+ void SetDefault( int nToken, int nValue );
+
+ // Excecute pard / plain
+ void RTFPardPlain( int bPard, SfxItemSet** ppSet );
+
+ void BuildWhichTbl();
+
+ enum RTF_CharTypeDef
+ {
+ NOTDEF_CHARTYPE,
+ LOW_CHARTYPE,
+ HIGH_CHARTYPE,
+ DOUBLEBYTE_CHARTYPE
+ };
+
+ // set latin/asian/complex character attributes
+ void SetScriptAttr(
+ RTF_CharTypeDef eType, SfxItemSet& rSet, SfxPoolItem& rItem );
+
+protected:
+ virtual void EnterEnvironment();
+ virtual void LeaveEnvironment();
+ virtual void ResetPard();
+ virtual void InsertPara() = 0;
+
+
+ String& DelCharAtEnd( String& rStr, const sal_Unicode cDel );
+
+ // is called for each token that is recognized in CallParser
+ virtual void NextToken( int nToken );
+
+ virtual void ReadBitmapData();
+ virtual void ReadOLEData();
+
+ void ReadStyleTable();
+ void ReadColorTable();
+ void ReadFontTable();
+ void ReadAttr( int nToken, SfxItemSet* pSet );
+ void ReadTabAttr( int nToken, SfxItemSet& rSet );
+
+ // Read Document-Info
+ ::com::sun::star::util::DateTime GetDateTimeStamp( );
+ String& GetTextToEndGroup( String& rStr );
+ virtual void ReadInfo( const sal_Char* pChkForVerNo = 0 );
+
+ inline SfxItemSet& GetAttrSet();
+ // no text yet inserted? (SttPos from the top stack entry!)
+ int IsAttrSttPos();
+ void AttrGroupEnd(); // edit the current, delete from stack
+ void SetAllAttrOfStk(); // end all Attr. and set it into doc
+
+
+ virtual void InsertText() = 0;
+ virtual void MovePos( int bForward = sal_True ) = 0;
+ virtual void SetEndPrevPara( SvxNodeIdx*& rpNodePos,
+ xub_StrLen& rCntPos )=0;
+ virtual void SetAttrInDoc( SvxRTFItemStackType &rSet );
+ // for Tokens, which are not evaluated in ReadAttr
+ virtual void UnknownAttrToken( int nToken, SfxItemSet* pSet );
+
+ // if no-one would like to have any twips
+ virtual void CalcValue();
+
+ SvxRTFParser( SfxItemPool& rAttrPool,
+ SvStream& rIn,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XDocumentProperties> i_xDocProps,
+ int bReadNewDoc = sal_True );
+ virtual ~SvxRTFParser();
+
+ int IsNewDoc() const { return bNewDoc; }
+ void SetNewDoc( int bFlag ) { bNewDoc = bFlag; }
+ int IsNewGroup() const { return bNewGroup; }
+ void SetNewGroup( int bFlag ) { bNewGroup = bFlag; }
+ int IsChkStyleAttr() const { return bChkStyleAttr; }
+ void SetChkStyleAttr( int bFlag ) { bChkStyleAttr = bFlag; }
+ int IsCalcValue() const { return bCalcValue; }
+ void SetCalcValue( int bFlag ) { bCalcValue = bFlag; }
+ int IsPardTokenRead() const { return bPardTokenRead; }
+ void SetPardTokenRead( int bFlag ) { bPardTokenRead = bFlag; }
+ int IsReadDocInfo() const { return bReadDocInfo; }
+ void SetReadDocInfo( int bFlag ) { bReadDocInfo = bFlag; }
+
+ // Query/Set the current insert position
+ SvxPosition& GetInsPos() const { return *pInsPos; }
+ void SetInsPos( const SvxPosition& rNew );
+
+ long GetVersionNo() const { return nVersionNo; }
+
+ // Query/Set the mapping IDs for the Pard/Plain attributes
+ //(Set: It is noted in the pointers, which thus does not create a copy)
+ void AddPardAttr( sal_uInt16 nWhich ) { aPardMap.push_back( nWhich ); }
+ void AddPlainAttr( sal_uInt16 nWhich ) { aPlainMap.push_back( nWhich ); }
+
+ SvxRTFStyleTbl& GetStyleTbl() { return aStyleTbl; }
+ SvxRTFItemStack& GetAttrStack() { return aAttrStack; }
+ SvxRTFColorTbl& GetColorTbl() { return aColorTbl; }
+ SvxRTFFontTbl& GetFontTbl() { return aFontTbl; }
+
+ const String& GetBaseURL() const { return sBaseURL; }
+
+public:
+
+ virtual SvParserState CallParser();
+
+ inline const Color& GetColor( size_t nId ) const;
+ const Font& GetFont( sal_uInt16 nId ); // Changes the dflt Font
+
+ virtual int IsEndPara( SvxNodeIdx* pNd, xub_StrLen nCnt ) const = 0;
+
+ // to det a different attribute pool. May only be done prior to CallParser!
+ // The maps are not generated anew!
+ void SetAttrPool( SfxItemPool* pNewPool ) { pAttrPool = pNewPool; }
+ // to set different WhichIds for a different pool.
+ RTFPardAttrMapIds& GetPardMap()
+ { return (RTFPardAttrMapIds&)*aPardMap.begin(); }
+ RTFPlainAttrMapIds& GetPlainMap()
+ { return (RTFPlainAttrMapIds&)*aPlainMap.begin(); }
+ // to be able to assign them from the outside as for example table cells
+ void ReadBorderAttr( int nToken, SfxItemSet& rSet, int bTableDef=sal_False );
+ void ReadBackgroundAttr( int nToken, SfxItemSet& rSet, int bTableDef=sal_False );
+
+ // for asynchronous read from the SvStream
+ virtual void Continue( int nToken );
+
+ // get RTF default ItemSets. Must be used by pard/plain tokens or in
+ // reset of Style-Items
+ const SfxItemSet& GetRTFDefaults();
+ virtual bool UncompressableStackEntry(const SvxRTFItemStackType &rSet) const;
+};
+
+// The stack for the attributes:
+// this class may only be used by SvxRTFParser!
+class EDITENG_DLLPUBLIC SvxRTFItemStackType
+{
+ friend class SvxRTFParser;
+
+ SfxItemSet aAttrSet;
+ SvxNodeIdx *pSttNd, *pEndNd;
+ xub_StrLen nSttCnt, nEndCnt;
+ SvxRTFItemStackList* pChildList;
+ sal_uInt16 nStyleNo;
+
+ SvxRTFItemStackType( SfxItemPool&, const sal_uInt16* pWhichRange,
+ const SvxPosition& );
+
+ void Add( SvxRTFItemStackType* );
+ void Compress( const SvxRTFParser& );
+
+public:
+ SvxRTFItemStackType( const SvxRTFItemStackType&, const SvxPosition&,
+ int bCopyAttr = sal_False );
+ ~SvxRTFItemStackType();
+ //cmc, I'm very suspicios about SetStartPos, it doesn't change
+ //its children's starting position, and the implementation looks
+ //bad, consider this deprecated.
+ void SetStartPos( const SvxPosition& rPos );
+
+ void MoveFullNode(const SvxNodeIdx &rOldNode,
+ const SvxNodeIdx &rNewNode);
+
+ sal_uLong GetSttNodeIdx() const { return pSttNd->GetIdx(); }
+ sal_uLong GetEndNodeIdx() const { return pEndNd->GetIdx(); }
+
+ const SvxNodeIdx& GetSttNode() const { return *pSttNd; }
+ const SvxNodeIdx& GetEndNode() const { return *pEndNd; }
+
+ xub_StrLen GetSttCnt() const { return nSttCnt; }
+ xub_StrLen GetEndCnt() const { return nEndCnt; }
+
+ SfxItemSet& GetAttrSet() { return aAttrSet; }
+ const SfxItemSet& GetAttrSet() const { return aAttrSet; }
+
+ sal_uInt16 StyleNo() const { return nStyleNo; }
+
+ void SetRTFDefaults( const SfxItemSet& rDefaults );
+};
+
+
+// ----------- Inline Implementations --------------
+
+inline const Color& SvxRTFParser::GetColor( size_t nId ) const
+{
+ ColorPtr pColor = (ColorPtr)pDfltColor;
+ if( nId < aColorTbl.size() )
+ pColor = aColorTbl[ nId ];
+ return *pColor;
+}
+
+inline SfxItemSet& SvxRTFParser::GetAttrSet()
+{
+ SvxRTFItemStackType* pTmp;
+ if( bNewGroup || 0 == ( pTmp = aAttrStack.empty() ? 0 : aAttrStack.back()) )
+ pTmp = _GetAttrSet();
+ return pTmp->aAttrSet;
+}
+
+
+#endif
+ //_SVXRTF_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/swafopt.hxx b/include/editeng/swafopt.hxx
new file mode 100644
index 000000000000..684a1838c731
--- /dev/null
+++ b/include/editeng/swafopt.hxx
@@ -0,0 +1,134 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef EE_SVXSWAFOPT_HXX
+#define EE_SVXSWAFOPT_HXX
+
+#include <o3tl/sorted_vector.hxx>
+
+#include <tools/string.hxx>
+
+#include <vcl/font.hxx>
+#include "editeng/editengdllapi.h"
+
+class SmartTagMgr;
+
+namespace editeng {
+
+class EDITENG_DLLPUBLIC IAutoCompleteString
+{
+private:
+ String m_String;
+public:
+ explicit IAutoCompleteString(String const& rString) : m_String(rString) {}
+ virtual ~IAutoCompleteString() {}
+ String const& GetAutoCompleteString() const { return m_String; }
+};
+
+struct CompareAutoCompleteString
+{
+ bool operator()(IAutoCompleteString *const& lhs,
+ IAutoCompleteString *const& rhs) const
+ {
+ return lhs->GetAutoCompleteString().CompareIgnoreCaseToAscii(
+ rhs->GetAutoCompleteString()) == COMPARE_LESS;
+ }
+};
+
+class SortedAutoCompleteStrings
+ : public o3tl::sorted_vector<IAutoCompleteString*, CompareAutoCompleteString>
+{
+public:
+ ~SortedAutoCompleteStrings() { DeleteAndDestroyAll(); }
+};
+
+} // namespace editeng
+
+// Class of options for AutoFormat
+struct EDITENG_DLLPUBLIC SvxSwAutoFmtFlags
+{
+ Font aBulletFont;
+ Font aByInputBulletFont;
+ /// only valid inside the Dialog!!!
+ const editeng::SortedAutoCompleteStrings * m_pAutoCompleteList;
+ SmartTagMgr* pSmartTagMgr;
+
+ sal_Unicode cBullet;
+ sal_Unicode cByInputBullet;
+
+ sal_uInt16 nAutoCmpltWordLen, nAutoCmpltListLen;
+ sal_uInt16 nAutoCmpltExpandKey;
+
+ sal_uInt8 nRightMargin;
+
+ sal_Bool bAutoCorrect : 1;
+ sal_Bool bCptlSttSntnc : 1;
+ sal_Bool bCptlSttWrd : 1;
+ sal_Bool bChkFontAttr : 1;
+
+ sal_Bool bChgUserColl : 1;
+ sal_Bool bChgEnumNum : 1;
+
+ sal_Bool bAFmtByInput : 1;
+ sal_Bool bDelEmptyNode : 1;
+ sal_Bool bSetNumRule : 1;
+
+ sal_Bool bChgOrdinalNumber : 1;
+ sal_Bool bChgToEnEmDash : 1;
+ sal_Bool bAddNonBrkSpace : 1;
+ sal_Bool bChgWeightUnderl : 1;
+ sal_Bool bSetINetAttr : 1;
+
+ sal_Bool bSetBorder : 1;
+ sal_Bool bCreateTable : 1;
+ sal_Bool bReplaceStyles : 1;
+ sal_Bool bDummy : 1;
+
+ sal_Bool bWithRedlining : 1;
+
+ sal_Bool bRightMargin : 1;
+
+ sal_Bool bAutoCompleteWords : 1;
+ sal_Bool bAutoCmpltCollectWords : 1;
+ sal_Bool bAutoCmpltEndless : 1;
+// -- under NT here starts a new long
+ sal_Bool bAutoCmpltAppendBlanc : 1;
+ sal_Bool bAutoCmpltShowAsTip : 1;
+
+ sal_Bool bAFmtDelSpacesAtSttEnd : 1;
+ sal_Bool bAFmtDelSpacesBetweenLines : 1;
+ sal_Bool bAFmtByInpDelSpacesAtSttEnd : 1;
+ sal_Bool bAFmtByInpDelSpacesBetweenLines : 1;
+
+ sal_Bool bAutoCmpltKeepList : 1;
+
+ // some dummies for any new options
+ sal_Bool bDummy6 : 1,
+ bDummy7 : 1,
+ bDummy8 : 1
+ ;
+
+ SvxSwAutoFmtFlags();
+ SvxSwAutoFmtFlags( const SvxSwAutoFmtFlags& rAFFlags ) { *this = rAFFlags; }
+ SvxSwAutoFmtFlags& operator=( const SvxSwAutoFmtFlags& );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/tstpitem.hxx b/include/editeng/tstpitem.hxx
new file mode 100644
index 000000000000..f8eca761395b
--- /dev/null
+++ b/include/editeng/tstpitem.hxx
@@ -0,0 +1,161 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_TSPTITEM_HXX
+#define _SVX_TSPTITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <editeng/svxenum.hxx>
+#include <editeng/editengdllapi.h>
+#include <o3tl/sorted_vector.hxx>
+
+// class SvxTabStop ------------------------------------------------------
+
+#define SVX_TAB_DEFCOUNT 10
+#define SVX_TAB_DEFDIST 1134 // 2cm in twips
+#define SVX_TAB_NOTFOUND USHRT_MAX
+#define cDfltDecimalChar (sal_Unicode(0x00)) // Get from IntlWrapper
+#define cDfltFillChar (sal_Unicode(' '))
+
+class EDITENG_DLLPUBLIC SvxTabStop
+{
+private:
+ sal_Int32 nTabPos;
+
+ SvxTabAdjust eAdjustment;
+ mutable sal_Unicode m_cDecimal;
+ sal_Unicode cFill;
+
+ EDITENG_DLLPRIVATE friend SvStream& operator<<( SvStream&, SvxTabStop& );
+
+ void fillDecimal() const;
+
+public:
+ SvxTabStop();
+ explicit SvxTabStop( const sal_Int32 nPos,
+ const SvxTabAdjust eAdjst = SVX_TAB_ADJUST_LEFT,
+ const sal_Unicode cDec = cDfltDecimalChar,
+ const sal_Unicode cFil = cDfltFillChar );
+
+ sal_Int32& GetTabPos() { return nTabPos; }
+ sal_Int32 GetTabPos() const { return nTabPos; }
+
+ SvxTabAdjust& GetAdjustment() { return eAdjustment; }
+ SvxTabAdjust GetAdjustment() const { return eAdjustment; }
+
+ sal_Unicode& GetDecimal() { fillDecimal(); return m_cDecimal; }
+ sal_Unicode GetDecimal() const { fillDecimal(); return m_cDecimal; }
+
+ sal_Unicode& GetFill() { return cFill; }
+ sal_Unicode GetFill() const { return cFill; }
+
+ String GetValueString() const;
+
+ // the "old" operator==()
+ sal_Bool IsEqual( const SvxTabStop& rTS ) const
+ {
+ return ( nTabPos == rTS.nTabPos &&
+ eAdjustment == rTS.eAdjustment &&
+ m_cDecimal == rTS.m_cDecimal &&
+ cFill == rTS.cFill );
+ }
+
+ // For the SortedArray:
+ sal_Bool operator==( const SvxTabStop& rTS ) const
+ { return nTabPos == rTS.nTabPos; }
+ sal_Bool operator <( const SvxTabStop& rTS ) const
+ { return nTabPos < rTS.nTabPos; }
+
+ SvxTabStop& operator=( const SvxTabStop& rTS )
+ {
+ nTabPos = rTS.nTabPos;
+ eAdjustment = rTS.eAdjustment;
+ m_cDecimal = rTS.m_cDecimal;
+ cFill = rTS.cFill;
+ return *this;
+ }
+};
+
+// class SvxTabStopItem --------------------------------------------------
+
+typedef o3tl::sorted_vector<SvxTabStop> SvxTabStopArr;
+
+/* [Description]
+
+ This item describes a list of TabStops.
+*/
+
+class EDITENG_DLLPUBLIC SvxTabStopItem : public SfxPoolItem
+{
+ SvxTabStopArr maTabStops;
+
+public:
+ TYPEINFO();
+
+ explicit SvxTabStopItem( sal_uInt16 nWhich );
+ SvxTabStopItem( const sal_uInt16 nTabs,
+ const sal_uInt16 nDist,
+ const SvxTabAdjust eAdjst /*= SVX_TAB_ADJUST_DEFAULT*/,
+ sal_uInt16 nWhich );
+ SvxTabStopItem( const SvxTabStopItem& rTSI );
+
+ // Returns index of the tab or TAB_NOTFOUND
+ sal_uInt16 GetPos( const SvxTabStop& rTab ) const;
+
+ // Returns index of the tab at nPos, or TAB_NOTFOUND
+ sal_uInt16 GetPos( const sal_Int32 nPos ) const;
+
+ // unprivatized:
+ sal_uInt16 Count() const { return maTabStops.size(); }
+ bool Insert( const SvxTabStop& rTab );
+ void Insert( const SvxTabStopItem* pTabs, sal_uInt16 nStart = 0,
+ sal_uInt16 nEnd = USHRT_MAX );
+ void Remove( SvxTabStop& rTab )
+ { maTabStops.erase( rTab ); }
+ void Remove( const sal_uInt16 nPos, const sal_uInt16 nLen = 1 )
+ { maTabStops.erase( maTabStops.begin() + nPos, maTabStops.begin() + nPos + nLen ); }
+
+ // Assignment operator, equality operator (caution: expensive!)
+ SvxTabStopItem& operator=( const SvxTabStopItem& rTSI );
+
+ // this is already included in SfxPoolItem declaration
+ //int operator!=( const SvxTabStopItem& rTSI ) const
+ // { return !( operator==( rTSI ) ); }
+
+ const SvxTabStop& operator[]( const sal_uInt16 nPos ) const
+ { return maTabStops[nPos]; }
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream&, sal_uInt16 ) const;
+ virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const;
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/twolinesitem.hxx b/include/editeng/twolinesitem.hxx
new file mode 100644
index 000000000000..dfdddde4b54b
--- /dev/null
+++ b/include/editeng/twolinesitem.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_TWOLINESITEM_HXX
+#define _SVX_TWOLINESITEM_HXX
+
+#include <sal/types.h>
+#include <svl/poolitem.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+class EDITENG_DLLPUBLIC SvxTwoLinesItem : public SfxPoolItem
+{
+ sal_Unicode cStartBracket, cEndBracket;
+ sal_Bool bOn;
+public:
+ TYPEINFO();
+ SvxTwoLinesItem( sal_Bool bOn /*= sal_True*/,
+ sal_Unicode nStartBracket /*= 0*/,
+ sal_Unicode nEndBracket /*= 0*/,
+ sal_uInt16 nId );
+ SvxTwoLinesItem( const SvxTwoLinesItem& rAttr );
+ virtual ~SvxTwoLinesItem();
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16 nVer) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nIVer) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFFVer ) const;
+
+ SvxTwoLinesItem& operator=( const SvxTwoLinesItem& rCpy )
+ {
+ SetValue( rCpy.GetValue() );
+ SetStartBracket( rCpy.GetStartBracket() );
+ SetEndBracket( rCpy.GetEndBracket() );
+ return *this;
+ }
+
+ sal_Bool GetValue() const { return bOn; }
+ void SetValue( sal_Bool bFlag ) { bOn = bFlag; }
+
+ sal_Unicode GetStartBracket() const { return cStartBracket; }
+ void SetStartBracket( sal_Unicode c ) { cStartBracket = c; }
+
+ sal_Unicode GetEndBracket() const { return cEndBracket; }
+ void SetEndBracket( sal_Unicode c ) { cEndBracket = c; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/txtrange.hxx b/include/editeng/txtrange.hxx
new file mode 100644
index 000000000000..700db5760ad1
--- /dev/null
+++ b/include/editeng/txtrange.hxx
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _MyTXTRANGE_HXX
+#define _MyTXTRANGE_HXX
+
+#include "editeng/editengdllapi.h"
+#include "tools/solar.h"
+#include "tools/gen.hxx"
+
+#include <deque>
+
+class PolyPolygon;
+class Rectangle;
+
+namespace basegfx {
+ class B2DPolyPolygon;
+}
+
+typedef std::deque<long>* LongDqPtr;
+
+/*************************************************************************
+|*
+|* class TextRanger
+|*
+*************************************************************************/
+class EDITENG_DLLPUBLIC TextRanger
+{
+ //! The RangeCache class is used to cache the result of a single range calculation.
+ struct RangeCache
+ {
+ Range range; //!< Range for which we calculated results.
+ std::deque<long> results; //!< Calculated results for the range.
+ RangeCache(const Range& rng) : range(rng) {};
+ };
+ std::deque<RangeCache> mRangeCache; //!< Cached range calculations.
+ PolyPolygon *mpPolyPolygon; // Surface polygon
+ PolyPolygon *mpLinePolyPolygon; // Line polygon
+ Rectangle *pBound; // Comprehensive rectangle
+ sal_uInt16 nCacheSize; // Cache-Size
+ sal_uInt16 nRight; // Distance Contour-Text
+ sal_uInt16 nLeft; // Distance Text-Contour
+ sal_uInt16 nUpper; // Distance Contour-Text
+ sal_uInt16 nLower; // Distance Text-Contour
+ sal_uInt32 nPointCount; // Number of polygon points
+ sal_Bool bSimple : 1; // Just outside edge
+ sal_Bool bInner : 1; // TRUE: Objekt inline (EditEngine);
+ // FALSE: Objekt flow (StarWriter);
+ sal_Bool bVertical :1; // for vertical writing mode
+ sal_Bool bFlag3 :1;
+ sal_Bool bFlag4 :1;
+ sal_Bool bFlag5 :1;
+ sal_Bool bFlag6 :1;
+ sal_Bool bFlag7 :1;
+ TextRanger( const TextRanger& ); // not implemented
+ const Rectangle& _GetBoundRect();
+public:
+ TextRanger( const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const basegfx::B2DPolyPolygon* pLinePolyPolygon,
+ sal_uInt16 nCacheSize, sal_uInt16 nLeft, sal_uInt16 nRight,
+ sal_Bool bSimple, sal_Bool bInner, sal_Bool bVert = sal_False );
+ ~TextRanger();
+ LongDqPtr GetTextRanges( const Range& rRange );
+ sal_uInt16 GetRight() const { return nRight; }
+ sal_uInt16 GetLeft() const { return nLeft; }
+ sal_uInt16 GetUpper() const { return nUpper; }
+ sal_uInt16 GetLower() const { return nLower; }
+ sal_uInt32 GetPointCount() const { return nPointCount; }
+ sal_Bool IsSimple() const { return bSimple; }
+ sal_Bool IsInner() const { return bInner; }
+ sal_Bool IsVertical() const { return bVertical; }
+ sal_Bool HasBorder() const { return nRight || nLeft; }
+ const PolyPolygon& GetPolyPolygon() const { return *mpPolyPolygon; }
+ const PolyPolygon* GetLinePolygon() const { return mpLinePolyPolygon; }
+ const Rectangle& GetBoundRect()
+ { return pBound ? static_cast< const Rectangle& >(*pBound) : _GetBoundRect(); }
+ void SetUpper( sal_uInt16 nNew ){ nUpper = nNew; }
+ void SetLower( sal_uInt16 nNew ){ nLower = nNew; }
+ void SetVertical( sal_Bool bNew );
+ sal_Bool IsFlag3() const { return bFlag3; }
+ void SetFlag3( sal_Bool bNew ) { bFlag3 = bNew; }
+ sal_Bool IsFlag4() const { return bFlag4; }
+ void SetFlag4( sal_Bool bNew ) { bFlag4 = bNew; }
+ sal_Bool IsFlag5() const { return bFlag5; }
+ void SetFlag5( sal_Bool bNew ) { bFlag5 = bNew; }
+ sal_Bool IsFlag6() const { return bFlag6; }
+ void SetFlag6( sal_Bool bNew ) { bFlag6 = bNew; }
+ sal_Bool IsFlag7() const { return bFlag7; }
+ void SetFlag7( sal_Bool bNew ) { bFlag7 = bNew; }
+};
+
+
+
+#endif // _TXTRANGE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/udlnitem.hxx b/include/editeng/udlnitem.hxx
new file mode 100644
index 000000000000..7d1a88dfa81a
--- /dev/null
+++ b/include/editeng/udlnitem.hxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_UDLNITEM_HXX
+#define _SVX_UDLNITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <vcl/vclenum.hxx>
+#include <tools/color.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxTextLineItem ------------------------------------------------
+
+/* Value container for underline and overline font effects */
+
+class EDITENG_DLLPUBLIC SvxTextLineItem : public SfxEnumItem
+{
+ Color mColor;
+public:
+ TYPEINFO();
+
+ SvxTextLineItem( const FontUnderline eSt,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+ virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const;
+ virtual sal_uInt16 GetValueCount() const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ // MS VC4.0 messes things up
+ void SetValue( sal_uInt16 nNewVal )
+ {SfxEnumItem::SetValue(nNewVal); }
+ virtual int HasBoolValue() const;
+ virtual sal_Bool GetBoolValue() const;
+ virtual void SetBoolValue( sal_Bool bVal );
+
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ inline SvxTextLineItem& operator=(const SvxTextLineItem& rTextLine)
+ {
+ SetValue( rTextLine.GetValue() );
+ SetColor( rTextLine.GetColor() );
+ return *this;
+ }
+
+ // enum cast
+ FontUnderline GetLineStyle() const
+ { return (FontUnderline)GetValue(); }
+ void SetLineStyle( FontUnderline eNew )
+ { SetValue((sal_uInt16) eNew); }
+
+ const Color& GetColor() const { return mColor; }
+ void SetColor( const Color& rCol ) { mColor = rCol; }
+};
+
+// class SvxUnderlineItem ------------------------------------------------
+
+/* Value container for underline font effects */
+
+class EDITENG_DLLPUBLIC SvxUnderlineItem : public SvxTextLineItem
+{
+public:
+ TYPEINFO();
+
+ SvxUnderlineItem( const FontUnderline eSt,
+ const sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const;
+};
+
+// class SvxOverlineItem ------------------------------------------------
+
+/* Value container for overline font effects */
+
+class EDITENG_DLLPUBLIC SvxOverlineItem : public SvxTextLineItem
+{
+public:
+ TYPEINFO();
+
+ SvxOverlineItem( const FontUnderline eSt,
+ const sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const;
+};
+
+#endif // #ifndef _SVX_UDLNITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/ulspitem.hxx b/include/editeng/ulspitem.hxx
new file mode 100644
index 000000000000..f57c01bb3d3f
--- /dev/null
+++ b/include/editeng/ulspitem.hxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_ULSPITEM_HXX
+#define _SVX_ULSPITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <editeng/editengdllapi.h>
+
+
+// class SvxULSpaceItem --------------------------------------------------
+
+/* [Description]
+
+ This item describes the Upper- and Lower space of a page or paragraph.
+*/
+
+#define ULSPACE_16_VERSION ((sal_uInt16)0x0001)
+
+class EDITENG_DLLPUBLIC SvxULSpaceItem : public SfxPoolItem
+{
+ sal_uInt16 nUpper; // Upper space
+ sal_uInt16 nLower; // Lower space
+ sal_Bool bContext; // Contextual spacing?
+ sal_uInt16 nPropUpper, nPropLower; // relative or absolute (=100%)
+public:
+ TYPEINFO();
+
+ explicit SvxULSpaceItem( const sal_uInt16 nId );
+ SvxULSpaceItem( const sal_uInt16 nUp, const sal_uInt16 nLow,
+ const sal_uInt16 nId );
+ inline SvxULSpaceItem& operator=( const SvxULSpaceItem &rCpy );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+ virtual bool ScaleMetrics( long nMult, long nDiv );
+ virtual bool HasMetrics() const;
+
+ inline void SetUpper( const sal_uInt16 nU, const sal_uInt16 nProp = 100 );
+ inline void SetLower( const sal_uInt16 nL, const sal_uInt16 nProp = 100 );
+
+ void SetUpperValue( const sal_uInt16 nU ) { nUpper = nU; }
+ void SetLowerValue( const sal_uInt16 nL ) { nLower = nL; }
+ void SetContextValue( const sal_Bool bC ) { bContext = bC; }
+ void SetPropUpper( const sal_uInt16 nU ) { nPropUpper = nU; }
+ void SetPropLower( const sal_uInt16 nL ) { nPropLower = nL; }
+
+ sal_uInt16 GetUpper() const { return nUpper; }
+ sal_uInt16 GetLower() const { return nLower; }
+ sal_Bool GetContext() const { return bContext; }
+ sal_uInt16 GetPropUpper() const { return nPropUpper; }
+ sal_uInt16 GetPropLower() const { return nPropLower; }
+};
+
+inline SvxULSpaceItem &SvxULSpaceItem::operator=( const SvxULSpaceItem &rCpy )
+{
+ nUpper = rCpy.GetUpper();
+ nLower = rCpy.GetLower();
+ bContext = rCpy.GetContext();
+ nPropUpper = rCpy.GetPropUpper();
+ nPropLower = rCpy.GetPropLower();
+ return *this;
+}
+
+inline void SvxULSpaceItem::SetUpper( const sal_uInt16 nU, const sal_uInt16 nProp )
+{
+ nUpper = sal_uInt16((sal_uInt32(nU) * nProp ) / 100); nPropUpper = nProp;
+}
+inline void SvxULSpaceItem::SetLower( const sal_uInt16 nL, const sal_uInt16 nProp )
+{
+ nLower = sal_uInt16((sal_uInt32(nL) * nProp ) / 100); nPropLower = nProp;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unoedhlp.hxx b/include/editeng/unoedhlp.hxx
new file mode 100644
index 000000000000..25cf36f17356
--- /dev/null
+++ b/include/editeng/unoedhlp.hxx
@@ -0,0 +1,161 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_UNOEDHLP_HXX
+#define _SVX_UNOEDHLP_HXX
+
+#include <memory>
+#include <tools/solar.h>
+#include <vcl/textdata.hxx>
+#include <svl/hint.hxx>
+#include <tools/gen.hxx>
+#include "editeng/editengdllapi.h"
+
+struct EENotify;
+class EditEngine;
+
+#define EDITSOURCE_HINT_PARASMOVED 20
+#define EDITSOURCE_HINT_SELECTIONCHANGED 21
+
+/** Extends TextHint by two additional parameters which are necessary
+ for the EDITSOURCE_HINT_PARASMOVED hint. TextHint's value in this
+ case denotes the destination position, the two parameters the
+ start and the end of the moved paragraph range.
+ */
+class EDITENG_DLLPUBLIC SvxEditSourceHint : public TextHint
+{
+private:
+ sal_uLong mnStart;
+ sal_uLong mnEnd;
+
+public:
+ TYPEINFO();
+ SvxEditSourceHint( sal_uLong nId );
+ SvxEditSourceHint( sal_uLong nId, sal_uLong nValue, sal_uLong nStart=0, sal_uLong nEnd=0 );
+
+ sal_uLong GetValue() const;
+ sal_uLong GetStartValue() const;
+ sal_uLong GetEndValue() const;
+};
+
+/** Helper class for common functionality in edit sources
+ */
+class EDITENG_DLLPUBLIC SvxEditSourceHelper
+{
+public:
+
+ /** Translates EditEngine notifications into broadcastable hints
+
+ @param aNotify
+ Notification object send by the EditEngine.
+
+ @return the translated hint
+ */
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ static ::std::auto_ptr<SfxHint> EENotification2Hint( EENotify* aNotify );
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+
+ /** Calculate attribute run for EditEngines
+
+ Please note that the range returned is half-open: [nStartIndex,nEndIndex)
+
+ @param nStartIndex
+ Herein, the start index of the range of similar attributes is returned
+
+ @param nEndIndex
+ Herein, the end index (exclusive) of the range of similar attributes is returned
+
+ @param rEE
+ The EditEngine to query for attributes
+
+ @param nPara
+ The paragraph the following index value is to be interpreted in
+
+ @param nIndex
+ The character index from which the range of similar attributed characters is requested
+
+ @return sal_True, if the range has been successfully determined
+ */
+ static sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, const EditEngine& rEE, sal_uInt16 nPara, sal_uInt16 nIndex );
+
+ /** Convert point from edit engine to user coordinate space
+
+ As the edit engine internally keeps vertical text unrotated,
+ all internal edit engine methods return their stuff unrotated,
+ too. This method rotates and shifts given point appropriately,
+ if vertical writing is on.
+
+ @param rPoint
+ Point to transform
+
+ @param rEESize
+ Paper size of the edit engine
+
+ @param bIsVertical
+ Whether output text is vertical or not
+
+ @return the possibly transformed point
+ */
+ static Point EEToUserSpace( const Point& rPoint, const Size& rEESize, bool bIsVertical );
+
+ /** Convert point from user to edit engine coordinate space
+
+ As the edit engine internally keeps vertical text unrotated,
+ all internal edit engine methods return their stuff unrotated,
+ too. This method rotates and shifts given point appropriately,
+ if vertical writing is on.
+
+ @param rPoint
+ Point to transform
+
+ @param rEESize
+ Paper size of the edit engine
+
+ @param bIsVertical
+ Whether output text is vertical or not
+
+ @return the possibly transformed point
+ */
+ static Point UserSpaceToEE( const Point& rPoint, const Size& rEESize, bool bIsVertical );
+
+ /** Convert rect from edit engine to user coordinate space
+
+ As the edit engine internally keeps vertical text unrotated,
+ all internal edit engine methods return their stuff unrotated,
+ too. This method rotates and shifts given rect appropriately,
+ if vertical writing is on.
+
+ @param rRect
+ Rectangle to transform
+
+ @param rEESize
+ Paper size of the edit engine
+
+ @param bIsVertical
+ Whether output text is vertical or not
+
+ @return the possibly transformed rect
+ */
+ static Rectangle EEToUserSpace( const Rectangle& rRect, const Size& rEESize, bool bIsVertical );
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unoedprx.hxx b/include/editeng/unoedprx.hxx
new file mode 100644
index 000000000000..c6e067a6a633
--- /dev/null
+++ b/include/editeng/unoedprx.hxx
@@ -0,0 +1,176 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_UNOEDPRX_HXX
+#define _SVX_UNOEDPRX_HXX
+
+#include <memory>
+#include <svl/brdcst.hxx>
+#include <editeng/unoedsrc.hxx>
+
+#include <editeng/editdata.hxx>
+#include "editeng/editengdllapi.h"
+
+class SvxAccessibleTextAdapter : public SvxTextForwarder
+{
+public:
+ SvxAccessibleTextAdapter();
+ virtual ~SvxAccessibleTextAdapter();
+
+ virtual sal_uInt16 GetParagraphCount() const;
+ virtual sal_uInt16 GetTextLen( sal_uInt16 nParagraph ) const;
+ virtual String GetText( const ESelection& rSel ) const;
+ virtual SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = 0 ) const;
+ virtual SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const;
+ virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet );
+ virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich );
+ virtual void GetPortions( sal_uInt16 nPara, std::vector<sal_uInt16>& rList ) const;
+
+ virtual sal_uInt16 CalcEditEngineIndex( sal_uInt16 nPara, sal_Int32 nLogicalIndex );
+
+ virtual sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const;
+ virtual sal_uInt16 GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const;
+
+ virtual void QuickInsertText( const String& rText, const ESelection& rSel );
+ virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel );
+ virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel );
+ virtual void QuickInsertLineBreak( const ESelection& rSel );
+
+ virtual SfxItemPool* GetPool() const;
+
+ virtual XubString CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor );
+ virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos );
+
+ virtual sal_Bool IsValid() const;
+
+ virtual LanguageType GetLanguage( sal_uInt16, sal_uInt16 ) const;
+ virtual sal_uInt16 GetFieldCount( sal_uInt16 nPara ) const;
+ virtual EFieldInfo GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const;
+ virtual EBulletInfo GetBulletInfo( sal_uInt16 nPara ) const;
+ virtual Rectangle GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const;
+ virtual Rectangle GetParaBounds( sal_uInt16 nPara ) const;
+ virtual MapMode GetMapMode() const;
+ virtual OutputDevice* GetRefDevice() const;
+ virtual sal_Bool GetIndexAtPoint( const Point&, sal_uInt16& nPara, sal_uInt16& nIndex ) const;
+ virtual sal_Bool GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const;
+ virtual sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const;
+ virtual sal_uInt16 GetLineCount( sal_uInt16 nPara ) const;
+ virtual sal_uInt16 GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const;
+ virtual void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const;
+ virtual sal_uInt16 GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const;
+
+ virtual sal_Bool Delete( const ESelection& );
+ virtual sal_Bool InsertText( const String&, const ESelection& );
+ virtual sal_Bool QuickFormatDoc( sal_Bool bFull=sal_False );
+ virtual sal_Int16 GetDepth( sal_uInt16 nPara ) const;
+ virtual sal_Bool SetDepth( sal_uInt16 nPara, sal_Int16 nNewDepth );
+
+ virtual const SfxItemSet* GetEmptyItemSetPtr();
+
+ // implementation functions for XParagraphAppend and XTextPortionAppend
+ // (not needed for accessibility, only for new import API)
+ virtual void AppendParagraph();
+ virtual xub_StrLen AppendTextPortion( sal_uInt16 nPara, const String &rText, const SfxItemSet &rSet );
+
+ //XTextCopy
+ virtual void CopyText(const SvxTextForwarder& rSource);
+
+ void SetForwarder( SvxTextForwarder& );
+ sal_Bool HaveImageBullet( sal_uInt16 nPara ) const;
+ sal_Bool HaveTextBullet( sal_uInt16 nPara ) const;
+
+ /** Query whether all text in given selection is editable
+
+ @return sal_True if every character in the given selection can
+ be changed, and sal_False if e.g. a field or a bullet is
+ contained therein.
+ */
+ sal_Bool IsEditable( const ESelection& rSelection );
+
+private:
+ SvxTextForwarder* mrTextForwarder;
+};
+
+class SvxAccessibleTextEditViewAdapter : public SvxEditViewForwarder
+{
+public:
+
+ SvxAccessibleTextEditViewAdapter();
+ virtual ~SvxAccessibleTextEditViewAdapter();
+
+ // SvxViewForwarder interface
+ virtual sal_Bool IsValid() const;
+ virtual Rectangle GetVisArea() const;
+ virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const;
+ virtual Point PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const;
+
+ // SvxEditViewForwarder interface
+ virtual sal_Bool GetSelection( ESelection& rSelection ) const;
+ virtual sal_Bool SetSelection( const ESelection& rSelection );
+ virtual sal_Bool Copy();
+ virtual sal_Bool Cut();
+ virtual sal_Bool Paste();
+
+ void SetForwarder( SvxEditViewForwarder&, SvxAccessibleTextAdapter& );
+
+private:
+ SvxEditViewForwarder* mrViewForwarder;
+ SvxAccessibleTextAdapter* mrTextForwarder;
+};
+
+class EDITENG_DLLPUBLIC SvxEditSourceAdapter : public SvxEditSource
+{
+public:
+ SvxEditSourceAdapter();
+ ~SvxEditSourceAdapter();
+
+ virtual SvxEditSource* Clone() const;
+ virtual SvxTextForwarder* GetTextForwarder();
+ SvxAccessibleTextAdapter* GetTextForwarderAdapter(); // covariant return types don't work on MSVC
+ virtual SvxViewForwarder* GetViewForwarder();
+ virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate = sal_False );
+ SvxAccessibleTextEditViewAdapter* GetEditViewForwarderAdapter( sal_Bool bCreate = sal_False ); // covariant return types don't work on MSVC
+ virtual void UpdateData();
+ virtual SfxBroadcaster& GetBroadcaster() const;
+
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ void SetEditSource( ::std::auto_ptr< SvxEditSource > pAdaptee );
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+ sal_Bool IsValid() const;
+
+private:
+ // declared, but not defined
+ SvxEditSourceAdapter( const SvxEditSourceAdapter& );
+ SvxEditSourceAdapter& operator= ( const SvxEditSourceAdapter& );
+
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ ::std::auto_ptr< SvxEditSource > mpAdaptee;
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+
+ SvxAccessibleTextAdapter maTextAdapter;
+ SvxAccessibleTextEditViewAdapter maEditViewAdapter;
+
+ mutable SfxBroadcaster maDummyBroadcaster;
+
+ sal_Bool mbEditSourceValid;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unoedsrc.hxx b/include/editeng/unoedsrc.hxx
new file mode 100644
index 000000000000..9e5bba23e56b
--- /dev/null
+++ b/include/editeng/unoedsrc.hxx
@@ -0,0 +1,540 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_UNOEDSRC_HXX
+#define _SVX_UNOEDSRC_HXX
+
+#include <com/sun/star/accessibility/TextSegment.hpp>
+
+#include <tools/solar.h>
+#include <i18nlangtag/lang.h>
+#include <tools/gen.hxx>
+#include <vcl/mapmod.hxx>
+#include <tools/string.hxx>
+#include <tools/color.hxx>
+#include <svl/poolitem.hxx>
+#include <svl/itempool.hxx>
+#include "editeng/editengdllapi.h"
+
+#include <list>
+
+struct ESelection;
+struct EFieldInfo;
+struct EBulletInfo;
+class OutputDevice;
+class String;
+class SfxItemSet;
+class SvxTextForwarder;
+class SvxViewForwarder;
+class SvxEditViewForwarder;
+class SvxFieldItem;
+class SfxBroadcaster;
+class SvxUnoTextRangeBase;
+
+typedef std::list< SvxUnoTextRangeBase* > SvxUnoTextRangeBaseList;
+
+/** Wrapper class for unified EditEngine/Outliner access
+
+ This class wraps a textual object, which might or might not
+ contain an EditEngine/Outliner. Is used e.g. for filling an
+ EditEngine with the content of a cell, note page or page template.
+*/
+class EDITENG_DLLPUBLIC SvxEditSource
+{
+public:
+ virtual ~SvxEditSource();
+
+ /// Returns a new reference to the same object. This is a shallow copy
+ virtual SvxEditSource* Clone() const = 0;
+
+ /** Query the text forwarder
+
+ @return the text forwarder, or NULL if the underlying object is dead
+ */
+ virtual SvxTextForwarder* GetTextForwarder() = 0;
+
+ /** Query the view forwarder
+
+ @return the view forwarder, or NULL if the underlying object
+ is dead, or if no view is available
+
+ @derive default implementation provided, overriding is optional
+ */
+ virtual SvxViewForwarder* GetViewForwarder();
+
+ /** Query the edit view forwarder
+
+ @param bCreate
+ Determines whether an EditView should be created, if there is
+ none active. If set to sal_True, and the underlying object is
+ not in EditMode, the text forwarder changes and the object is
+ set to EditMode.
+
+ @return the edit view forwarder, or NULL if the underlying
+ object is dead, or if no view is available (if bCreate is
+ sal_False, NULL is also returned if the object is not in
+ EditMode)
+
+ @derive default implementation provided, overriding is optional
+
+ @attention If this method is called with bCreate equal to
+ sal_True, all previously returned text forwarder can become
+ invalid
+ */
+ virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate = sal_False );
+
+ /// Write back data to model
+ virtual void UpdateData() = 0;
+
+ /** Returns broadcaster the underlying edit engine's events are sent from
+
+ @derive default implementation provided, overriding is optional
+ */
+ virtual SfxBroadcaster& GetBroadcaster() const;
+
+ /** adds the given SvxUnoTextRangeBase to the text object
+ capsulated by this SvxEditSource. This allows the text
+ object to inform all created text ranges about changes
+ and also allows to re use already created instances.
+ All SvxUnoTextRangeBase must remove itself with
+ removeRange() before theire deleted. */
+ virtual void addRange( SvxUnoTextRangeBase* pNewRange );
+
+ /** removes the given SvxUnoTextRangeBase from the text
+ object capsulated by this SvxEditSource. This text range
+ will not be informed any longer of changes on the underlying
+ text and will also not re used anymore. */
+ virtual void removeRange( SvxUnoTextRangeBase* pOldRange );
+
+ /** returns a const list of all text ranges that are registered
+ for the underlying text object. */
+ virtual const SvxUnoTextRangeBaseList& getRanges() const;
+};
+
+
+/** Contains an EditEngine or an Outliner and unifies access to them.
+
+ The EditEngine-UNO objects use this class only. To reflect changes
+ not only in the EditEngine, but also in the model data, call
+ SvxEditSource::UpdateData(). This copies back the data to the model's
+ EditTextObject/OutlinerParaObject.
+ */
+class EDITENG_DLLPUBLIC SvxTextForwarder
+{
+public:
+ virtual ~SvxTextForwarder();
+
+ virtual sal_uInt16 GetParagraphCount() const = 0;
+ virtual sal_uInt16 GetTextLen( sal_uInt16 nParagraph ) const = 0;
+ virtual String GetText( const ESelection& rSel ) const = 0;
+ virtual SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = 0 ) const = 0;
+ virtual SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const = 0;
+ virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ) = 0;
+ virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ) = 0;
+ virtual void GetPortions( sal_uInt16 nPara, std::vector<sal_uInt16>& rList ) const = 0;
+
+ virtual sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const = 0;
+ virtual sal_uInt16 GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const = 0;
+
+ virtual void QuickInsertText( const String& rText, const ESelection& rSel ) = 0;
+ virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ) = 0;
+ virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel ) = 0;
+ virtual void QuickInsertLineBreak( const ESelection& rSel ) = 0;
+
+ virtual XubString CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor ) = 0;
+ virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos ) = 0;
+
+ virtual SfxItemPool* GetPool() const = 0;
+
+ virtual const SfxItemSet* GetEmptyItemSetPtr() = 0;
+
+ // implementation functions for XParagraphAppend and XTextPortionAppend
+ virtual void AppendParagraph() = 0;
+ virtual xub_StrLen AppendTextPortion( sal_uInt16 nPara, const String &rText, const SfxItemSet &rSet ) = 0;
+
+ // XTextCopy
+ virtual void CopyText(const SvxTextForwarder& rSource) = 0;
+
+ /** Query state of forwarder
+
+ @return sal_False, if no longer valid
+ */
+ virtual sal_Bool IsValid() const = 0;
+
+ /** Query language of character at given position on the underlying edit engine
+
+ @param nPara[0 .. n-1]
+ Index of paragraph to query language in
+
+ @param nIndex[0 .. m-1]
+ Index of character to query language of
+ */
+ virtual LanguageType GetLanguage( sal_uInt16 nPara, sal_uInt16 nIndex ) const = 0;
+
+ /** Query number of fields in the underlying edit engine
+
+ @param nPara[0 .. n-1]
+ Index of paragraph to query field number in
+ */
+ virtual sal_uInt16 GetFieldCount( sal_uInt16 nPara ) const = 0;
+
+ /** Query information for given field number in the underlying edit engine
+
+ @param nPara[0 .. n-1]
+ Index of paragraph to query field info in
+
+ @param nField[0 .. m-1]
+ Index of field to query information of
+ */
+ virtual EFieldInfo GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const = 0;
+
+ /** Query information regarding bullets for given paragraph on the underlying edit engine
+
+ @param nPara[0 .. n-1]
+ Index of paragraph to query bullet info on
+ */
+ virtual EBulletInfo GetBulletInfo( sal_uInt16 nPara ) const = 0;
+
+ /** Query the bounding rectangle of the given character
+
+ @param nPara[0 .. n]
+ Index of paragraph to query the bounds in. <p>The virtual
+ character after the last character of the represented text,
+ i.e. the one at position n is a special case. Because it does
+ not represent an existing character its bounding box is
+ defined in relation to preceding characters. It should be
+ rougly equivalent to the bounding box of some character when
+ inserted at the end of the text. Its height typically being
+ the maximal height of all the characters in the text or the
+ height of the preceding character, its width being at least
+ one pixel so that the bounding box is not degenerate.<br>
+
+ @param nIndex[0 .. m-1]
+ Index of character to query the bounds of
+
+ @return rectangle in logical coordinates, relative to upper
+ left corner of text. The coordinates returned here are to be
+ interpreted in the map mode given by GetMapMode().
+ */
+ virtual Rectangle GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const = 0;
+
+ /** Query the bounding rectangle of the given paragraph
+
+ @param nPara[0 .. n-1]
+ Index of paragraph to query the bounds of
+
+ @return rectangle in logical coordinates, relative to upper
+ left corner of text. The coordinates returned here are to be
+ interpreted in the map mode given by GetMapMode().
+ */
+ virtual Rectangle GetParaBounds( sal_uInt16 nPara ) const = 0;
+
+ /** Query the map mode of the underlying EditEngine/Outliner
+
+ @return the map mode used on the EditEngine/Outliner. The
+ values returned by GetParaBounds() and GetCharBounds() are to
+ be interpreted in this map mode, the point given to
+ GetIndexAtPoint() is interpreted in this map mode.
+ */
+ virtual MapMode GetMapMode() const = 0;
+
+ /** Query the reference output device of the underlying EditEngine/Outliner
+
+ @return the OutputDevice used from the EditEngine/Outliner to
+ format the text. It should be used when performing e.g. font
+ calculations, since this is usually a printer with fonts and
+ resolution different from the screen.
+ */
+ virtual OutputDevice* GetRefDevice() const = 0;
+
+ /** Query paragraph and character index of the character at the
+ given point. Returns sal_True on success, sal_False otherwise
+
+ @param rPoint
+ Point to query text position of. Is interpreted in logical
+ coordinates, relativ to the upper left corner of the text, and
+ in the map mode given by GetMapMode()
+
+ @param rPara[0 .. n-1]
+ Index of paragraph the point is within
+
+ @param rIndex[0 .. m-1]
+ Index of character the point is over
+
+ @return sal_True, if the point is over any text and both rPara and rIndex are valid
+
+ */
+ virtual sal_Bool GetIndexAtPoint( const Point& rPoint, sal_uInt16& rPara, sal_uInt16& rIndex ) const = 0;
+
+ /** Get the start and the end index of the word at the given index
+
+ An index value on a word leads from the first character of
+ that word up to and including the last space before the next
+ word. The index values returned do not contain any leading or
+ trailing white-space. If the input indices are invalid,
+ sal_False is returned.
+
+ @param nPara[0 .. n-1]
+ Index of paragraph to start the search in
+
+ @param nIndex[0 .. m-1]
+ Index of character to query the search on
+
+ @param rStart
+ Start index (in the same paragraph)
+
+ @param rEnd
+ End index (in the same paragraph), this point to the last
+ character still contained in the query
+
+ @return sal_True, if the result is non-empty
+ */
+ virtual sal_Bool GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& rStart, sal_uInt16& rEnd ) const = 0;
+
+ /** Query range of similar attributes
+
+ Please note that the range returned is half-open: [nStartIndex,nEndIndex)
+
+ @param nStartIndex
+ Herein, the start index of the range of similar attributes is returned
+
+ @param nEndIndex
+ Herein, the end index (exclusive) of the range of similar attributes is returned
+
+ @param nIndex
+ The character index from which the range of similar attributed characters is requested
+
+ @return sal_True, if the range has been successfully determined
+ */
+ virtual sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const = 0;
+
+ /** Query number of lines in the formatted paragraph
+
+ @param nPara[0 .. n-1]
+ Index of paragraph to query number of lines in
+
+ @return number of lines in given paragraph
+
+ */
+ virtual sal_uInt16 GetLineCount( sal_uInt16 nPara ) const = 0;
+
+ /** Query line length
+
+ @param nPara[0 .. n-1]
+ Index of paragraph to query line length in
+
+ @param nLine[0 .. m-1]
+ Index of line in paragraph to query line length of
+
+ */
+ virtual sal_uInt16 GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const = 0;
+
+ /** Query bounds of line in paragraph
+
+ @param rStart [output param; 0 .. text_len]
+ The index in the paragraph text that belongs to the chara at the start of the line
+
+ @param rEnd [output param; 0 .. text_len]
+ The index in the paragraph text that follows the last chara in the line
+
+ @param nParagraph[0 .. n-1]
+ Index of paragraph to query line length in
+
+ @param nLine[0 .. m-1]
+ Index of line in paragraph to query line length of
+
+ */
+ virtual void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const = 0;
+
+ /** Query the line number for a index in the paragraphs text
+
+ @param nPara[0 .. n-1]
+ Index of paragraph to query line length in
+
+ @param nIndex[0 .. m-1]
+ Index of of the chara in the paragraph text
+
+ @returns [0 .. k-1]
+ The line number of the chara in the paragraph
+ */
+ virtual sal_uInt16 GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const = 0;
+
+ /** Delete given text range and reformat text
+
+ @param rSelection
+ The text range to be deleted
+
+ @return sal_True if text has been successfully deleted
+ */
+ virtual sal_Bool Delete( const ESelection& rSelection ) = 0;
+
+ /** Insert/Replace given text in given range and reformat text
+
+ @param rText
+ Text to insert/replace
+
+ @param rSel
+ Selection where text should be replaced. The empty selection inserts
+
+ @return sal_True if text has been successfully inserted
+ */
+ virtual sal_Bool InsertText( const String& rText, const ESelection& rSel ) = 0;
+
+ /** Updates the formatting
+
+ @see EditEngine::QuickFormatDoc() for details
+
+ @return sal_True if text have been successfully reformatted
+ */
+ virtual sal_Bool QuickFormatDoc( sal_Bool bFull=sal_False ) = 0;
+
+ /** Get the outline depth of given paragraph
+
+ @param nPara
+ Index of the paragraph to query the depth of
+
+ @return the outline level of the given paragraph. The range is
+ [0,n), where n is the maximal outline level.
+ */
+ virtual sal_Int16 GetDepth( sal_uInt16 nPara ) const = 0;
+
+ /** Set the outline depth of given paragraph
+
+ @param nPara
+ Index of the paragraph to set the depth of
+
+ @param nNewDepth
+ The depth to set on the given paragraph. The range is
+ [0,n), where n is the maximal outline level.
+
+ @return sal_True, if depth could be successfully set. Reasons for
+ failure are e.g. the text does not support outline level
+ (EditEngine), or the depth range is exceeded.
+ */
+ virtual sal_Bool SetDepth( sal_uInt16 nPara, sal_Int16 nNewDepth ) = 0;
+
+ virtual sal_Int16 GetNumberingStartValue( sal_uInt16 nPara );
+ virtual void SetNumberingStartValue( sal_uInt16 nPara, sal_Int16 nNumberingStartValue );
+
+ virtual sal_Bool IsParaIsNumberingRestart( sal_uInt16 nPara );
+ virtual void SetParaIsNumberingRestart( sal_uInt16 nPara, sal_Bool bParaIsNumberingRestart );
+};
+
+/** Encapsulates the document view for the purpose of unified
+ EditEngine/Outliner access.
+
+ This one has to be different from the SvxEditViewForwarder, since
+ the latter is only valid in edit mode.
+ */
+class EDITENG_DLLPUBLIC SvxViewForwarder
+{
+public:
+ virtual ~SvxViewForwarder();
+
+ /** Query state of forwarder
+
+ @return sal_False, if no longer valid
+ */
+ virtual sal_Bool IsValid() const = 0;
+
+ /** Query visible area of the view containing the text
+
+ @return the visible rectangle of the text, i.e. the part of
+ the EditEngine or Outliner that is currently on screen. The
+ values are already in screen coordinates (pixel), and have to
+ be relative to the EditEngine/Outliner's upper left corner.
+ */
+ virtual Rectangle GetVisArea() const = 0;
+
+ /** Convert from logical, EditEngine-relative coordinates to screen coordinates
+
+ @param rPoint
+ Point in logical, EditEngine-relative coordinates.
+
+ @param rMapMode
+ The map mode to interpret the coordinates in.
+
+ @return the point in screen coordinates
+ */
+ virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const = 0;
+
+ /** Convert from screen to logical, EditEngine-relative coordinates
+
+ @param rPoint
+ Point in screen coordinates
+
+ @param rMapMode
+ The map mode to interpret the coordinates in.
+
+ @return the point in logical coordinates.
+ */
+ virtual Point PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const = 0;
+
+};
+
+
+/** Encapsulates EditView and OutlinerView for the purpose of unified
+ EditEngine/Outliner access
+ */
+class SvxEditViewForwarder : public SvxViewForwarder
+{
+public:
+
+ /** Query current selection.
+
+ @param rSelection
+ Contains the current selection after method call
+
+ @return sal_False, if there is no view or no selection (the empty selection _is_ a selection)
+
+ */
+ virtual sal_Bool GetSelection( ESelection& rSelection ) const = 0;
+
+ /** Set selection in view.
+
+ @param rSelection
+ The selection to set
+
+ @return sal_False, if there is no view or selection is invalid
+ */
+ virtual sal_Bool SetSelection( const ESelection& rSelection ) = 0;
+
+ /** Copy current selection to clipboard.
+
+ @return sal_False if no selection or no view (the empty selection _is_ a selection)
+ */
+ virtual sal_Bool Copy() = 0;
+
+ /** Cut current selection to clipboard.
+
+ @eturn sal_False if no selection or no view (the empty selection _is_ a selection)
+ */
+ virtual sal_Bool Cut() = 0;
+
+ /** Paste clipboard into current selection.
+
+ @return sal_False if no view or no selection (the empty selection _is_ a selection)
+ */
+ virtual sal_Bool Paste() = 0;
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unofdesc.hxx b/include/editeng/unofdesc.hxx
new file mode 100644
index 000000000000..711affaf2c1e
--- /dev/null
+++ b/include/editeng/unofdesc.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVX_UNOFDESC_HXX
+#define SVX_UNOFDESC_HXX
+
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/beans/PropertyState.hpp>
+#include <svl/itemset.hxx>
+#include <vcl/font.hxx>
+#include "editeng/editengdllapi.h"
+
+class EDITENG_DLLPUBLIC SvxUnoFontDescriptor
+{
+public:
+ static void ConvertToFont( const ::com::sun::star::awt::FontDescriptor& rDesc, Font& rFont );
+ static void ConvertFromFont( const Font& rFont, ::com::sun::star::awt::FontDescriptor& rDesc );
+
+ static void FillItemSet( const ::com::sun::star::awt::FontDescriptor& rDesc, SfxItemSet& rSet );
+ static void FillFromItemSet( const SfxItemSet& rSet, ::com::sun::star::awt::FontDescriptor& rDesc );
+
+ static void setPropertyToDefault( SfxItemSet& rSet );
+ static ::com::sun::star::uno::Any getPropertyDefault( SfxItemPool* pPool );
+
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unofield.hxx b/include/editeng/unofield.hxx
new file mode 100644
index 000000000000..d496e7217efc
--- /dev/null
+++ b/include/editeng/unofield.hxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_UNOFIELD_HXX
+#define _SVX_UNOFIELD_HXX
+
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/text/XTextField.hpp>
+#include <com/sun/star/text/textfield/Type.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/component.hxx>
+#include "editeng/editengdllapi.h"
+
+#include <comphelper/servicehelper.hxx>
+
+#include <editeng/mutxhelp.hxx>
+
+class SvxUnoFieldData_Impl;
+class SfxItemPropertySet;
+class SvxFieldData;
+
+com::sun::star::uno::Reference< com::sun::star::uno::XInterface > EDITENG_DLLPUBLIC SAL_CALL SvxUnoTextCreateTextField(
+ const OUString& ServiceSpecifier ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+class EDITENG_DLLPUBLIC SvxUnoTextField : public SvxMutexHelper,
+ public ::cppu::OComponentHelper,
+ public ::com::sun::star::text::XTextField,
+ public ::com::sun::star::beans::XPropertySet,
+ public ::com::sun::star::lang::XServiceInfo,
+ public ::com::sun::star::lang::XUnoTunnel
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > mxAnchor;
+ const SfxItemPropertySet* mpPropSet;
+ sal_Int32 mnServiceId;
+ SvxUnoFieldData_Impl* mpImpl;
+
+protected:
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > maTypeSequence;
+
+public:
+ SvxUnoTextField( sal_Int32 nServiceId ) throw();
+ SvxUnoTextField( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xAnchor, const OUString& rPresentation, const SvxFieldData* pFieldData ) throw();
+ virtual ~SvxUnoTextField() throw();
+
+ // Internal
+ SvxFieldData* CreateFieldData() const throw();
+ void SetAnchor( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xAnchor ) { mxAnchor = xAnchor; }
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::uno::XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // ::com::sun::star::lang::XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XTextField
+ virtual OUString SAL_CALL getPresentation( sal_Bool bShowCommand ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XTextContent
+ virtual void SAL_CALL attach( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xTextRange ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getAnchor( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XComponent
+ virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing();
+
+ // XServiceInfo
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unofored.hxx b/include/editeng/unofored.hxx
new file mode 100644
index 000000000000..5c88119f3a8f
--- /dev/null
+++ b/include/editeng/unofored.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_UNOFORED_HXX
+#define _SVX_UNOFORED_HXX
+
+#include <editeng/editeng.hxx>
+#include <editeng/unoedsrc.hxx>
+#include "editeng/editengdllapi.h"
+
+// SvxEditEngineForwarder - SvxTextForwarder for EditEngine
+
+class EDITENG_DLLPUBLIC SvxEditEngineForwarder : public SvxTextForwarder
+{
+private:
+ EditEngine& rEditEngine;
+
+public:
+ SvxEditEngineForwarder( EditEngine& rEngine );
+ virtual ~SvxEditEngineForwarder();
+
+ virtual sal_uInt16 GetParagraphCount() const;
+ virtual sal_uInt16 GetTextLen( sal_uInt16 nParagraph ) const;
+ virtual String GetText( const ESelection& rSel ) const;
+ virtual SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = EditEngineAttribs_All ) const;
+ virtual SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const;
+ virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet );
+ virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich );
+ virtual void GetPortions( sal_uInt16 nPara, std::vector<sal_uInt16>& rList ) const;
+
+ virtual sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const;
+ virtual sal_uInt16 GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const;
+
+ virtual void QuickInsertText( const String& rText, const ESelection& rSel );
+ virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel );
+ virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel );
+ virtual void QuickInsertLineBreak( const ESelection& rSel );
+
+ virtual SfxItemPool* GetPool() const;
+
+ virtual XubString CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor );
+ virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos );
+ virtual sal_Bool IsValid() const;
+
+ virtual LanguageType GetLanguage( sal_uInt16, sal_uInt16 ) const;
+ virtual sal_uInt16 GetFieldCount( sal_uInt16 nPara ) const;
+ virtual EFieldInfo GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const;
+ virtual EBulletInfo GetBulletInfo( sal_uInt16 nPara ) const;
+ virtual Rectangle GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const;
+ virtual Rectangle GetParaBounds( sal_uInt16 nPara ) const;
+ virtual MapMode GetMapMode() const;
+ virtual OutputDevice* GetRefDevice() const;
+ virtual sal_Bool GetIndexAtPoint( const Point&, sal_uInt16& nPara, sal_uInt16& nIndex ) const;
+ virtual sal_Bool GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const;
+ virtual sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const;
+ virtual sal_uInt16 GetLineCount( sal_uInt16 nPara ) const;
+ virtual sal_uInt16 GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const;
+ virtual void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const;
+ virtual sal_uInt16 GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const;
+ virtual sal_Bool Delete( const ESelection& );
+ virtual sal_Bool InsertText( const String&, const ESelection& );
+ virtual sal_Bool QuickFormatDoc( sal_Bool bFull=sal_False );
+ virtual sal_Int16 GetDepth( sal_uInt16 nPara ) const;
+ virtual sal_Bool SetDepth( sal_uInt16 nPara, sal_Int16 nNewDepth );
+
+ virtual const SfxItemSet* GetEmptyItemSetPtr();
+
+ // implementation functions for XParagraphAppend and XTextPortionAppend
+ virtual void AppendParagraph();
+ virtual xub_StrLen AppendTextPortion( sal_uInt16 nPara, const String &rText, const SfxItemSet &rSet );
+ //XTextCopy
+ virtual void CopyText(const SvxTextForwarder& rSource);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unoforou.hxx b/include/editeng/unoforou.hxx
new file mode 100644
index 000000000000..68ee89160944
--- /dev/null
+++ b/include/editeng/unoforou.hxx
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_UNOFOROU_HXX
+#define _SVX_UNOFOROU_HXX
+
+#include <editeng/unoedsrc.hxx>
+#include "editeng/editengdllapi.h"
+
+#include <editeng/editdata.hxx>
+
+class Outliner;
+
+// SvxOutlinerForwarder - SvxTextForwarder for Outliner
+
+class EDITENG_DLLPUBLIC SvxOutlinerForwarder : public SvxTextForwarder
+{
+private:
+ Outliner& rOutliner;
+ sal_Bool bOutlinerText;
+
+ /** this pointer may be null or point to an item set for the attribs of
+ the selection maAttribsSelection */
+ mutable SfxItemSet* mpAttribsCache;
+
+ /** if we have a chached attribute item set, this is the selection of it */
+ mutable ESelection maAttribCacheSelection;
+
+ /** this pointer may be null or point to an item set for the paragraph
+ mnParaAttribsCache */
+ mutable SfxItemSet* mpParaAttribsCache;
+
+ /** if we have a cached para attribute item set, this is the paragraph of it */
+ mutable sal_uInt16 mnParaAttribsCache;
+
+public:
+ SvxOutlinerForwarder( Outliner& rOutl, sal_Bool bOutlText = sal_False );
+ virtual ~SvxOutlinerForwarder();
+
+ virtual sal_uInt16 GetParagraphCount() const;
+ virtual sal_uInt16 GetTextLen( sal_uInt16 nParagraph ) const;
+ virtual String GetText( const ESelection& rSel ) const;
+ virtual SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = 0 ) const;
+ virtual SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const;
+ virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet );
+ virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich );
+ virtual void GetPortions( sal_uInt16 nPara, std::vector<sal_uInt16>& rList ) const;
+
+ virtual sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const;
+ virtual sal_uInt16 GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const;
+
+ virtual void QuickInsertText( const String& rText, const ESelection& rSel );
+ virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel );
+ virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel );
+ virtual void QuickInsertLineBreak( const ESelection& rSel );
+
+ virtual SfxItemPool* GetPool() const;
+
+ virtual XubString CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor );
+ virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos );
+
+ virtual sal_Bool IsValid() const;
+
+ Outliner& GetOutliner() const { return rOutliner; }
+
+ virtual LanguageType GetLanguage( sal_uInt16, sal_uInt16 ) const;
+ virtual sal_uInt16 GetFieldCount( sal_uInt16 nPara ) const;
+ virtual EFieldInfo GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const;
+ virtual EBulletInfo GetBulletInfo( sal_uInt16 nPara ) const;
+ virtual Rectangle GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const;
+ virtual Rectangle GetParaBounds( sal_uInt16 nPara ) const;
+ virtual MapMode GetMapMode() const;
+ virtual OutputDevice* GetRefDevice() const;
+ virtual sal_Bool GetIndexAtPoint( const Point&, sal_uInt16& nPara, sal_uInt16& nIndex ) const;
+ virtual sal_Bool GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const;
+ virtual sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const;
+ virtual sal_uInt16 GetLineCount( sal_uInt16 nPara ) const;
+ virtual sal_uInt16 GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const;
+ virtual void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nPara, sal_uInt16 nLine ) const;
+ virtual sal_uInt16 GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const;
+ virtual sal_Bool Delete( const ESelection& );
+ virtual sal_Bool InsertText( const String&, const ESelection& );
+ virtual sal_Bool QuickFormatDoc( sal_Bool bFull=sal_False );
+ virtual sal_Int16 GetDepth( sal_uInt16 nPara ) const;
+ virtual sal_Bool SetDepth( sal_uInt16 nPara, sal_Int16 nNewDepth );
+ virtual sal_Int16 GetNumberingStartValue( sal_uInt16 nPara );
+ virtual void SetNumberingStartValue( sal_uInt16 nPara, sal_Int16 nNumberingStartValue );
+
+ virtual sal_Bool IsParaIsNumberingRestart( sal_uInt16 nPara );
+ virtual void SetParaIsNumberingRestart( sal_uInt16 nPara, sal_Bool bParaIsNumberingRestart );
+
+ /* this method flushes internal caches for this forwarder */
+ void flushCache();
+
+ virtual const SfxItemSet* GetEmptyItemSetPtr();
+
+ // implementation functions for XParagraphAppend and XTextPortionAppend
+ virtual void AppendParagraph();
+ virtual xub_StrLen AppendTextPortion( sal_uInt16 nPara, const String &rText, const SfxItemSet &rSet );
+ //XTextCopy
+ virtual void CopyText(const SvxTextForwarder& rSource);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unoipset.hxx b/include/editeng/unoipset.hxx
new file mode 100644
index 000000000000..584eb367f5a1
--- /dev/null
+++ b/include/editeng/unoipset.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_UNOIPSET_HXX_
+#define _SVX_UNOIPSET_HXX_
+
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include "editeng/editengdllapi.h"
+#include <svl/itemprop.hxx>
+#include <vector>
+
+class SdrItemPool;
+class SfxItemSet;
+class SvxShape;
+struct SvxIDPropertyCombine;
+
+#define SFX_METRIC_ITEM (0x40)
+
+class EDITENG_DLLPUBLIC SvxItemPropertySet
+{
+ SfxItemPropertyMap m_aPropertyMap;
+ mutable com::sun::star::uno::Reference<com::sun::star::beans::XPropertySetInfo> m_xInfo;
+ const SfxItemPropertyMapEntry* _pMap;
+ ::std::vector< SvxIDPropertyCombine* > aCombineList;
+ sal_Bool mbConvertTwips;
+ SfxItemPool& mrItemPool;
+
+public:
+ SvxItemPropertySet( const SfxItemPropertyMapEntry *pMap, SfxItemPool& rPool, sal_Bool bConvertTwips = sal_False );
+ ~SvxItemPropertySet();
+
+ // Methods, which work directly with the ItemSet
+ ::com::sun::star::uno::Any getPropertyValue( const SfxItemPropertySimpleEntry* pMap, const SfxItemSet& rSet, bool bSearchInParent, bool bDontConvertNegativeValues ) const;
+ void setPropertyValue( const SfxItemPropertySimpleEntry* pMap, const ::com::sun::star::uno::Any& rVal, SfxItemSet& rSet, bool bDontConvertNegativeValues ) const;
+
+ // Methods that use Any instead
+ ::com::sun::star::uno::Any getPropertyValue( const SfxItemPropertySimpleEntry* pMap ) const;
+ void setPropertyValue( const SfxItemPropertySimpleEntry* pMap, const ::com::sun::star::uno::Any& rVal ) const;
+
+ sal_Bool AreThereOwnUsrAnys() const { return ( aCombineList.empty() ? sal_False : sal_True ); }
+ ::com::sun::star::uno::Any* GetUsrAnyForID(sal_uInt16 nWID) const;
+ void AddUsrAnyForID(const ::com::sun::star::uno::Any& rAny, sal_uInt16 nWID);
+ void ClearAllUsrAny();
+
+ com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > getPropertySetInfo() const;
+ const SfxItemPropertyMapEntry* getPropertyMapEntries() const {return _pMap;}
+ const SfxItemPropertyMap* getPropertyMap()const { return &m_aPropertyMap;}
+ const SfxItemPropertySimpleEntry* getPropertyMapEntry(const OUString &rName) const;
+
+ static com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > getPropertySetInfo( const SfxItemPropertyMapEntry* pMap );
+};
+
+/** converts the given any with a metric to 100th/mm if needed */
+EDITENG_DLLPUBLIC void SvxUnoConvertToMM( const SfxMapUnit eSourceMapUnit, com::sun::star::uno::Any & rMetric ) throw();
+
+/** converts the given any with a metric from 100th/mm to the given metric if needed */
+EDITENG_DLLPUBLIC void SvxUnoConvertFromMM( const SfxMapUnit eDestinationMapUnit, com::sun::star::uno::Any & rMetric ) throw();
+
+#endif // _SVX_UNOIPSET_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unolingu.hxx b/include/editeng/unolingu.hxx
new file mode 100644
index 000000000000..09f570228f95
--- /dev/null
+++ b/include/editeng/unolingu.hxx
@@ -0,0 +1,192 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _UNO_LINGU_HXX
+#define _UNO_LINGU_HXX
+
+#include <i18nlangtag/lang.h>
+#include <tools/string.hxx>
+#include <com/sun/star/util/Language.hpp>
+#include <com/sun/star/linguistic2/XLinguServiceManager2.hpp>
+#include <com/sun/star/linguistic2/XSpellChecker1.hpp>
+#include <com/sun/star/linguistic2/XHyphenator.hpp>
+#include <com/sun/star/linguistic2/XThesaurus.hpp>
+#include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include "editeng/editengdllapi.h"
+
+class LinguMgrExitLstnr;
+
+class Window;
+
+///////////////////////////////////////////////////////////////////////////
+
+class EDITENG_DLLPUBLIC LinguMgr
+{
+ friend class LinguMgrExitLstnr;
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XLinguServiceManager2 > xLngSvcMgr;
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 > xSpell;
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenator > xHyph;
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XThesaurus > xThes;
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSearchableDictionaryList > xDicList;
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > xProp;
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XDictionary > xIgnoreAll;
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XDictionary > xChangeAll;
+
+ static LinguMgrExitLstnr *pExitLstnr;
+ static sal_Bool bExiting;
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 > GetSpell();
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenator > GetHyph();
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XThesaurus > GetThes();
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSearchableDictionaryList > GetDicList();
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > GetProp();
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XDictionary > GetStandard();
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XDictionary > GetIgnoreAll();
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XDictionary > GetChangeAll();
+
+ // disallow access to copy-constructor and assignment-operator
+ LinguMgr(const LinguMgr &);
+ LinguMgr & operator = (const LinguMgr &);
+
+public:
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 > GetSpellChecker();
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenator > GetHyphenator();
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XThesaurus > GetThesaurus();
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSearchableDictionaryList > GetDictionaryList();
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > GetLinguPropertySet();
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XLinguServiceManager2 > GetLngSvcMgr();
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XDictionary > GetStandardDic();
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XDictionary > GetIgnoreAllList();
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XDictionary > GetChangeAllList();
+};
+
+///////////////////////////////////////////////////////////////////////////
+
+namespace com { namespace sun { namespace star { namespace linguistic2 {
+ class XHyphenatedWord;
+}}}}
+
+
+struct SvxAlternativeSpelling
+{
+ String aReplacement;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenatedWord > xHyphWord;
+ sal_Int16 nChangedPos,
+ nChangedLength;
+ sal_Bool bIsAltSpelling;
+
+ inline SvxAlternativeSpelling();
+};
+
+inline SvxAlternativeSpelling::SvxAlternativeSpelling() :
+ nChangedPos(-1), nChangedLength(-1), bIsAltSpelling(sal_False)
+{
+}
+
+
+EDITENG_DLLPUBLIC SvxAlternativeSpelling SvxGetAltSpelling(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenatedWord > & rHyphWord );
+
+
+///////////////////////////////////////////////////////////////////////////
+
+class EDITENG_DLLPUBLIC SvxDicListChgClamp
+{
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSearchableDictionaryList > xDicList;
+
+ // disallow access to copy-constructor and assignment-operator
+ EDITENG_DLLPRIVATE SvxDicListChgClamp(const SvxDicListChgClamp &);
+ EDITENG_DLLPRIVATE SvxDicListChgClamp & operator = (const SvxDicListChgClamp &);
+
+public:
+ SvxDicListChgClamp( ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSearchableDictionaryList > &rxDicList );
+ ~SvxDicListChgClamp();
+};
+
+///////////////////////////////////////////////////////////////////////////
+
+//TODO: remove those functions or make them inline
+EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 > SvxGetSpellChecker();
+EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenator > SvxGetHyphenator();
+EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XThesaurus > SvxGetThesaurus();
+EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSearchableDictionaryList > SvxGetDictionaryList();
+EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SvxGetLinguPropertySet();
+//TODO: remove argument or provide SvxGetIgnoreAllList with the same one
+EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XDictionary > SvxGetOrCreatePosDic(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSearchableDictionaryList > xDicList );
+EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XDictionary > SvxGetIgnoreAllList();
+EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XDictionary > SvxGetChangeAllList();
+
+///////////////////////////////////////////////////////////////////////////
+// misc functions
+//
+
+EDITENG_DLLPUBLIC short SvxDicError( Window *pParent, sal_Int16 nError );
+
+
+#endif
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unonames.hxx b/include/editeng/unonames.hxx
new file mode 100644
index 000000000000..3a5984452773
--- /dev/null
+++ b/include/editeng/unonames.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+// Common across fields
+#define UNO_TC_PROP_ANCHOR "Anchor"
+#define UNO_TC_PROP_TEXTFIELD_TYPE "TextFieldType"
+#define UNO_TC_PROP_IS_FIXED "IsFixed"
+#define UNO_TC_PROP_CURRENT_PRESENTATION "CurrentPresentation"
+
+// Date & Time
+#define UNO_TC_PROP_IS_DATE "IsDate"
+#define UNO_TC_PROP_DATE_TIME "DateTime"
+#define UNO_TC_PROP_NUMFORMAT "NumberFormat"
+
+// URL
+#define UNO_TC_PROP_URL_FORMAT "Format"
+#define UNO_TC_PROP_URL_REPRESENTATION "Representation"
+#define UNO_TC_PROP_URL_TARGET "TargetFrame"
+#define UNO_TC_PROP_URL "URL"
+
+// Table
+#define UNO_TC_PROP_TABLE_POSITION "TablePosition"
+
+// File
+#define UNO_TC_PROP_FILE_FORMAT "FileFormat"
+
+// Author
+#define UNO_TC_PROP_AUTHOR_CONTENT "Content"
+#define UNO_TC_PROP_AUTHOR_FORMAT "AuthorFormat"
+#define UNO_TC_PROP_AUTHOR_FULLNAME "FullName"
+
+// Measure
+#define UNO_TC_PROP_MEASURE_KIND "Kind"
+
+#define UNO_TR_PROP_SELECTION "Selection"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unonrule.hxx b/include/editeng/unonrule.hxx
new file mode 100644
index 000000000000..985e3e9193bb
--- /dev/null
+++ b/include/editeng/unonrule.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_UNONRULE_HXX
+#define _SVX_UNONRULE_HXX
+
+#include <com/sun/star/container/XIndexReplace.hpp>
+#include <com/sun/star/ucb/XAnyCompare.hpp>
+#include "editeng/editengdllapi.h"
+#include <cppuhelper/implbase5.hxx>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <editeng/numitem.hxx>
+#include <comphelper/servicehelper.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace > SvxCreateNumRule( const SvxNumRule* pRule ) throw();
+EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace > SvxCreateNumRule() throw();
+const SvxNumRule& SvxGetNumRule( ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace > xRule ) throw( ::com::sun::star::lang::IllegalArgumentException );
+EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XAnyCompare > SvxCreateNumRuleCompare() throw();
+
+class SvxUnoNumberingRules : public ::cppu::WeakAggImplHelper5< com::sun::star::container::XIndexReplace, com::sun::star::ucb::XAnyCompare,
+ com::sun::star::lang::XUnoTunnel, com::sun::star::util::XCloneable, com::sun::star::lang::XServiceInfo >
+{
+private:
+ SvxNumRule maRule;
+public:
+ SvxUnoNumberingRules( const SvxNumRule& rRule ) throw();
+ virtual ~SvxUnoNumberingRules() throw();
+
+ UNO3_GETIMPLEMENTATION_DECL( SvxUnoNumberingRules )
+
+ //XIndexReplace
+ virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const com::sun::star::uno::Any& Element ) throw(
+ com::sun::star::lang::IllegalArgumentException, com::sun::star::lang::IndexOutOfBoundsException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException);
+
+ //XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount() throw(com::sun::star::uno::RuntimeException) ;
+ virtual com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(com::sun::star::lang::IndexOutOfBoundsException,
+ com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException);
+
+ //XElementAccess
+ virtual com::sun::star::uno::Type SAL_CALL getElementType() throw(com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements() throw(com::sun::star::uno::RuntimeException);
+
+ // XAnyCompare
+ virtual sal_Int16 SAL_CALL compare( const com::sun::star::uno::Any& Any1, const com::sun::star::uno::Any& Any2 ) throw(com::sun::star::uno::RuntimeException);
+
+ // XCloneable
+ virtual com::sun::star::uno::Reference< com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) throw(com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(com::sun::star::uno::RuntimeException);
+ virtual com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(com::sun::star::uno::RuntimeException);
+
+ // internal
+ com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> getNumberingRuleByIndex( sal_Int32 nIndex) const throw();
+ void setNumberingRuleByIndex( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rProperties, sal_Int32 nIndex) throw( com::sun::star::uno::RuntimeException, com::sun::star::lang::IllegalArgumentException );
+
+ static sal_Int16 Compare( const com::sun::star::uno::Any& rAny1, const com::sun::star::uno::Any& rAny2 );
+
+ const SvxNumRule& getNumRule() const { return maRule; }
+};
+
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unopracc.hxx b/include/editeng/unopracc.hxx
new file mode 100644
index 000000000000..c2d3fdc746f3
--- /dev/null
+++ b/include/editeng/unopracc.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_UNOPRACC_HXX
+#define _SVX_UNOPRACC_HXX
+
+#include <editeng/unotext.hxx>
+
+
+class SvxEditSource;
+
+/** Wraps SvxUnoTextRangeBase and provides us with the text properties
+
+ Inherits from SvxUnoTextRangeBase and provides XPropertySet and
+ XMultiPropertySet interfaces. Just set the selection to the
+ required text range and return a reference to a XPropertySet.
+ */
+class SvxAccessibleTextPropertySet : public SvxUnoTextRangeBase,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::cppu::OWeakObject
+{
+public:
+ SvxAccessibleTextPropertySet( const SvxEditSource*, const SvxItemPropertySet* );
+ virtual ~SvxAccessibleTextPropertySet() throw();
+
+ // XTextRange
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException);
+
+ // uno::XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // lang::XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+ // lang::XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceName
+ OUString SAL_CALL getServiceName() throw (::com::sun::star::uno::RuntimeException);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unoprnms.hxx b/include/editeng/unoprnms.hxx
new file mode 100644
index 000000000000..38ba3bdb4961
--- /dev/null
+++ b/include/editeng/unoprnms.hxx
@@ -0,0 +1,372 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_UNOPRNMS_HXX
+#define _SVX_UNOPRNMS_HXX
+
+#define UNO_NAME_SHAPE_SIZE "Size"
+#define UNO_NAME_SHAPE_POSITION "Position"
+
+#define UNO_NAME_CHAR_COLOR "CharColor"
+#define UNO_NAME_CHAR_FONT "CharFont"
+#define UNO_NAME_CHAR_HEIGHT "CharHeight"
+#define UNO_NAME_CHAR_POSTURE "CharPosture"
+#define UNO_NAME_CHAR_SHADOWED "CharShadowed"
+#define UNO_NAME_CHAR_UNDERLINE "CharUnderline"
+#define UNO_NAME_CHAR_WEIGHT "CharWeight"
+
+#define UNO_NAME_FILLSTYLE "FillStyle"
+#define UNO_NAME_FILLCOLOR "FillColor"
+#define UNO_NAME_FILLGRADIENT "FillGradient"
+#define UNO_NAME_FILLHATCH "FillHatch"
+#define UNO_NAME_FILLBITMAP "FillBitmap"
+#define UNO_NAME_FILLBACKGROUND "FillBackground"
+#define UNO_NAME_FILLCOLOR_2 "FillColor2"
+
+#define UNO_NAME_EDGEKIND "EdgeKind"
+#define UNO_NAME_EDGELINE1DELTA "EdgeLine1Delta"
+#define UNO_NAME_EDGELINE2DELTA "EdgeLine2Delta"
+#define UNO_NAME_EDGELINE3DELTA "EdgeLine3Delta"
+#define UNO_NAME_EDGENODE1HORZDIST "EdgeNode1HorzDist"
+#define UNO_NAME_EDGENODE1VERTDIST "EdgeNode1VertDist"
+#define UNO_NAME_EDGENODE2HORZDIST "EdgeNode2HorzDist"
+#define UNO_NAME_EDGENODE2VERTDIST "EdgeNode2VertDist"
+
+#define UNO_NAME_FILLBMP_OFFSET_X "FillBitmapOffsetX"
+#define UNO_NAME_FILLBMP_OFFSET_Y "FillBitmapOffsetY"
+#define UNO_NAME_FILLBMP_POSITION_OFFSET_X "FillBitmapPositionOffsetX"
+#define UNO_NAME_FILLBMP_POSITION_OFFSET_Y "FillBitmapPositionOffsetY"
+#define UNO_NAME_FILLBMP_RECTANGLE_POINT "FillBitmapRectanglePoint"
+#define UNO_NAME_FILLBMP_TILE "FillBitmapTile"
+#define UNO_NAME_FILLBMP_STRETCH "FillBitmapStretch"
+#define UNO_NAME_FILLBMP_LOGICAL_SIZE "FillBitmapLogicalSize"
+#define UNO_NAME_FILLBMP_SIZE_X "FillBitmapSizeX"
+#define UNO_NAME_FILLBMP_SIZE_Y "FillBitmapSizeY"
+#define UNO_NAME_FILL_TRANSPARENCE "FillTransparence"
+#define UNO_NAME_FILLBMP_MODE "FillBitmapMode"
+
+#define UNO_NAME_FILL_GRADIENT_STYLE "FillGradientStyle"
+#define UNO_NAME_FILL_GRADIENT_START_COLOR "FillGradientStartColor"
+#define UNO_NAME_FILL_GRADIENT_END_COLOR "FillGradientEndColor"
+#define UNO_NAME_FILL_GRADIENT_ANGLE "FillGradientAngle"
+#define UNO_NAME_FILL_GRADIENT_BORDER "FillGradientBorder"
+#define UNO_NAME_FILL_GRADIENT_OFFSET_X "FillGradientOffsetX"
+#define UNO_NAME_FILL_GRADIENT_OFFSET_Y "FillGradientOffsetY"
+#define UNO_NAME_FILL_GRADIENT_START_INTENSITY "FillGradientStartIntensity"
+#define UNO_NAME_FILL_GRADIENT_END_INTENSITY "FillGradientEndIntensity"
+#define UNO_NAME_FILL_GRADIENT_STEPS "FillGradientSteps"
+
+#define UNO_NAME_FILL_HATCH_STYLE "FillHatchStyle"
+#define UNO_NAME_FILL_HATCH_COLOR "FillHatchColor"
+#define UNO_NAME_FILL_HATCH_DISTANCE "FillHatchDistance"
+#define UNO_NAME_FILL_HATCH_ANGLE "FillHatchAngle"
+
+#define UNO_NAME_LINESTYLE "LineStyle"
+#define UNO_NAME_LINEDASH "LineDash"
+#define UNO_NAME_LINEWIDTH "LineWidth"
+#define UNO_NAME_LINECOLOR "LineColor"
+#define UNO_NAME_LINEJOINT "LineJoint"
+#define UNO_NAME_LINESTART "LineStart"
+#define UNO_NAME_LINEEND "LineEnd"
+#define UNO_NAME_LINESTARTWIDTH "LineStartWidth"
+#define UNO_NAME_LINEENDWIDTH "LineEndWidth"
+#define UNO_NAME_LINESTARTCENTER "LineStartCenter"
+#define UNO_NAME_LINEENDCENTER "LineEndCenter"
+#define UNO_NAME_LINETRANSPARENCE "LineTransparence"
+#define UNO_NAME_LINECAP "LineCap"
+
+#define UNO_NAME_SHADOW "Shadow"
+#define UNO_NAME_SHADOWCOLOR "ShadowColor"
+#define UNO_NAME_SHADOWXDIST "ShadowXDistance"
+#define UNO_NAME_SHADOWYDIST "ShadowYDistance"
+#define UNO_NAME_SHADOWTRANSPARENCE "ShadowTransparence"
+
+#define UNO_NAME_EDGERADIUS "CornerRadius"
+
+#define UNO_NAME_TEXT_MINFRAMEHEIGHT "TextMinimumFrameHeight"
+#define UNO_NAME_TEXT_AUTOGROWHEIGHT "TextAutoGrowHeight"
+#define UNO_NAME_TEXT_FITTOSIZE "TextFitToSize"
+#define UNO_NAME_TEXT_LEFTDIST "TextLeftDistance"
+#define UNO_NAME_TEXT_RIGHTDIST "TextRightDistance"
+#define UNO_NAME_TEXT_UPPERDIST "TextUpperDistance"
+#define UNO_NAME_TEXT_LOWERDIST "TextLowerDistance"
+#define UNO_NAME_TEXT_VERTADJUST "TextVerticalAdjust"
+#define UNO_NAME_TEXT_MAXFRAMEHEIGHT "TextMaximumFrameHeight"
+#define UNO_NAME_TEXT_MINFRAMEWIDTH "TextMinimumFrameWidth"
+#define UNO_NAME_TEXT_MAXFRAMEWIDTH "TextMaximumFrameWidth"
+#define UNO_NAME_TEXT_AUTOGROWWIDTH "TextAutoGrowWidth"
+#define UNO_NAME_TEXT_HORZADJUST "TextHorizontalAdjust"
+#define UNO_NAME_TEXT_ANIKIND "TextAnimationKind"
+#define UNO_NAME_TEXT_ANIDIRECTION "TextAnimationDirection"
+#define UNO_NAME_TEXT_ANISTARTINSIDE "TextAnimationStartInside"
+#define UNO_NAME_TEXT_ANISTOPINSIDE "TextAnimationStopInside"
+#define UNO_NAME_TEXT_ANICOUNT "TextAnimationCount"
+#define UNO_NAME_TEXT_ANIDELAY "TextAnimationDelay"
+#define UNO_NAME_TEXT_ANIAMOUNT "TextAnimationAmount"
+#define UNO_NAME_TEXT_CONTOURFRAME "TextContourFrame"
+#define UNO_NAME_TEXT_WRITINGMODE "TextWritingMode"
+#define UNO_NAME_TEXT_FONTINDEPENDENTLINESPACING "FontIndependentLineSpacing"
+#define UNO_NAME_TEXT_WORDWRAP "TextWordWrap"
+
+#define UNO_NAME_MEASUREKIND "MeasureKind"
+#define UNO_NAME_MEASURETEXTHPOS "MeasureTextHorizontalPosition"
+#define UNO_NAME_MEASURETEXTVPOS "MeasureTextVerticalPosition"
+#define UNO_NAME_MEASURELINEDIST "MeasureLineDistance"
+#define UNO_NAME_MEASUREHELPLINEOVERHANG "MeasureHelpLineOverhang"
+#define UNO_NAME_MEASUREHELPLINEDIST "MeasureHelpLineDistance"
+#define UNO_NAME_MEASUREHELPLINE1LEN "MeasureHelpLine1Length"
+#define UNO_NAME_MEASUREHELPLINE2LEN "MeasureHelpLine2Length"
+#define UNO_NAME_MEASUREBELOWREFEDGE "MeasureBelowReferenceEdge"
+#define UNO_NAME_MEASURETEXTROTA90 "MeasureTextRotate90"
+#define UNO_NAME_MEASURETEXTUPSIDEDOWN "MeasureTextUpsideDown"
+#define UNO_NAME_MEASUREOVERHANG "MeasureOverhang"
+#define UNO_NAME_MEASUREUNIT "MeasureUnit"
+#define UNO_NAME_MEASURESCALE "MeasureScale"
+#define UNO_NAME_MEASURESHOWUNIT "MeasureShowUnit"
+#define UNO_NAME_MEASUREFORMATSTRING "MeasureFormatString"
+#define UNO_NAME_MEASURETEXTAUTOANGLE "MeasureTextAutoAngle"
+#define UNO_NAME_MEASURETEXTAUTOANGLEVIEW "MeasureTextAutoAngleView"
+#define UNO_NAME_MEASURETEXTISFIXEDANGLE "MeasureTextIsFixedAngle"
+#define UNO_NAME_MEASURETEXTFIXEDANGLE "MeasureTextFixedAngle"
+
+#define UNO_NAME_CIRCKIND "CircleKind"
+#define UNO_NAME_CIRCSTARTANGLE "CircleStartAngle"
+#define UNO_NAME_CIRCENDANGLE "CircleEndAngle"
+
+#define UNO_NAME_POLYGONKIND "PolygonKind"
+#define UNO_NAME_POLYPOLYGON "PolyPolygon"
+#define UNO_NAME_POLYPOLYGONBEZIER "PolyPolygonBezier"
+#define UNO_NAME_POLYGON "Polygon"
+
+#define UNO_NAME_MISC_OBJ_ZORDER "ZOrder"
+#define UNO_NAME_MISC_OBJ_MOVEPROTECT "MoveProtect"
+#define UNO_NAME_MISC_OBJ_SIZEPROTECT "SizeProtect"
+#define UNO_NAME_MISC_OBJ_PRINTABLE "Printable"
+#define UNO_NAME_MISC_OBJ_LAYERID "LayerID"
+#define UNO_NAME_MISC_OBJ_LAYERNAME "LayerName"
+#define UNO_NAME_MISC_OBJ_NAME "Name"
+#define UNO_NAME_MISC_OBJ_ROTATEANGLE "RotateAngle"
+#define UNO_NAME_MISC_OBJ_SHEARANGLE "ShearAngle"
+#define UNO_NAME_MISC_OBJ_ROTATION_POINT_X "RotationPointX"
+#define UNO_NAME_MISC_OBJ_ROTATION_POINT_Y "RotationPointY"
+#define UNO_NAME_MISC_OBJ_FRAMERECT "FrameRect"
+#define UNO_NAME_MISC_OBJ_BOUNDRECT "BoundRect"
+
+// #i68101#
+#define UNO_NAME_MISC_OBJ_TITLE "Title"
+#define UNO_NAME_MISC_OBJ_DESCRIPTION "Description"
+
+#define UNO_NAME_GRAPHOBJ_FILLBITMAP "GraphicObjectFillBitmap"
+#define UNO_NAME_GRAPHOBJ_GRAFURL "GraphicURL"
+#define UNO_NAME_GRAPHOBJ_REPLACEMENTGRAFURL "ReplacementGraphicURL"
+#define UNO_NAME_GRAPHOBJ_GRAFSTREAMURL "GraphicStreamURL"
+#define UNO_NAME_GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:"
+#define UNO_NAME_GRAPHOBJ_URLPKGPREFIX "vnd.sun.star.Package:"
+#define UNO_NAME_GRAPHOBJ_GRAPHIC "Graphic"
+
+#define UNO_NAME_OLE2_METAFILE "MetaFile"
+#define UNO_NAME_OLE2_PERSISTNAME "PersistName"
+
+#define UNO_NAME_3D_SCENE_PERSPECTIVE "D3DScenePerspective"
+#define UNO_NAME_3D_SCENE_DISTANCE "D3DSceneDistance"
+#define UNO_NAME_3D_SCENE_FOCAL_LENGTH "D3DSceneFocalLength"
+#define UNO_NAME_3D_SCENE_TWO_SIDED_LIGHTING "D3DSceneTwoSidedLighting"
+#define UNO_NAME_3D_SCENE_LIGHTCOLOR_1 "D3DSceneLightColor1"
+#define UNO_NAME_3D_SCENE_LIGHTCOLOR_2 "D3DSceneLightColor2"
+#define UNO_NAME_3D_SCENE_LIGHTCOLOR_3 "D3DSceneLightColor3"
+#define UNO_NAME_3D_SCENE_LIGHTCOLOR_4 "D3DSceneLightColor4"
+#define UNO_NAME_3D_SCENE_LIGHTCOLOR_5 "D3DSceneLightColor5"
+#define UNO_NAME_3D_SCENE_LIGHTCOLOR_6 "D3DSceneLightColor6"
+#define UNO_NAME_3D_SCENE_LIGHTCOLOR_7 "D3DSceneLightColor7"
+#define UNO_NAME_3D_SCENE_LIGHTCOLOR_8 "D3DSceneLightColor8"
+#define UNO_NAME_3D_SCENE_LIGHTON_1 "D3DSceneLightOn1"
+#define UNO_NAME_3D_SCENE_LIGHTON_2 "D3DSceneLightOn2"
+#define UNO_NAME_3D_SCENE_LIGHTON_3 "D3DSceneLightOn3"
+#define UNO_NAME_3D_SCENE_LIGHTON_4 "D3DSceneLightOn4"
+#define UNO_NAME_3D_SCENE_LIGHTON_5 "D3DSceneLightOn5"
+#define UNO_NAME_3D_SCENE_LIGHTON_6 "D3DSceneLightOn6"
+#define UNO_NAME_3D_SCENE_LIGHTON_7 "D3DSceneLightOn7"
+#define UNO_NAME_3D_SCENE_LIGHTON_8 "D3DSceneLightOn8"
+#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_1 "D3DSceneLightDirection1"
+#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_2 "D3DSceneLightDirection2"
+#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_3 "D3DSceneLightDirection3"
+#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_4 "D3DSceneLightDirection4"
+#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_5 "D3DSceneLightDirection5"
+#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_6 "D3DSceneLightDirection6"
+#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_7 "D3DSceneLightDirection7"
+#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_8 "D3DSceneLightDirection8"
+#define UNO_NAME_3D_SCENE_AMBIENTCOLOR "D3DSceneAmbientColor"
+#define UNO_NAME_3D_SCENE_SHADOW_SLANT "D3DSceneShadowSlant"
+#define UNO_NAME_3D_SCENE_SHADE_MODE "D3DSceneShadeMode"
+
+#define UNO_NAME_3D_DOUBLE_SIDED "D3DDoubleSided"
+#define UNO_NAME_3D_NORMALS_KIND "D3DNormalsKind"
+#define UNO_NAME_3D_NORMALS_INVERT "D3DNormalsInvert"
+#define UNO_NAME_3D_TEXTURE_PROJ_X "D3DTextureProjectionX"
+#define UNO_NAME_3D_TEXTURE_PROJ_Y "D3DTextureProjectionY"
+#define UNO_NAME_3D_SHADOW_3D "D3DShadow3D"
+#define UNO_NAME_3D_MAT_COLOR "D3DMaterialColor"
+#define UNO_NAME_3D_MAT_EMISSION "D3DMaterialEmission"
+#define UNO_NAME_3D_MAT_SPECULAR "D3DMaterialSpecular"
+#define UNO_NAME_3D_MAT_SPECULAR_INTENSITY "D3DMaterialSpecularIntensity"
+#define UNO_NAME_3D_TEXTURE_KIND "D3DTextureKind"
+#define UNO_NAME_3D_TEXTURE_MODE "D3DTextureMode"
+#define UNO_NAME_3D_TEXTURE_FILTER "D3DTextureFilter"
+
+// #i28528#
+// Added extra Item (Bool) for chart2 to be able to show reduced line geometry
+#define UNO_NAME_3D_REDUCED_LINE_GEOMETRY "D3DReducedLineGeometry"
+
+#define UNO_NAME_3D_HORZ_SEGS "D3DHorizontalSegments"
+#define UNO_NAME_3D_VERT_SEGS "D3DVerticalSegments"
+
+#define UNO_NAME_3D_PERCENT_DIAGONAL "D3DPercentDiagonal"
+#define UNO_NAME_3D_BACKSCALE "D3DBackscale"
+#define UNO_NAME_3D_LATHE_END_ANGLE "D3DEndAngle"
+
+#define UNO_NAME_3D_EXTRUDE_DEPTH "D3DDepth"
+
+#define UNO_NAME_3D_TRANSFORM_MATRIX "D3DTransformMatrix"
+#define UNO_NAME_3D_CAMERA_GEOMETRY "D3DCameraGeometry"
+#define UNO_NAME_3D_POS "D3DPosition"
+#define UNO_NAME_3D_SIZE "D3DSize"
+#define UNO_NAME_3D_POS_IS_CENTER "D3DPositionIsCenter"
+#define UNO_NAME_3D_POLYPOLYGON3D "D3DPolyPolygon3D"
+#define UNO_NAME_3D_NORMALSPOLYGON3D "D3DNormalsPolygon3D"
+#define UNO_NAME_3D_TEXTUREPOLYGON3D "D3DTexturePolygon3D"
+#define UNO_NAME_3D_LINEONLY "D3DLineOnly"
+
+// New 3D properties which are possible for lathe and extrude 3d objects
+#define UNO_NAME_3D_SMOOTH_NORMALS "D3DSmoothNormals"
+#define UNO_NAME_3D_SMOOTH_LIDS "D3DSmoothLids"
+#define UNO_NAME_3D_CHARACTER_MODE "D3DCharacterMode"
+#define UNO_NAME_3D_CLOSE_FRONT "D3DCloseFront"
+#define UNO_NAME_3D_CLOSE_BACK "D3DCloseBack"
+
+#define UNO_NAME_NUMBERING "NumberingIsNumber"
+#define UNO_NAME_NUMBERING_RULES "NumberingRules"
+#define UNO_NAME_NUMBERING_LEVEL "NumberingLevel"
+
+#define UNO_NAME_NRULE_NUMBERINGTYPE "NumberingType"
+#define UNO_NAME_NRULE_PREFIX "Prefix"
+#define UNO_NAME_NRULE_SUFFIX "Suffix"
+#define UNO_NAME_NRULE_BULLETID "BulletId"
+#define UNO_NAME_NRULE_BULLET_COLOR "BulletColor"
+#define UNO_NAME_NRULE_BULLET_RELSIZE "BulletRelSize"
+#define UNO_NAME_NRULE_BULLET_FONT "BulletFont"
+#define UNO_NAME_NRULE_GRAPHICURL "GraphicURL"
+#define UNO_NAME_NRULE_START_WITH "StartWith"
+#define UNO_NAME_NRULE_LEFT_MARGIN "LeftMargin"
+#define UNO_NAME_NRULE_FIRST_LINE_OFFSET "FirstLineOffset"
+#define UNO_NAME_NRULE_ADJUST "Adjust"
+
+#define UNO_NAME_EDIT_FONT_DESCRIPTOR "FontDescriptor"
+#define UNO_NAME_EDIT_FONT_STYLENAME "FontStyleName"
+
+#define UNO_NAME_EDIT_PARA_ADJUST "ParaAdjust"
+#define UNO_NAME_EDIT_PARA_BMARGIN "ParaBottomMargin"
+#define UNO_NAME_EDIT_PARA_LASTLINEADJ "ParaLastLineAdjust"
+#define UNO_NAME_EDIT_PARA_LMARGIN "ParaLeftMargin"
+#define UNO_NAME_EDIT_PARA_LRPARAMARGIN "ParaLeftRightParaMargin"
+#define UNO_NAME_EDIT_PARA_LINESPACING "ParaLineSpacing"
+#define UNO_NAME_EDIT_PARA_RMARGIN "ParaRightMargin"
+#define UNO_NAME_EDIT_PARA_TAPSTOPS "ParaTabStops"
+#define UNO_NAME_EDIT_PARA_TBMARGIN "ParaTopBottomMargin"
+#define UNO_NAME_EDIT_PARA_TMARGIN "ParaTopMargin"
+#define UNO_NAME_EDIT_PARA_IS_HYPHEN "ParaIsHyphenation"
+#define UNO_NAME_EDIT_PARA_IS_HANGING_PUNCTUATION "ParaIsHangingPunctuation"
+#define UNO_NAME_EDIT_PARA_IS_CHARACTER_DISTANCE "ParaIsCharacterDistance"
+#define UNO_NAME_EDIT_PARA_IS_FORBIDDEN_RULES "ParaIsForbiddenRules"
+#define UNO_NAME_EDIT_PARA_FIRST_LINE_INDENT "ParaFirstLineIndent"
+
+#define UNO_NAME_EDIT_CHAR_HEIGHT "CharHeight"
+#define UNO_NAME_EDIT_CHAR_FONTNAME "CharFontName"
+#define UNO_NAME_EDIT_CHAR_FONTSTYLENAME "CharFontStyleName"
+#define UNO_NAME_EDIT_CHAR_FONTFAMILY "CharFontFamily"
+#define UNO_NAME_EDIT_CHAR_FONTCHARSET "CharFontCharSet"
+#define UNO_NAME_EDIT_CHAR_FONTPITCH "CharFontPitch"
+#define UNO_NAME_EDIT_CHAR_POSTURE "CharPosture"
+#define UNO_NAME_EDIT_CHAR_WEIGHT "CharWeight"
+#define UNO_NAME_EDIT_CHAR_LOCALE "CharLocale"
+
+#define UNO_NAME_EDIT_CHAR_HEIGHT_ASIAN "CharHeightAsian"
+#define UNO_NAME_EDIT_CHAR_FONTNAME_ASIAN "CharFontNameAsian"
+#define UNO_NAME_EDIT_CHAR_FONTSTYLENAME_ASIAN "CharFontStyleNameAsian"
+#define UNO_NAME_EDIT_CHAR_FONTFAMILY_ASIAN "CharFontFamilyAsian"
+#define UNO_NAME_EDIT_CHAR_FONTCHARSET_ASIAN "CharFontCharSetAsian"
+#define UNO_NAME_EDIT_CHAR_FONTPITCH_ASIAN "CharFontPitchAsian"
+#define UNO_NAME_EDIT_CHAR_POSTURE_ASIAN "CharPostureAsian"
+#define UNO_NAME_EDIT_CHAR_WEIGHT_ASIAN "CharWeightAsian"
+#define UNO_NAME_EDIT_CHAR_LOCALE_ASIAN "CharLocaleAsian"
+
+#define UNO_NAME_EDIT_CHAR_HEIGHT_COMPLEX "CharHeightComplex"
+#define UNO_NAME_EDIT_CHAR_FONTNAME_COMPLEX "CharFontNameComplex"
+#define UNO_NAME_EDIT_CHAR_FONTSTYLENAME_COMPLEX "CharFontStyleNameComplex"
+#define UNO_NAME_EDIT_CHAR_FONTFAMILY_COMPLEX "CharFontFamilyComplex"
+#define UNO_NAME_EDIT_CHAR_FONTCHARSET_COMPLEX "CharFontCharSetComplex"
+#define UNO_NAME_EDIT_CHAR_FONTPITCH_COMPLEX "CharFontPitchComplex"
+#define UNO_NAME_EDIT_CHAR_POSTURE_COMPLEX "CharPostureComplex"
+#define UNO_NAME_EDIT_CHAR_WEIGHT_COMPLEX "CharWeightComplex"
+#define UNO_NAME_EDIT_CHAR_LOCALE_COMPLEX "CharLocaleComplex"
+
+#define UNO_NAME_EDIT_CHAR_COLOR "CharColor"
+#define UNO_NAME_EDIT_CHAR_CROSSEDOUT "CharCrossedOut"
+#define UNO_NAME_EDIT_CHAR_STRIKEOUT "CharStrikeout"
+#define UNO_NAME_EDIT_CHAR_ESCAPEMENT "CharEscapement"
+#define UNO_NAME_EDIT_CHAR_FONTNAME "CharFontName"
+#define UNO_NAME_EDIT_CHAR_SHADOWED "CharShadowed"
+#define UNO_NAME_EDIT_CHAR_UNDERLINE "CharUnderline"
+#define UNO_NAME_EDIT_CHAR_OVERLINE "CharOverline"
+
+#define UNO_NAME_BITMAP "Bitmap"
+
+#define UNO_NAME_LINKDISPLAYNAME "LinkDisplayName"
+#define UNO_NAME_LINKDISPLAYBITMAP "LinkDisplayBitmap"
+
+#define UNO_NAME_GRAPHIC_LUMINANCE "AdjustLuminance"
+#define UNO_NAME_GRAPHIC_CONTRAST "AdjustContrast"
+#define UNO_NAME_GRAPHIC_RED "AdjustRed"
+#define UNO_NAME_GRAPHIC_GREEN "AdjustGreen"
+#define UNO_NAME_GRAPHIC_BLUE "AdjustBlue"
+#define UNO_NAME_GRAPHIC_GAMMA "Gamma"
+#define UNO_NAME_GRAPHIC_TRANSPARENCY "Transparency"
+#define UNO_NAME_GRAPHIC_COLOR_MODE "GraphicColorMode"
+#define UNO_NAME_GRAPHIC_GRAPHICCROP "GraphicCrop"
+
+#define UNO_NAME_CUSTOMSHAPE_ADJUSTMENT "CustomShapeAdjustment"
+
+// The following properties are obsolete and can eventually be removed
+#define UNO_NAME_EDIT_FONT_COLOR "FontColor"
+#define UNO_NAME_EDIT_FONT_ESCAPEMENT "FontEscapement"
+#define UNO_NAME_EDIT_FONT_HEIGHT "FontHeight"
+#define UNO_NAME_EDIT_FONT_SHADOWED "FontShadowed"
+#define UNO_NAME_EDIT_FONT_SLANT "FontSlant"
+#define UNO_NAME_EDIT_FONT_STRIKEOUT "FontStrikeout"
+#define UNO_NAME_EDIT_FONT_UNDERLINE "FontUnderline"
+#define UNO_NAME_EDIT_FONT_WEIGHT "FontWeight"
+#define UNO_NAME_EDIT_CHAR_STYLE "CharStyle"
+#define UNO_NAME_EDIT_FONT_FAMILY "FontFamily"
+#define UNO_NAME_EDIT_FONT_NAME "FontName"
+#define UNO_NAME_EDIT_FONT_CHARSET "FontCharset"
+// End of the obsolete properties
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unotext.hxx b/include/editeng/unotext.hxx
new file mode 100644
index 000000000000..b5a5e02a8c1b
--- /dev/null
+++ b/include/editeng/unotext.hxx
@@ -0,0 +1,661 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_UNOTEXT_HXX
+#define _SVX_UNOTEXT_HXX
+
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/text/XTextRangeMover.hpp>
+#include <com/sun/star/text/XTextCursor.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/text/XTextRangeCompare.hpp>
+#include <com/sun/star/beans/XMultiPropertyStates.hpp>
+#include <com/sun/star/text/XTextAppend.hpp>
+#include <com/sun/star/text/XTextCopy.hpp>
+#include <com/sun/star/text/XTextField.hpp>
+#include <com/sun/star/container/XIndexReplace.hpp>
+#include <com/sun/star/awt/FontSlant.hpp>
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/style/LineSpacing.hpp>
+#include <com/sun/star/style/TabStop.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <cppuhelper/interfacecontainer.h>
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/weakagg.hxx>
+#include <osl/diagnose.hxx>
+#include <osl/mutex.hxx>
+#include <comphelper/servicehelper.hxx>
+#include <tools/link.hxx>
+#include <svl/itemprop.hxx>
+#include <svl/itemset.hxx>
+#include <svl/itempool.hxx>
+#include <svl/solar.hrc>
+#include <editeng/editdata.hxx>
+#include <editeng/unoedsrc.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/editengdllapi.h>
+#include <editeng/memberids.hrc>
+
+class SvxItemPropertySet;
+
+#ifndef SEQTYPE
+ #if defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500)
+ #define SEQTYPE(x) (new ::com::sun::star::uno::Type( x ))
+ #else
+ #define SEQTYPE(x) &(x)
+ #endif
+#endif
+
+#define WID_FONTDESC OWN_ATTR_VALUE_START
+#define WID_NUMLEVEL OWN_ATTR_VALUE_START+1
+#define WID_PORTIONTYPE OWN_ATTR_VALUE_START+2
+#define WID_NUMBERINGSTARTVALUE OWN_ATTR_VALUE_START+3
+#define WID_PARAISNUMBERINGRESTART OWN_ATTR_VALUE_START+4
+
+#define SVX_UNOEDIT_NUMBERING_PROPERTIE \
+ {MAP_CHAR_LEN(UNO_NAME_NUMBERING_RULES), EE_PARA_NUMBULLET, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace>*)0), 0, 0 }, \
+ {MAP_CHAR_LEN(UNO_NAME_NUMBERING), EE_PARA_BULLETSTATE,&::getBooleanCppuType(), 0, 0 }
+
+#define SVX_UNOEDIT_OUTLINER_PROPERTIES \
+ SVX_UNOEDIT_NUMBERING_PROPERTIE, \
+ {MAP_CHAR_LEN(UNO_NAME_NUMBERING_LEVEL), WID_NUMLEVEL, &::getCppuType((const sal_Int16*)0), 0, 0 }, \
+ {MAP_CHAR_LEN("NumberingStartValue"), WID_NUMBERINGSTARTVALUE, &::getCppuType((const sal_Int16*)0), 0, 0 }, \
+ {MAP_CHAR_LEN("ParaIsNumberingRestart"), WID_PARAISNUMBERINGRESTART, &::getBooleanCppuType(), 0, 0 }
+
+#define SVX_UNOEDIT_CHAR_PROPERTIES \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_HEIGHT), EE_CHAR_FONTHEIGHT, &::getCppuType((const float*)0), 0, MID_FONTHEIGHT|CONVERT_TWIPS }, \
+ { MAP_CHAR_LEN("CharScaleWidth"), EE_CHAR_FONTWIDTH, &::getCppuType((const sal_Int16*)0), 0, 0 }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTNAME), EE_CHAR_FONTINFO, &::getCppuType((const OUString*)0), 0, MID_FONT_FAMILY_NAME },\
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTSTYLENAME),EE_CHAR_FONTINFO, &::getCppuType((const OUString*)0), 0, MID_FONT_STYLE_NAME }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTFAMILY), EE_CHAR_FONTINFO, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_FAMILY }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTCHARSET), EE_CHAR_FONTINFO, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_CHAR_SET }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTPITCH), EE_CHAR_FONTINFO, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_PITCH }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_POSTURE), EE_CHAR_ITALIC, &::getCppuType((const ::com::sun::star::awt::FontSlant*)0),0, MID_POSTURE }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_WEIGHT), EE_CHAR_WEIGHT, &::getCppuType((const float*)0), 0, MID_WEIGHT }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_LOCALE), EE_CHAR_LANGUAGE, &::getCppuType((const ::com::sun::star::lang::Locale*)0),0, MID_LANG_LOCALE }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_COLOR), EE_CHAR_COLOR, &::getCppuType((const sal_Int32*)0), 0, 0 }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_ESCAPEMENT), EE_CHAR_ESCAPEMENT, &::getCppuType((const sal_Int16*)0), 0, MID_ESC }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_UNDERLINE), EE_CHAR_UNDERLINE, &::getCppuType((const sal_Int16*)0), 0, MID_TL_STYLE }, \
+ { MAP_CHAR_LEN("CharUnderlineColor"), EE_CHAR_UNDERLINE, &::getCppuType((const sal_Int32*)0), 0, MID_TL_COLOR }, \
+ { MAP_CHAR_LEN("CharUnderlineHasColor"), EE_CHAR_UNDERLINE, &::getBooleanCppuType(), 0, MID_TL_HASCOLOR } , \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_OVERLINE), EE_CHAR_OVERLINE, &::getCppuType((const sal_Int16*)0), 0, MID_TL_STYLE }, \
+ { MAP_CHAR_LEN("CharOverlineColor"), EE_CHAR_OVERLINE, &::getCppuType((const sal_Int32*)0), 0, MID_TL_COLOR }, \
+ { MAP_CHAR_LEN("CharOverlineHasColor"), EE_CHAR_OVERLINE, &::getBooleanCppuType(), 0, MID_TL_HASCOLOR } , \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_CROSSEDOUT), EE_CHAR_STRIKEOUT, &::getBooleanCppuType(), 0, MID_CROSSED_OUT }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_STRIKEOUT), EE_CHAR_STRIKEOUT, &::getCppuType((const sal_Int16*)0), 0, MID_CROSS_OUT}, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_SHADOWED), EE_CHAR_SHADOW, &::getBooleanCppuType(), 0, 0 }, \
+ { MAP_CHAR_LEN("CharContoured"), EE_CHAR_OUTLINE, &::getBooleanCppuType(), 0, 0 }, \
+ { MAP_CHAR_LEN("CharEscapementHeight"), EE_CHAR_ESCAPEMENT, &::getCppuType((const sal_Int8*)0), 0, MID_ESC_HEIGHT },\
+ { MAP_CHAR_LEN("CharAutoKerning"), EE_CHAR_PAIRKERNING,&::getBooleanCppuType(), 0, 0 } , \
+ { MAP_CHAR_LEN("CharKerning"), EE_CHAR_KERNING, &::getCppuType((const sal_Int16*)0) , 0, 0 }, \
+ { MAP_CHAR_LEN("CharWordMode"), EE_CHAR_WLM, &::getBooleanCppuType(), 0, 0 }, \
+ { MAP_CHAR_LEN("CharEmphasis"), EE_CHAR_EMPHASISMARK,&::getCppuType((const sal_Int16*)0), 0, MID_EMPHASIS},\
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_HEIGHT_ASIAN), EE_CHAR_FONTHEIGHT_CJK, &::getCppuType((const float*)0), 0, MID_FONTHEIGHT|CONVERT_TWIPS }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTNAME_ASIAN), EE_CHAR_FONTINFO_CJK, &::getCppuType((const OUString*)0), 0, MID_FONT_FAMILY_NAME },\
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTSTYLENAME_ASIAN), EE_CHAR_FONTINFO_CJK, &::getCppuType((const OUString*)0), 0, MID_FONT_STYLE_NAME }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTFAMILY_ASIAN), EE_CHAR_FONTINFO_CJK, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_FAMILY }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTCHARSET_ASIAN), EE_CHAR_FONTINFO_CJK, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_CHAR_SET }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTPITCH_ASIAN), EE_CHAR_FONTINFO_CJK, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_PITCH }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_POSTURE_ASIAN), EE_CHAR_ITALIC_CJK, &::getCppuType((const ::com::sun::star::awt::FontSlant*)0),0, MID_POSTURE }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_WEIGHT_ASIAN), EE_CHAR_WEIGHT_CJK, &::getCppuType((const float*)0), 0, MID_WEIGHT }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_LOCALE_ASIAN), EE_CHAR_LANGUAGE_CJK, &::getCppuType((const ::com::sun::star::lang::Locale*)0),0, MID_LANG_LOCALE }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_HEIGHT_COMPLEX), EE_CHAR_FONTHEIGHT_CTL, &::getCppuType((const float*)0), 0, MID_FONTHEIGHT|CONVERT_TWIPS }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTNAME_COMPLEX), EE_CHAR_FONTINFO_CTL, &::getCppuType((const OUString*)0), 0, MID_FONT_FAMILY_NAME },\
+ {MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTSTYLENAME_COMPLEX),EE_CHAR_FONTINFO_CTL, &::getCppuType((const OUString*)0), 0, MID_FONT_STYLE_NAME }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTFAMILY_COMPLEX), EE_CHAR_FONTINFO_CTL, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_FAMILY }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTCHARSET_COMPLEX), EE_CHAR_FONTINFO_CTL, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_CHAR_SET }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTPITCH_COMPLEX), EE_CHAR_FONTINFO_CTL, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_PITCH }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_POSTURE_COMPLEX), EE_CHAR_ITALIC_CTL, &::getCppuType((const ::com::sun::star::awt::FontSlant*)0),0, MID_POSTURE }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_WEIGHT_COMPLEX), EE_CHAR_WEIGHT_CTL, &::getCppuType((const float*)0), 0, MID_WEIGHT }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_LOCALE_COMPLEX), EE_CHAR_LANGUAGE_CTL, &::getCppuType((const ::com::sun::star::lang::Locale*)0),0, MID_LANG_LOCALE }, \
+ { MAP_CHAR_LEN("CharRelief" ), EE_CHAR_RELIEF, &::getCppuType((const sal_Int16*)0), 0, MID_RELIEF }
+
+#define SVX_UNOEDIT_FONT_PROPERTIES \
+ {MAP_CHAR_LEN(UNO_NAME_EDIT_FONT_DESCRIPTOR), WID_FONTDESC, &::getCppuType((const ::com::sun::star::awt::FontDescriptor*)0), 0, MID_FONT_FAMILY_NAME }
+
+#define SVX_UNOEDIT_PARA_PROPERTIES \
+ {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_ADJUST), EE_PARA_JUST, &::getCppuType((const sal_Int16*)0), 0, MID_PARA_ADJUST }, \
+ {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_BMARGIN), EE_PARA_ULSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_LO_MARGIN|SFX_METRIC_ITEM }, \
+ {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_IS_HYPHEN), EE_PARA_HYPHENATE, &::getBooleanCppuType(), 0, 0 }, \
+ {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_LASTLINEADJ), EE_PARA_JUST, &::getCppuType((const sal_Int16*)0), 0, MID_LAST_LINE_ADJUST }, \
+ {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_LMARGIN), EE_PARA_LRSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_TXT_LMARGIN|SFX_METRIC_ITEM }, \
+ {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_LINESPACING), EE_PARA_SBL, &::getCppuType((const ::com::sun::star::style::LineSpacing*)0), 0, 0 }, \
+ {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_RMARGIN), EE_PARA_LRSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_R_MARGIN|SFX_METRIC_ITEM }, \
+ {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_TAPSTOPS), EE_PARA_TABS, SEQTYPE(::getCppuType((const ::com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop >*)0)), 0, 0 }, \
+ {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_TMARGIN), EE_PARA_ULSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_UP_MARGIN|SFX_METRIC_ITEM },\
+ {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_FIRST_LINE_INDENT), EE_PARA_LRSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_FIRST_LINE_INDENT|SFX_METRIC_ITEM}, \
+ {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_IS_HANGING_PUNCTUATION),EE_PARA_HANGINGPUNCTUATION, &::getBooleanCppuType(), 0 ,0 }, \
+ {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_IS_CHARACTER_DISTANCE), EE_PARA_ASIANCJKSPACING, &::getBooleanCppuType(), 0 ,0 }, \
+ {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_IS_FORBIDDEN_RULES), EE_PARA_FORBIDDENRULES, &::getBooleanCppuType(), 0 ,0 },\
+ {MAP_CHAR_LEN("WritingMode"), EE_PARA_WRITINGDIR, &::getCppuType((const sal_Int16*)0), 0, 0 }
+
+class SvxEditSource;
+class SvxTextForwarder;
+class SvxFieldItem;
+class SvxTextEditSource;
+class SvxFieldData;
+struct ESelection;
+
+EDITENG_DLLPUBLIC void GetSelection( struct ESelection& rSel, SvxTextForwarder* pForwarder ) throw();
+EDITENG_DLLPUBLIC void CheckSelection( struct ESelection& rSel, SvxTextForwarder* pForwarder ) throw();
+
+// ====================================================================
+// This class implements a SvxEditSource and SvxTextForwarder and does
+// nothing otherwise
+// ====================================================================
+
+class SvxDummyTextSource : public SvxEditSource, public SvxTextForwarder
+{
+public:
+
+ // SvxEditSource
+ virtual ~SvxDummyTextSource();
+ virtual SvxEditSource* Clone() const;
+ virtual SvxTextForwarder* GetTextForwarder();
+ virtual void UpdateData();
+
+ // SvxTextForwarder
+ virtual sal_uInt16 GetParagraphCount() const;
+ virtual sal_uInt16 GetTextLen( sal_uInt16 nParagraph ) const;
+ virtual String GetText( const ESelection& rSel ) const;
+ virtual SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = 0 ) const;
+ virtual SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const;
+ virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet );
+ virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich );
+ virtual void GetPortions( sal_uInt16 nPara, std::vector<sal_uInt16>& rList ) const;
+
+ sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const;
+ sal_uInt16 GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const;
+
+ virtual SfxItemPool* GetPool() const;
+
+ virtual void QuickInsertText( const String& rText, const ESelection& rSel );
+ virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel );
+ virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel );
+ virtual void QuickInsertLineBreak( const ESelection& rSel );
+
+ virtual XubString CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor );
+ virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos );
+
+ virtual sal_Bool IsValid() const;
+
+ virtual void SetNotifyHdl( const Link& );
+ virtual LanguageType GetLanguage( sal_uInt16, sal_uInt16 ) const;
+ virtual sal_uInt16 GetFieldCount( sal_uInt16 nPara ) const;
+ virtual EFieldInfo GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const;
+ virtual EBulletInfo GetBulletInfo( sal_uInt16 nPara ) const;
+ virtual Rectangle GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const;
+ virtual Rectangle GetParaBounds( sal_uInt16 nPara ) const;
+ virtual MapMode GetMapMode() const;
+ virtual OutputDevice* GetRefDevice() const;
+ virtual sal_Bool GetIndexAtPoint( const Point&, sal_uInt16& nPara, sal_uInt16& nIndex ) const;
+ virtual sal_Bool GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const;
+ virtual sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const;
+ virtual sal_uInt16 GetLineCount( sal_uInt16 nPara ) const;
+ virtual sal_uInt16 GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const;
+ virtual void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const;
+ virtual sal_uInt16 GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const;
+ virtual sal_Bool Delete( const ESelection& );
+ virtual sal_Bool InsertText( const String&, const ESelection& );
+ virtual sal_Bool QuickFormatDoc( sal_Bool bFull=sal_False );
+ virtual sal_Int16 GetDepth( sal_uInt16 nPara ) const;
+ virtual sal_Bool SetDepth( sal_uInt16 nPara, sal_Int16 nNewDepth );
+
+ virtual const SfxItemSet* GetEmptyItemSetPtr();
+
+ // implementation functions for XParagraphAppend and XTextPortionAppend
+ virtual void AppendParagraph();
+ virtual xub_StrLen AppendTextPortion( sal_uInt16 nPara, const String &rText, const SfxItemSet &rSet );
+ //XTextCopy
+ virtual void CopyText(const SvxTextForwarder& rSource);
+};
+
+namespace accessibility
+{
+ class AccessibleEditableTextPara;
+}
+
+// ====================================================================
+class EDITENG_DLLPUBLIC SvxUnoTextRangeBase : public ::com::sun::star::text::XTextRange,
+ public ::com::sun::star::beans::XPropertySet,
+ public ::com::sun::star::beans::XMultiPropertySet,
+ public ::com::sun::star::beans::XMultiPropertyStates,
+ public ::com::sun::star::beans::XPropertyState,
+ public ::com::sun::star::lang::XServiceInfo,
+ public ::com::sun::star::text::XTextRangeCompare,
+ public ::com::sun::star::lang::XUnoTunnel,
+ private osl::DebugBase<SvxUnoTextRangeBase>
+
+{
+ friend class SvxUnoTextRangeEnumeration;
+ friend class ::accessibility::AccessibleEditableTextPara;
+
+protected:
+ SvxEditSource* mpEditSource;
+ ESelection maSelection;
+ const SvxItemPropertySet* mpPropSet;
+
+ virtual void SAL_CALL _setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue, sal_Int32 nPara = -1 ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL _getPropertyValue( const OUString& PropertyName, sal_Int32 nPara = -1 ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL _setPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues, sal_Int32 nPara = -1 ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL _getPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, sal_Int32 nPara = -1 ) throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL _getPropertyState( const SfxItemPropertySimpleEntry* pMap, sal_Int32 nPara = -1 ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL _getPropertyState( const OUString& PropertyName, sal_Int32 nPara = -1 ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL _getPropertyStates( const ::com::sun::star::uno::Sequence< OUString >& aPropertyName, sal_Int32 nPara = -1 ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ // returns true if property found or false if unknown property
+ virtual sal_Bool _getOnePropertyStates(const SfxItemSet* pSet, const SfxItemPropertySimpleEntry* pMap, ::com::sun::star::beans::PropertyState& rState);
+
+ virtual void SAL_CALL _setPropertyToDefault( const OUString& PropertyName, sal_Int32 nPara = -1 ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void _setPropertyToDefault( SvxTextForwarder* pForwarder, const SfxItemPropertySimpleEntry* pMap, sal_Int32 nPara ) throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException );
+ void SetEditSource( SvxEditSource* _pEditSource ) throw();
+
+ virtual void getPropertyValue( const SfxItemPropertySimpleEntry* pMap, com::sun::star::uno::Any& rAny, const SfxItemSet& rSet ) throw(::com::sun::star::beans::UnknownPropertyException );
+ virtual void setPropertyValue( const SfxItemPropertySimpleEntry* pMap, const com::sun::star::uno::Any& rValue, const ESelection& rSelection, const SfxItemSet& rOldSet, SfxItemSet& rNewSet ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::IllegalArgumentException );
+
+public:
+ SvxUnoTextRangeBase( const SvxItemPropertySet* _pSet ) throw();
+ SvxUnoTextRangeBase( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet ) throw();
+ SvxUnoTextRangeBase( const SvxUnoTextRangeBase& rRange ) throw();
+ virtual ~SvxUnoTextRangeBase() throw();
+
+ // Internal
+ const ESelection& GetSelection() const throw() { CheckSelection( ((SvxUnoTextRangeBase*)this)->maSelection, mpEditSource->GetTextForwarder() ); return maSelection; };
+ void SetSelection( const ESelection& rSelection ) throw();
+
+ virtual void CollapseToStart(void) throw();
+ virtual void CollapseToEnd(void) throw();
+ virtual sal_Bool IsCollapsed(void) throw();
+ virtual sal_Bool GoLeft(sal_Int16 nCount, sal_Bool Expand) throw();
+ virtual sal_Bool GoRight(sal_Int16 nCount, sal_Bool Expand) throw();
+ virtual void GotoStart(sal_Bool Expand) throw();
+ virtual void GotoEnd(sal_Bool Expand) throw();
+
+ //const SfxItemPropertyMapEntry* getPropertyMapEntries() const throw() { return maPropSet.getPropertyMapEntries(); }
+ const SvxItemPropertySet* getPropertySet() const throw() { return mpPropSet; }
+ SvxEditSource* GetEditSource() const throw() { return mpEditSource; }
+
+ static sal_Bool SetPropertyValueHelper( const SfxItemSet& rOldSet, const SfxItemPropertySimpleEntry* pMap, const ::com::sun::star::uno::Any& aValue, SfxItemSet& rNewSet, const ESelection* pSelection = NULL, SvxEditSource* pEditSource = NULL );
+ static sal_Bool GetPropertyValueHelper( SfxItemSet& rSet, const SfxItemPropertySimpleEntry* pMap, ::com::sun::star::uno::Any& aAny, const ESelection* pSelection = NULL, SvxEditSource* pEditSource = NULL ) throw( ::com::sun::star::uno::RuntimeException );
+
+ void attachField( const SvxFieldData* pData ) throw();
+
+ UNO3_GETIMPLEMENTATION_DECL( SvxUnoTextRangeBase )
+
+ // ::com::sun::star::text::XTextRange
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getStart() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getEnd() throw(::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getString() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setString( const OUString& aString ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XMultiPropertySet
+ virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XMultiPropertyStates
+ //virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< OUString >& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setAllPropertiesToDefault( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertiesToDefault( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyDefaults( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XTextRangeCompare
+ virtual ::sal_Int16 SAL_CALL compareRegionStarts( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xR1, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xR2 ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int16 SAL_CALL compareRegionEnds( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xR1, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xR2 ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames_Static( ) SAL_THROW(());
+};
+
+// ====================================================================
+
+class SvxUnoTextBase;
+class EDITENG_DLLPUBLIC SvxUnoTextRange : public SvxUnoTextRangeBase,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::cppu::OWeakAggObject
+{
+ friend class SvxUnoTextRangeEnumeration;
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xParentText;
+ sal_Bool mbPortion;
+
+public:
+ SvxUnoTextRange( const SvxUnoTextBase& rParent, sal_Bool bPortion = sal_False ) throw();
+ virtual ~SvxUnoTextRange() throw();
+
+ // ::com::sun::star::uno::XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // ::com::sun::star::text::XTextRange
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+class EDITENG_DLLPUBLIC SvxUnoTextBase : public SvxUnoTextRangeBase,
+ public ::com::sun::star::text::XTextAppend,
+ public ::com::sun::star::text::XTextCopy,
+ public ::com::sun::star::container::XEnumerationAccess,
+ public ::com::sun::star::text::XTextRangeMover,
+ public ::com::sun::star::lang::XTypeProvider
+{
+protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xParentText;
+
+public:
+ SvxUnoTextBase( ) throw();
+ SvxUnoTextBase( const SvxItemPropertySet* _pSet ) throw();
+ SvxUnoTextBase( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet, ::com::sun::star::uno::Reference < ::com::sun::star::text::XText > xParent ) throw();
+ SvxUnoTextBase( const SvxUnoTextBase& rText ) throw();
+ virtual ~SvxUnoTextBase() throw();
+
+ UNO3_GETIMPLEMENTATION_DECL( SvxUnoTextBase )
+
+ ESelection InsertField( const SvxFieldItem& rField ) throw();
+ static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getStaticTypes() throw();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > createTextCursorBySelection( const ESelection& rSel );
+
+ // ::com::sun::star::uno::XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::text::XSimpleText
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL createTextCursor( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL createTextCursorByRange( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& aTextPosition ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL insertString( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange, const OUString& aString, sal_Bool bAbsorb ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL insertControlCharacter( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange, sal_Int16 nControlCharacter, sal_Bool bAbsorb ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::text::XText
+ virtual void SAL_CALL insertTextContent( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >& xContent, sal_Bool bAbsorb ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeTextContent( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >& xContent ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getString() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setString( const OUString& aString ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::text::XTextRange
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getStart() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getEnd() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XEnumerationAccess
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::text::XTextRangeMover
+ virtual void SAL_CALL moveTextRange( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange, sal_Int16 nParagraphs ) throw(::com::sun::star::uno::RuntimeException);
+
+ // com::sun::star::text::XParagraphAppend (new import API)
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL finishParagraph( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& CharacterAndParagraphProperties ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL finishParagraphInsert( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& CharacterAndParagraphProperties, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xInsertPosition ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+
+ // com::sun::star::text::XTextPortionAppend (new import API)
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL appendTextPortion( const OUString& Text, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& CharacterAndParagraphProperties ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL insertTextPortion( const OUString& Text, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& CharacterAndParagraphProperties, const com::sun::star::uno::Reference< com::sun::star::text::XTextRange>& rTextRange ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+
+ // com::sun::star::text::XTextCopy
+ virtual void SAL_CALL copyText( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCopy >& xSource ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames_Static( ) SAL_THROW(());
+
+ // ::com::sun::star::lang::XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+// ====================================================================
+class EDITENG_DLLPUBLIC SvxUnoText : public SvxUnoTextBase,
+ public ::cppu::OWeakAggObject
+{
+public:
+ SvxUnoText( ) throw();
+ SvxUnoText( const SvxItemPropertySet* _pSet ) throw();
+ SvxUnoText( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet, ::com::sun::star::uno::Reference < ::com::sun::star::text::XText > xParent ) throw();
+ SvxUnoText( const SvxUnoText& rText ) throw();
+ virtual ~SvxUnoText() throw();
+
+ // Internal
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::uno::XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // ::com::sun::star::lang::XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+// ====================================================================
+
+class SvxUnoTextContentEnumeration : public ::cppu::WeakAggImplHelper1< ::com::sun::star::container::XEnumeration >
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > mxParentText;
+ SvxEditSource* mpEditSource;
+ sal_uInt16 mnNextParagraph;
+ const SvxUnoTextBase& mrText;
+
+public:
+ SvxUnoTextContentEnumeration( const SvxUnoTextBase& _rText ) throw();
+ virtual ~SvxUnoTextContentEnumeration() throw();
+
+ // ::com::sun::star::container::XEnumeration
+ virtual sal_Bool SAL_CALL hasMoreElements( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL nextElement( ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+};
+
+// ====================================================================
+#include <com/sun/star/text/XTextContent.hpp>
+
+class SvxUnoTextContent : public SvxUnoTextRangeBase,
+ public ::com::sun::star::text::XTextContent,
+ public ::com::sun::star::container::XEnumerationAccess,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::cppu::OWeakAggObject
+{
+ friend class SvxUnoTextContentEnumeration;
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > mxParentText;
+ sal_uInt16 mnParagraph;
+ const SvxUnoTextBase& mrParentText;
+
+ // for xComponent
+ ::osl::Mutex maDisposeContainerMutex;
+ ::cppu::OInterfaceContainerHelper maDisposeListeners;
+ bool mbDisposing;
+
+protected:
+ using SvxUnoTextRangeBase::setPropertyValue;
+ using SvxUnoTextRangeBase::getPropertyValue;
+
+public:
+ SvxUnoTextContent( const SvxUnoTextBase& rText, sal_uInt16 nPara ) throw();
+ SvxUnoTextContent( const SvxUnoTextContent& rContent ) throw();
+ virtual ~SvxUnoTextContent() throw();
+
+ // ::com::sun::star::uno::XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // ::com::sun::star::text::XTextRange
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::text::XTextContent -> ::com::sun::star::lang::XComponent
+ virtual void SAL_CALL attach( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xTextRange ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getAnchor( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XComponent
+ virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XEnumerationAccess
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XPropertySet
+ virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XMultiPropertySet
+ virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+// ====================================================================
+
+class SvxUnoTextRangeEnumeration : public ::cppu::WeakAggImplHelper1< ::com::sun::star::container::XEnumeration >
+{
+private:
+ SvxEditSource* mpEditSource;
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > mxParentText;
+ const SvxUnoTextBase& mrParentText;
+ sal_uInt16 mnParagraph;
+ std::vector<sal_uInt16>* mpPortions;
+ sal_uInt16 mnNextPortion;
+
+public:
+ SvxUnoTextRangeEnumeration( const SvxUnoTextBase& rText, sal_uInt16 nPara ) throw();
+ virtual ~SvxUnoTextRangeEnumeration() throw();
+
+ // ::com::sun::star::container::XEnumeration
+ virtual sal_Bool SAL_CALL hasMoreElements( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL nextElement( ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+};
+
+// ====================================================================
+
+class EDITENG_DLLPUBLIC SvxUnoTextCursor : public SvxUnoTextRangeBase,
+ public ::com::sun::star::text::XTextCursor,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::cppu::OWeakAggObject
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > mxParentText;
+
+public:
+ SvxUnoTextCursor( const SvxUnoTextBase& rText ) throw();
+ SvxUnoTextCursor( const SvxUnoTextCursor& rCursor ) throw();
+ virtual ~SvxUnoTextCursor() throw();
+
+ // ::com::sun::star::uno::XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // ::com::sun::star::text::XTextRange
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText() throw(::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getString() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setString( const OUString& aString ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getStart() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getEnd() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::text::XTextCursor -> ::com::sun::star::text::XTextRange
+ virtual void SAL_CALL collapseToStart( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL collapseToEnd( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isCollapsed( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL goLeft( sal_Int16 nCount, sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL goRight( sal_Int16 nCount, sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL gotoStart( sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL gotoEnd( sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL gotoRange( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange, sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+
+};
+
+EDITENG_DLLPUBLIC const SvxItemPropertySet* ImplGetSvxUnoOutlinerTextCursorSvxPropertySet();
+EDITENG_DLLPUBLIC const SfxItemPropertyMapEntry* ImplGetSvxUnoOutlinerTextCursorPropertyMap();
+EDITENG_DLLPUBLIC const SvxItemPropertySet* ImplGetSvxTextPortionSvxPropertySet();
+EDITENG_DLLPUBLIC const SfxItemPropertyMapEntry* ImplGetSvxTextPortionPropertyMap();
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unoviwou.hxx b/include/editeng/unoviwou.hxx
new file mode 100644
index 000000000000..24031f93c847
--- /dev/null
+++ b/include/editeng/unoviwou.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_UNOVIWOU_HXX
+#define _SVX_UNOVIWOU_HXX
+
+#include <editeng/unoedsrc.hxx>
+#include <editeng/editengdllapi.h>
+
+class OutlinerView;
+
+/// Specialization for Draw/Impress
+class EDITENG_DLLPUBLIC SvxDrawOutlinerViewForwarder : public SvxEditViewForwarder
+{
+private:
+ OutlinerView& mrOutlinerView;
+ Point maTextShapeTopLeft;
+
+ EDITENG_DLLPRIVATE Point GetTextOffset() const;
+
+public:
+ explicit SvxDrawOutlinerViewForwarder( OutlinerView& rOutl );
+ SvxDrawOutlinerViewForwarder( OutlinerView& rOutl, const Point& rShapePosTopLeft );
+ virtual ~SvxDrawOutlinerViewForwarder();
+
+ virtual sal_Bool IsValid() const;
+
+ virtual Rectangle GetVisArea() const;
+ virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const;
+ virtual Point PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const;
+
+ virtual sal_Bool GetSelection( ESelection& rSelection ) const;
+ virtual sal_Bool SetSelection( const ESelection& rSelection );
+ virtual sal_Bool Copy();
+ virtual sal_Bool Cut();
+ virtual sal_Bool Paste();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/wghtitem.hxx b/include/editeng/wghtitem.hxx
new file mode 100644
index 000000000000..b10d74361dc8
--- /dev/null
+++ b/include/editeng/wghtitem.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_WGHTITEM_HXX
+#define _SVX_WGHTITEM_HXX
+
+#include <vcl/vclenum.hxx>
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxWeightItem ---------------------------------------------------
+
+/* [Description]
+
+ This item describes the font weight.
+*/
+
+class EDITENG_DLLPUBLIC SvxWeightItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+
+ SvxWeightItem( const FontWeight eWght /*= WEIGHT_NORMAL*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem + SfxEnumItem
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+ virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const;
+ virtual sal_uInt16 GetValueCount() const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual int HasBoolValue() const;
+ virtual sal_Bool GetBoolValue() const;
+ virtual void SetBoolValue( sal_Bool bVal );
+
+ inline SvxWeightItem& operator=(const SvxWeightItem& rWeight) {
+ SetValue( rWeight.GetValue() );
+ return *this;
+ }
+
+ // enum cast
+ FontWeight GetWeight() const
+ { return (FontWeight)GetValue(); }
+ void SetWeight( FontWeight eNew )
+ { SetValue( (sal_uInt16)eNew ); }
+};
+
+#endif // #ifndef _SVX_WGHTITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/widwitem.hxx b/include/editeng/widwitem.hxx
new file mode 100644
index 000000000000..8602702a00f7
--- /dev/null
+++ b/include/editeng/widwitem.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_WIDWITEM_HXX
+#define _SVX_WIDWITEM_HXX
+
+#include <svl/intitem.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxWidowsItem ---------------------------------------------------
+
+/* [Description]
+
+ This item describes the number of lines for the widows control.
+*/
+
+class EDITENG_DLLPUBLIC SvxWidowsItem: public SfxByteItem
+{
+ friend SvStream & operator<<( SvStream & aS, SvxWidowsItem & );
+public:
+ TYPEINFO();
+
+ SvxWidowsItem( const sal_uInt8 nL /*= 0*/, const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream &, sal_uInt16 ) const;
+ virtual SvStream& Store( SvStream & , sal_uInt16 nItemVersion ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ inline SvxWidowsItem& operator=( const SvxWidowsItem& rWidows )
+ {
+ SetValue( rWidows.GetValue() );
+ return *this;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/writingmodeitem.hxx b/include/editeng/writingmodeitem.hxx
new file mode 100644
index 000000000000..c1ad81587f42
--- /dev/null
+++ b/include/editeng/writingmodeitem.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_WRITINGMODEITEM_HXX
+#define _SVX_WRITINGMODEITEM_HXX
+
+#include <com/sun/star/text/WritingMode.hpp>
+#include <svl/intitem.hxx>
+#include "editeng/editengdllapi.h"
+
+// class SvxWritingModeItem ----------------------------------------------
+
+class EDITENG_DLLPUBLIC SvxWritingModeItem : public SfxUInt16Item
+{
+public:
+ TYPEINFO();
+
+ SvxWritingModeItem( ::com::sun::star::text::WritingMode eValue /*= com::sun::star::text::WritingMode_LR_TB*/,
+ sal_uInt16 nWhich /*= SDRATTR_TEXTDIRECTION*/ );
+ virtual ~SvxWritingModeItem();
+
+ SvxWritingModeItem& operator=( const SvxWritingModeItem& rItem );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream & rStrm, sal_uInt16 nIVer) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper * = 0 ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+};
+
+#endif // #ifndef _SVX_WRITINGMODEITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/wrlmitem.hxx b/include/editeng/wrlmitem.hxx
new file mode 100644
index 000000000000..b74b2f406a71
--- /dev/null
+++ b/include/editeng/wrlmitem.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_WRLMITEM_HXX
+#define _SVX_WRLMITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxWordLineModeItem ---------------------------------------------
+
+/* [Description]
+
+ This item describes, whether underlined and strikethrough is limited
+ to word boundaries.
+*/
+
+class EDITENG_DLLPUBLIC SvxWordLineModeItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+
+ SvxWordLineModeItem( const sal_Bool bWordLineMode /*= sal_False*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ inline SvxWordLineModeItem& operator=( const SvxWordLineModeItem& rWLM )
+ {
+ SetValue( rWLM.GetValue() );
+ return *this;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/xmlcnitm.hxx b/include/editeng/xmlcnitm.hxx
new file mode 100644
index 000000000000..d361ab79c8d0
--- /dev/null
+++ b/include/editeng/xmlcnitm.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_XMLCNITM_HXX
+#define _SVX_XMLCNITM_HXX
+
+#include <svl/poolitem.hxx>
+#include "editeng/editengdllapi.h"
+
+class SvXMLNamespaceMap;
+
+//============================================================================
+
+class SvXMLAttrContainerData;
+
+class EDITENG_DLLPUBLIC SvXMLAttrContainerItem: public SfxPoolItem
+{
+ SvXMLAttrContainerData *pImpl;
+
+public:
+ TYPEINFO();
+
+ SvXMLAttrContainerItem( sal_uInt16 nWhich = 0 );
+ SvXMLAttrContainerItem( const SvXMLAttrContainerItem& );
+ virtual ~SvXMLAttrContainerItem();
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ using SfxPoolItem::Compare;
+ virtual int Compare( const SfxPoolItem &rWith ) const;
+
+ virtual SfxItemPresentation GetPresentation(
+ SfxItemPresentation ePresentation,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresentationMetric,
+ OUString &rText,
+ const IntlWrapper *pIntlWrapper = 0 ) const;
+
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxPoolItem *Clone( SfxItemPool * = 0) const
+ { return new SvXMLAttrContainerItem( *this ); }
+
+ sal_Bool AddAttr( const OUString& rLName,
+ const OUString& rValue );
+ sal_Bool AddAttr( const OUString& rPrefix,
+ const OUString& rNamespace,
+ const OUString& rLName,
+ const OUString& rValue );
+
+ sal_uInt16 GetAttrCount() const;
+ OUString GetAttrNamespace( sal_uInt16 i ) const;
+ OUString GetAttrPrefix( sal_uInt16 i ) const;
+ const OUString& GetAttrLName( sal_uInt16 i ) const;
+ const OUString& GetAttrValue( sal_uInt16 i ) const;
+
+ sal_uInt16 GetFirstNamespaceIndex() const;
+ sal_uInt16 GetNextNamespaceIndex( sal_uInt16 nIdx ) const;
+ const OUString& GetNamespace( sal_uInt16 i ) const;
+ const OUString& GetPrefix( sal_uInt16 i ) const;
+};
+
+#endif // _SVX_XMLCNITM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/dllapi.h b/include/filter/dllapi.h
new file mode 100644
index 000000000000..9b94621feedf
--- /dev/null
+++ b/include/filter/dllapi.h
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _FILTER_DLLAPI_H
+#define _FILTER_DLLAPI_H
+
+#include "sal/config.h"
+#include "sal/types.h"
+
+#if defined FILTER_DLLIMPLEMENTATION
+#define FILTER_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define FILTER_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#if defined UNX && ! defined MACOS
+#define FILTER_PLUGIN_PUBLIC FILTER_DLLPUBLIC
+#else
+#define FILTER_PLUGIN_PUBLIC SAL_DLLPRIVATE
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/countryid.hxx b/include/filter/msfilter/countryid.hxx
new file mode 100644
index 000000000000..b70f649b05c3
--- /dev/null
+++ b/include/filter/msfilter/countryid.hxx
@@ -0,0 +1,311 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+// ============================================================================
+
+#ifndef INCLUDED_SVX_COUNTRYID_HXX
+#define INCLUDED_SVX_COUNTRYID_HXX
+
+#include <sal/types.h>
+#include <i18nlangtag/lang.h>
+#include "filter/msfilter/msfilterdllapi.h"
+
+// ----------------------------------------------------------------------------
+
+namespace msfilter {
+
+// Windows Country IDs ========================================================
+
+/** Represents a Windows country ID.
+
+ The country IDs used in Windows are equal to the international calling
+ code of each country, i.e. the code 353 represents Ireland (+353).
+
+ ATTENTION: These country codes are not supposed to be used anywhere in core
+ structures! They shall ONLY be used in the import/export filters for
+ Microsoft Office documents!
+ */
+typedef sal_uInt16 CountryId;
+
+const CountryId COUNTRY_DONTKNOW = 0;
+const CountryId COUNTRY_USA = 1;
+const CountryId COUNTRY_DOMINICAN_REPUBLIC = 1; // NANP
+const CountryId COUNTRY_GUAM = 1; // NANP
+const CountryId COUNTRY_JAMAICA = 1; // NANP
+const CountryId COUNTRY_PUERTO_RICO = 1; // NANP
+const CountryId COUNTRY_TRINIDAD_Y_TOBAGO = 1; // NANP
+const CountryId COUNTRY_CANADA = 2;
+const CountryId COUNTRY_RUSSIA = 7;
+const CountryId COUNTRY_KAZAKHSTAN = 7; // no own ID
+const CountryId COUNTRY_TATARSTAN = 7; // no own ID
+const CountryId COUNTRY_EGYPT = 20;
+const CountryId COUNTRY_SOUTH_AFRICA = 27;
+const CountryId COUNTRY_GREECE = 30;
+const CountryId COUNTRY_NETHERLANDS = 31;
+const CountryId COUNTRY_BELGIUM = 32;
+const CountryId COUNTRY_FRANCE = 33;
+const CountryId COUNTRY_SPAIN = 34;
+const CountryId COUNTRY_HUNGARY = 36;
+const CountryId COUNTRY_ITALY = 39;
+const CountryId COUNTRY_ROMANIA = 40;
+const CountryId COUNTRY_SWITZERLAND = 41;
+const CountryId COUNTRY_AUSTRIA = 43;
+const CountryId COUNTRY_UNITED_KINGDOM = 44;
+const CountryId COUNTRY_DENMARK = 45;
+const CountryId COUNTRY_SWEDEN = 46;
+const CountryId COUNTRY_NORWAY = 47;
+const CountryId COUNTRY_POLAND = 48;
+const CountryId COUNTRY_GERMANY = 49;
+const CountryId COUNTRY_PERU = 51;
+const CountryId COUNTRY_MEXICO = 52;
+const CountryId COUNTRY_CUBA = 53;
+const CountryId COUNTRY_ARGENTINIA = 54;
+const CountryId COUNTRY_BRAZIL = 55;
+const CountryId COUNTRY_CHILE = 56;
+const CountryId COUNTRY_COLOMBIA = 57;
+const CountryId COUNTRY_VENEZUELA = 58;
+const CountryId COUNTRY_MALAYSIA = 60;
+const CountryId COUNTRY_AUSTRALIA = 61;
+const CountryId COUNTRY_INDONESIA = 62;
+const CountryId COUNTRY_PHILIPPINES = 63;
+const CountryId COUNTRY_NEW_ZEALAND = 64;
+const CountryId COUNTRY_SINGAPORE = 65;
+const CountryId COUNTRY_THAILAND = 66;
+const CountryId COUNTRY_JAPAN = 81;
+const CountryId COUNTRY_SOUTH_KOREA = 82;
+const CountryId COUNTRY_VIET_NAM = 84;
+const CountryId COUNTRY_PR_CHINA = 86;
+const CountryId COUNTRY_TIBET = 86; // no own ID
+const CountryId COUNTRY_TURKEY = 90;
+const CountryId COUNTRY_INDIA = 91;
+const CountryId COUNTRY_PAKISTAN = 92;
+const CountryId COUNTRY_AFGHANISTAN = 93;
+const CountryId COUNTRY_SRI_LANKA = 94;
+const CountryId COUNTRY_MYANMAR = 95;
+const CountryId COUNTRY_MOROCCO = 212;
+const CountryId COUNTRY_ALGERIA = 213;
+const CountryId COUNTRY_TUNISIA = 216;
+const CountryId COUNTRY_LIBYA = 218;
+const CountryId COUNTRY_GAMBIA = 220;
+const CountryId COUNTRY_SENEGAL = 221;
+const CountryId COUNTRY_MAURITANIA = 222;
+const CountryId COUNTRY_MALI = 223;
+const CountryId COUNTRY_GUINEA = 224;
+const CountryId COUNTRY_COTE_D_IVOIRE = 225;
+const CountryId COUNTRY_BURKINA_FARSO = 226;
+const CountryId COUNTRY_NIGER = 227;
+const CountryId COUNTRY_TOGO = 228;
+const CountryId COUNTRY_BENIN = 229;
+const CountryId COUNTRY_MAURITIUS = 230;
+const CountryId COUNTRY_LIBERIA = 231;
+const CountryId COUNTRY_SIERRA_LEONE = 232;
+const CountryId COUNTRY_GHANA = 233;
+const CountryId COUNTRY_NIGERIA = 234;
+const CountryId COUNTRY_CHAD = 235;
+const CountryId COUNTRY_CENTRAL_AFR_REP = 236;
+const CountryId COUNTRY_CAMEROON = 237;
+const CountryId COUNTRY_CAPE_VERDE = 238;
+const CountryId COUNTRY_SAO_TOME = 239;
+const CountryId COUNTRY_EQUATORIAL_GUINEA = 240;
+const CountryId COUNTRY_GABON = 241;
+const CountryId COUNTRY_CONGO = 242;
+const CountryId COUNTRY_ZAIRE = 243;
+const CountryId COUNTRY_ANGOLA = 244;
+const CountryId COUNTRY_GUINEA_BISSAU = 245;
+const CountryId COUNTRY_DIEGO_GARCIA = 246;
+const CountryId COUNTRY_ASCENSION_ISLAND = 247;
+const CountryId COUNTRY_SEYCHELLES = 248;
+const CountryId COUNTRY_SUDAN = 249;
+const CountryId COUNTRY_RWANDA = 250;
+const CountryId COUNTRY_ETHIOPIA = 251;
+const CountryId COUNTRY_SOMALIA = 252;
+const CountryId COUNTRY_DJIBOUTI = 253;
+const CountryId COUNTRY_KENYA = 254;
+const CountryId COUNTRY_TANZANIA = 255;
+const CountryId COUNTRY_UGANDA = 256;
+const CountryId COUNTRY_BURUNDI = 257;
+const CountryId COUNTRY_MOZAMBIQUE = 258;
+const CountryId COUNTRY_ZANZIBAR = 259;
+const CountryId COUNTRY_ZAMBIA = 260;
+const CountryId COUNTRY_MADAGASKAR = 261;
+const CountryId COUNTRY_REUNION = 262;
+const CountryId COUNTRY_ZIMBABWE = 263;
+const CountryId COUNTRY_NAMIBIA = 264;
+const CountryId COUNTRY_MALAWI = 265;
+const CountryId COUNTRY_LESOTHO = 266;
+const CountryId COUNTRY_BOTSWANA = 267;
+const CountryId COUNTRY_SWAZILAND = 268;
+const CountryId COUNTRY_COMOROS_MAYOTTE = 269;
+const CountryId COUNTRY_ST_HELENA = 290;
+const CountryId COUNTRY_ERITREA = 291;
+const CountryId COUNTRY_ARUBA = 297;
+const CountryId COUNTRY_FAEROE_ISLANDS = 298;
+const CountryId COUNTRY_GREEN_ISLAND = 299;
+const CountryId COUNTRY_GIBRALTAR = 350;
+const CountryId COUNTRY_PORTUGAL = 351;
+const CountryId COUNTRY_LUXEMBOURG = 352;
+const CountryId COUNTRY_IRELAND = 353;
+const CountryId COUNTRY_ICELAND = 354;
+const CountryId COUNTRY_ALBANIA = 355;
+const CountryId COUNTRY_MALTA = 356;
+const CountryId COUNTRY_CYPRUS = 357;
+const CountryId COUNTRY_FINLAND = 358;
+const CountryId COUNTRY_BULGARIA = 359;
+const CountryId COUNTRY_LITHUANIA = 370;
+const CountryId COUNTRY_LATVIA = 371;
+const CountryId COUNTRY_ESTONIA = 372;
+const CountryId COUNTRY_MOLDOVA = 373;
+const CountryId COUNTRY_ARMENIA = 374;
+const CountryId COUNTRY_BELARUS = 375;
+const CountryId COUNTRY_ANDORRA = 376;
+const CountryId COUNTRY_MONACO = 377;
+const CountryId COUNTRY_SAN_MARINO = 378;
+const CountryId COUNTRY_VATICAN_CITY = 379;
+const CountryId COUNTRY_UKRAINE = 380;
+const CountryId COUNTRY_SERBIA = 381;
+const CountryId COUNTRY_CROATIA = 385;
+const CountryId COUNTRY_SLOVENIA = 386;
+const CountryId COUNTRY_BOSNIA = 387;
+const CountryId COUNTRY_MACEDONIA = 389;
+const CountryId COUNTRY_CZECH = 420;
+const CountryId COUNTRY_SLOVAK = 421;
+const CountryId COUNTRY_LIECHTENSTEIN = 423;
+const CountryId COUNTRY_FALKLAND_ISLANDS = 500;
+const CountryId COUNTRY_BELIZE = 501;
+const CountryId COUNTRY_GUATEMALA = 502;
+const CountryId COUNTRY_EL_SALVADOR = 503;
+const CountryId COUNTRY_HONDURAS = 504;
+const CountryId COUNTRY_NICARAGUA = 505;
+const CountryId COUNTRY_COSTA_RICA = 506;
+const CountryId COUNTRY_PANAMA = 507;
+const CountryId COUNTRY_ST_PIERRE = 508;
+const CountryId COUNTRY_HAITI = 509;
+const CountryId COUNTRY_GUADELOUPE = 590;
+const CountryId COUNTRY_BOLIVIA = 591;
+const CountryId COUNTRY_GUYANA = 592;
+const CountryId COUNTRY_ECUADOR = 593;
+const CountryId COUNTRY_FRENCH_GUIANA = 594;
+const CountryId COUNTRY_PARAGUAY = 595;
+const CountryId COUNTRY_MARTINIQUE = 596;
+const CountryId COUNTRY_SURINAME = 597;
+const CountryId COUNTRY_URUGUAY = 598;
+const CountryId COUNTRY_NETHERL_ANTILLES = 599;
+const CountryId COUNTRY_EAST_TIMOR = 670;
+const CountryId COUNTRY_ANTARCTICA = 672;
+const CountryId COUNTRY_BRUNEI_DARUSSALAM = 673;
+const CountryId COUNTRY_NARUPU = 674;
+const CountryId COUNTRY_PAPUA_NEW_GUINEA = 675;
+const CountryId COUNTRY_TONGA = 676;
+const CountryId COUNTRY_SOLOMON_ISLANDS = 677;
+const CountryId COUNTRY_VANUATU = 678;
+const CountryId COUNTRY_FIJI = 679;
+const CountryId COUNTRY_PALAU = 680;
+const CountryId COUNTRY_WALLIS_AND_FUTUNA = 681;
+const CountryId COUNTRY_COOK_ISLANDS = 682;
+const CountryId COUNTRY_NIUE_ISLAND = 683;
+const CountryId COUNTRY_AMERICAN_SAMOA = 684;
+const CountryId COUNTRY_WESTERN_SAMOA = 685;
+const CountryId COUNTRY_KIRIBATI = 686;
+const CountryId COUNTRY_NEW_CALEDONIA = 687;
+const CountryId COUNTRY_TUVALU = 688;
+const CountryId COUNTRY_FRENCH_POLYNESIA = 689;
+const CountryId COUNTRY_TOKELAU = 690;
+const CountryId COUNTRY_MICRONESIA = 691;
+const CountryId COUNTRY_MARSHALL_ISLANDS = 692;
+const CountryId COUNTRY_NORTH_KOREA = 850;
+const CountryId COUNTRY_HONG_KONG = 852;
+const CountryId COUNTRY_MACAU = 853;
+const CountryId COUNTRY_CAMBODIA = 855;
+const CountryId COUNTRY_LAOS = 856;
+const CountryId COUNTRY_BANGLADESH = 880;
+const CountryId COUNTRY_TAIWAN = 886;
+const CountryId COUNTRY_MALDIVES = 960;
+const CountryId COUNTRY_LEBANON = 961;
+const CountryId COUNTRY_JORDAN = 962;
+const CountryId COUNTRY_SYRIA = 963;
+const CountryId COUNTRY_IRAQ = 964;
+const CountryId COUNTRY_KUWAIT = 965;
+const CountryId COUNTRY_SAUDI_ARABIA = 966;
+const CountryId COUNTRY_YEMEN = 967;
+const CountryId COUNTRY_OMAN = 968;
+const CountryId COUNTRY_PALESTINE = 970;
+const CountryId COUNTRY_UAE = 971;
+const CountryId COUNTRY_ISRAEL = 972;
+const CountryId COUNTRY_BAHRAIN = 973;
+const CountryId COUNTRY_QATAR = 974;
+const CountryId COUNTRY_BHUTAN = 975;
+const CountryId COUNTRY_MONGOLIA = 976;
+const CountryId COUNTRY_NEPAL = 977;
+const CountryId COUNTRY_IRAN = 981;
+const CountryId COUNTRY_TAJIKISTAN = 992;
+const CountryId COUNTRY_TURKMENISTAN = 993;
+const CountryId COUNTRY_AZERBAIJAN = 994;
+const CountryId COUNTRY_GEORGIA = 995;
+const CountryId COUNTRY_KYRGYZSTAN = 996;
+const CountryId COUNTRY_UZBEKISTAN = 998;
+
+// Country ID <-> Language type conversion ====================================
+
+/** Converts a language type to a Windows country ID.
+
+ The function regards the sub type of the passed language, and tries to
+ return the appropriate country, i.e. COUNTRY_IRELAND for
+ LANGUAGE_ENGLISH_EIRE.
+
+ A few countries do not have an own associated country ID. Most of these
+ countries are mapped to another related country, i.e. Kazakhstan is
+ mapped to Russia.
+
+ If no country can be found, the value COUNTRY_DONTKNOW will be returned.
+
+ @param eLanguage
+ A language type, defined in tools/lang.hxx.
+
+ @return
+ The best Windows country ID for the passed language type, or
+ COUNTRY_DONTKNOW on error.
+ */
+MSFILTER_DLLPUBLIC CountryId ConvertLanguageToCountry( LanguageType eLanguage );
+
+/** Converts a Windows country ID to a language type.
+
+ The function returns the most used language for the passed country
+ (hopefully), i.e. LANGUAGE_ENGLISH_EIRE for COUNTRY_IRELAND.
+
+ If the passed country ID is not valid, the value LANGUAGE_DONTKNOW will be
+ returned.
+
+ @param eCountry
+ A Windows country ID, defined above.
+
+ @return
+ The most used language type in the passed country, or LANGUAGE_DONTKNOW
+ on error.
+ */
+MSFILTER_DLLPUBLIC LanguageType ConvertCountryToLanguage( CountryId eCountry );
+
+// ============================================================================
+
+} // namespace svx
+
+// ============================================================================
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/dffpropset.hxx b/include/filter/msfilter/dffpropset.hxx
new file mode 100644
index 000000000000..e4e9e90a5a6e
--- /dev/null
+++ b/include/filter/msfilter/dffpropset.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _DFFPROPSET_HXX
+#define _DFFPROPSET_HXX
+
+#include <tools/solar.h>
+#include <filter/msfilter/msfilterdllapi.h>
+#include <filter/msfilter/dffrecordheader.hxx>
+#include <tools/stream.hxx>
+#include <vector>
+
+struct DffPropFlags
+{
+ sal_uInt8 bSet : 1;
+ sal_uInt8 bComplex : 1;
+ sal_uInt8 bBlip : 1;
+ sal_uInt8 bSoftAttr : 1;
+};
+
+struct DffPropSetEntry
+{
+ DffPropFlags aFlags;
+ sal_uInt16 nComplexIndexOrFlagsHAttr;
+ sal_uInt32 nContent;
+};
+
+class MSFILTER_DLLPUBLIC DffPropSet
+{
+ private:
+ DffPropSetEntry* mpPropSetEntries;
+ std::vector< sal_uInt32 > maOffsets;
+
+ void ReadPropSet( SvStream&, bool );
+
+ public:
+ explicit DffPropSet();
+ ~DffPropSet();
+
+ inline sal_Bool IsProperty( sal_uInt32 nRecType ) const { return ( mpPropSetEntries[ nRecType & 0x3ff ].aFlags.bSet ); };
+ sal_Bool IsHardAttribute( sal_uInt32 nId ) const;
+ sal_uInt32 GetPropertyValue( sal_uInt32 nId, sal_uInt32 nDefault = 0 ) const;
+ /** Returns a boolean property by its real identifier. */
+ bool GetPropertyBool( sal_uInt32 nId, bool bDefault = false ) const;
+ /** Returns a string property. */
+ OUString GetPropertyString( sal_uInt32 nId, SvStream& rStrm ) const;
+ sal_Bool SeekToContent( sal_uInt32 nRecType, SvStream& rSt ) const;
+ void InitializePropSet( sal_uInt16 nPropSetType ) const;
+
+ friend SvStream& operator>>( SvStream& rIn, DffPropSet& rPropSet );
+ friend SvStream& operator|=( SvStream& rIn, DffPropSet& rPropSet );
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/dffrecordheader.hxx b/include/filter/msfilter/dffrecordheader.hxx
new file mode 100644
index 000000000000..ca2fcc368c46
--- /dev/null
+++ b/include/filter/msfilter/dffrecordheader.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _DFFRECORDHEADER_HXX
+#define _DFFRECORDHEADER_HXX
+
+#include <tools/solar.h>
+#include <tools/stream.hxx>
+#include <filter/msfilter/msfilterdllapi.h>
+#include <svx/msdffdef.hxx>
+
+class MSFILTER_DLLPUBLIC DffRecordHeader
+{
+public:
+ sal_uInt8 nRecVer; // may be DFF_PSFLAG_CONTAINER
+ sal_uInt16 nRecInstance;
+ sal_uInt16 nImpVerInst;
+ sal_uInt16 nRecType;
+ sal_uInt32 nRecLen;
+ sal_uLong nFilePos;
+
+ DffRecordHeader() : nRecVer(0), nRecInstance(0), nImpVerInst(0),
+ nRecType(0), nRecLen(0), nFilePos(0) {}
+ bool IsContainer() const { return nRecVer == DFF_PSFLAG_CONTAINER; }
+ sal_uLong GetRecBegFilePos() const { return nFilePos; }
+ sal_uLong GetRecEndFilePos() const
+ { return nFilePos + DFF_COMMON_RECORD_HEADER_SIZE + nRecLen; }
+ bool SeekToEndOfRecord(SvStream& rIn) const
+ {
+ sal_Size nPos = nFilePos + DFF_COMMON_RECORD_HEADER_SIZE + nRecLen;
+ return nPos == rIn.Seek(nPos);
+ }
+ bool SeekToContent(SvStream& rIn) const
+ {
+ sal_Size nPos = nFilePos + DFF_COMMON_RECORD_HEADER_SIZE;
+ return nPos == rIn.Seek(nPos);
+ }
+ bool SeekToBegOfRecord(SvStream& rIn) const
+ {
+ return nFilePos == rIn.Seek(nFilePos);
+ }
+
+ MSFILTER_DLLPUBLIC friend SvStream& operator>>(SvStream& rIn, DffRecordHeader& rRec);
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/escherex.hxx b/include/filter/msfilter/escherex.hxx
new file mode 100644
index 000000000000..b57d269d30b0
--- /dev/null
+++ b/include/filter/msfilter/escherex.hxx
@@ -0,0 +1,1721 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_ESCHEREX_HXX
+#define _SVX_ESCHEREX_HXX
+
+#include <memory>
+#include <vector>
+#include <boost/shared_ptr.hpp>
+#include <tools/solar.h>
+#include <tools/gen.hxx>
+#include <tools/stream.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <svtools/grfmgr.hxx>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/PropertyState.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/drawing/BitmapMode.hpp>
+#include <com/sun/star/drawing/Hatch.hpp>
+#include <svx/msdffdef.hxx>
+#include "filter/msfilter/msfilterdllapi.h"
+
+ /*Record Name FBT-Value Instance Contents Wrd Exl PPt Ver*/
+// In the Microsoft documentation the naming scheme is msofbt... instead of ESCHER_...
+#define ESCHER_DggContainer 0xF000 /* per-document data X X X */
+#define ESCHER_Dgg 0xF006 /* an FDGG and several FIDCLs X X X 0 */
+#define ESCHER_CLSID 0xF016 /* the CLSID of the application that put the data on the clipboard C C C 0 */
+#define ESCHER_OPT 0xF00B /* count of properties the document-wide default shape properties X X X 3 */
+#define ESCHER_ColorMRU 0xF11A /* count of colors the colors in the MRU swatch X X X 0 */
+#define ESCHER_SplitMenuColors 0xF11E /* count of colors the colors in the top-level split menus X X X 0 */
+#define ESCHER_BstoreContainer 0xF001 /* count of BLIPs all images in the document (JPEGs, metafiles, etc.) X X X */
+#define ESCHER_BSE 0xF007 /* BLIP type an FBSE (one per BLIP) X X X 2 */
+#define ESCHER_BlipFirst 0xF018 /* range of fbts reserved for various kinds of BLIPs X X X */
+#define ESCHER_BlipLast 0xF117 /* range of fbts reserved for various kinds of BLIPs X X X */
+
+#define ESCHER_DgContainer 0xF002 /* per-sheet/page/slide data X X X */
+#define ESCHER_Dg 0xF008 /* drawing ID an FDG X X X 0 */
+#define ESCHER_RegroupItems 0xF118 /* count of regroup entries several FRITs X X X 0 */
+#define ESCHER_ColorScheme 0xF120 /* count of colors the colors of the source host's color scheme C C 0 */
+#define ESCHER_SpgrContainer 0xF003 /* several SpContainers, the first of which is the group shape itself X X X */
+#define ESCHER_SpContainer 0xF004 /* a shape X X X */
+#define ESCHER_Spgr 0xF009 /* an FSPGR; only present if the shape is a group shape X X X 1 */
+#define ESCHER_Sp 0xF00A /* shape type an FSP X X X 2 */
+//#define ESCHER_OPT 0xF00B /* count of properties a shape property table X X X 3 */
+#define ESCHER_Textbox 0xF00C /* RTF text C C C 0 */
+#define ESCHER_ClientTextbox 0xF00D /* host-defined the text in the textbox, in host-defined format X X X */
+#define ESCHER_Anchor 0xF00E /* a RECT, in 100000ths of an inch C C C 0 */
+#define ESCHER_ChildAnchor 0xF00F /* a RECT, in units relative to the parent group X X X 0 */
+#define ESCHER_ClientAnchor 0xF010 /* host-defined the location of the shape, in a host-defined format X X X */
+#define ESCHER_ClientData 0xF011 /* host-defined host-specific data X X X */
+#define ESCHER_OleObject 0xF11F /* a serialized IStorage for an OLE object C C C 0 */
+#define ESCHER_DeletedPspl 0xF11D /* an FPSPL; only present in top-level deleted shapes X 0 */
+#define ESCHER_SolverContainer 0xF005 /* count of rules the rules governing shapes X X X */
+#define ESCHER_ConnectorRule 0xF012 /* an FConnectorRule X X 1 */
+#define ESCHER_AlignRule 0xF013 /* an FAlignRule X X X 0 */
+#define ESCHER_ArcRule 0xF014 /* an FARCRU X X X 0 */
+#define ESCHER_ClientRule 0xF015 /* host-defined host-defined */
+#define ESCHER_CalloutRule 0xF017 /* an FCORU X X X 0 */
+#define ESCHER_Selection 0xF119 /* an FDGSL followed by the SPIDs of the shapes in the selection X 0 */
+#define ESCHER_UDefProp 0xF122
+
+#define SHAPEFLAG_GROUP 0x001 /* This shape is a group shape */
+#define SHAPEFLAG_CHILD 0x002 /* Not a top-level shape */
+#define SHAPEFLAG_PATRIARCH 0x004 /* This is the topmost group shape. Exactly one of these per drawing. */
+#define SHAPEFLAG_DELETED 0x008 /* The shape has been deleted */
+#define SHAPEFLAG_OLESHAPE 0x010 /* The shape is an OLE object */
+#define SHAPEFLAG_HAVEMASTER 0x020 /* Shape has a hspMaster property */
+#define SHAPEFLAG_FLIPH 0x040 /* Shape is flipped horizontally */
+#define SHAPEFLAG_FLIPV 0x080 /* Shape is flipped vertically */
+#define SHAPEFLAG_CONNECTOR 0x100 /* Connector type of shape */
+#define SHAPEFLAG_HAVEANCHOR 0x200 /* Shape has an anchor of some kind */
+#define SHAPEFLAG_BACKGROUND 0x400 /* Background shape */
+#define SHAPEFLAG_HAVESPT 0x800 /* Shape has a shape type property */
+
+#define ESCHER_ShpInst_Min 0
+#define ESCHER_ShpInst_NotPrimitive ESCHER_ShpInst_Min
+#define ESCHER_ShpInst_Rectangle 1
+#define ESCHER_ShpInst_RoundRectangle 2
+#define ESCHER_ShpInst_Ellipse 3
+#define ESCHER_ShpInst_Diamond 4
+#define ESCHER_ShpInst_IsocelesTriangle 5
+#define ESCHER_ShpInst_RightTriangle 6
+#define ESCHER_ShpInst_Parallelogram 7
+#define ESCHER_ShpInst_Trapezoid 8
+#define ESCHER_ShpInst_Hexagon 9
+#define ESCHER_ShpInst_Octagon 10
+#define ESCHER_ShpInst_Plus 11
+#define ESCHER_ShpInst_Star 12
+#define ESCHER_ShpInst_Arrow 13
+#define ESCHER_ShpInst_ThickArrow 14
+#define ESCHER_ShpInst_HomePlate 15
+#define ESCHER_ShpInst_Cube 16
+#define ESCHER_ShpInst_Balloon 17
+#define ESCHER_ShpInst_Seal 18
+#define ESCHER_ShpInst_Arc 19
+#define ESCHER_ShpInst_Line 20
+#define ESCHER_ShpInst_Plaque 21
+#define ESCHER_ShpInst_Can 22
+#define ESCHER_ShpInst_Donut 23
+#define ESCHER_ShpInst_TextSimple 24
+#define ESCHER_ShpInst_TextOctagon 25
+#define ESCHER_ShpInst_TextHexagon 26
+#define ESCHER_ShpInst_TextCurve 27
+#define ESCHER_ShpInst_TextWave 28
+#define ESCHER_ShpInst_TextRing 29
+#define ESCHER_ShpInst_TextOnCurve 30
+#define ESCHER_ShpInst_TextOnRing 31
+#define ESCHER_ShpInst_StraightConnector1 32
+#define ESCHER_ShpInst_BentConnector2 33
+#define ESCHER_ShpInst_BentConnector3 34
+#define ESCHER_ShpInst_BentConnector4 35
+#define ESCHER_ShpInst_BentConnector5 36
+#define ESCHER_ShpInst_CurvedConnector2 37
+#define ESCHER_ShpInst_CurvedConnector3 38
+#define ESCHER_ShpInst_CurvedConnector4 39
+#define ESCHER_ShpInst_CurvedConnector5 40
+#define ESCHER_ShpInst_Callout1 41
+#define ESCHER_ShpInst_Callout2 42
+#define ESCHER_ShpInst_Callout3 43
+#define ESCHER_ShpInst_AccentCallout1 44
+#define ESCHER_ShpInst_AccentCallout2 45
+#define ESCHER_ShpInst_AccentCallout3 46
+#define ESCHER_ShpInst_BorderCallout1 47
+#define ESCHER_ShpInst_BorderCallout2 48
+#define ESCHER_ShpInst_BorderCallout3 49
+#define ESCHER_ShpInst_AccentBorderCallout1 50
+#define ESCHER_ShpInst_AccentBorderCallout2 51
+#define ESCHER_ShpInst_AccentBorderCallout3 52
+#define ESCHER_ShpInst_Ribbon 53
+#define ESCHER_ShpInst_Ribbon2 54
+#define ESCHER_ShpInst_Chevron 55
+#define ESCHER_ShpInst_Pentagon 56
+#define ESCHER_ShpInst_NoSmoking 57
+#define ESCHER_ShpInst_Seal8 58
+#define ESCHER_ShpInst_Seal16 59
+#define ESCHER_ShpInst_Seal32 60
+#define ESCHER_ShpInst_WedgeRectCallout 61
+#define ESCHER_ShpInst_WedgeRRectCallout 62
+#define ESCHER_ShpInst_WedgeEllipseCallout 63
+#define ESCHER_ShpInst_Wave 64
+#define ESCHER_ShpInst_FoldedCorner 65
+#define ESCHER_ShpInst_LeftArrow 66
+#define ESCHER_ShpInst_DownArrow 67
+#define ESCHER_ShpInst_UpArrow 68
+#define ESCHER_ShpInst_LeftRightArrow 69
+#define ESCHER_ShpInst_UpDownArrow 70
+#define ESCHER_ShpInst_IrregularSeal1 71
+#define ESCHER_ShpInst_IrregularSeal2 72
+#define ESCHER_ShpInst_LightningBolt 73
+#define ESCHER_ShpInst_Heart 74
+#define ESCHER_ShpInst_PictureFrame 75
+#define ESCHER_ShpInst_QuadArrow 76
+#define ESCHER_ShpInst_LeftArrowCallout 77
+#define ESCHER_ShpInst_RightArrowCallout 78
+#define ESCHER_ShpInst_UpArrowCallout 79
+#define ESCHER_ShpInst_DownArrowCallout 80
+#define ESCHER_ShpInst_LeftRightArrowCallout 81
+#define ESCHER_ShpInst_UpDownArrowCallout 82
+#define ESCHER_ShpInst_QuadArrowCallout 83
+#define ESCHER_ShpInst_Bevel 84
+#define ESCHER_ShpInst_LeftBracket 85
+#define ESCHER_ShpInst_RightBracket 86
+#define ESCHER_ShpInst_LeftBrace 87
+#define ESCHER_ShpInst_RightBrace 88
+#define ESCHER_ShpInst_LeftUpArrow 89
+#define ESCHER_ShpInst_BentUpArrow 90
+#define ESCHER_ShpInst_BentArrow 91
+#define ESCHER_ShpInst_Seal24 92
+#define ESCHER_ShpInst_StripedRightArrow 93
+#define ESCHER_ShpInst_NotchedRightArrow 94
+#define ESCHER_ShpInst_BlockArc 95
+#define ESCHER_ShpInst_SmileyFace 96
+#define ESCHER_ShpInst_VerticalScroll 97
+#define ESCHER_ShpInst_HorizontalScroll 98
+#define ESCHER_ShpInst_CircularArrow 99
+#define ESCHER_ShpInst_NotchedCircularArrow 100
+#define ESCHER_ShpInst_UturnArrow 101
+#define ESCHER_ShpInst_CurvedRightArrow 102
+#define ESCHER_ShpInst_CurvedLeftArrow 103
+#define ESCHER_ShpInst_CurvedUpArrow 104
+#define ESCHER_ShpInst_CurvedDownArrow 105
+#define ESCHER_ShpInst_CloudCallout 106
+#define ESCHER_ShpInst_EllipseRibbon 107
+#define ESCHER_ShpInst_EllipseRibbon2 108
+#define ESCHER_ShpInst_FlowChartProcess 109
+#define ESCHER_ShpInst_FlowChartDecision 110
+#define ESCHER_ShpInst_FlowChartInputOutput 111
+#define ESCHER_ShpInst_FlowChartPredefinedProcess 112
+#define ESCHER_ShpInst_FlowChartInternalStorage 113
+#define ESCHER_ShpInst_FlowChartDocument 114
+#define ESCHER_ShpInst_FlowChartMultidocument 115
+#define ESCHER_ShpInst_FlowChartTerminator 116
+#define ESCHER_ShpInst_FlowChartPreparation 117
+#define ESCHER_ShpInst_FlowChartManualInput 118
+#define ESCHER_ShpInst_FlowChartManualOperation 119
+#define ESCHER_ShpInst_FlowChartConnector 120
+#define ESCHER_ShpInst_FlowChartPunchedCard 121
+#define ESCHER_ShpInst_FlowChartPunchedTape 122
+#define ESCHER_ShpInst_FlowChartSummingJunction 123
+#define ESCHER_ShpInst_FlowChartOr 124
+#define ESCHER_ShpInst_FlowChartCollate 125
+#define ESCHER_ShpInst_FlowChartSort 126
+#define ESCHER_ShpInst_FlowChartExtract 127
+#define ESCHER_ShpInst_FlowChartMerge 128
+#define ESCHER_ShpInst_FlowChartOfflineStorage 129
+#define ESCHER_ShpInst_FlowChartOnlineStorage 130
+#define ESCHER_ShpInst_FlowChartMagneticTape 131
+#define ESCHER_ShpInst_FlowChartMagneticDisk 132
+#define ESCHER_ShpInst_FlowChartMagneticDrum 133
+#define ESCHER_ShpInst_FlowChartDisplay 134
+#define ESCHER_ShpInst_FlowChartDelay 135
+#define ESCHER_ShpInst_TextPlainText 136
+#define ESCHER_ShpInst_TextStop 137
+#define ESCHER_ShpInst_TextTriangle 138
+#define ESCHER_ShpInst_TextTriangleInverted 139
+#define ESCHER_ShpInst_TextChevron 140
+#define ESCHER_ShpInst_TextChevronInverted 141
+#define ESCHER_ShpInst_TextRingInside 142
+#define ESCHER_ShpInst_TextRingOutside 143
+#define ESCHER_ShpInst_TextArchUpCurve 144
+#define ESCHER_ShpInst_TextArchDownCurve 145
+#define ESCHER_ShpInst_TextCircleCurve 146
+#define ESCHER_ShpInst_TextButtonCurve 147
+#define ESCHER_ShpInst_TextArchUpPour 148
+#define ESCHER_ShpInst_TextArchDownPour 149
+#define ESCHER_ShpInst_TextCirclePour 150
+#define ESCHER_ShpInst_TextButtonPour 151
+#define ESCHER_ShpInst_TextCurveUp 152
+#define ESCHER_ShpInst_TextCurveDown 153
+#define ESCHER_ShpInst_TextCascadeUp 154
+#define ESCHER_ShpInst_TextCascadeDown 155
+#define ESCHER_ShpInst_TextWave1 156
+#define ESCHER_ShpInst_TextWave2 157
+#define ESCHER_ShpInst_TextWave3 158
+#define ESCHER_ShpInst_TextWave4 159
+#define ESCHER_ShpInst_TextInflate 160
+#define ESCHER_ShpInst_TextDeflate 161
+#define ESCHER_ShpInst_TextInflateBottom 162
+#define ESCHER_ShpInst_TextDeflateBottom 163
+#define ESCHER_ShpInst_TextInflateTop 164
+#define ESCHER_ShpInst_TextDeflateTop 165
+#define ESCHER_ShpInst_TextDeflateInflate 166
+#define ESCHER_ShpInst_TextDeflateInflateDeflate 167
+#define ESCHER_ShpInst_TextFadeRight 168
+#define ESCHER_ShpInst_TextFadeLeft 169
+#define ESCHER_ShpInst_TextFadeUp 170
+#define ESCHER_ShpInst_TextFadeDown 171
+#define ESCHER_ShpInst_TextSlantUp 172
+#define ESCHER_ShpInst_TextSlantDown 173
+#define ESCHER_ShpInst_TextCanUp 174
+#define ESCHER_ShpInst_TextCanDown 175
+#define ESCHER_ShpInst_FlowChartAlternateProcess 176
+#define ESCHER_ShpInst_FlowChartOffpageConnector 177
+#define ESCHER_ShpInst_Callout90 178
+#define ESCHER_ShpInst_AccentCallout90 179
+#define ESCHER_ShpInst_BorderCallout90 180
+#define ESCHER_ShpInst_AccentBorderCallout90 181
+#define ESCHER_ShpInst_LeftRightUpArrow 182
+#define ESCHER_ShpInst_Sun 183
+#define ESCHER_ShpInst_Moon 184
+#define ESCHER_ShpInst_BracketPair 185
+#define ESCHER_ShpInst_BracePair 186
+#define ESCHER_ShpInst_Seal4 187
+#define ESCHER_ShpInst_DoubleWave 188
+#define ESCHER_ShpInst_ActionButtonBlank 189
+#define ESCHER_ShpInst_ActionButtonHome 190
+#define ESCHER_ShpInst_ActionButtonHelp 191
+#define ESCHER_ShpInst_ActionButtonInformation 192
+#define ESCHER_ShpInst_ActionButtonForwardNext 193
+#define ESCHER_ShpInst_ActionButtonBackPrevious 194
+#define ESCHER_ShpInst_ActionButtonEnd 195
+#define ESCHER_ShpInst_ActionButtonBeginning 196
+#define ESCHER_ShpInst_ActionButtonReturn 197
+#define ESCHER_ShpInst_ActionButtonDocument 198
+#define ESCHER_ShpInst_ActionButtonSound 199
+#define ESCHER_ShpInst_ActionButtonMovie 200
+#define ESCHER_ShpInst_HostControl 201
+#define ESCHER_ShpInst_TextBox 202
+#define ESCHER_ShpInst_COUNT 203
+#define ESCHER_ShpInst_Max 0x0FFF
+#define ESCHER_ShpInst_Nil ESCHER_ShpInst_Max
+
+enum ESCHER_BlibType
+{ // GEL provided types...
+ ERROR = 0, // An error occurred during loading
+ UNKNOWN, // An unknown blip type
+ EMF, // Windows Enhanced Metafile
+ WMF, // Windows Metafile
+ PICT, // Macintosh PICT
+ PEG, // JFIF
+ PNG, // PNG
+ DIB, // Windows DIB
+ FirstClient = 32, // First client defined blip type
+ LastClient = 255 // Last client defined blip type
+};
+
+enum ESCHER_FillStyle
+{
+ ESCHER_FillSolid, // Fill with a solid color
+ ESCHER_FillPattern, // Fill with a pattern (bitmap)
+ ESCHER_FillTexture, // A texture (pattern with its own color map)
+ ESCHER_FillPicture, // Center a picture in the shape
+ ESCHER_FillShade, // Shade from start to end points
+ ESCHER_FillShadeCenter, // Shade from bounding rectangle to end point
+ ESCHER_FillShadeShape, // Shade from shape outline to end point
+ ESCHER_FillShadeScale,
+ ESCHER_FillShadeTitle,
+ ESCHER_FillBackground
+};
+
+enum ESCHER_wMode
+{
+ ESCHER_wColor, // only used for predefined shades
+ ESCHER_wAutomatic, // depends on object type
+ ESCHER_wGrayScale, // shades of gray only
+ ESCHER_wLightGrayScale, // shades of light gray only
+ ESCHER_wInverseGray, // dark gray mapped to light gray, etc.
+ ESCHER_wGrayOutline, // pure gray and white
+ ESCHER_wBlackTextLine, // black text and lines, all else grayscale
+ ESCHER_wHighContrast, // pure black and white mode (no grays)
+ ESCHER_wBlack, // solid black msobwWhite, // solid white
+ ESCHER_wDontShow, // object not drawn
+ ESCHER_wNumModes // number of Black and white modes
+};
+
+
+//
+enum ESCHER_ShapePath
+{
+ ESCHER_ShapeLines, // A line of straight segments
+ ESCHER_ShapeLinesClosed, // A closed polygonal object
+ ESCHER_ShapeCurves, // A line of Bezier curve segments
+ ESCHER_ShapeCurvesClosed, // A closed shape with curved edges
+ ESCHER_ShapeComplex // pSegmentInfo must be non-empty
+};
+
+
+enum ESCHER_WrapMode
+{
+ ESCHER_WrapSquare,
+ ESCHER_WrapByPoints,
+ ESCHER_WrapNone,
+ ESCHER_WrapTopBottom,
+ ESCHER_WrapThrough
+};
+
+//
+enum ESCHER_bwMode
+{
+ ESCHER_bwColor, // only used for predefined shades
+ ESCHER_bwAutomatic, // depends on object type
+ ESCHER_bwGrayScale, // shades of gray only
+ ESCHER_bwLightGrayScale, // shades of light gray only
+ ESCHER_bwInverseGray, // dark gray mapped to light gray, etc.
+ ESCHER_bwGrayOutline, // pure gray and white
+ ESCHER_bwBlackTextLine, // black text and lines, all else grayscale
+ ESCHER_bwHighContrast, // pure black and white mode (no grays)
+ ESCHER_bwBlack, // solid black
+ ESCHER_bwWhite, // solid white
+ ESCHER_bwDontShow, // object not drawn
+ ESCHER_bwNumModes // number of Black and white modes
+};
+
+
+enum ESCHER_AnchorText
+{
+ ESCHER_AnchorTop,
+ ESCHER_AnchorMiddle,
+ ESCHER_AnchorBottom,
+ ESCHER_AnchorTopCentered,
+ ESCHER_AnchorMiddleCentered,
+ ESCHER_AnchorBottomCentered,
+ ESCHER_AnchorTopBaseline,
+ ESCHER_AnchorBottomBaseline,
+ ESCHER_AnchorTopCenteredBaseline,
+ ESCHER_AnchorBottomCenteredBaseline
+};
+
+enum ESCHER_cDir
+{
+ ESCHER_cDir0, // Right
+ ESCHER_cDir90, // Down
+ ESCHER_cDir180, // Left
+ ESCHER_cDir270 // Up
+};
+
+// connector style
+enum ESCHER_cxSTYLE
+{
+ ESCHER_cxstyleStraight = 0,
+ ESCHER_cxstyleBent,
+ ESCHER_cxstyleCurved,
+ ESCHER_cxstyleNone
+};
+
+// text flow
+enum ESCHER_txfl
+{
+ ESCHER_txflHorzN, // Horizontal non-@
+ ESCHER_txflTtoBA, // Top to Bottom @-font
+ ESCHER_txflBtoT, // Bottom to Top non-@
+ ESCHER_txflTtoBN, // Top to Bottom non-@
+ ESCHER_txflHorzA, // Horizontal @-font
+ ESCHER_txflVertN // Vertical, non-@
+};
+
+// text direction (needed for Bi-Di support)
+enum ESCHER_txDir
+{
+ ESCHER_txdirLTR, // left-to-right text direction
+ ESCHER_txdirRTL, // right-to-left text direction
+ ESCHER_txdirContext // context text direction
+};
+
+// Callout Type
+enum ESCHER_spcot
+{
+ ESCHER_spcotRightAngle = 1,
+ ESCHER_spcotOneSegment = 2,
+ ESCHER_spcotTwoSegment = 3,
+ ESCHER_spcotThreeSegment= 4
+};
+
+// Callout Angle
+enum ESCHER_spcoa
+{
+ ESCHER_spcoaAny,
+ ESCHER_spcoa30,
+ ESCHER_spcoa45,
+ ESCHER_spcoa60,
+ ESCHER_spcoa90,
+ ESCHER_spcoa0
+};
+
+// Callout Drop
+enum ESCHER_spcod
+{
+ ESCHER_spcodTop,
+ ESCHER_spcodCenter,
+ ESCHER_spcodBottom,
+ ESCHER_spcodSpecified
+};
+
+// FontWork alignment
+enum ESCHER_GeoTextAlign
+{
+ ESCHER_AlignTextStretch, // Stretch each line of text to fit width.
+ ESCHER_AlignTextCenter, // Center text on width.
+ ESCHER_AlignTextLeft, // Left justify.
+ ESCHER_AlignTextRight, // Right justify.
+ ESCHER_AlignTextLetterJust, // Spread letters out to fit width.
+ ESCHER_AlignTextWordJust, // Spread words out to fit width.
+ ESCHER_AlignTextInvalid // Invalid
+};
+
+// flags for pictures
+enum ESCHER_BlipFlags
+{
+ ESCHER_BlipFlagDefault = 0,
+ ESCHER_BlipFlagComment = 0, // Blip name is a comment
+ ESCHER_BlipFlagFile, // Blip name is a file name
+ ESCHER_BlipFlagURL, // Blip name is a full URL
+ ESCHER_BlipFlagType = 3, // Mask to extract type
+ /* Or the following flags with any of the above. */
+ ESCHER_BlipFlagDoNotSave = 4,
+ ESCHER_BlipFlagLinkToFile = 8
+};
+
+//
+enum ESCHER_3DRenderMode
+{
+ ESCHER_FullRender, // Generate a full rendering
+ ESCHER_Wireframe, // Generate a wireframe
+ ESCHER_BoundingCube // Generate a bounding cube
+};
+
+//
+enum ESCHER_xFormType
+{
+ ESCHER_xFormAbsolute, // Apply transform in absolute space centered on shape
+ ESCHER_xFormShape, // Apply transform to shape geometry
+ ESCHER_xFormDrawing // Apply transform in drawing space
+};
+
+//
+enum ESCHER_ShadowType
+{
+ ESCHER_ShadowOffset, // N pixel offset shadow
+ ESCHER_ShadowDouble, // Use second offset too
+ ESCHER_ShadowRich, // Rich perspective shadow (cast relative to shape)
+ ESCHER_ShadowShape, // Rich perspective shadow (cast in shape space)
+ ESCHER_ShadowDrawing, // Perspective shadow cast in drawing space
+ ESCHER_ShadowEmbossOrEngrave
+};
+
+// - the type of a (length) measurement
+enum ESCHER_dzType
+ {
+ ESCHER_dzTypeMin = 0,
+ ESCHER_dzTypeDefault = 0, // Default size, ignore the values
+ ESCHER_dzTypeA = 1, // Values are in EMUs
+ ESCHER_dzTypeV = 2, // Values are in pixels
+ ESCHER_dzTypeShape = 3, // Values are 16.16 fractions of shape size
+ ESCHER_dzTypeFixedAspect = 4, // Aspect ratio is fixed
+ ESCHER_dzTypeAFixed = 5, // EMUs, fixed aspect ratio
+ ESCHER_dzTypeVFixed = 6, // Pixels, fixed aspect ratio
+ ESCHER_dzTypeShapeFixed = 7, // Proportion of shape, fixed aspect ratio
+ ESCHER_dzTypeFixedAspectEnlarge= 8, // Aspect ratio is fixed, favor larger size
+ ESCHER_dzTypeAFixedBig = 9, // EMUs, fixed aspect ratio
+ ESCHER_dzTypeVFixedBig = 10, // Pixels, fixed aspect ratio
+ ESCHER_dzTypeShapeFixedBig= 11, // Proportion of shape, fixed aspect ratio
+ ESCHER_dzTypeMax = 11
+};
+
+// how to interpret the colors in a shaded fill.
+enum ESCHER_ShadeType
+{
+ ESCHER_ShadeNone = 0, // Interpolate without correction between RGBs
+ ESCHER_ShadeGamma = 1, // Apply gamma correction to colors
+ ESCHER_ShadeSigma = 2, // Apply a sigma transfer function to position
+ ESCHER_ShadeBand = 4, // Add a flat band at the start of the shade
+ ESCHER_ShadeOneColor = 8, // This is a one color shade
+
+ /* A parameter for the band or sigma function can be stored in the top
+ 16 bits of the value - this is a proportion of *each* band of the
+ shade to make flat (or the approximate equal value for a sigma
+ function). NOTE: the parameter is not used for the sigma function,
+ instead a built in value is used. This value should not be changed
+ from the default! */
+ ESCHER_ShadeParameterShift = 16,
+ ESCHER_ShadeParameterMask = 0xffff0000,
+
+ ESCHER_ShadeDefault = (ESCHER_ShadeGamma|ESCHER_ShadeSigma|
+ (16384<<ESCHER_ShadeParameterShift))
+};
+
+// compound line style
+enum ESCHER_LineStyle
+{
+ ESCHER_LineSimple, // Single line (of width lineWidth)
+ ESCHER_LineDouble, // Double lines of equal width
+ ESCHER_LineThickThin, // Double lines, one thick, one thin
+ ESCHER_LineThinThick, // Double lines, reverse order
+ ESCHER_LineTriple // Three lines, thin, thick, thin
+};
+
+// how to "fill" the line contour
+enum ESCHER_LineType
+{
+ ESCHER_lineSolidType, // Fill with a solid color
+ ESCHER_linePattern, // Fill with a pattern (bitmap)
+ ESCHER_lineTexture, // A texture (pattern with its own color map)
+ ESCHER_linePicture // Center a picture in the shape
+};
+
+// dashed line style
+enum ESCHER_LineDashing
+{
+ ESCHER_LineSolid, // Solid (continuous) pen
+ ESCHER_LineDashSys, // PS_DASH system dash style
+ ESCHER_LineDotSys, // PS_DOT system dash style
+ ESCHER_LineDashDotSys, // PS_DASHDOT system dash style
+ ESCHER_LineDashDotDotSys, // PS_DASHDOTDOT system dash style
+ ESCHER_LineDotGEL, // square dot style
+ ESCHER_LineDashGEL, // dash style
+ ESCHER_LineLongDashGEL, // long dash style
+ ESCHER_LineDashDotGEL, // dash short dash
+ ESCHER_LineLongDashDotGEL, // long dash short dash
+ ESCHER_LineLongDashDotDotGEL // long dash short dash short dash
+};
+
+// line end effect
+enum ESCHER_LineEnd
+{
+ ESCHER_LineNoEnd,
+ ESCHER_LineArrowEnd,
+ ESCHER_LineArrowStealthEnd,
+ ESCHER_LineArrowDiamondEnd,
+ ESCHER_LineArrowOvalEnd,
+ ESCHER_LineArrowOpenEnd
+};
+
+// size of arrowhead
+enum ESCHER_LineWidth
+{
+ ESCHER_LineNarrowArrow,
+ ESCHER_LineMediumWidthArrow,
+ ESCHER_LineWideArrow
+};
+
+// size of arrowhead
+enum ESCHER_LineEndLenght
+{
+ ESCHER_LineShortArrow,
+ ESCHER_LineMediumLenArrow,
+ ESCHER_LineLongArrow
+};
+
+// line join style.
+enum ESCHER_LineJoin
+{
+ ESCHER_LineJoinBevel, // Join edges by a straight line
+ ESCHER_LineJoinMiter, // Extend edges until they join
+ ESCHER_LineJoinRound // Draw an arc between the two edges
+};
+
+// line cap style (applies to ends of dash segments too).
+enum ESCHER_LineCap
+{
+ ESCHER_LineEndCapRound, // Rounded ends - the default
+ ESCHER_LineEndCapSquare, // Square protrudes by half line width
+ ESCHER_LineEndCapFlat // Line ends at end point
+};
+
+// Shape Properties
+// 1pt = 12700 EMU (English Metric Units)
+// 1pt = 20 Twip = 20/1440" = 1/72"
+// 1twip=635 EMU
+// 1" = 12700*72 = 914400 EMU
+// 1" = 25.4mm
+// 1mm = 36000 EMU
+// Transform
+#define ESCHER_Prop_Rotation 4 /* Fixed Point 16.16 degrees */
+// Protection
+#define ESCHER_Prop_LockRotation 119 /* sal_Bool No rotation */
+#define ESCHER_Prop_LockAspectRatio 120 /* sal_Bool Don't allow changes in aspect ratio */
+#define ESCHER_Prop_LockPosition 121 /* sal_Bool Don't allow the shape to be moved */
+#define ESCHER_Prop_LockAgainstSelect 122 /* sal_Bool Shape may not be selected */
+#define ESCHER_Prop_LockCropping 123 /* sal_Bool No cropping this shape */
+#define ESCHER_Prop_LockVertices 124 /* sal_Bool Edit Points not allowed */
+#define ESCHER_Prop_LockText 125 /* sal_Bool Do not edit text */
+#define ESCHER_Prop_LockAdjustHandles 126 /* sal_Bool Do not adjust */
+#define ESCHER_Prop_LockAgainstGrouping 127 /* sal_Bool Do not group this shape */
+// Text
+#define ESCHER_Prop_lTxid 128 /* LONG id for the text, value determined by the host */
+#define ESCHER_Prop_dxTextLeft 129 /* LONG margins relative to shape's inscribed */
+#define ESCHER_Prop_dyTextTop 130 /* LONG text rectangle (in EMUs) */
+#define ESCHER_Prop_dxTextRight 131 /* LONG */
+#define ESCHER_Prop_dyTextBottom 132 /* LONG */
+#define ESCHER_Prop_WrapText 133 /* MSOWRAPMODE Wrap text at shape margins */
+#define ESCHER_Prop_scaleText 134 /* LONG Text zoom/scale (used if fFitTextToShape) */
+#define ESCHER_Prop_AnchorText 135 /* ESCHER_AnchorText How to anchor the text */
+#define ESCHER_Prop_txflTextFlow 136 /* MSOTXFL Text flow */
+#define ESCHER_Prop_cdirFont 137 /* MSOCDIR Font rotation */
+#define ESCHER_Prop_hspNext 138 /* MSOHSP ID of the next shape (used by Word for linked textboxes) */
+#define ESCHER_Prop_txdir 139 /* MSOTXDIR Bi-Di Text direction */
+#define ESCHER_Prop_SelectText 187 /* sal_Bool sal_True if single click selects text, sal_False if two clicks */
+#define ESCHER_Prop_AutoTextMargin 188 /* sal_Bool use host's margin calculations */
+#define ESCHER_Prop_RotateText 189 /* sal_Bool Rotate text with shape */
+#define ESCHER_Prop_FitShapeToText 190 /* sal_Bool Size shape to fit text size */
+#define ESCHER_Prop_FitTextToShape 191 /* sal_Bool Size text to fit shape size */
+// GeoText
+#define ESCHER_Prop_gtextUNICODE 192 /* WCHAR* UNICODE text string */
+#define ESCHER_Prop_gtextRTF 193 /* char* RTF text string */
+#define ESCHER_Prop_gtextAlign 194 /* MSOGEOTEXTALIGN alignment on curve */
+#define ESCHER_Prop_gtextSize 195 /* LONG default point size */
+#define ESCHER_Prop_gtextSpacing 196 /* LONG fixed point 16.16 */
+#define ESCHER_Prop_gtextFont 197 /* WCHAR* font family name */
+#define ESCHER_Prop_gtextFReverseRows 240 /* sal_Bool Reverse row order */
+#define ESCHER_Prop_fGtext 241 /* sal_Bool Has text effect */
+#define ESCHER_Prop_gtextFVertical 242 /* sal_Bool Rotate characters */
+#define ESCHER_Prop_gtextFKern 243 /* sal_Bool Kern characters */
+#define ESCHER_Prop_gtextFTight 244 /* sal_Bool Tightening or tracking */
+#define ESCHER_Prop_gtextFStretch 245 /* sal_Bool Stretch to fit shape */
+#define ESCHER_Prop_gtextFShrinkFit 246 /* sal_Bool Char bounding box */
+#define ESCHER_Prop_gtextFBestFit 247 /* sal_Bool Scale text-on-path */
+#define ESCHER_Prop_gtextFNormalize 248 /* sal_Bool Stretch char height */
+#define ESCHER_Prop_gtextFDxMeasure 249 /* sal_Bool Do not measure along path */
+#define ESCHER_Prop_gtextFBold 250 /* sal_Bool Bold font */
+#define ESCHER_Prop_gtextFItalic 251 /* sal_Bool Italic font */
+#define ESCHER_Prop_gtextFUnderline 252 /* sal_Bool Underline font */
+#define ESCHER_Prop_gtextFShadow 253 /* sal_Bool Shadow font */
+#define ESCHER_Prop_gtextFSmallcaps 254 /* sal_Bool Small caps font */
+#define ESCHER_Prop_gtextFStrikethrough 255 /* sal_Bool Strike through font */
+// Blip
+#define ESCHER_Prop_cropFromTop 256 /* LONG 16.16 fraction times total */
+#define ESCHER_Prop_cropFromBottom 257 /* LONG image width or height, */
+#define ESCHER_Prop_cropFromLeft 258 /* LONG as appropriate. */
+#define ESCHER_Prop_cropFromRight 259 /* LONG */
+#define ESCHER_Prop_pib 260 /* IMsoBlip* Blip to display */
+#define ESCHER_Prop_pibName 261 /* WCHAR* Blip file name */
+#define ESCHER_Prop_pibFlags 262 /* MSOBLIPFLAGS Blip flags */
+#define ESCHER_Prop_pictureTransparent 263 /* LONG transparent color (none if ~0UL) */
+#define ESCHER_Prop_pictureContrast 264 /* LONG contrast setting */
+#define ESCHER_Prop_pictureBrightness 265 /* LONG brightness setting */
+#define ESCHER_Prop_pictureGamma 266 /* LONG 16.16 gamma */
+#define ESCHER_Prop_pictureId 267 /* LONG Host-defined ID for OLE objects (usually a pointer) */
+#define ESCHER_Prop_pictureDblCrMod 268 /* MSOCLR Modification used if shape has double shadow */
+#define ESCHER_Prop_pictureFillCrMod 269 /* MSOCLR */
+#define ESCHER_Prop_pictureLineCrMod 270 /* MSOCLR */
+#define ESCHER_Prop_pibPrint 271 /* IMsoBlip* Blip to display when printing */
+#define ESCHER_Prop_pibPrintName 272 /* WCHAR* Blip file name */
+#define ESCHER_Prop_pibPrintFlags 273 /* MSOBLIPFLAGS Blip flags */
+#define ESCHER_Prop_fNoHitTestPicture 316 /* sal_Bool Do not hit test the picture */
+#define ESCHER_Prop_pictureGray 317 /* sal_Bool grayscale display */
+#define ESCHER_Prop_pictureBiLevel 318 /* sal_Bool bi-level display */
+#define ESCHER_Prop_pictureActive 319 /* sal_Bool Server is active (OLE objects only) */
+// Geometry
+#define ESCHER_Prop_geoLeft 320 /* LONG Defines the G (geometry) coordinate space. */
+#define ESCHER_Prop_geoTop 321 /* LONG */
+#define ESCHER_Prop_geoRight 322 /* LONG */
+#define ESCHER_Prop_geoBottom 323 /* LONG */
+#define ESCHER_Prop_shapePath 324 /* MSOSHAPEPATH */
+#define ESCHER_Prop_pVertices 325 /* IMsoArray An array of points, in G units. */
+#define ESCHER_Prop_pSegmentInfo 326 /* IMsoArray */
+#define ESCHER_Prop_adjustValue 327 /* LONG Adjustment values corresponding to */
+#define ESCHER_Prop_adjust2Value 328 /* LONG the positions of the adjust handles */
+#define ESCHER_Prop_adjust3Value 329 /* LONG of the shape. The number of values */
+#define ESCHER_Prop_adjust4Value 330 /* LONG used and their allowable ranges vary */
+#define ESCHER_Prop_adjust5Value 331 /* LONG from shape type to shape type. */
+#define ESCHER_Prop_adjust6Value 332 /* LONG */
+#define ESCHER_Prop_adjust7Value 333 /* LONG */
+#define ESCHER_Prop_adjust8Value 334 /* LONG */
+#define ESCHER_Prop_adjust9Value 335 /* LONG */
+#define ESCHER_Prop_adjust10Value 336 /* LONG */
+#define ESCHER_Prop_fShadowOK 378 /* sal_Bool Shadow may be set */
+#define ESCHER_Prop_f3DOK 379 /* sal_Bool 3D may be set */
+#define ESCHER_Prop_fLineOK 380 /* sal_Bool Line style may be set */
+#define ESCHER_Prop_fGtextOK 381 /* sal_Bool Text effect (FontWork) supported */
+#define ESCHER_Prop_fFillShadeShapeOK 382 /* sal_Bool */
+#define ESCHER_Prop_fFillOK 383 /* sal_Bool OK to fill the shape through the UI or VBA? */
+// FillStyle
+#define ESCHER_Prop_fillType 384 /* ESCHER_FillStyle Type of fill */
+#define ESCHER_Prop_fillColor 385 /* MSOCLR Foreground color */
+#define ESCHER_Prop_fillOpacity 386 /* LONG Fixed 16.16 */
+#define ESCHER_Prop_fillBackColor 387 /* MSOCLR Background color */
+#define ESCHER_Prop_fillBackOpacity 388 /* LONG Shades only */
+#define ESCHER_Prop_fillCrMod 389 /* MSOCLR Modification for BW views */
+#define ESCHER_Prop_fillBlip 390 /* IMsoBlip* Pattern/texture */
+#define ESCHER_Prop_fillBlipName 391 /* WCHAR* Blip file name */
+#define ESCHER_Prop_fillBlipFlags 392 /* MSOBLIPFLAGS Blip flags */
+#define ESCHER_Prop_fillWidth 393 /* LONG How big (A units) to make a metafile texture. */
+#define ESCHER_Prop_fillHeight 394 /* LONG */
+#define ESCHER_Prop_fillAngle 395 /* LONG Fade angle - degrees in 16.16 */
+#define ESCHER_Prop_fillFocus 396 /* LONG Linear shaded fill focus percent */
+#define ESCHER_Prop_fillToLeft 397 /* LONG Fraction 16.16 */
+#define ESCHER_Prop_fillToTop 398 /* LONG Fraction 16.16 */
+#define ESCHER_Prop_fillToRight 399 /* LONG Fraction 16.16 */
+#define ESCHER_Prop_fillToBottom 400 /* LONG Fraction 16.16 */
+#define ESCHER_Prop_fillRectLeft 401 /* LONG For shaded fills, use the specified rectangle */
+#define ESCHER_Prop_fillRectTop 402 /* LONG instead of the shape's bounding rect to */
+#define ESCHER_Prop_fillRectRight 403 /* LONG define how large the fade is going to be. */
+#define ESCHER_Prop_fillRectBottom 404 /* LONG */
+#define ESCHER_Prop_fillDztype 405 /* MSODZTYPE */
+#define ESCHER_Prop_fillShadePreset 406 /* LONG Special shades */
+#define ESCHER_Prop_fillShadeColors 407 /* IMsoArray a preset array of colors */
+#define ESCHER_Prop_fillOriginX 408 /* LONG */
+#define ESCHER_Prop_fillOriginY 409 /* LONG */
+#define ESCHER_Prop_fillShapeOriginX 410 /* LONG */
+#define ESCHER_Prop_fillShapeOriginY 411 /* LONG */
+#define ESCHER_Prop_fillShadeType 412 /* MSOSHADETYPE Type of shading, if a shaded (gradient) fill. */
+#define ESCHER_Prop_fFilled 443 /* sal_Bool Is shape filled? */
+#define ESCHER_Prop_fHitTestFill 444 /* sal_Bool Should we hit test fill? */
+#define ESCHER_Prop_fillShape 445 /* sal_Bool Register pattern on shape */
+#define ESCHER_Prop_fillUseRect 446 /* sal_Bool Use the large rect? */
+#define ESCHER_Prop_fNoFillHitTest 447 /* sal_Bool Hit test a shape as though filled */
+// LineStyle
+#define ESCHER_Prop_lineColor 448 /* MSOCLR Color of line */
+#define ESCHER_Prop_lineOpacity 449 /* LONG Not implemented */
+#define ESCHER_Prop_lineBackColor 450 /* MSOCLR Background color */
+#define ESCHER_Prop_lineCrMod 451 /* MSOCLR Modification for BW views */
+#define ESCHER_Prop_lineType 452 /* MSOLINETYPE Type of line */
+#define ESCHER_Prop_lineFillBlip 453 /* IMsoBlip* Pattern/texture */
+#define ESCHER_Prop_lineFillBlipName 454 /* WCHAR* Blip file name */
+#define ESCHER_Prop_lineFillBlipFlags 455 /* MSOBLIPFLAGS Blip flags */
+#define ESCHER_Prop_lineFillWidth 456 /* LONG How big (A units) to make */
+#define ESCHER_Prop_lineFillHeight 457 /* LONG a metafile texture. */
+#define ESCHER_Prop_lineFillDztype 458 /* MSODZTYPE How to interpret fillWidth/Height numbers. */
+#define ESCHER_Prop_lineWidth 459 /* LONG A units; 1pt == 12700 EMUs */
+#define ESCHER_Prop_lineMiterLimit 460 /* LONG ratio (16.16) of width */
+#define ESCHER_Prop_lineStyle 461 /* MSOLINESTYLE Draw parallel lines? */
+#define ESCHER_Prop_lineDashing 462 /* MSOLINEDASHING Can be overridden by: */
+#define ESCHER_Prop_lineDashStyle 463 /* IMsoArray As Win32 ExtCreatePen */
+#define ESCHER_Prop_lineStartArrowhead 464 /* MSOLINEEND Arrow at start */
+#define ESCHER_Prop_lineEndArrowhead 465 /* MSOLINEEND Arrow at end */
+#define ESCHER_Prop_lineStartArrowWidth 466 /* MSOLINEENDWIDTH Arrow at start */
+#define ESCHER_Prop_lineStartArrowLength 467 /* MSOLINEENDLENGTH Arrow at end */
+#define ESCHER_Prop_lineEndArrowWidth 468 /* MSOLINEENDWIDTH Arrow at start */
+#define ESCHER_Prop_lineEndArrowLength 469 /* MSOLINEENDLENGTH Arrow at end */
+#define ESCHER_Prop_lineJoinStyle 470 /* MSOLINEJOIN How to join lines */
+#define ESCHER_Prop_lineEndCapStyle 471 /* MSOLINECAP How to end lines */
+#define ESCHER_Prop_fArrowheadsOK 507 /* sal_Bool Allow arrowheads if prop. is set */
+#define ESCHER_Prop_fLine 508 /* sal_Bool Any line? */
+#define ESCHER_Prop_fHitTestLine 509 /* sal_Bool Should we hit test lines? */
+#define ESCHER_Prop_lineFillShape 510 /* sal_Bool Register pattern on shape */
+#define ESCHER_Prop_fNoLineDrawDash 511 /* sal_Bool Draw a dashed line if no line */
+// ShadowStyle
+#define ESCHER_Prop_shadowType 512 /* MSOSHADOWTYPE Type of effect */
+#define ESCHER_Prop_shadowColor 513 /* MSOCLR Foreground color */
+#define ESCHER_Prop_shadowHighlight 514 /* MSOCLR Embossed color */
+#define ESCHER_Prop_shadowCrMod 515 /* MSOCLR Modification for BW views */
+#define ESCHER_Prop_shadowOpacity 516 /* LONG Fixed 16.16 */
+#define ESCHER_Prop_shadowOffsetX 517 /* LONG Offset shadow */
+#define ESCHER_Prop_shadowOffsetY 518 /* LONG Offset shadow */
+#define ESCHER_Prop_shadowSecondOffsetX 519 /* LONG Double offset shadow */
+#define ESCHER_Prop_shadowSecondOffsetY 520 /* LONG Double offset shadow */
+#define ESCHER_Prop_shadowScaleXToX 521 /* LONG 16.16 */
+#define ESCHER_Prop_shadowScaleYToX 522 /* LONG 16.16 */
+#define ESCHER_Prop_shadowScaleXToY 523 /* LONG 16.16 */
+#define ESCHER_Prop_shadowScaleYToY 524 /* LONG 16.16 */
+#define ESCHER_Prop_shadowPerspectiveX 525 /* LONG 16.16 / weight */
+#define ESCHER_Prop_shadowPerspectiveY 526 /* LONG 16.16 / weight */
+#define ESCHER_Prop_shadowWeight 527 /* LONG scaling factor */
+#define ESCHER_Prop_shadowOriginX 528 /* LONG */
+#define ESCHER_Prop_shadowOriginY 529 /* LONG */
+#define ESCHER_Prop_fShadow 574 /* sal_Bool Any shadow? */
+#define ESCHER_Prop_fshadowObscured 575 /* sal_Bool Excel5-style shadow */
+// PerspectiveStyle
+#define ESCHER_Prop_perspectiveType 576 /* MSOXFORMTYPE Where transform applies */
+#define ESCHER_Prop_perspectiveOffsetX 577 /* LONG The LONG values define a */
+#define ESCHER_Prop_perspectiveOffsetY 578 /* LONG transformation matrix, */
+#define ESCHER_Prop_perspectiveScaleXToX 579 /* LONG effectively, each value */
+#define ESCHER_Prop_perspectiveScaleYToX 580 /* LONG is scaled by the */
+#define ESCHER_Prop_perspectiveScaleXToY 581 /* LONG perspectiveWeight parameter. */
+#define ESCHER_Prop_perspectiveScaleYToY 582 /* LONG */
+#define ESCHER_Prop_perspectivePerspectiveX 583 /* LONG */
+#define ESCHER_Prop_perspectivePerspectiveY 584 /* LONG */
+#define ESCHER_Prop_perspectiveWeight 585 /* LONG Scaling factor */
+#define ESCHER_Prop_perspectiveOriginX 586 /* LONG */
+#define ESCHER_Prop_perspectiveOriginY 587 /* LONG */
+#define ESCHER_Prop_fPerspective 639 /* sal_Bool On/off */
+// 3D Object
+#define ESCHER_Prop_c3DSpecularAmt 640 /* LONG Fixed-point 16.16 */
+#define ESCHER_Prop_c3DDiffuseAmt 641 /* LONG Fixed-point 16.16 */
+#define ESCHER_Prop_c3DShininess 642 /* LONG Default gives OK results */
+#define ESCHER_Prop_c3DEdgeThickness 643 /* LONG Specular edge thickness */
+#define ESCHER_Prop_c3DExtrudeForward 644 /* LONG Distance of extrusion in EMUs */
+#define ESCHER_Prop_c3DExtrudeBackward 645 /* LONG */
+#define ESCHER_Prop_c3DExtrudePlane 646 /* LONG Extrusion direction */
+#define ESCHER_Prop_c3DExtrusionColor 647 /* MSOCLR Basic color of extruded part of shape; the lighting model used will determine the exact shades used when rendering. */
+#define ESCHER_Prop_c3DCrMod 648 /* MSOCLR Modification for BW views */
+#define ESCHER_Prop_f3D 700 /* sal_Bool Does this shape have a 3D effect? */
+#define ESCHER_Prop_fc3DMetallic 701 /* sal_Bool Use metallic specularity? */
+#define ESCHER_Prop_fc3DUseExtrusionColor 702 /* sal_Bool */
+#define ESCHER_Prop_fc3DLightFace 703 /* sal_Bool */
+// 3D Style
+#define ESCHER_Prop_c3DYRotationAngle 704 /* LONG degrees (16.16) about y axis */
+#define ESCHER_Prop_c3DXRotationAngle 705 /* LONG degrees (16.16) about x axis */
+#define ESCHER_Prop_c3DRotationAxisX 706 /* LONG These specify the rotation axis; */
+#define ESCHER_Prop_c3DRotationAxisY 707 /* LONG only their relative magnitudes */
+#define ESCHER_Prop_c3DRotationAxisZ 708 /* LONG matter. */
+#define ESCHER_Prop_c3DRotationAngle 709 /* LONG degrees (16.16) about axis */
+#define ESCHER_Prop_c3DRotationCenterX 710 /* LONG rotation center x (16.16 or g-units) */
+#define ESCHER_Prop_c3DRotationCenterY 711 /* LONG rotation center y (16.16 or g-units) */
+#define ESCHER_Prop_c3DRotationCenterZ 712 /* LONG rotation center z (absolute (emus)) */
+#define ESCHER_Prop_c3DRenderMode 713 /* MSO3DRENDERMODE Full,wireframe, or bcube */
+#define ESCHER_Prop_c3DTolerance 714 /* LONG pixels (16.16) */
+#define ESCHER_Prop_c3DXViewpoint 715 /* LONG X view point (emus) */
+#define ESCHER_Prop_c3DYViewpoint 716 /* LONG Y view point (emus) */
+#define ESCHER_Prop_c3DZViewpoint 717 /* LONG Z view distance (emus) */
+#define ESCHER_Prop_c3DOriginX 718 /* LONG */
+#define ESCHER_Prop_c3DOriginY 719 /* LONG */
+#define ESCHER_Prop_c3DSkewAngle 720 /* LONG degree (16.16) skew angle */
+#define ESCHER_Prop_c3DSkewAmount 721 /* LONG Percentage skew amount */
+#define ESCHER_Prop_c3DAmbientIntensity 722 /* LONG Fixed point intensity */
+#define ESCHER_Prop_c3DKeyX 723 /* LONG Key light source direc- */
+#define ESCHER_Prop_c3DKeyY 724 /* LONG tion; only their relative */
+#define ESCHER_Prop_c3DKeyZ 725 /* LONG magnitudes matter */
+#define ESCHER_Prop_c3DKeyIntensity 726 /* LONG Fixed point intensity */
+#define ESCHER_Prop_c3DFillX 727 /* LONG Fill light source direc- */
+#define ESCHER_Prop_c3DFillY 728 /* LONG tion; only their relative */
+#define ESCHER_Prop_c3DFillZ 729 /* LONG magnitudes matter */
+#define ESCHER_Prop_c3DFillIntensity 730 /* LONG Fixed point intensity */
+#define ESCHER_Prop_fc3DConstrainRotation 763 /* sal_Bool */
+#define ESCHER_Prop_fc3DRotationCenterAuto 764 /* sal_Bool */
+#define ESCHER_Prop_fc3DParallel 765 /* sal_Bool Parallel projection? */
+#define ESCHER_Prop_fc3DKeyHarsh 766 /* sal_Bool Is key lighting harsh? */
+#define ESCHER_Prop_fc3DFillHarsh 767 /* sal_Bool Is fill lighting harsh? */
+// Shape
+#define ESCHER_Prop_hspMaster 769 /* MSOHSP master shape */
+#define ESCHER_Prop_cxstyle 771 /* MSOCXSTYLE Type of connector */
+#define ESCHER_Prop_bWMode 772 /* ESCHERwMode Settings for modifications to */
+#define ESCHER_Prop_bWModePureBW 773 /* ESCHERwMode be made when in different */
+#define ESCHER_Prop_bWModeBW 774 /* ESCHERwMode forms of black-and-white mode. */
+#define ESCHER_Prop_fOleIcon 826 /* sal_Bool For OLE objects, whether the object is in icon form */
+#define ESCHER_Prop_fPreferRelativeResize 827 /* sal_Bool For UI only. Prefer relative resizing. */
+#define ESCHER_Prop_fLockShapeType 828 /* sal_Bool Lock the shape type (don't allow Change Shape) */
+#define ESCHER_Prop_fDeleteAttachedObject 830 /* sal_Bool */
+#define ESCHER_Prop_fBackground 831 /* sal_Bool If sal_True, this is the background shape. */
+// Callout
+#define ESCHER_Prop_spcot 832 /* MSOSPCOT Callout type */
+#define ESCHER_Prop_dxyCalloutGap 833 /* LONG Distance from box to first point.(EMUs) */
+#define ESCHER_Prop_spcoa 834 /* MSOSPCOA Callout angle */
+#define ESCHER_Prop_spcod 835 /* MSOSPCOD Callout drop type */
+#define ESCHER_Prop_dxyCalloutDropSpecified 836 /* LONG if msospcodSpecified, the actual drop distance */
+#define ESCHER_Prop_dxyCalloutLengthSpecified 837 /* LONG if fCalloutLengthSpecified, the actual distance */
+#define ESCHER_Prop_fCallout 889 /* sal_Bool Is the shape a callout? */
+#define ESCHER_Prop_fCalloutAccentBar 890 /* sal_Bool does callout have accent bar */
+#define ESCHER_Prop_fCalloutTextBorder 891 /* sal_Bool does callout have a text border */
+#define ESCHER_Prop_fCalloutMinusX 892 /* sal_Bool */
+#define ESCHER_Prop_fCalloutMinusY 893 /* sal_Bool */
+#define ESCHER_Prop_fCalloutDropAuto 894 /* sal_Bool If true, then we occasionally invert the drop distance */
+#define ESCHER_Prop_fCalloutLengthSpecified 895 /* sal_Bool if true, we look at dxyCalloutLengthSpecified */
+// GroupShape
+#define ESCHER_Prop_wzName 896 /* WCHAR* Shape Name (present only if explicitly set) */
+#define ESCHER_Prop_wzDescription 897 /* WCHAR* alternate text */
+#define ESCHER_Prop_pihlShape 898 /* IHlink* The hyperlink in the shape. */
+#define ESCHER_Prop_pWrapPolygonVertices 899 /* IMsoArray The polygon that text will be wrapped around (Word) */
+#define ESCHER_Prop_dxWrapDistLeft 900 /* LONG Left wrapping distance from text (Word) */
+#define ESCHER_Prop_dyWrapDistTop 901 /* LONG Top wrapping distance from text (Word) */
+#define ESCHER_Prop_dxWrapDistRight 902 /* LONG Right wrapping distance from text (Word) */
+#define ESCHER_Prop_dyWrapDistBottom 903 /* LONG Bottom wrapping distance from text (Word) */
+#define ESCHER_Prop_lidRegroup 904 /* LONG Regroup ID */
+#define ESCHER_Prop_tableProperties 927
+#define ESCHER_Prop_tableRowProperties 928
+#define ESCHER_Prop_fEditedWrap 953 /* sal_Bool Has the wrap polygon been edited? */
+#define ESCHER_Prop_fBehindDocument 954 /* sal_Bool Word-only (shape is behind text) */
+#define ESCHER_Prop_fOnDblClickNotify 955 /* sal_Bool Notify client on a double click */
+#define ESCHER_Prop_fIsButton 956 /* sal_Bool A button shape (i.e., clicking performs an action). Set for shapes with attached hyperlinks or macros. */
+#define ESCHER_Prop_fOneD 957 /* sal_Bool 1D adjustment */
+#define ESCHER_Prop_fHidden 958 /* sal_Bool Do not display */
+#define ESCHER_Prop_fPrint 959 /* sal_Bool Print this shape */
+
+#define ESCHER_PERSISTENTRY_PREALLOCATE 64
+
+#define ESCHER_Persist_PrivateEntry 0x80000000
+#define ESCHER_Persist_Dgg 0x00010000
+#define ESCHER_Persist_Dg 0x00020000
+#define ESCHER_Persist_CurrentPosition 0x00040000
+#define ESCHER_Persist_Grouping_Snap 0x00050000
+#define ESCHER_Persist_Grouping_Logic 0x00060000
+
+const sal_uInt32 DFF_DGG_CLUSTER_SIZE = 0x00000400; /// Shape IDs per cluster in DGG atom.
+
+// ---------------------------------------------------------------------------------------------
+
+namespace com { namespace sun { namespace star {
+ namespace awt {
+ struct Gradient;
+ }
+ namespace drawing {
+ struct EnhancedCustomShapeAdjustmentValue;
+ class XShape;
+ class XShapes;
+ }
+}}}
+
+struct MSFILTER_DLLPUBLIC EscherConnectorListEntry
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mXConnector;
+ ::com::sun::star::awt::Point maPointA;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mXConnectToA;
+ ::com::sun::star::awt::Point maPointB;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mXConnectToB;
+
+ sal_uInt32 GetConnectorRule( sal_Bool bFirst );
+
+ EscherConnectorListEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rC,
+ const ::com::sun::star::awt::Point& rPA,
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rSA ,
+ const ::com::sun::star::awt::Point& rPB,
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rSB ) :
+ mXConnector ( rC ),
+ maPointA ( rPA ),
+ mXConnectToA( rSA ),
+ maPointB ( rPB ),
+ mXConnectToB( rSB ) {}
+
+ sal_uInt32 GetClosestPoint( const Polygon& rPoly, const ::com::sun::star::awt::Point& rP );
+};
+
+struct MSFILTER_DLLPUBLIC EscherExContainer
+{
+ sal_uInt32 nContPos;
+ SvStream& rStrm;
+
+ EscherExContainer( SvStream& rSt, const sal_uInt16 nRecType, const sal_uInt16 nInstance = 0 );
+ ~EscherExContainer();
+};
+
+struct MSFILTER_DLLPUBLIC EscherExAtom
+{
+ sal_uInt32 nContPos;
+ SvStream& rStrm;
+
+ EscherExAtom( SvStream& rSt, const sal_uInt16 nRecType, const sal_uInt16 nInstance = 0, const sal_uInt8 nVersion = 0 );
+ ~EscherExAtom();
+};
+
+struct EscherPropertyValueHelper
+{
+ static sal_Bool GetPropertyValue(
+ ::com::sun::star::uno::Any& rAny,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
+ const OUString& rPropertyName,
+ sal_Bool bTestPropertyAvailability = sal_False
+ );
+
+ static ::com::sun::star::beans::PropertyState GetPropertyState(
+ const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > &,
+ const OUString& rPropertyName
+ );
+};
+
+// ---------------------------------------------------------------------------------------------
+
+struct EscherPersistEntry
+{
+ sal_uInt32 mnID;
+ sal_uInt32 mnOffset;
+
+ EscherPersistEntry( sal_uInt32 nId, sal_uInt32 nOffset ) { mnID = nId; mnOffset = nOffset; };
+
+};
+
+// ---------------------------------------------------------------------------------------------
+
+class EscherBlibEntry
+{
+
+ friend class EscherGraphicProvider;
+ friend class EscherEx;
+
+protected:
+
+ sal_uInt32 mnIdentifier[ 4 ];
+ sal_uInt32 mnPictureOffset; // offset to the graphic im PictureStreams
+ sal_uInt32 mnSize; // size of real graphic
+
+ sal_uInt32 mnRefCount; // !! reference count
+ sal_uInt32 mnSizeExtra; // !! size of preceding header
+
+ ESCHER_BlibType meBlibType;
+
+ Size maPrefSize;
+ MapMode maPrefMapMode;
+
+ sal_Bool mbIsEmpty;
+ sal_Bool mbIsNativeGraphicPossible;
+
+public:
+
+ EscherBlibEntry(
+ sal_uInt32 nPictureOffset,
+ const GraphicObject& rObj,
+ const OString& rId,
+ const GraphicAttr* pAttr = NULL
+ );
+
+ ~EscherBlibEntry();
+
+ void WriteBlibEntry( SvStream& rSt, sal_Bool bWritePictureOffset, sal_uInt32 nResize = 0 );
+ sal_Bool IsEmpty() const { return mbIsEmpty; };
+
+ sal_Bool operator==( const EscherBlibEntry& ) const;
+};
+
+// ---------------------------------------------------------------------------------------------
+
+#define _E_GRAPH_PROV_USE_INSTANCES 1
+#define _E_GRAPH_PROV_DO_NOT_ROTATE_METAFILES 2
+
+class MSFILTER_DLLPUBLIC EscherGraphicProvider
+{
+ sal_uInt32 mnFlags;
+
+ EscherBlibEntry** mpBlibEntrys;
+ sal_uInt32 mnBlibBufSize;
+ sal_uInt32 mnBlibEntrys;
+
+ OUString maBaseURI;
+
+protected:
+
+ sal_uInt32 ImplInsertBlib( EscherBlibEntry* p_EscherBlibEntry );
+
+public:
+
+ sal_uInt32 GetBlibStoreContainerSize( SvStream* pMergePicStreamBSE = NULL ) const;
+ void WriteBlibStoreContainer( SvStream& rStrm, SvStream* pMergePicStreamBSE = NULL );
+ sal_Bool WriteBlibStoreEntry(SvStream& rStrm, sal_uInt32 nBlipId,
+ sal_Bool bWritePictureOffset, sal_uInt32 nResize = 0);
+ sal_uInt32 GetBlibID(
+ SvStream& rPicOutStream,
+ const OString& rGraphicId,
+ const Rectangle& rBoundRect,
+ const com::sun::star::awt::Rectangle* pVisArea = NULL,
+ const GraphicAttr* pGrafikAttr = NULL
+ );
+ sal_Bool HasGraphics() const { return mnBlibEntrys != 0; };
+
+ void SetNewBlipStreamOffset( sal_Int32 nOffset );
+
+ sal_Bool GetPrefSize( const sal_uInt32 nBlibId, Size& rSize, MapMode& rMapMode );
+
+ void SetBaseURI( const OUString& rBaseURI ) { maBaseURI = rBaseURI; };
+ const OUString& GetBaseURI() { return maBaseURI; };
+
+ EscherGraphicProvider( sal_uInt32 nFlags = _E_GRAPH_PROV_DO_NOT_ROTATE_METAFILES );
+ ~EscherGraphicProvider();
+
+};
+
+struct EscherShapeListEntry;
+typedef ::std::vector< EscherShapeListEntry* > EscherShapeList_impl;
+typedef ::std::vector< EscherConnectorListEntry* > EscherConnectorList_impl;
+
+class MSFILTER_DLLPUBLIC EscherSolverContainer
+{
+ EscherShapeList_impl maShapeList;
+ EscherConnectorList_impl maConnectorList;
+
+public:
+
+ sal_uInt32 GetShapeId(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rShape
+ ) const;
+
+ void AddShape(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > &,
+ sal_uInt32 nId
+ );
+
+ void AddConnector(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > &,
+ const ::com::sun::star::awt::Point& rA,
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > &,
+ const ::com::sun::star::awt::Point& rB,
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rConB
+ );
+
+ void WriteSolver( SvStream& );
+
+ EscherSolverContainer(){};
+ ~EscherSolverContainer();
+};
+
+// ---------------------------------------------------------------------------------------------
+
+#define ESCHER_CREATEPOLYGON_LINE 1
+#define ESCHER_CREATEPOLYGON_POLYLINE 2
+#define ESCHER_CREATEPOLYGON_POLYPOLYGON 4
+
+class GraphicAttr;
+class SdrObjCustomShape;
+
+struct EscherPropSortStruct
+{
+ sal_uInt8* pBuf;
+ sal_uInt32 nPropSize;
+ sal_uInt32 nPropValue;
+ sal_uInt16 nPropId;
+};
+
+typedef std::vector< EscherPropSortStruct > EscherProperties;
+
+class MSFILTER_DLLPUBLIC EscherPropertyContainer
+{
+ EscherGraphicProvider* pGraphicProvider;
+ SvStream* pPicOutStrm;
+ Rectangle* pShapeBoundRect;
+
+ EscherPropSortStruct* pSortStruct;
+
+ sal_uInt32 nSortCount;
+ sal_uInt32 nSortBufSize;
+ sal_uInt32 nCountCount;
+ sal_uInt32 nCountSize;
+
+ sal_Bool bHasComplexData;
+ sal_Bool bSuppressRotation;
+
+
+ sal_uInt32 ImplGetColor( const sal_uInt32 rColor, sal_Bool bSwap = sal_True );
+ void ImplCreateGraphicAttributes(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
+ sal_uInt32 nBlibId,
+ sal_Bool bCreateCroppingAttributes
+ );
+ sal_Bool ImplCreateEmbeddedBmp( const OString& rUniqueId );
+ void ImplInit();
+
+public:
+
+ EscherPropertyContainer();
+ EscherPropertyContainer(
+ EscherGraphicProvider& rGraphicProvider, // the PropertyContainer needs to know
+ SvStream* pPicOutStrm, // the GraphicProvider to be able to write
+ Rectangle& rShapeBoundRect // FillBitmaps or GraphicObjects.
+ ); // under some circumstances the ShapeBoundRect
+ // is adjusted this will happen when rotated
+ // GraphicObjects are saved to PowerPoint
+ ~EscherPropertyContainer();
+
+ void AddOpt( sal_uInt16 nPropertyID, const OUString& rString );
+
+ void AddOpt(
+ sal_uInt16 nPropertyID,
+ sal_uInt32 nPropValue,
+ sal_Bool bBlib = sal_False
+ );
+
+ void AddOpt(
+ sal_uInt16 nPropertyID,
+ sal_Bool bBlib,
+ sal_uInt32 nPropValue,
+ sal_uInt8* pProp,
+ sal_uInt32 nPropSize
+ );
+
+ sal_Bool GetOpt( sal_uInt16 nPropertyID, sal_uInt32& rPropValue ) const;
+
+ sal_Bool GetOpt( sal_uInt16 nPropertyID, EscherPropSortStruct& rPropValue ) const;
+
+ EscherProperties GetOpts() const;
+
+ void Commit( SvStream& rSt, sal_uInt16 nVersion = 3, sal_uInt16 nRecType = ESCHER_OPT );
+
+ sal_Bool CreateShapeProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape
+ );
+ sal_Bool CreateOLEGraphicProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXOleObject
+ );
+
+ /** Creates a complex ESCHER_Prop_fillBlip containing the BLIP directly (for Excel charts). */
+ sal_Bool CreateEmbeddedBitmapProperties(
+ const OUString& rBitmapUrl,
+ ::com::sun::star::drawing::BitmapMode eBitmapMode
+ );
+ /** Creates a complex ESCHER_Prop_fillBlip containing a hatch style (for Excel charts). */
+ sal_Bool CreateEmbeddedHatchProperties(
+ const ::com::sun::star::drawing::Hatch& rHatch,
+ const Color& rBackColor,
+ bool bFillBackground
+ );
+
+ // the GraphicProperties will only be created if a GraphicProvider and PicOutStrm is known
+ // DR: #99897# if no GraphicProvider is present, a complex ESCHER_Prop_fillBlip
+ // will be created, containing the BLIP directly (e.g. for Excel charts).
+ sal_Bool CreateGraphicProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
+ const OUString& rSource,
+ const sal_Bool bCreateFillBitmap,
+ const sal_Bool bCreateCroppingAttributes = sal_False,
+ const sal_Bool bFillBitmapModeAllowed = sal_True
+ );
+
+ sal_Bool CreatePolygonProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
+ sal_uInt32 nFlags,
+ sal_Bool bBezier,
+ ::com::sun::star::awt::Rectangle& rGeoRect,
+ Polygon* pPolygon = NULL
+ );
+
+ static sal_uInt32 GetGradientColor(
+ const ::com::sun::star::awt::Gradient* pGradient,
+ sal_uInt32 nStartColor
+ );
+
+ void CreateGradientProperties( const ::com::sun::star::awt::Gradient & rGradient );
+ void CreateGradientProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &
+ );
+ void CreateLineProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
+ sal_Bool bEdge
+ );
+ void CreateFillProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, sal_Bool bEdge );
+ void CreateTextProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
+ sal_uInt32 nText,
+ const sal_Bool bIsCustomShape = sal_False,
+ const sal_Bool bIsTextFrame = sal_True
+ );
+
+ sal_Bool CreateConnectorProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape,
+ EscherSolverContainer& rSolver,
+ ::com::sun::star::awt::Rectangle& rGeoRect,
+ sal_uInt16& rShapeType,
+ sal_uInt16& rShapeFlags
+ );
+
+ // Because shadow properties depends to the line and fillstyle, the CreateShadowProperties method should be called at last.
+ // It activ only when at least a FillStyle or LineStyle is set.
+ sal_Bool CreateShadowProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &
+ );
+
+ // creates all necessary CustomShape properties, this includes also Text-, Shadow-, Fill-, and LineProperties
+ void CreateCustomShapeProperties(
+ const MSO_SPT eShapeType,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > &
+ );
+ sal_Bool IsFontWork() const;
+
+ // helper functions which are also used by the escher import
+ static PolyPolygon GetPolyPolygon(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape
+ );
+ static PolyPolygon GetPolyPolygon( const ::com::sun::star::uno::Any& rSource );
+ static MSO_SPT GetCustomShapeType(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape,
+ sal_uInt32& nMirrorFlags
+ );
+ static MSO_SPT GetCustomShapeType(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape,
+ sal_uInt32& nMirrorFlags,
+ OUString& rShapeType
+ );
+
+ // helper functions which are also used in ooxml export
+ static sal_Bool GetLineArrow(
+ const sal_Bool bLineStart,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
+ ESCHER_LineEnd& reLineEnd,
+ sal_Int32& rnArrowLength,
+ sal_Int32& rnArrowWidth
+ );
+ static sal_Bool IsDefaultObject( SdrObjCustomShape* pCustoShape );
+ static void LookForPolarHandles(
+ const MSO_SPT eShapeType,
+ sal_Int32& nAdjustmentsWhichNeedsToBeConverted
+ );
+ static sal_Bool GetAdjustmentValue( const com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue & rkProp, sal_Int32 nIndex, sal_Int32 nAdjustmentsWhichNeedsToBeConverted, sal_Int32& nValue );
+};
+
+// ---------------------------------------------------------------------------------------------
+
+typedef ::std::vector< EscherPersistEntry* > EscherPersistTable_impl;
+
+class MSFILTER_DLLPUBLIC EscherPersistTable
+{
+
+public:
+ EscherPersistTable_impl maPersistTable;
+
+ sal_Bool PtIsID( sal_uInt32 nID );
+ void PtInsert( sal_uInt32 nID, sal_uInt32 nOfs );
+ sal_uInt32 PtDelete( sal_uInt32 nID );
+ sal_uInt32 PtGetOffsetByID( sal_uInt32 nID );
+ sal_uInt32 PtReplace( sal_uInt32 nID, sal_uInt32 nOfs );
+ sal_uInt32 PtReplaceOrInsert( sal_uInt32 nID, sal_uInt32 nOfs );
+ sal_uInt32 PtGetCount() const { return maPersistTable.size(); };
+
+ EscherPersistTable();
+ virtual ~EscherPersistTable();
+};
+
+// ---------------------------------------------------------------------------------------------
+
+class EscherEx;
+
+/// abstract base class for ESCHER_ClientTextbox, ESCHER_ClientData
+class MSFILTER_DLLPUBLIC EscherExClientRecord_Base
+{
+public:
+ EscherExClientRecord_Base() {}
+ virtual ~EscherExClientRecord_Base();
+
+ /// Application writes the record header
+ /// using rEx.AddAtom(...) followed by
+ /// record data written to rEx.GetStream()
+ virtual void WriteData( EscherEx& rEx ) const = 0;
+};
+
+
+/// abstract base class for ESCHER_ClientAnchor
+class MSFILTER_DLLPUBLIC EscherExClientAnchor_Base
+{
+public:
+ EscherExClientAnchor_Base() {}
+ virtual ~EscherExClientAnchor_Base();
+
+ /// Application writes the record header
+ /// using rEx.AddAtom(...) followed by
+ /// record data written to rEx.GetStream()
+ virtual void WriteData( EscherEx& rEx,
+ const Rectangle& rRect ) = 0;
+};
+
+class InteractionInfo
+{
+ bool mbHasInteraction;
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ std::auto_ptr<SvMemoryStream> mpHyperlinkRecord;
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+ InteractionInfo();
+
+public:
+ InteractionInfo( SvMemoryStream* pStream, bool bInteraction ) : mbHasInteraction( bInteraction )
+ {
+ mpHyperlinkRecord.reset( pStream );
+ }
+ bool hasInteraction() { return mbHasInteraction; }
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ const std::auto_ptr< SvMemoryStream >& getHyperlinkRecord() { return mpHyperlinkRecord; }
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+};
+
+class EscherExHostAppData
+{
+private:
+ EscherExClientAnchor_Base* pClientAnchor;
+ EscherExClientRecord_Base* pClientData;
+ EscherExClientRecord_Base* pClientTextbox;
+ InteractionInfo* pInteractionInfo;
+ // ignore single shape if entire pages are written
+ sal_Bool bDontWriteShape;
+
+public:
+ EscherExHostAppData() : pClientAnchor(0), pClientData(0),
+ pClientTextbox(0), pInteractionInfo(0), bDontWriteShape(sal_False)
+ {}
+
+ void SetInteractionInfo( InteractionInfo* p )
+ { pInteractionInfo = p; }
+ void SetClientAnchor( EscherExClientAnchor_Base* p )
+ { pClientAnchor = p; }
+ void SetClientData( EscherExClientRecord_Base* p )
+ { pClientData = p; }
+ void SetClientTextbox( EscherExClientRecord_Base* p )
+ { pClientTextbox = p; }
+ void SetDontWriteShape( sal_Bool b )
+ { bDontWriteShape = b; }
+ InteractionInfo* GetInteractionInfo() const
+ { return pInteractionInfo; }
+ EscherExClientAnchor_Base* GetClientAnchor() const
+ { return pClientAnchor; }
+ EscherExClientRecord_Base* GetClientData() const
+ { return pClientData; }
+ EscherExClientRecord_Base* GetClientTextbox() const
+ { return pClientTextbox; }
+
+ void WriteClientAnchor( EscherEx& rEx, const Rectangle& rRect )
+ { if( pClientAnchor ) pClientAnchor->WriteData( rEx, rRect ); }
+ void WriteClientData( EscherEx& rEx )
+ { if( pClientData ) pClientData->WriteData( rEx ); }
+ void WriteClientTextbox( EscherEx& rEx )
+ { if( pClientTextbox ) pClientTextbox->WriteData( rEx ); }
+
+ sal_Bool DontWriteShape() const { return bDontWriteShape; }
+};
+
+
+// ============================================================================
+
+/** Instance for global DFF data, shared through various instances of EscherEx. */
+class MSFILTER_DLLPUBLIC EscherExGlobal : public EscherGraphicProvider
+{
+public:
+ explicit EscherExGlobal( sal_uInt32 nGraphicProvFlags = _E_GRAPH_PROV_DO_NOT_ROTATE_METAFILES );
+ virtual ~EscherExGlobal();
+
+ /** Returns a new drawing ID for a new drawing container (DGCONTAINER). */
+ sal_uInt32 GenerateDrawingId();
+ /** Creates and returns a new shape identifier, updates the internal shape
+ counters and registers the identifier in the DGG cluster table.
+ @param nDrawingId Drawing identifier has to be passed to be able to
+ generate shape identifiers for multiple drawings simultaniously. */
+ sal_uInt32 GenerateShapeId( sal_uInt32 nDrawingId, bool bIsInSpgr );
+ /** Returns the number of shapes in the current drawing, based on number of
+ calls to the GenerateShapeId() function. */
+ sal_uInt32 GetDrawingShapeCount( sal_uInt32 nDrawingId ) const;
+ /** Returns the last shape identifier generated by the GenerateShapeId()
+ function. */
+ sal_uInt32 GetLastShapeId( sal_uInt32 nDrawingId ) const;
+
+ /** Sets the flag indicating that the DGGCONTAINER exists. */
+ inline void SetDggContainer() { mbHasDggCont = true; }
+ /** Sets the flag indicating that the DGGCONTAINER exists. */
+ inline bool HasDggContainer() const { return mbHasDggCont; }
+ /** Returns the total size of the DGG atom (including header). */
+ sal_uInt32 GetDggAtomSize() const;
+ /** Writes the complete DGG atom to the passed stream (overwrites existing data!). */
+ void WriteDggAtom( SvStream& rStrm ) const;
+
+ /** Called if a picture shall be written and no picture stream is set at
+ class ImplEscherExSdr.
+
+ On first invokation, this function calls the virtual member function
+ ImplQueryPictureStream(). The return value will be cached internally
+ for subsequent calls and for the GetPictureStream() function.
+ */
+ SvStream* QueryPictureStream();
+
+ /** Returns the picture stream if existing (queried), otherwise null. */
+ inline SvStream* GetPictureStream() { return mpPicStrm; }
+
+private:
+ /** Derived classes may implement to create a new stream used to store the
+ picture data.
+
+ The implementation has to take care about lifetime of the returned
+ stream (it will not be destructed automatically). This function is
+ called exactly once. The return value will be cached internally for
+ repeated calls of the public QueryPictureStream() function.
+ */
+ virtual SvStream* ImplQueryPictureStream();
+
+private:
+ struct ClusterEntry
+ {
+ sal_uInt32 mnDrawingId; /// Identifier of drawing this cluster belongs to (one-based index into maDrawingInfos).
+ sal_uInt32 mnNextShapeId; /// Next free shape identifier in this cluster.
+ inline explicit ClusterEntry( sal_uInt32 nDrawingId ) : mnDrawingId( nDrawingId ), mnNextShapeId( 0 ) {}
+ };
+ typedef ::std::vector< ClusterEntry > ClusterTable;
+
+ struct DrawingInfo
+ {
+ sal_uInt32 mnClusterId; /// Currently used cluster (one-based index into maClusterTable).
+ sal_uInt32 mnShapeCount; /// Current number of shapes in this drawing.
+ sal_uInt32 mnLastShapeId; /// Last shape identifier generated for this drawing.
+ inline explicit DrawingInfo( sal_uInt32 nClusterId ) : mnClusterId( nClusterId ), mnShapeCount( 0 ), mnLastShapeId( 0 ) {}
+ };
+ typedef ::std::vector< DrawingInfo > DrawingInfoVector;
+
+ ClusterTable maClusterTable; /// List with cluster IDs (used object IDs in drawings).
+ DrawingInfoVector maDrawingInfos; /// Data about all used drawings.
+ SvStream* mpPicStrm; /// Cached result of ImplQueryPictureStream().
+ bool mbHasDggCont; /// True = the DGGCONTAINER has been initialized.
+ bool mbPicStrmQueried; /// True = ImplQueryPictureStream() has been called.
+};
+
+typedef ::boost::shared_ptr< EscherExGlobal > EscherExGlobalRef;
+
+// ---------------------------------------------------------------------------------------------
+
+class SdrObject;
+class SdrPage;
+class ImplEscherExSdr;
+
+class MSFILTER_DLLPUBLIC EscherEx : public EscherPersistTable
+{
+ protected:
+ typedef ::std::auto_ptr< ImplEscherExSdr > ImplEscherExSdrPtr;
+
+ EscherExGlobalRef mxGlobal;
+ ImplEscherExSdrPtr mpImplEscherExSdr;
+ SvStream* mpOutStrm;
+ bool mbOwnsStrm;
+ sal_uInt32 mnStrmStartOfs;
+ std::vector< sal_uInt32 > mOffsets;
+ std::vector< sal_uInt16 > mRecTypes;
+
+ sal_uInt32 mnCurrentDg;
+ sal_uInt32 mnCountOfs;
+
+ sal_uInt32 mnGroupLevel;
+ sal_uInt16 mnHellLayerId;
+
+ sal_Bool mbEscherSpgr;
+ sal_Bool mbEscherDg;
+ sal_Bool mbOleEmf; // OLE is EMF instead of WMF
+
+
+ virtual sal_Bool DoSeek( sal_uInt32 nKey );
+
+public:
+ explicit EscherEx( const EscherExGlobalRef& rxGlobal, SvStream* pOutStrm );
+ virtual ~EscherEx();
+
+ /** Creates and returns a new shape identifier, updates the internal shape
+ counters and registers the identifier in the DGG cluster table. */
+ inline sal_uInt32 GenerateShapeId() { return mxGlobal->GenerateShapeId( mnCurrentDg, mbEscherSpgr ); }
+
+ /** Returns the graphic provider from the global object that has been
+ passed to the constructor.
+ */
+ inline EscherGraphicProvider& GetGraphicProvider() { return *mxGlobal; }
+
+ /** Called if a picture shall be written and no picture stream is set at
+ class ImplEscherExSdr.
+ */
+ inline SvStream* QueryPictureStream() { return mxGlobal->QueryPictureStream(); }
+
+ /// Inserts internal data into the EscherStream, this process
+ /// may and has to be executed only once
+ /// If pPicStreamMergeBSE is known, the BLIPs from this stream are being
+ /// merged into the MsofbtBSE Records of the EscherStream like it's
+ /// required for Excel (and maybe Word?)
+ virtual void Flush( SvStream* pPicStreamMergeBSE = NULL );
+
+ /** Inserts the passed number of bytes at the current position of the
+ output stream.
+
+ Inserts dummy bytes and moves all following stream data, and updates
+ all internal stream offsets stored in the PersistTable and the affected
+ container sizes, which makes this operation very expensive. (!)
+
+ @param nBytes The number of bytes to be inserted into the stream.
+
+ @param bExpandEndOfAtom If set to true, an atom that currently ends
+ exactly at the current stream position will be expanded to include
+ the inserted data. If set to false, an atom that currently ends
+ exactly at the current stream position will not be expanded to
+ include the inserted data (used to insert e.g. a new atom after an
+ existing atom). Note that containers that end exactly at the
+ current stream position are always expanded to include the inserted
+ data.
+ */
+ void InsertAtCurrentPos( sal_uInt32 nBytes, bool bExpandEndOfAtom );
+
+ void InsertPersistOffset( sal_uInt32 nKey, sal_uInt32 nOffset ); // It is not being checked if this key is already in the PersistantTable
+ void ReplacePersistOffset( sal_uInt32 nKey, sal_uInt32 nOffset );
+ sal_uInt32 GetPersistOffset( sal_uInt32 nKey );
+ sal_Bool SeekToPersistOffset( sal_uInt32 nKey );
+ virtual sal_Bool InsertAtPersistOffset( sal_uInt32 nKey, sal_uInt32 nValue ); // nValue is being inserted into the Stream where it's appropriate (overwrite modus), without that the
+ // current StreamPosition changes
+
+ SvStream& GetStream() const { return *mpOutStrm; }
+ sal_uLong GetStreamPos() const { return mpOutStrm->Tell(); }
+
+ // features during the creation of the following Containers:
+ //
+ // ESCHER_DggContainer: a EscherDgg Atom is automatically being created and managed
+ // ESCHER_DgContainer: a EscherDg Atom is automatically being created and managed
+ // ESCHER_SpgrContainer:
+ // ESCHER_SpContainer:
+
+ virtual void OpenContainer( sal_uInt16 nEscherContainer, int nRecInstance = 0 );
+ virtual void CloseContainer();
+
+ virtual void BeginAtom();
+ virtual void EndAtom( sal_uInt16 nRecType, int nRecVersion = 0, int nRecInstance = 0 );
+ virtual void AddAtom( sal_uInt32 nAtomSitze, sal_uInt16 nRecType, int nRecVersion = 0, int nRecInstance = 0 );
+ virtual void AddChildAnchor( const Rectangle& rRectangle );
+ virtual void AddClientAnchor( const Rectangle& rRectangle );
+
+ virtual sal_uInt32 EnterGroup( const OUString& rShapeName, const Rectangle* pBoundRect = 0 );
+ sal_uInt32 EnterGroup( const Rectangle* pBoundRect = NULL );
+ sal_uInt32 GetGroupLevel() const { return mnGroupLevel; };
+ virtual sal_Bool SetGroupSnapRect( sal_uInt32 nGroupLevel, const Rectangle& rRect );
+ virtual sal_Bool SetGroupLogicRect( sal_uInt32 nGroupLevel, const Rectangle& rRect );
+ virtual void LeaveGroup();
+
+ // a ESCHER_Sp is being written ( a ESCHER_DgContainer has to be opened for this purpose!)
+ virtual void AddShape( sal_uInt32 nShpInstance, sal_uInt32 nFlagIds, sal_uInt32 nShapeID = 0 );
+
+ virtual void Commit( EscherPropertyContainer& rProps, const Rectangle& rRect );
+
+ sal_uInt32 GetColor( const sal_uInt32 nColor, sal_Bool bSwap = sal_True );
+ sal_uInt32 GetColor( const Color& rColor, sal_Bool bSwap = sal_True );
+
+ // ...Sdr... implemented in eschesdo.cxx
+
+ void AddSdrPage( const SdrPage& rPage );
+ void AddUnoShapes( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes );
+
+ /// returns the ShapeID
+ sal_uInt32 AddSdrObject( const SdrObject& rObj );
+
+ /// If objects are written through AddSdrObject the
+ /// SolverContainer has to be written, and maybe some
+ /// maintenance to be done.
+ void EndSdrObjectPage();
+
+ /// Called before a shape is written, application supplies
+ /// ClientRecords. May set AppData::bDontWriteShape so the
+ /// shape is ignored.
+ virtual EscherExHostAppData* StartShape(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rShape,
+ const Rectangle* pChildAnchor );
+
+ /// Called after a shape is written to inform the application
+ /// of the resulted shape type and ID.
+ virtual void EndShape( sal_uInt16 nShapeType, sal_uInt32 nShapeID );
+
+ /// Called before an AdditionalText EnterGroup occurs.
+ /// The current shape will be written in three parts:
+ /// a group shape, the shape itself, and an extra textbox shape.
+ /// The complete flow is:
+ /// StartShape sets HostData1.
+ /// EnterAdditionalTextGroup sets HostData2, App may modify
+ /// HostData1 and keep track of the change.
+ /// The group shape is written with HostData2.
+ /// Another StartShape with the same (!) object sets HostData3.
+ /// The current shape is written with HostData3.
+ /// EndShape is called for the current shape.
+ /// Another StartShape with the same (!) object sets HostData4.
+ /// The textbox shape is written with HostData4.
+ /// EndShape is called for the textbox shape.
+ /// EndShape is called for the group shape, this provides
+ /// the same functionality as an ordinary recursive group.
+ virtual EscherExHostAppData* EnterAdditionalTextGroup();
+
+ /// Called if an ESCHER_Prop_lTxid shall be written
+ virtual sal_uInt32 QueryTextID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >&, sal_uInt32 nShapeId );
+ // add an dummy rectangle shape into the escher stream
+ sal_uInt32 AddDummyShape();
+
+ static const SdrObject* GetSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rXShape );
+
+ void SetHellLayerId( sal_uInt16 nId ) { mnHellLayerId = nId; }
+ sal_uInt16 GetHellLayerId() const { return mnHellLayerId; }
+
+private:
+ EscherEx( const EscherEx& );
+ EscherEx& operator=( const EscherEx& );
+
+ // prevent C-style cast to former base class EscherGraphicProvider
+ operator EscherGraphicProvider&();
+ operator EscherGraphicProvider const&();
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/mscodec.hxx b/include/filter/msfilter/mscodec.hxx
new file mode 100644
index 000000000000..f321441e2941
--- /dev/null
+++ b/include/filter/msfilter/mscodec.hxx
@@ -0,0 +1,370 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVX_MSCODEC_HXX
+#define SVX_MSCODEC_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/beans/NamedValue.hpp>
+
+#include <rtl/cipher.h>
+#include <rtl/digest.h>
+#include "filter/msfilter/msfilterdllapi.h"
+
+namespace msfilter {
+
+// ============================================================================
+
+/** Encodes and decodes data from protected MSO 95- documents.
+ */
+class MSFILTER_DLLPUBLIC MSCodec_Xor95
+{
+public:
+ explicit MSCodec_Xor95(int nRotateDistance);
+ virtual ~MSCodec_Xor95();
+
+ /** Initializes the algorithm with the specified password.
+
+ @param pPassData
+ Character array containing the password. Must be zero terminated,
+ which results in a maximum length of 15 characters.
+ */
+ void InitKey( const sal_uInt8 pnPassData[ 16 ] );
+
+ /** Initializes the algorithm with the encryption data.
+
+ @param aData
+ The sequence contains the necessary data to initialize
+ the codec.
+ */
+ sal_Bool InitCodec( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aData );
+
+ /** Retrieves the encryption data
+
+ @return
+ The sequence contains the necessary data to initialize
+ the codec.
+ */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetEncryptionData();
+
+
+ /** Verifies the validity of the password using the passed key and hash.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param nKey
+ Password key value read from the file.
+ @param nHash
+ Password hash value read from the file.
+
+ @return
+ true = Test was successful.
+ */
+ bool VerifyKey( sal_uInt16 nKey, sal_uInt16 nHash ) const;
+
+ /** Reinitializes the codec to start a new memory block.
+
+ Resets the internal key offset to 0.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+ */
+ void InitCipher();
+
+ /** Decodes a block of memory inplace.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param pnData
+ Encrypted data block. Will contain the decrypted data afterwards.
+ @param nBytes
+ Size of the passed data block.
+ */
+ virtual void Decode( sal_uInt8* pnData, sal_Size nBytes )=0;
+
+ /** Lets the cipher skip a specific amount of bytes.
+
+ This function sets the cipher to the same state as if the specified
+ amount of data has been decoded with one or more calls of Decode().
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param nBytes
+ Number of bytes to be skipped (cipher "seeks" forward).
+ */
+ void Skip( sal_Size nBytes );
+
+protected:
+ sal_uInt8 mpnKey[ 16 ]; /// Encryption key.
+ sal_Size mnOffset; /// Key offset.
+
+private:
+ MSFILTER_DLLPRIVATE MSCodec_Xor95( const MSCodec_Xor95& );
+ MSFILTER_DLLPRIVATE MSCodec_Xor95& operator=( const MSCodec_Xor95& );
+
+ sal_uInt16 mnKey; /// Base key from password.
+ sal_uInt16 mnHash; /// Hash value from password.
+ int mnRotateDistance;
+};
+
+/** Encodes and decodes data from protected MSO XLS 95- documents.
+ */
+class MSFILTER_DLLPUBLIC MSCodec_XorXLS95 : public MSCodec_Xor95
+{
+public:
+ explicit MSCodec_XorXLS95() : MSCodec_Xor95(2) {}
+
+ /** Decodes a block of memory inplace.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param pnData
+ Encrypted data block. Will contain the decrypted data afterwards.
+ @param nBytes
+ Size of the passed data block.
+ */
+ virtual void Decode( sal_uInt8* pnData, sal_Size nBytes );
+};
+
+/** Encodes and decodes data from protected MSO Word 95- documents.
+ */
+class MSFILTER_DLLPUBLIC MSCodec_XorWord95 : public MSCodec_Xor95
+{
+public:
+ explicit MSCodec_XorWord95() : MSCodec_Xor95(7) {}
+
+ /** Decodes a block of memory inplace.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param pnData
+ Encrypted data block. Will contain the decrypted data afterwards.
+ @param nBytes
+ Size of the passed data block.
+ */
+ virtual void Decode( sal_uInt8* pnData, sal_Size nBytes );
+};
+
+
+// ============================================================================
+
+/** Encodes and decodes data from protected MSO 97+ documents.
+
+ This is a wrapper class around low level cryptographic functions from RTL.
+ Implementation is based on the wvDecrypt package by Caolan McNamara:
+ http://www.csn.ul.ie/~caolan/docs/wvDecrypt.html
+ */
+class MSFILTER_DLLPUBLIC MSCodec_Std97
+{
+public:
+ explicit MSCodec_Std97();
+ ~MSCodec_Std97();
+
+ /** Initializes the algorithm with the encryption data.
+
+ @param aData
+ The sequence contains the necessary data to initialize
+ the codec.
+ */
+ sal_Bool InitCodec( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aData );
+
+ /** Retrieves the encryption data
+
+ @return
+ The sequence contains the necessary data to initialize
+ the codec.
+ */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetEncryptionData();
+
+
+ /** Initializes the algorithm with the specified password and document ID.
+
+ @param pPassData
+ Wide character array containing the password. Must be zero
+ terminated, which results in a maximum length of 15 characters.
+ @param pDocId
+ Unique document identifier read from or written to the file.
+ */
+ void InitKey(
+ const sal_uInt16 pPassData[ 16 ],
+ const sal_uInt8 pDocId[ 16 ] );
+
+ /** Verifies the validity of the password using the passed salt data.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param pSaltData
+ Salt data block read from the file.
+ @param pSaltDigest
+ Salt digest read from the file.
+
+ @return
+ true = Test was successful.
+ */
+ bool VerifyKey(
+ const sal_uInt8 pSaltData[ 16 ],
+ const sal_uInt8 pSaltDigest[ 16 ] );
+
+ /** Rekeys the codec using the specified counter.
+
+ After reading a specific amount of data the cipher algorithm needs to
+ be rekeyed using a counter that counts the data blocks.
+
+ The block size is for example 512 Bytes for Word files and 1024 Bytes
+ for Excel files.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param nCounter
+ Block counter used to rekey the cipher.
+ */
+ bool InitCipher( sal_uInt32 nCounter );
+
+ /** Creates an MD5 digest of salt digest. */
+ bool CreateSaltDigest(
+ const sal_uInt8 nSaltData[16], sal_uInt8 nSaltDigest[16] );
+
+ /** Encodes a block of memory.
+
+ @see rtl_cipher_encode()
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used. The destination buffer must be able to take all
+ unencoded data from the source buffer (usually this means it must be
+ as long as or longer than the source buffer).
+
+ @param pData
+ Unencrypted source data block.
+ @param nDatLen
+ Size of the passed source data block.
+ @param pBuffer
+ Destination buffer for the encrypted data.
+ @param nBufLen
+ Size of the destination buffer.
+
+ @return
+ true = Encoding was successful (no error occurred).
+ */
+ bool Encode(
+ const void* pData, sal_Size nDatLen,
+ sal_uInt8* pBuffer, sal_Size nBufLen );
+
+ /** Decodes a block of memory.
+
+ @see rtl_cipher_decode()
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used. The destination buffer must be able to take all
+ encoded data from the source buffer (usually this means it must be
+ as long as or longer than the source buffer).
+
+ @param pData
+ Encrypted source data block.
+ @param nDatLen
+ Size of the passed source data block.
+ @param pBuffer
+ Destination buffer for the decrypted data.
+ @param nBufLen
+ Size of the destination buffer.
+
+ @return
+ true = Decoding was successful (no error occurred).
+ */
+ bool Decode(
+ const void* pData, sal_Size nDatLen,
+ sal_uInt8* pBuffer, sal_Size nBufLen );
+
+ /** Lets the cipher skip a specific amount of bytes.
+
+ This function sets the cipher to the same state as if the specified
+ amount of data has been decoded with one or more calls of Decode().
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param nDatLen
+ Number of bytes to be skipped (cipher "seeks" forward).
+ */
+ bool Skip( sal_Size nDatLen );
+
+ /** Gets salt data and salt digest.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param pSalt
+ Salt, a random number.
+ @param pSaltData
+ Salt data block generated from the salt.
+ @param pSaltDigest
+ Salt digest generated from the salt.
+ */
+ void GetEncryptKey (
+ const sal_uInt8 pSalt[16],
+ sal_uInt8 pSaltData[16],
+ sal_uInt8 pSaltDigest[16]);
+
+ /* allows to get the unique document id from the codec
+ */
+ void GetDocId( sal_uInt8 pDocId[16] );
+
+ void GetDigestFromSalt( const sal_uInt8 pSaltData[16], sal_uInt8 pDigest[16] );
+
+private:
+ void InitKeyImpl(
+ const sal_uInt8 pKeyData[64],
+ const sal_uInt8 pDocId[16] );
+
+
+private:
+ MSFILTER_DLLPRIVATE MSCodec_Std97( const MSCodec_Std97& );
+ MSFILTER_DLLPRIVATE MSCodec_Std97& operator=( const MSCodec_Std97& );
+
+ rtlCipher m_hCipher;
+ rtlDigest m_hDigest;
+ sal_uInt8 m_pDigestValue[ RTL_DIGEST_LENGTH_MD5 ];
+ sal_uInt8 m_pDocId[16];
+};
+
+// ============================================================================
+
+} // namespace msfilter
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/msdffimp.hxx b/include/filter/msfilter/msdffimp.hxx
new file mode 100644
index 000000000000..6359277f49f4
--- /dev/null
+++ b/include/filter/msfilter/msdffimp.hxx
@@ -0,0 +1,809 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef FLT_MSDFFIMP_HXX
+#define FLT_MSDFFIMP_HXX
+
+#include <string.h>
+
+#include <map>
+#include <vector>
+#include <set>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/scoped_ptr.hpp>
+#include <boost/ptr_container/ptr_vector.hpp>
+#include <boost/ptr_container/ptr_set.hpp>
+
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include <tools/solar.h>
+#include <tools/color.hxx>
+#include <tools/gen.hxx>
+
+#include <sot/storage.hxx>
+
+#include <vcl/graph.hxx>
+
+#include <svx/msdffdef.hxx>
+#include <filter/msfilter/dffpropset.hxx>
+#include <filter/msfilter/dffrecordheader.hxx>
+
+#include <filter/msfilter/msfilterdllapi.h>
+
+class Graphic;
+class SvStream;
+class SdrObject;
+class SdrOle2Obj;
+class SotStorageRef;
+class Polygon;
+class PolyPolygon;
+class FmFormModel;
+class SdrModel;
+class SwFlyFrmFmt;
+
+struct SvxMSDffBLIPInfo;
+struct SvxMSDffShapeInfo;
+struct SvxMSDffShapeOrder;
+
+class SvxMSDffManager;
+class SfxItemSet;
+class SdrObject;
+class SdrTextObj;
+struct DffObjData;
+
+class MSFILTER_DLLPUBLIC DffPropertyReader : public DffPropSet
+{
+ const SvxMSDffManager& rManager;
+ DffPropSet* pDefaultPropSet;
+
+ void ApplyCustomShapeTextAttributes( SfxItemSet& rSet ) const;
+ void CheckAndCorrectExcelTextRotation( SvStream& rIn, SfxItemSet& rSet, DffObjData& rObjData ) const;
+ void ApplyCustomShapeAdjustmentAttributes( SfxItemSet& rSet ) const;
+ void ApplyCustomShapeGeometryAttributes( SvStream& rIn,
+ SfxItemSet& rSet,
+ const DffObjData& rObjData ) const;
+ void ApplyLineAttributes( SfxItemSet& rSet, const MSO_SPT eShapeType ) const; // #i28269#
+ void ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, const DffObjData& rObjData ) const;
+
+public:
+ sal_Int32 mnFix16Angle;
+ explicit DffPropertyReader( const SvxMSDffManager& rManager );
+ ~DffPropertyReader();
+ sal_Int32 Fix16ToAngle( sal_Int32 nAngle ) const;
+
+#ifdef DBG_CUSTOMSHAPE
+ void ReadPropSet( SvStream& rIn, void* pClientData, sal_uInt32 nShapeType = 0 ) const;
+#else
+ void ReadPropSet( SvStream& rIn, void* pClientData ) const;
+#endif
+
+ void SetDefaultPropSet( SvStream& rIn, sal_uInt32 nOffDgg ) const;
+ void ApplyAttributes( SvStream& rIn, SfxItemSet& rSet ) const;
+ void ApplyAttributes( SvStream& rIn, SfxItemSet& rSet, DffObjData& rObjData ) const;
+};
+
+#define COL_DEFAULT RGB_COLORDATA( 0xFA, 0xFB, 0xFC )
+
+typedef ::std::map< sal_Int32, SdrObject* > SvxMSDffShapeIdContainer;
+
+#define SVEXT_PERSIST_STREAM "\002OlePres000"
+
+// the following two will be sorted by the order of their appearance:
+typedef boost::ptr_vector<SvxMSDffBLIPInfo> SvxMSDffBLIPInfos;
+class SvxMSDffShapeOrders : public std::vector<SvxMSDffShapeOrder*>
+{
+public:
+ ~SvxMSDffShapeOrders();
+};
+
+struct MSFILTER_DLLPUBLIC CompareSvxMSDffShapeInfoById
+{
+ bool operator()(::boost::shared_ptr<SvxMSDffShapeInfo> const& lhs,
+ ::boost::shared_ptr<SvxMSDffShapeInfo> const& rhs) const;
+};
+struct MSFILTER_DLLPUBLIC CompareSvxMSDffShapeInfoByTxBxComp
+{
+ bool operator()(::boost::shared_ptr<SvxMSDffShapeInfo> const& lhs,
+ ::boost::shared_ptr<SvxMSDffShapeInfo> const& rhs) const;
+};
+
+// the following will be sorted explicitly:
+typedef ::std::set< ::boost::shared_ptr<SvxMSDffShapeInfo>,
+ CompareSvxMSDffShapeInfoById > SvxMSDffShapeInfos_ById;
+typedef ::std::multiset< ::boost::shared_ptr<SvxMSDffShapeInfo>,
+ CompareSvxMSDffShapeInfoByTxBxComp> SvxMSDffShapeInfos_ByTxBxComp;
+
+#define SVXMSDFF_SETTINGS_CROP_BITMAPS 1
+#define SVXMSDFF_SETTINGS_IMPORT_PPT 2
+#define SVXMSDFF_SETTINGS_IMPORT_EXCEL 4
+
+#define SP_FGROUP 0x001 ///< This shape is a group shape
+#define SP_FCHILD 0x002 ///< Not a top-level shape
+#define SP_FPATRIARCH 0x004 ///< This is the topmost group shape.
+ ///< Exactly one of these per drawing.
+#define SP_FDELETED 0x008 ///< The shape has been deleted
+#define SP_FOLESHAPE 0x010 ///< The shape is an OLE object
+#define SP_FHAVEMASTER 0x020 ///< Shape has a hspMaster property
+#define SP_FFLIPH 0x040 ///< Shape is flipped horizontally
+#define SP_FFLIPV 0x080 ///< Shape is flipped vertically
+#define SP_FCONNECTOR 0x100 ///< Connector type of shape
+#define SP_FHAVEANCHOR 0x200 ///< Shape has an anchor of some kind
+#define SP_FBACKGROUND 0x400 ///< Background shape
+#define SP_FHAVESPT 0x800 ///< Shape has a shape type property
+
+// for the CreateSdrOLEFromStorage we need the information, how we handle
+// convert able OLE-Objects - this ist stored in
+#define OLE_MATHTYPE_2_STARMATH 0x0001
+#define OLE_WINWORD_2_STARWRITER 0x0002
+#define OLE_EXCEL_2_STARCALC 0x0004
+#define OLE_POWERPOINT_2_STARIMPRESS 0x0008
+
+struct SvxMSDffConnectorRule
+{
+ sal_uInt32 nRuleId;
+ sal_uInt32 nShapeA; ///< SPID of shape A
+ sal_uInt32 nShapeB; ///< SPID of shape B
+ sal_uInt32 nShapeC; ///< SPID of connector shape
+ sal_uInt32 ncptiA; ///< Connection site Index of shape A
+ sal_uInt32 ncptiB; ///< Connection site Index of shape B
+ sal_uInt32 nSpFlagsA; ///< SpFlags of shape A (the original mirror flags
+ ///< must be known when solving the Solver Container)
+ sal_uInt32 nSpFlagsB; ///< SpFlags of shape B
+
+ SdrObject* pAObj; ///< pPtr of object (corresponding to shape A)
+ SdrObject* pBObj; ///< pPtr of object (corresponding to shape B)
+ SdrObject* pCObj; ///< pPtr of connector object
+
+ SvxMSDffConnectorRule() : nSpFlagsA( 0 ), nSpFlagsB( 0 ), pAObj( NULL ),
+ pBObj( NULL ), pCObj( NULL ) {};
+
+ friend SvStream& operator>>( SvStream& rIn, SvxMSDffConnectorRule& rAtom );
+};
+
+typedef ::std::vector< SvxMSDffConnectorRule* > SvxMSDffConnectorRuleList;
+
+struct MSFILTER_DLLPUBLIC SvxMSDffSolverContainer
+{
+ SvxMSDffConnectorRuleList aCList;
+
+ SvxMSDffSolverContainer();
+ ~SvxMSDffSolverContainer();
+
+ MSFILTER_DLLPUBLIC friend SvStream& operator>>( SvStream& rIn, SvxMSDffSolverContainer& rAtom );
+};
+
+struct FIDCL
+{
+ sal_uInt32 dgid; ///< DG owning the SPIDs in this cluster
+ sal_uInt32 cspidCur; ///< number of SPIDs used so far
+};
+
+/// provided by SvxMSDffManager for each shape in a group
+struct MSDffTxId
+{
+ sal_uInt16 nTxBxS;
+ sal_uInt16 nSequence;
+ MSDffTxId( sal_uInt16 nTxBxS_, sal_uInt16 nSequence_ )
+ : nTxBxS( nTxBxS_ ), nSequence( nSequence_ ){}
+ MSDffTxId( const MSDffTxId& rCopy )
+ : nTxBxS( rCopy.nTxBxS ), nSequence( rCopy.nSequence ){}
+};
+
+struct MSFILTER_DLLPUBLIC SvxMSDffImportRec
+{
+ static const int RELTO_DEFAULT = 2;
+
+ SdrObject* pObj;
+ Polygon* pWrapPolygon;
+ char* pClientAnchorBuffer;
+ sal_uInt32 nClientAnchorLen;
+ char* pClientDataBuffer;
+ sal_uInt32 nClientDataLen;
+ sal_uInt32 nXAlign;
+ sal_uInt32 *pXRelTo;
+ sal_uInt32 nYAlign;
+ sal_uInt32 *pYRelTo;
+ sal_uInt32 nLayoutInTableCell;
+ sal_uInt32 nFlags;
+ long nTextRotationAngle;
+ long nDxTextLeft; ///< distance of text box from surrounding shape
+ long nDyTextTop;
+ long nDxTextRight;
+ long nDyTextBottom;
+ long nDxWrapDistLeft;
+ long nDyWrapDistTop;
+ long nDxWrapDistRight;
+ long nDyWrapDistBottom;
+ long nCropFromTop;
+ long nCropFromBottom;
+ long nCropFromLeft;
+ long nCropFromRight;
+ MSDffTxId aTextId; ///< identifier for text boxes
+ sal_uLong nNextShapeId; ///< for linked text boxes
+ sal_uLong nShapeId;
+ MSO_SPT eShapeType;
+ MSO_LineStyle eLineStyle; ///< border types
+ MSO_LineDashing eLineDashing;
+ sal_Bool bDrawHell :1;
+ sal_Bool bHidden :1;
+ sal_Bool bReplaceByFly :1;
+ sal_Bool bLastBoxInChain :1;
+ sal_Bool bHasUDefProp :1;
+ sal_Bool bVFlip :1;
+ sal_Bool bHFlip :1;
+ sal_Bool bAutoWidth :1;
+ int relativeHorizontalWidth; ///< in 0.1% or -1 for none
+ bool isHorizontalRule;
+
+ SvxMSDffImportRec();
+ SvxMSDffImportRec(const SvxMSDffImportRec& rCopy);
+ ~SvxMSDffImportRec();
+
+ bool operator==( const SvxMSDffImportRec& rEntry ) const
+ { return nShapeId == rEntry.nShapeId; }
+ bool operator<( const SvxMSDffImportRec& rEntry ) const
+ { return nShapeId < rEntry.nShapeId; }
+
+private:
+ SvxMSDffImportRec &operator=(const SvxMSDffImportRec&);
+};
+
+/** list of all SvxMSDffImportRec instances of/for a group */
+class MSDffImportRecords
+ : public ::boost::ptr_set<SvxMSDffImportRec>
+{};
+
+/** block of parameters for import/export for a single call of
+ ImportObjAtCurrentStreamPos() */
+struct SvxMSDffImportData
+{
+ MSDffImportRecords aRecords; ///< Shape pointer, Shape ids and private data
+ Rectangle aParentRect;///< Rectangle of the surrounding groups,
+ ///< which might have been provided externally
+ Rectangle aNewRect; ///< Rectangle that is defined by this shape
+
+ SvxMSDffImportData()
+ {}
+ explicit SvxMSDffImportData( const Rectangle& rParentRect ) : aParentRect( rParentRect ) {}
+ void SetNewRect(sal_Int32 left, sal_Int32 top, sal_Int32 right, sal_Int32 bottom )
+ { aNewRect = Rectangle(left, top, right, bottom); }
+ sal_Bool HasParRect() const { return aParentRect.IsEmpty(); }
+ sal_Bool HasNewRect() const { return aNewRect.IsEmpty() ; }
+ bool empty() const { return aRecords.empty(); }
+ size_t size() const { return aRecords.size(); }
+ MSDffImportRecords::const_iterator begin() const { return aRecords.begin(); }
+ MSDffImportRecords::const_iterator end() const { return aRecords.end(); }
+};
+
+struct DffObjData
+{
+ const DffRecordHeader& rSpHd;
+
+ Rectangle aBoundRect;
+ Rectangle aChildAnchor;
+
+ sal_uInt32 nShapeId;
+ sal_uInt32 nSpFlags;
+ MSO_SPT eShapeType;
+
+ sal_Bool bShapeType : 1;
+ sal_Bool bClientAnchor : 1;
+ sal_Bool bClientData : 1;
+ sal_Bool bChildAnchor : 1;
+ sal_Bool bOpt : 1;
+ sal_Bool bOpt2 : 1;
+ sal_Bool bIsAutoText : 1;
+ sal_Bool bRotateTextWithShape : 1;
+ bool bPageAnchor;
+ int nCalledByGroup;
+
+ DffObjData( const DffRecordHeader& rObjHd,
+ const Rectangle& rBoundRect,
+ int nClByGroup ) :
+ rSpHd( rObjHd ),
+ aBoundRect( rBoundRect ),
+ nShapeId( 0 ),
+ nSpFlags( 0 ),
+ eShapeType( mso_sptNil ),
+ bShapeType( sal_False ),
+ bClientAnchor( sal_False ),
+ bClientData( sal_False ),
+ bChildAnchor( sal_False ),
+ bOpt( sal_False ),
+ bOpt2( sal_False ),
+ bIsAutoText( sal_False ),
+ bRotateTextWithShape( sal_True ),
+ bPageAnchor( true ),
+ nCalledByGroup( nClByGroup ){}
+};
+
+#define DFF_RECORD_MANAGER_BUF_SIZE 64
+
+struct DffRecordList
+{
+ sal_uInt32 nCount;
+ sal_uInt32 nCurrent;
+ DffRecordList* pPrev;
+ DffRecordList* pNext;
+
+ DffRecordHeader mHd[ DFF_RECORD_MANAGER_BUF_SIZE ];
+
+ explicit DffRecordList( DffRecordList* pList );
+ ~DffRecordList();
+};
+
+enum DffSeekToContentMode
+{
+ SEEK_FROM_BEGINNING,
+ SEEK_FROM_CURRENT,
+ SEEK_FROM_CURRENT_AND_RESTART
+};
+
+class MSFILTER_DLLPUBLIC DffRecordManager : public DffRecordList
+{
+public :
+ DffRecordList* pCList;
+
+ void Clear();
+ void Consume( SvStream& rIn,
+ sal_Bool bAppend = sal_False,
+ sal_uInt32 nStOfs = 0 );
+
+ sal_Bool SeekToContent( SvStream& rIn,
+ sal_uInt16 nRecType,
+ DffSeekToContentMode eMode = SEEK_FROM_BEGINNING );
+ DffRecordHeader* GetRecordHeader( sal_uInt16 nRecType,
+ DffSeekToContentMode eMode = SEEK_FROM_BEGINNING );
+
+ DffRecordManager();
+ explicit DffRecordManager( SvStream& rIn );
+ ~DffRecordManager();
+
+ DffRecordHeader* Current();
+ DffRecordHeader* First();
+ DffRecordHeader* Next();
+ DffRecordHeader* Prev();
+ DffRecordHeader* Last();
+};
+
+/** abstract base class for Escher imports
+
+ Purpose: access to objects in Drawing File Format
+
+ Note: The method ProcessUserDefinedRecord() _has_ to be implemented in the
+ inheriting class(es) that is/are eventually used for PowerPoint, Word,
+ or Excel importing.
+
+ Status: Currently only access to BLIPs (will be extended later)
+*/
+class MSFILTER_DLLPUBLIC SvxMSDffManager : public DffPropertyReader
+{
+ FmFormModel* pFormModel;
+ SvxMSDffBLIPInfos* pBLIPInfos;
+ ::boost::scoped_ptr<SvxMSDffShapeInfos_ByTxBxComp> m_pShapeInfosByTxBxComp;
+ ::boost::scoped_ptr<SvxMSDffShapeInfos_ById> m_pShapeInfosById;
+ SvxMSDffShapeOrders* pShapeOrders;
+ sal_uLong nDefaultFontHeight;
+ sal_uInt32 nOffsDgg;
+ sal_uInt16 nBLIPCount;
+ sal_uInt16 nShapeCount;
+ sal_uInt32 nGroupShapeFlags;
+
+ void CheckTxBxStoryChain();
+ void GetFidclData(sal_uInt32 nOffsDgg);
+
+protected :
+ typedef std::map<sal_uInt32, sal_uInt32> OffsetMap;
+
+ OUString maBaseURL;
+ sal_uInt32 mnCurMaxShapeId; // we need this information to
+ sal_uInt32 mnDrawingsSaved; // access the right drawing
+ sal_uInt32 mnIdClusters; // while only knowing the shapeid
+ std::vector<FIDCL> maFidcls;
+ OffsetMap maDgOffsetTable; ///< array of fileoffsets
+
+ friend class DffPropertyReader;
+
+ SvStream& rStCtrl;
+ SvStream* pStData;
+ SvStream* pStData2;
+ SdrModel* pSdrModel;
+
+ long nMapMul;
+ long nMapDiv;
+ long nMapXOfs;
+ long nMapYOfs;
+ long nEmuMul;
+ long nEmuDiv;
+ long nPntMul;
+ long nPntDiv;
+ bool bNeedMap;
+ sal_uInt32 nSvxMSDffSettings;
+ sal_uInt32 nSvxMSDffOLEConvFlags;
+
+ /** stores a reference to an imported SdrObject
+ with its shape id if it has one */
+ SvxMSDffShapeIdContainer maShapeIdContainer;
+
+ void GetCtrlData(sal_uInt32 nOffsDgg);
+ void GetDrawingGroupContainerData( SvStream& rSt,
+ sal_uLong nLenDgg );
+ // #156763#
+ // Add internal drawing container id as parameter to the sub methods of
+ // reading the control information about the drawing objects.
+ // The drawing container id is used to distinguish the text ids of drawing
+ // objects in different drawing containers.
+ void GetDrawingContainerData( SvStream& rSt,
+ sal_uLong nLenDg,
+ const unsigned long nDrawingContainerId );
+ sal_Bool GetShapeGroupContainerData( SvStream& rSt,
+ sal_uLong nLenShapeGroupCont,
+ sal_Bool bPatriarch,
+ const unsigned long nDrawingContainerId );
+ sal_Bool GetShapeContainerData( SvStream& rSt,
+ sal_uLong nLenShapeCont,
+ sal_uLong nPosGroup,
+ const unsigned long nDrawingContainerId );
+
+ bool ReadGraphic( SvStream& rSt, sal_uLong nIndex, Graphic& rGraphic ) const;
+ SdrObject* ImportGraphic( SvStream&, SfxItemSet&, const DffObjData& );
+ // #i32596# - pass <nCalledByGroup> to method
+ // Needed in Writer's Microsoft Word import to avoid import of OLE objects
+ // inside groups. Instead a graphic object is created.
+ virtual SdrObject* ImportOLE( long nOLEId,
+ const Graphic& rGraf,
+ const Rectangle& rBoundRect,
+ const Rectangle& rVisArea,
+ const int _nCalledByGroup,
+ sal_Int64 nAspect ) const;
+ static com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > CheckForConvertToSOObj(
+ sal_uInt32 nConvertFlags, SotStorage& rSrcStg,
+ const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xDestStg,
+ const Graphic& rGrf,
+ const Rectangle& rVisArea );
+
+// the following methods need to be overriden for Excel imports
+ virtual sal_Bool ProcessClientAnchor( SvStream& rStData,
+ sal_uInt32 nDatLen,
+ char*& rpBuff,
+ sal_uInt32& rBuffLen ) const;
+ virtual void ProcessClientAnchor2( SvStream& rStData,
+ DffRecordHeader& rHd,
+ void* pData, DffObjData& );
+ virtual sal_Bool ProcessClientData( SvStream& rStData,
+ sal_uInt32 nDatLen,
+ char*& rpBuff,
+ sal_uInt32& rBuffLen ) const;
+ virtual SdrObject* ProcessObj( SvStream& rSt,
+ DffObjData& rData,
+ void* pData,
+ Rectangle& rTextRect,
+ SdrObject* pObj = NULL);
+ virtual sal_uLong Calc_nBLIPPos( sal_uLong nOrgVal,
+ sal_uLong nStreamPos ) const;
+ virtual bool GetColorFromPalette(sal_uInt16 nNum, Color& rColor) const;
+
+ // Fontwork objects use a new implementation of ReadObjText because the old
+ // one does not properly import multiple paragraphs.
+ static void ReadObjText( const OUString& rText, SdrObject* pObj );
+
+// the following method needs to be overridden for the import of OLE objects
+ virtual sal_Bool GetOLEStorageName( long nOLEId,
+ OUString& rStorageName,
+ SotStorageRef& rSrcStorage,
+ com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xDestStg
+ ) const;
+
+ /** Prevent that (rounded) rectangles with wrapped text will always be
+ converted into SdrRectObj( OBJ_TEXT ).
+
+ @return sal_True means "conversion".
+ */
+ virtual sal_Bool ShapeHasText(sal_uLong nShapeId, sal_uLong nFilePos) const;
+
+public:
+ DffPropertyReader* pSecPropSet;
+ std::map<sal_uInt32,OString> aEscherBlipCache;
+
+ DffRecordManager maShapeRecords;
+ ColorData mnDefaultColor;
+
+ sal_Bool mbTracing;
+
+ Color MSO_TEXT_CLR_ToColor( sal_uInt32 nColorCode ) const;
+ Color MSO_CLR_ToColor( sal_uInt32 nColorCode,
+ sal_uInt16 nContextProperty = DFF_Prop_lineColor ) const;
+ virtual sal_Bool SeekToShape( SvStream& rSt,
+ void* pClientData,
+ sal_uInt32 nId ) const;
+ bool SeekToRec( SvStream& rSt,
+ sal_uInt16 nRecId,
+ sal_uLong nMaxFilePos,
+ DffRecordHeader* pRecHd = NULL,
+ sal_uLong nSkipCount = 0 ) const;
+ bool SeekToRec2( sal_uInt16 nRecId1,
+ sal_uInt16 nRecId2,
+ sal_uLong nMaxFilePos,
+ DffRecordHeader* pRecHd = NULL,
+ sal_uLong nSkipCount = 0 ) const;
+
+ static OUString MSDFFReadZString( SvStream& rIn,
+ sal_uInt32 nMaxLen,
+ bool bUniCode = sal_False);
+
+ static bool ReadCommonRecordHeader( SvStream& rSt,
+ sal_uInt8& rVer,
+ sal_uInt16& rInst,
+ sal_uInt16& rFbt,
+ sal_uInt32& rLength) SAL_WARN_UNUSED_RESULT;
+
+// TODO: provide proper documentation here
+ /** constructor
+
+ sets nBLIPCount
+
+ @param rStCtrl Management stream with containers, FBSE
+ objects and shapes (mandatory; stream needs
+ to be open already)
+ @param rBaseURL ???
+ @param nOffsDgg offset in rStrCtrl; beginning of the drawing
+ group container
+ @param pStData data stream in that the BLIPs are stored (if
+ NULL it is assumed that all BLIPs are also in
+ the rStCtrl; stream needs to be open already)
+ @param pSdrModel_ ??? (can be empty during Ctor call but needs
+ to be set via SetModel() later in that case!)
+ @param nApplicationScale ???
+ @param mnDefaultColor_ ???
+ @param nDefaultFontHeight_ ???
+ @param pStData2_ ???
+ */
+ SvxMSDffManager( SvStream& rStCtrl,
+ const OUString& rBaseURL,
+ sal_uInt32 nOffsDgg,
+ SvStream* pStData,
+ SdrModel* pSdrModel_ = 0,
+ long nApplicationScale = 0,
+ ColorData mnDefaultColor_ = COL_DEFAULT,
+ sal_uLong nDefaultFontHeight_ = 24,
+ SvStream* pStData2_ = 0 );
+
+ // in PPT the parameters DGGContainerOffset and PicStream are provided by an
+ // init method
+ SvxMSDffManager( SvStream& rStCtrl, const OUString& rBaseURL );
+ void InitSvxMSDffManager( sal_uInt32 nOffsDgg_,
+ SvStream* pStData_,
+ sal_uInt32 nSvxMSDffOLEConvFlags);
+ void SetDgContainer( SvStream& rSt );
+
+ virtual ~SvxMSDffManager();
+
+ sal_uInt32 GetSvxMSDffSettings() const { return nSvxMSDffSettings; };
+ void SetSvxMSDffSettings( sal_uInt32 nSettings ) { nSvxMSDffSettings = nSettings; };
+
+ static sal_Bool MakeContentStream( SotStorage * pStor, const GDIMetaFile & );
+ static void ReadObjText( SvStream& rStream, SdrObject* pObj );
+ static sal_Bool ConvertToOle2( SvStream& rStm,
+ sal_uInt32 nLen,
+ const GDIMetaFile*,
+ const SotStorageRef & rDest );
+
+ void SetModel(SdrModel* pModel, long nApplicationScale);
+ SdrModel* GetModel() const { return pSdrModel; }
+ void Scale(sal_Int32& rVal) const;
+ void Scale(Point& rPos) const;
+ void Scale(Size& rSiz) const;
+ void ScaleEmu(sal_Int32& rVal) const;
+ sal_uInt32 ScalePt( sal_uInt32 nPt ) const;
+ sal_Int32 ScalePoint( sal_Int32 nVal ) const;
+
+// TODO: provide proper documentation here
+ /** Request for a specific BLIP.
+
+ @param[in] nIdx number of the requested BLIP (mandatory)
+ @param[out] rData already converted data (insert directly as graphics
+ into our documents)
+ @param pVisArea ???
+
+ @return sal_True if successful, sal_False otherwise
+ */
+ sal_Bool GetBLIP( sal_uLong nIdx, Graphic& rData, Rectangle* pVisArea = NULL );
+
+// TODO: provide proper documentation here
+ /** read a BLIP out of a already positioned stream
+
+ @param[in] rBLIPStream alread positioned stream (mandatory)
+ @param[out] rData already converted data (insert directly as
+ graphics into our documents)
+ @param pVisArea ???
+
+ @return sal_True if successful, sal_False otherwise
+ */
+ sal_Bool GetBLIPDirect(SvStream& rBLIPStream, Graphic& rData, Rectangle* pVisArea = NULL ) const;
+
+ sal_Bool GetShape(sal_uLong nId, SdrObject*& rpData, SvxMSDffImportData& rData);
+
+ /** Get count of managed BLIPs
+
+ @return Number of BLIPs in pStData (or rStCtrl), thus number of FBSEs in
+ the drawing group container. If 0 is returned this means that
+ the structure is ok but there are no BLIPs; if USHRT_MAX is
+ returned than there was an error: no correct Drawing File Format
+ */
+ sal_uInt16 GetBLIPCount() const{ return nBLIPCount; }
+
+ SdrObject* ImportObj( SvStream& rSt,
+ void* pData,
+ Rectangle& rClientRect,
+ const Rectangle& rGlobalChildRect,
+ int nCalledByGroup = 0,
+ sal_Int32* pShapeId = NULL);
+ SdrObject* ImportGroup( const DffRecordHeader& rHd,
+ SvStream& rSt,
+ void* pData,
+ Rectangle& rClientRect,
+ const Rectangle& rGlobalChildRect,
+ int nCalledByGroup = 0,
+ sal_Int32* pShapeId = NULL );
+ SdrObject* ImportShape( const DffRecordHeader& rHd,
+ SvStream& rSt,
+ void* pData,
+ Rectangle& rClientRect,
+ const Rectangle& rGlobalChildRect,
+ int nCalledByGroup = 0,
+ sal_Int32* pShapeId = NULL);
+
+ Rectangle GetGlobalChildAnchor( const DffRecordHeader& rHd,
+ SvStream& rSt,
+ Rectangle& aClientRect );
+ void GetGroupAnchors( const DffRecordHeader& rHd,
+ SvStream& rSt,
+ Rectangle& rGroupClientAnchor,
+ Rectangle& rGroupChildAnchor,
+ const Rectangle& rClientRect,
+ const Rectangle& rGlobalChildRect );
+
+ inline const SvxMSDffShapeInfos_ById* GetShapeInfos( void ) const
+ { return m_pShapeInfosById.get(); }
+
+ inline const SvxMSDffShapeOrders* GetShapeOrders( void ) const
+ { return pShapeOrders; }
+
+ void StoreShapeOrder(sal_uLong nId,
+ sal_uLong nTxBx,
+ SdrObject* pObject,
+ SwFlyFrmFmt* pFly = 0,
+ short nHdFtSection = 0) const;
+
+ void ExchangeInShapeOrder(SdrObject* pOldObject,
+ sal_uLong nTxBx,
+ SwFlyFrmFmt* pFly,
+ SdrObject* pObject) const;
+
+ void RemoveFromShapeOrder( SdrObject* pObject ) const;
+
+ sal_uInt32 GetConvertFlags() const { return nSvxMSDffOLEConvFlags; }
+
+ static SdrOle2Obj* CreateSdrOLEFromStorage( const OUString& rStorageName,
+ SotStorageRef& rSrcStorage,
+ const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xDestStg,
+ const Graphic& rGraf,
+ const Rectangle& rBoundRect,
+ const Rectangle& rVisArea,
+ SvStream* pDataStrrm,
+ ErrCode& rError,
+ sal_uInt32 nConvertFlags,
+ sal_Int64 nAspect );
+
+ /** Create connections between shapes.
+ This method should be called after a page is imported.
+
+ @param rSolver contains necessary data that is collected during the
+ import of each shape
+ */
+ void SolveSolver( const SvxMSDffSolverContainer& rSolver );
+
+ static sal_Bool SetPropValue(
+ const ::com::sun::star::uno::Any& rAny,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
+ const OUString& rPropertyName,
+ sal_Bool bTestPropertyAvailability = sal_False
+ );
+
+ void insertShapeId( sal_Int32 nShapeId, SdrObject* pShape );
+ void removeShapeId( SdrObject* pShape );
+ SdrObject* getShapeForId( sal_Int32 nShapeId );
+};
+
+struct SvxMSDffBLIPInfo
+{
+ sal_uInt16 nBLIPType; ///< type of BLIP: e.g. 6 for PNG
+ sal_uLong nFilePos; ///< offset of the BLIP in data strem
+ sal_uLong nBLIPSize; ///< number of bytes that the BLIP needs in stream
+ SvxMSDffBLIPInfo(sal_uInt16 nBType, sal_uLong nFPos, sal_uLong nBSize):
+ nBLIPType( nBType ), nFilePos( nFPos ), nBLIPSize( nBSize ){}
+};
+
+struct SvxMSDffShapeInfo
+{
+ sal_uInt32 nShapeId; ///< shape id, used in PLCF SPA and in mso_fbtSp (FSP)
+ sal_uLong nFilePos; ///< offset of the shape in control stream for
+ ///< potential later access to it
+ sal_uInt32 nTxBxComp;
+
+ sal_Bool bReplaceByFly :1; ///< shape can be replaced by a frame in Writer
+ sal_Bool bLastBoxInChain:1;
+
+ explicit SvxMSDffShapeInfo(sal_uLong nFPos, sal_uInt32 nId=0, // sal_uLong nBIdx=0,
+ sal_uInt16 nSeqId=0, sal_uInt16 nBoxId=0):
+ nShapeId( nId ),
+ nFilePos( nFPos ),
+ nTxBxComp( (nSeqId << 16) + nBoxId )
+ {
+ bReplaceByFly = sal_False;
+ bLastBoxInChain = sal_True;
+ }
+ SvxMSDffShapeInfo(SvxMSDffShapeInfo& rInfo):
+ nShapeId( rInfo.nShapeId ),
+ nFilePos( rInfo.nFilePos ),
+ nTxBxComp( rInfo.nTxBxComp )
+ {
+ bReplaceByFly = rInfo.bReplaceByFly;
+ bLastBoxInChain = rInfo.bLastBoxInChain;
+ }
+};
+
+
+struct SvxMSDffShapeOrder
+{
+ sal_uLong nShapeId; ///< shape id used in PLCF SPA and in mso_fbtSp (FSP)
+ sal_uLong nTxBxComp; ///< chain or box number in the Text-Box-Story (or NULL)
+ SwFlyFrmFmt* pFly; ///< format of frame that was inserted as a replacement
+ ///< for a Sdr-Text object in Writer - needed for
+ ///< chaining!
+ short nHdFtSection; ///< used by Writer to find out if linked frames are in
+ ///< the same header or footer of the same section
+ SdrObject* pObj; ///< pointer to the draw object (or NULL if not used)
+
+ // Approach: In the Ctor of SvxMSDffManager only the shape ids are stored in
+ // the shape order array. The Text-Box number and the object
+ // pointer are only stored if the shape is really imported.
+ explicit SvxMSDffShapeOrder( sal_uLong nId ):
+ nShapeId( nId ), nTxBxComp( 0 ), pFly( 0 ), nHdFtSection( 0 ), pObj( 0 ){}
+
+ bool operator==( const SvxMSDffShapeOrder& rEntry ) const
+ { return (nTxBxComp == rEntry.nTxBxComp); }
+ bool operator<( const SvxMSDffShapeOrder& rEntry ) const
+ { return (nTxBxComp < rEntry.nTxBxComp); }
+};
+
+// the following will be sorted explicitly:
+struct CompareSvxMSDffShapeTxBxSort
+{
+ bool operator()( SvxMSDffShapeOrder* const& lhs, SvxMSDffShapeOrder* const& rhs ) const { return (*lhs)<(*rhs); }
+};
+class MSFILTER_DLLPUBLIC SvxMSDffShapeTxBxSort : public std::set<SvxMSDffShapeOrder*,CompareSvxMSDffShapeTxBxSort> {};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/msfilterdllapi.h b/include/filter/msfilter/msfilterdllapi.h
new file mode 100644
index 000000000000..03816baa92fc
--- /dev/null
+++ b/include/filter/msfilter/msfilterdllapi.h
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_MSFILTER_DLLAPI_H
+#define INCLUDED_MSFILTER_DLLAPI_H
+
+#include "sal/types.h"
+
+#if defined MSFILTER_DLLIMPLEMENTATION
+#define MSFILTER_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define MSFILTER_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#define MSFILTER_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/msocximex.hxx b/include/filter/msfilter/msocximex.hxx
new file mode 100644
index 000000000000..79815e49126e
--- /dev/null
+++ b/include/filter/msfilter/msocximex.hxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _MSOCXIMEX_HXX
+#define _MSOCXIMEX_HXX
+
+#include <sot/storage.hxx>
+
+#include "filter/msfilter/msfilterdllapi.h"
+
+namespace com{namespace sun{namespace star{
+ namespace drawing{
+ class XDrawPage;
+ class XShape;
+ class XShapes;
+ }
+ namespace form{
+ class XFormComponent;
+ }
+ namespace lang{
+ class XMultiServiceFactory;
+ }
+ namespace container{
+ class XIndexContainer;
+ class XNameContainer;
+ }
+ namespace beans{
+ class XPropertySet;
+ }
+ namespace text{
+ class XText;
+ }
+ namespace awt{
+ struct Size;
+ class XControlModel;
+ }
+ namespace uno{
+ class XComponentContext;
+ }
+ namespace frame{
+ class XModel;
+ }
+
+}}}
+
+class SfxObjectShell;
+
+class MSFILTER_DLLPUBLIC SvxMSConvertOCXControls
+{
+public:
+ SvxMSConvertOCXControls( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel );
+ virtual ~SvxMSConvertOCXControls();
+
+ virtual sal_Bool InsertControl(
+ const com::sun::star::uno::Reference<
+ com::sun::star::form::XFormComponent >& /*rFComp*/,
+ const com::sun::star::awt::Size& /*rSize*/,
+ com::sun::star::uno::Reference<
+ com::sun::star::drawing::XShape >* /*pShape*/,
+ sal_Bool /*bFloatingCtrl*/ ) {return sal_False;}
+
+ /*begin: Backwards compatability with office 95 import, modify later*/
+ const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory > & GetServiceFactory();
+protected:
+ const com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > &
+ GetShapes();
+
+ const com::sun::star::uno::Reference<
+ com::sun::star::container::XIndexContainer > & GetFormComps();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel;
+
+ // gecachte Interfaces
+ com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage >
+ xDrawPage;
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >
+ xShapes;
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xServiceFactory;
+
+ // das einzige Formular
+ com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer >
+ xFormComps;
+
+ virtual const com::sun::star::uno::Reference<
+ com::sun::star::drawing::XDrawPage > & GetDrawPage();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/msoleexp.hxx b/include/filter/msfilter/msoleexp.hxx
new file mode 100644
index 000000000000..468fa6284513
--- /dev/null
+++ b/include/filter/msfilter/msoleexp.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _MSOLEEXP_HXX
+#define _MSOLEEXP_HXX
+
+#include <com/sun/star/uno/Reference.h>
+#include "filter/msfilter/msfilterdllapi.h"
+
+// for the CreateSdrOLEFromStorage we need the information, how we handle
+// convert able OLE-Objects - this ist stored in
+#define OLE_STARMATH_2_MATHTYPE 0x0001
+#define OLE_STARWRITER_2_WINWORD 0x0002
+#define OLE_STARCALC_2_EXCEL 0x0004
+#define OLE_STARIMPRESS_2_POWERPOINT 0x0008
+
+class SotStorage;
+
+#include <svtools/embedhlp.hxx>
+
+class MSFILTER_DLLPUBLIC SvxMSExportOLEObjects
+{
+ sal_uInt32 nConvertFlags;
+public:
+ SvxMSExportOLEObjects( sal_uInt32 nCnvrtFlgs ) : nConvertFlags(nCnvrtFlgs) {}
+
+ void SetFlags( sal_uInt32 n ) { nConvertFlags = n; }
+ sal_uInt32 GetFlags() const { return nConvertFlags; }
+
+ void ExportOLEObject( svt::EmbeddedObjectRef& rObj, SotStorage& rDestStg );
+ void ExportOLEObject( const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject>& rObj, SotStorage& rDestStg );
+};
+
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/mstoolbar.hxx b/include/filter/msfilter/mstoolbar.hxx
new file mode 100644
index 000000000000..fc80f3115177
--- /dev/null
+++ b/include/filter/msfilter/mstoolbar.hxx
@@ -0,0 +1,359 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ * Noel Power <noel.power@novell.com>
+ * Portions created by the Initial Developer are Copyright (C) 2010 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Noel Power <noel.power@novell.com>
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+#ifndef _MSTOOLBAR_HXX
+#define _MSTOOLBAR_HXX
+#include "filter/msfilter/msfilterdllapi.h"
+#include <sot/storage.hxx>
+#include <ostream>
+#include <memory>
+#include <vector>
+#include <boost/shared_ptr.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
+#include <com/sun/star/ui/ImageType.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <vcl/bitmap.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+class TBCHeader;
+
+
+class MSOCommandConvertor
+{
+public:
+ virtual ~MSOCommandConvertor() {}
+ virtual OUString MSOCommandToOOCommand( sal_Int16 msoCmd ) = 0;
+ virtual OUString MSOTCIDToOOCommand( sal_Int16 msoTCID ) = 0;
+};
+
+class SfxObjectShell;
+
+class MSFILTER_DLLPUBLIC CustomToolBarImportHelper
+{
+ struct iconcontrolitem
+ {
+ OUString sCommand;
+ css::uno::Reference< css::graphic::XGraphic > image;
+ };
+ std::vector< iconcontrolitem > iconcommands;
+ std::auto_ptr< MSOCommandConvertor > pMSOCmdConvertor;
+ css::uno::Reference< css::ui::XUIConfigurationManagerSupplier > m_xCfgSupp;
+ css::uno::Reference< css::ui::XUIConfigurationManager > m_xAppCfgMgr;
+ SfxObjectShell& mrDocSh;
+ void ScaleImage( css::uno::Reference< css::graphic::XGraphic >& xGraphic, long nNewSize );
+public:
+ CustomToolBarImportHelper( SfxObjectShell& rDocSh, const css::uno::Reference< css::ui::XUIConfigurationManager >& rxAppCfgMgr );
+
+ void setMSOCommandMap( MSOCommandConvertor* pCnvtr ) { pMSOCmdConvertor.reset( pCnvtr ); }
+ css::uno::Reference< css::ui::XUIConfigurationManager > getCfgManager();
+ css::uno::Reference< css::ui::XUIConfigurationManager > getAppCfgManager();
+
+
+ css::uno::Any createCommandFromMacro( const OUString& sCmd );
+
+ void addIcon( const css::uno::Reference< css::graphic::XGraphic >& xImage, const OUString& sString );
+ void applyIcons();
+ OUString MSOCommandToOOCommand( sal_Int16 msoCmd );
+ OUString MSOTCIDToOOCommand( sal_Int16 msoTCID );
+ SfxObjectShell& GetDocShell() { return mrDocSh; }
+ bool createMenu( const OUString& rName, const css::uno::Reference< css::container::XIndexAccess >& xMenuDesc, bool bPersist );
+};
+
+class MSFILTER_DLLPUBLIC TBBase
+{
+friend class Indent;
+ static int nIndent; // num spaces to indent before printing
+protected:
+ void indent_printf(FILE* fp, const char* format, ... );
+ sal_uInt32 nOffSet; // usually for debug we can store the offset in the stream to this record
+public:
+ TBBase() : nOffSet( 0 ) {}
+ virtual ~TBBase(){}
+
+ virtual bool Read(SvStream &rS) = 0;
+ virtual void Print( FILE* ) {} // #FIXME remove this an implement the debug routines in all the classes below to enable some sort of readable output
+ sal_uInt32 GetOffset() { return nOffSet; }
+};
+
+class Indent
+{
+public:
+ Indent( bool binit = false )
+ {
+ if ( binit )
+ init();
+ else
+ TBBase::nIndent = TBBase::nIndent + 2;
+ }
+ ~Indent() { TBBase::nIndent = TBBase::nIndent - 2; }
+ void init() { TBBase::nIndent = 0; }
+};
+
+
+class MSFILTER_DLLPUBLIC WString : public TBBase
+{
+ OUString sString;
+
+public:
+ WString(){};
+ ~WString(){};
+ bool Read(SvStream &rS);
+ OUString getString(){ return sString; }
+};
+
+class MSFILTER_DLLPUBLIC TBCExtraInfo : public TBBase
+{
+ WString wstrHelpFile;
+ sal_Int32 idHelpContext;
+ WString wstrTag;
+ WString wstrOnAction;
+ WString wstrParam;
+ sal_Int8 tbcu;
+ sal_Int8 tbmg;
+
+ TBCExtraInfo(const TBCExtraInfo&);
+ TBCExtraInfo& operator = ( const TBCExtraInfo&);
+public:
+ TBCExtraInfo();
+ ~TBCExtraInfo(){}
+ bool Read(SvStream &rS);
+ void Print( FILE* );
+ OUString getOnAction();
+};
+
+class MSFILTER_DLLPUBLIC TBCGeneralInfo : public TBBase
+{
+ sal_uInt8 bFlags;
+ WString customText;
+ WString descriptionText;
+ WString tooltip;
+ TBCExtraInfo extraInfo;
+
+public:
+ TBCGeneralInfo();
+ ~TBCGeneralInfo() {}
+ bool Read(SvStream &rS);
+ void Print( FILE* );
+ bool ImportToolBarControlData( CustomToolBarImportHelper&, std::vector< css::beans::PropertyValue >& );
+ OUString CustomText() { return customText.getString(); }
+ OUString DescriptionText() { return descriptionText.getString(); }
+ OUString Tooltip() { return tooltip.getString(); }
+};
+
+class MSFILTER_DLLPUBLIC TBCBitMap : public TBBase
+{
+friend class TBCBSpecific; // #FIXME hacky access, need to fix
+ sal_Int32 cbDIB;
+ Bitmap mBitMap;
+public:
+ TBCBitMap();
+ ~TBCBitMap();
+ bool Read(SvStream &rS);
+ void Print( FILE* );
+ Bitmap& getBitMap();
+};
+
+class MSFILTER_DLLPUBLIC TBCMenuSpecific : public TBBase
+{
+ sal_Int32 tbid;
+ boost::shared_ptr< WString > name; //exist only if tbid equals 0x00000001
+public:
+ TBCMenuSpecific();
+ ~TBCMenuSpecific(){}
+ bool Read(SvStream &rS);
+ void Print( FILE* );
+ OUString Name();
+};
+
+class MSFILTER_DLLPUBLIC TBCCDData : public TBBase
+{
+ sal_Int16 cwstrItems; //Signed integer that specifies the number of items in wstrList. MUST be positive.
+ std::vector< WString > wstrList; // Zero-based index array of WString structures. Number of elements MUST be equal to cwstrItems.
+ sal_Int16 cwstrMRU; // Signed integer that specifies the number of most recently used string
+ sal_Int16 iSel ; // Signed integer that specifies the zero-based index of the selected item in the wstrList field. MUST be equal to 0xFFFF (-1) or greater than or equal to 0x0000.
+ sal_Int16 cLines; // Signed integer that specifies the suggested number of lines that the toolbar control will display at any time when displaying the elements of wstrList of available items.
+ sal_Int16 dxWidth; // Signed integer that specifies the width in pixels that the interior of the dropdown has. This excludes the width of the toolbar control border and scroll bar.
+ WString wstrEdit; //Structure of type WString. Editable text for editable area of the ComboBox toolbar control.
+
+public:
+ TBCCDData();
+ ~TBCCDData();
+ bool Read(SvStream &rS);
+ void Print( FILE* );
+};
+
+class TBCComboDropdownSpecific : public TBBase
+{
+ boost::shared_ptr< TBCCDData > data;
+public:
+ TBCComboDropdownSpecific( const TBCHeader& header );
+ TBCComboDropdownSpecific(){}
+ bool Read(SvStream &rS);
+ void Print( FILE* );
+};
+
+class TBCBSpecific : public TBBase
+{
+ sal_uInt8 bFlags;
+ boost::shared_ptr< TBCBitMap > icon; // optional
+ boost::shared_ptr< TBCBitMap > iconMask; // optional
+ boost::shared_ptr< sal_uInt16 > iBtnFace; // optional
+ boost::shared_ptr< WString > wstrAcc; // optional
+
+public:
+ TBCBSpecific();
+ ~TBCBSpecific(){}
+ bool Read(SvStream &rS);
+ void Print( FILE* );
+ // #TODO just add a getGraphic member here
+ TBCBitMap* getIcon();
+ TBCBitMap* getIconMask();
+ sal_uInt16* getBtnFace() { return iBtnFace.get(); }
+};
+
+/* TBCHeader.tct controlSpecificInfo type
+
+0x01 (Button control) TBCBSpecific
+0x10 (ExpandingGrid control) TBCBSpecific
+0x0A (Popup control) TBCMenuSpecific
+0x0C (ButtonPopup control) TBCMenuSpecific
+0x0D (SplitButtonPopup control) TBCMenuSpecific
+0x0E (SplitButtonMRUPopup control) TBCMenuSpecific
+0x02 (Edit control) TBCComboDropdow nSpecific
+0x04 (ComboBox control) TBCComboDropdow nSpecific
+0x14 (GraphicCombo control) TBCComboDropdow nSpecific
+0x03 (DropDown control) TBCComboDropdow nSpecific
+0x06 (SplitDropDown control) TBCComboDropdow nSpecific
+0x09 (GraphicDropDown control) TBCComboDropdow nSpecific
+0x07 (OCXDropDown control) controlSpecificInfo MUST NOT exist
+0x0F (Label control) controlSpecificInfo MUST NOT exist
+0x12 (Grid control) controlSpecificInfo MUST NOT exist
+0x13 (Gauge control) controlSpecificInfo MUST NOT exist
+0x16 (ActiveX control) controlSpecificInfo MUST NOT exist
+
+*/
+class MSFILTER_DLLPUBLIC TBCHeader : public TBBase
+{
+ sal_Int8 bSignature;
+ sal_Int8 bVersion;
+ sal_uInt8 bFlagsTCR;
+ sal_uInt8 tct;
+ sal_uInt16 tcid;
+ sal_uInt32 tbct;
+ sal_uInt8 bPriority;
+ boost::shared_ptr< sal_uInt16 > width; //optional
+ boost::shared_ptr< sal_uInt16 > height; //optional
+
+public:
+ TBCHeader();
+ ~TBCHeader();
+ sal_uInt8 getTct() const { return tct; }
+ sal_uInt16 getTcID() const { return tcid; }
+ bool isVisible() { return !( bFlagsTCR & 0x1 ); }
+ bool isBeginGroup() { return ( bFlagsTCR & 0x2 ); }
+ bool Read(SvStream &rS);
+ void Print( FILE* );
+ sal_uInt32 getTbct() { return tbct; };
+};
+
+class MSFILTER_DLLPUBLIC TBCData : public TBBase
+{
+ TBCHeader rHeader;
+ TBCGeneralInfo controlGeneralInfo;
+ boost::shared_ptr< TBBase > controlSpecificInfo; // can be one of TBCBSpecific, TBCMenuSpecific or TBCComboDropdow nSpecific depending on the control type specified by TBCHeader.tct
+ TBCData(const TBCData&);
+ TBCData& operator = ( const TBCData&);
+public:
+ TBCData( const TBCHeader& Header );
+ ~TBCData(){}
+ bool Read(SvStream &rS);
+ void Print( FILE* );
+ bool ImportToolBarControl( CustomToolBarImportHelper&, std::vector< css::beans::PropertyValue >&, bool& bBeginGroup, bool bIsMenuBar );
+ TBCGeneralInfo& getGeneralInfo() { return controlGeneralInfo; }
+ TBCMenuSpecific* getMenuSpecific();
+};
+
+class MSFILTER_DLLPUBLIC TB : public TBBase
+{
+ sal_uInt8 bSignature;// Signed integer that specifies the toolbar signature number. MUST be 0x02.
+ sal_uInt8 bVersion; // Signed integer that specifies the toolbar version number. MUST be 0x01.
+ sal_Int16 cCL; // Signed integer that SHOULD specify the number of toolbar controls contained in this toolbar.
+ sal_Int32 ltbid;// Signed integer that specifies the toolbar ID. MUST be 0x0001 (custom toolbar ID).
+ sal_uInt32 ltbtr;// Unsigned integer of type TBTRFlags that specifies the toolbar type and toolbar restrictions.
+ sal_uInt16 cRowsDefault;// Unsigned integer that specifies the number of preferred rows for the toolbar when the toolbar is not docked. MUST be less than or equal to 255.
+ sal_uInt16 bFlags; //Unsigned integer of type TBFlags.
+ WString name; //Structure of type WString that specifies the toolbar name
+public:
+ TB();
+ ~TB(){}
+ bool Read(SvStream &rS);
+ void Print( FILE* );
+ sal_Int16 getcCL(){ return cCL; }
+ WString& getName(){ return name; }
+ bool IsEnabled();
+ bool IsMenuToolbar(){ return ( ( ltbtr & 0x2000000 ) == 0x2000000 ); }
+};
+
+class MSFILTER_DLLPUBLIC SRECT : public TBBase
+{
+public:
+ SRECT() : left(0), top(0), right(0), bottom(0) {}
+ sal_Int16 left;
+ sal_Int16 top;
+ sal_Int16 right;
+ sal_Int16 bottom;
+ bool Read( SvStream &rS ) { rS >> left >> top >> right >> bottom; return true; }
+ void Print( FILE* fo );
+};
+
+typedef cppu::WeakImplHelper1< css::container::XIndexContainer > PropertyValueIndexContainer_BASE;
+
+class MSFILTER_DLLPUBLIC TBVisualData : public TBBase
+{
+ sal_Int8 tbds;
+ sal_Int8 tbv;
+ sal_Int8 tbdsDock;
+ sal_Int8 iRow;
+
+ SRECT rcDock;
+ SRECT rcFloat;
+
+public:
+ TBVisualData();
+ ~TBVisualData(){}
+ bool Read(SvStream &rS);
+ void Print( FILE* );
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/msvbahelper.hxx b/include/filter/msfilter/msvbahelper.hxx
new file mode 100644
index 000000000000..bafcc461a598
--- /dev/null
+++ b/include/filter/msfilter/msvbahelper.hxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _MSVBAHELPER_HXX
+#define _MSVBAHELPER_HXX
+
+#include <sfx2/objsh.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/script/vba/XVBAMacroResolver.hpp>
+#include <com/sun/star/awt/KeyEvent.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include "filter/msfilter/msfilterdllapi.h"
+namespace ooo {
+namespace vba {
+
+// ============================================================================
+
+struct MSFILTER_DLLPUBLIC MacroResolvedInfo
+{
+ SfxObjectShell* mpDocContext;
+ OUString msResolvedMacro;
+ bool mbFound;
+
+ inline explicit MacroResolvedInfo( SfxObjectShell* pDocContext = 0 ) : mpDocContext( pDocContext ), mbFound( false ) {}
+};
+
+MSFILTER_DLLPUBLIC OUString makeMacroURL( const OUString& sMacroName );
+MSFILTER_DLLPUBLIC OUString extractMacroName( const OUString& rMacroUrl );
+MSFILTER_DLLPUBLIC OUString getDefaultProjectName( SfxObjectShell* pShell );
+MSFILTER_DLLPUBLIC OUString resolveVBAMacro( SfxObjectShell* pShell, const OUString& rLibName, const OUString& rModuleName, const OUString& rMacroName );
+MSFILTER_DLLPUBLIC MacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const OUString& rMacroName, bool bSearchGlobalTemplates = false );
+MSFILTER_DLLPUBLIC sal_Bool executeMacro( SfxObjectShell* pShell, const OUString& sMacroName, com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArgs, com::sun::star::uno::Any& aRet, const com::sun::star::uno::Any& aCaller );
+MSFILTER_DLLPUBLIC ::com::sun::star::awt::KeyEvent parseKeyEvent( const OUString& sKey ) throw (::com::sun::star::uno::RuntimeException);
+MSFILTER_DLLPUBLIC void applyShortCutKeyBinding ( const ::com::sun::star::uno::Reference< com::sun::star::frame::XModel >& rxDoc, const ::com::sun::star::awt::KeyEvent& rKeyEvent, const OUString& sMacro ) throw (::com::sun::star::uno::RuntimeException);
+// ============================================================================
+
+typedef ::cppu::WeakImplHelper3<
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::lang::XInitialization,
+ ::com::sun::star::script::vba::XVBAMacroResolver > VBAMacroResolverBase;
+
+class VBAMacroResolver : public VBAMacroResolverBase
+{
+public:
+ explicit VBAMacroResolver();
+ virtual ~VBAMacroResolver();
+
+ // com.sun.star.lang.XServiceInfo interface -------------------------------
+
+ virtual OUString SAL_CALL
+ getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL
+ supportsService( const OUString& rService )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL
+ getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+ // com.sun.star.lang.XInitialization interface ----------------------------
+
+ virtual void SAL_CALL initialize(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rArgs )
+ throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ // com.sun.star.script.vba.XVBAMacroResolver interface --------------------
+
+ virtual OUString SAL_CALL
+ resolveVBAMacroToScriptURL( const OUString& rVBAMacroName )
+ throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ virtual OUString SAL_CALL
+ resolveScriptURLtoVBAMacro( const OUString& rScriptURL )
+ throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel;
+ SfxObjectShell* mpObjShell;
+ OUString maProjectName;
+};
+
+// ============================================================================
+
+} // namespace vba
+} // namespace ooo
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/rtfutil.hxx b/include/filter/msfilter/rtfutil.hxx
new file mode 100644
index 000000000000..b8d3c2c6d8ca
--- /dev/null
+++ b/include/filter/msfilter/rtfutil.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_MSFILTER_RTFUTIL_HXX
+#define INCLUDED_MSFILTER_RTFUTIL_HXX
+
+#include "filter/msfilter/msfilterdllapi.h"
+#include <rtl/string.hxx>
+#include <rtl/textenc.h>
+#include <tools/string.hxx>
+
+namespace msfilter {
+namespace rtfutil {
+
+/// Outputs a single character in hex form.
+MSFILTER_DLLPUBLIC OString OutHex(sal_uLong nHex, sal_uInt8 nLen);
+
+/// Handles correct unicode and legacy export of a single character.
+MSFILTER_DLLPUBLIC OString OutChar(sal_Unicode c, int *pUCMode, rtl_TextEncoding eDestEnc, bool* pSuccess = 0, bool bUnicode = true);
+
+/**
+ * Handles correct unicode and legacy export of a string.
+ *
+ * @param rStr the string to export
+ * @param eDestEnc the legacy encoding to use
+ * @param bUnicode if unicode output is wanted as well, or just legacy
+ */
+MSFILTER_DLLPUBLIC OString OutString(const String &rStr, rtl_TextEncoding eDestEnc, bool bUnicode = true);
+
+/**
+ * Handles correct unicode and legacy export of a string, when a
+ * '{' \upr '{' keyword ansi_text '}{\*' \ud '{' keyword Unicode_text '}}}'
+ * construct should be used.
+ *
+ * @param pToken the keyword
+ * @param rStr the text to export
+ * @param eDestEnc the legacy encoding to use
+ */
+MSFILTER_DLLPUBLIC OString OutStringUpr(const sal_Char *pToken, const String &rStr, rtl_TextEncoding eDestEnc);
+
+}
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx
new file mode 100644
index 000000000000..2fbf096aec58
--- /dev/null
+++ b/include/filter/msfilter/svdfppt.hxx
@@ -0,0 +1,1564 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVDFPPT_HXX
+#define _SVDFPPT_HXX
+
+#include <tools/solar.h>
+#include <tools/string.hxx>
+#include <tools/gen.hxx>
+#include <tools/color.hxx>
+#include <svx/svdobj.hxx>
+#include <editeng/numitem.hxx>
+#include <editeng/editdata.hxx>
+#include <filter/msfilter/msdffimp.hxx>
+#include <filter/msfilter/msocximex.hxx>
+#include <editeng/eeitem.hxx>
+#define ITEMID_FIELD EE_FEATURE_FIELD
+#include <editeng/flditem.hxx>
+#undef ITEMID_FIELD
+#include "filter/msfilter/msfilterdllapi.h"
+#include <vcl/font.hxx>
+#include <vector>
+#include <boost/optional.hpp>
+#include <boost/ptr_container/ptr_vector.hpp>
+
+class SdrModel;
+class SdPage;
+class SdrPage;
+class SdrObject;
+class SvStream;
+class Polygon;
+class PolyPolygon;
+class SfxItemSet;
+class Outliner;
+class Graphic;
+class SvxMSDffManager;
+class PPTTextObj;
+class DffRecordHeader;
+class SvxBulletItem;
+
+#define PPT_IMPORTFLAGS_NO_TEXT_ASSERT 1
+
+struct MSFILTER_DLLPUBLIC PptCurrentUserAtom
+{
+ sal_uInt32 nMagic;
+ sal_uInt32 nCurrentUserEdit;
+ sal_uInt16 nDocFileVersion;
+ sal_uInt8 nMajorVersion;
+ sal_uInt8 nMinorVersion;
+ OUString aCurrentUser;
+
+public:
+
+ PptCurrentUserAtom() : nMagic ( 0 ),
+ nCurrentUserEdit ( 0 ),
+ nDocFileVersion ( 0 ),
+ nMajorVersion ( 0 ),
+ nMinorVersion ( 0 ) {}
+
+ MSFILTER_DLLPUBLIC friend SvStream& operator>>( SvStream& rIn, PptCurrentUserAtom& rAtom );
+};
+
+struct MSFILTER_DLLPUBLIC PowerPointImportParam
+{
+ SvStream& rDocStream;
+ sal_uInt32 nImportFlags;
+ PptCurrentUserAtom aCurrentUserAtom;
+
+ PowerPointImportParam( SvStream& rDocStream, sal_uInt32 nImportFlags );
+};
+
+struct SdHyperlinkEntry
+{
+ sal_uInt32 nIndex;
+ sal_Int32 nPrivate1;
+ sal_Int32 nPrivate2;
+ sal_Int32 nPrivate3;
+ sal_Int32 nInfo;
+ OUString aTarget;
+ OUString aSubAdress;
+
+ sal_Int32 nStartPos;
+ sal_Int32 nEndPos;
+
+ OUString aConvSubString;
+ ESelection aESelection;
+ sal_Bool bSelection;
+};
+
+// Hilfsklasse zum Einlesen der PPT InteractiveInfoAtom
+struct MSFILTER_DLLPUBLIC PptInteractiveInfoAtom
+{
+ sal_uInt32 nSoundRef;
+ sal_uInt32 nExHyperlinkId;
+ sal_uInt8 nAction;
+ sal_uInt8 nOleVerb;
+ sal_uInt8 nJump;
+ sal_uInt8 nFlags;
+ sal_uInt8 nHyperlinkType;
+
+ // unknown, da Gesamtgroesse 16 ist
+ sal_uInt8 nUnknown1;
+ sal_uInt8 nUnknown2;
+ sal_uInt8 nUnknown3;
+
+public:
+
+ MSFILTER_DLLPUBLIC friend SvStream& operator>>( SvStream& rIn, PptInteractiveInfoAtom& rAtom );
+};
+
+enum PptPageKind { PPT_MASTERPAGE, PPT_SLIDEPAGE, PPT_NOTEPAGE };
+
+enum PptPageFormat
+{ PPTPF_SCREEN, //
+ PPTPF_USLETTER, // 8.5x11"
+ PPTPF_A4, // 210x297mm
+ PPTPF_35MMDIA, // DIA
+ PPTPF_OVERHEAD, //
+ PPTPF_CUSTOM
+};
+
+// Werte fuer den sal_uLong im PPT_PST_TextHeaderAtom
+enum PPT_TextHeader
+{
+ PPTTH_TITLE,
+ PPTTH_BODY,
+ PPTTH_NOTES,
+ PPTTH_NOTUSED,
+ PPTTH_OTHER, // Text in a Shape
+ PPTTH_CENTERBODY, // Subtitle in Title-Slide
+ PPTTH_CENTERTITLE, // Title in Title-Slide
+ PPTTH_HALFBODY, // Body in two-column slide
+ PPTTH_QUARTERBODY // Body in four-body slide
+};
+
+#define TSS_TYPE_PAGETITLE (0)
+#define TSS_TYPE_BODY (1)
+#define TSS_TYPE_NOTES (2)
+#define TSS_TYPE_UNUSED (3)
+#define TSS_TYPE_TEXT_IN_SHAPE (4)
+#define TSS_TYPE_SUBTITLE (5)
+#define TSS_TYPE_TITLE (6)
+#define TSS_TYPE_HALFBODY (7)
+#define TSS_TYPE_QUARTERBODY (8)
+
+// Inventor-Id fuer PPT UserData
+const sal_uInt32 PPTInventor = sal_uInt32('P') * 0x00000001
+ + sal_uInt32('P') * 0x00000100
+ + sal_uInt32('T') * 0x00010000
+ + sal_uInt32('0') * 0x01000000;
+
+// Object-Ids fuer StarDraw UserData
+#define PPT_OBJECTINFO_ID (1)
+
+struct MSFILTER_DLLPUBLIC PptDocumentAtom
+{
+ Size aSlidesPageSize; // page size of the slides in 576DPI
+ Size aNotesPageSize; // page size of the notes in 576DPI
+ // RatioAtom erstmal weggelassen
+ sal_uInt32 nNotesMasterPersist; // 0=non-existent
+ sal_uInt32 nHandoutMasterPersist; // 0=non-existent
+ sal_uInt16 n1stPageNumber; // page number of the first slide
+ PptPageFormat eSlidesPageFormat; // page format of the slides
+ sal_Bool bEmbeddedTrueType : 1; // TrueType direcly within the File?
+ sal_Bool bTitlePlaceholdersOmitted : 1;
+ sal_Bool bRightToLeft : 1;
+ sal_Bool bShowComments : 1;
+
+public:
+
+ Size GetPageSize( const Size& rSiz ) const;
+ Size GetSlidesPageSize() const { return GetPageSize( aSlidesPageSize ); }
+ Size GetNotesPageSize() const { return GetPageSize( aNotesPageSize ); }
+
+ friend SvStream& operator>>( SvStream& rIn, PptDocumentAtom& rAtom );
+};
+
+struct PptSlideLayoutAtom
+{
+ sal_Int32 eLayout; // 0..18
+ sal_uInt8 aPlaceholderId[ 8 ];
+ sal_uLong aPlacementId[ 8 ];
+
+public:
+ PptSlideLayoutAtom() { Clear(); }
+ void Clear();
+
+ // Das SlideLayoutAtom wird ohne Header eingelesen!
+ friend SvStream& operator>>( SvStream& rIn, PptSlideLayoutAtom& rAtom );
+};
+
+struct PptSlideAtom
+{
+ PptSlideLayoutAtom aLayout;
+ sal_uInt32 nMasterId;
+ sal_uInt32 nNotesId;
+ sal_uInt16 nFlags;
+
+public:
+ PptSlideAtom() { Clear(); }
+ void Clear();
+
+ friend SvStream& operator>>(SvStream& rIn, PptSlideAtom& rAtom);
+};
+
+struct PptSlidePersistAtom
+{
+ sal_uInt32 nPsrReference;
+ sal_uInt32 nFlags;
+ sal_uInt32 nNumberTexts;
+ sal_uInt32 nSlideId;
+ sal_uInt32 nReserved; // we will use nReserved temporarly to set the offset to SSSlideInfoAtom ( if possible )
+
+public:
+ PptSlidePersistAtom() { Clear(); }
+ void Clear();
+
+ friend SvStream& operator>>(SvStream& rIn, PptSlidePersistAtom& rAtom);
+};
+
+struct PptNotesAtom
+{
+ sal_uInt32 nSlideId;
+ sal_uInt16 nFlags;
+
+public:
+ PptNotesAtom() { Clear(); }
+ void Clear();
+
+ friend SvStream& operator>>(SvStream& rIn, PptNotesAtom& rAtom);
+};
+
+struct PptColorSchemeAtom
+{
+ sal_uInt8 aData[32];
+
+public:
+ PptColorSchemeAtom () { Clear(); }
+ void Clear();
+ Color GetColor( sal_uInt16 nNum ) const;
+
+ friend SvStream& operator>>(SvStream& rIn, PptColorSchemeAtom& rAtom);
+};
+
+struct PptFontEntityAtom
+{
+ OUString aName;
+ double fScaling;
+ sal_uInt8 lfClipPrecision;
+ sal_uInt8 lfQuality;
+
+ sal_uInt32 nUniqueFontId; // not used anymore
+ CharSet eCharSet;
+ FontFamily eFamily;
+ FontPitch ePitch;
+ sal_Bool bAvailable;
+
+ friend SvStream& operator>>(SvStream& rIn, PptFontEntityAtom& rAtom);
+};
+
+class PptFontCollection;
+struct PptUserEditAtom
+{
+ DffRecordHeader aHd;
+ sal_Int32 nLastSlideID; // ID of last visible slide
+ sal_uInt32 nVersion; // This is major/minor/build which did the edit
+ sal_uInt32 nOffsetLastEdit; // File offset of prev PptUserEditAtom
+ sal_uInt32 nOffsetPersistDirectory; // Offset to PersistPtrs for this file version.
+ sal_uInt32 nDocumentRef;
+ sal_uInt32 nMaxPersistWritten; // total number of Persist entries up to this point
+ sal_Int16 eLastViewType; // enum view type
+
+public:
+ PptUserEditAtom() : nOffsetPersistDirectory( 0 ) {}
+
+ friend SvStream& operator>>( SvStream& rIn, PptUserEditAtom& rAtom );
+};
+
+struct PptOEPlaceholderAtom
+{
+ sal_uInt32 nPlacementId;
+ sal_uInt8 nPlaceholderId;
+ sal_uInt8 nPlaceholderSize; // 0=Full size, 1=Half size, 2=Quarter of Slide
+
+public:
+ PptOEPlaceholderAtom() { Clear(); }
+ void Clear();
+
+ friend SvStream& operator>>( SvStream& rIn, PptOEPlaceholderAtom& rAtom );
+};
+
+struct ProcessData;
+struct PPTStyleSheet;
+struct HeaderFooterEntry;
+struct PptSlidePersistEntry
+{
+ PptSlidePersistAtom aPersistAtom;
+ PptSlideAtom aSlideAtom;
+ PptNotesAtom aNotesAtom;
+ PptColorSchemeAtom aColorScheme; // each slide includes this colorscheme atom
+ PPTStyleSheet* pStyleSheet; // stylesheet of this page ( only in masterpages ), since XP supports more than one masterpage
+
+ sal_uInt32 HeaderFooterOfs[ 4 ]; // containing the ofs to the placeholder (only masterpage)
+ HeaderFooterEntry* pHeaderFooterEntry;
+ SvxMSDffSolverContainer* pSolverContainer;
+ sal_uInt32 nSlidePersistStartOffset;// is an array to the end of the SlidePersistAtom of this page, TextHeaderAtom is following
+ sal_uInt32 nSlidePersistEndOffset;
+ sal_uInt32 nBackgroundOffset; // fileoffset
+ sal_uInt32 nDrawingDgId; // valid, if not -1
+ sal_uInt32* pPresentationObjects; // if valid, this is a pointer to an array that includes the offsets to the presentation objects
+ // on this masterpage for each instance ( 0 - 8 );
+ SdrObject* pBObj;
+ sal_Bool bBObjIsTemporary;
+
+ PptPageKind ePageKind; //
+
+ sal_Bool bNotesMaster : 1; // for NotesMaster
+ sal_Bool bHandoutMaster : 1; // for HandoutMaster
+ sal_Bool bStarDrawFiller : 1; // special for StarDraw
+public:
+ PptSlidePersistEntry();
+ ~PptSlidePersistEntry();
+ sal_uInt32 GetSlideId() const { return aPersistAtom.nSlideId; }
+};
+
+class _PptSlidePersistList : public std::vector<PptSlidePersistEntry*>
+{
+public:
+ ~_PptSlidePersistList()
+ {
+ for( const_iterator it = begin(); it != end(); ++it )
+ delete *it;
+ }
+};
+
+#define PPTSLIDEPERSIST_ENTRY_NOTFOUND 0xFFFF
+
+class MSFILTER_DLLPUBLIC PptSlidePersistList: public _PptSlidePersistList
+{
+public:
+ sal_uInt16 FindPage( sal_uInt32 nId ) const;
+};
+
+class SfxObjectShell;
+struct PPTOleEntry
+{
+ sal_uInt32 nId; // OleId
+ sal_uInt32 nPersistPtr; // PersistPtr
+ sal_uInt32 nRecHdOfs; // points to the record header: ExObjListHd
+ SfxObjectShell* pShell;
+ sal_uInt16 nType; // maybe PPT_PST_ExEmbed or PPT_PST_ExControl
+ sal_uInt32 nAspect; // the aspect of the OLE object
+
+ PPTOleEntry( sal_uInt32 nid, sal_uInt32 nOfs, SfxObjectShell* pSh, sal_uInt16 nT, sal_uInt32 nAsp ) :
+ nId ( nid ),
+ nRecHdOfs ( nOfs ),
+ pShell ( pSh ),
+ nType ( nT ),
+ nAspect ( nAsp ) {}
+};
+
+struct PptExOleObjAtom
+{
+ sal_uInt32 nAspect;
+ sal_uInt32 nId;
+ sal_uInt32 nPersistPtr;
+
+public:
+
+ friend SvStream& operator>>( SvStream& rIn, PptExOleObjAtom& rAtom );
+};
+
+typedef ::std::vector< PPTOleEntry* > PPTOleEntryList;
+class PPTExtParaProv;
+class MSFILTER_DLLPUBLIC SdrEscherImport : public SvxMSDffManager
+{
+protected:
+
+ friend class PPTTextObj;
+ friend class PPTPortionObj;
+ friend struct PPTStyleTextPropReader;
+ friend class ImplSdPPTImport;
+
+ PptDocumentAtom aDocAtom;
+ DffRecordManager aDocRecManager; // contains all first level container and atoms of the document container
+
+ PPTOleEntryList aOleObjectList; // contains PPTOleEntrys
+
+ PptFontCollection* pFonts;
+
+ sal_uInt32 nStreamLen;
+ sal_uInt16 nTextStylesIndex;
+
+ CharSet eCharSetSystem;
+
+ sal_Bool bWingdingsChecked : 1;
+ sal_Bool bWingdingsAvailable : 1;
+ sal_Bool bMonotypeSortsChecked : 1;
+ sal_Bool bMonotypeSortsAvailable : 1;
+ sal_Bool bTimesNewRomanChecked : 1;
+ sal_Bool bTimesNewRomanAvailable : 1;
+
+ sal_Bool ReadString( OUString& rStr ) const;
+ // nur fuer PowerPoint-Filter:
+ virtual const PptSlideLayoutAtom* GetSlideLayoutAtom() const;
+
+public:
+ using SvxMSDffManager::ReadObjText;
+
+ PowerPointImportParam& rImportParam;
+
+ SdrEscherImport( PowerPointImportParam&, const OUString& rBaseURL );
+ virtual ~SdrEscherImport();
+ virtual bool GetColorFromPalette( sal_uInt16 nNum, Color& rColor ) const;
+ virtual sal_Bool SeekToShape( SvStream& rSt, void* pClientData, sal_uInt32 nId ) const;
+ PptFontEntityAtom* GetFontEnityAtom( sal_uInt32 nNum ) const;
+ void RecolorGraphic( SvStream& rSt, sal_uInt32 nRecLen, Graphic& rGraph );
+ virtual SdrObject* ReadObjText( PPTTextObj* pTextObj, SdrObject* pObj, SdPage* pPage ) const;
+ virtual SdrObject* ProcessObj( SvStream& rSt, DffObjData& rData, void* pData, Rectangle& rTextRect, SdrObject* pObj );
+ virtual void ProcessClientAnchor2( SvStream& rSt, DffRecordHeader& rHd, void* pData, DffObjData& rObj );
+ void ImportHeaderFooterContainer( DffRecordHeader& rHeader, HeaderFooterEntry& rEntry );
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#define SD_HEADERFOOTER_DATE 1
+#define SD_HEADERFOOTER_TODAYDATE 2
+#define SD_HEADERFOOTER_USERDATE 4
+#define SD_HEADERFOOTER_SLIDENUMBER 8
+#define SD_HEADERFOOTER_HEADER 16
+#define SD_HEADERFOOTER_FOOTER 32
+
+class SvxFieldItem;
+struct MSFILTER_DLLPUBLIC PPTFieldEntry
+{
+ sal_uInt16 nPos;
+ sal_uInt16 nTextRangeEnd;
+ SvxFieldItem* pField1;
+ SvxFieldItem* pField2;
+ OUString* pString;
+
+ PPTFieldEntry() : nPos( 0 ), nTextRangeEnd( 0 ), pField1( NULL ), pField2( NULL ), pString( NULL ) {};
+ ~PPTFieldEntry();
+
+ void SetDateTime( sal_uInt32 nType );
+
+ // converting PPT date time format:
+ static void GetDateTime(
+ const sal_uInt32 nVal,
+ SvxDateFormat& eDateFormat,
+ SvxTimeFormat& eTimeFormat
+ );
+};
+
+struct MSFILTER_DLLPUBLIC HeaderFooterEntry
+{
+ const PptSlidePersistEntry* pMasterPersist;
+ OUString pPlaceholder[ 4 ];
+ sal_uInt32 nAtom;
+
+ sal_uInt32 GetMaskForInstance( sal_uInt32 nInstance );
+ sal_uInt32 IsToDisplay( sal_uInt32 nInstance );
+ sal_uInt32 NeedToImportInstance(
+ const sal_uInt32 nInstance,
+ const PptSlidePersistEntry& rSlidePersist
+ );
+
+ explicit HeaderFooterEntry( const PptSlidePersistEntry* pMaster = NULL );
+ ~HeaderFooterEntry();
+};
+
+struct ProcessData
+{
+ PptSlidePersistEntry& rPersistEntry;
+ SdPage* pPage;
+ ::std::vector< SdrObject* > aBackgroundColoredObjects;
+ sal_uInt32* pTableRowProperties;
+
+ ProcessData( PptSlidePersistEntry& rP, SdPage* pP ) :
+ rPersistEntry ( rP ),
+ pPage ( pP ),
+ pTableRowProperties ( NULL ) {};
+ ~ProcessData() { delete[] pTableRowProperties; };
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+typedef ::std::vector< SdHyperlinkEntry* > SdHyperlinkEntryList;
+class SdrTextObj;
+class SfxObjectShell;
+
+class MSFILTER_DLLPUBLIC SdrPowerPointImport : public SdrEscherImport
+{
+protected:
+
+ friend class PPTTextObj;
+ friend class PPTExtParaProv;
+ friend struct PPTStyleSheet;
+ friend class PPTNumberFormatCreator;
+
+ sal_Bool bOk;
+ PptUserEditAtom aUserEditAtom;
+ PptColorSchemeAtom aPageColors;
+ SdHyperlinkEntryList aHyperList;
+ sal_uInt32* pPersistPtr;
+ sal_uLong nPersistPtrAnz;
+
+ const PPTStyleSheet* pPPTStyleSheet; // this is the current stylesheet;
+ const PPTStyleSheet* pDefaultSheet; // this is a sheet we are using if no masterpage can be found, but that should
+ // never happen just preventing a crash
+ PptSlidePersistList* pMasterPages;
+ PptSlidePersistList* pSlidePages;
+ PptSlidePersistList* pNotePages;
+ sal_uInt16 nAktPageNum;
+ sal_uLong nDocStreamPos;
+ sal_uInt16 nPageColorsNum;
+ PptPageKind ePageColorsKind;
+ PptPageKind eAktPageKind;
+
+protected:
+ using SdrEscherImport::ReadObjText;
+
+ sal_Bool SeekToAktPage(DffRecordHeader* pRecHd=NULL) const;
+ sal_Bool SeekToDocument(DffRecordHeader* pRecHd=NULL) const;
+ sal_Bool SeekToContentOfProgTag(
+ sal_Int32 nVersion,
+ SvStream& rSt,
+ const DffRecordHeader& rProgTagBinaryDataHd,
+ DffRecordHeader& rContentHd
+ );
+ virtual SdrObject* ApplyTextObj(
+ PPTTextObj* pTextObj,
+ SdrTextObj* pText,
+ SdPage* pPage,
+ SfxStyleSheet*,
+ SfxStyleSheet** )
+ const;
+ virtual SdrObject* ReadObjText( PPTTextObj* pTextObj, SdrObject* pObj, SdPage* pPage ) const;
+ // #i32596# - new parameter <_nCalledByGroup>, which
+ // indicates, if the OLE object is imported inside a group object.
+ virtual SdrObject* ImportOLE(
+ long nOLEId,
+ const Graphic& rGraf,
+ const Rectangle& rBoundRect,
+ const Rectangle& rVisArea,
+ const int _nCalledByGroup,
+ sal_Int64 nAspect
+ ) const;
+ SvMemoryStream* ImportExOleObjStg( sal_uInt32 nPersistPtr, sal_uInt32& nOleId ) const;
+ SdrPage* MakeBlancPage(sal_Bool bMaster) const;
+ sal_Bool ReadFontCollection();
+ sal_Bool ForceFontCollection() const
+ { return pFonts!=NULL?sal_True:((SdrPowerPointImport*)this)->ReadFontCollection(); }
+ PptSlidePersistList* GetPageList(PptPageKind ePageKind) const;
+ sal_uInt32 GetAktPageId();
+ sal_uInt32 GetMasterPageId(sal_uInt16 nPageNum, PptPageKind ePageKind) const;
+ sal_uInt32 GetNotesPageId(sal_uInt16 nPageNum ) const;
+ SdrOutliner* GetDrawOutliner( SdrTextObj* pSdrText ) const;
+ void SeekOle( SfxObjectShell* pShell, sal_uInt32 nFilterOptions );
+
+public:
+ SdrPowerPointImport( PowerPointImportParam&, const OUString& rBaseURL );
+ virtual ~SdrPowerPointImport();
+ sal_uInt16 GetPageCount( PptPageKind eKind = PPT_SLIDEPAGE ) const;
+ void SetPageNum( sal_uInt16 nPageNum, PptPageKind = PPT_SLIDEPAGE );
+ sal_uInt16 GetPageNum() const { return nAktPageNum; }
+ PptPageKind GetPageKind() const { return eAktPageKind; }
+ Size GetPageSize() const;
+ SdrObject* ImportPageBackgroundObject(
+ const SdrPage& rPage,
+ sal_uInt32& nBgFileOffset,
+ sal_Bool bForce
+ );
+ sal_Bool IsNoteOrHandout( sal_uInt16 nPageNum, PptPageKind ePageKind ) const;
+ sal_Bool HasMasterPage(
+ sal_uInt16 nPageNum,
+ PptPageKind ePageKind = PPT_SLIDEPAGE
+ ) const;
+ sal_uInt16 GetMasterPageIndex(
+ sal_uInt16 nPageNum,
+ PptPageKind ePageKind = PPT_SLIDEPAGE
+ ) const;
+
+ void ImportPage( SdrPage* pPage, const PptSlidePersistEntry* pMasterPersist = NULL );
+ virtual bool GetColorFromPalette(sal_uInt16 nNum, Color& rColor) const;
+ virtual sal_Bool SeekToShape( SvStream& rSt, void* pClientData, sal_uInt32 nId ) const;
+ sal_Unicode PPTSubstitute(
+ sal_uInt16 nFont,
+ sal_Unicode nChar,
+ sal_uInt32& nMappedFontId,
+ Font& rFont,
+ char nDefault
+ ) const;
+ const PptDocumentAtom& GetDocumentAtom() const { return aDocAtom; }
+ virtual const PptSlideLayoutAtom* GetSlideLayoutAtom() const;
+ SdrObject* CreateTable(
+ SdrObject* pGroupObject,
+ sal_uInt32* pTableArry,
+ SvxMSDffSolverContainer*
+ );
+ virtual bool ReadFormControl( SotStorageRef& rSrc1, com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rFormComp ) const = 0;
+};
+
+struct PPTTextCharacterStyleAtomInterpreter
+{
+ sal_uInt16 nFlags1;
+ sal_uInt16 nFlags2;
+ sal_uInt16 nFlags3;
+ sal_Int32 n1;
+ sal_uInt16 nFontHeight;
+ sal_Int32 nFontColor;
+
+ PPTTextCharacterStyleAtomInterpreter();
+ ~PPTTextCharacterStyleAtomInterpreter();
+
+ sal_Bool Read( SvStream& rIn, const DffRecordHeader& rRecHd );
+
+ sal_uInt32 GetColor( sal_uInt32 nDefault );
+};
+
+struct PPTTextParagraphStyleAtomInterpreter
+{
+ sal_Bool bValid;
+ sal_Bool bForbiddenRules;
+ sal_Bool bHangingPunctuation;
+ sal_Bool bLatinTextWrap;
+
+ PPTTextParagraphStyleAtomInterpreter();
+ ~PPTTextParagraphStyleAtomInterpreter();
+
+ sal_Bool Read( SvStream& rIn, const DffRecordHeader& rRecHd );
+};
+
+struct PPTTextSpecInfo
+{
+ sal_uInt32 nCharIdx;
+ sal_uInt16 nLanguage[ 3 ];
+ sal_uInt16 nDontKnow;
+
+ explicit PPTTextSpecInfo( sal_uInt32 nCharIdx );
+ ~PPTTextSpecInfo();
+};
+
+typedef ::std::vector< PPTTextSpecInfo* > PPTTextSpecInfoList;
+struct PPTTextSpecInfoAtomInterpreter
+{
+ sal_Bool bValid;
+ PPTTextSpecInfoList aList;
+
+ PPTTextSpecInfoAtomInterpreter();
+ ~PPTTextSpecInfoAtomInterpreter();
+
+ sal_Bool Read(
+ SvStream& rIn,
+ const DffRecordHeader& rRecHd,
+ sal_uInt16 nRecordType,
+ const PPTTextSpecInfo* pTextSpecDefault = NULL
+ );
+
+};
+
+#define PPT_STYLESHEETENTRYS 9
+
+struct PPTExtParaLevel
+{
+ sal_uInt32 mnExtParagraphMask;
+ sal_uInt16 mnBuBlip;
+ sal_uInt16 mnHasAnm;
+ sal_uInt32 mnAnmScheme;
+ sal_uInt32 mpfPP10Ext;
+ sal_uInt32 mnExtCharacterMask;
+ sal_uInt32 mcfPP10Ext;
+ sal_Bool mbSet;
+
+ PPTExtParaLevel();
+ friend SvStream& operator>>( SvStream& rIn, PPTExtParaLevel& rL );
+};
+
+struct PPTExtParaSheet
+{
+ PPTExtParaLevel aExtParaLevel[ 5 ];
+};
+
+struct PPTBuGraEntry
+{
+ sal_uInt32 nInstance;
+ Graphic aBuGra;
+
+ PPTBuGraEntry( Graphic& rGraphic, sal_uInt32 nInstance );
+};
+
+typedef ::std::vector< PPTBuGraEntry* > PPTBuGraEntryList;
+
+class PPTExtParaProv
+{
+ PPTBuGraEntryList aBuGraList;
+
+public :
+ sal_Bool bStyles;
+ sal_Bool bGraphics;
+ DffRecordManager aExtendedPresRules;
+
+ PPTExtParaSheet aExtParaSheet[ PPT_STYLESHEETENTRYS ];
+
+ sal_Bool GetGraphic( sal_uInt32 nInstance, Graphic& rGraphic ) const;
+
+ PPTExtParaProv(
+ SdrPowerPointImport& rManager,
+ SvStream& rSt,
+ const DffRecordHeader* pMainMasterHd
+ );
+ ~PPTExtParaProv();
+};
+
+struct PPTCharLevel
+{
+ Color mnFontColorInStyleSheet;
+ sal_uInt32 mnFontColor;
+ sal_uInt16 mnFlags;
+ sal_uInt16 mnFont;
+ sal_uInt16 mnAsianOrComplexFont;
+ sal_uInt16 mnFontHeight;
+ sal_uInt16 mnEscapement;
+};
+
+struct PPTCharSheet
+{
+ PPTCharLevel maCharLevel[ 5 ];
+
+ explicit PPTCharSheet( sal_uInt32 nInstance );
+ PPTCharSheet( const PPTCharSheet& rCharSheet );
+
+ void Read( SvStream& rIn, sal_Bool bMasterStyle, sal_uInt32 nLevel, sal_Bool bFirst );
+};
+
+struct PPTParaLevel
+{
+ sal_uInt16 mnBuFlags;
+ sal_uInt16 mnBulletChar;
+ sal_uInt16 mnBulletFont;
+ sal_uInt16 mnBulletHeight;
+ sal_uInt32 mnBulletColor;
+
+ sal_uInt16 mnAdjust;
+ sal_uInt16 mnLineFeed;
+ sal_uInt16 mnUpperDist;
+ sal_uInt16 mnLowerDist;
+ sal_uInt16 mnTextOfs;
+ sal_uInt16 mnBulletOfs;
+ sal_uInt16 mnDefaultTab;
+ sal_uInt16 mnAsianLineBreak; // bit0: use asian rules for first and last character
+ // 1: do not wrap latin text in the middle of the word
+ // 2: allow hanging punctuation
+ sal_uInt16 mnBiDi;
+};
+
+struct PPTParaSheet
+{
+public:
+
+ PPTParaLevel maParaLevel[ 5 ];
+
+ explicit PPTParaSheet( sal_uInt32 nInstance );
+ PPTParaSheet( const PPTParaSheet& rParaSheet );
+
+ void Read(
+ SdrPowerPointImport& rMan,
+ SvStream& rIn,
+ sal_Bool bMasterStyle,
+ sal_uInt32 nLevel,
+ sal_Bool bFirst
+ );
+ void UpdateBulletRelSize( sal_uInt32 nLevel, sal_uInt16 nFontHeight );
+};
+
+class PPTParagraphObj;
+class PPTNumberFormatCreator
+{
+ sal_uInt32 nIsBullet;
+ sal_uInt32 nBulletChar;
+ sal_uInt32 nBulletFont;
+ sal_uInt32 nBulletHeight;
+ sal_uInt32 nBulletColor;
+ sal_uInt32 nTextOfs;
+ sal_uInt32 nBulletOfs;
+
+ void ImplGetNumberFormat(
+ SdrPowerPointImport& rMan,
+ SvxNumberFormat& rNumberFormat,
+ sal_uInt32 nLevel
+ );
+ sal_Bool ImplGetExtNumberFormat(
+ SdrPowerPointImport& rMan,
+ SvxNumberFormat& rNumberFormat,
+ sal_uInt32 nLevel,
+ sal_uInt32 nInstance,
+ sal_uInt32 nInstanceInSheet,
+ boost::optional< sal_Int16 >& rStartNumbering,
+ sal_uInt32 nFontHeight,
+ PPTParagraphObj* pPara
+ );
+
+protected:
+
+ PPTNumberFormatCreator( PPTExtParaProv* );
+ ~PPTNumberFormatCreator();
+
+public:
+
+ PPTExtParaProv* pExtParaProv;
+
+ void GetNumberFormat(
+ SdrPowerPointImport& rMan,
+ SvxNumberFormat& rNumberFormat,
+ sal_uInt32 nLevel,
+ const PPTParaLevel& rParaLevel,
+ const PPTCharLevel& rCharLevel,
+ sal_uInt32 nInstance
+ );
+
+ sal_Bool GetNumberFormat(
+ SdrPowerPointImport& rMan,
+ SvxNumberFormat& rNumberFormat,
+ PPTParagraphObj* pPara,
+ sal_uInt32 nInstanceInSheet,
+ boost::optional< sal_Int16 >& rStartNumbering
+ );
+};
+
+class SvxNumBulletItem;
+struct PPTStyleSheet : public PPTNumberFormatCreator
+{
+ PPTTextSpecInfo maTxSI;
+ PPTCharSheet* mpCharSheet[ PPT_STYLESHEETENTRYS ];
+ PPTParaSheet* mpParaSheet[ PPT_STYLESHEETENTRYS ];
+ SvxNumBulletItem* mpNumBulletItem[ PPT_STYLESHEETENTRYS ];
+
+ PPTStyleSheet(
+ const DffRecordHeader& rSlideHd,
+ SvStream& rSt, SdrPowerPointImport&,
+ const PPTTextCharacterStyleAtomInterpreter&,
+ const PPTTextParagraphStyleAtomInterpreter&,
+ const PPTTextSpecInfo&
+ );
+ ~PPTStyleSheet();
+};
+
+struct ImplPPTParaPropSet
+{
+ sal_uInt32 mnRefCount;
+
+ sal_uInt16 mnDepth;
+ sal_uInt32 mnAttrSet;
+ sal_uInt32 mnBulletColor;
+ sal_uInt16 mpArry[ 22 ];
+
+ sal_uInt32 mnExtParagraphMask;
+ sal_uInt32 mnAnmScheme;
+ sal_uInt16 mnHasAnm;
+ sal_uInt16 mnBuBlip;
+
+ sal_uInt32 nDontKnow1;
+ sal_uInt32 nDontKnow2;
+ sal_uInt16 nDontKnow2bit06;
+
+ ImplPPTParaPropSet()
+ { mnRefCount = 1; mnAttrSet = 0; mnExtParagraphMask = 0; mnDepth = 0; };
+};
+
+struct PPTParaPropSet
+{
+ sal_uInt32 mnOriginalTextPos;
+ ImplPPTParaPropSet* pParaSet;
+
+ PPTParaPropSet();
+ PPTParaPropSet( PPTParaPropSet& rParaPropSet );
+ ~PPTParaPropSet();
+
+ PPTParaPropSet& operator=( PPTParaPropSet& rParaPropSet );
+};
+
+struct ImplPPTCharPropSet
+{
+ sal_uInt32 mnRefCount;
+
+ sal_uInt32 mnAttrSet;
+ sal_uInt16 mnFlags;
+ sal_uInt32 mnColor;
+ sal_uInt16 mnFont;
+ sal_uInt16 mnAsianOrComplexFont;
+ sal_uInt16 mnANSITypeface;
+ sal_uInt16 mnFontHeight;
+ sal_uInt16 mnEscapement;
+ sal_uInt16 mnSymbolFont;
+
+ ImplPPTCharPropSet(){ mnRefCount = 1; mnAttrSet = 0; };
+};
+
+struct PPTCharPropSet
+{
+ //when the bullet text has more than two color,next the text following with bullet has been set hyperlink.
+ //now,the bullet color should be set original hyperlink text's color
+ //so "mbHardHylinkOrigColor" hold the original hyperlink text's color.
+ sal_uInt32 mnHylinkOrigColor;
+ //the bullet text weather has a hyperlink.
+ sal_Bool mbIsHyperlink;
+ //the hyperlink text weather has a custom color.
+ sal_Bool mbHardHylinkOrigColor;
+
+ sal_uInt32 mnOriginalTextPos;
+ sal_uInt32 mnParagraph;
+ OUString maString;
+ SvxFieldItem* mpFieldItem;
+ sal_uInt16 mnLanguage[ 3 ];
+
+ ImplPPTCharPropSet* pCharSet;
+
+ void SetFont( sal_uInt16 nFont );
+ void SetColor( sal_uInt32 nColor );
+
+ explicit PPTCharPropSet( sal_uInt32 nParagraph );
+ PPTCharPropSet( const PPTCharPropSet& rCharPropSet );
+ PPTCharPropSet( const PPTCharPropSet& rCharPropSet, sal_uInt32 nParagraph );
+ ~PPTCharPropSet();
+
+ PPTCharPropSet& operator=( const PPTCharPropSet& rCharPropSet );
+
+private:
+ void ImplMakeUnique();
+};
+
+struct PPTTabEntry
+{
+ sal_uInt16 nOffset;
+ sal_uInt16 nStyle;
+};
+
+struct PPTRuler
+{
+ sal_uInt32 nRefCount;
+
+ sal_Int32 nFlags;
+ sal_uInt16 nDefaultTab;
+ sal_uInt16 nTextOfs[ 5 ];
+ sal_uInt16 nBulletOfs[ 5 ];
+ PPTTabEntry* pTab;
+ sal_uInt16 nTabCount;
+
+ PPTRuler();
+ ~PPTRuler();
+};
+
+struct PPTTextRulerInterpreter
+{
+ PPTRuler *mpImplRuler;
+
+ PPTTextRulerInterpreter();
+ PPTTextRulerInterpreter( PPTTextRulerInterpreter& rRuler );
+ PPTTextRulerInterpreter(
+ sal_uInt32 nFileOfs,
+ SdrPowerPointImport&,
+ DffRecordHeader& rHd,
+ SvStream& rIn
+ );
+ ~PPTTextRulerInterpreter();
+
+ sal_uInt16 GetTabOffsetByIndex( sal_uInt16 nIndex ) const
+ { return mpImplRuler->pTab[ nIndex ].nOffset; };
+
+ sal_uInt16 GetTabStyleByIndex( sal_uInt16 nIndex ) const
+ { return mpImplRuler->pTab[ nIndex ].nStyle; };
+
+ sal_uInt16 GetTabCount() const { return mpImplRuler->nTabCount; };
+ sal_Bool GetDefaultTab( sal_uInt32 nLevel, sal_uInt16& nValue ) const;
+ sal_Bool GetTextOfs( sal_uInt32 nLevel, sal_uInt16& nValue ) const;
+ sal_Bool GetBulletOfs( sal_uInt32 nLevel, sal_uInt16& nValue ) const;
+
+ PPTTextRulerInterpreter& operator=( PPTTextRulerInterpreter& rRuler );
+};
+
+#define PPT_SPEC_NEWLINE 0x10000
+#define PPT_SPEC_SYMBOL 0x20000
+#define PPT_SPEC_USE_STARBATS 0x40000
+
+struct StyleTextProp9
+{
+ sal_uInt32 mnExtParagraphMask;
+ sal_uInt16 mnBuBlip;
+ sal_uInt16 mnHasAnm;
+ sal_uInt32 mnAnmScheme;
+ sal_uInt32 mpfPP10Ext;
+ sal_uInt32 mnExtCharacterMask;
+ sal_uInt32 mncfPP10Ext;
+ sal_uInt32 mnSpecialInfoMask;
+ sal_uInt32 mnPP10Ext;
+ sal_uInt16 mfBidi;
+
+ StyleTextProp9()
+ : mnExtParagraphMask( 0 )
+ , mnBuBlip( 0 )
+ , mnHasAnm( 0 )
+ , mnAnmScheme( 0 )
+ , mpfPP10Ext( 0 )
+ , mnExtCharacterMask( 0 )
+ , mncfPP10Ext( 0 )
+ , mnSpecialInfoMask( 0 )
+ , mnPP10Ext( 0 )
+ , mfBidi( 0 )
+ {
+ }
+ void Read( SvStream& rSt );
+};
+
+typedef std::vector<PPTParaPropSet*> PPTParaPropSetList;
+typedef std::vector<PPTCharPropSet*> PPTCharPropSetList;
+
+struct PPTStyleTextPropReader
+{
+ std::vector< sal_uInt32 > aSpecMarkerList; // hiword -> Flags, loword -> Position
+ PPTParaPropSetList aParaPropList;
+ PPTCharPropSetList aCharPropList;
+
+ PPTStyleTextPropReader(
+ SvStream& rIn,
+ SdrPowerPointImport&,
+ const DffRecordHeader& rClientTextBoxHd,
+ PPTTextRulerInterpreter& rInterpreter,
+ const DffRecordHeader& rExtParaHd,
+ sal_uInt32 nTextInstance
+ );
+ ~PPTStyleTextPropReader();
+
+ void Init(
+ SvStream& rIn,
+ SdrPowerPointImport&,
+ const DffRecordHeader& rClientTextBoxHd,
+ PPTTextRulerInterpreter& rInterpreter,
+ const DffRecordHeader& rExtParaHd,
+ sal_uInt32 nTextInstance
+ );
+ void ReadParaProps(
+ SvStream& rIn,
+ SdrPowerPointImport& rMan,
+ const DffRecordHeader& rTextHeader,
+ const OUString& aString,
+ PPTTextRulerInterpreter& rRuler,
+ sal_uInt32& nCharCount,
+ sal_Bool& bTextPropAtom
+ );
+ void ReadCharProps(
+ SvStream& rIn,
+ PPTCharPropSet& aCharPropSet,
+ const OUString& aString,
+ sal_uInt32& nCharCount,
+ sal_uInt32 nCharAnzRead,
+ sal_Bool& bTextPropAtom,
+ sal_uInt32 nExtParaPos,
+ const std::vector< StyleTextProp9 >& aStyleTextProp9,
+ sal_uInt32& nExtParaFlags,
+ sal_uInt16& nBuBlip,
+ sal_uInt16& nHasAnm,
+ sal_uInt32& nAnmScheme
+ );
+};
+
+class SvxFieldItem;
+class MSFILTER_DLLPUBLIC PPTPortionObj : public PPTCharPropSet
+{
+
+ friend class PPTParagraphObj;
+
+ const PPTStyleSheet& mrStyleSheet;
+ sal_uInt32 mnInstance;
+ sal_uInt32 mnDepth;
+
+public:
+
+ sal_Bool GetAttrib( sal_uInt32 nAttr, sal_uInt32& nVal, sal_uInt32 nInstanceInSheet ) const;
+ SvxFieldItem* GetTextField();
+
+ PPTPortionObj( const PPTStyleSheet&, sal_uInt32 nInstance, sal_uInt32 nDepth );
+ PPTPortionObj(
+ const PPTCharPropSet&,
+ const PPTStyleSheet&,
+ sal_uInt32 nInstance,
+ sal_uInt32 nDepth
+ );
+ PPTPortionObj( const PPTPortionObj& );
+ ~PPTPortionObj();
+
+ // the following function should be removed during next full update
+ void ApplyTo(
+ SfxItemSet& rSet,
+ SdrPowerPointImport& rManager,
+ sal_uInt32 nInstanceInSheet
+ );
+ void ApplyTo(
+ SfxItemSet& rSet,
+ SdrPowerPointImport& rManager,
+ sal_uInt32 nInstanceInSheet,
+ const PPTTextObj* pTextObj
+ );
+ sal_uInt32 Count() const { return ( mpFieldItem ) ? 1 : maString.getLength(); };
+ sal_Bool HasTabulator();
+};
+
+class MSFILTER_DLLPUBLIC PPTParagraphObj
+ : public PPTParaPropSet,
+ public PPTNumberFormatCreator,
+ public PPTTextRulerInterpreter
+{
+ friend class PPTTextObj;
+ friend class PPTNumberFormatCreator;
+
+ const PPTStyleSheet& mrStyleSheet;
+ sal_uInt32 mnInstance;
+
+protected:
+
+ void ImplClear();
+
+public:
+
+ sal_Bool mbTab; // if true, this paragraph has tabulators in text
+
+ sal_uInt32 mnCurrentObject;
+ ::boost::ptr_vector<PPTPortionObj> m_PortionList;
+
+ void UpdateBulletRelSize( sal_uInt32& nBulletRelSize ) const;
+ sal_Bool GetAttrib( sal_uInt32 nAttr, sal_uInt32& nVal, sal_uInt32 nInstanceInSheet );
+
+ PPTParagraphObj(
+ const PPTStyleSheet&,
+ sal_uInt32 nInstance,
+ sal_uInt16 nDepth
+ );
+ PPTParagraphObj(
+ PPTStyleTextPropReader&,
+ size_t nCurParaPos,
+ size_t& rnCurCharPos,
+ const PPTStyleSheet&,
+ sal_uInt32 nInstance,
+ PPTTextRulerInterpreter& rRuler
+ );
+ ~PPTParagraphObj();
+
+ sal_uInt32 GetTextSize();
+ PPTPortionObj* First();
+ PPTPortionObj* Next();
+
+ void AppendPortion( PPTPortionObj& rPortion );
+ void ApplyTo(
+ SfxItemSet& rSet,
+ boost::optional< sal_Int16 >& rStartNumbering,
+ SdrPowerPointImport& rManager,
+ sal_uInt32 nInstanceInSheet,
+ const PPTParagraphObj* pPrev
+ );
+};
+
+#define PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT 1
+#define PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_CENTER 2
+#define PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT 4
+#define PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_BLOCK 8
+#define PPT_TEXTOBJ_FLAGS_VERTICAL 16
+
+struct ImplPPTTextObj
+{
+ sal_uInt32 mnRefCount;
+ sal_uInt32 mnShapeId;
+ sal_uInt32 mnShapeMaster;
+ PptOEPlaceholderAtom* mpPlaceHolderAtom;
+ sal_uInt16 mnInstance;
+ sal_uInt16 mnDestinationInstance;
+ MSO_SPT meShapeType;
+
+ sal_uInt32 mnCurrentObject;
+ sal_uInt32 mnParagraphCount;
+ PPTParagraphObj** mpParagraphList;
+ PptSlidePersistEntry& mrPersistEntry;
+
+ sal_uInt32 mnTextFlags;
+
+ explicit ImplPPTTextObj( PptSlidePersistEntry& rPersistEntry ) : mrPersistEntry ( rPersistEntry ) {};
+};
+
+class PPTTextObj
+{
+ ImplPPTTextObj* mpImplTextObj;
+ void ImplClear();
+
+ PPTTextObj(){};
+public:
+ PPTTextObj(
+ SvStream& rSt,
+ SdrPowerPointImport&,
+ PptSlidePersistEntry&,
+ DffObjData*
+ );
+ PPTTextObj( PPTTextObj& rTextObj );
+ ~PPTTextObj();
+
+ sal_uInt32 GetCurrentIndex() const { return mpImplTextObj->mnCurrentObject; };
+ sal_uInt32 Count() const { return mpImplTextObj->mnParagraphCount; };
+ PPTParagraphObj* First();
+ PPTParagraphObj* Next();
+ MSO_SPT GetShapeType() const { return mpImplTextObj->meShapeType; };
+ sal_uInt32 GetInstance() const { return mpImplTextObj->mnInstance; };
+ void SetInstance( sal_uInt16 nInstance )
+ { mpImplTextObj->mnInstance = nInstance; }
+
+ sal_uInt32 GetDestinationInstance() const
+ { return mpImplTextObj->mnDestinationInstance; }
+
+ void SetDestinationInstance( sal_uInt16 nInstance )
+ { mpImplTextObj->mnDestinationInstance = nInstance; }
+
+ PptOEPlaceholderAtom* GetOEPlaceHolderAtom() const { return mpImplTextObj->mpPlaceHolderAtom; }
+ sal_uInt32 GetTextFlags() const { return mpImplTextObj->mnTextFlags; }
+ void SetVertical( sal_Bool bVertical )
+ {
+ if ( bVertical )
+ mpImplTextObj->mnTextFlags |= PPT_TEXTOBJ_FLAGS_VERTICAL;
+ else
+ mpImplTextObj->mnTextFlags &= ~PPT_TEXTOBJ_FLAGS_VERTICAL;
+ }
+ sal_Bool GetVertical() const
+ { return ( mpImplTextObj->mnTextFlags & PPT_TEXTOBJ_FLAGS_VERTICAL ) != 0; }
+
+ const SfxItemSet* GetBackground() const;
+
+ PPTTextObj& operator=( PPTTextObj& rTextObj );
+};
+
+class PPTConvertOCXControls : public SvxMSConvertOCXControls
+{
+ virtual const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > & GetDrawPage();
+ PptPageKind ePageKind;
+ const SdrPowerPointImport* mpPPTImporter;
+ com::sun::star::uno::Reference< com::sun::star::io::XInputStream > mxInStrm;
+public :
+
+ PPTConvertOCXControls( const SdrPowerPointImport* pPPTImporter, com::sun::star::uno::Reference< com::sun::star::io::XInputStream >& rxInStrm, const com::sun::star::uno::Reference< com::sun::star::frame::XModel >& rxModel, PptPageKind ePKind ) :
+ SvxMSConvertOCXControls ( rxModel ),
+ ePageKind ( ePKind ),
+ mpPPTImporter ( pPPTImporter ),
+ mxInStrm ( rxInStrm )
+ {};
+ virtual sal_Bool ReadOCXStream( SotStorageRef& rSrc1,
+ com::sun::star::uno::Reference<
+ com::sun::star::drawing::XShape > *pShapeRef=0,
+ sal_Bool bFloatingCtrl=sal_False );
+ virtual sal_Bool InsertControl(
+ const com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > &rFComp,
+ const com::sun::star::awt::Size& rSize,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShape > *pShape,
+ sal_Bool bFloatingCtrl
+ );
+};
+
+// Powerpoint Recordtypen
+#define PPT_PST_Unknown 0
+#define PPT_PST_SubContainerCompleted 1
+#define PPT_PST_IRRAtom 2
+#define PPT_PST_PSS 3
+#define PPT_PST_SubContainerException 4
+#define PPT_PST_ClientSignal1 6
+#define PPT_PST_ClientSignal2 7
+#define PPT_PST_PowerPointStateInfoAtom 10
+#define PPT_PST_Document 1000
+#define PPT_PST_DocumentAtom 1001
+#define PPT_PST_EndDocument 1002
+#define PPT_PST_SlidePersist 1003
+#define PPT_PST_SlideBase 1004
+#define PPT_PST_SlideBaseAtom 1005
+#define PPT_PST_Slide 1006
+#define PPT_PST_SlideAtom 1007
+#define PPT_PST_Notes 1008
+#define PPT_PST_NotesAtom 1009
+#define PPT_PST_Environment 1010
+#define PPT_PST_SlidePersistAtom 1011
+#define PPT_PST_Scheme 1012
+#define PPT_PST_SchemeAtom 1013
+#define PPT_PST_DocViewInfo 1014
+#define PPT_PST_SslideLayoutAtom 1015
+#define PPT_PST_MainMaster 1016
+#define PPT_PST_SSSlideInfoAtom 1017
+#define PPT_PST_SlideViewInfo 1018
+#define PPT_PST_GuideAtom 1019
+#define PPT_PST_ViewInfo 1020
+#define PPT_PST_ViewInfoAtom 1021
+#define PPT_PST_SlideViewInfoAtom 1022
+#define PPT_PST_VBAInfo 1023
+#define PPT_PST_VBAInfoAtom 1024
+#define PPT_PST_SSDocInfoAtom 1025
+#define PPT_PST_Summary 1026
+#define PPT_PST_Texture 1027
+#define PPT_PST_VBASlideInfo 1028
+#define PPT_PST_VBASlideInfoAtom 1029
+#define PPT_PST_DocRoutingSlip 1030
+#define PPT_PST_OutlineViewInfo 1031
+#define PPT_PST_SorterViewInfo 1032
+#define PPT_PST_ExObjList 1033
+#define PPT_PST_ExObjListAtom 1034
+#define PPT_PST_PPDrawingGroup 1035
+#define PPT_PST_PPDrawing 1036
+#define PPT_PST_NewlyAddedAtomByXP1037 1037
+#define PPT_PST_NamedShows 1040
+#define PPT_PST_NamedShow 1041
+#define PPT_PST_NamedShowSlides 1042
+#define PPT_PST_List 2000
+#define PPT_PST_FontCollection 2005
+#define PPT_PST_ListPlaceholder 2017
+#define PPT_PST_BookmarkCollection 2019
+#define PPT_PST_SoundCollection 2020
+#define PPT_PST_SoundCollAtom 2021
+#define PPT_PST_Sound 2022
+#define PPT_PST_SoundData 2023
+#define PPT_PST_BookmarkSeedAtom 2025
+#define PPT_PST_GuideList 2026
+#define PPT_PST_RunArray 2028
+#define PPT_PST_RunArrayAtom 2029
+#define PPT_PST_ArrayElementAtom 2030
+#define PPT_PST_Int4ArrayAtom 2031
+#define PPT_PST_ColorSchemeAtom 2032
+
+// these atoms first was seen in ppt2000 in a private Tag atom
+#define PPT_PST_ExtendedBuGraContainer 2040 // consist of 4041
+#define PPT_PST_ExtendedBuGraAtom 2041 // the instance of this atom indices the current graphic
+
+#define PPT_PST_OEShape 3008
+#define PPT_PST_ExObjRefAtom 3009
+#define PPT_PST_OEPlaceholderAtom 3011
+#define PPT_PST_GrColor 3020
+#define PPT_PST_GrectAtom 3025
+#define PPT_PST_GratioAtom 3031
+#define PPT_PST_Gscaling 3032
+#define PPT_PST_GpointAtom 3034
+#define PPT_PST_OEShapeAtom 3035
+#define PPT_PST_OutlineTextRefAtom 3998
+#define PPT_PST_TextHeaderAtom 3999
+#define PPT_PST_TextCharsAtom 4000
+#define PPT_PST_StyleTextPropAtom 4001
+#define PPT_PST_BaseTextPropAtom 4002
+#define PPT_PST_TxMasterStyleAtom 4003
+#define PPT_PST_TxCFStyleAtom 4004
+#define PPT_PST_TxPFStyleAtom 4005
+#define PPT_PST_TextRulerAtom 4006
+#define PPT_PST_TextBookmarkAtom 4007
+#define PPT_PST_TextBytesAtom 4008
+#define PPT_PST_TxSIStyleAtom 4009
+#define PPT_PST_TextSpecInfoAtom 4010
+#define PPT_PST_DefaultRulerAtom 4011
+
+// these atoms first was seen in ppt2000 in a private Tag atom
+#define PPT_PST_ExtendedParagraphAtom 4012
+#define PPT_PST_ExtendedParagraphMasterAtom 4013
+#define PPT_PST_ExtendedPresRuleContainer 4014 // consist of 4012, 4015,
+#define PPT_PST_ExtendedParagraphHeaderAtom 4015 // the instance of this atom indices the current presobj
+ // the first sal_uInt32 in this atom indices the current slideId
+#define PPT_PST_NewlyAddedAtom4016 4016
+
+#define PPT_PST_FontEntityAtom 4023
+#define PPT_PST_FontEmbedData 4024
+#define PPT_PST_TypeFace 4025
+#define PPT_PST_CString 4026
+#define PPT_PST_ExternalObject 4027
+#define PPT_PST_MetaFile 4033
+#define PPT_PST_ExOleObj 4034
+#define PPT_PST_ExOleObjAtom 4035
+#define PPT_PST_ExPlainLinkAtom 4036
+#define PPT_PST_CorePict 4037
+#define PPT_PST_CorePictAtom 4038
+#define PPT_PST_ExPlainAtom 4039
+#define PPT_PST_SrKinsoku 4040
+#define PPT_PST_Handout 4041
+#define PPT_PST_ExEmbed 4044
+#define PPT_PST_ExEmbedAtom 4045
+#define PPT_PST_ExLink 4046
+#define PPT_PST_ExLinkAtom_old 4047
+#define PPT_PST_BookmarkEntityAtom 4048
+#define PPT_PST_ExLinkAtom 4049
+#define PPT_PST_SrKinsokuAtom 4050
+#define PPT_PST_ExHyperlinkAtom 4051
+#define PPT_PST_ExPlain 4053
+#define PPT_PST_ExPlainLink 4054
+#define PPT_PST_ExHyperlink 4055
+#define PPT_PST_SlideNumberMCAtom 4056
+#define PPT_PST_HeadersFooters 4057
+#define PPT_PST_HeadersFootersAtom 4058
+#define PPT_PST_RecolorEntryAtom 4062
+#define PPT_PST_TxInteractiveInfoAtom 4063
+#define PPT_PST_EmFormatAtom 4065
+#define PPT_PST_CharFormatAtom 4066
+#define PPT_PST_ParaFormatAtom 4067
+#define PPT_PST_MasterText 4068
+#define PPT_PST_RecolorInfoAtom 4071
+#define PPT_PST_ExQuickTime 4073
+#define PPT_PST_ExQuickTimeMovie 4074
+#define PPT_PST_ExQuickTimeMovieData 4075
+#define PPT_PST_ExSubscription 4076
+#define PPT_PST_ExSubscriptionSection 4077
+#define PPT_PST_ExControl 4078
+#define PPT_PST_ExControlAtom 4091
+#define PPT_PST_SlideListWithText 4080
+#define PPT_PST_AnimationInfoAtom 4081
+#define PPT_PST_InteractiveInfo 4082
+#define PPT_PST_InteractiveInfoAtom 4083
+#define PPT_PST_SlideList 4084
+#define PPT_PST_UserEditAtom 4085
+#define PPT_PST_CurrentUserAtom 4086
+#define PPT_PST_DateTimeMCAtom 4087
+#define PPT_PST_GenericDateMCAtom 4088
+#define PPT_PST_HeaderMCAtom 4089
+#define PPT_PST_FooterMCAtom 4090
+#define PPT_PST_ExMediaAtom 4100
+#define PPT_PST_ExVideo 4101
+#define PPT_PST_ExAviMovie 4102
+#define PPT_PST_ExMCIMovie 4103
+#define PPT_PST_ExMIDIAudio 4109
+#define PPT_PST_ExCDAudio 4110
+#define PPT_PST_ExWAVAudioEmbedded 4111
+#define PPT_PST_ExWAVAudioLink 4112
+#define PPT_PST_ExOleObjStg 4113
+#define PPT_PST_ExCDAudioAtom 4114
+#define PPT_PST_ExWAVAudioEmbeddedAtom 4115
+#define PPT_PST_AnimationInfo 4116
+#define PPT_PST_RTFDateTimeMCAtom 4117
+#define PPT_PST_ProgTags 5000
+#define PPT_PST_ProgStringTag 5001
+#define PPT_PST_ProgBinaryTag 5002
+#define PPT_PST_BinaryTagData 5003
+#define PPT_PST_PrintOptions 6000
+#define PPT_PST_PersistPtrFullBlock 6001
+#define PPT_PST_PersistPtrIncrementalBlock 6002
+
+// these atoms first was seen in ppt2000 in a private Tag atom
+#define PPT_PST_NewlyAddedAtomByPPT2000_6010 6010
+#define PPT_PST_NewlyAddedAtomByPPT2000_6011 6011
+
+#define PPT_PST_RulerIndentAtom 10000
+#define PPT_PST_GscalingAtom 10001
+#define PPT_PST_GrColorAtom 10002
+#define PPT_PST_GLPointAtom 10003
+#define PPT_PST_GlineAtom 10004
+
+#define PPT_PST_NewlyAddedAtomByXP11008 11008
+#define PPT_PST_NewlyAddedAtomByXP11010 11010
+#define PPT_PST_Comment10 12000
+#define PPT_PST_CommentAtom10 12001
+#define PPT_PST_NewlyAddedAtomByXP12004 12004
+#define PPT_PST_NewlyAddedAtomByXP12010 12010
+#define PPT_PST_NewlyAddedAtomByXP12011 12011
+#define PPT_PST_NewlyAddedAtomByXP14001 14001
+
+// Attribute fuer PptTextStyleSheet
+#define PPT_ParaAttr_BulletOn 0 //00000001
+#define PPT_ParaAttr_BuHardFont 1 //00000002
+#define PPT_ParaAttr_BuHardColor 2 //00000004
+#define PPT_ParaAttr_BuHardHeight 3 //00000008
+#define PPT_ParaAttr_BulletFont 4 //00000010
+#define PPT_ParaAttr_BulletColor 5 //00000020
+#define PPT_ParaAttr_BulletHeight 6 //00000040
+#define PPT_ParaAttr_BulletChar 7 //00000080
+#define PPT_ParaAttr_DontKnow1 8 //00000100
+#define PPT_ParaAttr_DontKnow2 9 //00000200
+#define PPT_ParaAttr_DontKnow3 10 //00000400
+#define PPT_ParaAttr_Adjust 11 //00000800 0000=Left, 0001=Center, 0002=Right, 0003=Block
+#define PPT_ParaAttr_LineFeed 12 //00001000
+#define PPT_ParaAttr_UpperDist 13 //00002000 ist bei Textframes default immer auf 0032 gesetzt
+#define PPT_ParaAttr_LowerDist 14 //00004000
+#define PPT_ParaAttr_TextOfs 15 //00008000
+#define PPT_ParaAttr_BulletOfs 16 //00010000
+#define PPT_ParaAttr_DefaultTab 17 //00020000
+#define PPT_ParaAttr_AsianLB_1 18
+#define PPT_ParaAttr_AsianLB_2 19
+#define PPT_ParaAttr_AsianLB_3 20
+#define PPT_ParaAttr_BiDi 21 //00200000
+
+#define PPT_CharAttr_Bold 0 //00000001
+#define PPT_CharAttr_Italic 1 //00000002
+#define PPT_CharAttr_Underline 2 //00000004
+#define PPT_CharAttr_Shadow 4 //00000010
+#define PPT_CharAttr_Strikeout 8 //00000100
+#define PPT_CharAttr_Embossed 9 //00000200
+#define PPT_CharAttr_ResetNumbering 10 //00000400
+#define PPT_CharAttr_EnableNumbering1 11 //00000800
+#define PPT_CharAttr_EnableNumbering2 12 //00001000
+#define PPT_CharAttr_Font 16 //00010000
+#define PPT_CharAttr_AsianOrComplexFont 21 //00200000
+#define PPT_CharAttr_ANSITypeface 22 //00400000
+#define PPT_CharAttr_Symbol 23 //00800000
+#define PPT_CharAttr_FontHeight 17 //00020000
+#define PPT_CharAttr_FontColor 18 //00040000
+#define PPT_CharAttr_Escapement 19 //00080000
+
+// Werte fuer PptSlideLayoutAtom.eLayout
+#define PPT_LAYOUT_TITLESLIDE 0 // The slide is a title slide
+#define PPT_LAYOUT_TITLEANDBODYSLIDE 1 // Title and body slide
+#define PPT_LAYOUT_TITLEMASTERSLIDE 2 // Title master slide
+#define PPT_LAYOUT_MASTERSLIDE 3 // Master slide layout
+#define PPT_LAYOUT_MASTERNOTES 4 // Master notes layout
+#define PPT_LAYOUT_NOTESTITLEBODY 5 // Notes title/body layout
+#define PPT_LAYOUT_HANDOUTLAYOUT 6 // Handout layout, therefore it doesn't have placeholders except header, footer, and date
+#define PPT_LAYOUT_ONLYTITLE 7 // Only title placeholder
+#define PPT_LAYOUT_2COLUMNSANDTITLE 8 // Body of the slide has 2 columns and a title
+#define PPT_LAYOUT_2ROWSANDTITLE 9 // Slide's body has 2 rows and a title
+#define PPT_LAYOUT_RIGHTCOLUMN2ROWS 10 // Body contains 2 columns, right column has 2 rows
+#define PPT_LAYOUT_LEFTCOLUMN2ROWS 11 // Body contains 2 columns, left column has 2 rows
+#define PPT_LAYOUT_BOTTOMROW2COLUMNS 12 // Body contains 2 rows, bottom row has 2 columns
+#define PPT_LAYOUT_TOPROW2COLUMN 13 // Body contains 2 rows, top row has 2 columns
+#define PPT_LAYOUT_4OBJECTS 14 // 4 objects
+#define PPT_LAYOUT_BIGOBJECT 15 // Big object
+#define PPT_LAYOUT_BLANCSLIDE 16 // Blank slide
+#define PPT_LAYOUT_TITLERIGHTBODYLEFT 17 // Vertical title on the right, body on the left
+#define PPT_LAYOUT_TITLERIGHT2BODIESLEFT 18 // Vertical title on the right, body on the left split into 2 rows
+
+// the following table describes the placeholder id's (values from reality followed by values taken from the documentation)
+#define PPT_PLACEHOLDER_NONE 0 // 0 None
+#define PPT_PLACEHOLDER_MASTERTITLE 1 // 1 Master title
+#define PPT_PLACEHOLDER_MASTERBODY 2 // 2 Master body
+#define PPT_PLACEHOLDER_MASTERCENTEREDTITLE 3 // 3 Master centered title
+#define PPT_PLACEHOLDER_MASTERSUBTITLE 4 // 10 Master subtitle
+#define PPT_PLACEHOLDER_MASTERNOTESSLIDEIMAGE 5 // 4 Master notes slide image
+#define PPT_PLACEHOLDER_MASTERNOTESBODYIMAGE 6 // 5 Master notes body image
+#define PPT_PLACEHOLDER_MASTERDATE 7 // 6 Master date
+#define PPT_PLACEHOLDER_MASTERSLIDENUMBER 8 // 7 Master slide number
+#define PPT_PLACEHOLDER_MASTERFOOTER 9 // 8 Master footer
+#define PPT_PLACEHOLDER_MASTERHEADER 10 // 9 Master header
+#define PPT_PLACEHOLDER_GENERICTEXTOBJECT // 11 Generic text object
+#define PPT_PLACEHOLDER_TITLE 13 // 12 Title
+#define PPT_PLACEHOLDER_BODY 14 // 13 Body
+#define PPT_PLACEHOLDER_NOTESBODY 12 // 14 Notes body
+#define PPT_PLACEHOLDER_CENTEREDTITLE 15 // 15 Centered title
+#define PPT_PLACEHOLDER_SUBTITLE 16 // 16 Subtitle
+#define PPT_PLACEHOLDER_VERTICALTEXTTITLE 17 // 17 Vertical text title
+#define PPT_PLACEHOLDER_VERTICALTEXTBODY 18 // 18 Vertical text body
+#define PPT_PLACEHOLDER_NOTESSLIDEIMAGE 11 // 19 Notes slide image
+#define PPT_PLACEHOLDER_OBJECT 19 // 20 Object (no matter the size)
+#define PPT_PLACEHOLDER_GRAPH 20 // 21 Graph
+#define PPT_PLACEHOLDER_TABLE 21 // 22 Table
+#define PPT_PLACEHOLDER_CLIPART 22 // 23 Clip Art
+#define PPT_PLACEHOLDER_ORGANISZATIONCHART 23 // 24 Organization Chart
+#define PPT_PLACEHOLDER_MEDIACLIP 24 // 25 Media Clip
+
+#endif //_SVDFPPT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/svxmsbas.hxx b/include/filter/msfilter/svxmsbas.hxx
new file mode 100644
index 000000000000..8f87401edee5
--- /dev/null
+++ b/include/filter/msfilter/svxmsbas.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVXMSBAS_HXX
+#define _SVXMSBAS_HXX
+
+#include <tools/solar.h>
+#include "filter/msfilter/msfilterdllapi.h"
+
+#include <sot/storage.hxx>
+#include <map>
+#include <boost/unordered_map.hpp>
+
+class SfxObjectShell;
+
+/* Construct with the root storage of the MS document, with bImportCode
+ * set the visual basic code will be imported into the stardocument when Import
+ * is called, with bCopyStorage set, the visual basic storage tree will be
+ * copied completely into staroffice, so that any future export to a msoffice
+ * format will retain the vba code, allowing a lossless roundtrip from
+ * msoffice to staroffice and back.
+ *
+ * Setting bAsComment to true in Import will import the visual basic as a
+ * starbasic comment. Which is currently necessary, as vb is not valid sb.
+ *
+ * Setting bStripped will remove the "Attribute" lines from the vb, msoffice
+ * does this itself when it shows the vb code in the vbeditor, so this is
+ * probably what the user expects to see when viewing the code
+ */
+
+typedef boost::unordered_map< sal_Int32, OUString > ObjIdToName;
+
+typedef std::map< OUString, ObjIdToName > ControlAttributeInfo;
+
+class MSFILTER_DLLPUBLIC SvxImportMSVBasic
+{
+public:
+ SvxImportMSVBasic( SfxObjectShell &rDocS, SotStorage &rRoot )
+ : xRoot(&rRoot), rDocSh(rDocS)
+ {}
+ // only for the export - copy or delete the saved VBA-macro-storage
+ // form the ObjectShell
+ // - returns a warning code if a modified basic exist, in all other
+ // cases return ERRCODE_NONE.
+ sal_uLong SaveOrDelMSVBAStorage( sal_Bool bSaveInto, const OUString& rStorageName );
+
+ // check if the MS-VBA-Storage exist in the RootStorage of the DocShell.
+ // If it exist, then return the WarningId for loosing the information.
+ static sal_uLong GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS );
+
+ static OUString GetMSBasicStorageName();
+private:
+ SotStorageRef xRoot;
+ SfxObjectShell &rDocSh;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/util.hxx b/include/filter/msfilter/util.hxx
new file mode 100644
index 000000000000..f50e4d10ea83
--- /dev/null
+++ b/include/filter/msfilter/util.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_MSFILTER_UTIL_HXX
+#define INCLUDED_MSFILTER_UTIL_HXX
+
+#include <rtl/textenc.h>
+#include <tools/datetime.hxx>
+#include <tools/color.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+#include "filter/msfilter/msfilterdllapi.h"
+
+namespace msfilter {
+namespace util {
+
+/// Returns the best-fit default 8bit encoding for a given locale
+/// i.e. useful when dealing with legacy formats which use legacy text encodings without recording
+/// what the encoding is, but you know or can guess the language
+MSFILTER_DLLPUBLIC rtl_TextEncoding getBestTextEncodingFromLocale(const ::com::sun::star::lang::Locale &rLocale);
+
+/// Convert a color in BGR format to RGB.
+MSFILTER_DLLPUBLIC sal_uInt32 BGRToRGB(sal_uInt32 nColour);
+
+/** Convert from DTTM to Writer's DateTime
+
+ @author
+ <a href="mailto:mmaher@openoffice.org">Martin Maher</a
+ */
+MSFILTER_DLLPUBLIC DateTime DTTM2DateTime( long lDTTM );
+
+/** Convert DateTime to xsd::dateTime string.
+
+I guess there must be an implementation of this somewhere in LO, but I failed
+to find it, unfortunately :-(
+*/
+MSFILTER_DLLPUBLIC OString DateTimeToOString( const DateTime& rDateTime );
+
+/// Given a cBullet in encoding r_ioChrSet and fontname r_ioFontName return a
+/// suitable new Bullet and change r_ioChrSet and r_ioFontName to form the
+/// best-fit replacement in terms of default available MSOffice symbol
+/// fonts.
+///
+/// Set bDisableUnicodeSupport when exporting to 8bit encodings
+///
+/// Used to map from [Open|Star]Symbol to some Windows font or other.
+MSFILTER_DLLPUBLIC sal_Unicode bestFitOpenSymbolToMSFont(sal_Unicode cBullet,
+ rtl_TextEncoding& r_ioChrSet, OUString& r_ioFontName, bool bDisableUnicodeSupport = false);
+
+
+enum TextCategory
+{
+ latin, //Latin
+ cs, //Complex Script
+ ea, //East Asian
+ sym //Symbol
+};
+
+/** Categorize codepoints according to how MS seems to do it.
+
+ It's been bugging me for ages as to what codepoint MS considers in
+ what category. Tom Jebo has a post suggesting the criteria used here
+ and indicating its been submitting to the standards working group
+ as a proposed resolution.
+*/
+MSFILTER_DLLPUBLIC TextCategory categorizeCodePoint(sal_uInt32 codePoint, const OUString &rBcp47LanguageTag);
+
+/// Converts tools Color to HTML color (without leading hashmark).
+MSFILTER_DLLPUBLIC OString ConvertColor( const Color &rColor );
+
+}
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/ExternalReferenceHelper.hxx b/include/formula/ExternalReferenceHelper.hxx
new file mode 100644
index 000000000000..cd9b3b5b69c6
--- /dev/null
+++ b/include/formula/ExternalReferenceHelper.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef FORMULA_EXTERNALREFERENCEHELPER_HXX
+#define FORMULA_EXTERNALREFERENCEHELPER_HXX
+
+#include <rtl/ustring.hxx>
+#include "formula/formuladllapi.h"
+
+namespace formula
+{
+ class FORMULA_DLLPUBLIC SAL_NO_VTABLE ExternalReferenceHelper
+ {
+ public:
+ virtual OUString getCacheTableName(sal_uInt16 nFileId, size_t nTabIndex) const = 0;
+
+ protected:
+ ~ExternalReferenceHelper() {}
+ };
+// =============================================================================
+} // formula
+// =============================================================================
+#endif //FORMULA_EXTERNALREFERENCEHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/FormulaCompiler.hxx b/include/formula/FormulaCompiler.hxx
new file mode 100644
index 000000000000..b53bb2df4316
--- /dev/null
+++ b/include/formula/FormulaCompiler.hxx
@@ -0,0 +1,388 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef FORMULA_COMPILER_HXX_INCLUDED
+#define FORMULA_COMPILER_HXX_INCLUDED
+
+#include "formula/formuladllapi.h"
+#include <tools/string.hxx>
+#include <tools/debug.hxx>
+#include <rtl/ustrbuf.hxx>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/unordered_map.hpp>
+
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include "formula/opcode.hxx"
+#include "formula/grammar.hxx"
+#include "formula/token.hxx"
+#include "formula/ExternalReferenceHelper.hxx"
+
+
+#define MAXJUMPCOUNT 32 /* maximum number of jumps (ocChose) */
+#define MAXCODE 512 /* maximum number of tokens in formula */
+
+
+namespace com { namespace sun { namespace star {
+ namespace sheet {
+ struct FormulaOpCodeMapEntry;
+ struct FormulaToken;
+ }
+}}}
+
+
+namespace formula
+{
+ class FormulaTokenArray;
+
+struct FormulaArrayStack
+{
+ FormulaArrayStack* pNext;
+ FormulaTokenArray* pArr;
+ bool bTemp;
+};
+
+
+struct FORMULA_DLLPUBLIC StringHashCode
+{
+ size_t operator()( const String& rStr ) const
+ {
+ return rtl_ustr_hashCode_WithLength( rStr.GetBuffer(), rStr.Len() );
+ }
+};
+
+typedef ::boost::unordered_map< String, OpCode, StringHashCode, ::std::equal_to< String > > OpCodeHashMap;
+typedef ::boost::unordered_map< String, String, StringHashCode, ::std::equal_to< String > > ExternalHashMap;
+
+class FORMULA_DLLPUBLIC FormulaCompiler
+{
+public:
+ FormulaCompiler();
+ FormulaCompiler(FormulaTokenArray& _rArr);
+ virtual ~FormulaCompiler();
+
+ // SUNWS8 needs a forward declared friend, otherwise members of the outer
+ // class are not accessible.
+ class OpCodeMap;
+ friend class FormulaCompiler::OpCodeMap;
+
+ /** Mappings from strings to OpCodes and vice versa. */
+ class FORMULA_DLLPUBLIC OpCodeMap
+ {
+ OpCodeHashMap * mpHashMap; /// Hash map of symbols, String -> OpCode
+ String * mpTable; /// Array of symbols, OpCode -> String, offset==OpCode
+ ExternalHashMap * mpExternalHashMap; /// Hash map of ocExternal, Filter String -> AddIn String
+ ExternalHashMap * mpReverseExternalHashMap; /// Hash map of ocExternal, AddIn String -> Filter String
+ FormulaGrammar::Grammar meGrammar; /// Grammar, language and reference convention
+ sal_uInt16 mnSymbols; /// Count of OpCode symbols
+ bool mbCore : 1; /// If mapping was setup by core, not filters
+ bool mbEnglish : 1; /// If English symbols and external names
+
+ OpCodeMap(); // prevent usage
+ OpCodeMap( const OpCodeMap& ); // prevent usage
+ OpCodeMap& operator=( const OpCodeMap& ); // prevent usage
+
+ public:
+
+ OpCodeMap(sal_uInt16 nSymbols, bool bCore, FormulaGrammar::Grammar eGrammar ) :
+ mpHashMap( new OpCodeHashMap( nSymbols)),
+ mpTable( new String[ nSymbols ]),
+ mpExternalHashMap( new ExternalHashMap),
+ mpReverseExternalHashMap( new ExternalHashMap),
+ meGrammar( eGrammar),
+ mnSymbols( nSymbols),
+ mbCore( bCore)
+ {
+ mbEnglish = FormulaGrammar::isEnglish( meGrammar);
+ }
+ virtual ~OpCodeMap();
+
+ void copyFrom( const OpCodeMap& r );
+
+ /// Get the symbol String -> OpCode hash map for finds.
+ inline const OpCodeHashMap* getHashMap() const { return mpHashMap; }
+
+ /// Get the symbol String -> AddIn String hash map for finds.
+ inline const ExternalHashMap* getExternalHashMap() const { return mpExternalHashMap; }
+
+ /// Get the AddIn String -> symbol String hash map for finds.
+ inline const ExternalHashMap* getReverseExternalHashMap() const { return mpReverseExternalHashMap; }
+
+ /// Get the symbol string matching an OpCode.
+ inline const String& getSymbol( const OpCode eOp ) const
+ {
+ DBG_ASSERT( sal_uInt16(eOp) < mnSymbols, "OpCodeMap::getSymbol: OpCode out of range");
+ if (sal_uInt16(eOp) < mnSymbols)
+ return mpTable[ eOp ];
+ static String s_sEmpty;
+ return s_sEmpty;
+ }
+
+ /// Get the grammar.
+ inline FormulaGrammar::Grammar getGrammar() const { return meGrammar; }
+
+ /// Get the symbol count.
+ inline sal_uInt16 getSymbolCount() const { return mnSymbols; }
+
+ /** Are these English symbols, as opposed to native language (which may
+ be English as well)? */
+ inline bool isEnglish() const { return mbEnglish; }
+
+ /// Is it an internal core mapping, or setup by filters?
+ inline bool isCore() const { return mbCore; }
+
+ /// Is it an ODF 1.1 compatibility mapping?
+ inline bool isPODF() const { return FormulaGrammar::isPODF( meGrammar); }
+
+ /// Is it an ODFF / ODF 1.2 mapping?
+ inline bool isODFF() const { return FormulaGrammar::isODFF( meGrammar); }
+
+ /// Does it have external symbol/name mappings?
+ inline bool hasExternals() const { return !mpExternalHashMap->empty(); }
+
+ /// Put entry of symbol String and OpCode pair.
+ void putOpCode( const String & rStr, const OpCode eOp );
+
+ /// Put entry of symbol String and AddIn international String pair.
+ void putExternal( const String & rSymbol, const String & rAddIn );
+
+ /** Put entry of symbol String and AddIn international String pair,
+ failing silently if rAddIn name already exists. */
+ void putExternalSoftly( const String & rSymbol, const String & rAddIn );
+
+ /// Core implementation of XFormulaOpCodeMapper::getMappings()
+ ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken >
+ createSequenceOfFormulaTokens(const FormulaCompiler& _rCompiler,
+ const ::com::sun::star::uno::Sequence< OUString >& rNames ) const;
+
+ /// Core implementation of XFormulaOpCodeMapper::getAvailableMappings()
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::sheet::FormulaOpCodeMapEntry >
+ createSequenceOfAvailableMappings( const FormulaCompiler& _rCompiler,const sal_Int32 nGroup ) const;
+
+ /** The value used in createSequenceOfAvailableMappings() and thus in
+ XFormulaOpCodeMapper::getMappings() for an unknown symbol. */
+ static sal_Int32 getOpCodeUnknown();
+ };
+
+public:
+ typedef ::boost::shared_ptr< const OpCodeMap > OpCodeMapPtr;
+ typedef ::boost::shared_ptr< OpCodeMap > NonConstOpCodeMapPtr;
+
+ /** Get OpCodeMap for formula language.
+ @param nLanguage
+ One of ::com::sun::star::sheet::FormulaLanguage constants.
+ @return Map for nLanguage. If nLanguage is unknown, a NULL map is returned.
+ */
+ OpCodeMapPtr GetOpCodeMap( const sal_Int32 nLanguage ) const;
+
+ /** Create an internal symbol map from API mapping.
+ @param bEnglish
+ Use English number parser / formatter instead of native.
+ */
+ OpCodeMapPtr CreateOpCodeMap(
+ const ::com::sun::star::uno::Sequence<
+ const ::com::sun::star::sheet::FormulaOpCodeMapEntry > & rMapping,
+ bool bEnglish );
+
+ /** Get current OpCodeMap in effect. */
+ inline OpCodeMapPtr GetCurrentOpCodeMap() const { return mxSymbols; }
+
+ /** Get OpCode for English symbol.
+ Used in XFunctionAccess to create token array.
+ @param rName
+ Symbol to lookup. MUST be upper case.
+ */
+ OpCode GetEnglishOpCode( const String& rName ) const;
+
+ sal_uInt16 GetErrorConstant( const String& rName ) const;
+
+ void SetCompileForFAP( bool bVal )
+ { bCompileForFAP = bVal; bIgnoreErrors = bVal; }
+
+ static bool IsOpCodeVolatile( OpCode eOp );
+
+ static bool DeQuote( String& rStr );
+
+
+ static const String& GetNativeSymbol( OpCode eOp );
+ static bool IsMatrixFunction(OpCode _eOpCode); // if a function _always_ returns a Matrix
+
+ short GetNumFormatType() const { return nNumFmt; }
+ bool CompileTokenArray();
+
+ void CreateStringFromTokenArray( String& rFormula );
+ void CreateStringFromTokenArray( OUStringBuffer& rBuffer );
+ FormulaToken* CreateStringFromToken( String& rFormula, FormulaToken* pToken,
+ bool bAllowArrAdvance = false );
+ FormulaToken* CreateStringFromToken( OUStringBuffer& rBuffer, FormulaToken* pToken,
+ bool bAllowArrAdvance = false );
+
+ void AppendBoolean( OUStringBuffer& rBuffer, bool bVal );
+ void AppendDouble( OUStringBuffer& rBuffer, double fVal );
+ void AppendString( OUStringBuffer& rBuffer, const String & rStr );
+
+ /** Set symbol map corresponding to one of predefined formula::FormulaGrammar::Grammar,
+ including an address reference convention. */
+ inline FormulaGrammar::Grammar GetGrammar() const { return meGrammar; }
+
+ static void UpdateSeparatorsNative( const OUString& rSep, const OUString& rArrayColSep, const OUString& rArrayRowSep );
+ static void ResetNativeSymbols();
+ static void SetNativeSymbols( const OpCodeMapPtr& xMap );
+protected:
+ virtual String FindAddInFunction( const String& rUpperName, bool bLocalFirst ) const;
+ virtual void fillFromAddInCollectionUpperName( NonConstOpCodeMapPtr xMap ) const;
+ virtual void fillFromAddInMap( NonConstOpCodeMapPtr xMap, FormulaGrammar::Grammar _eGrammar ) const;
+ virtual void fillFromAddInCollectionEnglishName( NonConstOpCodeMapPtr xMap ) const;
+ virtual void fillAddInToken(::std::vector< ::com::sun::star::sheet::FormulaOpCodeMapEntry >& _rVec,bool _bIsEnglish) const;
+
+ virtual void SetError(sal_uInt16 nError);
+ virtual FormulaTokenRef ExtendRangeReference( FormulaToken & rTok1, FormulaToken & rTok2, bool bReuseDoubleRef );
+ virtual bool HandleExternalReference(const FormulaToken& _aToken);
+ virtual bool HandleRange();
+ virtual bool HandleSingleRef();
+ virtual bool HandleDbData();
+
+ virtual void CreateStringFromExternal(OUStringBuffer& rBuffer, FormulaToken* pTokenP);
+ virtual void CreateStringFromSingleRef(OUStringBuffer& rBuffer,FormulaToken* pTokenP);
+ virtual void CreateStringFromDoubleRef(OUStringBuffer& rBuffer,FormulaToken* pTokenP);
+ virtual void CreateStringFromMatrix(OUStringBuffer& rBuffer,FormulaToken* pTokenP);
+ virtual void CreateStringFromIndex(OUStringBuffer& rBuffer,FormulaToken* pTokenP);
+ virtual void LocalizeString( String& rName ); // modify rName - input: exact name
+
+ void AppendErrorConstant( OUStringBuffer& rBuffer, sal_uInt16 nError );
+
+ bool GetToken();
+ OpCode NextToken();
+ void PutCode( FormulaTokenRef& );
+ void Factor();
+ void RangeLine();
+ void UnionLine();
+ void IntersectionLine();
+ void UnaryLine();
+ void PostOpLine();
+ void PowLine();
+ void MulDivLine();
+ void AddSubLine();
+ void ConcatLine();
+ void CompareLine();
+ void NotLine();
+ OpCode Expression();
+ void PopTokenArray();
+ void PushTokenArray( FormulaTokenArray*, bool = false );
+
+ bool MergeRangeReference( FormulaToken * * const pCode1, FormulaToken * const * const pCode2 );
+
+ String aCorrectedFormula; // autocorrected Formula
+ String aCorrectedSymbol; // autocorrected Symbol
+
+ OpCodeMapPtr mxSymbols; // which symbols are used
+
+ FormulaTokenRef mpToken; // current token
+ FormulaTokenRef pCurrentFactorToken; // current factor token (of Factor() method)
+ FormulaTokenArray* pArr;
+ ExternalReferenceHelper* pExternalRef;
+
+ FormulaToken** pCode;
+ FormulaArrayStack* pStack;
+
+ OpCode eLastOp;
+ short nRecursion; // GetToken() recursions
+ short nNumFmt; // set during CompileTokenArray()
+ sal_uInt16 pc; // program counter
+
+ FormulaGrammar::Grammar meGrammar; // The grammar used, language plus convention.
+
+ bool bAutoCorrect; // whether to apply AutoCorrection
+ bool bCorrected; // AutoCorrection was applied
+ bool bCompileForFAP; //! not real RPN but names, for FunctionAutoPilot
+ // will not be resolved
+ bool bIgnoreErrors; // on AutoCorrect and CompileForFAP
+ // ignore errors and create RPN nevertheless
+ bool glSubTotal; // if code contains one or more subtotal functions
+private:
+ void InitSymbolsNative() const; /// only SymbolsNative, on first document creation
+ void InitSymbolsEnglish() const; /// only SymbolsEnglish, maybe later
+ void InitSymbolsPODF() const; /// only SymbolsPODF, on demand
+ void InitSymbolsODFF() const; /// only SymbolsODFF, on demand
+ void InitSymbolsEnglishXL() const; /// only SymbolsEnglishXL, on demand
+
+ void loadSymbols(sal_uInt16 _nSymbols,FormulaGrammar::Grammar _eGrammar,NonConstOpCodeMapPtr& _xMap) const;
+
+ static inline void ForceArrayOperator( FormulaTokenRef& rCurr, const FormulaTokenRef& rPrev )
+ {
+ if ( rPrev && rPrev->HasForceArray() &&
+ rCurr->GetType() == svByte && rCurr->GetOpCode() != ocPush
+ && !rCurr->HasForceArray() )
+ rCurr->SetForceArray( true);
+ }
+
+ // SUNWS7 needs a forward declared friend, otherwise members of the outer
+ // class are not accessible.
+ class CurrentFactor;
+ friend class FormulaCompiler::CurrentFactor;
+ class CurrentFactor
+ {
+ FormulaTokenRef pPrevFac;
+ FormulaCompiler* pCompiler;
+ // not implemented
+ CurrentFactor( const CurrentFactor& );
+ CurrentFactor& operator=( const CurrentFactor& );
+ public:
+ explicit CurrentFactor( FormulaCompiler* pComp )
+ : pPrevFac( pComp->pCurrentFactorToken )
+ , pCompiler( pComp )
+ {}
+ ~CurrentFactor()
+ { pCompiler->pCurrentFactorToken = pPrevFac; }
+ // yes, this operator= may modify the RValue
+ void operator=( FormulaTokenRef& r )
+ {
+ ForceArrayOperator( r, pPrevFac);
+ pCompiler->pCurrentFactorToken = r;
+ }
+ void operator=( FormulaToken* p )
+ {
+ FormulaTokenRef xTemp( p );
+ *this = xTemp;
+ }
+ operator FormulaTokenRef&()
+ { return pCompiler->pCurrentFactorToken; }
+ FormulaToken* operator->()
+ { return pCompiler->pCurrentFactorToken.operator->(); }
+ operator FormulaToken*()
+ { return operator->(); }
+ };
+
+
+ mutable NonConstOpCodeMapPtr mxSymbolsODFF; // ODFF symbols
+ mutable NonConstOpCodeMapPtr mxSymbolsPODF; // ODF 1.1 symbols
+ mutable NonConstOpCodeMapPtr mxSymbolsNative; // native symbols
+ mutable NonConstOpCodeMapPtr mxSymbolsEnglish; // English symbols
+ mutable NonConstOpCodeMapPtr mxSymbolsEnglishXL; // English Excel symbols (for VBA formula parsing)
+};
+// =============================================================================
+} // formula
+// =============================================================================
+
+#endif // FORMULA_COMPILER_HXX_INCLUDED
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/FormulaOpCodeMapperObj.hxx b/include/formula/FormulaOpCodeMapperObj.hxx
new file mode 100644
index 000000000000..07945ca27101
--- /dev/null
+++ b/include/formula/FormulaOpCodeMapperObj.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef FORMULA_FORMULAOPCODEMAPPER_HXX_INCLUDED
+#define FORMULA_FORMULAOPCODEMAPPER_HXX_INCLUDED
+
+#include "formula/formuladllapi.h"
+#include <cppuhelper/implbase2.hxx>
+#include <com/sun/star/sheet/XFormulaOpCodeMapper.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <memory>
+#include "formula/FormulaCompiler.hxx"
+
+
+namespace formula
+{
+
+class FORMULA_DLLPUBLIC FormulaOpCodeMapperObj : public ::cppu::WeakImplHelper2<
+ ::com::sun::star::sheet::XFormulaOpCodeMapper,
+ ::com::sun::star::lang::XServiceInfo >
+{
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ ::std::auto_ptr<FormulaCompiler> m_pCompiler;
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+public:
+ static OUString getImplementationName_Static();
+ static ::com::sun::star::uno::Sequence< OUString> getSupportedServiceNames_Static();
+ static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > create(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _xContext);
+
+protected:
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ FormulaOpCodeMapperObj(::std::auto_ptr<FormulaCompiler> _pCompiler);
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+ virtual ~FormulaOpCodeMapperObj();
+
+private:
+ // XFormulaOpCodeMapper
+ // Attributes
+ virtual ::sal_Int32 SAL_CALL getOpCodeExternal() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getOpCodeUnknown() throw (::com::sun::star::uno::RuntimeException);
+ // Methods
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > SAL_CALL getMappings(
+ const ::com::sun::star::uno::Sequence< OUString >& rNames,
+ sal_Int32 nLanguage )
+ throw ( ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaOpCodeMapEntry > SAL_CALL getAvailableMappings(
+ sal_Int32 nLanguage, sal_Int32 nGroups )
+ throw ( ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName()
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
+ throw(::com::sun::star::uno::RuntimeException);
+
+};
+// =============================================================================
+} // formula
+// =============================================================================
+
+#endif // FORMULA_FORMULAOPCODEMAPPER_HXX_INCLUDED
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/IControlReferenceHandler.hxx b/include/formula/IControlReferenceHandler.hxx
new file mode 100644
index 000000000000..bee4bac3953e
--- /dev/null
+++ b/include/formula/IControlReferenceHandler.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef FORMULA_ICONTROL_REFERENCE_HANDLER_HXX_INCLUDED
+#define FORMULA_ICONTROL_REFERENCE_HANDLER_HXX_INCLUDED
+
+#include "formula/formuladllapi.h"
+
+namespace formula
+{
+ class RefEdit;
+ class RefButton;
+ class FORMULA_DLLPUBLIC SAL_NO_VTABLE IControlReferenceHandler
+ {
+ public:
+ virtual void ShowReference(const String& _sRef) = 0;
+ virtual void HideReference( sal_Bool bDoneRefMode = sal_True ) = 0;
+ virtual void ReleaseFocus( RefEdit* pEdit, RefButton* pButton = NULL ) = 0;
+ virtual void ToggleCollapsed( RefEdit* pEdit, RefButton* pButton = NULL ) = 0;
+
+ protected:
+ ~IControlReferenceHandler() {}
+ };
+} // formula
+#endif // FORMULA_ICONTROL_REFERENCE_HANDLER_HXX_INCLUDED
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/IFunctionDescription.hxx b/include/formula/IFunctionDescription.hxx
new file mode 100644
index 000000000000..1747c2f2ddce
--- /dev/null
+++ b/include/formula/IFunctionDescription.hxx
@@ -0,0 +1,170 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDE_FUNCTION_DESCRIPTION
+#define INCLUDE_FUNCTION_DESCRIPTION
+
+#include <vector>
+#include <memory>
+#include "formula/formuladllapi.h"
+#include <rtl/ustring.hxx>
+#include <tools/string.hxx>
+#include <com/sun/star/sheet/XFormulaParser.hpp>
+#include <com/sun/star/sheet/XFormulaOpCodeMapper.hpp>
+
+class SvTreeListEntry;
+
+namespace formula
+{
+ class IFunctionCategory;
+ class IFunctionDescription;
+ class FormEditData;
+ class FormulaTokenArray;
+
+ class SAL_NO_VTABLE IFunctionManager
+ {
+ public:
+ IFunctionManager(){}
+ enum EToken
+ {
+ eOk,
+ eClose,
+ eSep,
+ eArrayOpen,
+ eArrayClose
+ };
+ virtual sal_uInt32 getCount() const = 0;
+ virtual const IFunctionCategory* getCategory(sal_uInt32 nPos) const = 0;
+ virtual void fillLastRecentlyUsedFunctions(::std::vector< const IFunctionDescription*>& _rLastRUFunctions) const = 0;
+ virtual const IFunctionDescription* getFunctionByName(const OUString& _sFunctionName) const = 0;
+
+ virtual sal_Unicode getSingleToken(const EToken _eToken) const = 0;
+
+ protected:
+ ~IFunctionManager() {}
+ };
+
+ class SAL_NO_VTABLE IFunctionCategory
+ {
+ public:
+ IFunctionCategory(){}
+ virtual const IFunctionManager* getFunctionManager() const = 0;
+ virtual sal_uInt32 getCount() const = 0;
+ virtual const IFunctionDescription* getFunction(sal_uInt32 _nPos) const = 0;
+ virtual sal_uInt32 getNumber() const = 0;
+ virtual OUString getName() const = 0;
+
+ protected:
+ ~IFunctionCategory() {}
+ };
+
+ class SAL_NO_VTABLE IFunctionDescription
+ {
+ public:
+ IFunctionDescription(){}
+ virtual OUString getFunctionName() const = 0;
+ virtual const IFunctionCategory* getCategory() const = 0;
+ virtual OUString getDescription() const = 0;
+ // GetSuppressedArgCount
+ virtual xub_StrLen getSuppressedArgumentCount() const = 0;
+ // GetFormulaString
+ virtual OUString getFormula(const ::std::vector< OUString >& _aArguments) const = 0;
+ // GetVisibleArgMapping
+ virtual void fillVisibleArgumentMapping(::std::vector<sal_uInt16>& _rArguments) const = 0;
+ virtual void initArgumentInfo() const = 0;
+ virtual OUString getSignature() const = 0;
+ virtual OString getHelpId() const = 0;
+
+ // parameter
+ virtual sal_uInt32 getParameterCount() const = 0;
+ virtual OUString getParameterName(sal_uInt32 _nPos) const = 0;
+ virtual OUString getParameterDescription(sal_uInt32 _nPos) const = 0;
+ virtual bool isParameterOptional(sal_uInt32 _nPos) const = 0;
+
+ protected:
+ ~IFunctionDescription() {}
+ };
+
+ class SAL_NO_VTABLE IFormulaToken
+ {
+ public:
+ virtual bool isFunction() const = 0;
+ virtual sal_uInt32 getArgumentCount() const = 0;
+
+ protected:
+ ~IFormulaToken() {}
+ };
+
+ class SAL_NO_VTABLE IStructHelper
+ {
+ public:
+ IStructHelper(){}
+ virtual SvTreeListEntry* InsertEntry(const XubString& rText, SvTreeListEntry* pParent,
+ sal_uInt16 nFlag,sal_uLong nPos=0,IFormulaToken* pScToken=NULL) = 0;
+
+ virtual String GetEntryText(SvTreeListEntry* pEntry) const = 0;
+ virtual SvTreeListEntry* GetParent(SvTreeListEntry* pEntry) const = 0;
+
+ protected:
+ ~IStructHelper() {}
+ };
+
+ class SAL_NO_VTABLE IFormulaEditorHelper
+ {
+ public:
+ IFormulaEditorHelper(){}
+ virtual void notifyChange() = 0;
+ virtual void fill() = 0;
+
+ virtual String getCurrentFormula() const = 0;
+ virtual void setCurrentFormula(const String& _sReplacement) = 0;
+
+ virtual void getSelection(xub_StrLen& _nStart,xub_StrLen& _nEnd) const = 0;
+ virtual void setSelection(xub_StrLen _nStart,xub_StrLen _nEnd) = 0;
+
+ virtual FormEditData* getFormEditData() const = 0;
+ virtual bool calculateValue(const String& _sExpression,String& _rResult) = 0;
+
+ virtual void switchBack() = 0;
+
+ virtual void clear() = 0;
+ virtual void deleteFormData() = 0;
+ virtual void setReferenceInput(const FormEditData* _pData) = 0;
+
+ virtual IFunctionManager* getFunctionManager() = 0;
+ virtual ::std::auto_ptr<FormulaTokenArray> convertToTokenArray(const ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken >& _aTokenList) = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaParser> getFormulaParser() const = 0;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaOpCodeMapper> getFormulaOpCodeMapper() const = 0;
+ virtual ::com::sun::star::table::CellAddress getReferencePosition() const = 0;
+
+ virtual void setDispatcherLock( sal_Bool bLock ) = 0;
+ virtual void dispatch(sal_Bool _bOK,sal_Bool _bMartixChecked) = 0;
+ virtual void doClose(sal_Bool _bOk) = 0;
+ virtual void insertEntryToLRUList(const IFunctionDescription* pDesc) = 0;
+ virtual void showReference(const String& _sFormula) = 0;
+
+ protected:
+ ~IFormulaEditorHelper() {}
+ };
+
+}
+#endif //INCLUDE_FUNCTION_DESCRIPTION
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/compiler.hrc b/include/formula/compiler.hrc
new file mode 100644
index 000000000000..053947c2a796
--- /dev/null
+++ b/include/formula/compiler.hrc
@@ -0,0 +1,423 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef FORMULA_COMPILER_HRC
+#define FORMULA_COMPILER_HRC
+
+/* Central definition of OpCodes for spreadsheet functions */
+
+/*** Special commands ***/
+#define SC_OPCODE_PUSH 0 /* internal commands */
+#define SC_OPCODE_CALL 1
+#define SC_OPCODE_STOP 2
+#define SC_OPCODE_EXTERNAL 3
+#define SC_OPCODE_NAME 4
+#define SC_OPCODE_EXTERNAL_REF 5
+#define SC_OPCODE_IF 6 /* jump commands */
+#define SC_OPCODE_IF_ERROR 7
+#define SC_OPCODE_IF_NA 8
+#define SC_OPCODE_CHOSE 9
+#define SC_OPCODE_OPEN 10 /* parentheses and separators */
+#define SC_OPCODE_CLOSE 11
+#define SC_OPCODE_SEP 12
+#define SC_OPCODE_MISSING 13 /* special OpCodes */
+#define SC_OPCODE_BAD 14
+#define SC_OPCODE_STRINGXML 15
+#define SC_OPCODE_SPACES 16
+#define SC_OPCODE_MAT_REF 17
+#define SC_OPCODE_DB_AREA 18 /* additional access operators */
+#define SC_OPCODE_MACRO 19
+#define SC_OPCODE_COL_ROW_NAME 20
+#define SC_OPCODE_COL_ROW_NAME_AUTO 21
+#define SC_OPCODE_PERCENT_SIGN 22 /* operator _follows_ value */
+#define SC_OPCODE_ARRAY_OPEN 23
+#define SC_OPCODE_ARRAY_CLOSE 24
+#define SC_OPCODE_ARRAY_ROW_SEP 25
+#define SC_OPCODE_ARRAY_COL_SEP 26 /* some convs use sep != col_sep */
+#define SC_OPCODE_STOP_DIV 27
+#define SC_OPCODE_SKIP 28 /* used to skip raw tokens during string compilation */
+
+/*** error constants #... ***/
+#define SC_OPCODE_START_ERRORS 30
+#define SC_OPCODE_ERROR_NULL 30
+#define SC_OPCODE_ERROR_DIVZERO 31
+#define SC_OPCODE_ERROR_VALUE 32
+#define SC_OPCODE_ERROR_REF 33
+#define SC_OPCODE_ERROR_NAME 34
+#define SC_OPCODE_ERROR_NUM 35
+#define SC_OPCODE_ERROR_NA 36
+#define SC_OPCODE_STOP_ERRORS 37
+
+/*** Binary operators ***/
+#define SC_OPCODE_START_BIN_OP 40
+#define SC_OPCODE_ADD 40
+#define SC_OPCODE_SUB 41
+#define SC_OPCODE_MUL 42
+#define SC_OPCODE_DIV 43
+#define SC_OPCODE_AMPERSAND 44
+#define SC_OPCODE_POW 45
+#define SC_OPCODE_EQUAL 46
+#define SC_OPCODE_NOT_EQUAL 47
+#define SC_OPCODE_LESS 48
+#define SC_OPCODE_GREATER 49
+#define SC_OPCODE_LESS_EQUAL 50
+#define SC_OPCODE_GREATER_EQUAL 51
+#define SC_OPCODE_AND 52
+#define SC_OPCODE_OR 53
+#define SC_OPCODE_INTERSECT 54
+#define SC_OPCODE_UNION 55
+#define SC_OPCODE_RANGE 56
+#define SC_OPCODE_STOP_BIN_OP 57
+
+/* NOTE: binary and unary operators must be in sequence for compiler! */
+
+/*** Unary operators ***/
+#define SC_OPCODE_START_UN_OP 60
+#define SC_OPCODE_NOT 60
+#define SC_OPCODE_NEG 61
+#define SC_OPCODE_NEG_SUB 62
+#define SC_OPCODE_STOP_UN_OP 63
+
+#define SC_OPCODE_START_FUNCTION 65
+
+/*** Functions without parameters ***/
+#define SC_OPCODE_START_NO_PAR 65
+#define SC_OPCODE_PI 65
+#define SC_OPCODE_RANDOM 66
+#define SC_OPCODE_TRUE 67
+#define SC_OPCODE_FALSE 68
+#define SC_OPCODE_GET_ACT_DATE 69
+#define SC_OPCODE_GET_ACT_TIME 70
+#define SC_OPCODE_NO_VALUE 71
+#define SC_OPCODE_CURRENT 72
+#define SC_OPCODE_STOP_NO_PAR 73
+
+/*** Functions with one parameter ***/
+#define SC_OPCODE_START_1_PAR 80
+#define SC_OPCODE_DEG 80 /* trigonometric */
+#define SC_OPCODE_RAD 81
+#define SC_OPCODE_SIN 82
+#define SC_OPCODE_COS 83
+#define SC_OPCODE_TAN 84
+#define SC_OPCODE_COT 85
+#define SC_OPCODE_ARC_SIN 86
+#define SC_OPCODE_ARC_COS 87
+#define SC_OPCODE_ARC_TAN 88
+#define SC_OPCODE_ARC_COT 89
+#define SC_OPCODE_SIN_HYP 90
+#define SC_OPCODE_COS_HYP 91
+#define SC_OPCODE_TAN_HYP 92
+#define SC_OPCODE_COT_HYP 93
+#define SC_OPCODE_ARC_SIN_HYP 94 /* transcendent */
+#define SC_OPCODE_ARC_COS_HYP 95
+#define SC_OPCODE_ARC_TAN_HYP 96
+#define SC_OPCODE_ARC_COT_HYP 97
+#define SC_OPCODE_COSECANT 98
+#define SC_OPCODE_SECANT 99
+#define SC_OPCODE_COSECANT_HYP 100
+#define SC_OPCODE_SECANT_HYP 101
+#define SC_OPCODE_EXP 102
+#define SC_OPCODE_LN 103
+#define SC_OPCODE_SQRT 104
+#define SC_OPCODE_FACT 105
+#define SC_OPCODE_GET_YEAR 106 /* date and time */
+#define SC_OPCODE_GET_MONTH 107
+#define SC_OPCODE_GET_DAY 108
+#define SC_OPCODE_GET_HOUR 109
+#define SC_OPCODE_GET_MIN 110
+#define SC_OPCODE_GET_SEC 111
+#define SC_OPCODE_PLUS_MINUS 112 /* miscellaneous */
+#define SC_OPCODE_ABS 113
+#define SC_OPCODE_INT 114
+#define SC_OPCODE_PHI 115
+#define SC_OPCODE_GAUSS 116
+#define SC_OPCODE_IS_EMPTY 117 /* obtain type */
+#define SC_OPCODE_IS_STRING 118
+#define SC_OPCODE_IS_NON_STRING 119
+#define SC_OPCODE_IS_LOGICAL 120
+#define SC_OPCODE_TYPE 121
+#define SC_OPCODE_IS_REF 122
+#define SC_OPCODE_IS_VALUE 123
+#define SC_OPCODE_IS_FORMULA 124
+#define SC_OPCODE_IS_NV 125
+#define SC_OPCODE_IS_ERR 126
+#define SC_OPCODE_IS_ERROR 127
+#define SC_OPCODE_IS_EVEN 128
+#define SC_OPCODE_IS_ODD 129
+#define SC_OPCODE_N 130
+#define SC_OPCODE_GET_DATE_VALUE 131 /* string functions */
+#define SC_OPCODE_GET_TIME_VALUE 132
+#define SC_OPCODE_CODE 133
+#define SC_OPCODE_TRIM 134
+#define SC_OPCODE_UPPER 135
+#define SC_OPCODE_PROPPER 136
+#define SC_OPCODE_LOWER 137
+#define SC_OPCODE_LEN 138
+#define SC_OPCODE_T 139 /* miscellaneous, part 21 */
+#define SC_OPCODE_VALUE 140
+#define SC_OPCODE_CLEAN 141
+#define SC_OPCODE_CHAR 142
+#define SC_OPCODE_LOG10 143
+#define SC_OPCODE_EVEN 144
+#define SC_OPCODE_ODD 145
+#define SC_OPCODE_STD_NORM_DIST 146
+#define SC_OPCODE_FISHER 147
+#define SC_OPCODE_FISHER_INV 148
+#define SC_OPCODE_S_NORM_INV 149
+#define SC_OPCODE_GAMMA_LN 150
+#define SC_OPCODE_ERROR_TYPE 151
+#define SC_OPCODE_ERR_CELL 152
+#define SC_OPCODE_FORMULA 153
+#define SC_OPCODE_ARABIC 154
+#define SC_OPCODE_INFO 155
+#define SC_OPCODE_BAHTTEXT 156
+#define SC_OPCODE_JIS 157
+#define SC_OPCODE_ASC 158
+#define SC_OPCODE_UNICODE 159
+#define SC_OPCODE_UNICHAR 160
+#define SC_OPCODE_GAMMA 161
+#define SC_OPCODE_STOP_1_PAR 162
+
+/*** Functions with more than one parameters ***/
+#define SC_OPCODE_START_2_PAR 201
+#define SC_OPCODE_ARC_TAN_2 201
+#define SC_OPCODE_CEIL 202
+#define SC_OPCODE_FLOOR 203
+#define SC_OPCODE_ROUND 204
+#define SC_OPCODE_ROUND_UP 205
+#define SC_OPCODE_ROUND_DOWN 206
+#define SC_OPCODE_TRUNC 207
+#define SC_OPCODE_LOG 208
+#define SC_OPCODE_POWER 209
+#define SC_OPCODE_GGT 210
+#define SC_OPCODE_KGV 211
+#define SC_OPCODE_MOD 212
+#define SC_OPCODE_SUM_PRODUCT 213
+#define SC_OPCODE_SUM_SQ 214
+#define SC_OPCODE_SUM_X2MY2 215
+#define SC_OPCODE_SUM_X2DY2 216
+#define SC_OPCODE_SUM_XMY2 217
+#define SC_OPCODE_GET_DATE 218
+#define SC_OPCODE_GET_TIME 219
+#define SC_OPCODE_GET_DIFF_DATE 220
+#define SC_OPCODE_GET_DIFF_DATE_360 221
+#define SC_OPCODE_MIN 222
+#define SC_OPCODE_MAX 223
+#define SC_OPCODE_SUM 224
+#define SC_OPCODE_PRODUCT 225
+#define SC_OPCODE_AVERAGE 226
+#define SC_OPCODE_COUNT 227
+#define SC_OPCODE_COUNT_2 228
+#define SC_OPCODE_NBW 229
+#define SC_OPCODE_IKV 230
+#define SC_OPCODE_VAR 231
+#define SC_OPCODE_VAR_P 232
+#define SC_OPCODE_ST_DEV 233
+#define SC_OPCODE_ST_DEV_P 234
+#define SC_OPCODE_B 235
+#define SC_OPCODE_NORM_DIST 236
+#define SC_OPCODE_EXP_DIST 237
+#define SC_OPCODE_BINOM_DIST 238
+#define SC_OPCODE_POISSON_DIST 239
+#define SC_OPCODE_KOMBIN 240
+#define SC_OPCODE_KOMBIN_2 241
+#define SC_OPCODE_VARIATIONEN 242
+#define SC_OPCODE_VARIATIONEN_2 243
+#define SC_OPCODE_BW 244
+#define SC_OPCODE_DIA 245
+#define SC_OPCODE_GDA 246
+#define SC_OPCODE_GDA_2 247
+#define SC_OPCODE_VBD 248
+#define SC_OPCODE_LAUFZ 249
+#define SC_OPCODE_LIA 250
+#define SC_OPCODE_RMZ 251
+#define SC_OPCODE_COLUMNS 252
+#define SC_OPCODE_ROWS 253
+#define SC_OPCODE_COLUMN 254
+#define SC_OPCODE_ROW 255
+#define SC_OPCODE_ZGZ 256
+#define SC_OPCODE_ZW 257
+#define SC_OPCODE_ZZR 258
+#define SC_OPCODE_ZINS 259
+#define SC_OPCODE_ZINS_Z 260
+#define SC_OPCODE_KAPZ 261
+#define SC_OPCODE_KUM_ZINS_Z 262
+#define SC_OPCODE_KUM_KAP_Z 263
+#define SC_OPCODE_EFFEKTIV 264
+#define SC_OPCODE_NOMINAL 265
+#define SC_OPCODE_SUB_TOTAL 266
+#define SC_OPCODE_DB_SUM 267 /* database functions */
+#define SC_OPCODE_DB_COUNT 268
+#define SC_OPCODE_DB_COUNT_2 269
+#define SC_OPCODE_DB_AVERAGE 270
+#define SC_OPCODE_DB_GET 271
+#define SC_OPCODE_DB_MAX 272
+#define SC_OPCODE_DB_MIN 273
+#define SC_OPCODE_DB_PRODUCT 274
+#define SC_OPCODE_DB_STD_DEV 275
+#define SC_OPCODE_DB_STD_DEV_P 276
+#define SC_OPCODE_DB_VAR 277
+#define SC_OPCODE_DB_VAR_P 278
+#define SC_OPCODE_INDIRECT 279 /* management functions */
+#define SC_OPCODE_ADDRESS 280
+#define SC_OPCODE_MATCH 281
+#define SC_OPCODE_COUNT_EMPTY_CELLS 282
+#define SC_OPCODE_COUNT_IF 283
+#define SC_OPCODE_SUM_IF 284
+#define SC_OPCODE_LOOKUP 285
+#define SC_OPCODE_V_LOOKUP 286
+#define SC_OPCODE_H_LOOKUP 287
+#define SC_OPCODE_MULTI_AREA 288
+#define SC_OPCODE_OFFSET 289
+#define SC_OPCODE_INDEX 290
+#define SC_OPCODE_AREAS 291
+#define SC_OPCODE_CURRENCY 292 /* string functions */
+#define SC_OPCODE_REPLACE 293
+#define SC_OPCODE_FIXED 294
+#define SC_OPCODE_FIND 295
+#define SC_OPCODE_EXACT 296
+#define SC_OPCODE_LEFT 297
+#define SC_OPCODE_RIGHT 298
+#define SC_OPCODE_SEARCH 299
+#define SC_OPCODE_MID 300
+#define SC_OPCODE_TEXT 301
+#define SC_OPCODE_SUBSTITUTE 302
+#define SC_OPCODE_REPT 303
+#define SC_OPCODE_CONCAT 304
+#define SC_OPCODE_MAT_VALUE 305 /* matrix functions */
+#define SC_OPCODE_MAT_DET 306
+#define SC_OPCODE_MAT_INV 307
+#define SC_OPCODE_MAT_MULT 308
+#define SC_OPCODE_MAT_TRANS 309
+#define SC_OPCODE_MATRIX_UNIT 310
+#define SC_OPCODE_BACK_SOLVER 311 /* BackSolver */
+#define SC_OPCODE_HYP_GEOM_DIST 312 /* statistical functions */
+#define SC_OPCODE_LOG_NORM_DIST 313
+#define SC_OPCODE_T_DIST 314
+#define SC_OPCODE_F_DIST 315
+#define SC_OPCODE_CHI_DIST 316
+#define SC_OPCODE_WEIBULL 317
+#define SC_OPCODE_NEG_BINOM_VERT 318
+#define SC_OPCODE_KRIT_BINOM 319
+#define SC_OPCODE_KURT 320
+#define SC_OPCODE_HAR_MEAN 321
+#define SC_OPCODE_GEO_MEAN 322
+#define SC_OPCODE_STANDARD 323
+#define SC_OPCODE_AVE_DEV 324
+#define SC_OPCODE_SCHIEFE 325
+#define SC_OPCODE_DEV_SQ 326
+#define SC_OPCODE_MEDIAN 327
+#define SC_OPCODE_MODAL_VALUE 328
+#define SC_OPCODE_Z_TEST 329
+#define SC_OPCODE_T_TEST 330
+#define SC_OPCODE_RANK 331
+#define SC_OPCODE_PERCENTILE 332
+#define SC_OPCODE_PERCENT_RANK 333
+#define SC_OPCODE_LARGE 334
+#define SC_OPCODE_SMALL 335
+#define SC_OPCODE_FREQUENCY 336
+#define SC_OPCODE_QUARTILE 337
+#define SC_OPCODE_NORM_INV 338
+#define SC_OPCODE_CONFIDENCE 339
+#define SC_OPCODE_F_TEST 340
+#define SC_OPCODE_TRIM_MEAN 341
+#define SC_OPCODE_PROB 342
+#define SC_OPCODE_CORREL 343
+#define SC_OPCODE_COVAR 344
+#define SC_OPCODE_PEARSON 345
+#define SC_OPCODE_RSQ 346
+#define SC_OPCODE_STEYX 347
+#define SC_OPCODE_SLOPE 348
+#define SC_OPCODE_INTERCEPT 349
+#define SC_OPCODE_TREND 350
+#define SC_OPCODE_GROWTH 351
+#define SC_OPCODE_RGP 352
+#define SC_OPCODE_RKP 353
+#define SC_OPCODE_FORECAST 354
+#define SC_OPCODE_CHI_INV 355
+#define SC_OPCODE_GAMMA_DIST 356
+#define SC_OPCODE_GAMMA_INV 357
+#define SC_OPCODE_T_INV 358
+#define SC_OPCODE_F_INV 359
+#define SC_OPCODE_CHI_TEST 360
+#define SC_OPCODE_LOG_INV 361
+#define SC_OPCODE_TABLE_OP 362
+#define SC_OPCODE_BETA_DIST 363
+#define SC_OPCODE_BETA_INV 364
+#define SC_OPCODE_WEEK 365 /* miscellaneous */
+#define SC_OPCODE_GET_DAY_OF_WEEK 366
+#define SC_OPCODE_NO_NAME 367
+#define SC_OPCODE_STYLE 368
+#define SC_OPCODE_DDE 369
+#define SC_OPCODE_BASE 370
+#define SC_OPCODE_TABLE 371
+#define SC_OPCODE_TABLES 372
+#define SC_OPCODE_MIN_A 373
+#define SC_OPCODE_MAX_A 374
+#define SC_OPCODE_AVERAGE_A 375
+#define SC_OPCODE_ST_DEV_A 376
+#define SC_OPCODE_ST_DEV_P_A 377
+#define SC_OPCODE_VAR_A 378
+#define SC_OPCODE_VAR_P_A 379
+#define SC_OPCODE_EASTERSUNDAY 380
+#define SC_OPCODE_DECIMAL 381
+#define SC_OPCODE_CONVERT 382
+#define SC_OPCODE_ROMAN 383
+#define SC_OPCODE_MIRR 384
+#define SC_OPCODE_CELL 385
+#define SC_OPCODE_ISPMT 386
+#define SC_OPCODE_HYPERLINK 387
+#define SC_OPCODE_INDIRECT_XL 388 /* See also INDIRECT for OOO variant */
+#define SC_OPCODE_ADDRESS_XL 389 /* See also ADRESS for OOO variant */
+#define SC_OPCODE_GET_PIVOT_DATA 390
+#define SC_OPCODE_EUROCONVERT 391
+#define SC_OPCODE_NUMBERVALUE 392
+#define SC_OPCODE_CHISQ_DIST 393
+#define SC_OPCODE_CHISQ_INV 394
+#define SC_OPCODE_BITAND 395
+#define SC_OPCODE_BITOR 396
+#define SC_OPCODE_BITXOR 397
+#define SC_OPCODE_BITRSHIFT 398
+#define SC_OPCODE_BITLSHIFT 399
+#define SC_OPCODE_GET_DATEDIF 400
+#define SC_OPCODE_XOR 401
+#define SC_OPCODE_AVERAGE_IF 402
+#define SC_OPCODE_SUM_IFS 403
+#define SC_OPCODE_AVERAGE_IFS 404
+#define SC_OPCODE_COUNT_IFS 405
+#define SC_OPCODE_SKEWP 406
+#define SC_OPCODE_STOP_2_PAR 407
+#define SC_OPCODE_LAST_OPCODE_ID 406 /* last OpCode */
+
+#define SC_OPCODE_STOP_FUNCTION 407
+
+/*** Internal ***/
+#define SC_OPCODE_INTERNAL_BEGIN 9999
+#define SC_OPCODE_TTT 9999
+#define SC_OPCODE_INTERNAL_END 9999
+
+/*** from here on ExtraData contained ***/
+#define SC_OPCODE_DATA_TOKEN_1 10000
+
+#define SC_OPCODE_NONE 0xFFFF
+
+
+#endif /* FORMULA_COMPILER_HRC */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/errorcodes.hxx b/include/formula/errorcodes.hxx
new file mode 100644
index 000000000000..1e145e04132b
--- /dev/null
+++ b/include/formula/errorcodes.hxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SC_ERRORCODES_HXX
+#define SC_ERRORCODES_HXX
+
+#include <rtl/math.hxx>
+#include <tools/solar.h>
+
+namespace ScErrorCodes
+{
+
+const sal_uInt16 errIllegalChar = 501;
+const sal_uInt16 errIllegalArgument = 502;
+const sal_uInt16 errIllegalFPOperation = 503; // #NUM!
+const sal_uInt16 errIllegalParameter = 504;
+const sal_uInt16 errIllegalJump = 505;
+const sal_uInt16 errSeparator = 506;
+const sal_uInt16 errPair = 507;
+const sal_uInt16 errPairExpected = 508;
+const sal_uInt16 errOperatorExpected = 509;
+const sal_uInt16 errVariableExpected = 510;
+const sal_uInt16 errParameterExpected = 511;
+const sal_uInt16 errCodeOverflow = 512;
+const sal_uInt16 errStringOverflow = 513;
+const sal_uInt16 errStackOverflow = 514;
+const sal_uInt16 errUnknownState = 515;
+const sal_uInt16 errUnknownVariable = 516;
+const sal_uInt16 errUnknownOpCode = 517;
+const sal_uInt16 errUnknownStackVariable = 518;
+const sal_uInt16 errNoValue = 519; // #VALUE!
+const sal_uInt16 errUnknownToken = 520;
+const sal_uInt16 errNoCode = 521; // #NULL!
+const sal_uInt16 errCircularReference = 522;
+const sal_uInt16 errNoConvergence = 523;
+const sal_uInt16 errNoRef = 524; // #REF!
+const sal_uInt16 errNoName = 525; // #NAME?
+const sal_uInt16 errDoubleRef = 526;
+const sal_uInt16 errInterpOverflow = 527;
+// Not displayed, temporary for TrackFormulas,
+// Cell depends on another cell that has errCircularReference
+const sal_uInt16 errTrackFromCircRef = 528;
+// ScInterpreter internal: no numeric value but numeric queried. If this is
+// set as mnStringNoValueError no error is generated but 0 returned.
+const sal_uInt16 errCellNoValue = 529;
+// Interpreter: needed AddIn not found
+const sal_uInt16 errNoAddin = 530;
+// Interpreter: needed Macro not found
+const sal_uInt16 errNoMacro = 531;
+// Interpreter: Division by zero
+const sal_uInt16 errDivisionByZero = 532; // #DIV/0!
+// Compiler: a non-simple (str,err,val) value was put in an array
+const sal_uInt16 errNestedArray = 533;
+// ScInterpreter internal: no numeric value but numeric queried. If this is
+// temporarily (!) set as mnStringNoValueError, the error is generated and can
+// be used to distinguish that condition from all other (inherited) errors. Do
+// not use for anything else! Never push or inherit the error otherwise!
+const sal_uInt16 errNotNumericString = 534;
+// ScInterpreter internal: jump matrix already has a result at this position,
+// do not overwrite in case of empty code path.
+const sal_uInt16 errJumpMatHasResult = 535;
+
+// Interpreter: NA() not available condition, not a real error
+const sal_uInt16 NOTAVAILABLE = 0x7fff;
+
+
+/** Unconditionally construct a double value of NAN where the lower bits
+ represent an interpreter error code. */
+inline double CreateDoubleError( sal_uInt16 nErr )
+{
+ union
+ {
+ double fVal;
+ sal_math_Double smVal;
+ };
+ ::rtl::math::setNan( &fVal );
+ smVal.nan_parts.fraction_lo = nErr;
+ return fVal;
+}
+
+
+/** Recreate the error code of a coded double error, if any. */
+inline sal_uInt16 GetDoubleErrorValue( double fVal )
+{
+ if ( ::rtl::math::isFinite( fVal ) )
+ return 0;
+ if ( ::rtl::math::isInf( fVal ) )
+ return errIllegalFPOperation; // normal INF
+ sal_uInt32 nErr = reinterpret_cast< sal_math_Double * >(
+ &fVal)->nan_parts.fraction_lo;
+ if ( nErr & 0xffff0000 )
+ return errNoValue; // just a normal NAN
+ return (sal_uInt16)(nErr & 0x0000ffff); // any other error
+}
+
+} // namespace ScErrorCodes
+
+// yes, exceptionally we put a "using namespace" in a header file..
+using namespace ScErrorCodes;
+
+#endif // SC_ERRORCODES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/formdata.hxx b/include/formula/formdata.hxx
new file mode 100644
index 000000000000..595ddb63fc5a
--- /dev/null
+++ b/include/formula/formdata.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef FORMULA_FORMDATA_HXX
+#define FORMULA_FORMDATA_HXX
+
+#include <tools/string.hxx>
+#include <tools/gen.hxx>
+#include "formula/formuladllapi.h"
+
+//============================================================================
+namespace formula
+{
+class FORMULA_DLLPUBLIC FormEditData
+{
+public:
+ FormEditData();
+ virtual ~FormEditData();
+
+ virtual void SaveValues();
+ sal_Bool HasParent() const { return pParent != NULL; }
+
+ inline sal_uInt16 GetMode() const { return nMode; }
+ inline xub_StrLen GetFStart() const { return nFStart; }
+ inline sal_uInt16 GetCatSel() const { return nCatSel; }
+ inline sal_uInt16 GetFuncSel() const { return nFuncSel; }
+ inline sal_uInt16 GetOffset() const { return nOffset; }
+ inline sal_uInt16 GetEdFocus() const { return nEdFocus; }
+ inline const String& GetUndoStr() const { return aUndoStr; }
+ inline sal_Bool GetMatrixFlag()const{ return bMatrix;}
+ inline OString GetUniqueId()const { return aUniqueId;}
+ inline const Selection& GetSelection()const { return aSelection;}
+
+ inline void SetMode( sal_uInt16 nNew ) { nMode = nNew; }
+ inline void SetFStart( xub_StrLen nNew ) { nFStart = nNew; }
+ inline void SetCatSel( sal_uInt16 nNew ) { nCatSel = nNew; }
+ inline void SetFuncSel( sal_uInt16 nNew ) { nFuncSel = nNew; }
+ inline void SetOffset( sal_uInt16 nNew ) { nOffset = nNew; }
+ inline void SetEdFocus( sal_uInt16 nNew ) { nEdFocus = nNew; }
+ inline void SetUndoStr( const String& rNew ) { aUndoStr = rNew; }
+ inline void SetMatrixFlag(sal_Bool bNew) { bMatrix=bNew;}
+ inline void SetUniqueId(const OString nNew) { aUniqueId=nNew;}
+ inline void SetSelection(const Selection& aSel) { aSelection=aSel;}
+protected:
+ void Reset();
+ FormEditData( const FormEditData& );
+ const FormEditData& operator=( const FormEditData& r );
+
+ FormEditData* pParent; // fuer Verschachtelung
+private:
+ sal_uInt16 nMode; // enum ScFormulaDlgMode
+ xub_StrLen nFStart;
+ sal_uInt16 nCatSel;
+ sal_uInt16 nFuncSel;
+ sal_uInt16 nOffset;
+ sal_uInt16 nEdFocus;
+ String aUndoStr;
+ sal_Bool bMatrix;
+ OString aUniqueId;
+ Selection aSelection;
+};
+
+
+} // formula
+#endif // FORMULA_FORMDATA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/formula.hxx b/include/formula/formula.hxx
new file mode 100644
index 000000000000..5a55f5ca81d1
--- /dev/null
+++ b/include/formula/formula.hxx
@@ -0,0 +1,142 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef FORMULA_FORMULA_HXX
+#define FORMULA_FORMULA_HXX
+
+#include <sfx2/basedlgs.hxx>
+#include <memory>
+#include "formula/formuladllapi.h"
+#include "formula/omoduleclient.hxx"
+#include <formula/IFunctionDescription.hxx>
+
+namespace formula
+{
+//============================================================================
+#define STRUCT_END 1
+#define STRUCT_FOLDER 2
+#define STRUCT_ERROR 3
+
+enum FormulaDlgMode { FORMULA_FORMDLG_FORMULA, FORMULA_FORMDLG_ARGS, FORMULA_FORMDLG_EDIT };
+
+//============================================================================
+
+class FormulaDlg_Impl;
+class IControlReferenceHandler;
+class IFunctionDescription;
+class IFunctionManager;
+class FormulaHelper;
+class RefEdit;
+class RefButton;
+class FormEditData;
+//============================================================================
+class FORMULA_DLLPUBLIC FormulaModalDialog : public ModalDialog, public formula::IFormulaEditorHelper
+{
+ friend class FormulaDlg_Impl;
+public:
+ FormulaModalDialog( Window* pParent
+ , bool _bSupportFunctionResult
+ , bool _bSupportResult
+ , bool _bSupportMatrix
+ ,IFunctionManager* _pFunctionMgr
+ ,IControlReferenceHandler* _pDlg = NULL );
+ virtual ~FormulaModalDialog();
+private:
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ ::std::auto_ptr<FormulaDlg_Impl> m_pImpl;
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+
+protected:
+
+ virtual long PreNotify( NotifyEvent& rNEvt );
+ ::std::pair<RefButton*,RefEdit*> RefInputStartBefore( RefEdit* pEdit, RefButton* pButton = NULL );
+ void RefInputStartAfter( RefEdit* pEdit, RefButton* pButton = NULL );
+ void RefInputDoneAfter( sal_Bool bForced = sal_False );
+ void SetFocusWin(Window *pWin,const OString& nUniqueId);
+
+ void SetMeText(const String& _sText);
+ void Update();
+ sal_Bool CheckMatrix(String& aFormula /*IN/OUT*/);
+ void Update(const String& _sExp);
+
+ void StoreFormEditData(FormEditData* pData);
+};
+
+class FORMULA_DLLPUBLIC FormulaDlg:
+ private OModuleClient, public SfxModelessDialog, public IFormulaEditorHelper
+ // order of base classes is important, as OModuleClient controls the
+ // lifecycle of the ResMgr passed into SfxModelessDialog (via
+ // formula::ModuleRes), and at least with DBG_UTIL calling TestRes in
+ // ~Resource, the ResMgr must outlive the Resource (from which
+ // SfxModelessDialog ultimately derives)
+{
+ friend class FormulaDlg_Impl;
+public:
+ FormulaDlg( SfxBindings* pB
+ , SfxChildWindow* pCW
+ , Window* pParent
+ , bool _bSupportFunctionResult
+ , bool _bSupportResult
+ , bool _bSupportMatrix
+ , IFunctionManager* _pFunctionMgr
+ , IControlReferenceHandler* _pDlg = NULL );
+ virtual ~FormulaDlg();
+private:
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ ::std::auto_ptr<FormulaDlg_Impl> m_pImpl;
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+
+ DECL_LINK( UpdateFocusHdl, void*);
+protected:
+ void disableOk();
+
+protected:
+
+ virtual long PreNotify( NotifyEvent& rNEvt );
+ ::std::pair<RefButton*,RefEdit*> RefInputStartBefore( RefEdit* pEdit, RefButton* pButton = NULL );
+ void RefInputStartAfter( RefEdit* pEdit, RefButton* pButton = NULL );
+ void RefInputDoneAfter( sal_Bool bForced = sal_False );
+ void SetFocusWin(Window *pWin,const OString& nUniqueId);
+ void HighlightFunctionParas(const String& aFormula);
+
+ void SetMeText(const String& _sText);
+ FormulaDlgMode SetMeText(const String& _sText,xub_StrLen PrivStart, xub_StrLen PrivEnd,sal_Bool bMatrix,sal_Bool _bSelect,sal_Bool _bUpdate);
+ void Update();
+ sal_Bool CheckMatrix(String& aFormula /*IN/OUT*/);
+ String GetMeText() const;
+ void Update(const String& _sExp);
+ void CheckMatrix();
+ void DoEnter(sal_Bool _bOk);
+ sal_Bool isUserMatrix() const;
+ const IFunctionDescription* getCurrentFunctionDescription() const;
+ sal_Bool UpdateParaWin(Selection& _rSelection);
+ void UpdateParaWin(const Selection& _rSelection,const String& _sRefStr);
+ RefEdit* GetActiveEdit();
+ void SetEdSelection();
+
+ void StoreFormEditData(FormEditData* pData);
+
+ const FormulaHelper& GetFormulaHelper() const;
+};
+
+} // formula
+
+#endif // FORMULA_FORMULA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/formuladllapi.h b/include/formula/formuladllapi.h
new file mode 100644
index 000000000000..b2f4b06bd1a8
--- /dev/null
+++ b/include/formula/formuladllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FORMULADLLAPI_H
+#define INCLUDED_FORMULADLLAPI_H
+
+#include "sal/types.h"
+
+#if defined(FORMULA_DLLIMPLEMENTATION)
+#define FORMULA_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define FORMULA_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define FORMULA_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif /* INCLUDED_FORMULADLLAPI_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/formulahelper.hxx b/include/formula/formulahelper.hxx
new file mode 100644
index 000000000000..27c9b6683964
--- /dev/null
+++ b/include/formula/formulahelper.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef FORMULA_FORMULA_HELPER_HXX
+#define FORMULA_FORMULA_HELPER_HXX
+
+#include "formula/IFunctionDescription.hxx"
+#include <vector>
+#include <tools/string.hxx>
+#include <memory>
+#include "formula/formuladllapi.h"
+
+class SvtSysLocale;
+class CharClass;
+
+namespace formula
+{
+ class FORMULA_DLLPUBLIC FormulaHelper
+ {
+ ::std::auto_ptr<SvtSysLocale> m_pSysLocale;
+ const CharClass* m_pCharClass;
+ const IFunctionManager* m_pFunctionManager;
+ const sal_Unicode open;
+ const sal_Unicode close;
+ const sal_Unicode sep;
+ const sal_Unicode arrayOpen;
+ const sal_Unicode arrayClose;
+ public:
+ FormulaHelper(const IFunctionManager* _pFunctionManager);
+
+ inline const CharClass* GetCharClass() const { return m_pCharClass; }
+
+ sal_Bool GetNextFunc( const String& rFormula,
+ sal_Bool bBack,
+ xub_StrLen& rFStart, // Ein- und Ausgabe
+ xub_StrLen* pFEnd = NULL,
+ const IFunctionDescription** ppFDesc = NULL,
+ ::std::vector< OUString>* pArgs = NULL ) const;
+
+ xub_StrLen GetFunctionStart( const String& rFormula, xub_StrLen nStart,
+ sal_Bool bBack, String* pFuncName = NULL ) const;
+
+ xub_StrLen GetFunctionEnd ( const String& rFormula, xub_StrLen nStart ) const;
+
+ xub_StrLen GetArgStart ( const String& rFormula, xub_StrLen nStart,
+ sal_uInt16 nArg ) const;
+
+ void GetArgStrings ( ::std::vector< OUString >& _rArgs,
+ const String& rFormula,
+ xub_StrLen nFuncPos,
+ sal_uInt16 nArgs ) const;
+
+ void FillArgStrings ( const String& rFormula,
+ xub_StrLen nFuncPos,
+ sal_uInt16 nArgs,
+ ::std::vector< OUString >& _rArgs ) const;
+ };
+// =============================================================================
+} // formula
+// =============================================================================
+
+#endif //FORMULA_FORMULA_HELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/funcutl.hxx b/include/formula/funcutl.hxx
new file mode 100644
index 000000000000..6676117cdf20
--- /dev/null
+++ b/include/formula/funcutl.hxx
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef FORMULA_FUNCUTL_HXX
+#define FORMULA_FUNCUTL_HXX
+
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <vcl/edit.hxx>
+#include "formula/formuladllapi.h"
+
+namespace formula {
+
+class IControlReferenceHandler;
+
+class FORMULA_DLLPUBLIC RefEdit : public Edit
+{
+private:
+ Timer aTimer;
+ IControlReferenceHandler* pAnyRefDlg; // parent dialog
+ Window* pLabelWidget;
+
+ DECL_LINK( UpdateHdl, void* );
+
+protected:
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void GetFocus();
+ virtual void LoseFocus();
+
+public:
+ RefEdit( Window* _pParent,IControlReferenceHandler* pParent,
+ Window* pShrinkModeLabel, const ResId& rResId );
+ RefEdit( Window* _pParent, Window* pShrinkModeLabel,
+ WinBits nStyle = WB_BORDER );
+ virtual ~RefEdit();
+
+ void SetRefString( const XubString& rStr );
+
+ /**
+ * Flag reference valid or invalid, which in turn changes the visual
+ * appearance of the control accordingly.
+ */
+ void SetRefValid(bool bValid);
+
+ using Edit::SetText;
+ virtual void SetText( const XubString& rStr );
+ virtual void Modify();
+
+ void StartUpdateData();
+
+ void SetReferences( IControlReferenceHandler* pDlg, Window *pLabelWidget );
+ IControlReferenceHandler* GetRefDialog() { return pAnyRefDlg; }
+ Window* GetLabelWidgetForShrinkMode() { return pLabelWidget; }
+};
+
+
+//============================================================================
+
+class FORMULA_DLLPUBLIC RefButton : public ImageButton
+{
+private:
+ Image aImgRefStart; /// Start reference input
+ Image aImgRefDone; /// Stop reference input
+ OUString aShrinkQuickHelp;
+ OUString aExpandQuickHelp;
+ IControlReferenceHandler* pAnyRefDlg; // parent dialog
+ RefEdit* pRefEdit; // zugeordnetes Edit-Control
+
+protected:
+ virtual void Click();
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void GetFocus();
+ virtual void LoseFocus();
+
+public:
+ RefButton(Window* _pParent, const ResId& rResId);
+ RefButton(Window* _pParent, WinBits nStyle = 0);
+ RefButton(Window* _pParent, const ResId& rResId,
+ RefEdit* pEdit, IControlReferenceHandler* pDlg);
+
+ void SetReferences( IControlReferenceHandler* pDlg,
+ RefEdit* pEdit );
+
+ void SetStartImage();
+ void SetEndImage();
+ void DoRef() { Click(); }
+};
+
+} // formula
+
+#endif // FORMULA_FUNCUTL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/grammar.hxx b/include/formula/grammar.hxx
new file mode 100644
index 000000000000..584aff1ae57f
--- /dev/null
+++ b/include/formula/grammar.hxx
@@ -0,0 +1,242 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef FORMULA_GRAMMAR_HXX
+#define FORMULA_GRAMMAR_HXX
+
+#include "com/sun/star/sheet/FormulaLanguage.hpp"
+#include "formula/formuladllapi.h"
+#include <tools/debug.hxx>
+
+namespace formula
+{
+
+/** Grammars digested by ScCompiler.
+ */
+class FORMULA_DLLPUBLIC FormulaGrammar
+{
+public:
+ enum AddressConvention{
+ CONV_UNSPECIFIED = -1, /* useful when we want method to chose, must be first */
+
+ /* elements must be sequential and changes should be reflected in ScCompiler::pCharTables */
+ CONV_OOO = 0, /* 'doc'#sheet.A1:sheet2.B2 */
+ CONV_ODF, /* ['doc'#sheet.A1:sheet2.B2] */
+ CONV_XL_A1, /* [doc]sheet:sheet2!A1:B2 */
+ CONV_XL_R1C1, /* [doc]sheet:sheet2!R1C1:R2C2 */
+ CONV_XL_OOX, /* [#]sheet:sheet2!A1:B2 */
+
+ CONV_LOTUS_A1, /* external? 3d? A1.B2 <placeholder/> */
+
+ CONV_LAST /* for loops, must always be last */
+ };
+
+ //! CONV_UNSPECIFIED is a negative value!
+ static const int kConventionOffset = - CONV_UNSPECIFIED + 1;
+ // Room for 32k hypothetical languages plus EXTERNAL.
+ static const int kConventionShift = 16;
+ // Room for 256 reference conventions.
+ static const int kEnglishBit = (1 << (kConventionShift + 8));
+ // Mask off all non-language bits.
+ static const int kFlagMask = ~((~int(0)) << kConventionShift);
+
+ /** Values encoding the formula language plus address reference convention
+ plus English parsing/formatting
+ */
+ //! When adding new values adapt isSupported() below as well.
+ enum Grammar
+ {
+ /// Used only in ScCompiler ctor and in some XML import API context.
+ GRAM_UNSPECIFIED = -1,
+ /// ODFF with default ODF A1 bracketed references.
+ GRAM_ODFF = ::com::sun::star::sheet::FormulaLanguage::ODFF |
+ ((CONV_ODF +
+ kConventionOffset) << kConventionShift) |
+ kEnglishBit,
+ /// ODF 1.1 with default ODF A1 bracketed references.
+ GRAM_PODF = ::com::sun::star::sheet::FormulaLanguage::ODF_11 |
+ ((CONV_ODF +
+ kConventionOffset) << kConventionShift) |
+ kEnglishBit,
+ /// English with default A1 reference style.
+ GRAM_ENGLISH = ::com::sun::star::sheet::FormulaLanguage::ENGLISH |
+ ((CONV_OOO +
+ kConventionOffset) << kConventionShift) |
+ kEnglishBit,
+ /// Native with default A1 reference style.
+ GRAM_NATIVE = ::com::sun::star::sheet::FormulaLanguage::NATIVE |
+ ((CONV_OOO +
+ kConventionOffset) << kConventionShift),
+ /// ODFF with reference style as set in UI, may be A1 or R1C1.
+ GRAM_ODFF_UI = ::com::sun::star::sheet::FormulaLanguage::ODFF |
+ ((CONV_UNSPECIFIED +
+ kConventionOffset) << kConventionShift) |
+ kEnglishBit,
+ /// ODFF with A1 reference style, unbracketed.
+ GRAM_ODFF_A1 = ::com::sun::star::sheet::FormulaLanguage::ODFF |
+ ((CONV_OOO +
+ kConventionOffset) << kConventionShift) |
+ kEnglishBit,
+ /// ODF 1.1 with reference style as set in UI, may be A1 or R1C1.
+ GRAM_PODF_UI = ::com::sun::star::sheet::FormulaLanguage::ODF_11 |
+ ((CONV_UNSPECIFIED +
+ kConventionOffset) << kConventionShift) |
+ kEnglishBit,
+ /// ODF 1.1 with A1 reference style, unbracketed.
+ GRAM_PODF_A1 = ::com::sun::star::sheet::FormulaLanguage::ODF_11 |
+ ((CONV_OOO +
+ kConventionOffset) << kConventionShift) |
+ kEnglishBit,
+ /// Native with reference style as set in UI, may be A1 or R1C1.
+ GRAM_NATIVE_UI = ::com::sun::star::sheet::FormulaLanguage::NATIVE |
+ ((CONV_UNSPECIFIED +
+ kConventionOffset) << kConventionShift),
+ /// Native with ODF A1 bracketed references. Not very useful but supported.
+ GRAM_NATIVE_ODF = ::com::sun::star::sheet::FormulaLanguage::NATIVE |
+ ((CONV_ODF +
+ kConventionOffset) << kConventionShift),
+ /// Native with Excel A1 reference style.
+ GRAM_NATIVE_XL_A1 = ::com::sun::star::sheet::FormulaLanguage::NATIVE |
+ ((CONV_XL_A1 +
+ kConventionOffset) << kConventionShift),
+ /// Native with Excel R1C1 reference style.
+ GRAM_NATIVE_XL_R1C1 = ::com::sun::star::sheet::FormulaLanguage::NATIVE |
+ ((CONV_XL_R1C1 +
+ kConventionOffset) << kConventionShift),
+ /// English with Excel A1 reference style.
+ GRAM_ENGLISH_XL_A1 = ::com::sun::star::sheet::FormulaLanguage::XL_ENGLISH |
+ ((CONV_XL_A1 +
+ kConventionOffset) << kConventionShift) |
+ kEnglishBit,
+ /// English with Excel R1C1 reference style.
+ GRAM_ENGLISH_XL_R1C1 = ::com::sun::star::sheet::FormulaLanguage::XL_ENGLISH |
+ ((CONV_XL_R1C1 +
+ kConventionOffset) << kConventionShift) |
+ kEnglishBit,
+ /// Central definition of the default grammar to be used.
+ GRAM_DEFAULT = GRAM_NATIVE_UI,
+
+ /// Central definition of the default storage grammar to be used.
+ GRAM_STORAGE_DEFAULT = GRAM_ODFF,
+
+ /** OpCodeMap set by external filter and merged with reference
+ convention plus English bit on top. Plain value acts as
+ FormulaLanguage. */
+ GRAM_EXTERNAL = (1 << (kConventionShift - 1))
+ };
+
+ /// If English parsing/formatting is associated with a grammar.
+ static inline bool isEnglish( const Grammar eGrammar )
+ {
+ return (eGrammar & kEnglishBit) != 0;
+ }
+
+ /** Compatibility helper for old "bCompileEnglish, bCompileXML" API calls
+ to obtain the new grammar. */
+ static Grammar mapAPItoGrammar( const bool bEnglish, const bool bXML )
+ {
+ Grammar eGrammar;
+ if (bEnglish && bXML)
+ eGrammar = GRAM_PODF;
+ else if (bEnglish && !bXML)
+ eGrammar = GRAM_PODF_A1;
+ else if (!bEnglish && bXML)
+ eGrammar = GRAM_NATIVE_ODF;
+ else // (!bEnglish && !bXML)
+ eGrammar = GRAM_NATIVE;
+ return eGrammar;
+ }
+
+ static bool isSupported( const Grammar eGrammar )
+ {
+ switch (eGrammar)
+ {
+ case GRAM_ODFF :
+ case GRAM_PODF :
+ case GRAM_ENGLISH :
+ case GRAM_NATIVE :
+ case GRAM_ODFF_UI :
+ case GRAM_ODFF_A1 :
+ case GRAM_PODF_UI :
+ case GRAM_PODF_A1 :
+ case GRAM_NATIVE_UI :
+ case GRAM_NATIVE_ODF :
+ case GRAM_NATIVE_XL_A1 :
+ case GRAM_NATIVE_XL_R1C1 :
+ case GRAM_ENGLISH_XL_A1 :
+ case GRAM_ENGLISH_XL_R1C1:
+ return true;
+ default:
+ return extractFormulaLanguage( eGrammar) == GRAM_EXTERNAL;
+ }
+ }
+
+ static inline sal_Int32 extractFormulaLanguage( const Grammar eGrammar )
+ {
+ return eGrammar & kFlagMask;
+ }
+
+ static inline AddressConvention extractRefConvention( const Grammar eGrammar )
+ {
+ return static_cast<AddressConvention>(
+ ((eGrammar & ~kEnglishBit) >> kConventionShift) -
+ kConventionOffset);
+ }
+
+ static inline Grammar setEnglishBit( const Grammar eGrammar, const bool bEnglish )
+ {
+ if (bEnglish)
+ return static_cast<Grammar>( eGrammar | kEnglishBit);
+ else
+ return static_cast<Grammar>( eGrammar & ~kEnglishBit);
+ }
+
+ static inline Grammar mergeToGrammar( const Grammar eGrammar, const AddressConvention eConv )
+ {
+ bool bEnglish = isEnglish( eGrammar);
+ Grammar eGram = static_cast<Grammar>(
+ extractFormulaLanguage( eGrammar) |
+ ((eConv + kConventionOffset) << kConventionShift));
+ eGram = setEnglishBit( eGram, bEnglish);
+ DBG_ASSERT( isSupported( eGram), "CompilerGrammarMap::mergeToGrammar: unsupported grammar");
+ return eGram;
+ }
+
+ /// If grammar is of ODF 1.1
+ static inline bool isPODF( const Grammar eGrammar )
+ {
+ return extractFormulaLanguage( eGrammar) ==
+ ::com::sun::star::sheet::FormulaLanguage::ODF_11;
+ }
+
+ /// If grammar is of ODFF
+ static inline bool isODFF( const Grammar eGrammar )
+ {
+ return extractFormulaLanguage( eGrammar) ==
+ ::com::sun::star::sheet::FormulaLanguage::ODFF;
+ }
+
+};
+// =============================================================================
+} // formula
+// =============================================================================
+
+#endif // FORMULA_GRAMMAR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/omoduleclient.hxx b/include/formula/omoduleclient.hxx
new file mode 100644
index 000000000000..76fcee97fb57
--- /dev/null
+++ b/include/formula/omoduleclient.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FORMULA_MODULECLIENT_HXX
+#define INCLUDED_FORMULA_MODULECLIENT_HXX
+
+#include "sal/config.h"
+
+#include "boost/noncopyable.hpp"
+#include "formula/formuladllapi.h"
+
+namespace formula {
+
+/** Base class for objects which use any global module-specific resources.
+*/
+class FORMULA_DLLPUBLIC OModuleClient: private boost::noncopyable
+{
+public:
+ OModuleClient();
+ ~OModuleClient();
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/opcode.hxx b/include/formula/opcode.hxx
new file mode 100644
index 000000000000..b94c066a624b
--- /dev/null
+++ b/include/formula/opcode.hxx
@@ -0,0 +1,420 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef FORMULA_OPCODE_HXX
+#define FORMULA_OPCODE_HXX
+
+#include "formula/compiler.hrc" // OpCodes
+#include <tools/solar.h>
+
+enum OpCodeEnum
+{
+ // Special commands
+ ocPush = SC_OPCODE_PUSH,
+ ocCall = SC_OPCODE_CALL,
+ ocStop = SC_OPCODE_STOP,
+ ocExternal = SC_OPCODE_EXTERNAL,
+ ocName = SC_OPCODE_NAME,
+ ocExternalRef = SC_OPCODE_EXTERNAL_REF,
+ // Jump commands
+ ocIf = SC_OPCODE_IF,
+ ocIfError = SC_OPCODE_IF_ERROR,
+ ocIfNA = SC_OPCODE_IF_NA,
+ ocChose = SC_OPCODE_CHOSE,
+ // Parentheses and separators
+ ocOpen = SC_OPCODE_OPEN,
+ ocClose = SC_OPCODE_CLOSE,
+ ocSep = SC_OPCODE_SEP,
+ ocArrayOpen = SC_OPCODE_ARRAY_OPEN,
+ ocArrayClose = SC_OPCODE_ARRAY_CLOSE,
+ ocArrayRowSep = SC_OPCODE_ARRAY_ROW_SEP,
+ ocArrayColSep = SC_OPCODE_ARRAY_COL_SEP,
+ // Special OpCodes
+ ocMissing = SC_OPCODE_MISSING,
+ ocBad = SC_OPCODE_BAD,
+ ocStringXML = SC_OPCODE_STRINGXML,
+ ocSpaces = SC_OPCODE_SPACES,
+ ocMatRef = SC_OPCODE_MAT_REF,
+ ocSkip = SC_OPCODE_SKIP,
+ // Access commands
+ ocDBArea = SC_OPCODE_DB_AREA,
+ ocMacro = SC_OPCODE_MACRO,
+ ocColRowName = SC_OPCODE_COL_ROW_NAME,
+ ocColRowNameAuto = SC_OPCODE_COL_ROW_NAME_AUTO,
+ // Percent operator _follows_ value
+ ocPercentSign = SC_OPCODE_PERCENT_SIGN,
+ // Error constants
+ ocErrNull = SC_OPCODE_ERROR_NULL,
+ ocErrDivZero = SC_OPCODE_ERROR_DIVZERO,
+ ocErrValue = SC_OPCODE_ERROR_VALUE,
+ ocErrRef = SC_OPCODE_ERROR_REF,
+ ocErrName = SC_OPCODE_ERROR_NAME,
+ ocErrNum = SC_OPCODE_ERROR_NUM,
+ ocErrNA = SC_OPCODE_ERROR_NA,
+ // Binary operators
+ ocAdd = SC_OPCODE_ADD,
+ ocSub = SC_OPCODE_SUB,
+ ocMul = SC_OPCODE_MUL,
+ ocDiv = SC_OPCODE_DIV,
+ ocAmpersand = SC_OPCODE_AMPERSAND,
+ ocPow = SC_OPCODE_POW,
+ ocEqual = SC_OPCODE_EQUAL,
+ ocNotEqual = SC_OPCODE_NOT_EQUAL,
+ ocLess = SC_OPCODE_LESS,
+ ocGreater = SC_OPCODE_GREATER,
+ ocLessEqual = SC_OPCODE_LESS_EQUAL,
+ ocGreaterEqual = SC_OPCODE_GREATER_EQUAL,
+ ocAnd = SC_OPCODE_AND,
+ ocOr = SC_OPCODE_OR,
+ ocXor = SC_OPCODE_XOR,
+ ocIntersect = SC_OPCODE_INTERSECT,
+ ocUnion = SC_OPCODE_UNION,
+ ocRange = SC_OPCODE_RANGE,
+ // Unary operators
+ ocNot = SC_OPCODE_NOT,
+ ocNeg = SC_OPCODE_NEG,
+ ocNegSub = SC_OPCODE_NEG_SUB,
+ // Functions with no parameters
+ ocPi = SC_OPCODE_PI,
+ ocRandom = SC_OPCODE_RANDOM,
+ ocTrue = SC_OPCODE_TRUE,
+ ocFalse = SC_OPCODE_FALSE,
+ ocGetActDate = SC_OPCODE_GET_ACT_DATE,
+ ocGetActTime = SC_OPCODE_GET_ACT_TIME,
+ ocNotAvail = SC_OPCODE_NO_VALUE,
+ ocCurrent = SC_OPCODE_CURRENT,
+ // Functions with one parameter
+ ocDeg = SC_OPCODE_DEG,
+ ocRad = SC_OPCODE_RAD,
+ ocSin = SC_OPCODE_SIN,
+ ocCos = SC_OPCODE_COS,
+ ocTan = SC_OPCODE_TAN,
+ ocCot = SC_OPCODE_COT,
+ ocArcSin = SC_OPCODE_ARC_SIN,
+ ocArcCos = SC_OPCODE_ARC_COS,
+ ocArcTan = SC_OPCODE_ARC_TAN,
+ ocArcCot = SC_OPCODE_ARC_COT,
+ ocSinHyp = SC_OPCODE_SIN_HYP,
+ ocCosHyp = SC_OPCODE_COS_HYP,
+ ocTanHyp = SC_OPCODE_TAN_HYP,
+ ocCotHyp = SC_OPCODE_COT_HYP,
+ ocArcSinHyp = SC_OPCODE_ARC_SIN_HYP,
+ ocArcCosHyp = SC_OPCODE_ARC_COS_HYP,
+ ocArcTanHyp = SC_OPCODE_ARC_TAN_HYP,
+ ocArcCotHyp = SC_OPCODE_ARC_COT_HYP,
+ ocCosecant = SC_OPCODE_COSECANT,
+ ocSecant = SC_OPCODE_SECANT,
+ ocCosecantHyp = SC_OPCODE_COSECANT_HYP,
+ ocSecantHyp = SC_OPCODE_SECANT_HYP,
+ ocExp = SC_OPCODE_EXP,
+ ocLn = SC_OPCODE_LN,
+ ocSqrt = SC_OPCODE_SQRT,
+ ocFact = SC_OPCODE_FACT,
+ ocGetYear = SC_OPCODE_GET_YEAR,
+ ocGetMonth = SC_OPCODE_GET_MONTH,
+ ocGetDay = SC_OPCODE_GET_DAY,
+ ocGetHour = SC_OPCODE_GET_HOUR,
+ ocGetMin = SC_OPCODE_GET_MIN,
+ ocGetSec = SC_OPCODE_GET_SEC,
+ ocPlusMinus = SC_OPCODE_PLUS_MINUS,
+ ocAbs = SC_OPCODE_ABS,
+ ocInt = SC_OPCODE_INT,
+ ocPhi = SC_OPCODE_PHI,
+ ocGauss = SC_OPCODE_GAUSS,
+ ocIsEmpty = SC_OPCODE_IS_EMPTY,
+ ocIsString = SC_OPCODE_IS_STRING,
+ ocIsNonString = SC_OPCODE_IS_NON_STRING,
+ ocIsLogical = SC_OPCODE_IS_LOGICAL,
+ ocType = SC_OPCODE_TYPE,
+ ocCell = SC_OPCODE_CELL,
+ ocIsRef = SC_OPCODE_IS_REF,
+ ocIsValue = SC_OPCODE_IS_VALUE,
+ ocIsFormula = SC_OPCODE_IS_FORMULA,
+ ocIsNA = SC_OPCODE_IS_NV,
+ ocIsErr = SC_OPCODE_IS_ERR,
+ ocIsError = SC_OPCODE_IS_ERROR,
+ ocIsEven = SC_OPCODE_IS_EVEN,
+ ocIsOdd = SC_OPCODE_IS_ODD,
+ ocN = SC_OPCODE_N,
+ // String functions
+ ocGetDateValue = SC_OPCODE_GET_DATE_VALUE,
+ ocGetTimeValue = SC_OPCODE_GET_TIME_VALUE,
+ ocCode = SC_OPCODE_CODE,
+ ocTrim = SC_OPCODE_TRIM,
+ ocUpper = SC_OPCODE_UPPER,
+ ocPropper = SC_OPCODE_PROPPER,
+ ocLower = SC_OPCODE_LOWER,
+ ocLen = SC_OPCODE_LEN,
+ ocT = SC_OPCODE_T,
+ ocValue = SC_OPCODE_VALUE,
+ ocClean = SC_OPCODE_CLEAN,
+ ocChar = SC_OPCODE_CHAR,
+ ocLog10 = SC_OPCODE_LOG10,
+ ocEven = SC_OPCODE_EVEN,
+ ocOdd = SC_OPCODE_ODD,
+ ocStdNormDist = SC_OPCODE_STD_NORM_DIST,
+ ocFisher = SC_OPCODE_FISHER,
+ ocFisherInv = SC_OPCODE_FISHER_INV,
+ ocSNormInv = SC_OPCODE_S_NORM_INV,
+ ocGammaLn = SC_OPCODE_GAMMA_LN,
+ ocGamma = SC_OPCODE_GAMMA,
+ ocErrorType = SC_OPCODE_ERROR_TYPE,
+ ocErrCell = SC_OPCODE_ERR_CELL,
+ ocFormula = SC_OPCODE_FORMULA,
+ ocArabic = SC_OPCODE_ARABIC,
+ ocInfo = SC_OPCODE_INFO,
+ ocBahtText = SC_OPCODE_BAHTTEXT,
+ ocJis = SC_OPCODE_JIS,
+ ocAsc = SC_OPCODE_ASC,
+ ocUnicode = SC_OPCODE_UNICODE,
+ ocUnichar = SC_OPCODE_UNICHAR,
+ // Functions with more than one parameters
+ ocArcTan2 = SC_OPCODE_ARC_TAN_2,
+ ocCeil = SC_OPCODE_CEIL,
+ ocFloor = SC_OPCODE_FLOOR,
+ ocRound = SC_OPCODE_ROUND,
+ ocRoundUp = SC_OPCODE_ROUND_UP,
+ ocRoundDown = SC_OPCODE_ROUND_DOWN,
+ ocTrunc = SC_OPCODE_TRUNC,
+ ocLog = SC_OPCODE_LOG,
+ ocPower = SC_OPCODE_POWER,
+ ocGCD = SC_OPCODE_GGT,
+ ocLCM = SC_OPCODE_KGV,
+ ocMod = SC_OPCODE_MOD,
+ ocSumProduct = SC_OPCODE_SUM_PRODUCT,
+ ocSumSQ = SC_OPCODE_SUM_SQ,
+ ocSumX2MY2 = SC_OPCODE_SUM_X2MY2,
+ ocSumX2DY2 = SC_OPCODE_SUM_X2DY2,
+ ocSumXMY2 = SC_OPCODE_SUM_XMY2,
+ ocGetDate = SC_OPCODE_GET_DATE,
+ ocGetTime = SC_OPCODE_GET_TIME,
+ ocGetDiffDate = SC_OPCODE_GET_DIFF_DATE,
+ ocGetDiffDate360 = SC_OPCODE_GET_DIFF_DATE_360,
+ ocGetDateDif = SC_OPCODE_GET_DATEDIF,
+ ocMin = SC_OPCODE_MIN,
+ ocMax = SC_OPCODE_MAX,
+ ocSum = SC_OPCODE_SUM,
+ ocProduct = SC_OPCODE_PRODUCT,
+ ocAverage = SC_OPCODE_AVERAGE,
+ ocCount = SC_OPCODE_COUNT,
+ ocCount2 = SC_OPCODE_COUNT_2,
+ ocNPV = SC_OPCODE_NBW,
+ ocIRR = SC_OPCODE_IKV,
+ ocMIRR = SC_OPCODE_MIRR,
+ ocISPMT = SC_OPCODE_ISPMT,
+ ocVar = SC_OPCODE_VAR,
+ ocVarP = SC_OPCODE_VAR_P,
+ ocStDev = SC_OPCODE_ST_DEV,
+ ocStDevP = SC_OPCODE_ST_DEV_P,
+ ocB = SC_OPCODE_B,
+ ocNormDist = SC_OPCODE_NORM_DIST,
+ ocExpDist = SC_OPCODE_EXP_DIST,
+ ocBinomDist = SC_OPCODE_BINOM_DIST,
+ ocPoissonDist = SC_OPCODE_POISSON_DIST,
+ ocKombin = SC_OPCODE_KOMBIN,
+ ocKombin2 = SC_OPCODE_KOMBIN_2,
+ ocVariationen = SC_OPCODE_VARIATIONEN,
+ ocVariationen2 = SC_OPCODE_VARIATIONEN_2,
+ ocBW = SC_OPCODE_BW,
+ ocDIA = SC_OPCODE_DIA,
+ ocGDA = SC_OPCODE_GDA,
+ ocGDA2 = SC_OPCODE_GDA_2,
+ ocVBD = SC_OPCODE_VBD,
+ ocLaufz = SC_OPCODE_LAUFZ,
+ ocLIA = SC_OPCODE_LIA,
+ ocRMZ = SC_OPCODE_RMZ,
+ ocColumns = SC_OPCODE_COLUMNS,
+ ocRows = SC_OPCODE_ROWS,
+ ocColumn = SC_OPCODE_COLUMN,
+ ocRow = SC_OPCODE_ROW,
+ ocZGZ = SC_OPCODE_ZGZ,
+ ocZW = SC_OPCODE_ZW,
+ ocZZR = SC_OPCODE_ZZR,
+ ocZins = SC_OPCODE_ZINS,
+ ocZinsZ = SC_OPCODE_ZINS_Z,
+ ocKapz = SC_OPCODE_KAPZ,
+ ocKumZinsZ = SC_OPCODE_KUM_ZINS_Z,
+ ocKumKapZ = SC_OPCODE_KUM_KAP_Z,
+ ocEffektiv = SC_OPCODE_EFFEKTIV,
+ ocNominal = SC_OPCODE_NOMINAL,
+ ocSubTotal = SC_OPCODE_SUB_TOTAL,
+ // Database functions
+ ocDBSum = SC_OPCODE_DB_SUM,
+ ocDBCount = SC_OPCODE_DB_COUNT,
+ ocDBCount2 = SC_OPCODE_DB_COUNT_2,
+ ocDBAverage = SC_OPCODE_DB_AVERAGE,
+ ocDBGet = SC_OPCODE_DB_GET,
+ ocDBMax = SC_OPCODE_DB_MAX,
+ ocDBMin = SC_OPCODE_DB_MIN,
+ ocDBProduct = SC_OPCODE_DB_PRODUCT,
+ ocDBStdDev = SC_OPCODE_DB_STD_DEV,
+ ocDBStdDevP = SC_OPCODE_DB_STD_DEV_P,
+ ocDBVar = SC_OPCODE_DB_VAR,
+ ocDBVarP = SC_OPCODE_DB_VAR_P,
+ // Management functions
+ ocIndirect = SC_OPCODE_INDIRECT,
+ ocIndirectXL = SC_OPCODE_INDIRECT_XL,
+ ocAddress = SC_OPCODE_ADDRESS,
+ ocAddressXL = SC_OPCODE_ADDRESS_XL,
+ ocMatch = SC_OPCODE_MATCH,
+ ocCountEmptyCells = SC_OPCODE_COUNT_EMPTY_CELLS,
+ ocCountIf = SC_OPCODE_COUNT_IF,
+ ocSumIf = SC_OPCODE_SUM_IF,
+ ocAverageIf = SC_OPCODE_AVERAGE_IF,
+ ocSumIfs = SC_OPCODE_SUM_IFS,
+ ocAverageIfs = SC_OPCODE_AVERAGE_IFS,
+ ocCountIfs = SC_OPCODE_COUNT_IFS,
+ ocLookup = SC_OPCODE_LOOKUP,
+ ocVLookup = SC_OPCODE_V_LOOKUP,
+ ocHLookup = SC_OPCODE_H_LOOKUP,
+ ocMultiArea = SC_OPCODE_MULTI_AREA,
+ ocOffset = SC_OPCODE_OFFSET,
+ ocIndex = SC_OPCODE_INDEX,
+ ocAreas = SC_OPCODE_AREAS,
+ // String functions
+ ocCurrency = SC_OPCODE_CURRENCY,
+ ocReplace = SC_OPCODE_REPLACE,
+ ocFixed = SC_OPCODE_FIXED,
+ ocFind = SC_OPCODE_FIND,
+ ocExact = SC_OPCODE_EXACT,
+ ocLeft = SC_OPCODE_LEFT,
+ ocRight = SC_OPCODE_RIGHT,
+ ocSearch = SC_OPCODE_SEARCH,
+ ocMid = SC_OPCODE_MID,
+ ocText = SC_OPCODE_TEXT,
+ ocSubstitute = SC_OPCODE_SUBSTITUTE,
+ ocRept = SC_OPCODE_REPT,
+ ocConcat = SC_OPCODE_CONCAT,
+ ocNumberValue = SC_OPCODE_NUMBERVALUE,
+ // Matrix functions
+ ocMatValue = SC_OPCODE_MAT_VALUE,
+ ocMatDet = SC_OPCODE_MAT_DET,
+ ocMatInv = SC_OPCODE_MAT_INV,
+ ocMatMult = SC_OPCODE_MAT_MULT,
+ ocMatTrans = SC_OPCODE_MAT_TRANS,
+ ocMatrixUnit = SC_OPCODE_MATRIX_UNIT,
+ // BackSolver
+ ocBackSolver = SC_OPCODE_BACK_SOLVER,
+ // Statistical functions
+ ocHypGeomDist = SC_OPCODE_HYP_GEOM_DIST,
+ ocLogNormDist = SC_OPCODE_LOG_NORM_DIST,
+ ocTDist = SC_OPCODE_T_DIST,
+ ocFDist = SC_OPCODE_F_DIST,
+ ocChiDist = SC_OPCODE_CHI_DIST,
+ ocChiSqDist = SC_OPCODE_CHISQ_DIST,
+ ocChiSqInv = SC_OPCODE_CHISQ_INV,
+ ocWeibull = SC_OPCODE_WEIBULL,
+ ocNegBinomVert = SC_OPCODE_NEG_BINOM_VERT,
+ ocKritBinom = SC_OPCODE_KRIT_BINOM,
+ ocKurt = SC_OPCODE_KURT,
+ ocHarMean = SC_OPCODE_HAR_MEAN,
+ ocGeoMean = SC_OPCODE_GEO_MEAN,
+ ocStandard = SC_OPCODE_STANDARD,
+ ocAveDev = SC_OPCODE_AVE_DEV,
+ ocSchiefe = SC_OPCODE_SCHIEFE,
+ ocSkewp = SC_OPCODE_SKEWP,
+ ocDevSq = SC_OPCODE_DEV_SQ,
+ ocMedian = SC_OPCODE_MEDIAN,
+ ocModalValue = SC_OPCODE_MODAL_VALUE,
+ ocZTest = SC_OPCODE_Z_TEST,
+ ocTTest = SC_OPCODE_T_TEST,
+ ocRank = SC_OPCODE_RANK,
+ ocPercentile = SC_OPCODE_PERCENTILE,
+ ocPercentrank = SC_OPCODE_PERCENT_RANK,
+ ocLarge = SC_OPCODE_LARGE,
+ ocSmall = SC_OPCODE_SMALL,
+ ocFrequency = SC_OPCODE_FREQUENCY,
+ ocQuartile = SC_OPCODE_QUARTILE,
+ ocNormInv = SC_OPCODE_NORM_INV,
+ ocConfidence = SC_OPCODE_CONFIDENCE,
+ ocFTest = SC_OPCODE_F_TEST,
+ ocTrimMean = SC_OPCODE_TRIM_MEAN,
+ ocProb = SC_OPCODE_PROB,
+ ocCorrel = SC_OPCODE_CORREL,
+ ocCovar = SC_OPCODE_COVAR,
+ ocPearson = SC_OPCODE_PEARSON,
+ ocRSQ = SC_OPCODE_RSQ,
+ ocSTEYX = SC_OPCODE_STEYX,
+ ocSlope = SC_OPCODE_SLOPE,
+ ocIntercept = SC_OPCODE_INTERCEPT,
+ ocTrend = SC_OPCODE_TREND,
+ ocGrowth = SC_OPCODE_GROWTH,
+ ocRGP = SC_OPCODE_RGP,
+ ocRKP = SC_OPCODE_RKP,
+ ocForecast = SC_OPCODE_FORECAST,
+ ocChiInv = SC_OPCODE_CHI_INV,
+ ocGammaDist = SC_OPCODE_GAMMA_DIST,
+ ocGammaInv = SC_OPCODE_GAMMA_INV,
+ ocTInv = SC_OPCODE_T_INV,
+ ocFInv = SC_OPCODE_F_INV,
+ ocChiTest = SC_OPCODE_CHI_TEST,
+ ocLogInv = SC_OPCODE_LOG_INV,
+ ocTableOp = SC_OPCODE_TABLE_OP,
+ ocBetaDist = SC_OPCODE_BETA_DIST,
+ ocBetaInv = SC_OPCODE_BETA_INV,
+ // Bit functions
+ ocBitAnd = SC_OPCODE_BITAND,
+ ocBitOr = SC_OPCODE_BITOR,
+ ocBitXor = SC_OPCODE_BITXOR,
+ ocBitRshift = SC_OPCODE_BITRSHIFT,
+ ocBitLshift = SC_OPCODE_BITLSHIFT,
+ // miscellaneous
+ ocWeek = SC_OPCODE_WEEK,
+ ocGetDayOfWeek = SC_OPCODE_GET_DAY_OF_WEEK,
+ ocNoName = SC_OPCODE_NO_NAME,
+ ocStyle = SC_OPCODE_STYLE,
+ ocDde = SC_OPCODE_DDE,
+ ocBase = SC_OPCODE_BASE,
+ ocTable = SC_OPCODE_TABLE,
+ ocTables = SC_OPCODE_TABLES,
+ ocMinA = SC_OPCODE_MIN_A,
+ ocMaxA = SC_OPCODE_MAX_A,
+ ocAverageA = SC_OPCODE_AVERAGE_A,
+ ocStDevA = SC_OPCODE_ST_DEV_A,
+ ocStDevPA = SC_OPCODE_ST_DEV_P_A,
+ ocVarA = SC_OPCODE_VAR_A,
+ ocVarPA = SC_OPCODE_VAR_P_A,
+ ocEasterSunday = SC_OPCODE_EASTERSUNDAY,
+ ocDecimal = SC_OPCODE_DECIMAL,
+ ocConvert = SC_OPCODE_CONVERT,
+ ocRoman = SC_OPCODE_ROMAN,
+ ocHyperLink = SC_OPCODE_HYPERLINK,
+ ocGetPivotData = SC_OPCODE_GET_PIVOT_DATA,
+ ocEuroConvert = SC_OPCODE_EUROCONVERT,
+ // internal stuff
+ ocInternalBegin = SC_OPCODE_INTERNAL_BEGIN,
+ ocTTT = SC_OPCODE_TTT,
+ ocInternalEnd = SC_OPCODE_INTERNAL_END,
+ // from here on ExtraData
+ ocDataToken1 = SC_OPCODE_DATA_TOKEN_1,
+ // no OpCode
+ ocNone = SC_OPCODE_NONE
+};
+
+#ifndef DBG_UTIL
+// save memory since compilers tend to int an enum
+typedef sal_uInt16 OpCode;
+#else
+// have enum names in debugger
+typedef OpCodeEnum OpCode;
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/token.hxx b/include/formula/token.hxx
new file mode 100644
index 000000000000..3a174d7b9d4f
--- /dev/null
+++ b/include/formula/token.hxx
@@ -0,0 +1,428 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef FORMULA_TOKEN_HXX
+#define FORMULA_TOKEN_HXX
+
+#include <memory>
+#include <string.h>
+#include <vector>
+#include "formula/opcode.hxx"
+#include <tools/mempool.hxx>
+#include "formula/IFunctionDescription.hxx"
+#include "formula/formuladllapi.h"
+
+#include <boost/intrusive_ptr.hpp>
+
+namespace formula
+{
+
+enum StackVarEnum
+{
+ svByte,
+ svDouble,
+ svString,
+ svSingleRef,
+ svDoubleRef,
+ svMatrix,
+ svIndex,
+ svJump,
+ svExternal, // Byte + String
+ svFAP, // FormulaAutoPilot only, ever exported
+ svJumpMatrix, // 2003-07-02
+ svRefList, // ocUnion result
+ svEmptyCell, // Result is an empty cell, e.g. in LOOKUP()
+
+ svMatrixCell, // Result is a matrix with bells and
+ // whistles as needed for _the_ matrix
+ // formula result.
+
+ svHybridCell, // A temporary condition of a formula
+ // cell during import, having a double
+ // and/or string result and a formula
+ // string to be compiled.
+
+ svHybridValueCell, // A temporary formula cell with an value
+ // and possibily a string representation
+
+ svExternalSingleRef,
+ svExternalDoubleRef,
+ svExternalName,
+ svSubroutine, // A token with a subroutine token array.
+ svError, // error token
+ svMissing = 0x70, // 0 or ""
+ svSep, // separator, ocSep, ocOpen, ocClose
+ svUnknown // unknown StackType
+};
+
+#ifndef DBG_UTIL
+// save memory since compilers tend to int an enum
+typedef sal_uInt8 StackVar;
+#else
+// have enum names in debugger
+typedef StackVarEnum StackVar;
+#endif
+
+
+class FormulaToken;
+typedef ::boost::intrusive_ptr<FormulaToken> FormulaTokenRef;
+typedef ::boost::intrusive_ptr<const FormulaToken> FormulaConstTokenRef;
+
+class FormulaTokenArray;
+
+class FORMULA_DLLPUBLIC FormulaToken : public IFormulaToken
+{
+ OpCode eOp;
+ // not implemented, prevent usage
+ FormulaToken();
+ FormulaToken& operator=( const FormulaToken& );
+protected:
+
+ const StackVar eType; // type of data
+ mutable sal_uInt16 nRefCnt; // reference count
+
+public:
+ FormulaToken( StackVar eTypeP,OpCode e = ocPush ) :
+ eOp(e), eType( eTypeP ), nRefCnt(0) {}
+ FormulaToken( const FormulaToken& r ) : IFormulaToken(),
+ eOp(r.eOp), eType( r.eType ), nRefCnt(0) {}
+
+ virtual ~FormulaToken();
+
+ inline void Delete() { delete this; }
+ inline StackVar GetType() const { return eType; }
+ bool IsFunction() const; // pure functions, no operators
+ bool IsExternalRef() const;
+ sal_uInt8 GetParamCount() const;
+ inline void IncRef() const { nRefCnt++; }
+ inline void DecRef() const
+ {
+ if (!--nRefCnt)
+ const_cast<FormulaToken*>(this)->Delete();
+ }
+ inline sal_uInt16 GetRef() const { return nRefCnt; }
+ inline OpCode GetOpCode() const { return eOp; }
+
+ /**
+ Dummy methods to avoid switches and casts where possible,
+ the real token classes have to overload the appropriate method[s].
+ The only methods valid anytime if not overloaded are:
+
+ - GetByte() since this represents the count of parameters to a function
+ which of course is 0 on non-functions. FormulaByteToken and ScExternal do
+ overload it.
+
+ - HasForceArray() since also this is only used for operators and
+ functions and is 0 for other tokens.
+
+ Any other non-overloaded method pops up an assertion.
+ */
+
+ virtual sal_uInt8 GetByte() const;
+ virtual void SetByte( sal_uInt8 n );
+ virtual bool HasForceArray() const;
+ virtual void SetForceArray( bool b );
+ virtual double GetDouble() const;
+ virtual double& GetDoubleAsReference();
+ virtual const String& GetString() const;
+ virtual sal_uInt16 GetIndex() const;
+ virtual void SetIndex( sal_uInt16 n );
+ virtual bool IsGlobal() const;
+ virtual void SetGlobal( bool b );
+ virtual short* GetJump() const;
+ virtual const String& GetExternal() const;
+ virtual FormulaToken* GetFAPOrigToken() const;
+ virtual sal_uInt16 GetError() const;
+ virtual void SetError( sal_uInt16 );
+
+ virtual FormulaToken* Clone() const { return new FormulaToken(*this); }
+
+ virtual bool Is3DRef() const; // reference with 3D flag set
+ virtual bool TextEqual( const formula::FormulaToken& rToken ) const;
+ virtual bool operator==( const FormulaToken& rToken ) const;
+
+ virtual bool isFunction() const
+ {
+ return IsFunction();
+ }
+
+ virtual sal_uInt32 getArgumentCount() const
+ {
+ return GetParamCount();
+ }
+
+ /** This is dirty and only the compiler should use it! */
+ struct PrivateAccess { friend class FormulaCompiler; private: PrivateAccess() { } };
+ inline void NewOpCode( OpCode e, const PrivateAccess& ) { eOp = e; }
+
+ static size_t GetStrLenBytes( xub_StrLen nLen )
+ { return nLen * sizeof(sal_Unicode); }
+ static size_t GetStrLenBytes( const String& rStr )
+ { return GetStrLenBytes( rStr.Len() ); }
+};
+
+inline void intrusive_ptr_add_ref(const FormulaToken* p)
+{
+ p->IncRef();
+}
+
+inline void intrusive_ptr_release(const FormulaToken* p)
+{
+ p->DecRef();
+}
+
+class FORMULA_DLLPUBLIC FormulaByteToken : public FormulaToken
+{
+private:
+ sal_uInt8 nByte;
+ bool bHasForceArray;
+protected:
+ FormulaByteToken( OpCode e, sal_uInt8 n, StackVar v, bool b ) :
+ FormulaToken( v,e ), nByte( n ),
+ bHasForceArray( b ) {}
+public:
+ FormulaByteToken( OpCode e, sal_uInt8 n, bool b ) :
+ FormulaToken( svByte,e ), nByte( n ),
+ bHasForceArray( b ) {}
+ FormulaByteToken( OpCode e, sal_uInt8 n ) :
+ FormulaToken( svByte,e ), nByte( n ),
+ bHasForceArray( false ) {}
+ FormulaByteToken( OpCode e ) :
+ FormulaToken( svByte,e ), nByte( 0 ),
+ bHasForceArray( false ) {}
+ FormulaByteToken( const FormulaByteToken& r ) :
+ FormulaToken( r ), nByte( r.nByte ),
+ bHasForceArray( r.bHasForceArray ) {}
+
+ virtual FormulaToken* Clone() const { return new FormulaByteToken(*this); }
+ virtual sal_uInt8 GetByte() const;
+ virtual void SetByte( sal_uInt8 n );
+ virtual bool HasForceArray() const;
+ virtual void SetForceArray( bool b );
+ virtual bool operator==( const FormulaToken& rToken ) const;
+
+ DECL_FIXEDMEMPOOL_NEWDEL_DLL( FormulaByteToken )
+};
+
+
+// A special token for the FormulaAutoPilot only. Keeps a reference pointer of
+// the token of which it was created for comparison.
+class FORMULA_DLLPUBLIC FormulaFAPToken : public FormulaByteToken
+{
+private:
+ FormulaTokenRef pOrigToken;
+public:
+ FormulaFAPToken( OpCode e, sal_uInt8 n, FormulaToken* p ) :
+ FormulaByteToken( e, n, svFAP, false ),
+ pOrigToken( p ) {}
+ FormulaFAPToken( const FormulaFAPToken& r ) :
+ FormulaByteToken( r ), pOrigToken( r.pOrigToken ) {}
+
+ virtual FormulaToken* Clone() const { return new FormulaFAPToken(*this); }
+ virtual FormulaToken* GetFAPOrigToken() const;
+ virtual bool operator==( const FormulaToken& rToken ) const;
+};
+
+class FORMULA_DLLPUBLIC FormulaDoubleToken : public FormulaToken
+{
+private:
+ double fDouble;
+public:
+ FormulaDoubleToken( double f ) :
+ FormulaToken( svDouble ), fDouble( f ) {}
+ FormulaDoubleToken( const FormulaDoubleToken& r ) :
+ FormulaToken( r ), fDouble( r.fDouble ) {}
+
+ virtual FormulaToken* Clone() const { return new FormulaDoubleToken(*this); }
+ virtual double GetDouble() const;
+ virtual double& GetDoubleAsReference();
+ virtual bool operator==( const FormulaToken& rToken ) const;
+
+ DECL_FIXEDMEMPOOL_NEWDEL_DLL( FormulaDoubleToken )
+};
+
+
+class FORMULA_DLLPUBLIC FormulaStringToken : public FormulaToken
+{
+private:
+ String aString;
+public:
+ FormulaStringToken( const String& r ) :
+ FormulaToken( svString ), aString( r ) {}
+ FormulaStringToken( const FormulaStringToken& r ) :
+ FormulaToken( r ), aString( r.aString ) {}
+
+ virtual FormulaToken* Clone() const { return new FormulaStringToken(*this); }
+ virtual const String& GetString() const;
+ virtual bool operator==( const FormulaToken& rToken ) const;
+
+ DECL_FIXEDMEMPOOL_NEWDEL_DLL( FormulaStringToken )
+};
+
+
+/** Identical to FormulaStringToken, but with explicit OpCode instead of implicit
+ ocPush, and an optional sal_uInt8 for ocBad tokens. */
+class FORMULA_DLLPUBLIC FormulaStringOpToken : public FormulaByteToken
+{
+private:
+ String aString;
+public:
+ FormulaStringOpToken( OpCode e, const String& r ) :
+ FormulaByteToken( e, 0, svString, false ), aString( r ) {}
+ FormulaStringOpToken( const FormulaStringOpToken& r ) :
+ FormulaByteToken( r ), aString( r.aString ) {}
+
+ virtual FormulaToken* Clone() const { return new FormulaStringOpToken(*this); }
+ virtual const String& GetString() const;
+ virtual bool operator==( const FormulaToken& rToken ) const;
+};
+
+class FORMULA_DLLPUBLIC FormulaIndexToken : public FormulaToken
+{
+private:
+ sal_uInt16 nIndex;
+ bool mbGlobal;
+public:
+ FormulaIndexToken( OpCode e, sal_uInt16 n, bool bGlobal = true ) :
+ FormulaToken( svIndex, e ), nIndex( n ), mbGlobal( bGlobal ) {}
+ FormulaIndexToken( const FormulaIndexToken& r ) :
+ FormulaToken( r ), nIndex( r.nIndex ), mbGlobal( r.mbGlobal ) {}
+
+ virtual FormulaToken* Clone() const { return new FormulaIndexToken(*this); }
+ virtual sal_uInt16 GetIndex() const;
+ virtual void SetIndex( sal_uInt16 n );
+ virtual bool IsGlobal() const;
+ virtual void SetGlobal( bool b );
+ virtual bool operator==( const FormulaToken& rToken ) const;
+};
+
+
+class FORMULA_DLLPUBLIC FormulaExternalToken : public FormulaToken
+{
+private:
+ String aExternal;
+ sal_uInt8 nByte;
+public:
+ FormulaExternalToken( OpCode e, sal_uInt8 n, const String& r ) :
+ FormulaToken( svExternal, e ), aExternal( r ),
+ nByte( n ) {}
+ FormulaExternalToken( OpCode e, const String& r ) :
+ FormulaToken(svExternal, e ), aExternal( r ),
+ nByte( 0 ) {}
+ FormulaExternalToken( const FormulaExternalToken& r ) :
+ FormulaToken( r ), aExternal( r.aExternal ),
+ nByte( r.nByte ) {}
+
+ virtual FormulaToken* Clone() const { return new FormulaExternalToken(*this); }
+ virtual const String& GetExternal() const;
+ virtual sal_uInt8 GetByte() const;
+ virtual void SetByte( sal_uInt8 n );
+ virtual bool operator==( const FormulaToken& rToken ) const;
+};
+
+
+class FORMULA_DLLPUBLIC FormulaMissingToken : public FormulaToken
+{
+public:
+ FormulaMissingToken() :
+ FormulaToken( svMissing,ocMissing ) {}
+ FormulaMissingToken( const FormulaMissingToken& r ) :
+ FormulaToken( r ) {}
+
+ virtual FormulaToken* Clone() const { return new FormulaMissingToken(*this); }
+ virtual double GetDouble() const;
+ virtual const String& GetString() const;
+ virtual bool operator==( const FormulaToken& rToken ) const;
+};
+
+class FORMULA_DLLPUBLIC FormulaJumpToken : public FormulaToken
+{
+private:
+ short* pJump;
+public:
+ FormulaJumpToken( OpCode e, short* p ) :
+ FormulaToken( formula::svJump , e)
+ {
+ pJump = new short[ p[0] + 1 ];
+ memcpy( pJump, p, (p[0] + 1) * sizeof(short) );
+ }
+ FormulaJumpToken( const FormulaJumpToken& r ) :
+ FormulaToken( r )
+ {
+ pJump = new short[ r.pJump[0] + 1 ];
+ memcpy( pJump, r.pJump, (r.pJump[0] + 1) * sizeof(short) );
+ }
+ virtual ~FormulaJumpToken();
+ virtual short* GetJump() const;
+ virtual bool operator==( const formula::FormulaToken& rToken ) const;
+ virtual FormulaToken* Clone() const { return new FormulaJumpToken(*this); }
+};
+
+
+class FORMULA_DLLPUBLIC FormulaSubroutineToken : public FormulaToken
+{
+public:
+ /** Takes ownership of pArray and deletes it upon destruction! */
+ FormulaSubroutineToken( const FormulaTokenArray* pArray ) :
+ FormulaToken( svSubroutine, ocCall ), mpArray( pArray) {}
+ FormulaSubroutineToken( const FormulaSubroutineToken& r );
+ virtual ~FormulaSubroutineToken();
+ virtual FormulaToken* Clone() const { return new FormulaSubroutineToken(*this); }
+ virtual bool operator==( const FormulaToken& rToken ) const;
+
+private:
+ const FormulaTokenArray* mpArray;
+};
+
+
+class FORMULA_DLLPUBLIC FormulaUnknownToken : public FormulaToken
+{
+public:
+ FormulaUnknownToken( OpCode e ) :
+ FormulaToken( svUnknown, e ) {}
+ FormulaUnknownToken( const FormulaUnknownToken& r ) :
+ FormulaToken( r ) {}
+
+ virtual FormulaToken* Clone() const { return new FormulaUnknownToken(*this); }
+ virtual bool operator==( const FormulaToken& rToken ) const;
+};
+
+
+class FORMULA_DLLPUBLIC FormulaErrorToken : public FormulaToken
+{
+ sal_uInt16 nError;
+public:
+ FormulaErrorToken( sal_uInt16 nErr ) :
+ FormulaToken( svError ), nError( nErr) {}
+ FormulaErrorToken( const FormulaErrorToken& r ) :
+ FormulaToken( r ), nError( r.nError) {}
+
+ virtual FormulaToken* Clone() const { return new FormulaErrorToken(*this); }
+ virtual sal_uInt16 GetError() const;
+ virtual void SetError( sal_uInt16 nErr );
+ virtual bool operator==( const FormulaToken& rToken ) const;
+};
+
+// =============================================================================
+} // formula
+// =============================================================================
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/tokenarray.hxx b/include/formula/tokenarray.hxx
new file mode 100644
index 000000000000..875b055a621a
--- /dev/null
+++ b/include/formula/tokenarray.hxx
@@ -0,0 +1,287 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef FORMULA_TOKENARRAY_HXX
+#define FORMULA_TOKENARRAY_HXX
+
+#include <limits.h>
+#include "formula/token.hxx"
+#include "formula/ExternalReferenceHelper.hxx"
+#include <tools/solar.h>
+#include <com/sun/star/sheet/FormulaToken.hpp>
+
+namespace formula
+{
+
+// RecalcMode access only via TokenArray SetRecalcMode / IsRecalcMode...
+
+typedef sal_uInt8 ScRecalcMode;
+// Only one of the exclusive bits can be set,
+// handled by TokenArray SetRecalcMode... methods
+#define RECALCMODE_NORMAL 0x01 // exclusive
+#define RECALCMODE_ALWAYS 0x02 // exclusive, always
+#define RECALCMODE_ONLOAD 0x04 // exclusive, always after load
+#define RECALCMODE_ONLOAD_ONCE 0x08 // exclusive, once after load
+#define RECALCMODE_FORCED 0x10 // combined, also if cell isn't visible
+#define RECALCMODE_ONREFMOVE 0x20 // combined, if reference was moved
+#define RECALCMODE_EMASK 0x0F // mask of exclusive bits
+// If new bits are to be defined, AddRecalcMode has to be adjusted!
+
+class FormulaMissingContext;
+
+class FORMULA_DLLPUBLIC MissingConvention
+{
+ bool mbODFF; /// TRUE: ODFF, FALSE: PODF
+public:
+ explicit MissingConvention( bool bODFF ) : mbODFF(bODFF) {}
+ // Implementation and usage only in token.cxx
+ inline bool isRewriteNeeded( OpCode eOp ) const;
+ inline bool isODFF() const { return mbODFF; }
+};
+
+class FORMULA_DLLPUBLIC FormulaTokenArray
+{
+ friend class FormulaCompiler;
+ friend class FormulaTokenIterator;
+ friend class FormulaMissingContext;
+
+protected:
+ FormulaToken** pCode; // Token code array
+ FormulaToken** pRPN; // RPN array
+ sal_uInt16 nLen; // Length of token array
+ sal_uInt16 nRPN; // Length of RPN array
+ sal_uInt16 nIndex; // Current step index
+ sal_uInt16 nError; // Error code
+ short nRefs; // Count of cell references
+ ScRecalcMode nMode; // Flags to indicate when to recalc this code
+ bool bHyperLink; // If HYPERLINK() occurs in the formula.
+
+protected:
+ void Assign( const FormulaTokenArray& );
+
+ /// Also used by the compiler. The token MUST had been allocated with new!
+ FormulaToken* Add( FormulaToken* );
+ inline void SetCombinedBitsRecalcMode( ScRecalcMode nBits )
+ { nMode |= (nBits & ~RECALCMODE_EMASK); }
+ inline ScRecalcMode GetCombinedBitsRecalcMode() const
+ { return nMode & ~RECALCMODE_EMASK; }
+ /** Exclusive bits already set in nMode are
+ zero'ed, nBits may contain combined bits, but
+ only one exclusive bit may be set! */
+ inline void SetMaskedRecalcMode( ScRecalcMode nBits )
+ { nMode = GetCombinedBitsRecalcMode() | nBits; }
+
+public:
+ FormulaTokenArray();
+ /// Assignment with references to FormulaToken entries (not copied!)
+ FormulaTokenArray( const FormulaTokenArray& );
+ virtual ~FormulaTokenArray();
+ FormulaTokenArray* Clone() const; /// True copy!
+
+ void Clear();
+ void DelRPN();
+ FormulaToken* First() { nIndex = 0; return Next(); }
+ FormulaToken* Next();
+ FormulaToken* FirstNoSpaces() { nIndex = 0; return NextNoSpaces(); }
+ FormulaToken* NextNoSpaces();
+ FormulaToken* GetNextName();
+ FormulaToken* GetNextReference();
+ FormulaToken* GetNextReferenceRPN();
+ FormulaToken* GetNextReferenceOrName();
+ FormulaToken* GetNextColRowName();
+ FormulaToken* GetNextOpCodeRPN( OpCode );
+ /// Peek at nIdx-1 if not out of bounds, decrements nIdx if successful. Returns NULL if not.
+ FormulaToken* PeekPrev( sal_uInt16 & nIdx );
+ FormulaToken* PeekNext();
+ FormulaToken* PeekPrevNoSpaces(); /// Only after Reset/First/Next/Last/Prev!
+ FormulaToken* PeekNextNoSpaces(); /// Only after Reset/First/Next/Last/Prev!
+ FormulaToken* FirstRPN() { nIndex = 0; return NextRPN(); }
+ FormulaToken* NextRPN();
+ FormulaToken* LastRPN() { nIndex = nRPN; return PrevRPN(); }
+ FormulaToken* PrevRPN();
+
+ bool HasExternalRef() const;
+ bool HasOpCode( OpCode ) const;
+ bool HasOpCodeRPN( OpCode ) const;
+ /// Token of type svIndex or opcode ocColRowName
+ bool HasNameOrColRowName() const;
+
+ FormulaToken** GetArray() const { return pCode; }
+ FormulaToken** GetCode() const { return pRPN; }
+ sal_uInt16 GetLen() const { return nLen; }
+ sal_uInt16 GetCodeLen() const { return nRPN; }
+ void Reset() { nIndex = 0; }
+ sal_uInt16 GetCodeError() const { return nError; }
+ void SetCodeError( sal_uInt16 n ) { nError = n; }
+ short GetRefs() const { return nRefs; }
+ void IncrementRefs() { ++nRefs; }
+ void SetHyperLink( bool bVal ) { bHyperLink = bVal; }
+ bool IsHyperLink() const { return bHyperLink; }
+
+ inline ScRecalcMode GetRecalcMode() const { return nMode; }
+ /** Bits aren't set directly but validated and
+ maybe handled according to priority if more
+ than one exclusive bit was set. */
+ void AddRecalcMode( ScRecalcMode nBits );
+
+ inline void ClearRecalcMode() { nMode = RECALCMODE_NORMAL; }
+ inline void SetExclusiveRecalcModeNormal()
+ { SetMaskedRecalcMode( RECALCMODE_NORMAL ); }
+ inline void SetExclusiveRecalcModeAlways()
+ { SetMaskedRecalcMode( RECALCMODE_ALWAYS ); }
+ inline void SetExclusiveRecalcModeOnLoad()
+ { SetMaskedRecalcMode( RECALCMODE_ONLOAD ); }
+ inline void SetExclusiveRecalcModeOnLoadOnce()
+ { SetMaskedRecalcMode( RECALCMODE_ONLOAD_ONCE ); }
+ inline void SetRecalcModeForced()
+ { nMode |= RECALCMODE_FORCED; }
+ inline void ClearRecalcModeForced()
+ { nMode &= ~RECALCMODE_FORCED; }
+ inline void SetRecalcModeOnRefMove()
+ { nMode |= RECALCMODE_ONREFMOVE; }
+ inline void ClearRecalcModeOnRefMove()
+ { nMode &= ~RECALCMODE_ONREFMOVE; }
+ inline bool IsRecalcModeNormal() const
+ { return (nMode & RECALCMODE_NORMAL) != 0; }
+ inline bool IsRecalcModeAlways() const
+ { return (nMode & RECALCMODE_ALWAYS) != 0; }
+ inline bool IsRecalcModeOnLoad() const
+ { return (nMode & RECALCMODE_ONLOAD) != 0; }
+ inline bool IsRecalcModeOnLoadOnce() const
+ { return (nMode & RECALCMODE_ONLOAD_ONCE) != 0; }
+ inline bool IsRecalcModeForced() const
+ { return (nMode & RECALCMODE_FORCED) != 0; }
+ inline bool IsRecalcModeOnRefMove() const
+ { return (nMode & RECALCMODE_ONREFMOVE) != 0; }
+
+ /** Get OpCode of the most outer function */
+ inline OpCode GetOuterFuncOpCode();
+
+ /** Operators +,-,*,/,^,&,=,<>,<,>,<=,>=
+ with DoubleRef in Formula? */
+ bool HasMatrixDoubleRefOps();
+
+ virtual FormulaToken* AddOpCode(OpCode e);
+
+ /** Adds the single token to array.
+ Derived classes must overload it when they want to support derived classes from FormulaToken.
+ @return true when an error occurs
+ */
+ virtual bool AddFormulaToken(const com::sun::star::sheet::FormulaToken& _aToken, ExternalReferenceHelper* _pRef = NULL);
+
+ /** fill the array with the tokens from the sequence.
+ It calls AddFormulaToken for each token in the list.
+ @param _aSequence the token to add
+ @return true when an error occurs
+ */
+ bool Fill(const com::sun::star::uno::Sequence< com::sun::star::sheet::FormulaToken >& _aSequence, ExternalReferenceHelper* _pRef = NULL);
+
+ /**
+ * Do some checking based on the individual tokens. For now, we use this
+ * only to check whether we can vectorize the token array.
+ */
+ virtual void CheckToken( const FormulaToken& t );
+
+ FormulaToken* AddToken( const FormulaToken& );
+ FormulaToken* AddString( const sal_Unicode* pStr );
+ FormulaToken* AddString( const String& rStr );
+ FormulaToken* AddDouble( double fVal );
+ FormulaToken* AddExternal( const sal_Unicode* pStr );
+ /** Xcl import may play dirty tricks with OpCode!=ocExternal.
+ Others don't use! */
+ FormulaToken* AddExternal( const String& rStr, OpCode eOp = ocExternal );
+ FormulaToken* AddBad( const String& rStr ); /// ocBad with String
+ FormulaToken* AddStringXML( const String& rStr ); /// ocStringXML with String, temporary during import
+
+ virtual FormulaToken* MergeArray( );
+
+ /// Assignment with references to FormulaToken entries (not copied!)
+ FormulaTokenArray& operator=( const FormulaTokenArray& );
+
+ /** Determines if this formula needs any changes to convert it to something
+ previous versions of OOo could consume (Plain Old Formula). */
+ bool NeedsPofRewrite(const MissingConvention & rConv);
+
+ /** Rewrites to Plain Old Formula, substituting missing parameters. The
+ FormulaTokenArray* returned is new'ed. */
+ FormulaTokenArray* RewriteMissingToPof(const MissingConvention & rConv);
+
+ /** Determines if this formula may be followed by a reference. */
+ bool MayReferenceFollow();
+};
+
+inline OpCode FormulaTokenArray::GetOuterFuncOpCode()
+{
+ if ( pRPN && nRPN )
+ return pRPN[nRPN-1]->GetOpCode();
+ return ocNone;
+}
+
+struct ImpTokenIterator
+{
+ ImpTokenIterator* pNext;
+ const FormulaTokenArray* pArr;
+ short nPC;
+ short nStop;
+
+ DECL_FIXEDMEMPOOL_NEWDEL( ImpTokenIterator );
+};
+
+class FORMULA_DLLPUBLIC FormulaTokenIterator
+{
+ ImpTokenIterator* pCur;
+
+public:
+ FormulaTokenIterator( const FormulaTokenArray& );
+ ~FormulaTokenIterator();
+ void Reset();
+ const FormulaToken* Next();
+ const FormulaToken* PeekNextOperator();
+ bool IsEndOfPath() const; /// if a jump or subroutine path is done
+ bool HasStacked() const { return pCur->pNext != 0; }
+ short GetPC() const { return pCur->nPC; }
+
+ /** Jump or subroutine call.
+ Program counter values will be incremented before code is executed =>
+ positions are to be passed with -1 offset.
+ @param nStart
+ Start on code at position nStart+1 (yes, pass with offset -1)
+ @param nNext
+ After subroutine continue with instruction at position nNext+1
+ @param nStop
+ Stop before reaching code at position nStop. If not specified the
+ default is to either run the entire code, or to stop if an ocSep or
+ ocClose is encountered, which are only present in ocIf or ocChose
+ jumps.
+ */
+ void Jump( short nStart, short nNext, short nStop = SHRT_MAX );
+ void Push( const FormulaTokenArray* );
+ void Pop();
+
+private:
+ const FormulaToken* GetNonEndOfPathToken( short nIdx ) const;
+};
+// =============================================================================
+} // formula
+// =============================================================================
+
+
+#endif // FORMULA_TOKENARRAY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/actiontriggerhelper.hxx b/include/framework/actiontriggerhelper.hxx
new file mode 100644
index 000000000000..e942de94924f
--- /dev/null
+++ b/include/framework/actiontriggerhelper.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __FRAMEWORK_HELPER_ACTIONTRIGGERHELPER_HXX_
+#define __FRAMEWORK_HELPER_ACTIONTRIGGERHELPER_HXX_
+
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <vcl/menu.hxx>
+#include <framework/fwedllapi.h>
+
+
+namespace framework
+{
+ class FWE_DLLPUBLIC ActionTriggerHelper
+ {
+ public:
+ // Fills the submitted menu with the structure contained in the second
+ // parameter rActionTriggerContainer
+ // @param pNewMenu = must be a valid and empty menu
+ // @param rActionTriggerContainer = must be an instance of service "com.sun.star.ui.ActionTriggerContaienr"
+ static void
+ CreateMenuFromActionTriggerContainer(
+ Menu* pNewMenu,
+ const com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer >& rActionTriggerContainer );
+
+ // Creates a "com::sun::star::ui::ActionTriggerContainer" with the structure of the menu
+ // provided as a parameter. The implementation class stores the menu pointer
+ // to optimize the time of creation of a menu from a actiontrigger structure.
+ // IMPORTANT: The caller must ensure that the menu pointer is valid through the
+ // life time of the XIndexContainer object!!!
+ // @param pNewMenu = Must be a valid menu. Please be aware that this implementation is based on
+ // the above mentioned restriction!!!
+
+ static com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer > CreateActionTriggerContainerFromMenu(
+ const Menu* pMenu, const OUString* pMenuIdentifier );
+
+ // Fills the submitted rActionTriggerContainer with the structure of the menu
+ // provided as the second parameter
+ // @param rActionTriggerContainer = must be an instance of service "com.sun.star.ui.ActionTriggerContainer"
+ // @param pNewMenu = must be a valid menu
+ static void
+ FillActionTriggerContainerFromMenu(
+ com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer >& rActionTriggerContainer,
+ const Menu* pMenu );
+
+ };
+}
+
+#endif // __FRAMEWORK_HELPER_ACTIONTRIGGERHELPER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/addonmenu.hxx b/include/framework/addonmenu.hxx
new file mode 100644
index 000000000000..6390459be0f1
--- /dev/null
+++ b/include/framework/addonmenu.hxx
@@ -0,0 +1,127 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef __FRAMEWORK_CLASSES_ADDONMENU_HXX_
+#define __FRAMEWORK_CLASSES_ADDONMENU_HXX_
+
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <vcl/menu.hxx>
+#include <framework/fwedllapi.h>
+
+#define ADDONMENU_ITEMID_START 2000
+#define ADDONMENU_ITEMID_END 3000
+
+namespace framework
+{
+
+class FWE_DLLPUBLIC AddonMenu : public PopupMenu
+{
+ public:
+ AddonMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
+ ~AddonMenu();
+
+ protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
+};
+
+class AddonMenuManager;
+
+class FWE_DLLPUBLIC AddonPopupMenu : public AddonMenu
+{
+ public:
+ ~AddonPopupMenu();
+
+ // Check if command URL string has the unique prefix to identify addon popup menus
+ static sal_Bool IsCommandURLPrefix( const OUString& aCmdURL );
+
+ void SetCommandURL( const OUString& aCmdURL ) { m_aCommandURL = aCmdURL; }
+ const OUString& GetCommandURL() const { return m_aCommandURL; }
+
+ protected:
+ void Initialize( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rAddonPopupMenuDefinition );
+
+ private:
+ AddonPopupMenu( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame );
+
+ OUString m_aCommandURL;
+
+ friend class AddonMenuManager;
+};
+
+class FWE_DLLPUBLIC AddonMenuManager
+{
+ public:
+ enum MenuType
+ {
+ ADDON_MENU,
+ ADDON_POPUPMENU
+ };
+
+ static sal_Bool HasAddonMenuElements();
+
+ static sal_Bool IsAddonMenuId( sal_uInt16 nId ) { return (( nId >= ADDONMENU_ITEMID_START ) && ( nId < ADDONMENU_ITEMID_END )); }
+
+ // Check if the context string matches the provided xModel context
+ static sal_Bool IsCorrectContext( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rModel, const OUString& aContext );
+
+ // Factory method to create different Add-On menu types
+ static PopupMenu* CreatePopupMenuType( MenuType eMenuType, const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame );
+
+ // Create the Add-Ons menu
+ static AddonMenu* CreateAddonMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
+
+ // Merge the Add-Ons help menu items into the given menu bar at a defined pos
+ static void MergeAddonHelpMenu( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame,
+ MenuBar* pMergeMenuBar );
+
+ // Merge the addon popup menus into the given menu bar at the provided pos.
+ static void MergeAddonPopupMenus( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame,
+ const com::sun::star::uno::Reference< com::sun::star::frame::XModel >& rModel,
+ sal_uInt16 nMergeAtPos,
+ MenuBar* pMergeMenuBar );
+
+ // Returns the next position to insert a menu item/sub menu
+ static sal_uInt16 GetNextPos( sal_uInt16 nPos );
+
+ // Build up the menu item and sub menu into the provided pCurrentMenu. The sub menus should be of type nSubMenuType.
+ static void BuildMenu( PopupMenu* pCurrentMenu,
+ MenuType nSubMenuType,
+ sal_uInt16 nInsPos,
+ sal_uInt16& nUniqueMenuId,
+ com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > > aAddonMenuDefinition,
+ const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame,
+ const com::sun::star::uno::Reference< com::sun::star::frame::XModel >& rModel );
+
+ // Retrieve the menu entry property values from a sequence
+ static void GetMenuEntry( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rAddonMenuEntry,
+ OUString& rTitle,
+ OUString& rURL,
+ OUString& rTarget,
+ OUString& rImageId,
+ OUString& rContext,
+ com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > >& rAddonSubMenu );
+};
+
+} // namespace framework
+
+#endif // #ifndef __FRAMEWORK_CLASSES_ADDONMENU_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/addonsoptions.hxx b/include/framework/addonsoptions.hxx
new file mode 100644
index 000000000000..def743378216
--- /dev/null
+++ b/include/framework/addonsoptions.hxx
@@ -0,0 +1,350 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef __FRAMEWORK_CLASSES_ADDONSOPTIONS_HXX_
+#define __FRAMEWORK_CLASSES_ADDONSOPTIONS_HXX_
+
+#include <sal/types.h>
+#include <osl/mutex.hxx>
+#include <vcl/image.hxx>
+#include <vcl/bitmap.hxx>
+#include <vcl/svapp.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <framework/fwedllapi.h>
+//_________________________________________________________________________________________________________________
+// types, enums, ...
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @descr The method GetAddonsMenu() returns a list of property values.
+ Use follow defines to seperate values by names.
+*//*-*************************************************************************************************************/
+#define ADDONSMENUITEM_STRING_URL "URL"
+#define ADDONSMENUITEM_STRING_TITLE "Title"
+#define ADDONSMENUITEM_STRING_TARGET "Target"
+#define ADDONSMENUITEM_STRING_IMAGEIDENTIFIER "ImageIdentifier"
+#define ADDONSMENUITEM_STRING_CONTEXT "Context"
+#define ADDONSMENUITEM_STRING_SUBMENU "Submenu"
+#define ADDONSMENUITEM_STRING_CONTROLTYPE "ControlType"
+#define ADDONSMENUITEM_STRING_WIDTH "Width"
+
+#define ADDONSMENUITEM_URL_LEN 3
+#define ADDONSMENUITEM_TITLE_LEN 5
+#define ADDONSMENUITEM_TARGET_LEN 6
+#define ADDONSMENUITEM_SUBMENU_LEN 7
+#define ADDONSMENUITEM_CONTEXT_LEN 7
+#define ADDONSMENUITEM_IMAGEIDENTIFIER_LEN 15
+
+#define ADDONSMENUITEM_PROPERTYNAME_URL OUString(ADDONSMENUITEM_STRING_URL )
+#define ADDONSMENUITEM_PROPERTYNAME_TITLE OUString(ADDONSMENUITEM_STRING_TITLE )
+#define ADDONSMENUITEM_PROPERTYNAME_TARGET OUString(ADDONSMENUITEM_STRING_TARGET )
+#define ADDONSMENUITEM_PROPERTYNAME_IMAGEIDENTIFIER OUString(ADDONSMENUITEM_STRING_IMAGEIDENTIFIER )
+#define ADDONSMENUITEM_PROPERTYNAME_CONTEXT OUString(ADDONSMENUITEM_STRING_CONTEXT )
+#define ADDONSMENUITEM_PROPERTYNAME_SUBMENU OUString(ADDONSMENUITEM_STRING_SUBMENU )
+#define ADDONSMENUITEM_PROPERTYNAME_CONTROLTYPE OUString(ADDONSMENUITEM_STRING_CONTROLTYPE )
+#define ADDONSMENUITEM_PROPERTYNAME_WIDTH OUString(ADDONSMENUITEM_STRING_WIDTH )
+
+#define ADDONSPOPUPMENU_URL_PREFIX_STR "private:menu/Addon"
+
+#define ADDONSPOPUPMENU_URL_PREFIX OUString( ADDONSPOPUPMENU_URL_PREFIX_STR )
+
+namespace framework
+{
+
+typedef ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > MergeMenuDefinition;
+
+struct FWE_DLLPUBLIC MergeMenuInstruction
+{
+ OUString aMergePoint;
+ OUString aMergeCommand;
+ OUString aMergeCommandParameter;
+ OUString aMergeFallback;
+ OUString aMergeContext;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > aMergeMenu;
+};
+typedef ::std::vector< MergeMenuInstruction > MergeMenuInstructionContainer;
+
+struct FWE_DLLPUBLIC MergeToolbarInstruction
+{
+ OUString aMergeToolbar;
+ OUString aMergePoint;
+ OUString aMergeCommand;
+ OUString aMergeCommandParameter;
+ OUString aMergeFallback;
+ OUString aMergeContext;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > aMergeToolbarItems;
+};
+
+typedef ::std::vector< MergeToolbarInstruction > MergeToolbarInstructionContainer;
+
+//_________________________________________________________________________________________________________________
+// forward declarations
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @short forward declaration to our private date container implementation
+ @descr We use these class as internal member to support small memory requirements.
+ You can create the container if it is neccessary. The class which use these mechanism
+ is faster and smaller then a complete implementation!
+*//*-*************************************************************************************************************/
+
+class AddonsOptions_Impl;
+
+/*-************************************************************************************************************//**
+ @short collect information about menu features
+ @descr -
+
+ @implements -
+ @base -
+
+ @devstatus ready to use
+*//*-*************************************************************************************************************/
+
+class FWE_DLLPUBLIC AddonsOptions
+{
+ //-------------------------------------------------------------------------------------------------------------
+ // public methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ public:
+ //---------------------------------------------------------------------------------------------------------
+ // constructor / destructor
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short standard constructor and destructor
+ @descr This will initialize an instance with default values.
+ We implement these class with a refcount mechanism! Every instance of this class increase it
+ at create and decrease it at delete time - but all instances use the same data container!
+ He is implemented as a static member ...
+
+ @seealso member m_nRefCount
+ @seealso member m_pDataContainer
+
+ @param -
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ AddonsOptions();
+ ~AddonsOptions();
+
+ //---------------------------------------------------------------------------------------------------------
+ // interface
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short clears completely the addons menu
+ @descr Call this methods to clear the addons menu
+ To fill it again use AppendItem().
+
+ @seealso -
+
+ @param "eMenu" select right menu to clear.
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ void Clear();
+
+ /*-****************************************************************************************************//**
+ @short returns if an addons menu is available
+ @descr Call to retrieve if a addons menu is available
+
+
+ @return sal_True if there is a menu otherwise sal_False
+ *//*-*****************************************************************************************************/
+
+ sal_Bool HasAddonsMenu() const;
+
+ /*-****************************************************************************************************//**
+ @short returns number of addons toolbars
+ @descr Call to retrieve the number of addons toolbars
+
+
+ @return number of addons toolbars
+ *//*-*****************************************************************************************************/
+ sal_Int32 GetAddonsToolBarCount() const ;
+
+ /*-****************************************************************************************************//**
+ @short returns the complete addons menu
+ @descr Call it to get all entries of the addon menu.
+ We return a list of all nodes with his names and properties.
+
+ @seealso -
+
+ @return A list of menu items is returned.
+
+ @onerror We return an empty list.
+ *//*-*****************************************************************************************************/
+
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& GetAddonsMenu() const;
+
+ /*-****************************************************************************************************//**
+ @short Gets the menu bar part of all addon components registered
+ @descr -
+
+ @seealso -
+
+ @return A complete
+
+ @onerror We return sal_False
+ *//*-*****************************************************************************************************/
+
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& GetAddonsMenuBarPart() const;
+
+ /*-****************************************************************************************************//**
+ @short Gets a toolbar part of an single addon
+ @descr -
+
+ @seealso -
+
+ @return A complete
+
+ @onerror We return sal_False
+ *//*-*****************************************************************************************************/
+
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& GetAddonsToolBarPart( sal_uInt32 nIndex ) const;
+
+ /*-****************************************************************************************************//**
+ @short Gets a unique toolbar resource name of an single addon
+ @descr -
+
+ @seealso -
+
+ @return A complete
+
+ @onerror We return sal_False
+ *//*-*****************************************************************************************************/
+
+ const OUString GetAddonsToolbarResourceName( sal_uInt32 nIndex ) const;
+
+ /*-****************************************************************************************************//**
+ @short Retrieves all available merge instructions for the Office menu bar
+ @descr -
+
+ @seealso -
+
+ @return The filled MergeMenuDefinitionContaier
+
+ @onerror We return sal_False
+ *//*-*****************************************************************************************************/
+
+ const MergeMenuInstructionContainer& GetMergeMenuInstructions() const;
+
+ /*-****************************************************************************************************//**
+ @short Retrieves all available merge instructions for a single toolbar
+ @descr -
+
+ @seealso -
+
+ @return The filled
+
+ @onerror We return sal_False
+ *//*-*****************************************************************************************************/
+ bool GetMergeToolbarInstructions( const OUString& rToolbarName, MergeToolbarInstructionContainer& rToolbar ) const;
+
+ /*-****************************************************************************************************//**
+ @short Gets the Add-On help menu part of all addon components registered
+ @descr -
+
+ @seealso -
+
+ @return A complete
+
+ @onerror We return sal_False
+ *//*-*****************************************************************************************************/
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& GetAddonsHelpMenu() const;
+
+ /*-****************************************************************************************************//**
+ @short Retrieve an image for a command URL which is defined inside the addon menu configuration
+ @descr Call it to retrieve an image for a command URL which is defined inside the addon menu configuration
+
+ @seealso -
+
+ @return An image which was defined in the configuration for the menu item. The image can be empty
+ no bitmap was defined for the request image properties.
+
+ @onerror An empty image
+ *//*-*****************************************************************************************************/
+
+ Image GetImageFromURL( const OUString& aURL, sal_Bool bBig, sal_Bool bNoScale ) const;
+ Image GetImageFromURL( const OUString& aURL, sal_Bool bBig ) const;
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short return a reference to a static mutex
+ @descr These class is partially threadsafe (for de-/initialization only).
+ All access methods are'nt safe!
+ We create a static mutex only for one ime and use at different times.
+
+ @seealso -
+
+ @param -
+ @return A reference to a static mutex member.
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ static ::osl::Mutex& GetOwnStaticMutex();
+
+ /*-****************************************************************************************************//**
+ @short return a reference to a static mutex
+ @descr These class is partially threadsafe (for de-/initialization only).
+ All access methods are'nt safe!
+ We create a static mutex only for one ime and use at different times.
+
+ @seealso -
+
+ @param -
+ @return A reference to a static mutex member.
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+ DECL_STATIC_LINK( AddonsOptions, Notify, void* );
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private member
+ //-------------------------------------------------------------------------------------------------------------
+
+ private:
+
+ /*Attention
+
+ Don't initialize these static member in these header!
+ a) Double dfined symbols will be detected ...
+ b) and unresolved externals exist at linking time.
+ Do it in your source only.
+ */
+
+ static AddonsOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements!
+ static sal_Int32 m_nRefCount ; /// internal ref count mechanism
+
+}; // class SvtMenuOptions
+
+}
+
+#endif // #ifndef __FRAMEWORK_CLASSES_ADDONSOPTIONS_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/bmkmenu.hxx b/include/framework/bmkmenu.hxx
new file mode 100644
index 000000000000..d78eefeced24
--- /dev/null
+++ b/include/framework/bmkmenu.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef __FRAMEWORK_CLASSES_BMKMENU_HXX
+#define __FRAMEWORK_CLASSES_BMKMENU_HXX
+
+#include "framework/addonmenu.hxx"
+
+#include <com/sun/star/frame/XFrame.hpp>
+#include <framework/fwedllapi.h>
+
+#include <vcl/menu.hxx>
+#include <vcl/image.hxx>
+
+class String;
+class ImageList;
+
+#define BMKMENU_ITEMID_START 20000
+
+namespace framework
+{
+
+class BmkMenu_Impl;
+class FWE_DLLPUBLIC BmkMenu : public AddonMenu
+{
+ public:
+ enum BmkMenuType
+ {
+ BMK_NEWMENU,
+ BMK_WIZARDMENU
+ };
+
+ BmkMenu( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ BmkMenuType nType
+ );
+
+ ~BmkMenu();
+
+ void Initialize(); // Synchrones Laden der Eintraege
+
+ protected:
+ BmkMenu::BmkMenuType m_nType;
+ sal_uInt16 CreateMenuId();
+
+ private:
+
+ BmkMenu_Impl* _pImp;
+};
+
+} // namespace framework
+
+#endif // #ifndef __FRAMEWORK_CLASSES_BMKMENU_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/configimporter.hxx b/include/framework/configimporter.hxx
new file mode 100644
index 000000000000..06b6467f6c2a
--- /dev/null
+++ b/include/framework/configimporter.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __FRAMEWORK_HELPER_CONFIGIMPORTER_HXX_
+#define __FRAMEWORK_HELPER_CONFIGIMPORTER_HXX_
+
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/embed/XStorage.hpp>
+#include <com/sun/star/ui/XUIConfigurationManager2.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <rtl/ustring.hxx>
+#include <framework/fwedllapi.h>
+
+namespace framework
+{
+ class FWE_DLLPUBLIC UIConfigurationImporterOOo1x
+ {
+ public:
+ static sal_Bool ImportCustomToolbars(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager2 >& rContainerFactory,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > >& rSeqContainer,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& rToolbarStorage );
+ };
+
+} // namespace framework
+
+#endif // __FRAMEWORK_HELPER_CONFIGIMPORTER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/documentundoguard.hxx b/include/framework/documentundoguard.hxx
new file mode 100644
index 000000000000..1954a72b5c67
--- /dev/null
+++ b/include/framework/documentundoguard.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef FRAMEWORK_DOCUMENTUNDOGUARD_HXX
+#define FRAMEWORK_DOCUMENTUNDOGUARD_HXX
+
+#include "framework/fwedllapi.h"
+
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <boost/scoped_ptr.hpp>
+
+//......................................................................................................................
+namespace framework
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= DocumentUndoGuard
+ //==================================================================================================================
+ struct DocumentUndoGuard_Data;
+ /** a helper class guarding the Undo manager of a document
+
+ This class guards, within a given scope, the Undo Manager of a document (or another component supporting
+ the XUndoManagerSupplier interface). When entering the scope (i.e. when the <code>DocumentUndoGuard</code>
+ instances is constructed), the current state of the undo contexts of the undo manager is examined.
+ Upon leaving the scope (i.e. when the <code>DocumentUndoGuard</code> is destructed), the guard will execute
+ as many calls to <member scope="com::sun::star::document">XUndoManager::leaveUndoContext</member> as are
+ necessary to restore the manager's initial state.
+ */
+ class FWE_DLLPUBLIC DocumentUndoGuard
+ {
+ public:
+ DocumentUndoGuard( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& i_undoSupplierComponent );
+ ~DocumentUndoGuard();
+
+ private:
+ ::boost::scoped_ptr< DocumentUndoGuard_Data > m_pData;
+ };
+
+//......................................................................................................................
+} // namespace framework
+//......................................................................................................................
+
+#endif // FRAMEWORK_DOCUMENTUNDOGUARD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/eventsconfiguration.hxx b/include/framework/eventsconfiguration.hxx
new file mode 100644
index 000000000000..29694b7fb539
--- /dev/null
+++ b/include/framework/eventsconfiguration.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __FRAMEWORK_XML_EVENTSCONFIGURATION_HXX_
+#define __FRAMEWORK_XML_EVENTSCONFIGURATION_HXX_
+
+#include <framework/fwedllapi.h>
+#include <tools/stream.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+namespace framework
+{
+
+struct FWE_DLLPUBLIC EventsConfig
+{
+ ::com::sun::star::uno::Sequence< OUString > aEventNames;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aEventsProperties;
+};
+
+} // namespace framework
+
+#endif // __FRAMEWORK_XML_EVENTSCONFIGURATION_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/framelistanalyzer.hxx b/include/framework/framelistanalyzer.hxx
new file mode 100644
index 000000000000..951474c3934d
--- /dev/null
+++ b/include/framework/framelistanalyzer.hxx
@@ -0,0 +1,195 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __FRAMEWORK_CLASSES_FRAMELISTANALYZER_HXX_
+#define __FRAMEWORK_CLASSES_FRAMELISTANALYZER_HXX_
+
+#include <com/sun/star/frame/XFrame.hpp>
+
+#include <framework/fwedllapi.h>
+
+namespace framework{
+
+/** analyze and split the current available frame list of a given frames supplier
+ into different parts.
+
+ These analyzed information can be used e.g. to decide if it's neccessary
+ to switch into the backing mode, close the current active frame only or
+ exit the whole application explicitly or implicitly.
+ */
+class FWE_DLLPUBLIC FrameListAnalyzer
+{
+ //_______________________________________
+ // types
+
+ public:
+
+ /** These enums can be combined as flags to enable/disable
+ special search algorithm during analyze phase.
+ see impl_analyze() for further information.
+ But note: To be useable as flags, these enums
+ must be values of range [2^n]! */
+ enum EDetect
+ {
+ E_MODEL = 1,
+ E_HELP = 2,
+ E_BACKINGCOMPONENT = 4,
+ E_HIDDEN = 8,
+ E_ALL = 15,
+ E_ZOMBIE = 32768 // use it for special test scenarios only!!!
+ };
+
+ //_______________________________________
+ // member
+
+ public:
+
+ /** provides access to the frame container, which should be analyzed. */
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFramesSupplier >& m_xSupplier;
+
+ /** hold the reference frame, which is used e.g. to detect other frames with the same model. */
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& m_xReferenceFrame;
+
+ /** enable/disable some special analyzing steps.
+ see impl_analyze() for further information. */
+ sal_uInt32 m_eDetectMode;
+
+ /** contains all frames, which uses the same model like the reference frame.
+ Will be filled only if m_eDetectMode has set the flag E_MODEL.
+ The reference frame is never part of this list! */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > > m_lModelFrames;
+
+ /** contains all frames, which does not contain the same model like the reference frame.
+ Filling of it can't be supressed by m_eDetectMode.
+ The reference frame is never part of this list!
+ All frames inside this list are visible ones. */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > > m_lOtherVisibleFrames;
+
+ /** contains all frames, which does not contain the same model like the reference frame.
+ Filling of it can't be supressed by m_eDetectMode.
+ The reference frame is never part of this list!
+ All frames inside this list are hidden ones. */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > > m_lOtherHiddenFrames;
+
+ /** points to the help frame.
+ Will be set only, if any other frame (means different from the reference frame)
+ contains the help component. If the reference frame itself includes the help module
+ it's not set ... but another member m_bIsHelp is used to safe this information.
+ See following example code:
+
+ <listing>
+ if (m_xReferenceFrame == help)
+ {
+ m_xHelp = NULL;
+ m_bIsHelp = sal_True;
+ }
+ else
+ if (xOtherFrame == help)
+ {
+ m_xHelp = xOtherFrame;
+ m_bIsHelp = sal_False;
+ }
+ </listing>
+
+ Analyzing of the help frame ignores the visible state of any frame.
+ But note: a hidden help frame indicates a wrong state!
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xHelp;
+
+ /** points to the frame, which contains the backing component.
+ Will be set only, if any other frame (means different from the reference frame)
+ contains the backing component. If the reference frame itself includes the
+ backing component it's not set ... but another member m_bIsBackingComponent
+ will used to safe this information.
+ See following example code:
+
+ <listing>
+ if (m_xReferenceFrame == backing)
+ {
+ m_xBackingComponent = NULL;
+ m_bIsBackingComponent = sal_True;
+ }
+ else
+ if (xOtherFrame == backing)
+ {
+ m_xBackingComponent = xOtherFrame;
+ m_bIsBackingComponent = sal_False ;
+ }
+ </listing>
+
+ Analyzing of the help frame ignores the visible state of any frame.
+ But note: a hidden backing mode frame indicates a wrong state!
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xBackingComponent;
+
+ /** is set to true only, if the reference frame is a hidden one.
+ This value is undefined if m_eDetectMode doesn't have set the flag E_HIDDEN! */
+ sal_Bool m_bReferenceIsHidden;
+
+ /** is set to true only, if the reference frame contains the help component.
+ In this case the member m_xHelp is set to NULL everytimes.
+ This value is undefined if m_eDetectMode doesn't have set the flag E_HELP! */
+ sal_Bool m_bReferenceIsHelp;
+
+ /** is set to true only, if the reference frame contains the backing component.
+ In this case the member m_xBackingComponent is set to NULL everytimes.
+ This value is undefined if m_eDetectMode doesn't have set the flag E_BACKINGCOMPONENT! */
+ sal_Bool m_bReferenceIsBacking;
+
+ //_______________________________________
+ // interface
+
+ public:
+
+ /** starts analyze phase and fille all members with valid information.
+
+ @param xSupplier
+ Must be a valid reference to a frames supplier, which provies
+ access to the frame list for analyzing.
+
+ @param xReferenceFrame
+ This frame must(!) exist inside the analyzed frame list and
+ is used for some comparing functions. Further some member states
+ depends from the current state of this frame.
+
+ @param eDetectMode
+ It represent a flag field, which can enable/disable special
+ analyze steps. Note: Some member values will be undefined, if
+ an analyze step will be disabled.
+ */
+ FrameListAnalyzer( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFramesSupplier >& xSupplier ,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xReferenceFrame ,
+ sal_uInt32 eDetectMode );
+ virtual ~FrameListAnalyzer();
+
+ //_______________________________________
+ // helper
+
+ private:
+
+ void impl_analyze();
+
+
+}; // class FrameListAnalyzer
+
+} // namespace framework
+
+#endif // #ifndef __FRAMEWORK_CLASSES_FRAMELISTANALYZER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/fwedllapi.h b/include/framework/fwedllapi.h
new file mode 100644
index 000000000000..14201508768a
--- /dev/null
+++ b/include/framework/fwedllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FWEDLLAPI_H
+#define INCLUDED_FWEDLLAPI_H
+
+#include "sal/types.h"
+
+#if defined(FWE_DLLIMPLEMENTATION)
+#define FWE_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define FWE_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define FWE_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif /* INCLUDED_FWEDLLAPI_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/iguard.hxx b/include/framework/iguard.hxx
new file mode 100644
index 000000000000..a522d6225e43
--- /dev/null
+++ b/include/framework/iguard.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __FRAMEWORK_THREADHELP_IGUARD_H_
+#define __FRAMEWORK_THREADHELP_IGUARD_H_
+
+#include <sal/types.h>
+
+namespace framework{
+
+/*-************************************************************************************************************//**
+ @descr interface for guarding a lock
+*//*-*************************************************************************************************************/
+class SAL_NO_VTABLE IGuard
+{
+ //-------------------------------------------------------------------------------------------------------------
+ // public methods
+ //-------------------------------------------------------------------------------------------------------------
+ public:
+
+ /** clears the lock. If the guard does not currently hold the lock, nothing happens.
+ */
+ virtual void clear() = 0;
+
+ /** attempts to re-establishes the lock, blocking until the attempt is successful.
+ */
+ virtual void reset() = 0;
+
+ protected:
+ ~IGuard() {}
+
+}; // class IGuard
+
+} // namespace framework
+
+#endif // #ifndef __FRAMEWORK_THREADHELP_IGUARD_H_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/imageproducer.hxx b/include/framework/imageproducer.hxx
new file mode 100644
index 000000000000..0d9398f7b2a3
--- /dev/null
+++ b/include/framework/imageproducer.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __FRAMEWORK_HELPER_IMAGEPRODUCER_HXX_
+#define __FRAMEWORK_HELPER_IMAGEPRODUCER_HXX_
+
+#include <sal/types.h>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <vcl/image.hxx>
+#include <rtl/ustring.hxx>
+#include <framework/fwedllapi.h>
+
+namespace framework
+{
+
+typedef Image ( *pfunc_getImage)(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ const OUString& aURL,
+ bool bBig
+);
+
+pfunc_getImage FWE_DLLPUBLIC SAL_CALL SetImageProducer( pfunc_getImage pGetImageFunc );
+
+Image FWE_DLLPUBLIC SAL_CALL GetImageFromURL(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ const OUString& aURL,
+ bool bBig
+);
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/imutex.hxx b/include/framework/imutex.hxx
new file mode 100644
index 000000000000..f576297e0d14
--- /dev/null
+++ b/include/framework/imutex.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __FRAMEWORK_THREADHELP_IMUTEX_H_
+#define __FRAMEWORK_THREADHELP_IMUTEX_H_
+
+#include <sal/types.h>
+
+namespace framework{
+
+/*-************************************************************************************************************//**
+ @descr We need this interface to support using of different mutex implementations in a generic way.
+*//*-*************************************************************************************************************/
+class SAL_NO_VTABLE IMutex
+{
+ //-------------------------------------------------------------------------------------------------------------
+ // public methods
+ //-------------------------------------------------------------------------------------------------------------
+ public:
+
+ /*-****************************************************************************************************//**
+ @descr These functions must be supported by a derived class!
+ acquire() -try to register thread
+ release() -unregister thread
+ *//*-*****************************************************************************************************/
+ virtual void acquire() = 0;
+ virtual void release() = 0;
+
+ protected:
+ ~IMutex() {}
+}; // class IMutex
+
+} // namespace framework
+
+#endif // #ifndef __FRAMEWORK_THREADHELP_IMUTEX_H_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/interaction.hxx b/include/framework/interaction.hxx
new file mode 100644
index 000000000000..1cd56bbd36d9
--- /dev/null
+++ b/include/framework/interaction.hxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __FRAMEWORK_DISPATCH_INTERACTION_HXX_
+#define __FRAMEWORK_DISPATCH_INTERACTION_HXX_
+
+#include <com/sun/star/task/XInteractionRequest.hpp>
+#include <com/sun/star/task/XInteractionContinuation.hpp>
+#include <com/sun/star/task/XInteractionAbort.hpp>
+#include <com/sun/star/task/XInteractionApprove.hpp>
+#include <com/sun/star/task/XInteractionDisapprove.hpp>
+#include <com/sun/star/task/XInteractionRetry.hpp>
+#include <com/sun/star/document/XInteractionFilterSelect.hpp>
+#include <com/sun/star/document/NoSuchFilterRequest.hpp>
+#include <com/sun/star/document/AmbigousFilterRequest.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
+
+#include <rtl/ustring.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <framework/fwedllapi.h>
+
+namespace framework{
+
+/*-************************************************************************************************************//**
+ @short special request for interaction to ask user for right filter
+ @descr These helper can be used to ask user for right filter, if filter detection failed.
+ It capsulate communication with any interaction handler and supports an easy
+ access on interaction results for user of these class.
+ Use it and forget complex mechanism of interaction ...
+
+ @example RequestFilterSelect* pRequest = new RequestFilterSelect;
+ Reference< XInteractionRequest > xRequest ( pRequest );
+ xInteractionHandler->handle( xRequest );
+ if( ! pRequest.isAbort() )
+ {
+ OUString sFilter = pRequest->getFilter();
+ }
+
+ @implements XInteractionRequest
+
+ @base WeakImplHelper1
+
+ @devstatus ready to use
+ @threadsafe no (used on once position only!)
+*//*-*************************************************************************************************************/
+class RequestFilterSelect_Impl;
+class FWE_DLLPUBLIC RequestFilterSelect
+{
+ RequestFilterSelect_Impl* pImp;
+
+ public:
+ RequestFilterSelect( const OUString& sURL );
+ ~RequestFilterSelect();
+ sal_Bool isAbort () const;
+ OUString getFilter() const;
+ com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest > GetRequest();
+};
+
+/*-************************************************************************************************************//**
+ @short special request for interaction
+ @descr User must decide between a preselected and another detected filter.
+ It capsulate communication with any interaction handler and supports an easy
+ access on interaction results for user of these class.
+
+ @implements XInteractionRequest
+
+ @base WeakImplHelper1
+
+ @devstatus ready to use
+ @threadsafe no (used on once position only!)
+*//*-*************************************************************************************************************/
+class FWE_DLLPUBLIC InteractionRequest
+{
+public:
+ static com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest >
+ CreateRequest( const ::com::sun::star::uno::Any& aRequest,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > lContinuations );
+};
+
+
+} // namespace framework
+
+#endif // #define __FRAMEWORK_DISPATCH_INTERACTION_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/menuconfiguration.hxx b/include/framework/menuconfiguration.hxx
new file mode 100644
index 000000000000..1ccd6ba0d167
--- /dev/null
+++ b/include/framework/menuconfiguration.hxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __FRAMEWORK_XML_MENUCONFIGURATION_HXX_
+#define __FRAMEWORK_XML_MENUCONFIGURATION_HXX_
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/WrappedTargetException.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <framework/fwedllapi.h>
+
+#include <cppuhelper/weak.hxx>
+#include <vcl/menu.hxx>
+#include <vcl/toolbox.hxx>
+
+#define BOOKMARK_NEWMENU OUString( "private:menu_bookmark_new" )
+#define BOOKMARK_WIZARDMENU OUString( "private:menu_bookmark_wizard" )
+
+// Prepare for inclusion by framework and sfx
+// Please consider that there is a corresponding define also in sfxsids.hrc!! (SID_SFX_START)/(SID_ADDONS)
+#define FWK_SID_SFX_START 5000
+#define FWK_SID_ADDONS (FWK_SID_SFX_START+1678)
+#define FWK_SID_ADDONHELP (FWK_SID_SFX_START+1684)
+
+const sal_uInt16 START_ITEMID_PICKLIST = 4500;
+const sal_uInt16 END_ITEMID_PICKLIST = 4599;
+const sal_uInt16 MAX_ITEMCOUNT_PICKLIST = 99; // difference between START_... & END_... for picklist / must be changed too, if these values are changed!
+const sal_uInt16 START_ITEMID_WINDOWLIST = 4600;
+const sal_uInt16 END_ITEMID_WINDOWLIST = 4699;
+const sal_uInt16 ITEMID_ADDONLIST = FWK_SID_ADDONS;
+const sal_uInt16 ITEMID_ADDONHELP = FWK_SID_ADDONHELP;
+
+namespace framework
+{
+
+class FWE_DLLPUBLIC MenuConfiguration
+{
+ public:
+ struct Attributes
+ {
+ Attributes() {}
+ Attributes( const OUString& aFrame, const OUString& aImageIdStr ) :
+ aTargetFrame( aFrame ), aImageId( aImageIdStr ) {}
+
+ OUString aTargetFrame;
+ OUString aImageId;
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XDispatchProvider > xDispatchProvider;
+ sal_Int16 nStyle;
+ };
+
+ MenuConfiguration(
+ // use const when giving a uno reference by reference
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
+
+ virtual ~MenuConfiguration();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > CreateMenuBarConfigurationFromXML(
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rInputStream )
+ throw ( ::com::sun::star::lang::WrappedTargetException );
+
+ PopupMenu* CreateBookmarkMenu(
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ const OUString& aURL )
+ throw ( ::com::sun::star::lang::WrappedTargetException );
+
+ ToolBox* CreateToolBoxFromConfiguration(
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rInputStream )
+ throw ( ::com::sun::star::lang::WrappedTargetException );
+
+ void StoreMenuBarConfigurationToXML( ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rMenuBarConfiguration,
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOutputStream )
+ throw ( ::com::sun::star::lang::WrappedTargetException );
+
+ void StoreToolBox( ToolBox* pToolBox,
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOutputStream )
+ throw ( ::com::sun::star::lang::WrappedTargetException );
+
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> m_xContext;
+};
+
+}
+
+#endif // __FRAMEWORK_XML_MENUCONFIGURATION_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/menuextensionsupplier.hxx b/include/framework/menuextensionsupplier.hxx
new file mode 100644
index 000000000000..6d3a6761e38e
--- /dev/null
+++ b/include/framework/menuextensionsupplier.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __FRAMEWORK_CLASSES_MENUEXTENSIONSUPPLIER_HXX_
+#define __FRAMEWORK_CLASSES_MENUEXTENSIONSUPPLIER_HXX_
+
+#include <rtl/ustring.hxx>
+#include <framework/fwedllapi.h>
+
+struct FWE_DLLPUBLIC MenuExtensionItem
+{
+ OUString aLabel;
+ OUString aURL;
+};
+
+typedef MenuExtensionItem ( *pfunc_setMenuExtensionSupplier)();
+
+namespace framework
+{
+
+FWE_DLLPUBLIC MenuExtensionItem SAL_CALL GetMenuExtension();
+
+}
+
+#endif // __FRAMEWORK_CLASSES_MENUEXTENSIONSUPPLIER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/preventduplicateinteraction.hxx b/include/framework/preventduplicateinteraction.hxx
new file mode 100644
index 000000000000..5be9d52f62cf
--- /dev/null
+++ b/include/framework/preventduplicateinteraction.hxx
@@ -0,0 +1,236 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __FRAMEWORK_INTERACTION_PREVENTDUPLICATEINTERACTION_HXX_
+#define __FRAMEWORK_INTERACTION_PREVENTDUPLICATEINTERACTION_HXX_
+
+#include <framework/fwedllapi.h>
+
+#include <vector>
+
+#include <com/sun/star/task/XInteractionHandler2.hpp>
+#include <com/sun/star/task/XInteractionRequest.hpp>
+
+#include <cppuhelper/implbase1.hxx>
+
+namespace framework{
+
+/**
+ @short Prevent us from showing the same interaction more then once during
+ the same transaction.
+
+ @descr Every interaction provided to this helper will be safed ... handled by the internal
+ used UUIInteractionHandler (!) and never be handled a second time!
+
+ On the other side there exists some interactions, which allow a retry.
+ So this helper allow to set a list of interactions combined with a retry value.
+ */
+struct ThreadHelpBase2
+{
+ public:
+ mutable ::osl::Mutex m_aLock;
+};
+
+class FWE_DLLPUBLIC PreventDuplicateInteraction : private ThreadHelpBase2
+ ,public ::cppu::WeakImplHelper1< css::task::XInteractionHandler2 >
+{
+ //_____________________________________
+ // structs, types etcp.
+ public:
+
+ struct InteractionInfo
+ {
+ public:
+ /// describe the interaction.
+ css::uno::Type m_aInteraction;
+ /// after max count was reached this interaction will be blocked.
+ sal_Int32 m_nMaxCount;
+ /// count how often this interaction was called.
+ sal_Int32 m_nCallCount;
+ /** hold the last intercepted request (matching the set interaction type) alive
+ so it can be used for further checks */
+ css::uno::Reference< css::task::XInteractionRequest > m_xRequest;
+
+ public:
+
+ InteractionInfo(const css::uno::Type& aInteraction,
+ sal_Int32 nMaxCount )
+ : m_aInteraction(aInteraction)
+ , m_nMaxCount (nMaxCount )
+ , m_nCallCount (0 )
+ {}
+
+ InteractionInfo(const InteractionInfo& aCopy)
+ : m_aInteraction(aCopy.m_aInteraction)
+ , m_nMaxCount (aCopy.m_nMaxCount )
+ , m_nCallCount (aCopy.m_nCallCount )
+ , m_xRequest (aCopy.m_xRequest )
+ {}
+ };
+
+ typedef ::std::vector< InteractionInfo > InteractionList;
+
+ //_____________________________________
+ // member
+ private:
+
+ /// Used to create needed uno services at runtime.
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+
+ /** The outside interaction handler, which is used to handle every incoming interaction,
+ if it's not blocked. */
+ css::uno::Reference< css::task::XInteractionHandler > m_xHandler;
+
+ /** This list describe which and how incoming interactions must be handled.
+ Further it contains all collected information after this interaction
+ object was used.*/
+ InteractionList m_lInteractionRules;
+
+ //_____________________________________
+ // uno interface
+ public:
+
+ //_________________________________
+ /**
+ @interface XInteractionHandler
+ @short called from outside to handle a problem
+ @descr We filter the incoming interactions. some of them
+ will be forwarded to the generic UI interaction handler.
+ So we must not implement it twice. Some other ones
+ will be aborted only.
+
+ @threadsafe yes
+ */
+ virtual void SAL_CALL handle(const css::uno::Reference< css::task::XInteractionRequest >& xRequest)
+ throw(css::uno::RuntimeException);
+
+ //_________________________________
+ /**
+ @interface XInteractionHandler2
+ @short called from outside to handle a problem
+ @descr We filter the incoming interactions. some of them
+ will be forwarded to the generic UI interaction handler.
+ So we must not implement it twice. Some other ones
+ will be aborted only.
+
+ @threadsafe yes
+ */
+ virtual ::sal_Bool SAL_CALL handleInteractionRequest( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& xRequest )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //_________________________________
+ /**
+ @interface XInterface
+ @short called to query another interface of the component
+ @descr Will allow to query for XInteractionHandler2 if and only if m_xHandler supports this interface, too.
+
+ @threadsafe yes
+ */
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType )
+ throw (::com::sun::star::uno::RuntimeException);
+ //_____________________________________
+ // c++ interface
+ public:
+
+ //_________________________________
+ /**
+ @short ctor to guarantee right initialized instances of this class
+ @descr It uses the given uno service manager to create the global
+ generic UI interaction handler for later internal using.
+
+ @param xSMGR
+ uno service manager for creating services internaly
+
+ @threadsafe not neccessary
+ */
+ PreventDuplicateInteraction(const css::uno::Reference< css::uno::XComponentContext >& rxContext);
+
+ //_________________________________
+ /**
+ @short dtor to free used memory.
+ */
+ virtual ~PreventDuplicateInteraction();
+
+ //_________________________________
+ /**
+ @short set the outside interaction handler, which must be used internaly
+ if the interaction will not be blocked by the set list of rules.
+
+ @note This overwrites the settings of e.g. useDefaultUUIHandler()!
+
+ @param xHandler
+ the new interaction handler
+ */
+ virtual void setHandler(const css::uno::Reference< css::task::XInteractionHandler >& xHandler);
+
+ //_________________________________
+ /**
+ @short instead of setting an outside interaction handler, this method
+ make sure the default UUI interaction handler of the office is used.
+
+ @note This overwrites the settings of e.g. setHandler()!
+ */
+ virtual void useDefaultUUIHandler();
+
+ //_________________________________
+ /**
+ @short add a new interaction to the list of interactions, which
+ must be handled by this helper.
+
+ @descr This method must be called immediately after a new instance of this helper was
+ created. Without such list of InteractionRules, this instances does nothing!
+ On the other side there is no possibility to remove rules.
+ So the same instance cant be used within different transactions.
+ It's a OneWay-object .-)
+
+ @param aInteractionInfo
+ describe the type of interaction, hos often it can be called etcpp.
+
+ @threadsafe yes
+ */
+ virtual void addInteractionRule(const PreventDuplicateInteraction::InteractionInfo& aInteractionInfo);
+
+ //_________________________________
+ /**
+ @short return the info struct for the specified interaction.
+
+ @param aInteraction
+ specify the interaction.
+
+ @param pReturn
+ provides information about:
+ - the count how often this interaction was handled during the
+ lifetime of this helper.
+ - the interaction itself, so it can be analyzed further
+
+ @return [boolean]
+ sal_True if the queried interaction could be found.
+ sal_False otherwise.
+
+ @threadsafe yes
+ */
+ virtual sal_Bool getInteractionInfo(const css::uno::Type& aInteraction,
+ PreventDuplicateInteraction::InteractionInfo* pReturn ) const;
+};
+
+} // namespace framework
+
+#endif // #ifndef __FRAMEWORK_INTERACTION_PREVENTDUPLICATEINTERACTION_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/sfxhelperfunctions.hxx b/include/framework/sfxhelperfunctions.hxx
new file mode 100644
index 000000000000..ce2b604f5e5e
--- /dev/null
+++ b/include/framework/sfxhelperfunctions.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __FRAMEWORK_CLASSES_SFXHELPERFUNCTIONS_HXX_
+#define __FRAMEWORK_CLASSES_SFXHELPERFUNCTIONS_HXX_
+
+#include <framework/fwedllapi.h>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <rtl/ustring.hxx>
+#include <vcl/toolbox.hxx>
+#include <vcl/status.hxx>
+#include <svtools/toolboxcontroller.hxx>
+#include <svtools/statusbarcontroller.hxx>
+
+typedef svt::ToolboxController* ( *pfunc_setToolBoxControllerCreator)(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ ToolBox* pToolbox,
+ unsigned short nID,
+ const OUString& aCommandURL );
+
+typedef svt::StatusbarController* ( *pfunc_setStatusBarControllerCreator)(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ StatusBar* pStatusBar,
+ unsigned short nID,
+ const OUString& aCommandURL );
+
+typedef void ( *pfunc_getRefreshToolbars)(
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
+
+typedef void ( *pfunc_createDockingWindow)(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ const OUString& rResourceURL );
+
+typedef bool ( *pfunc_isDockingWindowVisible)(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ const OUString& rResourceURL );
+
+typedef void ( *pfunc_activateToolPanel)(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame,
+ const OUString& i_rPanelURL );
+
+
+namespace framework
+{
+FWE_DLLPUBLIC pfunc_setToolBoxControllerCreator SAL_CALL SetToolBoxControllerCreator( pfunc_setToolBoxControllerCreator pSetToolBoxControllerCreator );
+FWE_DLLPUBLIC svt::ToolboxController* SAL_CALL CreateToolBoxController(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ ToolBox* pToolbox,
+ unsigned short nID,
+ const OUString& aCommandURL );
+
+FWE_DLLPUBLIC pfunc_setStatusBarControllerCreator SAL_CALL SetStatusBarControllerCreator( pfunc_setStatusBarControllerCreator pSetStatusBarControllerCreator );
+FWE_DLLPUBLIC svt::StatusbarController* SAL_CALL CreateStatusBarController(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ StatusBar* pStatusBar,
+ unsigned short nID,
+ const OUString& aCommandURL );
+
+FWE_DLLPUBLIC pfunc_getRefreshToolbars SAL_CALL SetRefreshToolbars( pfunc_getRefreshToolbars pRefreshToolbarsFunc );
+FWE_DLLPUBLIC void SAL_CALL RefreshToolbars(
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
+
+FWE_DLLPUBLIC pfunc_createDockingWindow SAL_CALL SetDockingWindowCreator( pfunc_createDockingWindow pCreateDockingWindow );
+FWE_DLLPUBLIC void SAL_CALL CreateDockingWindow(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ const OUString& rResourceURL );
+
+FWE_DLLPUBLIC pfunc_isDockingWindowVisible SAL_CALL SetIsDockingWindowVisible( pfunc_isDockingWindowVisible pIsDockingWindowVisible );
+FWE_DLLPUBLIC bool SAL_CALL IsDockingWindowVisible(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ const OUString& rResourceURL );
+
+FWE_DLLPUBLIC pfunc_activateToolPanel SAL_CALL SetActivateToolPanel( pfunc_activateToolPanel i_pActivator );
+FWE_DLLPUBLIC void SAL_CALL ActivateToolPanel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame,
+ const OUString& i_rPanelURL );
+}
+
+#endif // __FRAMEWORK_CLASSES_SFXHELPERFUNCTIONS_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/statusbarconfiguration.hxx b/include/framework/statusbarconfiguration.hxx
new file mode 100644
index 000000000000..e71a89fe0ca4
--- /dev/null
+++ b/include/framework/statusbarconfiguration.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef __FRAMEWORK_CLASSES_STATUSBARCONFIGURATION_HXX_
+#define __FRAMEWORK_CLASSES_STATUSBARCONFIGURATION_HXX_
+
+#include <framework/fwedllapi.h>
+#include <tools/stream.hxx>
+#include <vcl/status.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+namespace framework
+{
+
+class FWE_DLLPUBLIC StatusBarConfiguration
+{
+ public:
+ static sal_Bool LoadStatusBar(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInputStream,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& rStatusbarConfiguration );
+
+ static sal_Bool StoreStatusBar(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutputStream,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rStatusbarConfiguration );
+};
+
+} // namespace framework
+
+#endif // __FRAMEWORK_CLASSES_STATUSBARCONFIGURATION_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/titlehelper.hxx b/include/framework/titlehelper.hxx
new file mode 100644
index 000000000000..c4cdc31a6329
--- /dev/null
+++ b/include/framework/titlehelper.hxx
@@ -0,0 +1,206 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _FRAMEWORK_TITLEHELPER_HXX_
+#define _FRAMEWORK_TITLEHELPER_HXX_
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/frame/XUntitledNumbers.hpp>
+#include <com/sun/star/frame/XTitle.hpp>
+#include <com/sun/star/frame/XTitleChangeBroadcaster.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XFrameActionListener.hpp>
+#include <com/sun/star/document/XEventListener.hpp>
+
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <cppuhelper/implbase5.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+
+#include <rtl/ustrbuf.hxx>
+
+#include <boost/unordered_map.hpp>
+#include <framework/fwedllapi.h>
+
+
+namespace framework{
+
+
+/** @short can be used as implementation helper of interface css.frame.XTitle
+
+ @threadsafe
+ */
+class FWE_DLLPUBLIC TitleHelper : private ::cppu::BaseMutex
+ , public ::cppu::WeakImplHelper5< css::frame::XTitle ,
+ css::frame::XTitleChangeBroadcaster,
+ css::frame::XTitleChangeListener ,
+ css::frame::XFrameActionListener ,
+ css::document::XEventListener >
+{
+ //-------------------------------------------
+ // interface
+ public:
+
+ //---------------------------------------
+ /** @short lightweight constructor.
+ */
+ TitleHelper(const css::uno::Reference< css::uno::XComponentContext >& rxContext);
+
+ //---------------------------------------
+ /** @short free all internaly used resources.
+ */
+ virtual ~TitleHelper();
+
+ //---------------------------------------
+ /** set an outside component which uses this container and must be set
+ as source of all broadcasted messages, exceptions.
+
+ It's holded weak only so we do not need any complex dispose sessions.
+
+ Note: Passing NULL as parameter will be alloed. It will reset the internal
+ member reference only.
+
+ @param xOwner
+ the new owner of this collection.
+ */
+ void setOwner (const css::uno::Reference< css::uno::XInterface >& xOwner);
+
+ //---------------------------------------
+ /** set an outside component which provides the righht string and number for
+ an untitled component.
+
+ It's holded weak only so we do not need any complex dispose sessions.
+
+ Note: Passing NULL as parameter will be alloed. It will reset the internal
+ member reference only.
+
+ @param xNumbers
+ the right numbered collection for this helper.
+ */
+ void connectWithUntitledNumbers (const css::uno::Reference< css::frame::XUntitledNumbers >& xNumbers);
+
+ //---------------------------------------
+ /** @see XTitle */
+ virtual OUString SAL_CALL getTitle()
+ throw (css::uno::RuntimeException);
+
+ //---------------------------------------
+ /** @see XTitle */
+ virtual void SAL_CALL setTitle(const OUString& sTitle)
+ throw (css::uno::RuntimeException);
+
+ //---------------------------------------
+ /** @see XTitleChangeBroadcaster */
+ virtual void SAL_CALL addTitleChangeListener(const css::uno::Reference< css::frame::XTitleChangeListener >& xListener)
+ throw (css::uno::RuntimeException);
+
+ //---------------------------------------
+ /** @see XTitleChangeBroadcaster */
+ virtual void SAL_CALL removeTitleChangeListener(const css::uno::Reference< css::frame::XTitleChangeListener >& xListener)
+ throw (css::uno::RuntimeException);
+
+ //---------------------------------------
+ /** @see XTitleChangeListener */
+ virtual void SAL_CALL titleChanged(const css::frame::TitleChangedEvent& aEvent)
+ throw (css::uno::RuntimeException);
+
+ //---------------------------------------
+ /** @see css.document.XEventListener */
+ virtual void SAL_CALL notifyEvent(const css::document::EventObject& aEvent)
+ throw (css::uno::RuntimeException);
+
+ //---------------------------------------
+ /** @see css.lang.XEventListener */
+ virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent)
+ throw (css::uno::RuntimeException);
+
+ //---------------------------------------
+ /** @see css.frame.XFrameActionListener */
+ virtual void SAL_CALL frameAction(const css::frame::FrameActionEvent& aEvent)
+ throw(css::uno::RuntimeException);
+
+ //-------------------------------------------
+ // internal
+ private:
+
+ void impl_sendTitleChangedEvent ();
+
+ void impl_updateTitle (bool init = false);
+ void impl_updateTitleForModel (const css::uno::Reference< css::frame::XModel >& xModel, bool init);
+ void impl_updateTitleForController (const css::uno::Reference< css::frame::XController >& xController, bool init);
+ void impl_updateTitleForFrame (const css::uno::Reference< css::frame::XFrame >& xFrame, bool init);
+
+ void impl_startListeningForModel (const css::uno::Reference< css::frame::XModel >& xModel);
+ void impl_startListeningForController (const css::uno::Reference< css::frame::XController >& xController);
+ void impl_startListeningForFrame (const css::uno::Reference< css::frame::XFrame >& xFrame);
+ void impl_updateListeningForFrame (const css::uno::Reference< css::frame::XFrame >& xFrame);
+
+ void impl_appendComponentTitle ( OUStringBuffer& sTitle ,
+ const css::uno::Reference< css::uno::XInterface >& xComponent);
+ void impl_appendProductName (OUStringBuffer& sTitle);
+ void impl_appendProductExtension (OUStringBuffer& sTitle);
+ void impl_appendModuleName (OUStringBuffer& sTitle);
+ void impl_appendDebugVersion (OUStringBuffer& sTitle);
+
+ void impl_setSubTitle (const css::uno::Reference< css::frame::XTitle >& xSubTitle);
+
+ OUString impl_convertURL2Title(const OUString& sURL);
+
+ //-------------------------------------------
+ // member
+ private:
+
+ /** points to the global uno service manager. */
+ css::uno::Reference< css::uno::XComponentContext> m_xContext;
+
+ /** reference to the outside UNO class using this helper. */
+ css::uno::WeakReference< css::uno::XInterface > m_xOwner;
+
+ /** used to know how an "Untitled X" string can be created right :-) */
+ css::uno::WeakReference< css::frame::XUntitledNumbers > m_xUntitledNumbers;
+
+ /** provides parts of our own title and we listen there for changes too. */
+ css::uno::WeakReference< css::frame::XTitle > m_xSubTitle;
+
+ /** if it's set to sal_True the member m_sTitle has not to be changed internaly.
+ It was set from outside and so outside code has to make sure it will be
+ updated.
+ */
+ ::sal_Bool m_bExternalTitle;
+
+ /** the actual title value */
+ OUString m_sTitle;
+
+ /** knows the leased number which must be used for untitled components. */
+ ::sal_Int32 m_nLeasedNumber;
+
+ /** contains all title change listener */
+ ::cppu::OMultiTypeInterfaceContainerHelper m_aListener;
+};
+
+} // namespace framework
+
+#endif // _FRAMEWORK_TITLEHELPER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/toolboxconfiguration.hxx b/include/framework/toolboxconfiguration.hxx
new file mode 100644
index 000000000000..a296231a07ea
--- /dev/null
+++ b/include/framework/toolboxconfiguration.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef __FRAMEWORK_XML_TOOLBOXCONFIGURATION_HXX_
+#define __FRAMEWORK_XML_TOOLBOXCONFIGURATION_HXX_
+
+#include <framework/fwedllapi.h>
+#include <vcl/bitmap.hxx>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+namespace framework
+{
+
+class FWE_DLLPUBLIC ToolBoxConfiguration
+{
+ public:
+ static sal_Bool LoadToolBox(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rInputStream,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& rToolbarConfiguration );
+
+ static sal_Bool StoreToolBox(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOutputStream,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rToolbarConfiguration );
+};
+
+} // namespace framework
+
+#endif // __FRAMEWORK_XML_TOOLBOXCONFIGURATION_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/undomanagerhelper.hxx b/include/framework/undomanagerhelper.hxx
new file mode 100644
index 000000000000..ae91db981553
--- /dev/null
+++ b/include/framework/undomanagerhelper.hxx
@@ -0,0 +1,159 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef FRAMEWORK_UNDOMANAGERHELPER_HXX
+#define FRAMEWORK_UNDOMANAGERHELPER_HXX
+
+#include "framework/fwedllapi.h"
+#include "framework/iguard.hxx"
+#include "framework/imutex.hxx"
+
+#include <com/sun/star/document/XUndoManager.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+
+#include <boost/scoped_ptr.hpp>
+
+namespace svl
+{
+ class IUndoManager;
+}
+
+//......................................................................................................................
+namespace framework
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= IMutexGuard
+ //==================================================================================================================
+ class SAL_NO_VTABLE IMutexGuard : public IGuard
+ {
+ public:
+ /** returns the mutex guarded by the instance.
+
+ Even if the guard currently has not a lock on the mutex, this method must succeed.
+ */
+ virtual IMutex& getGuardedMutex() = 0;
+
+ protected:
+ ~IMutexGuard() {}
+ };
+
+ //==================================================================================================================
+ //= IUndoManagerImplementation
+ //==================================================================================================================
+ class SAL_NO_VTABLE IUndoManagerImplementation
+ {
+ public:
+ /** returns the IUndoManager interface to the actual Undo stack
+
+ @throws com::sun::star::lang::DisposedException
+ when the instance is already disposed, and no IUndoManager can be provided
+
+ @throws com::sun::star::lang::NotInitializedException
+ when the instance is not initialized, yet, and no IUndoManager can be provided
+ */
+ virtual ::svl::IUndoManager& getImplUndoManager() = 0;
+
+ /** provides access to an UNO interface for the XUndoManager implementation. Used when throwing exceptions.
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager >
+ getThis() = 0;
+
+ protected:
+ ~IUndoManagerImplementation() {}
+ };
+
+ //==================================================================================================================
+ //= UndoManagerHelper
+ //==================================================================================================================
+ class UndoManagerHelper_Impl;
+ /** helper class for implementing an XUndoManager
+
+ Several of the methods of the class take an IMutexGuard instance. It is assumed that this guard has a lock on
+ its mutext at the moment the method is entered. The lock will be released before any notifications to the
+ registered XUndoManagerListeners happen.
+
+ The following locking strategy is used for this mutex:
+ <ul><li>Any notifications to the registered XUndoManagerListeners are after the guard has been cleared. i.e.
+ without the mutex being locked.</p>
+ <li>Any calls into the <code>IUndoManager</code> implementation is made without the mutex being locked.
+ Note that this implies that the <code>IUndoManager</code> implementation must be thread-safe in itself
+ (which is true for the default implementation, SfxUndoManager).</li>
+ <li>An exception to the previous item are the <member>IUndoManager::Undo</member> and
+ <member>IUndoManager::Redo</member> methods: They're called with the given external mutex being
+ locked.</li>
+ </ul>
+
+ The reason for the exception for IUndoManager::Undo and IUndoManager::Redo is that those are expected to
+ modify the actual document which the UndoManager works for. And as long as our documents are not thread-safe,
+ and as long as we do not re-fit <strong>all</strong> existing SfxUndoImplementations to <em>not</em> expect
+ the dreaded SolarMutex being locked when they're called, the above behavior is a compromise between "how it should
+ be" and "how it can realistically be".
+ */
+ class FWE_DLLPUBLIC UndoManagerHelper
+ {
+ public:
+ UndoManagerHelper( IUndoManagerImplementation& i_undoManagerImpl );
+ ~UndoManagerHelper();
+
+ // life time control
+ void disposing();
+
+ // XUndoManager equivalents
+ void enterUndoContext( const OUString& i_title, IMutexGuard& i_instanceLock );
+ void enterHiddenUndoContext( IMutexGuard& i_instanceLock );
+ void leaveUndoContext( IMutexGuard& i_instanceLock );
+ void addUndoAction( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoAction >& i_action, IMutexGuard& i_instanceLock );
+ void undo( IMutexGuard& i_instanceLock );
+ void redo( IMutexGuard& i_instanceLock );
+ ::sal_Bool isUndoPossible() const;
+ ::sal_Bool isRedoPossible() const;
+ OUString getCurrentUndoActionTitle() const;
+ OUString getCurrentRedoActionTitle() const;
+ ::com::sun::star::uno::Sequence< OUString >
+ getAllUndoActionTitles() const;
+ ::com::sun::star::uno::Sequence< OUString >
+ getAllRedoActionTitles() const;
+ void clear( IMutexGuard& i_instanceLock );
+ void clearRedo( IMutexGuard& i_instanceLock );
+ void reset( IMutexGuard& i_instanceLock );
+ void addUndoManagerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManagerListener >& i_listener );
+ void removeUndoManagerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManagerListener >& i_listener );
+
+ // XLockable, base of XUndoManager, equivalents
+ void lock();
+ void unlock();
+ ::sal_Bool isLocked();
+
+ // XModifyBroadcaster equivalents
+ void addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& i_listener );
+ void removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& i_listener );
+
+ private:
+ ::boost::scoped_ptr< UndoManagerHelper_Impl > m_pImpl;
+ };
+
+//......................................................................................................................
+} // namespace framework
+//......................................................................................................................
+
+#endif // FRAMEWORK_UNDOMANAGERHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nlangtag/i18nlangtagdllapi.h b/include/i18nlangtag/i18nlangtagdllapi.h
new file mode 100644
index 000000000000..ba9af35c08fe
--- /dev/null
+++ b/include/i18nlangtag/i18nlangtagdllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_I18NLANGTAG_I18NLANGTAGDLLAPI_H
+#define INCLUDED_I18NLANGTAG_I18NLANGTAGDLLAPI_H
+
+#include "sal/types.h"
+
+#if defined(I18NLANGTAG_DLLIMPLEMENTATION)
+#define I18NLANGTAG_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define I18NLANGTAG_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define I18NLANGTAG_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif /* INCLUDED_I18NLANGTAG_I18NLANGTAGDLLAPI_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nlangtag/lang.h b/include/i18nlangtag/lang.h
new file mode 100644
index 000000000000..d4f5ca7a61b3
--- /dev/null
+++ b/include/i18nlangtag/lang.h
@@ -0,0 +1,568 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_I18NLANGTAG_LANG_H
+#define INCLUDED_I18NLANGTAG_LANG_H
+
+/**
+ These are MS LANGIDs, the lower 10 bits (mask 0x03ff, values below 0x0400
+ aren't real locale IDs) represent the primary language ID, the upper 6 bits
+ represent the sublanguage ID, which in most cases together with the primary
+ language simply designates a country. A LANGID is constructed by
+ UINT16 nLangID = ((((UINT16)(SubLangId)) << 10) | (UINT16)(PriLangId));
+
+ A user-defined primary language ID is a value in the range 0x0200 to 0x03ff.
+ All other values are reserved for Windows system use.
+
+ A user-defined sublanguage identifier is a value in the range 0x20 to 0x3f.
+ All other values are reserved for Windows system use.
+ If there is no sublanguage ID for a primary language ID, use SUBLANG_DEFAULT
+ (0x01, which shifted to the left by 10 bits results in the frequently seen
+ 0x0400). OR'ed with a 0x0200 primary results in 0x0600.
+
+ Values added as of 2006-04-18, a helper script: ../../source/isolang/lcid.awk
+ Utility to compare MS-LANGID definitions with those defined in this file.
+
+ For further information about MS-LANGIDs please see include/winnt.h of a
+ recent MSDEV version and the following web pages.
+
+
+ The once complete list, not necessarily supported by Windows:
+ List of Locale ID (LCID) Values as Assigned by Microsoft
+ http://www.microsoft.com/globaldev/reference/lcid-all.mspx
+
+ As a complete list is never complete, some more that came with WinXP SP2:
+ Windows XP/Server 2003 - List of Locale IDs, Input Locale, and Language Collection
+ http://www.microsoft.com/globaldev/reference/winxp/xp-lcid.mspx
+
+ And of course 2 lists aren't enough, so Windows Vista needs an extra one.
+ Which at least seems to include values of other versions of Windows.
+ Language Identifier Constants and Strings
+ http://msdn2.microsoft.com/en-us/library/ms776294.aspx
+
+ Hey, yet another list, maybe this one will not move around? It seems to be
+ quite complete..
+ Language Identifier Constants and Strings (Windows)
+ http://msdn.microsoft.com/en-us/library/dd318693(VS.85).aspx
+
+ List of supported locale identifiers in Word
+ http://support.microsoft.com/default.aspx?scid=KB;en-us;q221435
+ */
+
+
+/* It must be safe to include this file in plain C code, so only C style
+ * comments are used. Do NOT use // C++ style comments. */
+
+/* disable typedef for usage in svtools/source/misc/langtab.src */
+#ifndef RSC_RESOURCE_USAGE
+typedef unsigned short LanguageType;
+#endif
+
+#define LANGUAGE_MASK_PRIMARY 0x03ff
+
+#ifdef __cplusplus
+/* Please use the methods provided in mslangid.hxx for type-safety! */
+#else
+#define MSLANGID_MAKELANGID( nSubLangId, nPriLangId ) \
+ (((nSubLangId) << 10) | (nPriLangId))
+#define MSLANGID_GETPRIMARYLANGUAGE( nLangID ) \
+ ((nLangID) & LANGUAGE_MASK_PRIMARY)
+#define MSLANGID_GETSUBLANGUAGE( nLangID ) \
+ (((nLangID) & ~LANGUAGE_MASK_PRIMARY) >> 10)
+#endif
+
+
+#define LANGUAGE_DONTKNOW 0x03FF /* yes, the mask */
+#define LANGUAGE_NONE 0x00FF
+#define LANGUAGE_HID_HUMAN_INTERFACE_DEVICE 0x04FF
+#define LANGUAGE_SYSTEM 0x0000 /* OOo/SO definition */
+
+/* The Invariant Locale (Locale ID = 0x007f) is a locale that can be used by
+ * applications when a consistent and locale-independent result is required.
+ * The invariant locale can be used, for example, when comparing character
+ * strings using the CompareString() API and a consistent result regardless of
+ * the User Locale is expected.
+ * The settings of the Invariant Locale are similar to US-English international
+ * standards, but should not be used to display formatted data. */
+/* NOTE: this is taken from the MS documentation! Not supported by OOo/SO! */
+#define LANGUAGE_INVARIANT 0x007F
+
+#define LANGUAGE_AFRIKAANS 0x0436
+#define LANGUAGE_ALBANIAN 0x041C
+#define LANGUAGE_ALSATIAN_FRANCE 0x0484
+#define LANGUAGE_AMHARIC_ETHIOPIA 0x045E
+#define LANGUAGE_ARABIC_ALGERIA 0x1401
+#define LANGUAGE_ARABIC_BAHRAIN 0x3C01
+#define LANGUAGE_ARABIC_EGYPT 0x0C01
+#define LANGUAGE_ARABIC_IRAQ 0x0801
+#define LANGUAGE_ARABIC_JORDAN 0x2C01
+#define LANGUAGE_ARABIC_KUWAIT 0x3401
+#define LANGUAGE_ARABIC_LEBANON 0x3001
+#define LANGUAGE_ARABIC_LIBYA 0x1001
+#define LANGUAGE_ARABIC_MOROCCO 0x1801
+#define LANGUAGE_ARABIC_OMAN 0x2001
+#define LANGUAGE_ARABIC_QATAR 0x4001
+#define LANGUAGE_ARABIC_SAUDI_ARABIA 0x0401
+#define LANGUAGE_ARABIC_SYRIA 0x2801
+#define LANGUAGE_ARABIC_TUNISIA 0x1C01
+#define LANGUAGE_ARABIC_UAE 0x3801
+#define LANGUAGE_ARABIC_YEMEN 0x2401
+#define LANGUAGE_ARABIC_PRIMARY_ONLY 0x0001 /* primary only, not a locale! */
+#define LANGUAGE_ARMENIAN 0x042B
+#define LANGUAGE_ASSAMESE 0x044D
+#define LANGUAGE_AZERI 0x002C /* primary only, not a locale! */
+#define LANGUAGE_AZERI_CYRILLIC 0x082C
+#define LANGUAGE_AZERI_LATIN 0x042C
+#define LANGUAGE_BASHKIR_RUSSIA 0x046D
+#define LANGUAGE_BASQUE 0x042D
+#define LANGUAGE_BELARUSIAN 0x0423
+#define LANGUAGE_BENGALI 0x0445 /* in India */
+#define LANGUAGE_BENGALI_BANGLADESH 0x0845
+#define LANGUAGE_BOSNIAN_LATIN_BOSNIA_HERZEGOVINA 0x141A
+#define LANGUAGE_BOSNIAN_CYRILLIC_BOSNIA_HERZEGOVINA 0x201A
+#define LANGUAGE_BOSNIAN_BOSNIA_HERZEGOVINA LANGUAGE_BOSNIAN_LATIN_BOSNIA_HERZEGOVINA /* TODO: remove, only for langtab.src & localize.sdf compatibility */
+#define LANGUAGE_BRETON_FRANCE 0x047E /* obsoletes LANGUAGE_USER_BRETON 0x0629 */
+#define LANGUAGE_BULGARIAN 0x0402
+#define LANGUAGE_BURMESE 0x0455
+#define LANGUAGE_CATALAN 0x0403
+#define LANGUAGE_CHEROKEE_UNITED_STATES 0x045C
+#define LANGUAGE_CHINESE 0x0004 /* primary only, not a locale! */
+#define LANGUAGE_CHINESE_HONGKONG 0x0C04
+#define LANGUAGE_CHINESE_MACAU 0x1404
+#define LANGUAGE_CHINESE_SIMPLIFIED 0x0804
+#define LANGUAGE_CHINESE_SINGAPORE 0x1004
+#define LANGUAGE_CHINESE_TRADITIONAL 0x0404
+/* #define LANGUAGE_CHINESE_SIMPLIFIED 0x0004 */ /* artificial political? Defined as 'zh-CHS' by MS. Primary only! */
+/* #define LANGUAGE_CHINESE_TRADITIONAL 0x7C04 */ /* artificial political? Defined as 'zh-CHT' by MS. */
+#define LANGUAGE_CORSICAN_FRANCE 0x0483
+#define LANGUAGE_CROATIAN 0x041A
+#define LANGUAGE_CROATIAN_BOSNIA_HERZEGOVINA 0x101A
+#define LANGUAGE_CZECH 0x0405
+#define LANGUAGE_DANISH 0x0406
+#define LANGUAGE_DARI_AFGHANISTAN 0x048C /* AKA Zoroastrian Dari */
+#define LANGUAGE_DHIVEHI 0x0465 /* AKA Divehi */
+#define LANGUAGE_DUTCH 0x0413
+#define LANGUAGE_DUTCH_BELGIAN 0x0813
+#define LANGUAGE_EDO 0x0466
+#define LANGUAGE_ENGLISH 0x0009 /* primary only, not a locale! */
+#define LANGUAGE_ENGLISH_AUS 0x0C09
+#define LANGUAGE_ENGLISH_BELIZE 0x2809
+#define LANGUAGE_ENGLISH_CAN 0x1009
+#define LANGUAGE_ENGLISH_CARRIBEAN 0x2409
+#define LANGUAGE_ENGLISH_EIRE 0x1809
+#define LANGUAGE_ENGLISH_HONG_KONG_SAR 0x3C09
+#define LANGUAGE_ENGLISH_INDIA 0x4009
+#define LANGUAGE_ENGLISH_INDONESIA 0x3809
+#define LANGUAGE_ENGLISH_JAMAICA 0x2009
+#define LANGUAGE_ENGLISH_MALAYSIA 0x4409
+#define LANGUAGE_ENGLISH_NZ 0x1409
+#define LANGUAGE_ENGLISH_PHILIPPINES 0x3409
+#define LANGUAGE_ENGLISH_SAFRICA 0x1C09
+#define LANGUAGE_ENGLISH_SINGAPORE 0x4809
+#define LANGUAGE_ENGLISH_TRINIDAD 0x2C09
+#define LANGUAGE_ENGLISH_UK 0x0809
+#define LANGUAGE_ENGLISH_US 0x0409
+#define LANGUAGE_ENGLISH_ZIMBABWE 0x3009
+#define LANGUAGE_ESTONIAN 0x0425
+#define LANGUAGE_FAEROESE 0x0438
+#define LANGUAGE_FARSI 0x0429
+#define LANGUAGE_FILIPINO 0x0464
+#define LANGUAGE_FINNISH 0x040B
+#define LANGUAGE_FRENCH 0x040C
+#define LANGUAGE_FRENCH_BELGIAN 0x080C
+#define LANGUAGE_FRENCH_CAMEROON 0x2C0C
+#define LANGUAGE_FRENCH_CANADIAN 0x0C0C
+#define LANGUAGE_FRENCH_COTE_D_IVOIRE 0x300C
+
+#define LANGUAGE_FRENCH_HAITI 0x3C0C
+#define LANGUAGE_FRENCH_LUXEMBOURG 0x140C
+#define LANGUAGE_FRENCH_MALI 0x340C
+#define LANGUAGE_FRENCH_MONACO 0x180C
+#define LANGUAGE_FRENCH_MOROCCO 0x380C
+#define LANGUAGE_FRENCH_NORTH_AFRICA 0xE40C
+#define LANGUAGE_FRENCH_REUNION 0x200C
+#define LANGUAGE_FRENCH_SENEGAL 0x280C
+#define LANGUAGE_FRENCH_SWISS 0x100C
+#define LANGUAGE_FRENCH_WEST_INDIES 0x1C0C
+#define LANGUAGE_FRENCH_ZAIRE 0x240C
+#define LANGUAGE_FRISIAN_NETHERLANDS 0x0462
+#define LANGUAGE_FULFULDE_NIGERIA 0x0467
+#define LANGUAGE_GAELIC_IRELAND 0x083C
+#define LANGUAGE_GAELIC_SCOTLAND 0x043C
+#define LANGUAGE_GALICIAN 0x0456
+#define LANGUAGE_GEORGIAN 0x0437
+#define LANGUAGE_GERMAN 0x0407
+#define LANGUAGE_GERMAN_AUSTRIAN 0x0C07
+#define LANGUAGE_GERMAN_LIECHTENSTEIN 0x1407
+#define LANGUAGE_GERMAN_LUXEMBOURG 0x1007
+#define LANGUAGE_GERMAN_SWISS 0x0807
+#define LANGUAGE_GREEK 0x0408
+#define LANGUAGE_GUARANI_PARAGUAY 0x0474
+#define LANGUAGE_GUJARATI 0x0447
+#define LANGUAGE_HAUSA_NIGERIA 0x0468
+#define LANGUAGE_HAWAIIAN_UNITED_STATES 0x0475
+#define LANGUAGE_HEBREW 0x040D
+#define LANGUAGE_HINDI 0x0439
+#define LANGUAGE_HUNGARIAN 0x040E
+#define LANGUAGE_IBIBIO_NIGERIA 0x0469
+#define LANGUAGE_ICELANDIC 0x040F
+#define LANGUAGE_IGBO_NIGERIA 0x0470
+#define LANGUAGE_INDONESIAN 0x0421
+#define LANGUAGE_INUKTITUT_SYLLABICS_CANADA 0x045D
+#define LANGUAGE_INUKTITUT_LATIN_CANADA 0x085D
+#define LANGUAGE_ITALIAN 0x0410
+#define LANGUAGE_ITALIAN_SWISS 0x0810
+#define LANGUAGE_JAPANESE 0x0411
+#define LANGUAGE_KALAALLISUT_GREENLAND 0x046F /* obsoletes LANGUAGE_USER_KALAALLISUT 0x062A */
+#define LANGUAGE_KANNADA 0x044B
+#define LANGUAGE_KANURI_NIGERIA 0x0471
+#define LANGUAGE_KASHMIRI 0x0460
+#define LANGUAGE_KASHMIRI_INDIA 0x0860
+#define LANGUAGE_KAZAKH 0x043F
+#define LANGUAGE_KHMER 0x0453
+#define LANGUAGE_KICHE_GUATEMALA 0x0486 /* AKA K'iche', West Central Quiche, */
+#define LANGUAGE_KINYARWANDA_RWANDA 0x0487 /* obsoletes LANGUAGE_USER_KINYARWANDA 0x0621 */
+#define LANGUAGE_KIRGHIZ 0x0440 /* AKA Kyrgyz */
+#define LANGUAGE_KONKANI 0x0457
+#define LANGUAGE_KOREAN 0x0412
+#define LANGUAGE_KOREAN_JOHAB 0x0812
+#define LANGUAGE_LAO 0x0454
+#define LANGUAGE_LATIN 0x0476 /* obsoletes LANGUAGE_USER_LATIN 0x0610 */
+#define LANGUAGE_LATVIAN 0x0426
+#define LANGUAGE_LITHUANIAN 0x0427
+#define LANGUAGE_LITHUANIAN_CLASSIC 0x0827
+#define LANGUAGE_LUXEMBOURGISH_LUXEMBOURG 0x046E /* obsoletes LANGUAGE_USER_LUXEMBOURGISH 0x0630 */
+#define LANGUAGE_MACEDONIAN 0x042F
+#define LANGUAGE_MALAY 0x003E /* primary only, not a locale! */
+#define LANGUAGE_MALAYALAM 0x044C /* in India */
+#define LANGUAGE_MALAY_BRUNEI_DARUSSALAM 0x083E
+#define LANGUAGE_MALAY_MALAYSIA 0x043E
+#define LANGUAGE_MALTESE 0x043A
+#define LANGUAGE_MANIPURI 0x0458
+#define LANGUAGE_MAORI_NEW_ZEALAND 0x0481 /* obsoletes LANGUAGE_USER_MAORI 0x0620 */
+#define LANGUAGE_MAPUDUNGUN_CHILE 0x047A /* AKA Araucanian */
+#define LANGUAGE_MARATHI 0x044E
+#define LANGUAGE_MOHAWK_CANADA 0x047C
+#define LANGUAGE_MONGOLIAN 0x0450 /* Cyrillic script */
+#define LANGUAGE_MONGOLIAN_MONGOLIAN 0x0850
+#define LANGUAGE_NEPALI 0x0461
+#define LANGUAGE_NEPALI_INDIA 0x0861
+#define LANGUAGE_NORWEGIAN 0x0014 /* primary only, not a locale! */
+#define LANGUAGE_NORWEGIAN_BOKMAL 0x0414
+#define LANGUAGE_NORWEGIAN_NYNORSK 0x0814
+#define LANGUAGE_OCCITAN_FRANCE 0x0482 /* obsoletes LANGUAGE_USER_OCCITAN 0x0625 */
+#define LANGUAGE_ORIYA 0x0448
+#define LANGUAGE_OROMO 0x0472
+#define LANGUAGE_PAPIAMENTU 0x0479
+#define LANGUAGE_PASHTO 0x0463
+#define LANGUAGE_POLISH 0x0415
+#define LANGUAGE_PORTUGUESE 0x0816
+#define LANGUAGE_PORTUGUESE_BRAZILIAN 0x0416
+#define LANGUAGE_PUNJABI 0x0446
+#define LANGUAGE_PUNJABI_PAKISTAN 0x0846
+#define LANGUAGE_QUECHUA_BOLIVIA 0x046B
+#define LANGUAGE_QUECHUA_ECUADOR 0x086B
+#define LANGUAGE_QUECHUA_PERU 0x0C6B
+#define LANGUAGE_RHAETO_ROMAN 0x0417
+#define LANGUAGE_ROMANIAN 0x0418
+#define LANGUAGE_ROMANIAN_MOLDOVA 0x0818
+#define LANGUAGE_RUSSIAN 0x0419
+#define LANGUAGE_RUSSIAN_MOLDOVA 0x0819
+#define LANGUAGE_SAMI_NORTHERN_NORWAY 0x043B
+#define LANGUAGE_SAMI_LAPPISH LANGUAGE_SAMI_NORTHERN_NORWAY /* the old MS definition */
+#define LANGUAGE_SAMI_INARI 0x243B
+#define LANGUAGE_SAMI_LULE_NORWAY 0x103B
+#define LANGUAGE_SAMI_LULE_SWEDEN 0x143B
+#define LANGUAGE_SAMI_NORTHERN_FINLAND 0x0C3B
+#define LANGUAGE_SAMI_NORTHERN_SWEDEN 0x083B
+#define LANGUAGE_SAMI_SKOLT 0x203B
+#define LANGUAGE_SAMI_SOUTHERN_NORWAY 0x183B
+#define LANGUAGE_SAMI_SOUTHERN_SWEDEN 0x1C3B
+#define LANGUAGE_SANSKRIT 0x044F
+#define LANGUAGE_SEPEDI 0x046C
+#define LANGUAGE_NORTHERNSOTHO LANGUAGE_SEPEDI /* just an alias for the already existing localization */
+#define LANGUAGE_SERBIAN 0x001A /* primary only, not a locale! */
+#define LANGUAGE_SERBIAN_CYRILLIC 0x0C1A /* MS lists this as Serbian (Cyrillic, Serbia) 'sr-Cyrl-SP', but they use 'SP' since at least Windows2003 where it was Serbia and Montenegro! */
+#define LANGUAGE_SERBIAN_CYRILLIC_BOSNIA_HERZEGOVINA 0x1C1A
+#define LANGUAGE_SERBIAN_LATIN 0x081A /* MS lists this as Serbian (Latin, Serbia) 'sr-Latn-SP', but they use 'SP' since at least Windows2003 where it was Serbia and Montenegro! */
+#define LANGUAGE_SERBIAN_LATIN_BOSNIA_HERZEGOVINA 0x181A
+#define LANGUAGE_SERBIAN_LATIN_NEUTRAL 0x7C1A /* MS lists this as 'sr' only. What a mess. */
+#define LANGUAGE_SESOTHO 0x0430 /* also called Sutu now by MS */
+#define LANGUAGE_SINDHI 0x0459
+#define LANGUAGE_SINDHI_PAKISTAN 0x0859
+#define LANGUAGE_SINHALESE_SRI_LANKA 0x045B
+#define LANGUAGE_SLOVAK 0x041B
+#define LANGUAGE_SLOVENIAN 0x0424
+#define LANGUAGE_SOMALI 0x0477
+#define LANGUAGE_UPPER_SORBIAN_GERMANY 0x042E /* obsoletes LANGUAGE_USER_UPPER_SORBIAN 0x0623 */
+#define LANGUAGE_LOWER_SORBIAN_GERMANY 0x082E /* obsoletes LANGUAGE_USER_LOWER_SORBIAN 0x0624. NOTE: the primary ID is identical to Upper Sorbian, which is not quite correct because they're distinct languages */
+#define LANGUAGE_SORBIAN LANGUAGE_USER_UPPER_SORBIAN /* a strange MS definition */
+#define LANGUAGE_SPANISH_DATED 0x040A /* old collation, not supported, see #i94435# */
+#define LANGUAGE_SPANISH_ARGENTINA 0x2C0A
+#define LANGUAGE_SPANISH_BOLIVIA 0x400A
+#define LANGUAGE_SPANISH_CHILE 0x340A
+#define LANGUAGE_SPANISH_COLOMBIA 0x240A
+#define LANGUAGE_SPANISH_COSTARICA 0x140A
+#define LANGUAGE_SPANISH_DOMINICAN_REPUBLIC 0x1C0A
+#define LANGUAGE_SPANISH_ECUADOR 0x300A
+#define LANGUAGE_SPANISH_EL_SALVADOR 0x440A
+#define LANGUAGE_SPANISH_GUATEMALA 0x100A
+#define LANGUAGE_SPANISH_HONDURAS 0x480A
+#define LANGUAGE_SPANISH_LATIN_AMERICA 0xE40A /* no locale possible */
+#define LANGUAGE_SPANISH_MEXICAN 0x080A
+#define LANGUAGE_SPANISH_MODERN 0x0C0A
+#define LANGUAGE_SPANISH_NICARAGUA 0x4C0A
+#define LANGUAGE_SPANISH_PANAMA 0x180A
+#define LANGUAGE_SPANISH_PARAGUAY 0x3C0A
+#define LANGUAGE_SPANISH_PERU 0x280A
+#define LANGUAGE_SPANISH_PUERTO_RICO 0x500A
+#define LANGUAGE_SPANISH_UNITED_STATES 0x540A
+#define LANGUAGE_SPANISH_URUGUAY 0x380A
+#define LANGUAGE_SPANISH_VENEZUELA 0x200A
+#define LANGUAGE_SPANISH LANGUAGE_SPANISH_MODERN /* modern collation, see #i94435# */
+#define LANGUAGE_SWAHILI 0x0441 /* Kenya */
+#define LANGUAGE_SWEDISH 0x041D
+#define LANGUAGE_SWEDISH_FINLAND 0x081D
+#define LANGUAGE_SYRIAC 0x045A
+#define LANGUAGE_TAJIK 0x0428
+#define LANGUAGE_TAMAZIGHT_ARABIC 0x045F
+#define LANGUAGE_TAMAZIGHT_LATIN 0x085F
+#define LANGUAGE_TAMAZIGHT_TIFINAGH 0x0C5F
+#define LANGUAGE_TAMIL 0x0449
+#define LANGUAGE_TATAR 0x0444
+#define LANGUAGE_TELUGU 0x044A
+#define LANGUAGE_THAI 0x041E
+#define LANGUAGE_TIBETAN 0x0451
+#define LANGUAGE_DZONGKHA 0x0851
+#define LANGUAGE_TIBETAN_BHUTAN LANGUAGE_DZONGKHA /* a MS error, see #i53497# */
+#define LANGUAGE_TIGRIGNA_ERITREA 0x0873
+#define LANGUAGE_TIGRIGNA_ETHIOPIA 0x0473
+#define LANGUAGE_TSONGA 0x0431
+#define LANGUAGE_TSWANA 0x0432 /* AKA Setsuana, for South Africa */
+#define LANGUAGE_TURKISH 0x041F
+#define LANGUAGE_TURKMEN 0x0442
+#define LANGUAGE_UIGHUR_CHINA 0x0480
+#define LANGUAGE_UKRAINIAN 0x0422
+#define LANGUAGE_URDU 0x0020 /* primary only, not a locale! */
+#define LANGUAGE_URDU_INDIA 0x0820
+#define LANGUAGE_URDU_PAKISTAN 0x0420
+#define LANGUAGE_UZBEK_CYRILLIC 0x0843
+#define LANGUAGE_UZBEK_LATIN 0x0443
+#define LANGUAGE_VENDA 0x0433
+#define LANGUAGE_VIETNAMESE 0x042A
+#define LANGUAGE_WELSH 0x0452
+#define LANGUAGE_WOLOF_SENEGAL 0x0488
+#define LANGUAGE_XHOSA 0x0434 /* AKA isiZhosa */
+#define LANGUAGE_YAKUT_RUSSIA 0x0485
+#define LANGUAGE_YI 0x0478 /* Sichuan Yi */
+#define LANGUAGE_YIDDISH 0x043D
+#define LANGUAGE_YORUBA 0x046A
+#define LANGUAGE_ZULU 0x0435
+
+/*! use only for import/export of MS documents, number formatter maps it to
+ *! LANGUAGE_SYSTEM and then to effective system language */
+#define LANGUAGE_SYSTEM_DEFAULT 0x0800
+
+/*! use only for import/export of MS documents, number formatter maps it to
+ *! LANGUAGE_SYSTEM and then to effective system language */
+#define LANGUAGE_PROCESS_OR_USER_DEFAULT 0x0400
+
+/* And now the extensions we define, valid from
+ * 0x0610 to 0x07FF with sublanguage ID 0x01 (default)
+ * 0x0A00 to 0x0BFF with sublanguage ID 0x02
+ * ...
+ * 0x8200 to 0x83FF with sublanguage ID 0x20
+ * 0x8600 to 0x87FF with sublanguage ID 0x21
+ * ...
+ * 0xFA00 to 0xFBFF with sublanguage ID 0x3E
+ * 0xFE00 to 0xFFFF with sublanguage ID 0x3F
+ *
+ * Obsolete OOo user defines now have other values assigned by MS, and
+ * different name. Mapping an obsolete value to ISO code should work provided
+ * that such a mapping exists in i18nlangtag/source/isolang/isolang.cxx, but
+ * mapping ISO back to LANGID will return the new value.
+ */
+#define LANGUAGE_OBSOLETE_USER_LATIN 0x0610
+#define LANGUAGE_USER_LATIN LANGUAGE_LATIN
+#define LANGUAGE_USER_ESPERANTO 0x0611 /* no locale possible */
+#define LANGUAGE_USER_INTERLINGUA 0x0612 /* no locale, but conventions */
+#define LANGUAGE_OBSOLETE_USER_MAORI 0x0620
+#define LANGUAGE_USER_MAORI LANGUAGE_MAORI_NEW_ZEALAND
+#define LANGUAGE_OBSOLETE_USER_KINYARWANDA 0x0621
+#define LANGUAGE_USER_KINYARWANDA LANGUAGE_KINYARWANDA_RWANDA
+/* was reserved for Northern Sotho but never used: 0x0622 */ /* obsoleted by LANGUAGE_SEPEDI */
+#define LANGUAGE_OBSOLETE_USER_UPPER_SORBIAN 0x0623
+#define LANGUAGE_USER_UPPER_SORBIAN LANGUAGE_UPPER_SORBIAN_GERMANY
+#define LANGUAGE_OBSOLETE_USER_LOWER_SORBIAN 0x0624
+#define LANGUAGE_USER_LOWER_SORBIAN LANGUAGE_LOWER_SORBIAN_GERMANY
+#define LANGUAGE_OBSOLETE_USER_OCCITAN 0x0625
+#define LANGUAGE_USER_OCCITAN LANGUAGE_OCCITAN_FRANCE /* reserved to languedocian */
+
+#define LANGUAGE_USER_KOREAN_NORTH 0x8012 /* North Korean as opposed to South Korean, makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_KOREAN)) */
+#define LANGUAGE_USER_KURDISH_TURKEY 0x0626 /* sublang 0x01, Latin script */
+#define LANGUAGE_USER_KURDISH_SYRIA 0x0A26 /* sublang 0x02, Latin script */
+#define LANGUAGE_USER_KURDISH_IRAQ 0x0E26 /* sublang 0x03, Arabic script */
+#define LANGUAGE_USER_KURDISH_IRAN 0x1226 /* sublang 0x04, Arabic script */
+#define LANGUAGE_USER_SARDINIAN 0x0627
+/* was reserved for Dzongkha but turned down with #i53497#: 0x0628 */ /* obsoleted by LANGUAGE_DZONGKHA */
+#define LANGUAGE_USER_SWAHILI_TANZANIA 0x8041 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_SWAHILI)) */
+#define LANGUAGE_OBSOLETE_USER_BRETON 0x0629
+#define LANGUAGE_USER_BRETON LANGUAGE_BRETON_FRANCE
+#define LANGUAGE_OBSOLETE_USER_KALAALLISUT 0x062A
+#define LANGUAGE_USER_KALAALLISUT LANGUAGE_KALAALLISUT_GREENLAND
+#define LANGUAGE_USER_SWAZI 0x062B
+#define LANGUAGE_USER_NDEBELE_SOUTH 0x062C
+#define LANGUAGE_USER_TSWANA_BOTSWANA 0x8032 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_TSWANA)) */
+#define LANGUAGE_USER_MOORE 0x062D
+#define LANGUAGE_USER_BAMBARA 0x062E
+#define LANGUAGE_USER_AKAN 0x062F
+#define LANGUAGE_OBSOLETE_USER_LUXEMBOURGISH 0x0630
+#define LANGUAGE_USER_LUXEMBOURGISH LANGUAGE_LUXEMBOURGISH_LUXEMBOURG
+#define LANGUAGE_USER_FRIULIAN 0x0631
+#define LANGUAGE_USER_FIJIAN 0x0632
+#define LANGUAGE_USER_AFRIKAANS_NAMIBIA 0x8036 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_AFRIKAANS)) */
+#define LANGUAGE_USER_ENGLISH_NAMIBIA 0x8009 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_ENGLISH_US)) */
+#define LANGUAGE_USER_WALLOON 0x0633
+#define LANGUAGE_USER_COPTIC 0x0634
+#define LANGUAGE_USER_CHUVASH 0x0635
+#define LANGUAGE_USER_GASCON 0x0636 /* Gascon France */
+#define LANGUAGE_USER_GERMAN_BELGIUM 0x8007 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_GERMAN)) */
+#define LANGUAGE_USER_CATALAN_VALENCIAN 0x8003 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_CATALAN)) */
+#define LANGUAGE_USER_HAUSA_GHANA 0x8068 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_HAUSA_NIGERIA)) */
+#define LANGUAGE_USER_EWE_GHANA 0x0637
+#define LANGUAGE_USER_ENGLISH_GHANA 0x8409 /* makeLangID( 0x21, getPrimaryLanguage( LANGUAGE_ENGLISH_US)) */
+#define LANGUAGE_USER_TAGALOG 0x0638
+#define LANGUAGE_USER_LINGALA_DRCONGO 0x0639
+#define LANGUAGE_USER_SANGO 0x063A
+#define LANGUAGE_USER_GANDA 0x063B
+#define LANGUAGE_USER_LOW_GERMAN 0x063C
+#define LANGUAGE_USER_HILIGAYNON 0x063D
+#define LANGUAGE_USER_NYANJA 0x063E
+#define LANGUAGE_USER_KASHUBIAN 0x063F
+#define LANGUAGE_USER_SPANISH_CUBA 0x800A /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_SPANISH)) */
+#define LANGUAGE_USER_TETUN 0x0640
+#define LANGUAGE_USER_QUECHUA_NORTH_BOLIVIA 0x0641
+#define LANGUAGE_USER_QUECHUA_SOUTH_BOLIVIA 0x0642
+#define LANGUAGE_USER_SERBIAN_CYRILLIC_SERBIA 0x8C1A /* makeLangID( 0x20+0x03, getPrimaryLanguage( LANGUAGE_SERBIAN_CYRILLIC)) */
+#define LANGUAGE_USER_SERBIAN_LATIN_SERBIA 0x881A /* makeLangID( 0x20+0x02, getPrimaryLanguage( LANGUAGE_SERBIAN_LATIN)) */
+#define LANGUAGE_USER_SERBIAN_CYRILLIC_MONTENEGRO 0xCC1A /* makeLangID( 0x20+0x13, getPrimaryLanguage( LANGUAGE_SERBIAN_CYRILLIC)) */
+#define LANGUAGE_USER_SERBIAN_LATIN_MONTENEGRO 0xC81A /* makeLangID( 0x20+0x12, getPrimaryLanguage( LANGUAGE_SERBIAN_LATIN)) */
+#define LANGUAGE_USER_SAMI_KILDIN_RUSSIA 0x803B /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_SAMI_NORTHERN_NORWAY)) */
+#define LANGUAGE_USER_BODO_INDIA 0x0643
+#define LANGUAGE_USER_DOGRI_INDIA 0x0644
+#define LANGUAGE_USER_MAITHILI_INDIA 0x0645
+#define LANGUAGE_USER_SANTALI_INDIA 0x0646
+#define LANGUAGE_USER_TETUN_TIMOR_LESTE 0x0A40 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_USER_TETUN)) */
+#define LANGUAGE_USER_TOK_PISIN 0x0647
+#define LANGUAGE_USER_SHUSWAP 0x0648
+#define LANGUAGE_USER_ARABIC_CHAD 0x8001 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */
+#define LANGUAGE_USER_ARABIC_COMOROS 0x8401 /* makeLangID( 0x21, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */
+#define LANGUAGE_USER_ARABIC_DJIBOUTI 0x8801 /* makeLangID( 0x22, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */
+#define LANGUAGE_USER_ARABIC_ERITREA 0x8C01 /* makeLangID( 0x23, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */
+#define LANGUAGE_USER_ARABIC_ISRAEL 0x9001 /* makeLangID( 0x24, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */
+#define LANGUAGE_USER_ARABIC_MAURITANIA 0x9401 /* makeLangID( 0x25, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */
+#define LANGUAGE_USER_ARABIC_PALESTINE 0x9801 /* makeLangID( 0x26, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */
+#define LANGUAGE_USER_ARABIC_SOMALIA 0x9C01 /* makeLangID( 0x27, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */
+#define LANGUAGE_USER_ARABIC_SUDAN 0xA001 /* makeLangID( 0x28, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */
+#define LANGUAGE_USER_ANCIENT_GREEK 0x0649
+#define LANGUAGE_USER_ASTURIAN 0x064A
+#define LANGUAGE_USER_LATGALIAN 0x064B
+#define LANGUAGE_USER_MAORE 0x064C
+#define LANGUAGE_USER_BUSHI 0x064D
+#define LANGUAGE_USER_TAHITIAN 0x064E
+#define LANGUAGE_USER_MALAGASY_PLATEAU 0x064F
+#define LANGUAGE_USER_PAPIAMENTU_ARUBA 0x8079 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_PAPIAMENTU)) */
+#define LANGUAGE_USER_SARDINIAN_CAMPIDANESE 0x0650
+#define LANGUAGE_USER_SARDINIAN_GALLURESE 0x0651
+#define LANGUAGE_USER_SARDINIAN_LOGUDORESE 0x0652
+#define LANGUAGE_USER_SARDINIAN_SASSARESE 0x0653
+#define LANGUAGE_USER_BAFIA 0x0654
+#define LANGUAGE_USER_GIKUYU 0x0655
+#define LANGUAGE_USER_RUSYN_UKRAINE 0x0656
+#define LANGUAGE_USER_RUSYN_SLOVAKIA 0x8256 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_USER_RUSYN_UKRAINE)) */
+#define LANGUAGE_USER_YIDDISH_US 0x083D /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_YIDDISH)) */
+#define LANGUAGE_USER_LIMBU 0x0657
+#define LANGUAGE_USER_LOJBAN 0x0658 /* no locale */
+#define LANGUAGE_OBSOLETE_USER_KABYLE 0x0659
+#define LANGUAGE_USER_KABYLE LANGUAGE_TAMAZIGHT_LATIN
+#define LANGUAGE_USER_HAITIAN 0x065A
+#define LANGUAGE_USER_BEEMBE 0x065B
+#define LANGUAGE_USER_BEKWEL 0x065C
+#define LANGUAGE_USER_KITUBA 0x065D
+#define LANGUAGE_USER_LARI 0x065E
+#define LANGUAGE_USER_MBOCHI 0x065F
+#define LANGUAGE_USER_TEKE_IBALI 0x0660
+#define LANGUAGE_USER_TEKE_TYEE 0x0661
+#define LANGUAGE_USER_VILI 0x0662
+#define LANGUAGE_USER_PORTUGUESE_ANGOLA 0x8016 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_PORTUGUESE)) */
+#define LANGUAGE_USER_MANX 0x0663
+#define LANGUAGE_USER_TEKE_EBOO 0x0664
+#define LANGUAGE_USER_ARAGONESE 0x0665
+#define LANGUAGE_USER_KEYID 0x0666 /* key id pseudolanguage */
+#define LANGUAGE_USER_PALI_LATIN 0x0667
+#define LANGUAGE_USER_KYRGYZ_CHINA 0x0668 /* not derived from LANGUAGE_KIRGHIZ as these may be different scripts, see http://www.omniglot.com/writing/kirghiz.htm */
+#define LANGUAGE_USER_KOMI_ZYRIAN 0x0669
+#define LANGUAGE_USER_KOMI_PERMYAK 0x066A
+#define LANGUAGE_USER_PITJANTJATJARA 0x066B
+#define LANGUAGE_USER_ENGLISH_MALAWI 0x8809 /* makeLangID( 0x22, getPrimaryLanguage( LANGUAGE_ENGLISH_UK)) */
+#define LANGUAGE_USER_ERZYA 0x066C
+#define LANGUAGE_USER_MARI_MEADOW 0x066D
+#define LANGUAGE_USER_KHANTY 0x066E
+#define LANGUAGE_USER_LIVONIAN 0x066F
+#define LANGUAGE_USER_MOKSHA 0x0670
+#define LANGUAGE_USER_MARI_HILL 0x0671
+#define LANGUAGE_USER_NGANASAN 0x0672
+#define LANGUAGE_USER_OLONETS 0x0673
+#define LANGUAGE_USER_VEPS 0x0674
+#define LANGUAGE_USER_VORO 0x0675
+#define LANGUAGE_USER_NENETS 0x0676
+#define LANGUAGE_USER_PAPIAMENTU_CURACAO 0x8479 /* makeLangID( 0x21, getPrimaryLanguage( LANGUAGE_PAPIAMENTU)) */
+#define LANGUAGE_USER_PAPIAMENTU_BONAIRE 0x8879 /* makeLangID( 0x22, getPrimaryLanguage( LANGUAGE_PAPIAMENTU)) */
+#define LANGUAGE_USER_AKA 0x0677
+#define LANGUAGE_USER_AKA_CONGO 0x8277 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_USER_AKA)) */
+#define LANGUAGE_USER_DIBOLE 0x0678
+#define LANGUAGE_USER_DOONDO 0x0679
+#define LANGUAGE_USER_KAAMBA 0x067A
+#define LANGUAGE_USER_KOONGO 0x067B
+#define LANGUAGE_USER_KOONGO_CONGO 0x827B /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_USER_KOONGO)) */
+#define LANGUAGE_USER_KUNYI 0x067C
+#define LANGUAGE_USER_NGUNGWEL 0x067D
+#define LANGUAGE_USER_NJYEM 0x067E
+#define LANGUAGE_USER_NJYEM_CONGO 0x827E /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_USER_NJYEM)) */
+#define LANGUAGE_USER_PUNU 0x067F
+#define LANGUAGE_USER_PUNU_CONGO 0x827F /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_USER_PUNU)) */
+#define LANGUAGE_USER_SUUNDI 0x0680
+#define LANGUAGE_USER_TEKE_KUKUYA 0x0681
+#define LANGUAGE_USER_TSAANGI 0x0682
+#define LANGUAGE_USER_YAKA 0x0683
+#define LANGUAGE_USER_YOMBE 0x0684
+#define LANGUAGE_USER_YOMBE_CONGO 0x8284 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_USER_YOMBE)) */
+#define LANGUAGE_USER_SIDAMA 0x0685
+
+#define LANGUAGE_USER_PRIV_JOKER 0xFFEB /* privateuse "*" (sic! bad! nasty!), primary 0x3eb, sub 0x3f */
+#define LANGUAGE_USER_PRIV_COMMENT 0xFFEC /* privateuse "x-comment", primary 0x3ec, sub 0x3f */
+#define LANGUAGE_USER_PRIV_DEFAULT 0xFFED /* privateuse "x-default", primary 0x3ed, sub 0x3f */
+#define LANGUAGE_USER_PRIV_NOTRANSLATE 0xFFEE /* privateuse "x-no-translate" (sic!), primary 0x3ee, sub 0x3f */
+#define LANGUAGE_MULTIPLE 0xFFEF /* multiple languages, primary 0x3ef, sub 0x3f */
+#define LANGUAGE_UNDETERMINED 0xFFF0 /* undetermined language, primary 0x3f0, sub 0x3f */
+#define LANGUAGE_USER_SYSTEM_CONFIG 0xFFFE /* not a locale, to be used only in configuration context to obtain system default, primary 0x3fe, sub 0x3f */
+
+#endif /* INCLUDED_I18NLANGTAG_LANG_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nlangtag/languagetag.hxx b/include/i18nlangtag/languagetag.hxx
new file mode 100644
index 000000000000..e5ba011ab2ba
--- /dev/null
+++ b/include/i18nlangtag/languagetag.hxx
@@ -0,0 +1,400 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_I18NLANGTAG_LANGUAGETAG_HXX
+#define INCLUDED_I18NLANGTAG_LANGUAGETAG_HXX
+
+#include <sal/config.h>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+#include <i18nlangtag/i18nlangtagdllapi.h>
+#include <i18nlangtag/lang.h>
+
+#include <vector>
+
+typedef struct _rtl_Locale rtl_Locale; // as in rtl/locale.h
+
+
+/** Wrapper for liblangtag BCP 47 language tags, MS-LangIDs, locales and
+ conversions in between.
+
+ Note that member variables are mutable and may change their values even in
+ const methods. Getter methods return either the original value or matching
+ converted values.
+ */
+class I18NLANGTAG_DLLPUBLIC LanguageTag
+{
+public:
+
+ /** Init LanguageTag with existing BCP 47 language tag string.
+
+ @param bCanonicalize
+ If TRUE, canonicalize tag and reparse, the resulting tag string may
+ be different.
+ IF FALSE, the tag is simply stored and can be retrieved with
+ getBcp47().
+
+ Note that conversions to ISO codes, locales or LanguageType or
+ obtaining language or script will canonicalize the tag string anyway,
+ so specifying bCanonicalize=false is not a guarantee that the tag will
+ stay identical to what was passed.
+ */
+ explicit LanguageTag( const OUString & rBcp47LanguageTag, bool bCanonicalize = false );
+
+ /** Init LanguageTag with Locale. */
+ explicit LanguageTag( const com::sun::star::lang::Locale & rLocale );
+
+ /** Init LanguageTag with LanguageType MS-LangID. */
+ explicit LanguageTag( LanguageType nLanguage );
+
+ /** Init LanguageTag with language and country strings.
+
+ This is a convenience ctor for places that so far use only language and
+ country to replace the MsLangId::convert...IsoNames...() calls. Avoid
+ use in new code.
+ */
+ explicit LanguageTag( const OUString& rLanguage, const OUString& rCountry );
+
+ /** Init LanguageTag with rtl_Locale.
+
+ This is a convenience ctor.
+ */
+ explicit LanguageTag( const rtl_Locale & rLocale );
+
+ LanguageTag( const LanguageTag & rLanguageTag );
+ ~LanguageTag();
+ LanguageTag& operator=( const LanguageTag & rLanguageTag );
+
+ /** Obtain BCP 47 language tag.
+
+ @param bResolveSystem
+ If TRUE, resolve an empty language tag denoting the system
+ locale to the real locale used.
+ If FALSE, return an empty OUString for such a tag.
+ */
+ const OUString & getBcp47( bool bResolveSystem = true ) const;
+
+ /** Obtain language tag as Locale.
+
+ As a convention, language tags that can not be expressed as "pure"
+ com::sun::star::lang::Locale content using Language and Country fields
+ store "qlt" (ISO 639 reserved for local use) in the Language field and
+ the entire BCP 47 language tag in the Variant field. The Country field
+ contains the corresponding ISO 3166 country code _if_ there is one, or
+ otherwise is empty.
+
+ @param bResolveSystem
+ If TRUE, resolve an empty language tag denoting the system
+ locale to the real locale used.
+ If FALSE, return an empty Locale for such a tag.
+ */
+ const com::sun::star::lang::Locale & getLocale( bool bResolveSystem = true ) const;
+
+ /** Obtain mapping to MS-LangID.
+
+ @param bResolveSystem
+ If TRUE, resolve an empty language tag denoting the system
+ locale to the real locale used.
+ If FALSE, return LANGUAGE_SYSTEM for such a tag.
+ */
+ LanguageType getLanguageType( bool bResolveSystem = true ) const;
+
+ /** Obtain ISO strings for language and country.
+
+ This is a convenience method for places that so far use only language and
+ country to replace the MsLangId::convert...IsoNames...() calls. Avoid
+ use in new code.
+
+ ATTENTION! May return empty strings if the language tag is not
+ expressable in valid ISO codes!
+
+ @see isIsoLocale()
+
+ Always resolves an empty tag to the system locale.
+ */
+ void getIsoLanguageCountry( OUString& rLanguage, OUString& rCountry ) const;
+
+ /** Get ISO 639 language code, or BCP 47 language.
+
+ Always resolves an empty tag to the system locale.
+ */
+ OUString getLanguage() const;
+
+ /** Get ISO 15924 script code, if not the default script according to
+ BCP 47. For default script an empty string is returned.
+
+ @see hasScript()
+
+ Always resolves an empty tag to the system locale.
+ */
+ OUString getScript() const;
+
+ /** Get combined language and script code, separated by '-' if
+ non-default script, if default script only language.
+
+ @see hasScript()
+
+ Always resolves an empty tag to the system locale.
+ */
+ OUString getLanguageAndScript() const;
+
+ /** Get ISO 3166 country alpha code. Empty if the BCP 47 tags denote a
+ region not expressable as 2 character country code.
+
+ Always resolves an empty tag to the system locale.
+ */
+ OUString getCountry() const;
+
+ /** Get BCP 47 region tag, which may be an ISO 3166 country alpha code or
+ any other BCP 47 region tag.
+
+ Always resolves an empty tag to the system locale.
+ */
+ OUString getRegion() const;
+
+ /** Get a GLIBC locale string.
+
+ Always resolves an empty tag to the system locale.
+
+ @param rEncoding
+ An encoding to be appended to language_country, for example
+ ".UTF-8" including the dot.
+
+ @return The resulting GLIBC locale string if it could be constructed,
+ if not an empty string is returned.
+ */
+ OUString getGlibcLocaleString( const OUString & rEncoding ) const;
+
+ /** If language tag has a non-default script specified.
+ */
+ bool hasScript() const;
+
+ /** If language tag is a locale that can be expressed using only ISO 639
+ language codes and ISO 3166 country codes, thus is convertible to a
+ conforming Locale struct without using extension mechanisms.
+
+ Note that an empty language tag or empty Locale::Language field or
+ LanguageType LANGUAGE_SYSTEM could be treated as a valid ISO locale in
+ some context, but here is not. If you want that ask for
+ aTag.isSystemLocale() || aTag.isIsoLocale()
+
+ Always resolves an empty tag to the system locale.
+ */
+ bool isIsoLocale() const;
+
+ /** If language tag is a locale that can be expressed using only ISO 639
+ language codes and ISO 15924 script codes and ISO 3166 country codes,
+ thus can be stored in an ODF document using only fo:language, fo:script
+ and fo:country attributes. If this is FALSE, the locale must be stored
+ as a <*:rfc-language-tag> element.
+
+ Always resolves an empty tag to the system locale.
+ */
+ bool isIsoODF() const;
+
+ /** If this is a valid BCP 47 language tag.
+
+ Always resolves an empty tag to the system locale.
+ */
+ bool isValidBcp47() const;
+
+ /** If this tag was contructed as an empty tag denoting the system locale.
+ */
+ bool isSystemLocale() const;
+
+
+ /** Reset with existing BCP 47 language tag string. See ctor. */
+ void reset( const OUString & rBcp47LanguageTag, bool bCanonicalize = false );
+
+ /** Reset with Locale. */
+ void reset( const com::sun::star::lang::Locale & rLocale );
+
+ /** Reset with LanguageType MS-LangID. */
+ void reset( LanguageType nLanguage );
+
+ /** Reset with rtl_Locale. */
+ void reset( const rtl_Locale & rLocale );
+
+
+ /** Fall back to a known locale.
+
+ If the current tag does not represent a known (by us) locale, fall back
+ to the most likely locale possible known.
+ If the current tag is known, no change occurs.
+ */
+ LanguageTag & makeFallback();
+
+ /** Return a vector of fall-back strings.
+
+ In order:
+ full BCP 47 tag, same as getBcp47()
+ lll-Ssss-CC
+ lll-Ssss
+ lll-CC
+ lll
+
+ Only strings that differ from a higher order are included, for example
+ if there is no script the elements will be bcp47, lll-CC, lll; if the
+ bcp47 string is identical to lll-CC then only lll-CC, lll.
+
+ Note that lll is only ISO 639-1/2 alpha code and CC is only ISO 3166
+ alpha code. If the region can not be expressed as ISO 3166 then no -CC
+ tags are included.
+ */
+ ::std::vector< OUString > getFallbackStrings() const;
+
+
+ /** @short search for an equal or at least for a similar locale in a list
+ of possible ones.
+
+ @descr First search for a locale that is equal to the reference
+ locale. (means: same BCP47 string)
+
+ If the reference locale could not be located, check for
+ "similar" locales, in the same order as obtained by
+ getFallbackStrings().
+
+ If no similar locale could be located, we search for a locale
+ "en-US" inside the given locale list.
+
+ If "en-US" could not be located, we search for a locale "en"
+ inside the given list.
+
+ If no "same" nor any "similar" locale could be found, we try
+ "x-default" and "x-no-translate" explicitly. Sometimes
+ variables don't use real localization. For example, in case the
+ localized value is a fix product name.
+
+ If no locale matched until then, we use any other locale that
+ exists inside the set of given ones, namely the first
+ encountered!
+
+ @param rList
+ the vector of possible locales as BCP47 strings.
+
+ @param rReference
+ the reference locale, BCP47 string.
+
+ @return An iterator that points to the found element inside the given
+ locale list. If no matching locale could be found it points to
+ the end of the list.
+ */
+ static ::std::vector< OUString >::const_iterator getFallback( const ::std::vector< OUString > & rList,
+ const OUString & rReference );
+
+
+ /** Test equality of two LanguageTag, possibly resolving system locale.
+
+ @param bResolveSystem
+ If TRUE, resolve empty language tags denoting the system
+ locale to the real locale used before comparing.
+ If FALSE, the behavior is identical to operator==(), system
+ locales are not resolved first.
+ */
+ bool equals( const LanguageTag & rLanguageTag, bool bResolveSystem = false ) const;
+
+ /** Test equality of two LanguageTag.
+
+ Does NOT resolve system, i.e. if the system locale is en-US
+ LanguageTag("")==LanguageTag("en-US") returns false! Use
+ equals(...,true) instead if system locales shall be resolved.
+ */
+ bool operator==( const LanguageTag & rLanguageTag ) const;
+
+ /** Test inequality of two LanguageTag.
+
+ Does NOT resolve system, i.e. if the system locale is en-US
+ LanguageTag("")!=LanguageTag("en-US") returns true! Use
+ !equals(,...true) instead if system locales shall be resolved.
+ */
+ bool operator!=( const LanguageTag & rLanguageTag ) const;
+
+private:
+
+ enum Decision
+ {
+ DECISION_DONTKNOW,
+ DECISION_NO,
+ DECISION_YES
+ };
+
+ mutable com::sun::star::lang::Locale maLocale;
+ mutable OUString maBcp47;
+ mutable OUString maCachedLanguage; ///< cache getLanguage()
+ mutable OUString maCachedScript; ///< cache getScript()
+ mutable OUString maCachedCountry; ///< cache getCountry()
+ mutable void* mpImplLangtag; ///< actually lt_tag_t pointer, encapsulated
+ mutable LanguageType mnLangID;
+ mutable Decision meIsValid;
+ mutable Decision meIsIsoLocale;
+ mutable Decision meIsIsoODF;
+ mutable Decision meIsLiblangtagNeeded; ///< whether processing with liblangtag needed
+ bool mbSystemLocale : 1;
+ mutable bool mbInitializedBcp47 : 1;
+ mutable bool mbInitializedLocale : 1;
+ mutable bool mbInitializedLangID : 1;
+ mutable bool mbCachedLanguage : 1;
+ mutable bool mbCachedScript : 1;
+ mutable bool mbCachedCountry : 1;
+ bool mbIsFallback : 1;
+
+ void convertLocaleToBcp47();
+ void convertLocaleToLang();
+ void convertBcp47ToLocale();
+ void convertBcp47ToLang();
+ void convertLangToLocale();
+ void convertLangToBcp47();
+
+ void convertFromRtlLocale();
+
+ bool canonicalize();
+
+ OUString getLanguageFromLangtag();
+ OUString getScriptFromLangtag();
+ OUString getRegionFromLangtag();
+
+ void resetVars();
+
+ /** Obtain Language, Script and Country via simpleExtract() and assign them
+ to the cached variables if successful.
+
+ @return return of simpleExtract()
+ */
+ bool cacheSimpleLSC();
+
+ static bool isIsoLanguage( const OUString& rLanguage );
+ static bool isIsoScript( const OUString& rScript );
+ static bool isIsoCountry( const OUString& rRegion );
+
+ enum Extraction
+ {
+ EXTRACTED_NONE,
+ EXTRACTED_LSC,
+ EXTRACTED_X,
+ EXTRACTED_X_JOKER
+ };
+
+ /** Of a simple language tag of the form lll[-Ssss][-CC] (i.e. one that
+ would fulfill the isIsoODF() condition) extract the portions.
+
+ Does not check case or content!
+
+ @return EXTRACTED_LSC if simple tag was detected, EXTRACTED_X if x-...
+ privateuse tag was detected, EXTRACTED_X_JOKER if "*" joker was
+ detected, else EXTRACTED_NONE.
+ */
+ static Extraction simpleExtract( const OUString& rBcp47,
+ OUString& rLanguage,
+ OUString& rScript,
+ OUString& rCountry );
+};
+
+#endif // INCLUDED_I18NLANGTAG_LANGUAGETAG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nlangtag/mslangid.hxx b/include/i18nlangtag/mslangid.hxx
new file mode 100644
index 000000000000..8148d1760de0
--- /dev/null
+++ b/include/i18nlangtag/mslangid.hxx
@@ -0,0 +1,309 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_I18NLANGTAG_MSLANGID_HXX
+#define INCLUDED_I18NLANGTAG_MSLANGID_HXX
+
+#include <sal/config.h>
+
+#include "i18nlangtag/i18nlangtagdllapi.h"
+#include "i18nlangtag/lang.h"
+#include <com/sun/star/lang/Locale.hpp>
+
+/** Methods related to Microsoft language IDs. For details about MS-LANGIDs
+ please see lang.h */
+class I18NLANGTAG_DLLPUBLIC MsLangId
+{
+public:
+
+ /// Create a LangID from a primary and a sublanguage.
+ static inline LanguageType makeLangID( LanguageType nSubLangId, LanguageType nPriLangId)
+ {
+ return (nSubLangId << 10) | nPriLangId;
+ }
+
+ /// Get the primary language of a LangID.
+ static inline LanguageType getPrimaryLanguage( LanguageType nLangID)
+ {
+ return nLangID & LANGUAGE_MASK_PRIMARY;
+ }
+
+ /// Get the sublanguage of a LangID.
+ static inline LanguageType getSubLanguage( LanguageType nLangID)
+ {
+ return (nLangID & ~LANGUAGE_MASK_PRIMARY) >> 10;
+ }
+
+ /** Language/locale of category LC_CTYPE (on Unix, else the system
+ language).
+ Evaluation order: LC_ALL, LC_CTYPE, LANG */
+ static LanguageType getSystemLanguage();
+
+ /** Language/locale of category LC_MESSAGES (on Unix, else same as
+ GetSystemLanguage()).
+ Evaluation order: LANGUAGE, LC_ALL, LC_MESSAGES, LANG */
+ static LanguageType getSystemUILanguage();
+
+
+ /** @short: A proper language/locale if the nLang parameter designates some
+ special value.
+
+ @descr: NOTE: The "system" values may be overridden by the
+ application's configuration.
+
+ @returns
+ case LANGUAGE_PROCESS_OR_USER_DEFAULT : configured or system language
+ case LANGUAGE_SYSTEM_DEFAULT : configured or system language
+ case LANGUAGE_SYSTEM : configured or system language
+ case LANGUAGE_HID_HUMAN_INTERFACE_DEVICE : configured or system UI language
+ case LANGUAGE_DONTKNOW : LANGUAGE_ENGLISH_US
+ else: nLang
+
+ In case the configured language is LANGUAGE_SYSTEM, which is also
+ the initial default, the system language is obtained. In case the
+ configured or resulting system language is LANGUAGE_DONTKNOW,
+ LANGUAGE_ENGLISH_US is returned instead.
+ */
+ static LanguageType getRealLanguage( LanguageType nLang );
+
+
+ // TODO: refactor to LanguageTag? Used only in
+ // i18npool/source/localedata/localedata.cxx
+
+ /** Get fall-back Locale for Locale with handling of an empty language name
+ designating the SYSTEM language. Returns the same Locale if an exact
+ match was found.
+ */
+ static ::com::sun::star::lang::Locale getFallbackLocale(
+ const ::com::sun::star::lang::Locale & rLocale );
+
+
+ // TODO: refactor to LanguageTag, used only in
+ // i18npool/source/isolang/inunx.cxx to convert Unix locale string
+
+ static LanguageType convertUnxByteStringToLanguage( const OString& rString );
+
+
+ static LanguageType resolveSystemLanguageByScriptType( LanguageType nLang, sal_Int16 nType );
+
+
+ /** Whether locale has a Right-To-Left orientation. */
+ static bool isRightToLeft( LanguageType nLang );
+
+ /** Whether locale is a CJK locale */
+ static bool isCJK( LanguageType nLang );
+
+ /** Whether locale is a chinese locale */
+ static bool isChinese( LanguageType nLang );
+
+ /** Whether locale is a simplified chinese locale */
+ static bool isSimplifiedChinese( LanguageType nLang );
+
+ /** Whether locale is a traditional chinese locale */
+ static bool isTraditionalChinese( LanguageType nLang );
+
+ /** Whether locale is a korean locale */
+ static bool isKorean( LanguageType nLang );
+
+ /** Whether locale is a simplified chinese locale */
+ static bool isSimplifiedChinese( const ::com::sun::star::lang::Locale & rLocale );
+
+ /** Whether locale is a traditional chinese locale */
+ static bool isTraditionalChinese( const ::com::sun::star::lang::Locale & rLocale );
+
+ /** Whether locale is one where family name comes first, e.g. Japan, Hungary, Samoa */
+ static bool isFamilyNameFirst( LanguageType nLang );
+
+ /** Whether there are "forbidden characters at start or end of line" in
+ this locale. CJK locales.
+
+ @see offapi/com/sun/star/i18n/ForbiddenCharacters.idl
+ */
+ static bool hasForbiddenCharacters( LanguageType nLang );
+
+
+ /** Whether locale needs input sequence checking. CTL locales. */
+ static bool needsSequenceChecking( LanguageType nLang );
+
+
+ /** Get ::com::sun::star::i18n::ScriptType of locale. */
+ static sal_Int16 getScriptType( LanguageType nLang );
+
+
+ /** Map an obsolete user defined LANGID (see lang.h
+ LANGUAGE_OBSOLETE_USER_...) to the new value defined by MS in the
+ meantime.
+
+ Also used to map UI localizations using reserved ISO codes to something
+ "official" but not identical in order to not pollute documents with
+ invalid ISO codes.
+
+ @param bUserInterfaceSelection
+ If TRUE, don't replace such UI-only locale. Only use for
+ Tools->Options->LanguageSettings->UserInterface listbox.
+ If FALSE, do replace.
+ */
+ static LanguageType getReplacementForObsoleteLanguage( LanguageType nLang,
+ bool bUserInterfaceSelection = false );
+
+
+ /** @ATTENTION: these are _ONLY_ to be called by the application's
+ configuration! */
+ static void setConfiguredSystemLanguage( LanguageType nLang );
+ static void setConfiguredSystemUILanguage( LanguageType nLang );
+ static void setConfiguredWesternFallback( LanguageType nLang );
+ static void setConfiguredComplexFallback( LanguageType nLang );
+ static void setConfiguredAsianFallback( LanguageType nLang );
+
+// ---------------------------------------------------------------------------
+
+ /** @internal - Access to fields of an element of the simple conversion table.
+ For resource compiler build environment usage only! */
+ struct IsoLangEntry
+ {
+ LanguageType mnLang;
+ sal_Char maLangStr[4];
+ sal_Char maCountry[3];
+
+ /** Obtain a language tag string with '-' separator. */
+ I18NLANGTAG_DLLPUBLIC OUString getTagString() const;
+ };
+
+ /** @internal - Return a pointer to the IsoLangEntry of the underlying table,
+ matching the offset passed by nIndex. Only meaningful for the resource
+ compiler to build a list of known languages.
+
+ @returns address of IsoLangEntry, or NULL pointer if nIndex exceeds the
+ table elements' count.
+ */
+ static const IsoLangEntry* getIsoLangEntry( size_t nIndex );
+
+// ---------------------------------------------------------------------------
+
+ /** Encapsulated conversion methods used by LanguageTag and conversions,
+ not to be used by anything else.
+ */
+ class Conversion
+ {
+ private:
+
+ friend class LanguageTag;
+
+ friend ::com::sun::star::lang::Locale MsLangId::getFallbackLocale(
+ const ::com::sun::star::lang::Locale & rLocale );
+
+ friend LanguageType MsLangId::convertUnxByteStringToLanguage(
+ const OString& rString );
+
+
+ /** Convert a Locale to a LanguageType with handling of an empty
+ language name designating LANGUAGE_SYSTEM.
+ */
+ I18NLANGTAG_DLLPRIVATE static LanguageType convertLocaleToLanguage(
+ const ::com::sun::star::lang::Locale & rLocale );
+
+ /** Convert x-... privateuse, used by convertLocaleToLanguage(Locale) */
+ I18NLANGTAG_DLLPRIVATE static LanguageType convertPrivateUseToLanguage(
+ const OUString& rPriv );
+
+ /** Used by convertLocaleToLanguage(Locale) */
+ I18NLANGTAG_DLLPRIVATE static LanguageType convertIsoNamesToLanguage(
+ const OUString& rLang, const OUString& rCountry );
+
+
+ /** Used by convertUnxByteStringToLanguage(OString) */
+ I18NLANGTAG_DLLPRIVATE static LanguageType convertIsoNamesToLanguage(
+ const OString& rLang, const OString& rCountry );
+
+
+ /** Convert a LanguageType to a Locale.
+
+ @param bResolveSystem
+ If bResolveSystem==true, a LANGUAGE_SYSTEM is resolved.
+ If bResolveSystem==false, a LANGUAGE_SYSTEM results in an
+ empty Locale.
+ */
+ I18NLANGTAG_DLLPRIVATE static ::com::sun::star::lang::Locale convertLanguageToLocale(
+ LanguageType nLang, bool bResolveSystem );
+
+ /** Convert a LanguageType to a Locale, resolving LANGUAGE_SYSTEM.
+
+ Used by convertLanguageToLocale(LanguageType,bool)
+ */
+ I18NLANGTAG_DLLPRIVATE static void convertLanguageToLocale(
+ LanguageType nLang, ::com::sun::star::lang::Locale & rLocale );
+
+ /** Used by convertLanguageToLocale(LanguageType,Locale) */
+ I18NLANGTAG_DLLPRIVATE static void convertLanguageToIsoNames(
+ LanguageType nLang, OUString& rLangStr, OUString& rCountry );
+
+
+ I18NLANGTAG_DLLPRIVATE static LanguageType lookupFallbackLanguage( LanguageType nLang );
+
+ I18NLANGTAG_DLLPRIVATE static ::com::sun::star::lang::Locale lookupFallbackLocale(
+ const ::com::sun::star::lang::Locale & rLocale );
+
+
+ /** Convert a LanguageType to a Locale, resolving LANGUAGE_SYSTEM,
+ falling back to a default locale if no exact match was found.
+
+ Used by getFallbackLocale(Locale)
+ */
+ I18NLANGTAG_DLLPRIVATE static ::com::sun::star::lang::Locale convertLanguageToLocaleWithFallback(
+ LanguageType nLang );
+
+ /** Used by convertLanguageToLocaleWithFallback(LanguageType) */
+ I18NLANGTAG_DLLPRIVATE static ::com::sun::star::lang::Locale lookupFallbackLocale(
+ LanguageType nLang );
+ };
+
+private:
+
+ static LanguageType nConfiguredSystemLanguage;
+ static LanguageType nConfiguredSystemUILanguage;
+
+ static LanguageType nConfiguredWesternFallback;
+ static LanguageType nConfiguredAsianFallback;
+ static LanguageType nConfiguredComplexFallback;
+
+ static LanguageType getPlatformSystemLanguage();
+ static LanguageType getPlatformSystemUILanguage();
+
+ // Substitute LANGUAGE_SYSTEM for LANGUAGE_SYSTEM_DEFAULT and
+ // LANGUAGE_PROCESS_OR_USER_DEFAULT, other values aren't touched.
+ I18NLANGTAG_DLLPRIVATE static inline LanguageType simplifySystemLanguages( LanguageType nLang );
+};
+
+
+// static
+inline LanguageType MsLangId::getSystemLanguage()
+{
+ return getPlatformSystemLanguage();
+}
+
+
+// static
+inline LanguageType MsLangId::getSystemUILanguage()
+{
+ return getPlatformSystemUILanguage();
+}
+
+#endif // INCLUDED_I18NLANGTAG_MSLANGID_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nutil/casefolding.hxx b/include/i18nutil/casefolding.hxx
new file mode 100644
index 000000000000..a0867d1e687c
--- /dev/null
+++ b/include/i18nutil/casefolding.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_I18NUTIL_CASEFOLDING_HXX
+#define INCLUDED_I18NUTIL_CASEFOLDING_HXX
+
+#include <sal/types.h>
+#include <com/sun/star/i18n/TransliterationModules.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include "i18nutildllapi.h"
+
+namespace com { namespace sun { namespace star { namespace i18n {
+
+#define MappingTypeLowerToUpper (1 << 0) // Upper to Lower mapping
+#define MappingTypeUpperToLower (1 << 1) // Lower to Upper mapping
+#define MappingTypeToUpper (1 << 2) // to Upper mapping
+#define MappingTypeToLower (1 << 3) // to Lower mapping
+#define MappingTypeToTitle (1 << 4) // to Title mapping
+#define MappingTypeSimpleFolding (1 << 5) // Simple Case Folding
+#define MappingTypeFullFolding (1 << 6) // Full Case Folding
+#define MappingTypeMask (MappingTypeLowerToUpper|MappingTypeUpperToLower|\
+ MappingTypeToUpper|MappingTypeToLower|MappingTypeToTitle|\
+ MappingTypeSimpleFolding|MappingTypeFullFolding)
+
+#define ValueTypeNotValue (1 << 7) // Value field is an address
+
+#define CasedLetter (MappingTypeMask) // for final sigmar
+
+struct Value
+{
+ sal_uInt8 type;
+ sal_uInt16 value; // value or address, depend on the type
+};
+
+struct Mapping
+{
+ sal_uInt8 type;
+ sal_Int8 nmap;
+#define NMAPPINGMAX 3
+ sal_Unicode map[NMAPPINGMAX];
+}; // for Unconditional mapping
+
+struct MappingElement
+{
+ MappingElement() {element.nmap = current = 0;}
+ Mapping element;
+ sal_Int8 current;
+};
+
+class I18NUTIL_DLLPUBLIC casefolding
+{
+public:
+ static Mapping& getValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 len, com::sun::star::lang::Locale& aLocale, sal_uInt8 nMappingType) throw (com::sun::star::uno::RuntimeException);
+ static Mapping& getConditionalValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 len, com::sun::star::lang::Locale& aLocale, sal_uInt8 nMappingType) throw (com::sun::star::uno::RuntimeException);
+ static sal_Unicode getNextChar(const sal_Unicode *str, sal_Int32& idx, sal_Int32 len, MappingElement& e, com::sun::star::lang::Locale& aLocale,sal_uInt8 nMappingtype, TransliterationModules moduleLoaded) throw (com::sun::star::uno::RuntimeException);
+
+};
+
+} } } }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nutil/i18nutildllapi.h b/include/i18nutil/i18nutildllapi.h
new file mode 100644
index 000000000000..b208b51e9ee0
--- /dev/null
+++ b/include/i18nutil/i18nutildllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_I18NUTILDLLAPI_H
+#define INCLUDED_I18NUTILDLLAPI_H
+
+#include "sal/types.h"
+
+#if defined(I18NUTIL_DLLIMPLEMENTATION)
+#define I18NUTIL_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define I18NUTIL_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define I18NUTIL_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif /* INCLUDED_I18NUTILDLLAPI_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nutil/oneToOneMapping.hxx b/include/i18nutil/oneToOneMapping.hxx
new file mode 100644
index 000000000000..533e4ad52c59
--- /dev/null
+++ b/include/i18nutil/oneToOneMapping.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_I18NUTIL_TRANSLITERATION_ONETOONEMAPPING_HXX
+#define INCLUDED_I18NUTIL_TRANSLITERATION_ONETOONEMAPPING_HXX
+
+#include <boost/noncopyable.hpp>
+#include <rtl/ustring.hxx>
+#include "i18nutildllapi.h"
+
+namespace com { namespace sun { namespace star { namespace i18n {
+
+class widthfolding;
+
+struct OneToOneMappingTable_t
+{
+ sal_Unicode first;
+ sal_Unicode second;
+};
+
+typedef sal_Int8 UnicodePairFlag;
+struct UnicodePairWithFlag
+{
+ sal_Unicode first;
+ sal_Unicode second;
+ UnicodePairFlag flag;
+};
+
+class I18NUTIL_DLLPUBLIC oneToOneMapping : private boost::noncopyable
+{
+public:
+ oneToOneMapping( OneToOneMappingTable_t *rpTable, const size_t rnSize, const size_t rnUnitSize = sizeof(OneToOneMappingTable_t) );
+ virtual ~oneToOneMapping();
+
+ // binary search
+ virtual sal_Unicode find( const sal_Unicode nKey ) const;
+
+ // translator
+ sal_Unicode operator[] ( const sal_Unicode nKey ) const { return find( nKey ); };
+
+protected:
+ OneToOneMappingTable_t *mpTable;
+ size_t mnSize;
+};
+
+class I18NUTIL_DLLPUBLIC oneToOneMappingWithFlag : public oneToOneMapping
+{
+ friend class widthfolding;
+
+public:
+ oneToOneMappingWithFlag( UnicodePairWithFlag *rpTableWF, const size_t rnSize, const UnicodePairFlag rnFlag );
+ virtual ~oneToOneMappingWithFlag();
+
+ // make index for fast search
+ void makeIndex();
+
+ // index search
+ virtual sal_Unicode find( const sal_Unicode nKey ) const;
+protected:
+ UnicodePairWithFlag *mpTableWF;
+ UnicodePairFlag mnFlag;
+ UnicodePairWithFlag **mpIndex[256];
+ bool mbHasIndex;
+};
+
+} } } }
+
+#endif // _I18N_TRANSLITERATION_ONETOONEMAPPING_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nutil/paper.hxx b/include/i18nutil/paper.hxx
new file mode 100644
index 000000000000..8847b294fbdb
--- /dev/null
+++ b/include/i18nutil/paper.hxx
@@ -0,0 +1,148 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_I18NUTIL_PAPER_HXX
+#define INCLUDED_I18NUTIL_PAPER_HXX
+
+#include "i18nutildllapi.h"
+#include <rtl/string.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+
+//!! WARNING: be aware of cui/source/tabpages/page.h where someone had the broken idea
+//!! of duplicating the values of this enum in order to use those defines within
+//!! src files.
+//!! Thus don't reorder the enum values here without changing the code there as well.
+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_4_3,
+ 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_SCREEN_16_9,
+ PAPER_SCREEN_16_10
+};
+
+// defined for 'equal size' test with the implementation array
+#define NUM_PAPER_ENTRIES (PAPER_SCREEN_16_10 - PAPER_A0 + 1)
+
+// ---------
+// - Paper -
+// ---------
+
+class I18NUTIL_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 OString &rName);
+ static OString toPSName(Paper eType);
+
+ static long sloppyFitPageDimension(long nDimension);
+};
+
+#endif // INCLUDED_I18NUTIL_PAPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nutil/scripttypedetector.hxx b/include/i18nutil/scripttypedetector.hxx
new file mode 100644
index 000000000000..cf3b9b71e11b
--- /dev/null
+++ b/include/i18nutil/scripttypedetector.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _I18N_SCRIPTTYPEDETECTOR_HXX_
+#define _I18N_SCRIPTTYPEDETECTOR_HXX_
+
+#include "i18nutildllapi.h"
+#include <rtl/ustring.hxx>
+
+class I18NUTIL_DLLPUBLIC ScriptTypeDetector
+{
+public:
+ static sal_Int32 beginOfScriptDirection( const OUString& Text, sal_Int32 nPos, sal_Int16 scriptDirection );
+ static sal_Int32 endOfScriptDirection( const OUString& Text, sal_Int32 nPos, sal_Int16 scriptDirection );
+ static sal_Int16 getScriptDirection( const OUString& Text, sal_Int32 nPos, sal_Int16 defaultScriptDirection );
+ static sal_Int32 beginOfCTLScriptType( const OUString& Text, sal_Int32 nPos );
+ static sal_Int32 endOfCTLScriptType( const OUString& Text, sal_Int32 nPos );
+ static sal_Int16 getCTLScriptType( const OUString& Text, sal_Int32 nPos );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nutil/unicode.hxx b/include/i18nutil/unicode.hxx
new file mode 100644
index 000000000000..7da0f5329803
--- /dev/null
+++ b/include/i18nutil/unicode.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_I18NUTIL_UNICODE_HXX
+#define INCLUDED_I18NUTIL_UNICODE_HXX
+
+#include <com/sun/star/i18n/UnicodeScript.hpp>
+#include <sal/types.h>
+#include <unicode/uscript.h>
+#include "i18nutildllapi.h"
+
+typedef struct _ScriptTypeList {
+ sal_Int16 from;
+ sal_Int16 to;
+ sal_Int16 value;
+} ScriptTypeList;
+
+class I18NUTIL_DLLPUBLIC unicode
+{
+public:
+
+ static sal_Int16 SAL_CALL getUnicodeType( const sal_Unicode ch );
+ static sal_Int16 SAL_CALL getUnicodeScriptType( const sal_Unicode ch, ScriptTypeList *typeList = NULL, sal_Int16 unknownType = 0 );
+ static sal_Unicode SAL_CALL getUnicodeScriptStart(com::sun::star::i18n::UnicodeScript type);
+ static sal_Unicode SAL_CALL getUnicodeScriptEnd(com::sun::star::i18n::UnicodeScript type);
+ static sal_uInt8 SAL_CALL getUnicodeDirection( const sal_Unicode ch );
+ static sal_Bool SAL_CALL isUpper( const sal_Unicode ch);
+ static sal_Bool SAL_CALL isLower( const sal_Unicode ch);
+ static sal_Bool SAL_CALL isDigit( const sal_Unicode ch);
+ static sal_Bool SAL_CALL isControl( const sal_Unicode ch);
+ static sal_Bool SAL_CALL isPrint( const sal_Unicode ch);
+ static sal_Bool SAL_CALL isAlpha( const sal_Unicode ch);
+ static sal_Bool SAL_CALL isSpace( const sal_Unicode ch);
+ static sal_Bool SAL_CALL isWhiteSpace( const sal_Unicode ch);
+ static sal_Bool SAL_CALL isAlphaDigit( const sal_Unicode ch);
+
+ //Map an ISO 15924 script code to Latin/Asian/Complex/Weak
+ static sal_Int16 SAL_CALL getScriptClassFromUScriptCode(UScriptCode eScript);
+
+ //Return a language that can be written in a given ISO 15924 script code
+ static OString SAL_CALL getExemplerLanguageForUScriptCode(UScriptCode eScript);
+};
+
+#endif
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nutil/widthfolding.hxx b/include/i18nutil/widthfolding.hxx
new file mode 100644
index 000000000000..481239deca88
--- /dev/null
+++ b/include/i18nutil/widthfolding.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_I18NUTIL_WIDTHFOLDING_HXX
+#define INCLUDED_I18NUTIL_WIDTHFOLDING_HXX
+
+#include <sal/types.h>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <i18nutil/oneToOneMapping.hxx>
+#include "i18nutildllapi.h"
+
+namespace com { namespace sun { namespace star { namespace i18n {
+
+#define WIDTHFOLDNIG_DONT_USE_COMBINED_VU 0x01
+
+class I18NUTIL_DLLPUBLIC widthfolding
+{
+public:
+ static oneToOneMapping& getfull2halfTable();
+ static oneToOneMapping& gethalf2fullTable();
+
+ static oneToOneMapping& getfull2halfTableForASC();
+ static oneToOneMapping& gethalf2fullTableForJIS();
+
+ static oneToOneMapping& getfullKana2halfKanaTable();
+ static oneToOneMapping& gethalfKana2fullKanaTable();
+
+ static OUString decompose_ja_voiced_sound_marks(const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset, sal_Bool useOffset);
+ static sal_Unicode decompose_ja_voiced_sound_marksChar2Char (sal_Unicode inChar);
+ static OUString compose_ja_voiced_sound_marks(const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset, sal_Bool useOffset, sal_Int32 nFlags = 0 );
+ static sal_Unicode getCompositionChar(sal_Unicode c1, sal_Unicode c2);
+};
+
+
+} } } }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/jvmaccess/classpath.hxx b/include/jvmaccess/classpath.hxx
new file mode 100644
index 000000000000..1cc8d83ab348
--- /dev/null
+++ b/include/jvmaccess/classpath.hxx
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_JVMACCESS_CLASSPATH_HXX
+#define INCLUDED_JVMACCESS_CLASSPATH_HXX
+
+#include "jvmaccessdllapi.h"
+#include "sal/config.h"
+#include "com/sun/star/uno/Reference.hxx"
+
+#include "jni.h"
+
+namespace com { namespace sun { namespace star { namespace uno {
+ class XComponentContext;
+} } } }
+
+namespace jvmaccess {
+
+/**
+ Helper functions for class path handling.
+*/
+class JVMACCESS_DLLPUBLIC ClassPath {
+public:
+ /**
+ translates a class path into a java.net.URL[] instance.
+
+ @param context
+ a component context; must not be null.
+
+ @param environment
+ a JNI environment; must not be null.
+
+ @param classPath
+ a list of zero or more internal (see the
+ com.sun.star.uri.ExternalUriReferenceTranslator service) URI references,
+ where any space characters (U+0020) are ignored (and, in particular,
+ separate adjacent URI references). Any vnd.sun.star.expand URL
+ references in the list are expanded using the
+ com.sun.star.util.theMacroExpander singleton of the given context.
+
+ @returns
+ a local reference to a java.net.URL[] instance containing the external
+ (see the com.sun.star.uri.ExternalUriReferenceTranslator service)
+ equivalents of all the URI references in the given classPath. If null, a
+ (still pending) JNI exception occurred.
+
+ @throws com::sun::star::uno::RuntimeException
+ */
+ static inline ::jobjectArray
+ translateToUrls(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & context,
+ ::JNIEnv * environment, OUString const & classPath)
+ {
+ return
+ static_cast< ::jobjectArray >(
+ doTranslateToUrls(context, environment, classPath));
+ }
+
+ /**
+ loads a class via a java.net.URLClassLoader.
+
+ @param context
+ a component context; must not be null.
+
+ @param environment
+ a JNI environment; must not be null.
+
+ @param classPath
+ a list of zero or more internal (see the
+ com.sun.star.uri.ExternalUriReferenceTranslator service) URI references,
+ where any space characters (U+0020) are ignored (and, in particular,
+ separate adjacent URI references). Any vnd.sun.star.expand URL
+ references in the list are expanded using the
+ com.sun.star.util.theMacroExpander singleton of the given context.
+
+ @param name
+ the Java binary name of the class to load.
+
+ @returns
+ a local reference to a java.lang.Class instance. If null, a (still
+ pending) JNI exception occurred.
+
+ @throws com::sun::star::uno::RuntimeException
+ */
+ static inline ::jclass loadClass(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & context,
+ ::JNIEnv * environment, OUString const & classPath,
+ OUString const & name)
+ {
+ return
+ static_cast< ::jclass >(
+ doLoadClass(context, environment, classPath, name));
+ }
+
+private:
+ ClassPath(); // not defined
+ ClassPath(ClassPath &); // not defined
+ ~ClassPath(); // not defined
+ void operator =(ClassPath &); // not defined
+
+ // Functions that replace JNIEnv, jobjectArray, and jclass with void *, so
+ // that their mangled C++ names do not depend on the JDK version used at
+ // compile time:
+
+ static void * doTranslateToUrls(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & context,
+ void * environment, OUString const & classPath);
+
+ static void * doLoadClass(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & context,
+ void * environment, OUString const & classPath,
+ OUString const & name);
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/jvmaccess/jvmaccessdllapi.h b/include/jvmaccess/jvmaccessdllapi.h
new file mode 100644
index 000000000000..0f6651b5dbf8
--- /dev/null
+++ b/include/jvmaccess/jvmaccessdllapi.h
@@ -0,0 +1,24 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_JVMACCESS_JVMACCESSDLLAPI_H
+#define INCLUDED_JVMACCESS_JVMACCESSDLLAPI_H
+
+#include <sal/types.h>
+
+#if defined JVMACCESS_DLLIMPLEMENTATION
+# define JVMACCESS_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+# define JVMACCESS_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define JVMACCESS_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/jvmaccess/unovirtualmachine.hxx b/include/jvmaccess/unovirtualmachine.hxx
new file mode 100644
index 000000000000..4d618d14d863
--- /dev/null
+++ b/include/jvmaccess/unovirtualmachine.hxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_JVMACCESS_UNOVIRTUALMACHINE_HXX
+#define INCLUDED_JVMACCESS_UNOVIRTUALMACHINE_HXX
+
+#include "jvmaccessdllapi.h"
+#include "sal/config.h"
+#include "salhelper/simplereferenceobject.hxx"
+#include "rtl/ref.hxx"
+
+namespace jvmaccess {
+
+class VirtualMachine;
+
+/** An encapsulating wrapper around a Java virtual machine and an appropriate
+ UNO class loader.
+ */
+class JVMACCESS_DLLPUBLIC UnoVirtualMachine: public salhelper::SimpleReferenceObject {
+public:
+ /** An exception indicating failure to create a UnoVirtualMachine.
+ */
+ class JVMACCESS_DLLPUBLIC CreationException
+ {
+ public:
+ CreationException();
+
+ CreationException(CreationException const &);
+
+ virtual ~CreationException();
+
+ CreationException & operator =(CreationException const &);
+ };
+
+ /** Create a wrapper around a Java virtual machine and an appropriate UNO
+ class loader.
+
+ @param virtualMachine
+ A Java virtual machine wrapper. Must not be null.
+
+ @param classLoader
+ A local or global JNI reference, relative to the given virtualMachine,
+ to an appropriate UNO class loader instance. Must not be null. This
+ parameter should be of type jobject, not void *, but the exact
+ definition of jobject is different for different JDK versions, so that
+ the mangled C++ name of the constructor would depend on the JDK version
+ used at compile time.
+
+ @exception CreationException
+ Thrown in case creation fails (due to a JNI problem).
+ */
+ UnoVirtualMachine(
+ rtl::Reference< jvmaccess::VirtualMachine > const & virtualMachine,
+ void * classLoader);
+
+ /** Get the Java virtual machine wrapper.
+
+ @return
+ The Java virtual machine wrapper. Will never be null.
+ */
+ rtl::Reference< jvmaccess::VirtualMachine > getVirtualMachine() const;
+
+ /** Get the UNO class loader.
+
+ @return
+ A global JNI reference to the UNO class loader. (The JNI reference must
+ not be deleted by client code.) Will never be null. This should be of
+ type jobject, not void *, but the exact definition of jobject is
+ different for different JDK versions, so that the mangled C++ name of
+ the function would depend on the JDK version used at compile time.
+ */
+ void * getClassLoader() const;
+
+private:
+ UnoVirtualMachine(UnoVirtualMachine &); // not defined
+ void operator =(UnoVirtualMachine &); // not defined
+
+ virtual ~UnoVirtualMachine();
+
+ rtl::Reference< jvmaccess::VirtualMachine > m_virtualMachine;
+ void * m_classLoader;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/jvmaccess/virtualmachine.hxx b/include/jvmaccess/virtualmachine.hxx
new file mode 100644
index 000000000000..57ac5ead39f4
--- /dev/null
+++ b/include/jvmaccess/virtualmachine.hxx
@@ -0,0 +1,151 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_JVMACCESS_VIRTUALMACHINE_HXX
+#define INCLUDED_JVMACCESS_VIRTUALMACHINE_HXX
+
+#include "jvmaccessdllapi.h"
+#include "rtl/ref.hxx"
+#include "salhelper/simplereferenceobject.hxx"
+
+#include "jni.h"
+
+namespace jvmaccess {
+
+/** An encapsulating wrapper around a Java virtual machine.
+ */
+class JVMACCESS_DLLPUBLIC VirtualMachine: public salhelper::SimpleReferenceObject
+{
+public:
+ /** A helper to attach a thread to a Java virtual machine.
+
+ @descr
+ Upon construction of a guard the current thread is attached to the
+ virtual machine, and upon destruction of the guard the thread is
+ detached again. For any one thread, multiple instances of this class
+ may be used in a stack-like fashion (care is taken to only really
+ detach the thread from the virtual machine upon destruction of the guard
+ at the bottom of the stack).
+ */
+ class JVMACCESS_DLLPUBLIC AttachGuard
+ {
+ public:
+ /** An exception indicating failure to create an AttachGuard.
+ */
+ class JVMACCESS_DLLPUBLIC CreationException
+ {
+ public:
+ CreationException();
+
+ CreationException(CreationException const &);
+
+ virtual ~CreationException();
+
+ CreationException & operator =(CreationException const &);
+ };
+
+ /** Attach the current thread to a virtual machine.
+
+ @param rMachine
+ The virtual machine to attach to. Must not be a null reference.
+
+ @exception CreationException
+ Thrown in case attaching fails (due to a JNI problem).
+ */
+ explicit AttachGuard(rtl::Reference< VirtualMachine > const & rMachine);
+
+ /** Detach the current thread from the virtual machine again.
+ */
+ ~AttachGuard();
+
+ /** Get a JNI environment pointer for the current thread.
+
+ @return
+ A valid JNI environment pointer. Will never be null.
+ */
+ inline JNIEnv * getEnvironment() const { return m_pEnvironment; }
+
+ private:
+ AttachGuard(AttachGuard &); // not implemented
+ void operator =(AttachGuard); // not implemented
+
+ rtl::Reference< VirtualMachine > m_xMachine;
+ JNIEnv * m_pEnvironment;
+ bool m_bDetach;
+ };
+
+ /** Create a wrapper around a Java virtual machine.
+
+ @param pVm
+ A JNI pointer to virtual machine. Must not be null.
+
+ @param nVersion
+ The JNI version of the virtual machine pointed to by pVm. Must be at
+ least JNI_VERSION_1_2. This parameter should be of type jint, not int,
+ but at least on some platforms the definition of jint changed from
+ JDK 1.3 (long) to JDK 1.4 (int), so that the mangled C++ name of the
+ constructor would depend on the JDK version used at compile time.
+
+ @param bDestroy
+ Whether to destroy the virtual machine when destructing the wrapper
+ (i.e., whether the wrapper owns the virtual machine pointed to by pVm).
+
+ @param pMainThreadEnv
+ A valid JNI environment pointer for the current thread; must not be
+ null. The current thread must be "initially attached" to the virtual
+ machine while this constructor is being called (i.e., it must be the
+ thread that has called JNI_CreateJavaVM in case the virtual machine has
+ been started via the JNI Invocation API, and it must not already have
+ called DetachCurrentThread; or it must be executing native code called
+ from a "primordial" virtual machine). This environment pointer was
+ formerly used to obtain a reference to the thread's current context
+ class loader (java.lang.Thread.getCurrentClassLoader; if later a native
+ thread was attached to the virtual machine, that thread's context class
+ loader would be null, so the AttachGuard first of all set it to the
+ saved value; this feature has been removed again for performance reasons
+ and because the default context class loader is often not useful, so
+ that code relying on a context class loader has to set one explicitly,
+ anyway). This parameter is currently unused (but may be used again in
+ the future).
+ */
+ VirtualMachine(JavaVM * pVm, int nVersion, bool bDestroy,
+ JNIEnv * pMainThreadEnv);
+
+private:
+ VirtualMachine(VirtualMachine &); // not implemented
+ void operator =(VirtualMachine); // not implemented
+
+ virtual ~VirtualMachine();
+
+ JNIEnv * attachThread(bool * pAttached) const;
+
+ void detachThread() const;
+
+ JavaVM * m_pVm;
+ jint m_nVersion;
+ bool m_bDestroy;
+
+ friend class AttachGuard; // to access attachThread, detachThread
+};
+
+}
+
+#endif // INCLUDED_JVMACCESS_VIRTUALMACHINE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/jvmfwk/framework.h b/include/jvmfwk/framework.h
new file mode 100644
index 000000000000..f1399e0b88f1
--- /dev/null
+++ b/include/jvmfwk/framework.h
@@ -0,0 +1,835 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/** @HTML */
+
+#ifndef INCLUDED_JVMFWK_FRAMEWORK_H
+#define INCLUDED_JVMFWK_FRAMEWORK_H
+
+#include "jvmfwkdllapi.h"
+#include "rtl/ustring.h"
+#include "osl/mutex.h"
+#include "jni.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @file
+ <p>This library can operate in two modes, application mode and direct mode.</p>
+
+
+ <h2>Application Mode</h2>
+ In application mode the Java related settings are stored in files.
+ There are currently three files which need to be accessed. They are determined
+ by bootstrap parameters:</p>
+ <dl>
+ <dt>UNO_JAVA_JFW_VENDOR_SETTINGS</dt>
+ <dd>contains vendor and version information about JREs as well as the
+ location of plugin-libraries which are responsible for providing information
+ about these JREs as well as starting the VMs.</dd>
+ <dt>UNO_JAVA_JFW_USER_DATA</dt>
+ <dd>The file contains settings for a particular user. One can use the macro
+ $SYSUSERCONFIG in the URL which expands to a directory whery the user's data are
+ kept. On UNIX this would be the home directory and on Windows some sub-directory
+ of the &quot;Documents and Settings&quot; folder.The content of this file is an
+ implementation detail and may change in the future.</dd>
+ <dt>UNO_JAVA_JFW_SHARED_DATA</dt>
+ <dd>The file contains settings valid for all users. If a user changes a setting
+ then it takes precedence over the setting from UNO_JAVA_JFW_SHARED_DATA.
+ The content of this file is an implementation detail and may change in the future.</dd>
+ </dl>
+
+ <p>The values for these parameters must be file URLs and include the file name, for
+ example:<br>
+ file:///d:/MyApp/javavendors.xml<br>
+ All files are XML files and must have the extension .xml.</p>
+ <p>
+ Modifying the shared settings is currently not supported by the framework. To provide
+ Java settings for all users one can run OOo and change the settings in the
+ options dialog. These settings are made persistent in the UNO_JAVA_JFW_USER_DATA.
+ The file can then be copied into the base installation.
+ Other users will use automatically these data but can override the settings in
+ the options dialog. This mechanism may change in the future.
+ </p>
+ <p>If shared Java settings are not supported by an application then it is not
+ necessary to specify the bootstrap parameter <code>UNO_JAVA_JFW_SHARED_DATA</code>.
+ </p>
+
+ <p>Setting the class path used by a Java VM should not be necesarry. The locations
+ of Jar files should be knows by a class loader. If a jar file depends on another
+ jar file then it can be referenced in the manifest file of the first jar. However,
+ a user may add jars to the class path by using this API. If it becomes necessary
+ to add files to the class path which is to be used by all users then one can use
+ the bootrap parameter UNO_JAVA_JFW_CLASSPATH_URLS. The value contains of file URLs
+ which must be separated by spaces.</p>
+
+
+ <h2>Direct Mode</h2>
+
+ <p>The direct mode is intended for a scenario where no configuration files
+ are available and a Java VM shall be run. That is,
+ the files containing the user and shared settings are not specified by the
+ bootstrap parameters UNO_JAVA_JFW_SHARED_DATA and UNO_JAVA_JFW_USER_DATA.
+ For example, tools, such as regcomp, may use this framework in a build
+ environment. Then one would want to use settings which have been specified
+ by the build environment. The framework would automatically use the
+ current settings when they change in the environment.
+ </p>
+
+ <p> Here are examples how regcomp could be invoked using bootstrap parameters:
+ </p>
+ <p>
+ regcomp -env:UNO_JAVA_JFW_JREHOME=file:///d:/j2re1.4.2
+ -env:&quot;UNO_JAVA_JFW_CLASSPATH=d:\\solver\\bin\\classes.jar;d:\\solver\\bin\\jurt.jar&quot;
+ -register ....
+ </p>
+ <p>If UNO_JAVA_JFW_VENDOR_SETTINGS is not set then a plugin library must be specified. For example:</p>
+ <p>
+ regcomp -env:UNO_JAVA_JFW_JREHOME=file:///d:/j2re1.4.2
+ -env:&quot;UNO_JAVA_JFW_CLASSPATH=d:\\solver\\bin\\classes.jar;d:\\solver\\bin\\jurt.jar&quot;
+ -env:UNO_JAVA_JFW_PLUGIN=file:\\solver\\bin\\libsunjavaplugin.dll -register ....
+ </p>
+ <p>Additionall parameters for the Java VM can be provided. For every parameter
+ a seperate bootstrap parameter must be specified. The names are
+ <code>UNO_JAVA_JFW_PARAMETER_X</code>, where X is 1,2, .. n. For example:</p>
+ <p>
+ regcomp -env:UNO_JAVA_JFW_PARAMETER_1=-Xdebug
+ -env:UNO_JAVA_JFW_PARAMETER_2=-Xrunjdwp:transport=dt_socket,server=y,address=8100
+ -env:UNO_JAVA_JFW_JREHOME=file:///d:/j2re1.4.2
+ -env:&quot;UNO_JAVA_JFW_CLASSPATH=d:\\solver\\bin\\classes.jar;d:\\solver\\bin\\jurt.jar&quot;
+ -register ....</p>
+ <p>
+ Here is a complete list of the bootstrap parameter for the direct mode:
+ </p>
+ <dl>
+ <dt>UNO_JAVA_JFW_JREHOME</dt>
+ <dd>Specifies a file URL to a JRE installation.It must ALWAYS be specified
+ in direct mode</dd>
+ <dt>UNO_JAVA_JFW_ENV_JREHOME</dt>
+ <dd>Setting this parameter, for example to &quot;1&quot; or &quot;true&quot;,
+ causes the framework to use the environment variable JAVA_HOME. It is expected
+ that JAVA_HOME contains a system path rather than a file URL. This parameter
+ and UNO_JAVA_JFW_JREHOME are mutually exclusive</dd>
+ <dt>UNO_JAVA_JFW_CLASSPATH</dt>
+ <dd>Contains the class path which is to be used by the VM. Special character,
+ such as '\','{','}','$' must be preceded with '\'. See documentation about the
+ bootstrap parameter.</dd>
+ <dt>UNO_JAVA_JFW_ENV_CLASSPATH</dt>
+ <dd>Setting this parameter,for example to &quot;1&quot; or &quot;true&quot;,
+ causes the framework to use the
+ environment variable CLASSPATH. If this variable and UNO_JAVA_JFW_CLASSPATH are
+ set then the class path is composed from UNO_JAVA_JFW_CLASSPATH and the environment
+ variable CLASSPATH.</dd>
+ <dt>UNO_JAVA_JFW_PLUGIN</dt>
+ <dd>Specified a file URL to a plugin library. If this variable is provided
+ then a javavendors.xml is ignored. It must be provided if no
+ javavendors.xml is available.</dd>
+ <dt>UNO_JAVA_JFW_PARAMETER_X</dt>
+ <dd>Specifies a parameter for the Java VM. The X is replaced by
+ non-negative natural numbers starting with 1.</dd>
+ </dl>
+
+ <p>A note about bootstrap parameters. The implementation of the bootstrap
+ parameter mechanism interprets the characters '\', '$', '{', '}' as
+ escape characters. Thats why the Windows path contain double back-slashes.
+ One should also take into account that a console may have also special
+ escape characters.</p>
+
+ <h2>What mode is used</h2>
+ <p>
+ The default mode is application mode. If at least one bootstrap parameter
+ for the direct mode is provided then direct mode is used. </p>
+
+ <p>
+ All settings made by this API are done for the current user if not
+ mentioned differently.</p>
+
+ <h2>Other bootstrap variables</h2>
+ <dl>
+ <dt>JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY</dt>
+ <dd>This is a unofficial variable which was introduced to workaround external issues.
+ It may be removed in the future. By setting it to 1, the framework will not try to
+ find out if the system is configured to use accessibility tools or if a JRE has an
+ accessibiliy bridge installed</dd>
+ </dl>
+*/
+
+/** indicates that a JRE has an accessibility bridge installed.
+ <p>
+ The flag is used with JavaInfo::nFeatures.</p>
+ */
+#define JFW_FEATURE_ACCESSBRIDGE 0x1l
+/** indicates that there must be an environment set up before the Java process
+ runs.
+ <p>Therefore, when a Java is selected in OO then the office must be
+ restarted, so that the changes can take effect.</p>
+ */
+#define JFW_REQUIRE_NEEDRESTART 0x1l
+
+/** error codes which are returned by functions of this API.
+ */
+typedef enum _javaFrameworkError
+{
+ JFW_E_NONE,
+ JFW_E_ERROR,
+ JFW_E_INVALID_ARG,
+ JFW_E_NO_SELECT,
+ JFW_E_INVALID_SETTINGS,
+ JFW_E_NEED_RESTART,
+ JFW_E_RUNNING_JVM,
+ JFW_E_JAVA_DISABLED,
+ JFW_E_NO_PLUGIN,
+ JFW_E_NOT_RECOGNIZED,
+ JFW_E_FAILED_VERSION,
+ JFW_E_NO_JAVA_FOUND,
+ JFW_E_VM_CREATION_FAILED,
+ JFW_E_CONFIGURATION,
+ JFW_E_DIRECT_MODE
+} javaFrameworkError;
+
+/** an instance of this struct represents an installation of a Java
+ Runtime Environment (JRE).
+
+ <p>
+ Instances of this struct are created by the plug-in libraries which are used by
+ this framework (jvmfwk/vendorplugin.h). The memory of the instances is created
+ by <code>rtl_allocateMemory</code> (rtl/alloc.h). Therefore, the memory must
+ be freed by <code>rtl_freeMemory</code>. Also the contained members must be
+ freed particularly.
+ For convenience this API provides the function <code>jfw_freeJavaInfo</code>
+ which frees the objects properly. </p>
+ */
+struct _JavaInfo
+{
+ /** contains the vendor.
+
+ <p>string must be the same as the one obtained from the
+ Java system property <code>java.vendor</code>.
+ </p>
+ */
+ rtl_uString *sVendor;
+ /** contains the file URL to the installation directory.
+ */
+ rtl_uString *sLocation;
+ /** contains the version of this Java distribution.
+
+ <p>The version string must adhere to the rules
+ about how a version string has to be formed. These rules may
+ be vendor-dependent. Essentially the strings must syntactically
+ equal the Java system property <code>java.version</code>.
+ </p>
+ */
+ rtl_uString *sVersion;
+ /** indicates supported special features.
+
+ <p>For example, <code>JFW_FEATURE_ACCESSBRIDGE</code> indicates that
+ assistive technology tools are supported.</p>
+ */
+ sal_uInt64 nFeatures;
+ /** indicates requirments for running the java runtime.
+
+ <p>For example, it may be necessary to prepare the environment before
+ the runtime is created. That could mean, setting the
+ <code>LD_LIBRARY_PATH</code>
+ when <code>nRequirements</code> contains the flag
+ <code>JFW_REQUIRE_NEEDRESTART</code></p>
+ */
+ sal_uInt64 nRequirements;
+ /** contains data needed for the creation of the java runtime.
+
+ <p>There is no rule about the format and content of the sequence's
+ values. The plug-in libraries can put all data, necessary for
+ starting the java runtime into this sequence. </p>
+ */
+ sal_Sequence * arVendorData;
+};
+
+typedef struct _JavaInfo JavaInfo;
+
+/** frees the memory of a <code>JavaInfo</code> object.
+ @param pInfo
+ The object which is to be freed. It can be NULL;
+ */
+JVMFWK_DLLPUBLIC void SAL_CALL jfw_freeJavaInfo(JavaInfo *pInfo);
+
+
+/** compares two <code>JavaInfo</code> objects for equality.
+
+ <p>Two <code>JavaInfo</code> objects are said to be equal if the contained
+ members of the first <code>JavaInfo</code> are equal to their counterparts
+ in the second <code>JavaInfo</code> object. The equality of the
+ <code>rtl_uString</code> members is determined
+ by the respective comparison function (see
+ <code>OUString::equals</code>).
+ Similiarly the equality of the <code>sal_Sequence</code> is
+ also determined by a comparison
+ function (see <code>rtl::ByteSequence::operator ==</code>). </p>
+ <p>
+ Both argument pointers must be valid.</p>
+ @param pInfoA
+ the first argument.
+ @param pInfoB
+ the second argument which is compared with the first.
+ @return
+ sal_True - both object represent the same JRE.</br>
+ sal_False - the objects represend different JREs
+ */
+JVMFWK_DLLPUBLIC sal_Bool SAL_CALL jfw_areEqualJavaInfo(
+ JavaInfo const * pInfoA,JavaInfo const * pInfoB);
+
+/** determines if a Java Virtual Machine is already running.
+
+ <p>As long as the office and the JREs only support one
+ Virtual Machine per process the Java settings, particulary the
+ selected Java, are not effective immediately after changing when
+ a VM has already been running. That is, if a JRE A was used to start
+ a VM and then a JRE B is selected, then JRE B will only be used
+ after a restart of the office.</p>
+ <p>
+ By determining if a VM is running, the user can be presented a message,
+ that the changed setting may not be effective immediately.</p>
+
+ @param bRunning
+ [out] sal_True - a VM is running. <br/>
+ sal_False - no VM is running.
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_INVALID_ARG the parameter <code>bRunning</code> was NULL.
+*/
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_isVMRunning(sal_Bool *bRunning);
+
+/** detects a suitable JRE and configures the framework to use it.
+
+ <p>Which JREs can be used is determined by the file javavendors.xml,
+ which contains version requirements, as well as information about available
+ plug-in libraries. Only these libraries are responsible for locating JRE
+ installations.</p>
+ <p>
+ JREs can be provided by different vendors. In order to find the JREs of
+ a certain vendor a plug-in library must be provided. There must be only one
+ library for one vendor. The names of locations of those libraries have to
+ be put into the javavendors.xml file.<br/>
+ The function uses the plug-in libraries to obtain information about JRE
+ installation and checks if they there is one among them that supports
+ a set of features (currently only accessibilty is possible). If none was
+ found then it also uses a list of paths, which have been registered
+ by <code>jfw_addJRELocation</code> or <code>jfw_setJRELocations</code>
+ to find JREs. Found JREs are examined in the same way.</p>
+ <p>
+ A JRE installation is only selected if it meets the version requirements.
+ Information about the selected JRE are made persistent so that
+ subsequent calls to <code>jfw_getSelectedJRE</code> returns this
+ information.</p>
+ <p>
+ While determining a proper JRE this function takes into account if a
+ user requires support for assistive technology tools. If user
+ need that support they have to set up their system accordingly. When support
+ for assistive technology is required, then the lists of
+ <code>JavaInfo</code> objects,
+ which are provided by the <code>getJavaInfo</code> functions of the plug-ins, are
+ examined for a suitable JRE. That is, the <code>JavaInfo</code> objects
+ from the list
+ obtained from the first plug-in, are examined. If no <code>JavaInfo</code>
+ object has the flag
+ <code>JFW_FEATURE_ACCESSBRIDGE</code> in the member <code>nFeatures</code>
+ then the
+ next plug-in is used to obtain a list of <code>JavaInfo</code> objects.
+ This goes on until a <code>JavaInfo</code> object was found which
+ represents a suitable JRE. Or neither plug-in provided such a
+ <code>JavaInfo</code> object. In that case the first
+ <code>JavaInfo</code> object from the first plug-in is used to determine
+ the JRE which is to be used.</p>
+ <p>
+ If there is no need for the support of assistive technology tools then
+ the first <code>JavaInfo</code> object from the list obtained by the
+ first plug-in is used. If this plug-in does not find any JREs then the
+ next plug-in is used, and so on.</p>
+
+ @param ppInfo
+ [out] a <code>JavaInfo</code> pointer, representing the selected JRE.
+ The caller has to free it by calling <code>jfw_freeJavaInfo<code>. The
+ <code>JavaInfo</code> is for informational purposes only. It is not
+ necessary to call <code>jfw_setSelectedJRE</code> afterwards.<br/>
+ <code>ppInfo</code>can be NULL. If <code>*ppInfo</code> is not null, then it is
+ overwritten, without attempting to free <code>*ppInfo</code>.
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_ERROR an error occurred. <br/>
+ JFW_E_NO_PLUGIN a plug-in library could not be found.<br/>
+ JFW_E_NO_JAVA_FOUND no JRE was found that meets the requirements.</br>
+ JFW_E_DIRECT_MODE the function cannot be used in this mode. </br>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_findAndSelectJRE(JavaInfo **pInfo);
+
+/** provides information about all availabe JRE installations.
+
+ <p>The function determines dynamically what JREs are available. It uses
+ the plug-in libraries to provide lists of available <code>JavaInfo</code>
+ objects where each object represents a JRE (see vendorplugin.h,
+ getAllJavaInfos). It also uses a list of paths, which have been registered
+ by <code>jfw_addJRELocation</code> or <code>jfw_setJRELocations</code>.
+ It is checked if the path still contains a valid JRE and if so the respective
+ <code>JavaInfo</code> object will be appended to the array unless there is
+ already an equal object.</p>
+
+ @param parInfo
+ [out] on returns it contains a pointer to an array of <code>JavaInfo</code>
+ pointers.
+ The caller must free the array with <code>rtl_freeMemory</code> and each
+ element of the array must be freed with <code>jfw_freeJavaInfo</code>.
+ @param pSize
+ [out] on return contains the size of array returned in <code>parInfo</code>.
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_INVALID_ARG at least on of the parameters was NULL<br/>
+ JFW_E_ERROR an error occurred. <br/>
+ JFW_E_NO_PLUGIN a plug-in library could not be found.<br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.
+*/
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_findAllJREs(
+ JavaInfo ***parInfo, sal_Int32 *pSize);
+
+/** determines if a path points to a Java installation.
+
+ <p>If the path belongs to a JRE installation then it returns the
+ respective <code>JavaInfo</code> object. The function uses the
+ <code>getJavaInfoByPath</code> function of the plug-ins to obtain the
+ <code>JavaInfo</code> object. Only if the JRE found at the specified location
+ meets the version requirements as specified in the javavendors.xml file a
+ <code>JavaInfo</code> object is returned.<br/>
+ <p>
+ The functions only checks if a JRE exists but does not modify any settings.
+ To make the found JRE the &quot;selected JRE&quot; one has
+ to call <code>jfw_setSelectedJRE</code>.</p>
+
+ @param pPath
+ [in] a file URL to a directory.
+ @param pInfo
+ [out] the <code>JavaInfo</code> object which represents a JRE found at the
+ location specified by <code>pPath</code>
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_INVALID_ARG at least on of the parameters was NULL<br/>
+ JFW_E_ERROR an error occurred. <br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.</br>
+ JFW_E_NO_PLUGIN a plug-in library could not be found.<br/>
+ JFW_E_NOT_RECOGNIZED neither plug-in library could detect a JRE. <br/>
+ JFW_E_FAILED_VERSION a JRE was detected but if failed the version
+ requirements as determined by the javavendors.xml
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_getJavaInfoByPath(
+ rtl_uString *pPath, JavaInfo **ppInfo);
+
+
+/** starts a Java Virtual Machine (JVM).
+
+ <p>The function uses the current settings to start a JVM. The actual
+ start-up code, however, is provided by the plug-in libraries. The setting
+ of the &quot;selected Java&quot; contains the information as to what vendor
+ the respective JRE comes from. In the javavendors.xml there is a mapping of
+ vendor names to the respective plug-in libraries.</p>
+ <p>
+ The function ultimately calls <code>startJavaVirtualMachine</code> from
+ the plug-in library.</p>
+ <p>
+ The <code>arOptions</code>
+ argument contains start arguments which are passed in JavaVMOption structures
+ to the VM during its creation. These
+ could be things, such as language settings, proxy settings or any other
+ properties which shall be obtainable by
+ <code>java.lang.System.getProperties</code>. One can also pass options which
+ have a certain meaning to the runtime behaviour such as -ea or -X... However,
+ one must be sure that these options can be interpreted by the VM.<br/>
+ The class path cannot be set this way. The class path is internally composed by
+ the paths to archives in a certain directory, which is preconfigured in
+ the internal data store and the respective user setting (see
+ <code>jfw_setUserClassPath</code>.</p>
+ <p>
+ If a JRE was selected at runtime which was different from the previous
+ setting and that JRE needs a prepared environment, for example an adapted
+ <code>LD_LIBRARY_PATH</code> environment variable, then the VM will not be
+ created and JFW_E_NEED_RESTART error is returned. If a VM is already running
+ then a JFW_E_RUNNING_JVM is returned.</p>
+
+ @param pInfo
+ [in] optional pointer to a specific JRE; must be caller-freed if not NULL
+ @param arOptions
+ [in] the array containing additional start arguments or NULL.
+ @param nSize
+ [in] the size of the array <code>arOptions</code>.
+ @param ppVM
+ [out] the <code>JavaVM</code> pointer.
+ @param ppEnv
+ [out] the <code>JNIenv</code> pointer.
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_INVALID_ARG <code>ppVM</code>, <code>ppEnv</code> are NULL or
+ <code>arOptions</code> was NULL but <code>nSize</code> was greater 0.<br/>
+ JFW_E_ERROR an error occurred. <br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.</br>
+ JFW_E_NO_PLUGIN the plug-in library responsible for creating the VM
+ could not be found.<br/>
+ JFW_E_JAVA_DISABLED the use of Java is currently disabled. <br/>
+ JFW_E_NO_SELECT there is no JRE selected yet. <br/>
+ JFW_E_RUNNIN_JVM there is already a VM running.<br/>
+ JFW_E_INVALID_SETTINGS the javavendors.xml has been changed and no
+ JRE has been selected afterwards. <br/>
+ JFW_E_NEED_RESTART in the current process a different JRE has been selected
+ which needs a prepared environment, which has to be done before the office
+ process. Therefore the new JRE may not be used until the office was restarted.<br/>
+ JFW_E_NEED_RESTART is also returned when Java was disabled at the beginning and
+ then the user enabled it. If then the selected JRE has the requirement
+ JFW_REQUIRE_NEEDRESTART then this error is returned. </br>
+ JFW_E_VM_CREATION_FAILED the creation of the JVM failed. The creation is performed
+ by a plug-in library and not by this API.
+ JFW_E_FAILED_VERSION the &quot;Default Mode&quot; is active. The JRE determined by
+ <code>JAVA_HOME</code>does not meet the version requirements.
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_startVM(
+ JavaInfo const * pInfo, JavaVMOption * arOptions, sal_Int32 nSize,
+ JavaVM ** ppVM, JNIEnv ** ppEnv);
+
+/** determines the JRE that is to be used.
+
+ <p>When calling <code>jfw_startVM</code> then a VM is startet from
+ the JRE that is determined by this function.<br/>
+ It is not verified if the JRE represented by the <code>JavaInfo</code>
+ argument meets the requirements as specified by the javavendors.xml file.
+ However, usually one obtains the <code>JavaInfo</code> object from the
+ functions <code>jfw_findAllJREs</code> or <code>jfw_getJavaInfoByPath</code>,
+ which do verify the JREs and pass out only <code>JavaInfo</code> objects
+ which comply with the version requirements.</p>
+ <p>
+ If <code>pInfo</code> is NULL then the meaning is that no JRE will be
+ selected. <code>jfw_startVM</code> will then return
+ <code>JFW_E_NO_SELECT</code>.</p>
+
+ @param pInfo
+ [in] pointer to <code>JavaInfo</code> structure, containing data about a
+ JRE. The caller must still free <code>pInfo</code>.
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_ERROR An error occurred.<br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.<br/>
+ JFW_E_DIRECT_MODE the function cannot be used in this mode.
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_setSelectedJRE(JavaInfo const *pInfo);
+
+
+/** provides information about the JRE that is to be used.
+
+ <p>If no JRE is currently selected then <code>ppInfo</code> will contain
+ NULL on return.</br>
+ If the value of the element <updated> in the javavendors.xml file was
+ changed since the time when the last Java was selected then this
+ function returns <code>JFW_E_INVALID_SETTINGS</code>. This could happen during
+ a product patch. Then new version requirements may be introduced, so that
+ the currently selected JRE may not meet these requirements anymore.
+ </p>
+ <p>In direct mode the function returns information about a JRE that was
+ set by the bootstrap parameter UNO_JAVA_JFW_JREHOME.
+ </p>
+ @param ppInfo
+ [out] on return it contains a pointer to a <code>JavaInfo</code> object
+ that represents the currently selected JRE. When <code>*ppInfo</code> is not
+ NULL then the function overwrites the pointer. It is not attempted to free
+ the pointer.
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_INVALIDARG <code>ppInfo</code> is a NULL.<br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.<br/>
+ JFW_E_INVALID_SETTINGS the javavendors.xml has been changed and no
+ JRE has been selected afterwards. <br/>
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_getSelectedJRE(JavaInfo **ppInfo);
+
+
+/** determines if Java can be used.
+
+ <p>If <code>bEnabled</code> is <code>sal_False</code> then a call
+ to jfw_startVM will result in an error with the errorcode
+ <code>JFW_E_JAVA_DISABLED</code></p>
+
+ @param bEnabled
+ [in] use of Java enabled/disabled.
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_ERROR An error occurred.<br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.<br/>
+ JFW_E_DIRECT_MODE the function cannot be used in this mode.
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_setEnabled(sal_Bool bEnabled);
+
+/** provides the information if Java can be used.
+
+ <p>That is if the user enabled or disabled the use of Java.
+ </p>
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_INVALIDARG pbEnabled is NULL<br/>
+ JFW_E_ERROR An error occurred.<br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.<br/>
+ JFW_E_DIRECT_MODE the function cannot be used in this mode.
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_getEnabled(sal_Bool *pbEnabled);
+
+/** determines parameters which are passed to VM during its creation.
+
+ <p>The strings must be exactly as they are passed on the command line.
+ For example, one could pass<br/>
+ -Xdebug <br/>
+ -Xrunjdw:transport=dt_socket,server=y,address=8000<br/>
+ in order to enable debugging support.
+ </p>
+
+ @param arParameters
+ [in] contains the arguments. It can be NULL if nSize is 0.
+ @param nSize
+ [i] the size of <code>arArgs</code>
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_INVALIDARG arArgs is NULL and nSize is not 0
+ JFW_E_ERROR An error occurred.<br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.<br/>
+ JFW_E_DIRECT_MODE the function cannot be used in this mode.
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_setVMParameters(
+ rtl_uString ** arArgs, sal_Int32 nSize);
+
+/** obtains the currently used start parameters.
+
+ <p>The caller needs to free the returned array with
+ <code>rtl_freeMemory</code>. The contained strings must be released with
+ <code>rtl_uString_release</code>.
+ </p>
+
+ @param parParameters
+ [out] on returns contains a pointer to the array of the start arguments.
+ If *parParameters is not NULL then the value is overwritten.
+ @param pSize
+ [out] on return contains the size of array returned in
+ <code>parParameters</code>
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_INVALIDARG parParameters or pSize are NULL<br/>
+ JFW_E_ERROR An error occurred.<br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.<br/>
+ JFW_E_DIRECT_MODE the function cannot be used in this mode.
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_getVMParameters(
+ rtl_uString *** parParameters,
+ sal_Int32 * pSize);
+
+/** sets the user class path.
+
+ <p>When the VM is started then it is passed the class path. The
+ class path also contains the user class path set by this function.
+ The paths contained in <code>pCP</code> must be separated with a
+ system dependent path separator.</p>
+
+ @param pCP
+ [in] the user class path.
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_INVALIDARG pCP is NULL.<br/>
+ JFW_E_ERROR An error occurred.<br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.<br/>
+ JFW_E_DIRECT_MODE the function cannot be used in this mode.
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_setUserClassPath(rtl_uString * pCP);
+/** provides the value of the current user class path.
+
+ <p>The function returns an empty string if no user class path is set.
+ </p>
+
+ @param ppCP
+ [out] contains the user class path on return. If <code>*ppCP</code> was
+ not NULL then the value is overwritten. No attempt at freeing that string
+ is made.
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_INVALIDARG ppCP is NULL.<br/>
+ JFW_E_ERROR An error occurred.<br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.<br/>
+ JFW_E_DIRECT_MODE the function cannot be used in this mode.
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_getUserClassPath(rtl_uString ** ppCP);
+
+/** saves the location of a JRE.
+
+ <p>When <code>jfw_findAllJREs</code> is called then the paths added by this
+ function are evaluated. If the location still represents a
+ JRE then a <code>JavaInfo</code> object is created which is returned along
+ with all other <code>JavaInfo</code> objects by
+ <code>jfw_findAllJREs</code>. If the location
+ cannot be recognized then the location string is ignored. </p>
+ <p>
+ A validation if <code>sLocation</code> points to a JRE is not
+ performed. To do that one has to use <code>jfw_getJavaInfoByPath</code>.
+ </p>
+ <p>
+ Adding a path that is already stored causes no error.</p>
+
+ @param sLocation
+ [in] file URL to a directory which contains a JRE.
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_INVALIDARG sLocation is NULL.<br/>
+ JFW_E_ERROR An error occurred.<br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.<br/>
+ JFW_E_DIRECT_MODE the function cannot be used in this mode.
+ @see jfw_setJRELocations
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_addJRELocation(rtl_uString * sLocation);
+
+/** saves the locations of a number of JREs.
+
+ <p>
+ The function does not verify if the paths points to JRE. However,
+ it makes sure that every path is unique. That is, if the array
+ contains strings which are the same then only one is stored.</p>
+ <p>
+ If <code>arLocations</code> is NULL or it has the length null (nSize = 0)
+ then all previously stored paths are deleted. Otherwise,
+ the old values are overwritten.</p>
+
+ @param arLocations
+ [in] array of paths to locations of JREs.
+
+ @param nSize
+ [in] the size of the array <code>arLocations</code>
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_INVALIDARG arLocation is NULL and nSize is not null.<br/>
+ JFW_E_ERROR An error occurred.<br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.<br/>
+ JFW_E_DIRECT_MODE the function cannot be used in this mode.
+ @see jfw_addJRELocations
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_setJRELocations(
+ rtl_uString ** arLocations, sal_Int32 nSize);
+/** obtains an array containing paths to JRE installations.
+
+ <p>
+ It is not guaranteed that the returned paths represent
+ a valid JRE. One can use <code>jfw_getJavaInfoByPath</code> to check this.
+ </p>
+
+ @param parLocations
+ [out] on return it contains the array of paths.
+ @param pSize
+ [out] on return it contains the size of the array <code>parLocations</code>.
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_INVALIDARG parLocation is NULL or pSize is NULL.<br/>
+ JFW_E_ERROR An error occurred.<br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.<br/>
+ JFW_E_DIRECT_MODE the function cannot be used in this mode.
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_getJRELocations(
+ rtl_uString *** parLocations, sal_Int32 * pSize);
+
+
+/** checks if the installation of the jre still exists.
+
+ This function checks if the JRE described by pInfo still
+ exists. The check must be very quick because it is called by javaldx
+ (Linux, Solaris) at start up.
+
+ @param pInfo
+ [in] the JavaInfo object with information about the JRE.
+ @param pp_exist
+ [out] the parameter is set to either sal_True or sal_False. The value is
+ only valid if the function returns JFW_E_NONE.
+
+ @return
+ JFW_E_NONE the function ran successfully.</br>
+ JFW_E_ERROR an error occurred during execution.</br>
+ JFW_E_INVALID_ARG pInfo contains invalid data</br>
+ JFW_E_NO_PLUGIN a plug-in library could not be found.<br/>
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_existJRE(const JavaInfo *pInfo, sal_Bool *exist);
+
+
+/** locks this API so that it cannot be used by other threads.
+
+ <p>If a different thread called this function before then the
+ current call is blocked until the other thread has called
+ <code>jfw_unlock()</code>. The function should be called if one
+ needs an exact snapshot of the current settings. Then the settings
+ are retrieved one by one without risk that the settings may be changed
+ by a different thread. Similiary if one needs to make settings which
+ should become effective at the same time then <code>jfw_lock</code>
+ should be called. That is, <code>jfw_startVM</code> which uses the
+ settings cannot be called before all settings have be made.</p>
+ <p>
+ The only functions which are not effected by <code>jfw_lock</code> are
+ <code>jfw_freeJavaInfo</code> and <code>jfw_areEqualJavaInfo</code>.
+ */
+JVMFWK_DLLPUBLIC void SAL_CALL jfw_lock();
+
+/** unlocks this API.
+
+ <p>This function is called after <code>jfw_lock</code>. It allows other
+ threads to use this API concurrently.</p>
+*/
+JVMFWK_DLLPUBLIC void SAL_CALL jfw_unlock();
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/jvmfwk/jvmfwkdllapi.h b/include/jvmfwk/jvmfwkdllapi.h
new file mode 100644
index 000000000000..52c8273b5954
--- /dev/null
+++ b/include/jvmfwk/jvmfwkdllapi.h
@@ -0,0 +1,24 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_JVMFWK_JVMFWKDLLAPI_H
+#define INCLUDED_JVMFWK_JVMFWKDLLAPI_H
+
+#include <sal/types.h>
+
+#if defined JVMFWK_DLLIMPLEMENTATION
+# define JVMFWK_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+# define JVMFWK_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define JVMFWK_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/jvmfwk/jvmfwkplugindllapi.h b/include/jvmfwk/jvmfwkplugindllapi.h
new file mode 100644
index 000000000000..d96016e261bb
--- /dev/null
+++ b/include/jvmfwk/jvmfwkplugindllapi.h
@@ -0,0 +1,24 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_JVMFWK_JVMFWKPLUGINDLLAPI_H
+#define INCLUDED_JVMFWK_JVMFWKPLUGINDLLAPI_H
+
+#include <sal/types.h>
+
+#if defined JVMFWK_PLUGIN_DLLIMPLEMENTATION
+# define JVMFWK_PLUGIN_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+# define JVMFWK_PLUGIN_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define JVMFWK_PLUGIN_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/jvmfwk/vendorplugin.h b/include/jvmfwk/vendorplugin.h
new file mode 100644
index 000000000000..5ca5e10009ba
--- /dev/null
+++ b/include/jvmfwk/vendorplugin.h
@@ -0,0 +1,258 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/** @HTML */
+#ifndef INCLUDED_JVMFWK_VENDORPLUGIN_H
+#define INCLUDED_JVMFWK_VENDORPLUGIN_H
+
+#include "jvmfwkplugindllapi.h"
+#include "jvmfwk/framework.h"
+#include "rtl/ustring.h"
+#include "jni.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ @file
+ <p>
+ This API shall be implemented if one wants to support a Java Runtime
+ Environment (JRE) of a particular vendor. Because there is currently no
+ specification which rules the structure and location of JRE installations
+ and the format of version strings it is not possible to supply a general
+ implementation for all possible vendors. If an application determines exactly
+ what version a JRE must have then it relies on certain features and bug
+ fixes of that version. Because a version 1.4.2_1 from vendor X may contain
+ different fixes as the same version from vendor Y it is important to see
+ version an vendor as one entity. One without the other does not guarantee
+ the existence of a particular set of features or bug fixes. An implementation
+ of this API may support multiple vendors. </p>
+ <p>
+ Libraries which implement this interface will be dynamically loaded and
+ unloaded by the java framework (jvmfwk/framework.h). Therefore they must not
+ keep global variables.
+ </p>
+ */
+
+typedef enum
+{
+ JFW_PLUGIN_E_NONE,
+ JFW_PLUGIN_E_ERROR,
+ JFW_PLUGIN_E_INVALID_ARG,
+ JFW_PLUGIN_E_WRONG_VERSION_FORMAT,
+ JFW_PLUGIN_E_FAILED_VERSION,
+ JFW_PLUGIN_E_NO_JRE,
+ JFW_PLUGIN_E_WRONG_VENDOR,
+ JFW_PLUGIN_E_VM_CREATION_FAILED
+} javaPluginError;
+
+
+
+/** obtains information about installations of Java Runtime Environments (JREs).
+
+ <p>The function gathers information about available JREs which have the same
+ vendor as determined by the <code>sVendor</code> parameter. Only information
+ about those JREs which match the version requirements are returned. These
+ requirements are specified by the parameters <code>sMinVersion</code>,
+ <code>sMaxVersion</code> and <code>arExcludeList</code>.
+ </p>
+ <p>
+ The JavaInfo structures returned in <code>parJavaInfo</code> should be ordered
+ according to their version. The one, representing a JRE with the highest
+ version should be the first in the array. </p>
+ <p>
+ The function allocates memory for an array and all the JavaInfo objects returned
+ in <code>parJavaInfo</code>. The caller must free each JavaInfo object by calling
+ <code>jfw_freeJavaInfo</code> (#include "jvmfwk/framework.h"). The array is to be
+ freed by rtl_freeMemory.
+ In case an error occurred <code>parJavaInfo</code> need not be freed.
+ </p>
+ @param sVendor
+ [in] only JREs from this vendor are examined. This parameter always contains
+ a vendor string. That is, the string it is not empty.
+ @param sMinVersion
+ [in] represents the minimum version of a JRE. The string can be empty but
+ a null pointer is not allowed.
+ @param sMaxVersion
+ [in] represents the maximum version of a JRE. The string can be empty but
+ a null pointer is not allowed.
+ @param arExcludeList
+ [in] contains a list of &quot;bad&quot; versions. JREs which have one of these
+ versions must not be returned by this function. It can be NULL.
+ @param nSizeExcludeList
+ [in] the number of version strings contained in <code>arExcludeList</code>.
+ @param parJavaInfo
+ [out] if the function runs successfully then <code>parJavaInfo</code> contains
+ on return an array of pointers to <code>JavaInfo</code> objects.
+ @param nSizeJavaInfo
+ [out] the number of <code>JavaInfo</code> pointers contained in
+ <code>parJavaInfo</code>.
+
+ @return
+ JFW_PLUGIN_E_NONE the function ran successfully.</br>
+ JFW_PLUGIN_E_ERROR an error occurred during execution.</br>
+ JFW_PLUGIN_E_INVALID_ARG an argument was not valid. For example
+ <code>nSizeExcludeList</code> is greater null but <code>arExcludeList</code>
+ is NULL or NULL pointer were passed for at least on of the strings.</br>
+ JFW_PLUGIN_E_WRONG_VERSION_FORMAT the version strings in
+ <code>sMinVersion,sMaxVersion,arExcludeList</code> are not recognized as valid
+ version strings.
+ */
+JVMFWK_PLUGIN_DLLPUBLIC javaPluginError jfw_plugin_getAllJavaInfos(
+ rtl_uString *sVendor,
+ rtl_uString *sMinVersion,
+ rtl_uString *sMaxVersion,
+ rtl_uString * * arExcludeList,
+ sal_Int32 nSizeExcludeList,
+ JavaInfo*** parJavaInfo,
+ sal_Int32 *nSizeJavaInfo);
+
+/** obtains information for a JRE at a given location.
+
+ <p>If the given location belongs to a JRE whoose vendor matches the
+ sVendor argument and the JRE has a version which meets the requirements as
+ specified by <code>sMinVersion, sMaxVersion, arExcludeList</code> then
+ this function shall return a JavaInfo object for this JRE if this implementation
+ supports this vendor.</p>
+
+ @param sLocation
+ [in] a file URL to the directory of the JRE.
+ @param sVendor
+ [in] a name of a vendor. This parameter always contains
+ a vendor string. That is, the string it is not empty.
+ @param sMinVersion
+ [in] represents the minimum version of a JRE.
+ @param sMaxVersion
+ [in] represents the maximum version of a JRE.
+ @param arExcludeList
+ [in] contains a list of &quot;bad&quot; versions. JREs which have one of these
+ versions must not be returned by this function. It can be NULL.
+ @param nSizeExcludeList
+ [in] the number of version strings contained in <code>arExcludeList</code>.
+ @param ppInfo
+ [out] if the function runs successfully then <code>ppInfo</code> contains
+ on return a pointer to a <code>JavaInfo</code> object.
+
+ @return
+ JFW_PLUGIN_E_NONE the function ran successfully.</br>
+ JFW_PLUGIN_E_ERROR an error occurred during execution.</br>
+ JFW_PLUGIN_E_INVALID_ARG an argument was not valid. For example
+ <code>nSizeExcludeList</code> is greater null but <code>arExcludeList</code>
+ is NULL, NULL pointer were passed for at least on of the strings, sLocation
+ is an empty string.</br>
+ JFW_PLUGIN_E_WRONG_VERSION_FORMAT the version strings in
+ <code>sMinVersion,sMaxVersion,arExcludeList</code> are not recognized as valid
+ version strings.
+ JFW_PLUGIN_E_FAILED_VERSION there is a JRE at the given location but it does not
+ meet the version requirements.
+ JFW_PLUGIN_E_NO_JRE no JRE could be detected at the given location. However, that
+ does not mean necessarily that there is no JRE. There could be a JRE but it has
+ a vendor which is not supported by this API implementation.
+ */
+JVMFWK_PLUGIN_DLLPUBLIC javaPluginError jfw_plugin_getJavaInfoByPath(
+ rtl_uString *sLocation,
+ rtl_uString *sVendor,
+ rtl_uString *sMinVersion,
+ rtl_uString *sMaxVersion,
+ rtl_uString * *arExcludeList,
+ sal_Int32 nSizeExcludeList,
+ JavaInfo ** ppInfo);
+
+/** starts a Java Virtual Machine.
+
+ <p>The caller should provide all essential JavaVMOptions, such as the
+ class path (-Djava.class.path=xxx). It is assumed that the caller
+ knows what JRE is used. Hence the implementation does not need to check
+ the options for validity. If a user configured the application to
+ use specific options, such as -X..., then it is in his responsibility to
+ ensure that the application works properly. The function may add or modify
+ properties. For example, it may add to the class path property.
+ <p>
+ The function must ensure, that the VM does not abort the process
+ during instantiation.</p>
+ <p>
+ The function receives a <code>JavaInfo</code> object that was created
+ by the functions <code>jfw_plugin_getJavaInfoByPath</code> or
+ <code>jfw_plugin_getAllJavaInfos</code> from the same library. This can be
+ guaranteed if an application uses exactly one library for one vendor.
+ Therefore the functions which create the <code>JavaInfo</code> can store all
+ necessary information which are needed for starting the VM into that
+ structure. </p>
+
+ @param pInfo
+ [in] the JavaInfo object with information about the JRE.
+ @param arOptions
+ [in] the options which are passed into the JNI_CreateJavaVM function.
+ Can be NULL.
+ @param nSizeOptions
+ [in] the number of elements in <code>arOptions</code>.
+ @param ppVM
+ [out] the JavaVM pointer of the created VM.
+ @param ppEnv
+ [out] the JNIEnv pointer of the created VM.
+
+ @return
+ JFW_PLUGIN_E_NONE the function ran successfully.</br>
+ JFW_PLUGIN_E_ERROR an error occurred during execution.</br>
+ JFW_PLUGIN_E_WRONG_VENDOR the <code>JavaInfo</code> object was not created
+ in by this library and the VM cannot be started.</br>
+ JFW_PLUGIN_E_INVALID_ARG an argument was not valid. For example
+ <code>pInfo</code> or , <code>ppVM</code> or <code>ppEnv</code> are NULL.
+ </br>
+ JFW_PLUGIN_E_VM_CREATION_FAILED a VM could not be created. The error was caused
+ by the JRE.
+ */
+JVMFWK_PLUGIN_DLLPUBLIC javaPluginError jfw_plugin_startJavaVirtualMachine(
+ const JavaInfo *pInfo,
+ const JavaVMOption *arOptions,
+ sal_Int32 nSizeOptions,
+ JavaVM ** ppVM,
+ JNIEnv ** ppEnv);
+
+
+
+/** checks if the installation of the jre still exists.
+
+ This function checks if the JRE described by pInfo still
+ exists. The check must be very quick because it is called by javaldx
+ (Linux, Solaris) at start up.
+
+ @param pInfo
+ [in] the JavaInfo object with information about the JRE.
+ @param pp_exist
+ [out] the parameter is set to either sal_True or sal_False. The value is
+ only valid if the function returns JFW_E_NONE.
+
+ @return
+ JFW_PLUGIN_E_NONE the function ran successfully.</br>
+ JFW_PLUGIN_E_ERROR an error occurred during execution.</br>
+ JFW_PLUGIN_E_INVALID_ARG pInfo contains invalid data</br>
+ */
+JVMFWK_PLUGIN_DLLPUBLIC javaPluginError jfw_plugin_existJRE(const JavaInfo *pInfo, sal_Bool *exist);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/linguistic/hyphdta.hxx b/include/linguistic/hyphdta.hxx
new file mode 100644
index 000000000000..9dec2d6dc15e
--- /dev/null
+++ b/include/linguistic/hyphdta.hxx
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _LINGUISTIC_HYPHDTA_HXX_
+#define _LINGUISTIC_HYPHDTA_HXX_
+
+#include <com/sun/star/linguistic2/XHyphenatedWord.hpp>
+#include <com/sun/star/linguistic2/XPossibleHyphens.hpp>
+#include <tools/solar.h>
+#include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
+#include <cppuhelper/implbase1.hxx> // helper for implementations
+#include <linguistic/lngdllapi.h>
+
+namespace linguistic
+{
+
+class HyphenatedWord :
+ public cppu::WeakImplHelper1
+ <
+ ::com::sun::star::linguistic2::XHyphenatedWord
+ >
+{
+ OUString aWord;
+ OUString aHyphenatedWord;
+ sal_Int16 nHyphPos;
+ sal_Int16 nHyphenationPos;
+ sal_Int16 nLanguage;
+ sal_Bool bIsAltSpelling;
+
+ // disallow copy-constructor and assignment-operator for now
+ HyphenatedWord(const HyphenatedWord &);
+ HyphenatedWord & operator = (const HyphenatedWord &);
+
+public:
+ HyphenatedWord(const OUString &rWord, sal_Int16 nLang, sal_Int16 nHyphenationPos,
+ const OUString &rHyphenatedWord, sal_Int16 nHyphenPos );
+ virtual ~HyphenatedWord();
+
+ // XHyphenatedWord
+ virtual OUString SAL_CALL
+ getWord()
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::lang::Locale SAL_CALL
+ getLocale()
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL
+ getHyphenationPos()
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL
+ getHyphenatedWord()
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL
+ getHyphenPos()
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL
+ isAlternativeSpelling()
+ throw(::com::sun::star::uno::RuntimeException);
+
+ OUString GetWord() { return aWord; }
+ OUString GetHyphenatedWord() { return aHyphenatedWord; }
+ sal_Int16 GetLanguage() { return nLanguage; }
+ void SetWord( OUString &rTxt ) { aWord = rTxt; }
+ void SetHyphenatedWord( OUString &rTxt ) { aHyphenatedWord = rTxt; }
+ void SetLanguage( sal_Int16 nLang ) { nLanguage = nLang; }
+ static com::sun::star::uno::Reference <com::sun::star::linguistic2::XHyphenatedWord> LNG_DLLPUBLIC CreateHyphenatedWord(
+ const OUString &rWord, sal_Int16 nLang, sal_Int16 nHyphenationPos,
+ const OUString &rHyphenatedWord, sal_Int16 nHyphenPos );
+};
+
+
+class PossibleHyphens :
+ public cppu::WeakImplHelper1
+ <
+ ::com::sun::star::linguistic2::XPossibleHyphens
+ >
+{
+ OUString aWord;
+ OUString aWordWithHyphens;
+ ::com::sun::star::uno::Sequence< sal_Int16 > aOrigHyphenPos;
+ sal_Int16 nLanguage;
+
+ // disallow copy-constructor and assignment-operator for now
+ PossibleHyphens(const PossibleHyphens &);
+ PossibleHyphens & operator = (const PossibleHyphens &);
+
+public:
+ PossibleHyphens(const OUString &rWord, sal_Int16 nLang,
+ const OUString &rHyphWord,
+ const ::com::sun::star::uno::Sequence< sal_Int16 > &rPositions);
+ virtual ~PossibleHyphens();
+
+ // XPossibleHyphens
+ virtual OUString SAL_CALL
+ getWord()
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::lang::Locale SAL_CALL
+ getLocale()
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL
+ getPossibleHyphens()
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL
+ getHyphenationPositions()
+ throw(::com::sun::star::uno::RuntimeException);
+
+ OUString GetWord() { return aWord; }
+ sal_Int16 GetLanguage() { return nLanguage; }
+ void SetWord( OUString &rTxt ) { aWord = rTxt; }
+ void SetLanguage( sal_Int16 nLang ) { nLanguage = nLang; }
+
+ static com::sun::star::uno::Reference < com::sun::star::linguistic2::XPossibleHyphens > LNG_DLLPUBLIC CreatePossibleHyphens
+ (const OUString &rWord, sal_Int16 nLang,
+ const OUString &rHyphWord,
+ const ::com::sun::star::uno::Sequence< sal_Int16 > &rPositions);
+};
+} // namespace linguistic
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/linguistic/lngdllapi.h b/include/linguistic/lngdllapi.h
new file mode 100644
index 000000000000..0da35fe7e123
--- /dev/null
+++ b/include/linguistic/lngdllapi.h
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _LNG_DLLAPI_H
+#define _LNG_DLLAPI_H
+
+#include "sal/config.h"
+#include "sal/types.h"
+
+#if defined(LNG_DLLIMPLEMENTATION)
+#define LNG_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define LNG_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define LNG_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/linguistic/lngprophelp.hxx b/include/linguistic/lngprophelp.hxx
new file mode 100644
index 000000000000..3995d87cc1e4
--- /dev/null
+++ b/include/linguistic/lngprophelp.hxx
@@ -0,0 +1,360 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _LINGUISTIC_LNGPROPHELP_HXX_
+#define _LINGUISTIC_LNGPROPHELP_HXX_
+
+#include <tools/solar.h>
+#include <uno/lbnames.h>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/interfacecontainer.h>
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp>
+#include <linguistic/lngdllapi.h>
+
+namespace com { namespace sun { namespace star { namespace beans {
+ class XPropertySet;
+}}}}
+
+namespace com { namespace sun { namespace star { namespace linguistic2 {
+ struct LinguServiceEvent;
+}}}}
+
+
+namespace linguistic
+{
+
+// PropertyChgHelper
+// Base class for all XPropertyChangeListener members of the
+// various lingu services.
+
+
+// Flags for type of events allowed to be launched
+#define AE_SPELLCHECKER 1
+#define AE_HYPHENATOR 2
+
+typedef cppu::WeakImplHelper2
+<
+ ::com::sun::star::beans::XPropertyChangeListener,
+ ::com::sun::star::linguistic2::XLinguServiceEventBroadcaster
+> PropertyChgHelperBase;
+
+class PropertyChgHelper :
+ public PropertyChgHelperBase
+{
+ ::com::sun::star::uno::Sequence< OUString > aPropNames;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > xMyEvtObj;
+ ::cppu::OInterfaceContainerHelper aLngSvcEvtListeners;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > xPropSet;
+
+ int nEvtFlags; // flags for event types allowed to be launched
+
+ // default values
+ sal_Bool bIsIgnoreControlCharacters;
+ sal_Bool bIsUseDictionaryList;
+
+ // return values, will be set to default value or current temporary value
+ sal_Bool bResIsIgnoreControlCharacters;
+ sal_Bool bResIsUseDictionaryList;
+
+
+ // disallow use of copy-constructor and assignment-operator
+ PropertyChgHelper( const PropertyChgHelper & );
+ PropertyChgHelper & operator = ( const PropertyChgHelper & );
+
+protected:
+ virtual void SetDefaultValues();
+ virtual void GetCurrentValues();
+
+ ::com::sun::star::uno::Sequence< OUString > &
+ GetPropNames() { return aPropNames; }
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > &
+ GetPropSet() { return xPropSet; }
+
+ void AddPropNames( const char *pNewNames[], sal_Int32 nCount );
+
+ virtual sal_Bool propertyChange_Impl(
+ const ::com::sun::star::beans::PropertyChangeEvent& rEvt );
+
+public:
+ PropertyChgHelper(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > &rxSource,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > &rxPropSet,
+ int nAllowedEvents );
+ virtual ~PropertyChgHelper();
+
+ virtual void SetTmpPropVals( const com::sun::star::beans::PropertyValues &rPropVals );
+
+ // XEventListener
+ virtual void SAL_CALL
+ disposing( const ::com::sun::star::lang::EventObject& rSource )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // XPropertyChangeListener
+ virtual void SAL_CALL
+ propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& rEvt )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // XLinguServiceEventBroadcaster
+ virtual sal_Bool SAL_CALL
+ addLinguServiceEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XLinguServiceEventListener >& rxListener )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL
+ removeLinguServiceEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XLinguServiceEventListener >& rxListener )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // non-UNO functions
+ void LNG_DLLPUBLIC AddAsPropListener();
+ void LNG_DLLPUBLIC RemoveAsPropListener();
+ void LaunchEvent(
+ const ::com::sun::star::linguistic2::LinguServiceEvent& rEvt );
+
+ const ::com::sun::star::uno::Sequence< OUString > &
+ GetPropNames() const { return aPropNames; }
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > &
+ GetPropSet() const { return xPropSet; }
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > &
+ GetEvtObj() const { return xMyEvtObj; }
+
+ sal_Bool IsIgnoreControlCharacters() const { return bResIsIgnoreControlCharacters; }
+ sal_Bool IsUseDictionaryList() const { return bResIsUseDictionaryList; }
+};
+
+
+class PropertyHelper_Thes :
+ public PropertyChgHelper
+{
+ // disallow use of copy-constructor and assignment-operator
+ PropertyHelper_Thes( const PropertyHelper_Thes & );
+ PropertyHelper_Thes & operator = ( const PropertyHelper_Thes & );
+
+public:
+ PropertyHelper_Thes(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > &rxSource,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > &rxPropSet );
+ virtual ~PropertyHelper_Thes();
+
+ // XPropertyChangeListener
+ virtual void SAL_CALL
+ propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& rEvt )
+ throw(::com::sun::star::uno::RuntimeException);
+};
+
+class LNG_DLLPUBLIC PropertyHelper_Thesaurus
+{
+ PropertyHelper_Thes* pInst;
+ com::sun::star::uno::Reference< com::sun::star::beans::XPropertyChangeListener > xPropHelper;
+
+ // disallow use of copy-constructor and assignment-operator
+ PropertyHelper_Thesaurus( const PropertyHelper_Thes & );
+ PropertyHelper_Thesaurus & operator = ( const PropertyHelper_Thes & );
+
+public:
+ PropertyHelper_Thesaurus(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > &rxSource,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > &rxPropSet );
+ ~PropertyHelper_Thesaurus();
+ void AddAsPropListener();
+ void RemoveAsPropListener();
+ void SetTmpPropVals( const com::sun::star::beans::PropertyValues &rPropVals );
+};
+
+
+class LNG_DLLPUBLIC PropertyHelper_Spell :
+ public PropertyChgHelper
+{
+ // default values
+ sal_Bool bIsSpellUpperCase;
+ sal_Bool bIsSpellWithDigits;
+ sal_Bool bIsSpellCapitalization;
+
+ // return values, will be set to default value or current temporary value
+ sal_Int16 nResMaxNumberOfSuggestions; // special value that is not part of the property set and thus needs to be handled differently
+ sal_Bool bResIsSpellUpperCase;
+ sal_Bool bResIsSpellWithDigits;
+ sal_Bool bResIsSpellCapitalization;
+
+
+ // disallow use of copy-constructor and assignment-operator
+ PropertyHelper_Spell( const PropertyHelper_Spell & );
+ PropertyHelper_Spell & operator = ( const PropertyHelper_Spell & );
+
+protected:
+ // PropertyChgHelper
+ virtual void SetDefaultValues();
+ virtual void GetCurrentValues();
+ virtual sal_Bool propertyChange_Impl(
+ const ::com::sun::star::beans::PropertyChangeEvent& rEvt );
+
+public:
+ PropertyHelper_Spell(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > &rxSource,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > &rxPropSet );
+ virtual ~PropertyHelper_Spell();
+
+ virtual void SetTmpPropVals( const com::sun::star::beans::PropertyValues &rPropVals );
+
+ // XPropertyChangeListener
+ virtual void SAL_CALL
+ propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& rEvt )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Int16 GetDefaultNumberOfSuggestions() const;
+
+ sal_Int16 GetMaxNumberOfSuggestions() const { return nResMaxNumberOfSuggestions; }
+ sal_Bool IsSpellUpperCase() const { return bResIsSpellUpperCase; }
+ sal_Bool IsSpellWithDigits() const { return bResIsSpellWithDigits; }
+ sal_Bool IsSpellCapitalization() const { return bResIsSpellCapitalization; }
+};
+
+
+class LNG_DLLPUBLIC PropertyHelper_Spelling
+{
+ PropertyHelper_Spell* pInst;
+ com::sun::star::uno::Reference< com::sun::star::beans::XPropertyChangeListener > xPropHelper;
+
+ // disallow use of copy-constructor and assignment-operator
+ PropertyHelper_Spelling( const PropertyHelper_Spell & );
+ PropertyHelper_Spelling & operator = ( const PropertyHelper_Spell & );
+
+public:
+ PropertyHelper_Spelling(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > &rxSource,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > &rxPropSet );
+ ~PropertyHelper_Spelling();
+
+ void AddAsPropListener();
+ void RemoveAsPropListener();
+ void SetTmpPropVals( const com::sun::star::beans::PropertyValues &rPropVals );
+ sal_Bool IsSpellUpperCase() const;
+ sal_Bool IsSpellWithDigits() const;
+ sal_Bool IsSpellCapitalization() const;
+ sal_Bool addLinguServiceEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XLinguServiceEventListener >& rxListener )
+ throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool removeLinguServiceEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XLinguServiceEventListener >& rxListener )
+ throw(::com::sun::star::uno::RuntimeException);
+};
+
+
+class PropertyHelper_Hyphen :
+ public PropertyChgHelper
+{
+ // default values
+ sal_Int16 nHyphMinLeading,
+ nHyphMinTrailing,
+ nHyphMinWordLength;
+
+ // return values, will be set to default value or current temporary value
+ sal_Int16 nResHyphMinLeading,
+ nResHyphMinTrailing,
+ nResHyphMinWordLength;
+
+ // disallow use of copy-constructor and assignment-operator
+ PropertyHelper_Hyphen( const PropertyHelper_Hyphen & );
+ PropertyHelper_Hyphen & operator = ( const PropertyHelper_Hyphen & );
+
+protected:
+ // PropertyChgHelper
+ virtual void SetDefaultValues();
+ virtual void GetCurrentValues();
+ virtual sal_Bool propertyChange_Impl(
+ const ::com::sun::star::beans::PropertyChangeEvent& rEvt );
+
+public:
+ PropertyHelper_Hyphen(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > &rxSource,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > &rxPropSet);
+ virtual ~PropertyHelper_Hyphen();
+
+ virtual void SetTmpPropVals( const com::sun::star::beans::PropertyValues &rPropVals );
+
+ // XPropertyChangeListener
+ virtual void SAL_CALL
+ propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& rEvt )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ sal_Int16 GetMinLeading() const { return nResHyphMinLeading; }
+ sal_Int16 GetMinTrailing() const { return nResHyphMinTrailing; }
+ sal_Int16 GetMinWordLength() const { return nResHyphMinWordLength; }
+};
+
+class LNG_DLLPUBLIC PropertyHelper_Hyphenation
+{
+ PropertyHelper_Hyphen* pInst;
+ com::sun::star::uno::Reference< com::sun::star::beans::XPropertyChangeListener > xPropHelper;
+
+ // disallow use of copy-constructor and assignment-operator
+ PropertyHelper_Hyphenation( const PropertyHelper_Hyphen & );
+ PropertyHelper_Hyphenation & operator = ( const PropertyHelper_Hyphen & );
+
+public:
+ PropertyHelper_Hyphenation(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > &rxSource,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > &rxPropSet);
+ ~PropertyHelper_Hyphenation();
+
+ void AddAsPropListener();
+ void RemoveAsPropListener();
+ void SetTmpPropVals( const com::sun::star::beans::PropertyValues &rPropVals );
+ sal_Int16 GetMinLeading() const;
+ sal_Int16 GetMinTrailing() const;
+ sal_Int16 GetMinWordLength() const;
+ sal_Bool addLinguServiceEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XLinguServiceEventListener >& rxListener )
+ throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool removeLinguServiceEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XLinguServiceEventListener >& rxListener )
+ throw(::com::sun::star::uno::RuntimeException);
+};
+
+} // namespace linguistic
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/linguistic/lngprops.hxx b/include/linguistic/lngprops.hxx
new file mode 100644
index 000000000000..2f8339f9b0b8
--- /dev/null
+++ b/include/linguistic/lngprops.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _LINGUISTIC_LNGPROPS_HHX_
+#define _LINGUISTIC_LNGPROPS_HHX_
+
+#include <unotools/linguprops.hxx>
+
+// maximal number of suggestions to be returned in spelling context-menu
+// (may not include results added by looking up user dictionaries)
+#define UPN_MAX_NUMBER_OF_SUGGESTIONS "MaxNumberOfSuggestions"
+
+// WIDs for property names
+//!! Don't change values! They are used as the property handles in
+//!! the service description
+#define WID_IS_GERMAN_PRE_REFORM UPH_IS_GERMAN_PRE_REFORM /*! deprecated !*/
+#define WID_IS_USE_DICTIONARY_LIST UPH_IS_USE_DICTIONARY_LIST
+#define WID_IS_IGNORE_CONTROL_CHARACTERS UPH_IS_IGNORE_CONTROL_CHARACTERS
+#define WID_IS_SPELL_UPPER_CASE UPH_IS_SPELL_UPPER_CASE
+#define WID_IS_SPELL_WITH_DIGITS UPH_IS_SPELL_WITH_DIGITS
+#define WID_IS_SPELL_CAPITALIZATION UPH_IS_SPELL_CAPITALIZATION
+#define WID_HYPH_MIN_LEADING UPH_HYPH_MIN_LEADING
+#define WID_HYPH_MIN_TRAILING UPH_HYPH_MIN_TRAILING
+#define WID_HYPH_MIN_WORD_LENGTH UPH_HYPH_MIN_WORD_LENGTH
+#define WID_DEFAULT_LOCALE UPH_DEFAULT_LOCALE
+#define WID_IS_SPELL_AUTO UPH_IS_SPELL_AUTO
+#define WID_IS_SPELL_HIDE UPH_IS_SPELL_HIDE /*! deprecated !*/
+#define WID_IS_SPELL_IN_ALL_LANGUAGES UPH_IS_SPELL_IN_ALL_LANGUAGES /*! deprecated !*/
+#define WID_IS_SPELL_SPECIAL UPH_IS_SPELL_SPECIAL
+#define WID_IS_HYPH_AUTO UPH_IS_HYPH_AUTO
+#define WID_IS_HYPH_SPECIAL UPH_IS_HYPH_SPECIAL
+#define WID_IS_WRAP_REVERSE UPH_IS_WRAP_REVERSE
+#define WID_DEFAULT_LANGUAGE UPH_DEFAULT_LANGUAGE
+#define WID_DEFAULT_LOCALE_CJK UPH_DEFAULT_LOCALE_CJK
+#define WID_DEFAULT_LOCALE_CTL UPH_DEFAULT_LOCALE_CTL
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/linguistic/misc.hxx b/include/linguistic/misc.hxx
new file mode 100644
index 000000000000..c15d2fc70dab
--- /dev/null
+++ b/include/linguistic/misc.hxx
@@ -0,0 +1,215 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _LINGUISTIC_MISC_HXX_
+#define _LINGUISTIC_MISC_HXX_
+
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/frame/XTerminateListener.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/linguistic2/XDictionaryEntry.hpp>
+#include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
+#include <com/sun/star/linguistic2/XHyphenatedWord.hpp>
+
+#include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
+#include <cppuhelper/implbase1.hxx> // helper for implementations
+#include <unotools/pathoptions.hxx>
+#include <i18nlangtag/lang.h>
+#include <tools/string.hxx>
+#include <unotools/charclass.hxx>
+#include <osl/thread.h>
+#include <osl/mutex.hxx>
+#include <linguistic/lngdllapi.h>
+
+namespace com { namespace sun { namespace star { namespace beans {
+ class XPropertySet;
+ class XFastPropertySet;
+}}}}
+
+namespace com { namespace sun { namespace star { namespace frame {
+ class XDesktop2;
+}}}}
+
+class LocaleDataWrapper;
+
+
+#define SN_GRAMMARCHECKER "com.sun.star.linguistic2.Proofreader"
+#define SN_SPELLCHECKER "com.sun.star.linguistic2.SpellChecker"
+#define SN_HYPHENATOR "com.sun.star.linguistic2.Hyphenator"
+#define SN_THESAURUS "com.sun.star.linguistic2.Thesaurus"
+#define SN_LINGU_PROPERTIES "com.sun.star.linguistic2.LinguProperties"
+
+
+namespace linguistic
+{
+
+/// Flags to be used with the multi-path related functions
+/// @see GetDictionaryPaths
+#define PATH_FLAG_INTERNAL 0x01
+#define PATH_FLAG_USER 0x02
+#define PATH_FLAG_WRITABLE 0x04
+#define PATH_FLAG_ALL (PATH_FLAG_INTERNAL | PATH_FLAG_USER | PATH_FLAG_WRITABLE)
+
+
+// AddEntryToDic return values
+#define DIC_ERR_NONE 0
+#define DIC_ERR_FULL 1
+#define DIC_ERR_READONLY 2
+#define DIC_ERR_UNKNOWN 3
+#define DIC_ERR_NOT_EXISTS 4
+
+// values asigned to capitalization types
+enum CapType
+{
+ CAPTYPE_UNKNOWN,
+ CAPTYPE_NOCAP,
+ CAPTYPE_INITCAP,
+ CAPTYPE_ALLCAP,
+ CAPTYPE_MIXED
+};
+
+LNG_DLLPUBLIC ::osl::Mutex& GetLinguMutex();
+
+LocaleDataWrapper & GetLocaleDataWrapper( sal_Int16 nLang );
+
+sal_Int32 LevDistance( const OUString &rTxt1, const OUString &rTxt2 );
+
+/** Convert Locale to LanguageType for legacy handling.
+ Linguistic specific handling of an empty locale denoting LANGUAGE_NONE.
+ Does not resolve empty locale as system locale.
+ */
+LNG_DLLPUBLIC LanguageType LinguLocaleToLanguage( const ::com::sun::star::lang::Locale& rLocale );
+
+/** Convert LanguageType to Locale for legacy handling.
+ Linguistic specific handling of LANGUAGE_NONE resulting in an empty locale.
+ Avoid use!
+ */
+LNG_DLLPUBLIC ::com::sun::star::lang::Locale LinguLanguageToLocale( LanguageType nLanguage );
+
+/** Checks if a LanguageType is one of the values that denote absence of
+ language or undetermined language or multiple languages, in short all
+ values used in linguistic context that do not denote a specific language.
+ */
+LNG_DLLPUBLIC bool LinguIsUnspecified( LanguageType nLanguage );
+
+::com::sun::star::uno::Sequence< sal_Int16 >
+ LocaleSeqToLangSeq( ::com::sun::star::uno::Sequence<
+ ::com::sun::star::lang::Locale > &rLocaleSeq );
+
+// checks if file pointed to by rURL is readonly
+// and may also check return if such a file exists or not
+sal_Bool IsReadOnly( const String &rURL, sal_Bool *pbExist = 0 );
+
+// checks if a file with the given URL exists
+sal_Bool FileExists( const String &rURL );
+
+
+OUString GetDictionaryWriteablePath();
+::com::sun::star::uno::Sequence< OUString > GetDictionaryPaths( sal_Int16 nPathFlags = PATH_FLAG_ALL );
+
+/// @returns an URL for a new and writable dictionary rDicName.
+/// The URL will point to the path given by 'GetDictionaryWriteablePath'
+LNG_DLLPUBLIC String GetWritableDictionaryURL( const String &rDicName );
+
+LNG_DLLPUBLIC sal_Int32 GetPosInWordToCheck( const OUString &rTxt, sal_Int32 nPos );
+
+::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenatedWord >
+ RebuildHyphensAndControlChars( const OUString &rOrigWord,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenatedWord > &rxHyphWord );
+
+
+LNG_DLLPUBLIC sal_Bool IsUpper( const String &rText, xub_StrLen nPos, xub_StrLen nLen, sal_Int16 nLanguage );
+
+inline sal_Bool IsUpper( const String &rText, sal_Int16 nLanguage ) { return IsUpper( rText, 0, rText.Len(), nLanguage ); }
+LNG_DLLPUBLIC CapType SAL_CALL capitalType(const OUString&, CharClass *);
+
+String ToLower( const String &rText, sal_Int16 nLanguage );
+LNG_DLLPUBLIC sal_Bool HasDigits( const OUString &rText );
+LNG_DLLPUBLIC sal_Bool IsNumeric( const String &rText );
+
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > GetOneInstanceService( const char *pServiceName );
+LNG_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > GetLinguProperties();
+::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSearchableDictionaryList > GetDictionaryList();
+::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary > GetIgnoreAllList();
+
+
+sal_Bool IsUseDicList( const ::com::sun::star::beans::PropertyValues &rProperties,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > &rxPropSet );
+
+sal_Bool IsIgnoreControlChars( const ::com::sun::star::beans::PropertyValues &rProperties,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > &rxPropSet );
+
+::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XDictionaryEntry >
+ SearchDicList(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSearchableDictionaryList >& rDicList,
+ const OUString& rWord, sal_Int16 nLanguage,
+ sal_Bool bSearchPosDics, sal_Bool bSearchSpellEntry );
+
+LNG_DLLPUBLIC sal_uInt8 AddEntryToDic(
+ ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary > &rxDic,
+ const OUString &rWord, sal_Bool bIsNeg,
+ const OUString &rRplcTxt, sal_Int16 nRplcLang,
+ sal_Bool bStripDot = sal_True );
+
+LNG_DLLPUBLIC sal_Bool SaveDictionaries( const ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSearchableDictionaryList > &xDicList );
+
+// AppExitLstnr:
+// virtual base class that calls it AtExit function when the application
+// (ie the Desktop) is about to terminate
+
+class AppExitListener :
+ public cppu::WeakImplHelper1
+ <
+ ::com::sun::star::frame::XTerminateListener
+ >
+{
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XDesktop2 > xDesktop;
+
+public:
+ AppExitListener();
+ virtual ~AppExitListener();
+
+ virtual void AtExit() = 0;
+
+ void Activate();
+ void Deactivate();
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XTerminateListener
+ virtual void SAL_CALL queryTermination( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::frame::TerminationVetoException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL notifyTermination( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+} // namespace linguistic
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/linguistic/spelldta.hxx b/include/linguistic/spelldta.hxx
new file mode 100644
index 000000000000..92f9cd680c77
--- /dev/null
+++ b/include/linguistic/spelldta.hxx
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _LINGUISTIC_SPELLDTA_HXX_
+#define _LINGUISTIC_SPELLDTA_HXX_
+
+#include <vector>
+#include <com/sun/star/linguistic2/XSpellAlternatives.hpp>
+#include <com/sun/star/linguistic2/XSetSpellAlternatives.hpp>
+#include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
+
+#include <tools/solar.h>
+
+#include <uno/lbnames.h>
+#include <cppuhelper/implbase2.hxx>
+#include <linguistic/lngdllapi.h>
+
+#include <boost/noncopyable.hpp>
+
+namespace com { namespace sun { namespace star {
+ namespace linguistic2 {
+ class XDictionaryList;
+ }
+} } }
+
+
+namespace linguistic
+{
+
+::com::sun::star::uno::Sequence< OUString >
+ MergeProposalSeqs(
+ ::com::sun::star::uno::Sequence< OUString > &rAlt1,
+ ::com::sun::star::uno::Sequence< OUString > &rAlt2,
+ sal_Bool bAllowDuplicates );
+
+void SeqRemoveNegEntries(
+ ::com::sun::star::uno::Sequence< OUString > &rSeq,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSearchableDictionaryList > &rxDicList,
+ sal_Int16 nLanguage );
+
+sal_Bool SeqHasEntry(
+ const ::com::sun::star::uno::Sequence< OUString > &rSeq,
+ const OUString &rTxt);
+
+///////////////////////////////////////////////////////////////////////////
+
+void SearchSimilarText( const OUString &rText, sal_Int16 nLanguage,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSearchableDictionaryList > &xDicList,
+ std::vector< OUString > & rDicListProps );
+
+///////////////////////////////////////////////////////////////////////////
+
+
+class SpellAlternatives
+ : public cppu::WeakImplHelper2
+ <
+ ::com::sun::star::linguistic2::XSpellAlternatives,
+ ::com::sun::star::linguistic2::XSetSpellAlternatives
+ >
+ , private ::boost::noncopyable
+{
+ ::com::sun::star::uno::Sequence< OUString > aAlt; // list of alternatives, may be empty.
+ OUString aWord;
+ sal_Int16 nType; // type of failure
+ sal_Int16 nLanguage;
+
+public:
+ LNG_DLLPUBLIC SpellAlternatives();
+ SpellAlternatives(const OUString &rWord, sal_Int16 nLang, sal_Int16 nFailureType,
+ const ::com::sun::star::uno::Sequence< OUString > &rAlternatives );
+ virtual ~SpellAlternatives();
+
+ // XSpellAlternatives
+ virtual OUString SAL_CALL getWord( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int16 SAL_CALL getFailureType( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int16 SAL_CALL getAlternativesCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getAlternatives( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XSetSpellAlternatives
+ virtual void SAL_CALL setAlternatives( const ::com::sun::star::uno::Sequence< OUString >& aAlternatives ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setFailureType( ::sal_Int16 nFailureType ) throw (::com::sun::star::uno::RuntimeException);
+
+ // non-interface specific functions
+ void LNG_DLLPUBLIC SetWordLanguage(const OUString &rWord, sal_Int16 nLang);
+ void LNG_DLLPUBLIC SetFailureType(sal_Int16 nTypeP);
+ void LNG_DLLPUBLIC SetAlternatives( const ::com::sun::star::uno::Sequence< OUString > &rAlt );
+ static com::sun::star::uno::Reference < com::sun::star::linguistic2::XSpellAlternatives > LNG_DLLPUBLIC CreateSpellAlternatives(
+ const OUString &rWord, sal_Int16 nLang, sal_Int16 nTypeP, const ::com::sun::star::uno::Sequence< OUString > &rAlt );
+};
+
+
+///////////////////////////////////////////////////////////////////////////
+
+} // namespace linguistic
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/o3tl/compat_functional.hxx b/include/o3tl/compat_functional.hxx
new file mode 100644
index 000000000000..00ae33cb23bb
--- /dev/null
+++ b/include/o3tl/compat_functional.hxx
@@ -0,0 +1,151 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996-1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/*
+ * Lifted and paraphrased from STLport - with additions from Fridrich
+ * Strba and Thorsten Behrens
+ */
+
+#ifndef INCLUDED_O3TL_COMPAT_FUNCTIONAL_HXX
+#define INCLUDED_O3TL_COMPAT_FUNCTIONAL_HXX
+
+#include <functional>
+
+namespace o3tl
+{
+
+/// Identity functor - return the input value
+template<class T>
+struct identity : public std::unary_function<T, T>
+{
+ T operator()(const T& y) const
+ {
+ return (y);
+ }
+};
+
+/// Functor, given two parameters, return the first
+template<class T1,class T2>
+struct project1st : public std::binary_function<T1, T2, T1>
+{
+ T1 operator()(const T1& y, const T2&) const
+ {
+ return (y);
+ }
+};
+
+/// Functor, given two parameters, return the second
+template<class T1,class T2>
+struct project2nd : public std::binary_function<T1, T2, T2>
+{
+ T2 operator()(const T1&, const T2& x) const
+ {
+ return (x);
+ }
+};
+
+/// Select first value of a pair
+template<class P>
+struct select1st : public std::unary_function<P, typename P::first_type>
+{
+ const typename P::first_type& operator()(const P& y) const
+ {
+ return (y.first);
+ }
+};
+
+/// Select second value of a pair
+template<class P>
+struct select2nd : public std::unary_function<P, typename P::second_type>
+{
+ const typename P::second_type& operator()(const P& y) const
+ {
+ return (y.second);
+ }
+};
+
+/// Call F1 with the result of F2 applied to the one input parameter
+template<class F1, class F2>
+class unary_compose : public std::unary_function<typename F2::argument_type, typename F1::result_type>
+{
+ public:
+ unary_compose(const F1& fnction1, const F2& fnction2) : ftor1(fnction1), ftor2(fnction2) {}
+
+ typename F1::result_type operator()(const typename F2::argument_type& y) const
+ {
+ return (ftor1(ftor2(y)));
+ }
+
+ protected:
+ F1 ftor1;
+ F2 ftor2;
+};
+
+/// Create functor that calls F1 with the result of F2 applied to the one input parameter
+template<class F1, class F2>
+inline unary_compose<F1, F2> compose1(const F1& fnction1, const F2& fnction2)
+{
+ return (unary_compose<F1, F2>(fnction1, fnction2));
+}
+
+/// Calls F2 and F3 for the two args of F1, respectively
+template<class F1, class F2, class F3>
+class binary_compose : public std::unary_function<typename F2::argument_type,typename F1::result_type>
+{
+ public:
+ binary_compose(const F1& fnction1, const F2& fnction2, const F3& fnction3) : ftor1(fnction1), ftor2(fnction2), ftor3(fnction3) {}
+
+ typename F1::result_type operator()(const typename F2::argument_type& y) const
+ {
+ return (ftor1(ftor2(y), ftor3(y)));
+ }
+
+ protected:
+ F1 ftor1;
+ F2 ftor2;
+ F3 ftor3;
+};
+
+/// Creates functor that calls F2 and F3 for the two args of F1, respectively
+template<class F1, class F2, class F3>
+inline binary_compose<F1, F2, F3> compose2(const F1& fnction1, const F2& fnction2, const F3& fnction3)
+{
+ return (binary_compose<F1, F2, F3>(fnction1, fnction2, fnction3));
+}
+
+/// Algo that assigns val, val+1, ... to the given range
+template<typename FwdIter, typename ValueType>
+inline void iota(FwdIter first, FwdIter last, ValueType val)
+{
+ while(first != last)
+ *first++ = val++;
+}
+
+} // namespace o3tl
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/o3tl/cow_wrapper.hxx b/include/o3tl/cow_wrapper.hxx
new file mode 100644
index 000000000000..b54f99d0f190
--- /dev/null
+++ b/include/o3tl/cow_wrapper.hxx
@@ -0,0 +1,322 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_O3TL_COW_WRAPPER_HXX
+#define INCLUDED_O3TL_COW_WRAPPER_HXX
+
+#include <osl/interlck.h>
+
+#include <algorithm>
+
+#include <boost/utility.hpp>
+#include <boost/checked_delete.hpp>
+
+namespace o3tl
+{
+ /** Thread-unsafe refcounting
+
+ This is the default locking policy for cow_wrapper. No
+ locking/guarding against concurrent access is performed
+ whatsoever.
+ */
+ struct UnsafeRefCountingPolicy
+ {
+ typedef sal_uInt32 ref_count_t;
+ static void incrementCount( ref_count_t& rCount ) { ++rCount; }
+ static bool decrementCount( ref_count_t& rCount ) { return --rCount != 0; }
+ };
+
+ /** Thread-safe refcounting
+
+ Use this to have the cow_wrapper refcounting mechanisms employ
+ the thread-safe oslInterlockedCount .
+ */
+ struct ThreadSafeRefCountingPolicy
+ {
+ typedef oslInterlockedCount ref_count_t;
+ static void incrementCount( ref_count_t& rCount ) { osl_atomic_increment(&rCount); }
+ static bool decrementCount( ref_count_t& rCount )
+ {
+ if( rCount == 1 ) // caller is already the only/last reference
+ return false;
+ else
+ return osl_atomic_decrement(&rCount) != 0;
+ }
+ };
+
+ /** Copy-on-write wrapper.
+
+ This template provides copy-on-write semantics for the wrapped
+ type: when copying, the operation is performed shallow,
+ i.e. different cow_wrapper objects share the same underlying
+ instance. Only when accessing the underlying object via
+ non-const methods, a unique copy is provided.
+
+ The type parameter <code>T</code> must satisfy the following
+ requirements: it must be default-constructible, copyable (it
+ need not be assignable), and be of non-reference type. Note
+ that, despite the fact that this template provides access to
+ the wrapped type via pointer-like methods
+ (<code>operator->()</code> and <code>operator*()</code>), it does
+ <em>not</em> work like e.g. the boost pointer wrappers
+ (shared_ptr, scoped_ptr, etc.). Internally, the cow_wrapper
+ holds a by-value instance of the wrapped object. This is to
+ avoid one additional heap allocation, and providing access via
+ <code>operator->()</code>/<code>operator*()</code> is because
+ <code>operator.()</code> cannot be overridden.
+
+ Regarding thread safety: this wrapper is <em>not</em>
+ thread-safe per se, because cow_wrapper has no way of
+ syncronizing the potentially many different cow_wrapper
+ instances, that reference a single shared value_type
+ instance. That said, when passing
+ <code>ThreadSafeRefCountingPolicy</code> as the
+ <code>MTPolicy</code> parameter, accessing a thread-safe
+ pointee through multiple cow_wrapper instances might be
+ thread-safe, if the individual pointee methods are
+ thread-safe, <em>including</em> pointee's copy
+ constructor. Any wrapped object that needs external
+ synchronisation (e.g. via an external mutex, which arbitrates
+ access to object methods, and can be held across multiple
+ object method calls) cannot easily be dealt with in a
+ thread-safe way, because, as noted, objects are shared behind
+ the client's back.
+
+ @attention if one wants to use the pimpl idiom together with
+ cow_wrapper (i.e. put an opaque type into the cow_wrapper),
+ then <em>all<em> methods in the surrounding class needs to be
+ non-inline (<em>including</em> destructor, copy constructor
+ and assignment operator).
+
+ @example
+ <pre>
+class cow_wrapper_client_impl;
+
+class cow_wrapper_client
+{
+public:
+ cow_wrapper_client();
+ cow_wrapper_client( const cow_wrapper_client& );
+ ~cow_wrapper_client();
+
+ cow_wrapper_client& operator=( const cow_wrapper_client& );
+
+ void modify( int nVal );
+ int queryUnmodified() const;
+
+private:
+ otl::cow_wrapper< cow_wrapper_client_impl > maImpl;
+};
+ </pre>
+ and the implementation file would look like this:
+ <pre>
+class cow_wrapper_client_impl
+{
+public:
+ void setValue( int nVal ) { mnValue = nVal; }
+ int getValue() const { return mnValue; }
+
+private:
+ int mnValue;
+}
+
+cow_wrapper_client::cow_wrapper_client() :
+ maImpl()
+{
+}
+cow_wrapper_client::cow_wrapper_client( const cow_wrapper_client& rSrc ) :
+ maImpl( rSrc.maImpl )
+{
+}
+cow_wrapper_client::~cow_wrapper_client()
+{
+}
+cow_wrapper_client& cow_wrapper_client::operator=( const cow_wrapper_client& rSrc )
+{
+ maImpl = rSrc.maImpl;
+ return *this;
+}
+void cow_wrapper_client::modify( int nVal )
+{
+ maImpl->setValue( nVal );
+}
+int cow_wrapper_client::queryUnmodified() const
+{
+ return maImpl->getValue();
+}
+ </pre>
+ */
+ template<typename T, class MTPolicy=UnsafeRefCountingPolicy> class cow_wrapper
+ {
+ /** shared value object - gets cloned before cow_wrapper hands
+ out a non-const reference to it
+ */
+ struct impl_t : private boost::noncopyable
+ {
+ impl_t() :
+ m_value(),
+ m_ref_count(1)
+ {
+ }
+
+ explicit impl_t( const T& v ) :
+ m_value(v),
+ m_ref_count(1)
+ {
+ }
+
+ T m_value;
+ typename MTPolicy::ref_count_t m_ref_count;
+ };
+
+ void release()
+ {
+ if( !MTPolicy::decrementCount(m_pimpl->m_ref_count) )
+ boost::checked_delete(m_pimpl), m_pimpl=0;
+ }
+
+ public:
+ typedef T value_type;
+ typedef T* pointer;
+ typedef const T* const_pointer;
+ typedef MTPolicy mt_policy;
+
+ /** Default-construct wrapped type instance
+ */
+ cow_wrapper() :
+ m_pimpl( new impl_t() )
+ {
+ }
+
+ /** Copy-construct wrapped type instance from given object
+ */
+ explicit cow_wrapper( const value_type& r ) :
+ m_pimpl( new impl_t(r) )
+ {
+ }
+
+ /** Shallow-copy given cow_wrapper
+ */
+ explicit cow_wrapper( const cow_wrapper& rSrc ) : // nothrow
+ m_pimpl( rSrc.m_pimpl )
+ {
+ MTPolicy::incrementCount( m_pimpl->m_ref_count );
+ }
+
+ ~cow_wrapper() // nothrow, if ~T does not throw
+ {
+ release();
+ }
+
+ /// now sharing rSrc cow_wrapper instance with us
+ cow_wrapper& operator=( const cow_wrapper& rSrc ) // nothrow
+ {
+ // this already guards against self-assignment
+ MTPolicy::incrementCount( rSrc.m_pimpl->m_ref_count );
+
+ release();
+ m_pimpl = rSrc.m_pimpl;
+
+ return *this;
+ }
+
+ /// unshare with any other cow_wrapper instance
+ value_type& make_unique()
+ {
+ if( m_pimpl->m_ref_count > 1 )
+ {
+ impl_t* pimpl = new impl_t(m_pimpl->m_value);
+ release();
+ m_pimpl = pimpl;
+ }
+
+ return m_pimpl->m_value;
+ }
+
+ /// true, if not shared with any other cow_wrapper instance
+ bool is_unique() const // nothrow
+ {
+ return m_pimpl->m_ref_count == 1;
+ }
+
+ /// return number of shared instances (1 for unique object)
+ typename MTPolicy::ref_count_t use_count() const // nothrow
+ {
+ return m_pimpl->m_ref_count;
+ }
+
+ void swap(cow_wrapper& r) // never throws
+ {
+ std::swap(m_pimpl, r.m_pimpl);
+ }
+
+ pointer operator->() { return &make_unique(); }
+ value_type& operator*() { return make_unique(); }
+ const_pointer operator->() const { return &m_pimpl->m_value; }
+ const value_type& operator*() const { return m_pimpl->m_value; }
+
+ pointer get() { return &make_unique(); }
+ const_pointer get() const { return &m_pimpl->m_value; }
+
+ /// true, if both cow_wrapper internally share the same object
+ bool same_object( const cow_wrapper& rOther ) const
+ {
+ return rOther.m_pimpl == m_pimpl;
+ }
+
+ private:
+ impl_t* m_pimpl;
+ };
+
+
+ template<class T, class P> inline bool operator==( const cow_wrapper<T,P>& a,
+ const cow_wrapper<T,P>& b )
+ {
+ return a.same_object(b) ? true : *a == *b;
+ }
+
+ template<class T, class P> inline bool operator!=( const cow_wrapper<T,P>& a,
+ const cow_wrapper<T,P>& b )
+ {
+ return a.same_object(b) ? false : *a != *b;
+ }
+
+ template<class A, class B, class P> inline bool operator<( const cow_wrapper<A,P>& a,
+ const cow_wrapper<B,P>& b )
+ {
+ return *a < *b;
+ }
+
+ template<class T, class P> inline void swap( cow_wrapper<T,P>& a,
+ cow_wrapper<T,P>& b )
+ {
+ a.swap(b);
+ }
+
+ // to enable boost::mem_fn on cow_wrapper
+ template<class T, class P> inline T * get_pointer( const cow_wrapper<T,P>& r )
+ {
+ return r.get();
+ }
+
+}
+
+#endif /* INCLUDED_O3TL_COW_WRAPPER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/o3tl/heap_ptr.hxx b/include/o3tl/heap_ptr.hxx
new file mode 100644
index 000000000000..713aa21c41b8
--- /dev/null
+++ b/include/o3tl/heap_ptr.hxx
@@ -0,0 +1,305 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_O3TL_HEAP_PTR_HXX
+#define INCLUDED_O3TL_HEAP_PTR_HXX
+
+
+#include <boost/assert.hpp>
+#include <boost/checked_delete.hpp>
+
+
+namespace o3tl
+{
+/** heap_ptr<> owns an object on the heap, which will be automatically
+ deleted, when ~heap_ptr<>() is called.
+
+ Applicability
+ -------------
+ heap_ptr<> can be used for class members on the heap.
+ - One cannot forget to delete them in the destructor.
+ - Constness will be transfered from the owning instance.
+
+ heap_ptr<> can also be used as smart pointer in function bodies to
+ ensure exception safety.
+
+ Special Characteristics
+ -----------------------
+ - heap_ptr<> transfers constness from the owning object to
+ the pointed to object. Such it behaves like if *get() would be
+ a normal member of the owning object, not a pointer member.
+ This is preferable to the normal pointer behaviour, because
+ if an object is owned by another one, it is normally part of
+ its state.
+
+ - heap_ptr<> provides a ->release() function
+
+ - For reasons of simplicity and portability ->is()
+ is preferred over the safe-bool idiom.
+
+ Copyability
+ -----------
+ heap_ptr is non copyable.
+ - It forbids the copyconstructor and operator=(self).
+
+ - Owning classes will automatically be non copyable, if they do not
+ redefine those two functions themselves.
+
+ Incomplete Types
+ ----------------
+ heap_ptr<> also works with incomplete types. You only need to write
+ class T;
+ but need not include <T>.hxx.
+
+ If you use heap_ptr<> with an incomplete type, the owning class
+ needs to define a non-inline destructor. Else the compiler will
+ complain.
+*/
+template <class T>
+class heap_ptr
+{
+ public:
+ typedef T element_type; /// Provided for generic programming.
+ typedef heap_ptr<T> self;
+
+#ifndef __SUNPRO_CC
+ typedef T * (self::* safe_bool )();
+#endif
+
+ /// Now, pass_heapObject is owned by this.
+ explicit heap_ptr(
+ T * pass_heapObject = 0 );
+ ~heap_ptr();
+
+
+ /** Identical to reset(), except of the return value.
+ @see heap_ptr<>::reset()
+ */
+ self & operator=(
+ T * pass_heapObject );
+ const T & operator*() const;
+ T & operator*();
+ const T * operator->() const;
+ T * operator->();
+
+ /// True, if pHeapObject != 0.
+#ifndef __SUNPRO_CC
+ operator safe_bool() const;
+#else // workaround opt bug of Sun C++ compiler, when compiling with -xO3
+ operator bool() const;
+#endif
+
+
+ /** This deletes any prevoiusly existing ->pHeapObject.
+ Now, pass_heapObject, if != 0, is owned by this.
+
+ @onerror
+ Ignores self-assignment.
+ Such, multiple assignment of the same pointer to the same
+ instance of heap_ptr<> is possible (though not recommended).
+ */
+ void reset(
+ T * pass_heapObject );
+ /** @return An object on the heap that must be deleted by the caller,
+ or 0.
+
+ @postcond get() == 0;
+ */
+ T * release();
+ void swap(
+ self & io_other );
+
+ /// True, if pHeapObject != 0.
+ bool is() const;
+ const T * get() const;
+ T * get();
+
+ private:
+ // Forbidden functions:
+ heap_ptr( const self & ); /// Prevent copies.
+ self & operator=( const self & ); /// Prevent copies.
+
+ /// @attention Does not set ->pHeapObject = 0.
+ void internal_delete();
+
+ // DATA
+ /// Will be deleted, when *this is destroyed.
+ T * pHeapObject;
+};
+
+
+/** Supports the semantic of std::swap(). Provided as an aid to
+ generic programming.
+*/
+template<class T>
+inline void
+swap( heap_ptr<T> & io_a,
+ heap_ptr<T> & io_b )
+{
+ io_a.swap(io_b);
+}
+
+
+
+// IMPLEMENTATION
+
+template <class T>
+inline void
+heap_ptr<T>::internal_delete()
+{
+ ::boost::checked_delete(pHeapObject);
+
+ // Do not set pHeapObject to 0, because
+ // that is reset to a value in all code
+ // where internal_delete() is used.
+}
+
+template <class T>
+inline
+heap_ptr<T>::heap_ptr( T * pass_heapObject )
+ : pHeapObject(pass_heapObject)
+{
+}
+
+template <class T>
+inline
+heap_ptr<T>::~heap_ptr()
+{
+ internal_delete();
+}
+
+template <class T>
+inline heap_ptr<T> &
+heap_ptr<T>::operator=(T * pass_heapObject)
+{
+ reset(pass_heapObject);
+ return *this;
+}
+
+template <class T>
+inline const T &
+heap_ptr<T>::operator*() const
+{
+ BOOST_ASSERT( pHeapObject != 0
+ && "Accessing a heap_ptr<>(0)." );
+ return *pHeapObject;
+}
+
+template <class T>
+inline T &
+heap_ptr<T>::operator*()
+{
+ BOOST_ASSERT( pHeapObject != 0
+ && "Accessing a heap_ptr<>(0)." );
+ return *pHeapObject;
+}
+
+template <class T>
+inline const T *
+heap_ptr<T>::operator->() const
+{
+ return pHeapObject;
+}
+
+template <class T>
+inline T *
+heap_ptr<T>::operator->()
+{
+ return pHeapObject;
+}
+
+#ifndef __SUNPRO_CC
+
+template <class T>
+inline
+heap_ptr<T>::operator typename heap_ptr<T>::safe_bool() const
+{
+ return is()
+ ? safe_bool(&self::get)
+ : safe_bool(0);
+}
+
+#else
+
+template <class T>
+inline heap_ptr<T>::operator bool() const
+{
+ return is();
+}
+
+#endif // !defined(__SUNPRO_CC)
+
+
+
+template <class T>
+void
+heap_ptr<T>::reset(T * pass_heapObject)
+{
+ if ( pHeapObject != 0
+ && pHeapObject == pass_heapObject)
+ return;
+
+ internal_delete();
+ pHeapObject = pass_heapObject;
+}
+
+template <class T>
+T *
+heap_ptr<T>::release()
+{
+ T * ret = pHeapObject;
+ pHeapObject = 0;
+ return ret;
+}
+
+template <class T>
+void
+heap_ptr<T>::swap(self & io_other)
+{
+ T * temp = io_other.pHeapObject;
+ io_other.pHeapObject = pHeapObject;
+ pHeapObject = temp;
+}
+
+template <class T>
+inline bool
+heap_ptr<T>::is() const
+{
+ return pHeapObject != 0;
+}
+
+template <class T>
+inline const T *
+heap_ptr<T>::get() const
+{
+ return pHeapObject;
+}
+
+template <class T>
+inline T *
+heap_ptr<T>::get()
+{
+ return pHeapObject;
+}
+
+
+} // namespace o3tl
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/o3tl/lazy_update.hxx b/include/o3tl/lazy_update.hxx
new file mode 100644
index 000000000000..b05bda37ba40
--- /dev/null
+++ b/include/o3tl/lazy_update.hxx
@@ -0,0 +1,265 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_O3TL_LAZY_UPDATE_HXX
+#define INCLUDED_O3TL_LAZY_UPDATE_HXX
+
+#include <sal/types.h>
+#include <boost/function.hpp>
+
+namespace o3tl
+{
+ /** Update output object lazily
+
+ This template collects data in input type, and updates the
+ output type with the given update functor, but only if the
+ output is requested. Usefl if updating is expensive, or input
+ changes frequently, but output is only comparatively seldom
+ used.
+
+ @example
+ <pre>
+LazyUpdate<InType,OutType,LAZYUPDATE_DIRECT_TAG> myValue;
+*myValue = newInput;
+myValue->updateInput( this, that, those );
+
+output( *myValue );
+ </pre>
+ or
+ <pre>
+output( myValue.getOutValue() );
+ </pre>
+ if the compiler does not recognize the const context.
+ */
+ template< typename InputType, typename OutputType, typename Tag > class LazyUpdate;
+
+ /// LazyUpdate specialization takes boost::function argument
+ struct LAZYUPDATE_FUNCTOR_TAG {};
+ /// LazyUpdate specialization takes OutputType (*FunctionType)( InputType const& ) argument
+ struct LAZYUPDATE_FUNCTION_TAG {};
+ /// LazyUpdate specialization can directly convert, OutputType ctor must take InputType argument
+ struct LAZYUPDATE_DIRECT_TAG {};
+
+ // -----------------------------------------------------------------------------------------------------
+
+ namespace detail
+ {
+ /// @internal
+ template< typename InputType, typename OutputType, typename Functor > class LazyUpdateImpl : private Functor
+ {
+ public:
+ typedef OutputType output_type;
+ typedef InputType input_type;
+
+ LazyUpdateImpl() :
+ m_aInput()
+ {}
+
+ template< typename ParamType > explicit LazyUpdateImpl( ParamType const& rParm ) :
+ Functor(rParm),
+ m_aInput()
+ {}
+
+ enum UnaryConstructorTag{ UNARY_CONSTRUCTOR_TAG };
+ LazyUpdateImpl( const input_type& rInput, UnaryConstructorTag ) :
+ m_aInput(rInput)
+ {}
+
+ template< typename ParamType > LazyUpdateImpl( ParamType const& rParm,
+ const input_type& rInput ) :
+ Functor(rParm),
+ m_aInput(rInput)
+ {}
+
+ // default copy ctor/assignment operator are ok
+ // LazyUpdate( const LazyUpdate& );
+ // LazyUpdate& operator=( const LazyUpdate& );
+
+ void setInValue( input_type const& rIn ) { Functor::m_bCacheDirty = true; m_aInput = rIn; }
+ input_type const& getInValue() const { return m_aInput; }
+ output_type const& getOutValue() const { return this->implUpdateValue(m_aInput); }
+
+ input_type& operator*() { Functor::m_bCacheDirty = true; return m_aInput; }
+ input_type* operator->() { Functor::m_bCacheDirty = true; return &m_aInput; }
+
+ output_type const& operator*() const { return this->implUpdateValue(m_aInput); }
+ output_type const* operator->() const { return &(this->implUpdateValue(m_aInput)); }
+
+ private:
+ input_type m_aInput;
+ };
+
+ template< typename InputType, typename OutputType > struct DefaultFunctor
+ {
+ protected:
+ typedef OutputType output_type;
+ typedef InputType input_type;
+
+ DefaultFunctor() :
+ m_aOutput(),
+ m_bCacheDirty(true)
+ {}
+
+ OutputType const& implUpdateValue( input_type const& rIn ) const
+ {
+ if( m_bCacheDirty )
+ {
+ m_aOutput = output_type( rIn );
+ m_bCacheDirty = false;
+ }
+
+ return m_aOutput;
+ }
+
+ mutable output_type m_aOutput;
+ mutable bool m_bCacheDirty; // when true, m_aOutput needs update
+ };
+
+ template< typename InputType, typename OutputType, typename FunctionType > struct FunctionPointer
+ {
+ protected:
+ typedef OutputType output_type;
+ typedef InputType input_type;
+ typedef FunctionType function_type;
+
+ FunctionPointer() :
+ m_pFunc(),
+ m_aOutput(),
+ m_bCacheDirty(true)
+
+ {}
+
+ explicit FunctionPointer( function_type const& pFunc ) :
+ m_pFunc(pFunc),
+ m_aOutput(),
+ m_bCacheDirty(true)
+
+ {}
+
+ output_type const& implUpdateValue( input_type const& rIn ) const
+ {
+ if( m_bCacheDirty )
+ {
+ m_aOutput = m_pFunc( rIn );
+ m_bCacheDirty = false;
+ }
+
+ return m_aOutput;
+ }
+
+ function_type m_pFunc;
+ mutable output_type m_aOutput;
+ mutable bool m_bCacheDirty; // when true, m_aOutput needs update
+ };
+ }
+
+ // -----------------------------------------------------------------------------------------------------
+
+ // partial specializations for the three LAZYUPDATE_* tags
+
+ template< typename InputType, typename OutputType > class LazyUpdate<InputType,
+ OutputType,
+ LAZYUPDATE_DIRECT_TAG> :
+ public detail::LazyUpdateImpl<InputType,
+ OutputType,
+ detail::DefaultFunctor<InputType, OutputType> >
+ {
+ public:
+ LazyUpdate() {}
+ explicit LazyUpdate( InputType const& rIn ) :
+ detail::LazyUpdateImpl<InputType,
+ OutputType,
+ detail::DefaultFunctor<InputType, OutputType> >(
+ rIn,
+ detail::LazyUpdateImpl<
+ InputType,
+ OutputType,
+ detail::DefaultFunctor<InputType, OutputType> >::UNARY_CONSTRUCTOR_TAG )
+ {}
+ };
+
+ // -----------------------------------------------------------------------------------------------------
+
+ template< typename InputType, typename OutputType > class LazyUpdate<InputType,
+ OutputType,
+ LAZYUPDATE_FUNCTION_TAG> :
+ public detail::LazyUpdateImpl<InputType,
+ OutputType,
+ detail::FunctionPointer<
+ InputType,
+ OutputType,
+ OutputType (*)( InputType const& ) > >
+ {
+ public:
+ explicit LazyUpdate( OutputType (*pFunc)( InputType const& ) ) :
+ detail::LazyUpdateImpl<InputType,
+ OutputType,
+ detail::FunctionPointer<
+ InputType,
+ OutputType,
+ OutputType (*)( InputType const& )> >(pFunc)
+ {}
+ LazyUpdate( OutputType (*pFunc)( InputType const& ),
+ InputType const& rIn ) :
+ detail::LazyUpdateImpl<InputType,
+ OutputType,
+ detail::FunctionPointer<
+ InputType,
+ OutputType,
+ OutputType (*)( InputType const& )> >(pFunc,rIn)
+ {}
+ };
+
+ // -----------------------------------------------------------------------------------------------------
+
+ template< typename InputType, typename OutputType > class LazyUpdate<InputType,
+ OutputType,
+ LAZYUPDATE_FUNCTOR_TAG> :
+ public detail::LazyUpdateImpl<InputType,
+ OutputType,
+ detail::FunctionPointer<
+ InputType,
+ OutputType,
+ boost::function1<OutputType,InputType> > >
+ {
+ public:
+ explicit LazyUpdate( boost::function1<OutputType,InputType> const& rFunc ) :
+ detail::LazyUpdateImpl<InputType,
+ OutputType,
+ detail::FunctionPointer<
+ InputType,
+ OutputType,
+ boost::function1<OutputType,InputType> > >(rFunc)
+ {}
+ LazyUpdate( boost::function1<OutputType,InputType> const& rFunc,
+ InputType const& rIn ) :
+ detail::LazyUpdateImpl<InputType,
+ OutputType,
+ detail::FunctionPointer<
+ InputType,
+ OutputType,
+ boost::function1<OutputType,InputType> > >(rFunc,rIn)
+ {}
+ };
+
+}
+
+#endif /* INCLUDED_O3TL_LAZY_UPDATE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/o3tl/range.hxx b/include/o3tl/range.hxx
new file mode 100644
index 000000000000..a5ebacb4c6b8
--- /dev/null
+++ b/include/o3tl/range.hxx
@@ -0,0 +1,183 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_O3TL_RANGE_HXX
+#define INCLUDED_O3TL_RANGE_HXX
+
+
+#include <cstring> // for std::size_t
+#include <boost/assert.hpp>
+
+
+
+namespace o3tl
+{
+/** Represents a range of integer or iterator values.
+
+ @tpl T
+ Has to be assignable, add- and subtractable. That is:
+ either it is
+ - an integral type
+ - or a random access iterator.
+*/
+template <class T>
+class range
+{
+ public:
+ typedef T element_type; /// Provided for generic programming.
+ typedef range<T> self;
+
+ // LIFECYCLE
+ range(
+ T i_inclusiveLowerBorder,
+ T i_exclusiveUpperBorder );
+ ~range();
+ // INQUIRY
+ T begin() const;
+ T end() const;
+ std::size_t size() const;
+
+ bool contains(
+ T i_value ) const;
+ bool contains(
+ const self & i_other ) const;
+ bool overlaps(
+ const self & i_other ) const;
+ /// @return i_other.begin() - this->end()
+ long distance_to(
+ const self & i_other ) const;
+ private:
+ // DATA
+ T nBegin;
+ T nEnd;
+};
+
+
+template <class T>
+inline range<T>
+make_range(T i1, T i2)
+{
+ return range<T>(i1, i2);
+}
+
+template <class T>
+inline range<typename T::const_iterator>
+range_of(const T & i_container)
+{
+ return make_range( i_container.begin(),
+ i_container.end()
+ );
+}
+
+template <class T>
+inline range<typename T::iterator>
+range_of(T & io_container)
+{
+ return make_range( io_container.begin(),
+ io_container.end()
+ );
+}
+
+
+
+
+
+// IMPLEMENTATION
+
+template <class T>
+range<T>::range( T i_inclusiveLowerBorder,
+ T i_exclusiveUpperBorder )
+ : nBegin(i_inclusiveLowerBorder),
+ nEnd(i_exclusiveUpperBorder)
+{
+ BOOST_ASSERT( nBegin <= nEnd
+ && "Invalid parameters for range<> constructor.");
+}
+
+template <class T>
+range<T>::~range()
+{
+}
+
+template <class T>
+inline T
+range<T>::begin() const
+{
+ return nBegin;
+}
+
+template <class T>
+inline T
+range<T>::end() const
+{
+ return nEnd;
+}
+
+template <class T>
+inline std::size_t
+range<T>::size() const
+{
+ BOOST_ASSERT( nBegin <= nEnd
+ && "Invalid range limits in range<>::size().");
+ return static_cast<std::size_t>( end() - begin() );
+}
+
+template <class T>
+bool
+range<T>::contains(T i_value ) const
+{
+ return begin() <= i_value
+ && i_value < end();
+}
+
+template <class T>
+bool
+range<T>::contains(const self & i_other) const
+{
+ // This is subtle, because this would be wrong:
+ // begin() <= i_other.begin()
+ // && i_other.end() <= end();
+ // An empty range that begins and starts at my end()
+ // must not be contained.
+
+ return contains(i_other.begin())
+ && i_other.end() <= end();
+}
+
+template <class T>
+bool
+range<T>::overlaps(const self & i_other) const
+{
+ return contains(i_other.begin())
+ || i_other.contains(begin());
+}
+
+template <class T>
+long
+range<T>::distance_to(const self & i_other) const
+{
+ return i_other.begin() - end();
+}
+
+
+
+} // namespace o3tl
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/o3tl/sorted_vector.hxx b/include/o3tl/sorted_vector.hxx
new file mode 100644
index 000000000000..776fd5605e6f
--- /dev/null
+++ b/include/o3tl/sorted_vector.hxx
@@ -0,0 +1,237 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_O3TL_SORTED_VECTOR_HXX
+#define INCLUDED_O3TL_SORTED_VECTOR_HXX
+
+#include <vector>
+#include <functional>
+#include <algorithm>
+
+namespace o3tl
+{
+
+// forward declared because it's default tempate arg for sorted_vector
+template<class Value, class Compare>
+struct find_unique;
+
+/** Represents a sorted vector of values.
+
+ @tpl Value class of item to be stored in container
+ @tpl Compare comparison method
+ @tpl Find look up index of a Value in the array
+*/
+template<typename Value, typename Compare = std::less<Value>,
+ template<typename, typename> class Find = find_unique >
+class sorted_vector
+ : private std::vector<Value>
+{
+private:
+ typedef Find<Value, Compare> Find_t;
+ typedef typename std::vector<Value> base_t;
+ typedef typename std::vector<Value>::iterator iterator;
+public:
+ typedef typename std::vector<Value>::const_iterator const_iterator;
+ typedef typename std::vector<Value>::size_type size_type;
+
+ using base_t::clear;
+ using base_t::empty;
+ using base_t::size;
+
+ // MODIFIERS
+
+ std::pair<const_iterator,bool> insert( const Value& x )
+ {
+ std::pair<const_iterator, bool> const ret(Find_t()(begin(), end(), x));
+ if (!ret.second)
+ {
+ const_iterator const it = base_t::insert(
+ begin_nonconst() + (ret.first - begin()), x);
+ return std::make_pair(it, true);
+ }
+ return std::make_pair(ret.first, false);
+ }
+
+ size_type erase( const Value& x )
+ {
+ std::pair<const_iterator, bool> const ret(Find_t()(begin(), end(), x));
+ if (ret.second)
+ {
+ base_t::erase(begin_nonconst() + (ret.first - begin()));
+ return 1;
+ }
+ return 0;
+ }
+
+ void erase( size_t index )
+ {
+ base_t::erase( begin_nonconst() + index );
+ }
+
+ // like C++ 2011: erase with const_iterator (doesn't change sort order)
+ void erase(const_iterator const& position)
+ { // C++98 has vector::erase(iterator), so call that
+ base_t::erase(begin_nonconst() + (position - begin()));
+ }
+
+ void erase(const_iterator const& first, const_iterator const& last)
+ {
+ base_t::erase(begin_nonconst() + (first - begin()),
+ begin_nonconst() + (last - begin()));
+ }
+
+ // ACCESSORS
+
+ // Only return a const iterator, so that the vector cannot be directly updated.
+ const_iterator begin() const
+ {
+ return base_t::begin();
+ }
+
+ // Only return a const iterator, so that the vector cannot be directly updated.
+ const_iterator end() const
+ {
+ return base_t::end();
+ }
+
+ const Value& front() const
+ {
+ return base_t::front();
+ }
+
+ const Value& back() const
+ {
+ return base_t::back();
+ }
+
+ const Value& operator[]( size_t index ) const
+ {
+ return base_t::operator[]( index );
+ }
+
+ // OPERATIONS
+
+ const_iterator lower_bound( const Value& x ) const
+ {
+ return std::lower_bound( base_t::begin(), base_t::end(), x, Compare() );
+ }
+
+ const_iterator upper_bound( const Value& x ) const
+ {
+ return std::upper_bound( base_t::begin(), base_t::end(), x, Compare() );
+ }
+
+ /* Searches the container for an element with a value of x
+ * and returns an iterator to it if found, otherwise it returns an
+ * iterator to sorted_vector::end (the element past the end of the container).
+ *
+ * Only return a const iterator, so that the vector cannot be directly updated.
+ */
+ const_iterator find( const Value& x ) const
+ {
+ std::pair<const_iterator, bool> const ret(Find_t()(begin(), end(), x));
+ return (ret.second) ? ret.first : end();
+ }
+
+ void insert(sorted_vector<Value,Compare,Find> const& rOther)
+ {
+ // optimisation for the rather common case that we are overwriting this with the contents
+ // of another sorted vector
+ if ( empty() )
+ {
+ base_t::insert(begin_nonconst(), rOther.begin(), rOther.end());
+ }
+ else
+ for( const_iterator it = rOther.begin(); it != rOther.end(); ++it )
+ insert( *it );
+ }
+
+ /* Clear() elements in the vector, and free them one by one. */
+ void DeleteAndDestroyAll()
+ {
+ for( const_iterator it = begin(); it != end(); ++it )
+ delete *it;
+ clear();
+ }
+
+ // fdo#58793: some existing code in Writer (SwpHintsArray)
+ // routinely modifies the members of the vector in a way that
+ // violates the sort order, and then re-sorts the array.
+ // This is a kludge to enable that code to work.
+ // If you are calling this function, you are Doing It Wrong!
+ void Resort()
+ {
+ std::stable_sort(begin_nonconst(), end_nonconst(), Compare());
+ }
+
+private:
+
+ typename base_t::iterator begin_nonconst() { return base_t::begin(); }
+ typename base_t::iterator end_nonconst() { return base_t::end(); }
+
+};
+
+
+/** Implements an ordering function over a pointer, where the comparison uses the < operator on the pointed-to types.
+ Very useful for the cases where we put pointers to objects inside a sorted_vector.
+*/
+template <class T> struct less_ptr_to : public std::binary_function <T*,T*,bool>
+{
+ bool operator() ( T* const& lhs, T* const& rhs ) const
+ {
+ return (*lhs) < (*rhs);
+ }
+};
+
+/** the elements are totally ordered by Compare,
+ for no 2 elements !Compare(a,b) && !Compare(b,a) is true
+ */
+template<class Value, class Compare>
+struct find_unique
+{
+ typedef typename sorted_vector<Value, Compare,
+ o3tl::find_unique> ::const_iterator const_iterator;
+ std::pair<const_iterator, bool> operator()(
+ const_iterator first, const_iterator last,
+ Value const& v)
+ {
+ const_iterator const it = std::lower_bound(first, last, v, Compare());
+ return std::make_pair(it, (it != last && !Compare()(v, *it)));
+ }
+};
+
+/** the elements are partially ordered by Compare,
+ 2 elements are allowed if they are not the same element (pointer equal)
+ */
+template<class Value, class Compare>
+struct find_partialorder_ptrequals
+{
+ typedef typename sorted_vector<Value, Compare,
+ o3tl::find_partialorder_ptrequals>::const_iterator const_iterator;
+ std::pair<const_iterator, bool> operator()(
+ const_iterator first, const_iterator last,
+ Value const& v)
+ {
+ std::pair<const_iterator, const_iterator> const its =
+ std::equal_range(first, last, v, Compare());
+ for (const_iterator it = its.first; it != its.second; ++it)
+ {
+ if (v == *it)
+ {
+ return std::make_pair(it, true);
+ }
+ }
+ return std::make_pair(its.first, false);
+ }
+};
+
+} // namespace o3tl
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/o3tl/vector_pool.hxx b/include/o3tl/vector_pool.hxx
new file mode 100644
index 000000000000..b132289af3ab
--- /dev/null
+++ b/include/o3tl/vector_pool.hxx
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_O3TL_VECTOR_POOL_HXX
+#define INCLUDED_O3TL_VECTOR_POOL_HXX
+
+#include <sal/types.h>
+#include <vector>
+
+namespace o3tl
+{
+ namespace detail
+ {
+ template<typename ValueType, class Container> class simple_pool_impl :
+ public Container
+ {
+ typedef typename Container::value_type value_type;
+ std::ptrdiff_t mnFirstFreeIndex;
+
+ public:
+ simple_pool_impl() :
+ mnFirstFreeIndex(-1)
+ {}
+
+ std::ptrdiff_t alloc()
+ {
+ return store(ValueType());
+ }
+
+ std::ptrdiff_t store(const ValueType& rCopy)
+ {
+ if( mnFirstFreeIndex != -1 )
+ {
+ std::ptrdiff_t nIdx=mnFirstFreeIndex;
+ mnFirstFreeIndex = this->at(mnFirstFreeIndex).nextFree;
+ this->at(nIdx).value = rCopy;
+ this->at(nIdx).nextFree = -1;
+
+ return nIdx;
+ }
+ else
+ {
+ this->push_back(value_type(rCopy));
+ return this->size()-1;
+ }
+ }
+
+ void free( std::ptrdiff_t nIdx )
+ {
+ this->at(nIdx).nextFree = mnFirstFreeIndex;
+ mnFirstFreeIndex = nIdx;
+ }
+
+ const ValueType& get( std::ptrdiff_t nIdx ) const
+ {
+ return this->operator[](nIdx).value;
+ }
+ ValueType& get( std::ptrdiff_t nIdx )
+ {
+ return this->operator[](nIdx).value;
+ }
+ };
+
+ template< typename ValueType > struct struct_from_value
+ {
+ struct type
+ {
+ type() :
+ value(),
+ nextFree(-1)
+ {}
+ explicit type( const ValueType& val ) :
+ value(val),
+ nextFree(-1)
+ {}
+
+ ValueType value;
+ std::ptrdiff_t nextFree;
+ };
+ };
+ }
+
+ /** Simple vector-based memory pool allocator
+
+ This template can be used to provide simple pooled memory
+ allocation from a container class that adheres to the stl
+ random access container concept. Note that alloc/free works
+ with _indices_ into the container!
+
+ @example
+ <pre>
+vector_pool<type> myPool;
+int nIdx=myPool.alloc();
+myPool[nIdx] = myVal;
+ ... do stuff ...
+myPool.free(nIdx);
+ </pre>
+ */
+ template<typename ValueType> struct vector_pool :
+ public detail::simple_pool_impl<ValueType,
+ std::vector<typename detail::struct_from_value<ValueType>::type > >
+ {};
+}
+
+#endif /* INCLUDED_O3TL_VECTOR_POOL_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/binarycodec.hxx b/include/oox/core/binarycodec.hxx
new file mode 100644
index 000000000000..64b06d4244ef
--- /dev/null
+++ b/include/oox/core/binarycodec.hxx
@@ -0,0 +1,316 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_CORE_BINARYCODEC_HXX
+#define OOX_CORE_BINARYCODEC_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/beans/NamedValue.hpp>
+
+#include <rtl/cipher.h>
+#include <rtl/digest.h>
+#include "oox/dllapi.h"
+
+namespace oox { class AttributeList; }
+
+namespace oox {
+namespace core {
+
+// ============================================================================
+
+class OOX_DLLPUBLIC CodecHelper
+{
+public:
+ /** Returns the password hash if it is in the required 16-bit limit. */
+ static sal_uInt16 getPasswordHash( const AttributeList& rAttribs, sal_Int32 nElement );
+
+private:
+ CodecHelper();
+ ~CodecHelper();
+};
+
+// ============================================================================
+
+/** Encodes and decodes data from/to protected MS Office documents.
+
+ Implements a simple XOR encoding/decoding algorithm used in MS Office
+ versions up to MSO 95.
+ */
+class OOX_DLLPUBLIC BinaryCodec_XOR
+{
+public:
+ /** Enumerates codec types supported by this XOR codec implementation. */
+ enum CodecType
+ {
+ CODEC_WORD, ///< MS Word XOR codec.
+ CODEC_EXCEL ///< MS Excel XOR codec.
+ };
+
+public:
+ /** Default constructor.
+
+ Two-step construction in conjunction with the initKey() and verifyKey()
+ functions allows to try to initialize with different passwords (e.g.
+ built-in default password used for Excel workbook protection).
+ */
+ explicit BinaryCodec_XOR( CodecType eCodecType );
+
+ ~BinaryCodec_XOR();
+
+ /** Initializes the algorithm with the specified password.
+
+ @param pnPassData
+ Character array containing the password. Must be zero terminated,
+ which results in a maximum length of 15 characters.
+ */
+ void initKey( const sal_uInt8 pnPassData[ 16 ] );
+
+ /** Initializes the algorithm with the encryption data.
+
+ @param aData
+ The sequence contains the necessary data to initialize
+ the codec.
+ */
+ bool initCodec( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aData );
+
+ /** Retrieves the encryption data
+
+ @return
+ The sequence contains the necessary data to initialize
+ the codec.
+ */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > getEncryptionData();
+
+ /** Verifies the validity of the password using the passed key and hash.
+
+ @precond
+ The codec must be initialized with the initKey() function before
+ this function can be used.
+
+ @param nKey
+ Password key value read from the file.
+ @param nHash
+ Password hash value read from the file.
+
+ @return
+ True = test was successful.
+ */
+ bool verifyKey( sal_uInt16 nKey, sal_uInt16 nHash ) const;
+
+ /** Reinitializes the codec to start a new memory block.
+
+ Resets the internal key offset to 0.
+
+ @precond
+ The codec must be initialized with the initKey() function before
+ this function can be used.
+ */
+ void startBlock();
+
+ /** Decodes a block of memory.
+
+ @precond
+ The codec must be initialized with the initKey() function before
+ this function can be used.
+
+ @param pnDestData
+ Destination buffer. Will contain the decrypted data afterwards.
+ @param pnSrcData
+ Encrypted data block.
+ @param nBytes
+ Size of the passed data blocks. pnDestData and pnSrcData must be of
+ this size.
+
+ @return
+ True = decoding was successful (no error occurred).
+ */
+ bool decode(
+ sal_uInt8* pnDestData,
+ const sal_uInt8* pnSrcData,
+ sal_Int32 nBytes );
+
+ /** Lets the cipher skip a specific amount of bytes.
+
+ This function sets the cipher to the same state as if the specified
+ amount of data has been decoded with one or more calls of decode().
+
+ @precond
+ The codec must be initialized with the initKey() function before
+ this function can be used.
+
+ @param nBytes
+ Number of bytes to be skipped (cipher "seeks" forward).
+
+ @return
+ True = skip was successful (no error occurred).
+ */
+ bool skip( sal_Int32 nBytes );
+
+private:
+ CodecType meCodecType; ///< Codec type.
+ sal_uInt8 mpnKey[ 16 ]; ///< Encryption key.
+ sal_Int32 mnOffset; ///< Key offset.
+ sal_uInt16 mnBaseKey; ///< Base key from password.
+ sal_uInt16 mnHash; ///< Hash value from password.
+};
+
+// ============================================================================
+
+/** Encodes and decodes data from protected MSO 97+ documents.
+
+ This is a wrapper class around low level cryptographic functions from RTL.
+ Implementation is based on the wvDecrypt package by Caolan McNamara:
+ http://www.csn.ul.ie/~caolan/docs/wvDecrypt.html
+ */
+class OOX_DLLPUBLIC BinaryCodec_RCF
+{
+public:
+ /** Default constructor.
+
+ Two-step construction in conjunction with the initKey() and verifyKey()
+ functions allows to try to initialize with different passwords (e.g.
+ built-in default password used for Excel workbook protection).
+ */
+ explicit BinaryCodec_RCF();
+
+ ~BinaryCodec_RCF();
+
+ /** Initializes the algorithm with the encryption data.
+
+ @param aData
+ The sequence contains the necessary data to initialize
+ the codec.
+ */
+ bool initCodec( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aData );
+
+ /** Retrieves the encryption data
+
+ @return
+ The sequence contains the necessary data to initialize
+ the codec.
+ */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > getEncryptionData();
+
+ /** Initializes the algorithm with the specified password and document ID.
+
+ @param pnPassData
+ Unicode character array containing the password. Must be zero
+ terminated, which results in a maximum length of 15 characters.
+ @param pnSalt
+ Random salt data block read from or written to the file.
+ */
+ void initKey(
+ const sal_uInt16 pnPassData[ 16 ],
+ const sal_uInt8 pnSalt[ 16 ] );
+
+ /** Verifies the validity of the password using the passed salt data.
+
+ @precond
+ The codec must be initialized with the initKey() function before
+ this function can be used.
+
+ @param pnVerifier
+ Verifier block read from the file.
+ @param pnVerifierHash
+ Verifier hash read from the file.
+
+ @return
+ True = test was successful.
+ */
+ bool verifyKey(
+ const sal_uInt8 pnVerifier[ 16 ],
+ const sal_uInt8 pnVerifierHash[ 16 ] );
+
+ /** Rekeys the codec using the specified counter.
+
+ After reading a specific amount of data the cipher algorithm needs to
+ be rekeyed using a counter that counts the data blocks.
+
+ The block size is for example 512 bytes for MS Word files and 1024
+ bytes for MS Excel files.
+
+ @precond
+ The codec must be initialized with the initKey() function before
+ this function can be used.
+
+ @param nCounter
+ Block counter used to rekey the cipher.
+ */
+ bool startBlock( sal_Int32 nCounter );
+
+ /** Decodes a block of memory.
+
+ @see rtl_cipher_decode()
+
+ @precond
+ The codec must be initialized with the initKey() function before
+ this function can be used.
+
+ @param pnDestData
+ Destination buffer. Will contain the decrypted data afterwards.
+ @param pnSrcData
+ Encrypted data block.
+ @param nBytes
+ Size of the passed data blocks. pnDestData and pnSrcData must be of
+ this size.
+
+ @return
+ True = decoding was successful (no error occurred).
+ */
+ bool decode(
+ sal_uInt8* pnDestData,
+ const sal_uInt8* pnSrcData,
+ sal_Int32 nBytes );
+
+ /** Lets the cipher skip a specific amount of bytes.
+
+ This function sets the cipher to the same state as if the specified
+ amount of data has been decoded with one or more calls of decode().
+
+ @precond
+ The codec must be initialized with the initKey() function before
+ this function can be used.
+
+ @param nBytes
+ Number of bytes to be skipped (cipher "seeks" forward).
+
+ @return
+ True = skip was successful (no error occurred).
+ */
+ bool skip( sal_Int32 nBytes );
+
+private:
+ void InitKeyImpl(
+ const sal_uInt8 pKeyData[64],
+ const sal_uInt8 pUnique[16] );
+
+ rtlCipher mhCipher;
+ rtlDigest mhDigest;
+ sal_uInt8 mpnDigestValue[ RTL_DIGEST_LENGTH_MD5 ];
+ sal_uInt8 mpnUnique[16];
+};
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/contexthandler.hxx b/include/oox/core/contexthandler.hxx
new file mode 100644
index 000000000000..f11dc1d6260a
--- /dev/null
+++ b/include/oox/core/contexthandler.hxx
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_CORE_CONTEXTHANDLER_HXX
+#define OOX_CORE_CONTEXTHANDLER_HXX
+
+#include <com/sun/star/xml/sax/XFastContextHandler.hpp>
+#include <boost/shared_ptr.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <rtl/ref.hxx>
+#include "oox/token/namespaces.hxx"
+#include "oox/token/tokens.hxx"
+#include "oox/dllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XLocator; } }
+} } }
+
+namespace oox { class SequenceInputStream; }
+
+namespace oox {
+namespace core {
+
+class XmlFilterBase;
+class FragmentHandler;
+struct Relation;
+class Relations;
+
+// ============================================================================
+
+class ContextHandler;
+typedef ::rtl::Reference< ContextHandler > ContextHandlerRef;
+
+struct FragmentBaseData;
+typedef ::boost::shared_ptr< FragmentBaseData > FragmentBaseDataRef;
+
+typedef ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XFastContextHandler > ContextHandler_BASE;
+
+class OOX_DLLPUBLIC ContextHandler : public ContextHandler_BASE
+{
+public:
+ explicit ContextHandler( const ContextHandler& rParent );
+ virtual ~ContextHandler();
+
+ /** Returns the filter instance. */
+ XmlFilterBase& getFilter() const;
+ /** Returns the relations of the current fragment. */
+ const Relations& getRelations() const;
+ /** Returns the full path of the current fragment. */
+ const OUString& getFragmentPath() const;
+
+ /** Returns the full fragment path for the target of the passed relation. */
+ OUString getFragmentPathFromRelation( const Relation& rRelation ) const;
+ /** Returns the full fragment path for the passed relation identifier. */
+ OUString getFragmentPathFromRelId( const OUString& rRelId ) const;
+ /** Returns the full fragment path for the first relation of the passed type. */
+ OUString getFragmentPathFromFirstType( const OUString& rType ) const;
+
+ // com.sun.star.xml.sax.XFastContextHandler interface ---------------------
+
+ virtual void SAL_CALL startFastElement( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL startUnknownElement( const OUString& Namespace, const OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endUnknownElement( const OUString& Namespace, const OUString& Name ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createUnknownChildContext( const OUString& Namespace, const OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL characters( const OUString& aChars ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL ignorableWhitespace( const OUString& aWhitespaces ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL processingInstruction( const OUString& aTarget, const OUString& aData ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+ // record context interface -----------------------------------------------
+
+ virtual ContextHandlerRef createRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void startRecord( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void endRecord( sal_Int32 nRecId );
+
+protected:
+ /** Helper constructor for the FragmentHandler. */
+ explicit ContextHandler( const FragmentBaseDataRef& rxBaseData );
+
+ void implSetLocator( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >& rxLocator );
+
+#ifdef _MSC_VER
+ ContextHandler() {} // workaround
+#endif
+
+private:
+ ContextHandler& operator=( const ContextHandler& );
+
+private:
+ FragmentBaseDataRef mxBaseData; ///< Base data of the fragment.
+};
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/contexthandler2.hxx b/include/oox/core/contexthandler2.hxx
new file mode 100644
index 000000000000..f1a0c7db38b2
--- /dev/null
+++ b/include/oox/core/contexthandler2.hxx
@@ -0,0 +1,272 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_CORE_CONTEXTHANDLER2_HXX
+#define OOX_CORE_CONTEXTHANDLER2_HXX
+
+#include <vector>
+#include <boost/shared_ptr.hpp>
+#include "oox/helper/attributelist.hxx"
+#include "oox/helper/binaryinputstream.hxx"
+#include "oox/core/contexthandler.hxx"
+#include "oox/dllapi.h"
+
+namespace oox {
+namespace core {
+
+// ============================================================================
+
+const sal_Int32 XML_ROOT_CONTEXT = SAL_MAX_INT32;
+
+// ============================================================================
+
+struct ElementInfo;
+
+/** Helper class that provides a context stack.
+
+ Fragment handlers and context handlers derived from this helper class will
+ track the identifiers of the visited elements in a stack. The idea is to
+ use the same instance of a fragment handler or context handler to process
+ several nested elements in an XML stream. For that, the abstract function
+ onCreateContext() has to return 'this' for the passed element.
+
+ Derived classes have to implement the createFastChildContext(),
+ startFastElement(), characters(), and endFastElement() functions from the
+ com.sun.star.xml.sax.XFastContextHandler interface by simply forwarding
+ them to the respective implCreateChildContext(), implStartElement(),
+ implCharacters(), and implEndElement() functions of this helper. This is
+ implemented already in the classes ContextHandler2 and FragmentHandler2.
+ The new abstract functions have to be implemented according to the elements
+ to be processed.
+
+ Similarly, for binary import, derived classes have to forward the
+ createRecordContext(), startRecord(), and endRecord() functions from the
+ ContextHandler class to the implCreateRecordContext(), implStartRecord(),
+ and implEndRecord() functions of this helper. Again, this is implemented
+ already in the classes ContextHandler2 and FragmentHandler2.
+ */
+class OOX_DLLPUBLIC ContextHandler2Helper
+{
+public:
+ explicit ContextHandler2Helper( bool bEnableTrimSpace );
+ explicit ContextHandler2Helper( const ContextHandler2Helper& rParent );
+ virtual ~ContextHandler2Helper();
+
+ // allow instances to be stored in ::rtl::Reference
+ virtual void SAL_CALL acquire() throw() = 0;
+ virtual void SAL_CALL release() throw() = 0;
+
+ // interface --------------------------------------------------------------
+
+ /** Will be called to create a context handler for the passed element.
+
+ Usually 'this' can be returned to improve performance by reusing the
+ same instance to process several elements. Used by OOXML import only.
+ */
+ virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) = 0;
+
+ /** Will be called when a new element has been started.
+
+ This function is called at the context handler returned from
+ onCreateContext(), or, for root elements of an XML stream, at the
+ fragment handler itself.
+
+ The current element identifier can be accessed with getCurrentElement()
+ or isCurrentElement(). Used by OOXML import only.
+ */
+ virtual void onStartElement( const AttributeList& rAttribs ) = 0;
+
+ /** Will be called before a new child element starts, or if the current
+ element is about to be left.
+
+ This helper function collects all text fragments received by the
+ characters() function (such as encoded characters which are passed in
+ separate calls to the characters() function), and passes the
+ concatenated and trimmed string.
+
+ The current element identifier can be accessed with getCurrentElement()
+ or isCurrentElement(). Used by OOXML import only.
+ */
+ virtual void onCharacters( const OUString& rChars ) = 0;
+
+ /** Will be called when the current element is about to be left.
+
+ The current element identifier can be accessed with getCurrentElement()
+ or isCurrentElement(). Used by OOXML import only.
+ */
+ virtual void onEndElement() = 0;
+
+ /** Will be called to create a context handler for the passed record.
+
+ Usually 'this' can be returned to improve performance by reusing the
+ same instance to process several records. Used by BIFF import only.
+ */
+ virtual ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ) = 0;
+
+ /** Will be called when a new record block in a binary stream has been
+ started.
+
+ The current record identifier can be accessed with getCurrentElement()
+ or isCurrentElement(). Used by BIFF import only.
+ */
+ virtual void onStartRecord( SequenceInputStream& rStrm ) = 0;
+
+ /** Will be called when the current record block is about to be left.
+
+ The current record identifier can be accessed with getCurrentElement()
+ or isCurrentElement(). Used by BIFF import only.
+ */
+ virtual void onEndRecord() = 0;
+
+ // helpers ----------------------------------------------------------------
+
+ /** Returns the identifier of the currently processed element. Ignores MCE elements in stack */
+ sal_Int32 getCurrentElement() const;
+
+ /** Returns the identifier of the currently processed element - Including MCE root elements */
+ sal_Int32 getCurrentElementWithMce() const;
+
+ /** Returns true, if nElement contains the identifier of the currently
+ processed element. */
+ inline bool isCurrentElement( sal_Int32 nElement ) const
+ { return getCurrentElement() == nElement; }
+
+ /** Returns true, if either nElement1 or nElement2 contain the identifier
+ of the currently processed element. */
+ inline bool isCurrentElement( sal_Int32 nElement1, sal_Int32 nElement2 ) const
+ { return isCurrentElement( nElement1 ) || isCurrentElement( nElement2 ); }
+
+ /** Returns the identifier of the specified parent element. */
+ sal_Int32 getParentElement( sal_Int32 nCountBack = 1 ) const;
+
+ /** Returns true, if nElement contains the identifier of the specified
+ parent element. */
+ inline sal_Int32 isParentElement( sal_Int32 nElement, sal_Int32 nCountBack = 1 ) const
+ { return getParentElement( nCountBack ) == nElement; }
+
+ /** Returns true, if the element currently processed is the root element of
+ the context or fragment handler. */
+ bool isRootElement() const;
+
+ // implementation ---------------------------------------------------------
+
+protected:
+ /** Must be called from createFastChildContext() in derived classes. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler >
+ implCreateChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs );
+
+ /** Must be called from startFastElement() in derived classes. */
+ void implStartElement(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs );
+
+ /** Must be called from characters() in derived classes. */
+ void implCharacters( const OUString& rChars );
+
+ /** Must be called from endFastElement() in derived classes. */
+ void implEndElement( sal_Int32 nElement );
+
+ /** Must be called from createRecordContext() in derived classes. */
+ ContextHandlerRef implCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+
+ /** Must be called from startRecord() in derived classes. */
+ void implStartRecord( sal_Int32 nRecId, SequenceInputStream& rStrm );
+
+ /** Must be called from endRecord() in derived classes. */
+ void implEndRecord( sal_Int32 nRecId );
+
+private:
+ ContextHandler2Helper& operator=( const ContextHandler2Helper& );
+
+ ElementInfo& pushElementInfo( sal_Int32 nElement );
+ void popElementInfo();
+ void processCollectedChars();
+
+private:
+ typedef ::std::vector< ElementInfo > ContextStack;
+ typedef ::boost::shared_ptr< ContextStack > ContextStackRef;
+
+ ContextStackRef mxContextStack; ///< Stack of all processed elements.
+ size_t mnRootStackSize; ///< Stack size on construction time.
+ bool mbEnableTrimSpace; ///< True = trim whitespace in characters().
+};
+
+// ============================================================================
+
+class OOX_DLLPUBLIC ContextHandler2 : public ContextHandler, public ContextHandler2Helper
+{
+public:
+ explicit ContextHandler2( ContextHandler2Helper& rParent );
+ virtual ~ContextHandler2();
+
+ // resolve ambiguity from base classes
+ virtual void SAL_CALL acquire() throw() { ContextHandler::acquire(); }
+ virtual void SAL_CALL release() throw() { ContextHandler::release(); }
+
+ // com.sun.star.xml.sax.XFastContextHandler interface ---------------------
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL startFastElement(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL characters( const OUString& rChars )
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL endFastElement( sal_Int32 nElement )
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException );
+
+ // oox.core.ContextHandler interface --------------------------------------
+
+ virtual ContextHandlerRef createRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void startRecord( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void endRecord( sal_Int32 nRecId );
+
+ // oox.core.ContextHandler2Helper interface -------------------------------
+
+ virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onStartElement( const AttributeList& rAttribs );
+ virtual void onCharacters( const OUString& rChars );
+ virtual void onEndElement();
+
+ virtual ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void onStartRecord( SequenceInputStream& rStrm );
+ virtual void onEndRecord();
+};
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/fastparser.hxx b/include/oox/core/fastparser.hxx
new file mode 100644
index 000000000000..40b5e763998f
--- /dev/null
+++ b/include/oox/core/fastparser.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_CORE_FASTPARSER_HXX
+#define OOX_CORE_FASTPARSER_HXX
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/xml/sax/XFastParser.hpp>
+
+namespace oox {
+ struct NamespaceMap;
+ class StorageBase;
+}
+
+namespace oox {
+namespace core {
+
+// ============================================================================
+
+/** Wrapper for a fast SAX parser that works on automatically generated OOXML
+ token and namespace identifiers.
+ */
+class FastParser
+{
+public:
+ explicit FastParser(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ~FastParser();
+
+ /** Registers an OOXML namespace at the parser. */
+ void registerNamespace( sal_Int32 nNamespaceId )
+ throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
+
+ /** Sets the passed document handler that will receive the SAX parser events. */
+ void setDocumentHandler(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastDocumentHandler >& rxDocHandler )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ /** Parses the passed SAX input source.
+ @param bCloseStream True = closes the stream in the input source after parsing. */
+ void parseStream( const ::com::sun::star::xml::sax::InputSource& rInputSource, bool bCloseStream = false )
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException );
+
+ /** Parses the passed input stream.
+ @param bCloseStream True = closes the passed stream after parsing. */
+ void parseStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream,
+ const OUString& rStreamName, bool bCloseStream = false )
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException );
+
+ /** Parses a stream from the passed storage with the specified name.
+ @param bCloseStream True = closes the stream after parsing. */
+ void parseStream( StorageBase& rStorage, const OUString& rStreamName, bool bCloseStream = false )
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException );
+
+ OUString getNamespaceURL( const OUString& rPrefix )
+ throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
+
+ sal_Int32 getNamespaceId( const OUString& aUrl );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastTokenHandler >
+ getTokenHandler() const { return mxTokenHandler; }
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastParser >
+ mxParser;
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastTokenHandler >
+ mxTokenHandler;
+ const NamespaceMap& mrNamespaceMap;
+};
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/fasttokenhandler.hxx b/include/oox/core/fasttokenhandler.hxx
new file mode 100644
index 000000000000..05c7063d3925
--- /dev/null
+++ b/include/oox/core/fasttokenhandler.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_CORE_FASTTOKENHANDLER_HXX
+#define OOX_CORE_FASTTOKENHANDLER_HXX
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/xml/sax/XFastTokenHandler.hpp>
+#include <cppuhelper/implbase2.hxx>
+
+namespace oox { class TokenMap; }
+
+namespace oox {
+namespace core {
+
+// ============================================================================
+
+typedef ::cppu::WeakImplHelper2< ::com::sun::star::lang::XServiceInfo, ::com::sun::star::xml::sax::XFastTokenHandler > FastTokenHandler_BASE;
+
+/** Wrapper implementing the com.sun.star.xml.sax.XFastTokenHandler API interface
+ that provides access to the tokens generated from the internal token name list.
+ */
+class FastTokenHandler : public FastTokenHandler_BASE
+{
+public:
+ explicit FastTokenHandler();
+ virtual ~FastTokenHandler();
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+ // XFastTokenHandler
+ virtual sal_Int32 SAL_CALL getToken( const OUString& rIdentifier ) throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getIdentifier( sal_Int32 nToken ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getUTF8Identifier( sal_Int32 nToken ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getTokenFromUTF8( const ::com::sun::star::uno::Sequence< sal_Int8 >& Identifier ) throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ const TokenMap& mrTokenMap; ///< Reference to global token map singleton.
+};
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/filterbase.hxx b/include/oox/core/filterbase.hxx
new file mode 100644
index 000000000000..6f4fc40499c7
--- /dev/null
+++ b/include/oox/core/filterbase.hxx
@@ -0,0 +1,293 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_CORE_FILTERBASE_HXX
+#define OOX_CORE_FILTERBASE_HXX
+
+#include <memory>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/document/XExporter.hpp>
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/document/XImporter.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XStream.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/implbase5.hxx>
+#include <comphelper/sequenceashashmap.hxx>
+#include "oox/helper/binarystreambase.hxx"
+#include "oox/helper/storagebase.hxx"
+#include "oox/dllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace awt { struct DeviceInfo; }
+ namespace frame { class XFrame; }
+ namespace frame { class XModel; }
+ namespace drawing { class XShape; }
+ namespace graphic { class XGraphic; }
+ namespace io { class XInputStream; }
+ namespace io { class XOutputStream; }
+ namespace io { class XStream; }
+ namespace lang { class XMultiComponentFactory; }
+ namespace lang { class XMultiServiceFactory; }
+ namespace task { class XInteractionHandler; }
+ namespace task { class XStatusIndicator; }
+ namespace uno { class XComponentContext; }
+} } }
+
+namespace comphelper {
+ class IDocPasswordVerifier;
+ class MediaDescriptor;
+}
+
+namespace oox {
+ class GraphicHelper;
+ class ModelObjectHelper;
+}
+
+namespace oox { namespace ole {
+ class OleObjectHelper;
+ class VbaProject;
+} }
+
+namespace oox {
+namespace core {
+
+// ============================================================================
+
+enum OoxmlVersion
+{
+ ECMA_DIALECT,
+ ISOIEC_29500_2008
+};
+
+struct FilterBaseImpl;
+
+typedef ::cppu::WeakImplHelper5<
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::lang::XInitialization,
+ ::com::sun::star::document::XImporter,
+ ::com::sun::star::document::XExporter,
+ ::com::sun::star::document::XFilter >
+ FilterBase_BASE;
+
+class OOX_DLLPUBLIC FilterBase : public FilterBase_BASE, public ::cppu::BaseMutex
+{
+public:
+ explicit FilterBase(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ~FilterBase();
+
+ /** Returns true, if filter is an import filter. */
+ bool isImportFilter() const;
+ /** Returns true, if filter is an export filter. */
+ bool isExportFilter() const;
+
+ OoxmlVersion getVersion() const;
+
+ /** Derived classes implement import of the entire document. */
+ virtual bool importDocument() = 0;
+
+ /** Derived classes implement export of the entire document. */
+ virtual bool exportDocument() = 0;
+
+ // ------------------------------------------------------------------------
+
+ /** Returns the component context passed in the filter constructor (always existing). */
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&
+ getComponentContext() const;
+
+ /** Returns the multi service factory of the component (always existing). */
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&
+ getServiceFactory() const;
+
+ /** Returns the document model (always existing). */
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >&
+ getModel() const;
+
+ /** Returns the service factory provided by the document model (always existing). */
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&
+ getModelFactory() const;
+
+ /** Returns the frame that will contain the document model (may be null). */
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >&
+ getTargetFrame() const;
+
+ /// Returns the parent shape to load into (if any)
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >&
+ getParentShape() const;
+
+ /** Returns the status indicator (may be null). */
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator >&
+ getStatusIndicator() const;
+
+ /** Returns the FilterData */
+ ::comphelper::SequenceAsHashMap& getFilterData() const;
+
+ /** Returns the media descriptor. */
+ ::comphelper::MediaDescriptor& getMediaDescriptor() const;
+
+ /** Returns the URL of the imported or exported file. */
+ const OUString& getFileUrl() const;
+
+ /** Returns an absolute URL for the passed relative or absolute URL. */
+ OUString getAbsoluteUrl( const OUString& rUrl ) const;
+
+ /** Returns the base storage of the imported/exported file. */
+ StorageRef getStorage() const;
+
+ /** Opens and returns the specified input stream from the base storage.
+
+ @param rStreamName
+ The name of the embedded storage stream. The name may contain
+ slashes to open streams from embedded substorages. If base stream
+ access has been enabled in the storage, the base stream can be
+ accessed by passing an empty string as stream name.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ openInputStream( const OUString& rStreamName ) const;
+
+ /** Opens and returns the specified output stream from the base storage.
+
+ @param rStreamName
+ The name of the embedded storage stream. The name may contain
+ slashes to open streams from embedded substorages. If base stream
+ access has been enabled in the storage, the base stream can be
+ accessed by passing an empty string as stream name.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
+ openOutputStream( const OUString& rStreamName ) const;
+
+ /** Commits changes to base storage (and substorages) */
+ void commitStorage() const;
+
+ // helpers ----------------------------------------------------------------
+
+ /** Returns a helper for the handling of graphics and graphic objects. */
+ GraphicHelper& getGraphicHelper() const;
+
+ /** Returns a helper with containers for various named drawing objects for
+ the imported document. */
+ ModelObjectHelper& getModelObjectHelper() const;
+
+ /** Returns a helper for the handling of OLE objects. */
+ ::oox::ole::OleObjectHelper& getOleObjectHelper() const;
+
+ /** Returns the VBA project manager. */
+ ::oox::ole::VbaProject& getVbaProject() const;
+
+ /** Imports the raw binary data from the specified stream.
+ @return True, if the data could be imported from the stream. */
+ bool importBinaryData( StreamDataSequence& orDataSeq, const OUString& rStreamName );
+
+ // com.sun.star.lang.XServiceInfo interface -------------------------------
+
+ virtual OUString SAL_CALL
+ getImplementationName()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL
+ supportsService( const OUString& rServiceName )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ // com.sun.star.lang.XInitialization interface ----------------------------
+
+ /** Receives user defined arguments.
+
+ @param rArgs
+ the sequence of arguments passed to the filter. The implementation
+ expects one or two arguments. The first argument shall be the
+ com.sun.star.lang.XMultiServiceFactory interface of the global
+ service factory. The optional second argument may contain a
+ sequence of com.sun.star.beans.NamedValue objects. The different
+ filter implemetations may support different arguments.
+ */
+ virtual void SAL_CALL initialize(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rArgs )
+ throw( ::com::sun::star::uno::Exception,
+ ::com::sun::star::uno::RuntimeException );
+
+ // com.sun.star.document.XImporter interface ------------------------------
+
+ virtual void SAL_CALL setTargetDocument(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& rxDocument )
+ throw( ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException );
+
+ // com.sun.star.document.XExporter interface ------------------------------
+
+ virtual void SAL_CALL setSourceDocument(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& rxDocument )
+ throw( ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException );
+
+ // com.sun.star.document.XFilter interface --------------------------------
+
+ virtual sal_Bool SAL_CALL filter(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rMediaDescSeq )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL cancel()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ // ------------------------------------------------------------------------
+protected:
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ implGetInputStream( ::comphelper::MediaDescriptor& rMediaDesc ) const;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >
+ implGetOutputStream( ::comphelper::MediaDescriptor& rMediaDesc ) const;
+
+private:
+ void setMediaDescriptor(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rMediaDescSeq );
+
+ /** Derived classes may create a specialized graphic helper, e.g. for
+ resolving palette colors. */
+ virtual GraphicHelper* implCreateGraphicHelper() const;
+
+ /** Derived classes create a VBA project manager object. */
+ virtual ::oox::ole::VbaProject* implCreateVbaProject() const = 0;
+
+ virtual OUString implGetImplementationName() const = 0;
+
+ virtual StorageRef implCreateStorage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream ) const = 0;
+ virtual StorageRef implCreateStorage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxOutStream ) const = 0;
+
+private:
+ ::std::auto_ptr< FilterBaseImpl > mxImpl;
+};
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/filterdetect.hxx b/include/oox/core/filterdetect.hxx
new file mode 100644
index 000000000000..cd9573b0f0bd
--- /dev/null
+++ b/include/oox/core/filterdetect.hxx
@@ -0,0 +1,162 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_CORE_FILTERDETECT_HXX
+#define OOX_CORE_FILTERDETECT_HXX
+
+#include <vector>
+#include <com/sun/star/document/XExtendedFilterDetection.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/xml/sax/XFastDocumentHandler.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include "oox/dllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace io { class XInputStream; }
+ namespace uno { class XComponentContext; }
+} } }
+
+namespace comphelper { class MediaDescriptor; }
+
+namespace oox { class AttributeList; }
+
+namespace oox {
+namespace core {
+
+// ============================================================================
+
+/** Document handler specifically designed for detecting OOXML file formats.
+
+ It takes a reference to the filter string object via its constructor, and
+ puts the name of the detected filter to it, if it successfully finds one.
+ */
+class FilterDetectDocHandler : public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XFastDocumentHandler >
+{
+public:
+ explicit FilterDetectDocHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, OUString& rFilter );
+ virtual ~FilterDetectDocHandler();
+
+ // XFastDocumentHandler
+ virtual void SAL_CALL startDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDocumentLocator( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >& xLocator ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+ // XFastContextHandler
+ virtual void SAL_CALL startFastElement( sal_Int32 nElement, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL startUnknownElement( const OUString& Namespace, const OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endFastElement( sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endUnknownElement( const OUString& Namespace, const OUString& Name ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< XFastContextHandler > SAL_CALL createUnknownChildContext( const OUString& Namespace, const OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL characters( const OUString& aChars ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL ignorableWhitespace( const OUString& aWhitespaces ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL processingInstruction( const OUString& aTarget, const OUString& aData ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ void parseRelationship( const AttributeList& rAttribs );
+
+ OUString getFilterNameFromContentType( const OUString& rContentType ) const;
+ void parseContentTypesDefault( const AttributeList& rAttribs );
+ void parseContentTypesOverride( const AttributeList& rAttribs );
+
+private:
+ typedef ::std::vector< sal_Int32 > ContextVector;
+
+ OUString& mrFilterName;
+ ContextVector maContextStack;
+ OUString maTargetPath;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext;
+};
+
+// ============================================================================
+
+class OOX_DLLPUBLIC FilterDetect : public ::cppu::WeakImplHelper2< ::com::sun::star::document::XExtendedFilterDetection, ::com::sun::star::lang::XServiceInfo >
+{
+public:
+ explicit FilterDetect( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext )
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual ~FilterDetect();
+
+ /** Tries to extract an unencrypted ZIP package from the passed media
+ descriptor.
+
+ First, this function checks if the input stream provided by the media
+ descriptor property 'InputStream' contains a ZIP package. If yes, this
+ stream is returned.
+
+ Second, this function checks if the 'ComponentData' property exists and
+ contains a sequence of com.sun.star.beans.NamedValue. If yes, a named
+ value is searched with the name 'DecryptedPackage' and a value of type
+ com.sun.star.io.XStream. If the input stream provided by this XStream
+ contains a ZIP package, this input stream is returned.
+
+ Third, this function checks if the input stream of the media descriptor
+ contains an OLE package. If yes, it checks the existence of the streams
+ 'EncryptionInfo' and 'EncyptedPackage' and tries to decrypt the package
+ into a temporary file. This may include requesting a password from the
+ media descriptor property 'Password' or from the user, using the
+ interaction handler provided by the descriptor. On success, and if the
+ decrypted package is a ZIP package, the XStream of the temporary file
+ is stored in the property 'ComponentData' of the media descriptor and
+ its input stream is returned.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ extractUnencryptedPackage( ::comphelper::MediaDescriptor& rMediaDesc ) const;
+
+ // com.sun.star.lang.XServiceInfo interface -------------------------------
+
+ virtual OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
+
+ // com.sun.star.document.XExtendedFilterDetection interface ---------------
+
+ /** Detects MS Office 2007 file types and supports package decryption.
+
+ The following file types are detected:
+ - MS Word 2007 XML Document (*.docx, *.docm)
+ - MS Word 2007 XML Template (*.dotx, *.dotm)
+ - MS Excel 2007 XML Document (*.xlsx, *.xlsm)
+ - MS Excel 2007 BIFF12 Document (*.xlsb)
+ - MS Excel 2007 XML Template (*.xltx, *.xltm)
+ - MS Powerpoint 2007 XML Document (*.pptx, *.pptm)
+ - MS Powerpoint 2007 XML Template (*.potx, *.potm)
+
+ If the package is encrypted, the detection tries to decrypt it into a
+ temporary file. The user may be asked for a password. The XStream
+ interface of the temporary file will be stored in the 'ComponentData'
+ property of the passed media descriptor.
+ */
+ virtual OUString SAL_CALL
+ detect( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rMediaDescSeq )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext;
+};
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/fragmenthandler.hxx b/include/oox/core/fragmenthandler.hxx
new file mode 100644
index 000000000000..236e212e6e32
--- /dev/null
+++ b/include/oox/core/fragmenthandler.hxx
@@ -0,0 +1,131 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_CORE_FRAGMENTHANDLER_HXX
+#define OOX_CORE_FRAGMENTHANDLER_HXX
+
+#include <com/sun/star/xml/sax/XFastDocumentHandler.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include "oox/core/contexthandler.hxx"
+#include "oox/core/relations.hxx"
+#include "oox/dllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace io { class XInputStream; }
+} } }
+
+namespace oox {
+namespace core {
+
+// ============================================================================
+
+/** Base data of a fragment.
+
+ This data is stored in a separate struct to make it accessible in every
+ child context handler of the fragment.
+ */
+struct FragmentBaseData
+{
+ XmlFilterBase& mrFilter;
+ const OUString maFragmentPath;
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >
+ mxLocator;
+ RelationsRef mxRelations;
+
+ explicit FragmentBaseData(
+ XmlFilterBase& rFilter,
+ const OUString& rFragmentPath,
+ RelationsRef xRelations );
+};
+
+// ============================================================================
+
+/** Describes record identifiers used to create contexts in a binary stream.
+
+ If a record is used to start a new context, usually the record identifier
+ increased by 1 is used to mark the end of this context, e.g. the Excel
+ record SHEETDATA == 0x0091 starts the <sheetData> context, and the record
+ SHEETDATA_END == 0x0092 ends this context. But some records are used to
+ start a new context, though there is no identifier to end this context,
+ e.g. the ROW or EXTROW records. These record identifiers can be marked by
+ setting the mnEndRecId member of this struct to -1.
+ */
+struct RecordInfo
+{
+ sal_Int32 mnStartRecId; ///< Record identifier for context start.
+ sal_Int32 mnEndRecId; ///< Record identifier for context end, -1 = no record.
+};
+
+// ============================================================================
+
+typedef ::cppu::ImplInheritanceHelper1< ContextHandler, ::com::sun::star::xml::sax::XFastDocumentHandler > FragmentHandler_BASE;
+
+class OOX_DLLPUBLIC FragmentHandler : public FragmentHandler_BASE
+{
+public:
+ explicit FragmentHandler( XmlFilterBase& rFilter, const OUString& rFragmentPath );
+ virtual ~FragmentHandler();
+
+ /** Returns the com.sun.star.xml.sax.XFastContextHandler interface of this context. */
+ inline ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler >
+ getFastContextHandler() { return static_cast< ContextHandler* >( this ); }
+
+ // com.sun.star.xml.sax.XFastDocumentHandler interface --------------------
+
+ virtual void SAL_CALL startDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDocumentLocator( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >& rxLocator ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+ // com.sun.star.xml.sax.XFastContextHandler interface ---------------------
+
+ virtual void SAL_CALL startFastElement( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL startUnknownElement( const OUString& Namespace, const OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endUnknownElement( const OUString& Namespace, const OUString& Name ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createUnknownChildContext( const OUString& Namespace, const OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL characters( const OUString& aChars ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL ignorableWhitespace( const OUString& aWhitespaces ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL processingInstruction( const OUString& aTarget, const OUString& aData ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+ // XML stream handling ----------------------------------------------------
+
+ /** Opens the fragment stream referred by the own fragment path. Derived
+ classes may provide specilized stream implementations. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ openFragmentStream() const;
+
+ // binary records ---------------------------------------------------------
+
+ virtual const RecordInfo* getRecordInfos() const;
+
+protected:
+ explicit FragmentHandler( XmlFilterBase& rFilter, const OUString& rFragmentPath, RelationsRef xRelations );
+};
+
+typedef ::rtl::Reference< FragmentHandler > FragmentHandlerRef;
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/fragmenthandler2.hxx b/include/oox/core/fragmenthandler2.hxx
new file mode 100644
index 000000000000..21ad03619fd1
--- /dev/null
+++ b/include/oox/core/fragmenthandler2.hxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_CORE_FRAGMENTHANDLER2_HXX
+#define OOX_CORE_FRAGMENTHANDLER2_HXX
+
+#include "oox/core/contexthandler2.hxx"
+#include "oox/core/fragmenthandler.hxx"
+#include <vector>
+#include "oox/dllapi.h"
+
+namespace oox {
+namespace core {
+
+// ============================================================================
+
+class OOX_DLLPUBLIC FragmentHandler2 : public FragmentHandler, public ContextHandler2Helper
+{
+protected:
+ enum MCE_STATE
+ {
+ MCE_UNUSED,
+ MCE_STARTED,
+ MCE_FOUND_CHOICE
+ };
+ ::std::vector<MCE_STATE> aMceState;
+
+ bool prepareMceContext( sal_Int32 nElement, const AttributeList& rAttribs );
+
+
+public:
+ explicit FragmentHandler2(
+ XmlFilterBase& rFilter,
+ const OUString& rFragmentPath,
+ bool bEnableTrimSpace = true );
+ virtual ~FragmentHandler2();
+
+ // resolve ambiguity from base classes
+ virtual void SAL_CALL acquire() throw() { FragmentHandler::acquire(); }
+ virtual void SAL_CALL release() throw() { FragmentHandler::release(); }
+
+ // com.sun.star.xml.sax.XFastContextHandler interface ---------------------
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL startFastElement(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL characters( const OUString& rChars )
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL endFastElement( sal_Int32 nElement )
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException );
+
+ // com.sun.star.xml.sax.XFastDocumentHandler interface --------------------
+
+ virtual void SAL_CALL startDocument()
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL endDocument()
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException );
+
+ // oox.core.ContextHandler interface --------------------------------------
+
+ virtual ContextHandlerRef createRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void startRecord( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void endRecord( sal_Int32 nRecId );
+
+ // oox.core.ContextHandler2Helper interface -------------------------------
+
+ virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onStartElement( const AttributeList& rAttribs );
+ virtual void onCharacters( const OUString& rChars );
+ virtual void onEndElement();
+
+ virtual ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void onStartRecord( SequenceInputStream& rStrm );
+ virtual void onEndRecord();
+
+ // oox.core.FragmentHandler2 interface ------------------------------------
+
+ virtual void initializeImport();
+ virtual void finalizeImport();
+};
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/recordparser.hxx b/include/oox/core/recordparser.hxx
new file mode 100644
index 000000000000..9e417c03d01a
--- /dev/null
+++ b/include/oox/core/recordparser.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_CORE_RECORDPARSER_HXX
+#define OOX_CORE_RECORDPARSER_HXX
+
+#include <map>
+#include <com/sun/star/io/IOException.hpp>
+#include <com/sun/star/xml/sax/SAXException.hpp>
+#include <rtl/ref.hxx>
+#include "oox/helper/binaryinputstream.hxx"
+
+namespace oox {
+namespace core {
+
+class FragmentHandler;
+struct RecordInfo;
+
+namespace prv { class Locator; }
+namespace prv { class ContextStack; }
+
+// ============================================================================
+
+struct RecordInputSource
+{
+ BinaryInputStreamRef mxInStream;
+ OUString maPublicId;
+ OUString maSystemId;
+};
+
+// ============================================================================
+
+class RecordParser
+{
+public:
+ explicit RecordParser();
+ virtual ~RecordParser();
+
+ void setFragmentHandler( const ::rtl::Reference< FragmentHandler >& rxHandler );
+
+ void parseStream( const RecordInputSource& rInputSource )
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::io::IOException,
+ ::com::sun::star::uno::RuntimeException );
+
+ inline const RecordInputSource& getInputSource() const { return maSource; }
+
+private:
+ /** Returns a RecordInfo struct that contains the passed record identifier
+ as context start identifier. */
+ const RecordInfo* getStartRecordInfo( sal_Int32 nRecId ) const;
+ /** Returns a RecordInfo struct that contains the passed record identifier
+ as context end identifier. */
+ const RecordInfo* getEndRecordInfo( sal_Int32 nRecId ) const;
+
+private:
+ typedef ::std::map< sal_Int32, RecordInfo > RecordInfoMap;
+
+ RecordInputSource maSource;
+ ::rtl::Reference< FragmentHandler > mxHandler;
+ ::rtl::Reference< prv::Locator > mxLocator;
+ ::std::auto_ptr< prv::ContextStack > mxStack;
+ RecordInfoMap maStartMap;
+ RecordInfoMap maEndMap;
+};
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/relations.hxx b/include/oox/core/relations.hxx
new file mode 100644
index 000000000000..b78d0d3056eb
--- /dev/null
+++ b/include/oox/core/relations.hxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_CORE_RELATIONS_HXX
+#define OOX_CORE_RELATIONS_HXX
+
+#include <map>
+#include <boost/shared_ptr.hpp>
+#include "oox/helper/helper.hxx"
+#include "oox/dllapi.h"
+
+namespace oox {
+namespace core {
+
+// ============================================================================
+
+/** Expands to an OUString containing an 'officeDocument' relation type created
+ from the passed literal(!) ASCII(!) character array. */
+#define CREATE_OFFICEDOC_RELATION_TYPE( ascii ) \
+ ( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/" ascii )
+
+/** Expands to an OUString containing a 'package' relation type created from
+ the passed literal(!) ASCII(!) character array. */
+#define CREATE_PACKAGE_RELATION_TYPE( ascii ) \
+ ( "http://schemas.openxmlformats.org/package/2006/relationships/" ascii )
+
+/** Expands to an OUString containing an MS Office specific relation type
+ created from the passed literal(!) ASCII(!) character array. */
+#define CREATE_MSOFFICE_RELATION_TYPE( ascii ) \
+ ( "http://schemas.microsoft.com/office/2006/relationships/" ascii )
+
+// ============================================================================
+
+struct Relation
+{
+ OUString maId;
+ OUString maType;
+ OUString maTarget;
+ bool mbExternal;
+
+ inline explicit Relation() : mbExternal( false ) {}
+};
+
+// ============================================================================
+
+class Relations;
+typedef ::boost::shared_ptr< Relations > RelationsRef;
+
+class OOX_DLLPUBLIC Relations : public ::std::map< OUString, Relation >
+{
+public:
+ explicit Relations( const OUString& rFragmentPath );
+
+ /** Returns the path of the fragment this relations collection is related to. */
+ inline const OUString& getFragmentPath() const { return maFragmentPath; }
+
+ /** Returns the relation with the passed relation identifier. */
+ const Relation* getRelationFromRelId( const OUString& rId ) const;
+ /** Returns the first relation with the passed type. */
+ const Relation* getRelationFromFirstType( const OUString& rType ) const;
+ /** Finds all relations associated with the passed type. */
+ RelationsRef getRelationsFromType( const OUString& rType ) const;
+
+ /** Returns the external target of the relation with the passed relation identifier. */
+ OUString getExternalTargetFromRelId( const OUString& rRelId ) const;
+ /** Returns the internal target of the relation with the passed relation identifier. */
+ OUString getInternalTargetFromRelId( const OUString& rRelId ) const;
+
+ /** Returns the full fragment path for the target of the passed relation. */
+ OUString getFragmentPathFromRelation( const Relation& rRelation ) const;
+ /** Returns the full fragment path for the passed relation identifier. */
+ OUString getFragmentPathFromRelId( const OUString& rRelId ) const;
+ /** Returns the full fragment path for the first relation of the passed type. */
+ OUString getFragmentPathFromFirstType( const OUString& rType ) const;
+
+private:
+ OUString maFragmentPath;
+};
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/relationshandler.hxx b/include/oox/core/relationshandler.hxx
new file mode 100644
index 000000000000..d42e5d1ad8b7
--- /dev/null
+++ b/include/oox/core/relationshandler.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_CORE_RELATIONSHANDLER_HXX
+#define OOX_CORE_RELATIONSHANDLER_HXX
+
+#include "oox/core/fragmenthandler.hxx"
+
+namespace oox {
+namespace core {
+
+// ============================================================================
+
+class RelationsFragment : public FragmentHandler
+{
+public:
+ explicit RelationsFragment(
+ XmlFilterBase& rFilter,
+ RelationsRef xRelations );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ RelationsRef mxRelations;
+};
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/xmlfilterbase.hxx b/include/oox/core/xmlfilterbase.hxx
new file mode 100644
index 000000000000..4b5c1e093657
--- /dev/null
+++ b/include/oox/core/xmlfilterbase.hxx
@@ -0,0 +1,256 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_CORE_XMLFILTERBASE_HXX
+#define OOX_CORE_XMLFILTERBASE_HXX
+
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XTextCursor.hpp>
+#include <com/sun/star/text/XTextField.hpp>
+#include <rtl/ref.hxx>
+#include <rtl/string.hxx>
+#include <rtl/ustring.hxx>
+#include "oox/core/filterbase.hxx"
+#include "oox/core/relations.hxx"
+#include "oox/drawingml/table/tablestylelist.hxx"
+#include "oox/dllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace container { class XNameContainer; }
+ namespace document { class XDocumentProperties; }
+ namespace xml { namespace dom { class XDocument; } }
+ namespace xml { namespace sax { class XLocator; } }
+ namespace xml { namespace sax { class XFastDocumentHandler; } }
+ namespace xml { namespace sax { class XFastSAXSerializable; } }
+} } }
+
+namespace oox {
+ namespace drawingml { class Theme; }
+ namespace drawingml { namespace chart { class ChartConverter; } }
+ namespace vml { class Drawing; }
+}
+
+namespace sax_fastparser {
+ class FastSerializerHelper;
+
+ typedef boost::shared_ptr< FastSerializerHelper > FSHelperPtr;
+}
+
+namespace oox {
+namespace core {
+
+class FragmentHandler;
+
+// ============================================================================
+
+struct TextField {
+ com::sun::star::uno::Reference< com::sun::star::text::XText > xText;
+ com::sun::star::uno::Reference< com::sun::star::text::XTextCursor > xTextCursor;
+ com::sun::star::uno::Reference< com::sun::star::text::XTextField > xTextField;
+};
+typedef std::vector< TextField > TextFieldStack;
+
+// ============================================================================
+
+struct XmlFilterBaseImpl;
+
+class OOX_DLLPUBLIC XmlFilterBase : public FilterBase
+{
+public:
+ explicit XmlFilterBase(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ~XmlFilterBase();
+
+ /** Has to be implemented by each filter, returns the current theme. */
+ virtual const ::oox::drawingml::Theme*
+ getCurrentTheme() const = 0;
+
+ /** Has to be implemented by each filter to return the collection of VML shapes. */
+ virtual ::oox::vml::Drawing* getVmlDrawing() = 0;
+
+ /** Has to be implemented by each filter, returns a filter-specific chart
+ converter object, that should be global per imported document. */
+ virtual ::oox::drawingml::chart::ChartConverter* getChartConverter() = 0;
+
+ /** Has to be implemented by each filter to return the table style list. */
+ virtual const ::oox::drawingml::table::TableStyleListPtr getTableStyles() = 0;
+
+ // ------------------------------------------------------------------------
+
+ /** Returns the fragment path from the first relation of the passed type,
+ used for fragments referred by the root relations. */
+ OUString getFragmentPathFromFirstType( const OUString& rType );
+
+ /** Imports a fragment using the passed fragment handler, which contains
+ the full path to the fragment stream.
+
+ @return True, if the fragment could be imported.
+ */
+ bool importFragment( const ::rtl::Reference< FragmentHandler >& rxHandler );
+
+ /** Imports a fragment into an xml::dom::XDocument.
+
+ @param rFragmentPath path to fragment
+
+ @return a non-empty reference to the XDocument, if the
+ fragment could be imported.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::dom::XDocument> importFragment( const OUString& rFragmentPath );
+
+ /** Imports a fragment from an xml::dom::XDocument using the
+ passed fragment handler
+
+ @param rxHandler fragment handler; path to fragment is
+ ignored, input source is the rxSerializer
+
+ @param rxSerializer usually retrieved from a
+ xml::dom::XDocument, will get serialized into rxHandler
+
+ @return true, if the fragment could be imported.
+ */
+ bool importFragment( const ::rtl::Reference< FragmentHandler >& rxHandler,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XFastSAXSerializable >& rxSerializer );
+
+ /** Imports the relations fragment associated with the specified fragment.
+
+ @return The relations collection of the specified fragment.
+ */
+ RelationsRef importRelations( const OUString& rFragmentPath );
+
+ /** Adds new relation.
+
+ @param rType
+ Relation type.
+
+ @param rTarget
+ Relation target.
+
+ @return Added relation Id.
+ */
+ OUString addRelation( const OUString& rType, const OUString& rTarget, bool bExternal = false );
+
+ /** Adds new relation to part's relations.
+
+ @param rPartName
+ Part name the relations are related to. The relations will be stored in <rPartName::path>/_rels/<rPartName::name>.rels.
+
+ @param rType
+ Relation type.
+
+ @param rTarget
+ Relation target.
+
+ @return Added relation Id.
+ */
+ OUString addRelation( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xOutputStream, const OUString& rType, const OUString& rTarget, bool bExternal = false );
+
+ /** Returns a stack of used textfields, used by the pptx importer to replace links to slidepages with rhe real page name */
+ TextFieldStack& getTextFieldStack() const;
+
+ /** Opens and returns the specified output stream from the base storage with specified media type.
+
+ @param rStreamName
+ The name of the embedded storage stream. The name may contain
+ slashes to open streams from embedded substorages. If base stream
+ access has been enabled in the storage, the base stream can be
+ accessed by passing an empty string as stream name.
+
+ @param rMediaType
+ The media type string, used in [Content_Types].xml stream in base
+ storage.
+
+ @return The opened output stream.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
+ openFragmentStream(
+ const OUString& rStreamName,
+ const OUString& rMediaType );
+
+ /** Opens specified output stream from the base storage with specified
+ media type and returns new fast serializer for that stream.
+
+ @param rStreamName
+ The name of the embedded storage stream. The name may contain
+ slashes to open streams from embedded substorages. If base stream
+ access has been enabled in the storage, the base stream can be
+ accessed by passing an empty string as stream name.
+
+ @param rMediaType
+ The media type string, used in [Content_Types].xml stream in base
+ storage.
+
+ @return newly created serializer helper.
+ */
+ ::sax_fastparser::FSHelperPtr
+ openFragmentStreamWithSerializer(
+ const OUString& rStreamName,
+ const OUString& rMediaType );
+
+ /** Returns new unique ID for exported document.
+
+ @return newly created ID.
+ */
+ inline sal_Int32 GetUniqueId() { return mnMaxDocId++; }
+ inline OString GetUniqueIdOString() { return OString::valueOf( mnMaxDocId++ ); }
+ inline OUString GetUniqueIdOUString() { return OUString::valueOf( mnMaxDocId++ ); }
+
+ /** Write the document properties into into the current OPC package.
+
+ @param xProperties The document properties to export.
+
+ @return *this
+ */
+ XmlFilterBase& exportDocumentProperties( ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties > xProperties );
+
+ OUString getNamespaceURL( const OUString& rPrefix );
+
+ sal_Int32 getNamespaceId( const OUString& rUrl );
+
+ void importDocumentProperties();
+
+protected:
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ implGetInputStream( ::comphelper::MediaDescriptor& rMediaDesc ) const;
+
+private:
+ virtual StorageRef implCreateStorage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream ) const;
+ virtual StorageRef implCreateStorage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxOutStream ) const;
+
+private:
+ ::std::auto_ptr< XmlFilterBaseImpl > mxImpl;
+ sal_Int32 mnRelId;
+ sal_Int32 mnMaxDocId;
+};
+
+typedef ::rtl::Reference< XmlFilterBase > XmlFilterRef;
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/dllapi.h b/include/oox/dllapi.h
new file mode 100644
index 000000000000..6026aef0ae58
--- /dev/null
+++ b/include/oox/dllapi.h
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_DLLAPI_H
+#define INCLUDED_OOX_DLLAPI_H
+
+#include "sal/types.h"
+
+#if defined OOX_DLLIMPLEMENTATION
+#define OOX_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define OOX_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/axiscontext.hxx b/include/oox/drawingml/chart/axiscontext.hxx
new file mode 100644
index 000000000000..d22a53f23227
--- /dev/null
+++ b/include/oox/drawingml/chart/axiscontext.hxx
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_AXISCONTEXT_HXX
+#define OOX_DRAWINGML_CHART_AXISCONTEXT_HXX
+
+#include "oox/drawingml/chart/chartcontextbase.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct AxisDispUnitsModel;
+
+/** Handler for a value axis display units context (c:dispUnits element).
+ */
+class AxisDispUnitsContext : public ContextBase< AxisDispUnitsModel >
+{
+public:
+ explicit AxisDispUnitsContext( ::oox::core::ContextHandler2Helper& rParent, AxisDispUnitsModel& rModel );
+ virtual ~AxisDispUnitsContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct AxisModel;
+
+/** Base class for axis context handlers (c:catAx, c:dateAx, c:serAx, c:valAx
+ elements).
+ */
+class AxisContextBase : public ContextBase< AxisModel >
+{
+public:
+ explicit AxisContextBase( ::oox::core::ContextHandler2Helper& rParent, AxisModel& rModel );
+ virtual ~AxisContextBase();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a category axis context (c:catAx element).
+ */
+class CatAxisContext : public AxisContextBase
+{
+public:
+ explicit CatAxisContext( ::oox::core::ContextHandler2Helper& rParent, AxisModel& rModel );
+ virtual ~CatAxisContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a date axis context (c:dateAx element).
+ */
+class DateAxisContext : public AxisContextBase
+{
+public:
+ explicit DateAxisContext( ::oox::core::ContextHandler2Helper& rParent, AxisModel& rModel );
+ virtual ~DateAxisContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a series axis context (c:serAx element).
+ */
+class SerAxisContext : public AxisContextBase
+{
+public:
+ explicit SerAxisContext( ::oox::core::ContextHandler2Helper& rParent, AxisModel& rModel );
+ virtual ~SerAxisContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a value axis context (c:valAx element).
+ */
+class ValAxisContext : public AxisContextBase
+{
+public:
+ explicit ValAxisContext( ::oox::core::ContextHandler2Helper& rParent, AxisModel& rModel );
+ virtual ~ValAxisContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/axisconverter.hxx b/include/oox/drawingml/chart/axisconverter.hxx
new file mode 100644
index 000000000000..fac1d67c8997
--- /dev/null
+++ b/include/oox/drawingml/chart/axisconverter.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_AXISCONVERTER_HXX
+#define OOX_DRAWINGML_CHART_AXISCONVERTER_HXX
+
+#include "oox/drawingml/chart/converterbase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace chart2 { class XAxis; }
+ namespace chart2 { class XCoordinateSystem; }
+} } }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct AxisModel;
+class TypeGroupConverter;
+
+class AxisConverter : public ConverterBase< AxisModel >
+{
+public:
+ explicit AxisConverter(
+ const ConverterRoot& rParent,
+ AxisModel& rModel );
+ virtual ~AxisConverter();
+
+ /** Creates a chart2 axis and inserts it into the passed coordinate system. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem >& rxCoordSystem,
+ TypeGroupConverter& rTypeGroup,
+ const AxisModel* pCrossingAxis,
+ sal_Int32 nAxesSetIdx,
+ sal_Int32 nAxisIdx );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/axismodel.hxx b/include/oox/drawingml/chart/axismodel.hxx
new file mode 100644
index 000000000000..30ceae499b0a
--- /dev/null
+++ b/include/oox/drawingml/chart/axismodel.hxx
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_AXISMODEL_HXX
+#define OOX_DRAWINGML_CHART_AXISMODEL_HXX
+
+#include "oox/drawingml/shape.hxx"
+#include "oox/drawingml/chart/titlemodel.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct AxisDispUnitsModel
+{
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< TextBody > TextBodyRef;
+ typedef ModelRef< LayoutModel > LayoutRef;
+ typedef ModelRef< TextModel > TextRef;
+
+ ShapeRef mxShapeProp; /// Label frame formatting.
+ TextBodyRef mxTextProp; /// Label text formatting.
+ LayoutRef mxLayout; /// Layout/position of the axis units label.
+ TextRef mxText; /// Text source of the axis units label.
+ double mfCustomUnit; /// Custom unit size on value axis.
+ sal_Int32 mnBuiltInUnit; /// Built-in unit on value axis.
+
+ explicit AxisDispUnitsModel();
+ ~AxisDispUnitsModel();
+};
+
+// ============================================================================
+
+struct AxisModel
+{
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< TextBody > TextBodyRef;
+ typedef ModelRef< TitleModel > TitleRef;
+ typedef ModelRef< AxisDispUnitsModel > AxisDispUnitsRef;
+
+ ShapeRef mxShapeProp; /// Axis line formatting.
+ TextBodyRef mxTextProp; /// Axis label text formatting.
+ TitleRef mxTitle; /// Axis title.
+ AxisDispUnitsRef mxDispUnits; /// Axis units label.
+ ShapeRef mxMajorGridLines; /// Major grid lines formatting.
+ ShapeRef mxMinorGridLines; /// Minor grid lines formatting.
+ NumberFormat maNumberFormat; /// Number format for axis tick labels.
+ OptValue< double > mofCrossesAt; /// Position on this axis where another axis crosses.
+ OptValue< double > mofMajorUnit; /// Unit for major tick marks on date/value axis.
+ OptValue< double > mofMinorUnit; /// Unit for minor tick marks on date/value axis.
+ OptValue< double > mofLogBase; /// Logarithmic base for logarithmic axes.
+ OptValue< double > mofMax; /// Maximum axis value.
+ OptValue< double > mofMin; /// Minimum axis value.
+ OptValue< sal_Int32 > monBaseTimeUnit; /// Base time unit shown on a date axis.
+ sal_Int32 mnAxisId; /// Unique axis identifier.
+ sal_Int32 mnAxisPos; /// Position of the axis (top/bottom/left/right).
+ sal_Int32 mnCrossAxisId; /// Identifier of a crossing axis.
+ sal_Int32 mnCrossBetween; /// This value axis crosses between or inside category.
+ sal_Int32 mnCrossMode; /// Mode this axis crosses another axis (min, max, auto).
+ sal_Int32 mnLabelAlign; /// Tick mark label alignment.
+ sal_Int32 mnLabelOffset; /// Tick mark label distance from axis.
+ sal_Int32 mnMajorTickMark; /// Major tick mark style.
+ sal_Int32 mnMajorTimeUnit; /// Time unit for major tick marks on date axis.
+ sal_Int32 mnMinorTickMark; /// Mainor tick mark style.
+ sal_Int32 mnMinorTimeUnit; /// Time unit for minor tick marks on date axis.
+ sal_Int32 mnOrientation; /// Axis orientation (value order min to max, or max to min).
+ sal_Int32 mnTickLabelPos; /// Position of tick mark labels relative to the axis.
+ sal_Int32 mnTickLabelSkip; /// Number of tick mark labels to skip.
+ sal_Int32 mnTickMarkSkip; /// Number of tick marks to skip.
+ sal_Int32 mnTypeId; /// Type identifier of this axis.
+ bool mbAuto; /// True = automatic selection of text/date axis type.
+ bool mbDeleted; /// True = axis has been deleted manually.
+ bool mbNoMultiLevel; /// True = no multi-level categories supported.
+
+ explicit AxisModel( sal_Int32 nTypeId );
+ ~AxisModel();
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/chartcontextbase.hxx b/include/oox/drawingml/chart/chartcontextbase.hxx
new file mode 100644
index 000000000000..218e7bf4406e
--- /dev/null
+++ b/include/oox/drawingml/chart/chartcontextbase.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_CHARTCONTEXTBASE_HXX
+#define OOX_DRAWINGML_CHART_CHARTCONTEXTBASE_HXX
+
+#include "oox/core/fragmenthandler2.hxx"
+
+namespace oox { namespace drawingml { class Shape; } }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+template< typename ModelType >
+class ContextBase : public ::oox::core::ContextHandler2
+{
+public:
+ inline explicit ContextBase( ::oox::core::ContextHandler2Helper& rParent, ModelType& rModel ) :
+ ::oox::core::ContextHandler2( rParent ), mrModel( rModel ) {}
+ virtual ~ContextBase() {}
+
+protected:
+ ModelType& mrModel;
+};
+
+// ============================================================================
+
+template< typename ModelType >
+class FragmentBase : public ::oox::core::FragmentHandler2
+{
+public:
+ explicit FragmentBase( ::oox::core::XmlFilterBase& rFilter, const OUString& rFragmentPath, ModelType& rModel ) :
+ ::oox::core::FragmentHandler2( rFilter, rFragmentPath, false ), mrModel( rModel ) {}
+ virtual ~FragmentBase() {}
+
+protected:
+ ModelType& mrModel;
+};
+
+// ============================================================================
+
+/** Help class for all contexts that have only the c:spPr child element.
+ */
+class ShapePrWrapperContext : public ContextBase< Shape >
+{
+public:
+ explicit ShapePrWrapperContext( ::oox::core::ContextHandler2Helper& rParent, Shape& rModel );
+ virtual ~ShapePrWrapperContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct LayoutModel;
+
+/** Handler for a chart layout context (c:layout element).
+ */
+class LayoutContext : public ContextBase< LayoutModel >
+{
+public:
+ explicit LayoutContext( ::oox::core::ContextHandler2Helper& rParent, LayoutModel& rModel );
+ virtual ~LayoutContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/chartconverter.hxx b/include/oox/drawingml/chart/chartconverter.hxx
new file mode 100644
index 000000000000..bbc7e0fafd28
--- /dev/null
+++ b/include/oox/drawingml/chart/chartconverter.hxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_CHARTCONVERTER_HXX
+#define OOX_DRAWINGML_CHART_CHARTCONVERTER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/dllapi.h>
+
+namespace com { namespace sun { namespace star {
+ namespace awt { struct Point; }
+ namespace awt { struct Size; }
+ namespace drawing { class XShapes; }
+ namespace chart2 { class XChartDocument; }
+ namespace chart2 { namespace data { class XDataProvider; } }
+ namespace chart2 { namespace data { class XDataSequence; } }
+} } }
+
+namespace oox { namespace core { class XmlFilterBase; } }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+struct ChartSpaceModel;
+struct DataSequenceModel;
+
+// ============================================================================
+
+class OOX_DLLPUBLIC ChartConverter
+{
+public:
+ explicit ChartConverter();
+ virtual ~ChartConverter();
+
+ /** Converts the passed OOXML chart model to the passed chart2 document.
+
+ @param rChartModel The filled MSOOXML chart model structure.
+
+ @param rxChartDoc The UNO chart document model to be initialized.
+
+ @param rxExternalPage If null, all embedded shapes will be inserted
+ into the internal drawing page of the chart document. If not null,
+ all embedded shapes will be inserted into this shapes collection.
+
+ @param rChartPos The position of the chart shape in its drawing page,
+ in 1/100 mm. Will be used only, if parameter rxExternalPage is not
+ null, for correct positioning of the embedded shapes in the
+ external drawing page.
+
+ @param rChartSize The size of the chart shape in 1/100 mm. Needed for
+ calculation of position and size of the chart elements (diagram,
+ titles, legend, etc.) and embedded shapes.
+ */
+ void convertFromModel(
+ ::oox::core::XmlFilterBase& rFilter,
+ ChartSpaceModel& rChartModel,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& rxChartDoc,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxExternalPage,
+ const ::com::sun::star::awt::Point& rChartPos,
+ const ::com::sun::star::awt::Size& rChartSize );
+
+ /** Creates an internal data provider. Derived classes may override this
+ function to create an external data provider. */
+ virtual void createDataProvider(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& rxChartDoc );
+
+ /** Creates a data sequence from a formula. Dummy implementation. Derived
+ classes have to override this function to actually parse the formula. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >
+ createDataSequence(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider >& rxDataProvider,
+ const DataSequenceModel& rDataSeq );
+
+private:
+ ChartConverter( const ChartConverter& );
+ ChartConverter& operator=( const ChartConverter& );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/chartdrawingfragment.hxx b/include/oox/drawingml/chart/chartdrawingfragment.hxx
new file mode 100644
index 000000000000..43d27f586514
--- /dev/null
+++ b/include/oox/drawingml/chart/chartdrawingfragment.hxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_CHARTDRAWINGFRAGMENT_HXX
+#define OOX_DRAWINGML_CHART_CHARTDRAWINGFRAGMENT_HXX
+
+#include "oox/core/fragmenthandler2.hxx"
+#include "oox/drawingml/shape.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+/** Relative shape position in a chart object. */
+struct AnchorPosModel
+{
+ double mfX; /// X coordinate relative to chart object (0.0 to 1.0).
+ double mfY; /// Y coordinate relative to chart object (0.0 to 1.0).
+
+ inline explicit AnchorPosModel() : mfX( -1.0 ), mfY( -1.0 ) {}
+ inline bool isValid() const { return (0.0 <= mfX) && (mfX <= 1.0) && (0.0 <= mfY) && (mfY <= 1.0); }
+};
+
+// ----------------------------------------------------------------------------
+
+/** Absolute shape size in a chart object (in EMUs). */
+struct AnchorSizeModel : public EmuSize
+{
+ inline explicit AnchorSizeModel() : EmuSize( -1, -1 ) {}
+ inline bool isValid() const { return (Width >= 0) && (Height >= 0); }
+};
+
+// ============================================================================
+
+/** Contains the position of a shape in the chart object. Supports different
+ shape anchor modes (absolute, relative).
+ */
+class ShapeAnchor
+{
+public:
+ explicit ShapeAnchor( bool bRelSize );
+
+ /** Imports the absolute anchor size from the cdr:ext element. */
+ void importExt( const AttributeList& rAttribs );
+ /** Sets an the relative anchor position from the cdr:from or cdr:to element. */
+ void setPos( sal_Int32 nElement, sal_Int32 nParentContext, const OUString& rValue );
+
+ /** Calculates the resulting shape anchor in EMUs. */
+ EmuRectangle calcAnchorRectEmu( const EmuRectangle& rChartRect ) const;
+
+private:
+ AnchorPosModel maFrom; /// Top-left position relative to chart object.
+ AnchorPosModel maTo; /// Bottom-right position relative to chart object.
+ AnchorSizeModel maSize; /// Shape size, if anchor has absolute size.
+ bool mbRelSize; /// True = relative size, false = absolute size.
+};
+
+typedef ::boost::shared_ptr< ShapeAnchor > ShapeAnchorRef;
+
+// ============================================================================
+
+/** Handler for a chart drawing fragment (c:userShapes root element).
+ */
+class ChartDrawingFragment : public ::oox::core::FragmentHandler2
+{
+public:
+ explicit ChartDrawingFragment(
+ ::oox::core::XmlFilterBase& rFilter,
+ const OUString& rFragmentPath,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxDrawPage,
+ const ::com::sun::star::awt::Size& rChartSize,
+ const ::com::sun::star::awt::Point& rShapesOffset,
+ bool bOleSupport );
+ virtual ~ChartDrawingFragment();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onCharacters( const OUString& rChars );
+ virtual void onEndElement();
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
+ mxDrawPage; /// Drawing page of this sheet.
+ ::oox::drawingml::ShapePtr mxShape; /// Current top-level shape.
+ ShapeAnchorRef mxAnchor; /// Current anchor of top-level shape.
+ EmuRectangle maChartRectEmu; /// Position and size of the chart object for embedded shapes (in EMUs).
+ bool mbOleSupport; /// True = allow to insert OLE objects into the drawing page.
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/chartspaceconverter.hxx b/include/oox/drawingml/chart/chartspaceconverter.hxx
new file mode 100644
index 000000000000..2bdeb013b1b3
--- /dev/null
+++ b/include/oox/drawingml/chart/chartspaceconverter.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_CHARTSPACECONVERTER_HXX
+#define OOX_DRAWINGML_CHART_CHARTSPACECONVERTER_HXX
+
+#include "oox/drawingml/chart/converterbase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace drawing { class XShapes; }
+} } }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct ChartSpaceModel;
+
+class ChartSpaceConverter : public ConverterBase< ChartSpaceModel >
+{
+public:
+ explicit ChartSpaceConverter( const ConverterRoot& rParent, ChartSpaceModel& rModel );
+ virtual ~ChartSpaceConverter();
+
+ /** Converts the contained OOXML chart model to a chart2 document. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxExternalPage,
+ const ::com::sun::star::awt::Point& rChartPos );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/chartspacefragment.hxx b/include/oox/drawingml/chart/chartspacefragment.hxx
new file mode 100644
index 000000000000..c9b1e0c6b776
--- /dev/null
+++ b/include/oox/drawingml/chart/chartspacefragment.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_CHARTSPACEFRAGMENT_HXX
+#define OOX_DRAWINGML_CHART_CHARTSPACEFRAGMENT_HXX
+
+#include "oox/drawingml/chart/chartcontextbase.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct ChartSpaceModel;
+
+/** Handler for a chart fragment (c:chartSpace root element).
+ */
+class ChartSpaceFragment : public FragmentBase< ChartSpaceModel >
+{
+public:
+ explicit ChartSpaceFragment(
+ ::oox::core::XmlFilterBase& rFilter,
+ const OUString& rFragmentPath,
+ ChartSpaceModel& rModel );
+ virtual ~ChartSpaceFragment();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/chartspacemodel.hxx b/include/oox/drawingml/chart/chartspacemodel.hxx
new file mode 100644
index 000000000000..b3d3405c4670
--- /dev/null
+++ b/include/oox/drawingml/chart/chartspacemodel.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_CHARTSPACEMODEL_HXX
+#define OOX_DRAWINGML_CHART_CHARTSPACEMODEL_HXX
+
+#include "oox/drawingml/shape.hxx"
+#include "oox/drawingml/chart/plotareamodel.hxx"
+#include "oox/drawingml/chart/titlemodel.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct ChartSpaceModel
+{
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< TextBody > TextBodyRef;
+ typedef ModelRef< PlotAreaModel > PlotAreaRef;
+ typedef ModelRef< WallFloorModel > WallFloorRef;
+ typedef ModelRef< View3DModel > View3DRef;
+ typedef ModelRef< TitleModel > TitleRef;
+ typedef ModelRef< LegendModel > LegendRef;
+
+ ShapeRef mxShapeProp; /// Chart frame formatting.
+ TextBodyRef mxTextProp; /// Global chart text formatting.
+ PlotAreaRef mxPlotArea; /// Plot area of the chart.
+ WallFloorRef mxFloor; /// Floor formatting in 3D charts.
+ WallFloorRef mxBackWall; /// Back wall formatting in 3D charts.
+ WallFloorRef mxSideWall; /// Side wall formatting in 3D charts.
+ View3DRef mxView3D; /// 3D settings.
+ TitleRef mxTitle; /// Chart main title.
+ LegendRef mxLegend; /// Chart legend.
+ OUString maDrawingPath; /// Path to drawing fragment with embedded shapes.
+ sal_Int32 mnDispBlanksAs; /// Mode how to display blank values.
+ sal_Int32 mnStyle; /// Index to default formatting.
+ bool mbAutoTitleDel; /// True = automatic title deleted manually.
+ bool mbPlotVisOnly; /// True = plot visible cells in a sheet only.
+ bool mbShowLabelsOverMax;/// True = show labels over chart maximum.
+ bool mbPivotChart; /// True = pivot chart.
+
+ explicit ChartSpaceModel();
+ ~ChartSpaceModel();
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/converterbase.hxx b/include/oox/drawingml/chart/converterbase.hxx
new file mode 100644
index 000000000000..21a03441e803
--- /dev/null
+++ b/include/oox/drawingml/chart/converterbase.hxx
@@ -0,0 +1,153 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_CONVERTERBASE_HXX
+#define OOX_DRAWINGML_CHART_CONVERTERBASE_HXX
+
+#include "oox/drawingml/chart/chartcontextbase.hxx"
+#include "oox/drawingml/chart/objectformatter.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace awt { struct Rectangle; }
+ namespace awt { struct Size; }
+ namespace chart2 { class XChartDocument; }
+ namespace chart2 { class XTitle; }
+ namespace drawing { class XShape; }
+} } }
+
+namespace oox { namespace core {
+ class XmlFilterBase;
+} }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+class ChartConverter;
+struct ChartSpaceModel;
+struct ConverterData;
+
+// ============================================================================
+
+const sal_Int32 API_PRIM_AXESSET = 0;
+const sal_Int32 API_SECN_AXESSET = 1;
+
+const sal_Int32 API_X_AXIS = 0;
+const sal_Int32 API_Y_AXIS = 1;
+const sal_Int32 API_Z_AXIS = 2;
+
+// ============================================================================
+
+class ConverterRoot
+{
+public:
+ explicit ConverterRoot(
+ ::oox::core::XmlFilterBase& rFilter,
+ ChartConverter& rChartConverter,
+ const ChartSpaceModel& rChartModel,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& rxChartDoc,
+ const ::com::sun::star::awt::Size& rChartSize );
+ virtual ~ConverterRoot();
+
+ /** Creates an instance for the passed service name, using the process service factory. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+ createInstance( const OUString& rServiceName ) const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ getComponentContext() const;
+
+protected:
+ /** Returns the filter object of the imported/exported document. */
+ ::oox::core::XmlFilterBase& getFilter() const;
+ /** Returns the chart converter. */
+ ChartConverter* getChartConverter() const;
+ /** Returns the API chart document model. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >
+ getChartDocument() const;
+ /** Returns the position and size of the chart shape in 1/100 mm. */
+ const ::com::sun::star::awt::Size& getChartSize() const;
+ /** Returns the object formatter. */
+ ObjectFormatter& getFormatter() const;
+
+ /** Registers a title object and its layout data, needed for conversion of
+ the title position using the old Chart1 API. */
+ void registerTitleLayout(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTitle >& rxTitle,
+ const ModelRef< LayoutModel >& rxLayout, ObjectType eObjType,
+ sal_Int32 nMainIdx = -1, sal_Int32 nSubIdx = -1 );
+ /** Converts the positions of the main title and all axis titles. */
+ void convertTitlePositions();
+
+private:
+ ::boost::shared_ptr< ConverterData > mxData;
+};
+
+// ============================================================================
+
+/** Base class of all converter classes. Holds a reference to a model structure
+ of the specified type.
+ */
+template< typename ModelType >
+class ConverterBase : public ConverterRoot
+{
+public:
+ inline const ModelType& getModel() const { return mrModel; }
+
+protected:
+ inline explicit ConverterBase( const ConverterRoot& rParent, ModelType& rModel ) :
+ ConverterRoot( rParent ), mrModel( rModel ) {}
+ virtual ~ConverterBase() {}
+
+protected:
+ ModelType& mrModel;
+};
+
+// ============================================================================
+
+/** A layout converter calculates positions and sizes for various chart objects.
+ */
+class LayoutConverter : public ConverterBase< LayoutModel >
+{
+public:
+ explicit LayoutConverter( const ConverterRoot& rParent, LayoutModel& rModel );
+ virtual ~LayoutConverter();
+
+ /** Tries to calculate the absolute position and size from the contained
+ OOXML layout model. Returns true, if returned rectangle is valid. */
+ bool calcAbsRectangle( ::com::sun::star::awt::Rectangle& orRect ) const;
+
+ /** Tries to set the position and size from the contained OOXML layout model.
+ Returns true, if a manual position and size could be calculated. */
+ bool convertFromModel( PropertySet& rPropSet );
+
+ /** Tries to set the position from the contained OOXML layout model.
+ Returns true, if a manual position could be calculated. */
+ bool convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape,
+ double fRotationAngle );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/datasourcecontext.hxx b/include/oox/drawingml/chart/datasourcecontext.hxx
new file mode 100644
index 000000000000..163b99c868e4
--- /dev/null
+++ b/include/oox/drawingml/chart/datasourcecontext.hxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_DATASOURCECONTEXT_HXX
+#define OOX_DRAWINGML_CHART_DATASOURCECONTEXT_HXX
+
+#include "oox/drawingml/chart/chartcontextbase.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct DataSequenceModel;
+
+typedef ContextBase< DataSequenceModel > DataSequenceContextBase;
+
+// ============================================================================
+
+/** Handler for a double sequence context (c:numLit, c:numRef elements).
+ */
+class DoubleSequenceContext : public DataSequenceContextBase
+{
+public:
+ explicit DoubleSequenceContext( ::oox::core::ContextHandler2Helper& rParent, DataSequenceModel& rModel );
+ virtual ~DoubleSequenceContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onCharacters( const OUString& rChars );
+
+private:
+ sal_Int32 mnPtIndex; /// Current data point index.
+};
+
+// ============================================================================
+
+/** Handler for a string sequence context (c:multiLvlStrRef, c:strLit,
+ c:strRef elements).
+ */
+class StringSequenceContext : public DataSequenceContextBase
+{
+public:
+ explicit StringSequenceContext( ::oox::core::ContextHandler2Helper& rParent, DataSequenceModel& rModel );
+ virtual ~StringSequenceContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onCharacters( const OUString& rChars );
+
+private:
+ sal_Int32 mnPtIndex; /// Current data point index.
+};
+
+// ============================================================================
+
+struct DataSourceModel;
+
+/** Handler for a data source context (c:bubbleSize, c:cat, c:minus, c:plus,
+ c:val, c:xVal, c:yVal elements).
+ */
+class DataSourceContext : public ContextBase< DataSourceModel >
+{
+public:
+ explicit DataSourceContext( ::oox::core::ContextHandler2Helper& rParent, DataSourceModel& rModel );
+ virtual ~DataSourceContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/datasourceconverter.hxx b/include/oox/drawingml/chart/datasourceconverter.hxx
new file mode 100644
index 000000000000..e8b5649e1bef
--- /dev/null
+++ b/include/oox/drawingml/chart/datasourceconverter.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_DATASOURCECONVERTER_HXX
+#define OOX_DRAWINGML_CHART_DATASOURCECONVERTER_HXX
+
+#include "oox/drawingml/chart/converterbase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace chart2 { namespace data { class XDataSequence; } }
+} } }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct DataSequenceModel;
+
+class DataSequenceConverter : public ConverterBase< DataSequenceModel >
+{
+public:
+ explicit DataSequenceConverter( const ConverterRoot& rParent, DataSequenceModel& rModel );
+ virtual ~DataSequenceConverter();
+
+ /** Creates a data sequence object from the contained formula link. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >
+ createDataSequence( const OUString& rRole );
+};
+
+// ============================================================================
+
+struct DataSourceModel;
+
+class DataSourceConverter : public ConverterBase< DataSourceModel >
+{
+public:
+ explicit DataSourceConverter( const ConverterRoot& rParent, DataSourceModel& rModel );
+ virtual ~DataSourceConverter();
+
+ /** Creates a data sequence object from the contained series data. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >
+ createDataSequence( const OUString& rRole );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/datasourcemodel.hxx b/include/oox/drawingml/chart/datasourcemodel.hxx
new file mode 100644
index 000000000000..d43048ef071c
--- /dev/null
+++ b/include/oox/drawingml/chart/datasourcemodel.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_DATASOURCEMODEL_HXX
+#define OOX_DRAWINGML_CHART_DATASOURCEMODEL_HXX
+
+#include <com/sun/star/uno/Any.hxx>
+#include "oox/drawingml/chart/modelbase.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct DataSequenceModel
+{
+ typedef ::std::map< sal_Int32, ::com::sun::star::uno::Any > AnyMap;
+
+ AnyMap maData; /// Map of values, indexed by point identifier.
+ OUString maFormula; /// Formula reference, e.g. into a spreadsheet.
+ OUString maFormatCode; /// Number format for double values.
+ sal_Int32 mnPointCount; /// Number of points in this series source.
+
+ explicit DataSequenceModel();
+ ~DataSequenceModel();
+};
+
+// ============================================================================
+
+struct DataSourceModel
+{
+ typedef ModelRef< DataSequenceModel > DataSequenceRef;
+
+ DataSequenceRef mxDataSeq; /// The data sequence or formula link of this source.
+
+ explicit DataSourceModel();
+ ~DataSourceModel();
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/modelbase.hxx b/include/oox/drawingml/chart/modelbase.hxx
new file mode 100644
index 000000000000..985221ec394b
--- /dev/null
+++ b/include/oox/drawingml/chart/modelbase.hxx
@@ -0,0 +1,134 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_MODELBASE_HXX
+#define OOX_DRAWINGML_CHART_MODELBASE_HXX
+
+#include "oox/helper/helper.hxx"
+#include "oox/helper/refmap.hxx"
+#include "oox/helper/refvector.hxx"
+
+namespace oox { class AttributeList; }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+template< typename ModelType >
+class ModelRef : public ::boost::shared_ptr< ModelType >
+{
+public:
+ inline explicit ModelRef() {}
+ inline ModelRef( const ::boost::shared_ptr< ModelType >& rxModel ) : ::boost::shared_ptr< ModelType >( rxModel ) {}
+ inline ~ModelRef() {}
+
+ inline bool is() const { return this->get() != 0; }
+
+ inline ModelType& create() { this->reset( new ModelType ); return **this; }
+ template< typename Param1Type >
+ inline ModelType& create( const Param1Type& rParam1 ) { this->reset( new ModelType( rParam1 ) ); return **this; }
+
+ inline ModelType& getOrCreate() { if( !*this ) this->reset( new ModelType ); return **this; }
+ template< typename Param1Type >
+ inline ModelType& getOrCreate( const Param1Type& rParam1 ) { if( !*this ) this->reset( new ModelType( rParam1 ) ); return **this; }
+};
+
+// ============================================================================
+
+template< typename ModelType >
+class ModelVector : public RefVector< ModelType >
+{
+public:
+ typedef typename RefVector< ModelType >::value_type value_type;
+ typedef typename RefVector< ModelType >::size_type size_type;
+
+ inline explicit ModelVector() {}
+ inline ~ModelVector() {}
+
+ inline ModelType& create() { return append( new ModelType ); }
+ template< typename Param1Type >
+ inline ModelType& create( const Param1Type& rParam1 ) { return append( new ModelType( rParam1 ) ); }
+
+private:
+ inline ModelType& append( ModelType* pModel ) { this->push_back( value_type( pModel ) ); return *pModel; }
+};
+
+// ============================================================================
+
+template< typename KeyType, typename ModelType >
+class ModelMap : public RefMap< KeyType, ModelType >
+{
+public:
+ typedef typename RefMap< KeyType, ModelType >::key_type key_type;
+ typedef typename RefMap< KeyType, ModelType >::mapped_type mapped_type;
+ typedef typename RefMap< KeyType, ModelType >::value_type value_type;
+
+ inline explicit ModelMap() {}
+ inline ~ModelMap() {}
+
+ inline ModelType& create( KeyType eKey ) { return insert( eKey, new ModelType ); }
+ template< typename Param1Type >
+ inline ModelType& create( KeyType eKey, const Param1Type& rParam1 ) { return insert( eKey, new ModelType( rParam1 ) ); }
+
+private:
+ inline ModelType& insert( KeyType eKey, ModelType* pModel ) { (*this)[ eKey ].reset( pModel ); return *pModel; }
+};
+
+// ============================================================================
+
+struct NumberFormat
+{
+ OUString maFormatCode; /// Number format code.
+ bool mbSourceLinked; /// True = number format linked to source data.
+
+ explicit NumberFormat();
+
+ void setAttributes( const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct LayoutModel
+{
+ double mfX; /// Left position of this object.
+ double mfY; /// Top position of this object.
+ double mfW; /// Width of this object.
+ double mfH; /// Height of this object.
+ sal_Int32 mnXMode; /// Mode for left position.
+ sal_Int32 mnYMode; /// Mode for top position.
+ sal_Int32 mnWMode; /// Mode for width.
+ sal_Int32 mnHMode; /// Mode for height.
+ sal_Int32 mnTarget; /// Layout target for plot area.
+ bool mbAutoLayout; /// True = automatic positioning.
+
+ explicit LayoutModel();
+ ~LayoutModel();
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/objectformatter.hxx b/include/oox/drawingml/chart/objectformatter.hxx
new file mode 100644
index 000000000000..5b2bb727f4fd
--- /dev/null
+++ b/include/oox/drawingml/chart/objectformatter.hxx
@@ -0,0 +1,157 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_OBJECTFORMATTER_HXX
+#define OOX_DRAWINGML_CHART_OBJECTFORMATTER_HXX
+
+#include "oox/helper/propertyset.hxx"
+#include "oox/drawingml/drawingmltypes.hxx"
+#include "oox/drawingml/chart/modelbase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace chart2 { class XChartDocument; }
+} } }
+
+namespace oox { namespace core { class XmlFilterBase; } }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+/** Enumerates different object types for specific automatic formatting behaviour. */
+enum ObjectType
+{
+ OBJECTTYPE_CHARTSPACE, /// Chart background.
+ OBJECTTYPE_CHARTTITLE, /// Chart title.
+ OBJECTTYPE_LEGEND, /// Legend.
+ OBJECTTYPE_PLOTAREA2D, /// Plot area containing axes and data series in 2D charts.
+ OBJECTTYPE_PLOTAREA3D, /// Plot area containing axes and data series in 3D charts.
+ OBJECTTYPE_WALL, /// Background and side wall in 3D charts.
+ OBJECTTYPE_FLOOR, /// Floor in 3D charts.
+ OBJECTTYPE_AXIS, /// Axis line, labels, tick marks.
+ OBJECTTYPE_AXISTITLE, /// Axis title.
+ OBJECTTYPE_AXISUNIT, /// Axis unit label.
+ OBJECTTYPE_MAJORGRIDLINE, /// Axis major grid line.
+ OBJECTTYPE_MINORGRIDLINE, /// Axis minor grid line.
+ OBJECTTYPE_LINEARSERIES2D, /// Linear series in 2D line/radarline/scatter charts.
+ OBJECTTYPE_FILLEDSERIES2D, /// Filled series in 2D bar/area/radararea/bubble/pie/surface charts.
+ OBJECTTYPE_FILLEDSERIES3D, /// Filled series in 3D charts.
+ OBJECTTYPE_DATALABEL, /// Labels for data points.
+ OBJECTTYPE_TRENDLINE, /// Data series trend line.
+ OBJECTTYPE_TRENDLINELABEL, /// Trend line label.
+ OBJECTTYPE_ERRORBAR, /// Data series error indicator line.
+ OBJECTTYPE_SERLINE, /// Data point connector lines.
+ OBJECTTYPE_LEADERLINE, /// Leader lines between pie slice and data label.
+ OBJECTTYPE_DROPLINE, /// Drop lines between data points and X axis.
+ OBJECTTYPE_HILOLINE, /// High/low lines in line/stock charts.
+ OBJECTTYPE_UPBAR, /// Up-bar in line/stock charts.
+ OBJECTTYPE_DOWNBAR, /// Down-bar in line/stock charts.
+ OBJECTTYPE_DATATABLE /// Data table.
+};
+
+// ============================================================================
+
+struct ChartSpaceModel;
+struct ObjectFormatterData;
+struct PictureOptionsModel;
+
+class ObjectFormatter
+{
+public:
+ explicit ObjectFormatter(
+ const ::oox::core::XmlFilterBase& rFilter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& rxChartDoc,
+ const ChartSpaceModel& rChartSpace );
+ ~ObjectFormatter();
+
+ /** Sets the maximum series index used for color cycling/fading. */
+ void setMaxSeriesIndex( sal_Int32 nMaxSeriesIdx );
+ /** Returns the current maximum series index used for color cycling/fading. */
+ sal_Int32 getMaxSeriesIndex() const;
+
+ /** Sets frame formatting properties to the passed property set. */
+ void convertFrameFormatting(
+ PropertySet& rPropSet,
+ const ModelRef< Shape >& rxShapeProp,
+ ObjectType eObjType,
+ sal_Int32 nSeriesIdx = -1 );
+
+ /** Sets frame formatting properties to the passed property set. */
+ void convertFrameFormatting(
+ PropertySet& rPropSet,
+ const ModelRef< Shape >& rxShapeProp,
+ const PictureOptionsModel& rPicOptions,
+ ObjectType eObjType,
+ sal_Int32 nSeriesIdx = -1 );
+
+ /** Sets text formatting properties to the passed property set. */
+ void convertTextFormatting(
+ PropertySet& rPropSet,
+ const ModelRef< TextBody >& rxTextProp,
+ ObjectType eObjType );
+
+ /** Sets frame/text formatting properties to the passed property set. */
+ void convertFormatting(
+ PropertySet& rPropSet,
+ const ModelRef< Shape >& rxShapeProp,
+ const ModelRef< TextBody >& rxTextProp,
+ ObjectType eObjType );
+
+ /** Sets text formatting properties to the passed property set. */
+ void convertTextFormatting(
+ PropertySet& rPropSet,
+ const TextCharacterProperties& rTextProps,
+ ObjectType eObjType );
+
+ /** Sets text rotation properties to the passed property set. */
+ void convertTextRotation(
+ PropertySet& rPropSet,
+ const ModelRef< TextBody >& rxTextProp,
+ bool bSupportsStacked );
+
+ /** Sets number format properties to the passed property set. */
+ void convertNumberFormat(
+ PropertySet& rPropSet,
+ const NumberFormat& rNumberFormat,
+ bool bPercentFormat = false );
+
+ /** Sets automatic fill properties to the passed property set. */
+ void convertAutomaticFill(
+ PropertySet& rPropSet,
+ ObjectType eObjType,
+ sal_Int32 nSeriesIdx = -1 );
+
+ /** Returns true, if the passed shape properties have automatic fill mode. */
+ static bool isAutomaticFill( const ModelRef< Shape >& rxShapeProp );
+
+private:
+ ::boost::shared_ptr< ObjectFormatterData > mxData;
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/plotareacontext.hxx b/include/oox/drawingml/chart/plotareacontext.hxx
new file mode 100644
index 000000000000..d9966a8d8bf4
--- /dev/null
+++ b/include/oox/drawingml/chart/plotareacontext.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_PLOTAREACONTEXT_HXX
+#define OOX_DRAWINGML_CHART_PLOTAREACONTEXT_HXX
+
+#include "oox/drawingml/chart/chartcontextbase.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct View3DModel;
+
+/** Handler for a chart plot area context (c:plotArea element).
+ */
+class View3DContext : public ContextBase< View3DModel >
+{
+public:
+ explicit View3DContext( ::oox::core::ContextHandler2Helper& rParent, View3DModel& rModel );
+ virtual ~View3DContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct WallFloorModel;
+
+/** Handler for a chart wall/floor context (c:backWall, c:floor, c:sideWall
+ elements).
+ */
+class WallFloorContext : public ContextBase< WallFloorModel >
+{
+public:
+ explicit WallFloorContext( ::oox::core::ContextHandler2Helper& rParent, WallFloorModel& rModel );
+ virtual ~WallFloorContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct PlotAreaModel;
+
+/** Handler for a chart plot area context (c:plotArea element).
+ */
+class PlotAreaContext : public ContextBase< PlotAreaModel >
+{
+public:
+ explicit PlotAreaContext( ::oox::core::ContextHandler2Helper& rParent, PlotAreaModel& rModel );
+ virtual ~PlotAreaContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/plotareaconverter.hxx b/include/oox/drawingml/chart/plotareaconverter.hxx
new file mode 100644
index 000000000000..6796ffbd6a1c
--- /dev/null
+++ b/include/oox/drawingml/chart/plotareaconverter.hxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_PLOTAREACONVERTER_HXX
+#define OOX_DRAWINGML_CHART_PLOTAREACONVERTER_HXX
+
+#include "oox/drawingml/chart/converterbase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace chart2 { class XDiagram; }
+} } }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct View3DModel;
+class TypeGroupConverter;
+
+class View3DConverter : public ConverterBase< View3DModel >
+{
+public:
+ explicit View3DConverter( const ConverterRoot& rParent, View3DModel& rModel );
+ virtual ~View3DConverter();
+
+ /** Converts the OOXML plot area model to a chart2 diagram. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& rxDiagram,
+ TypeGroupConverter& rTypeGroup );
+};
+
+// ============================================================================
+
+struct WallFloorModel;
+
+class WallFloorConverter : public ConverterBase< WallFloorModel >
+{
+public:
+ explicit WallFloorConverter( const ConverterRoot& rParent, WallFloorModel& rModel );
+ virtual ~WallFloorConverter();
+
+ /** Converts the OOXML wall/floor model to a chart2 diagram. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& rxDiagram,
+ ObjectType eObjType );
+};
+
+// ============================================================================
+
+struct PlotAreaModel;
+
+class PlotAreaConverter : public ConverterBase< PlotAreaModel >
+{
+public:
+ explicit PlotAreaConverter( const ConverterRoot& rParent, PlotAreaModel& rModel );
+ virtual ~PlotAreaConverter();
+
+ /** Converts the OOXML plot area model to a chart2 diagram. */
+ void convertFromModel( View3DModel& rView3DModel );
+ /** Converts the manual plot area position and size, if set. */
+ void convertPositionFromModel();
+
+ /** Returns the automatic chart title if the chart contains only one series. */
+ inline const OUString& getAutomaticTitle() const { return maAutoTitle; }
+ /** Returns true, if the chart is three-dimensional. */
+ inline bool is3dChart() const { return mb3dChart; }
+ /** Returns true, if chart type supports wall and floor format in 3D mode. */
+ inline bool isWall3dChart() const { return mbWall3dChart; }
+
+private:
+ OUString maAutoTitle;
+ bool mb3dChart;
+ bool mbWall3dChart;
+ bool mbPieChart;
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/plotareamodel.hxx b/include/oox/drawingml/chart/plotareamodel.hxx
new file mode 100644
index 000000000000..2afd6ccdd1da
--- /dev/null
+++ b/include/oox/drawingml/chart/plotareamodel.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_PLOTAREAMODEL_HXX
+#define OOX_DRAWINGML_CHART_PLOTAREAMODEL_HXX
+
+#include "oox/drawingml/shape.hxx"
+#include "oox/drawingml/chart/axismodel.hxx"
+#include "oox/drawingml/chart/seriesmodel.hxx"
+#include "oox/drawingml/chart/typegroupmodel.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct View3DModel
+{
+ OptValue< sal_Int32 > monHeightPercent; /// Height of the 3D view, relative to chart width.
+ OptValue< sal_Int32 > monRotationX; /// Horizontal rotation in degrees.
+ OptValue< sal_Int32 > monRotationY; /// Vertical rotation in degrees.
+ sal_Int32 mnDepthPercent; /// Depth of the 3D view, relative to chart width.
+ sal_Int32 mnPerspective; /// Eye distance to the 3D objects.
+ bool mbRightAngled; /// True = right-angled axes in 3D view.
+
+ explicit View3DModel();
+ ~View3DModel();
+};
+
+// ============================================================================
+
+struct WallFloorModel
+{
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< PictureOptionsModel > PictureOptionsRef;
+
+ ShapeRef mxShapeProp; /// Wall/floor frame formatting.
+ PictureOptionsRef mxPicOptions; /// Fill bitmap settings.
+
+ explicit WallFloorModel();
+ ~WallFloorModel();
+};
+
+// ============================================================================
+
+struct PlotAreaModel
+{
+ typedef ModelVector< TypeGroupModel > TypeGroupVector;
+ typedef ModelVector< AxisModel > AxisVector;
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< LayoutModel > LayoutRef;
+
+ TypeGroupVector maTypeGroups; /// All chart type groups contained in the chart.
+ AxisVector maAxes; /// All axes contained in the chart.
+ ShapeRef mxShapeProp; /// Plot area frame formatting.
+ LayoutRef mxLayout; /// Layout/position of the plot area.
+
+ explicit PlotAreaModel();
+ ~PlotAreaModel();
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/seriescontext.hxx b/include/oox/drawingml/chart/seriescontext.hxx
new file mode 100644
index 000000000000..e31156dd2796
--- /dev/null
+++ b/include/oox/drawingml/chart/seriescontext.hxx
@@ -0,0 +1,266 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_SERIESCONTEXT_HXX
+#define OOX_DRAWINGML_CHART_SERIESCONTEXT_HXX
+
+#include "oox/drawingml/chart/chartcontextbase.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct DataLabelModel;
+
+/** Handler for a chart data point label context (c:dLbl element).
+ */
+class DataLabelContext : public ContextBase< DataLabelModel >
+{
+public:
+ explicit DataLabelContext( ::oox::core::ContextHandler2Helper& rParent, DataLabelModel& rModel );
+ virtual ~DataLabelContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onCharacters( const OUString& rChars );
+};
+
+// ============================================================================
+
+struct DataLabelsModel;
+
+/** Handler for a chart data point label context (c:dLbl element).
+ */
+class DataLabelsContext : public ContextBase< DataLabelsModel >
+{
+public:
+ explicit DataLabelsContext( ::oox::core::ContextHandler2Helper& rParent, DataLabelsModel& rModel );
+ virtual ~DataLabelsContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onCharacters( const OUString& rChars );
+};
+
+// ============================================================================
+
+struct PictureOptionsModel;
+
+/** Handler for fill bitmap settings (c:pictureOptions element).
+ */
+class PictureOptionsContext : public ContextBase< PictureOptionsModel >
+{
+public:
+ explicit PictureOptionsContext( ::oox::core::ContextHandler2Helper& rParent, PictureOptionsModel& rModel );
+ virtual ~PictureOptionsContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct ErrorBarModel;
+
+/** Handler for a series error bar context (c:errBars element).
+ */
+class ErrorBarContext : public ContextBase< ErrorBarModel >
+{
+public:
+ explicit ErrorBarContext( ::oox::core::ContextHandler2Helper& rParent, ErrorBarModel& rModel );
+ virtual ~ErrorBarContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct TrendlineLabelModel;
+
+/** Handler for a series trendline label context (c:trendlineLbl element).
+ */
+class TrendlineLabelContext : public ContextBase< TrendlineLabelModel >
+{
+public:
+ explicit TrendlineLabelContext( ::oox::core::ContextHandler2Helper& rParent, TrendlineLabelModel& rModel );
+ virtual ~TrendlineLabelContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct TrendlineModel;
+
+/** Handler for a series trendline context (c:trendline element).
+ */
+class TrendlineContext : public ContextBase< TrendlineModel >
+{
+public:
+ explicit TrendlineContext( ::oox::core::ContextHandler2Helper& rParent, TrendlineModel& rModel );
+ virtual ~TrendlineContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onCharacters( const OUString& rChars );
+};
+
+// ============================================================================
+
+struct DataPointModel;
+
+/** Handler for a chart data point context (c:dPt element).
+ */
+class DataPointContext : public ContextBase< DataPointModel >
+{
+public:
+ explicit DataPointContext( ::oox::core::ContextHandler2Helper& rParent, DataPointModel& rModel );
+ virtual ~DataPointContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct SeriesModel;
+
+/** Handler base class for chart data series contexts (c:ser element).
+ */
+class SeriesContextBase : public ContextBase< SeriesModel >
+{
+public:
+ explicit SeriesContextBase( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
+ virtual ~SeriesContextBase();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a data series context for area chart types (c:ser element).
+ */
+class AreaSeriesContext : public SeriesContextBase
+{
+public:
+ explicit AreaSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
+ virtual ~AreaSeriesContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a data series context for bar chart types (c:ser element).
+ */
+class BarSeriesContext : public SeriesContextBase
+{
+public:
+ explicit BarSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
+ virtual ~BarSeriesContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a data series context for bubble chart types (c:ser element).
+ */
+class BubbleSeriesContext : public SeriesContextBase
+{
+public:
+ explicit BubbleSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
+ virtual ~BubbleSeriesContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a data series context for line and stock chart types (c:ser
+ element).
+ */
+class LineSeriesContext : public SeriesContextBase
+{
+public:
+ explicit LineSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
+ virtual ~LineSeriesContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a data series context for pie and doughnut chart types (c:ser
+ element).
+ */
+class PieSeriesContext : public SeriesContextBase
+{
+public:
+ explicit PieSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
+ virtual ~PieSeriesContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a data series context for radar chart types (c:ser element).
+ */
+class RadarSeriesContext : public SeriesContextBase
+{
+public:
+ explicit RadarSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
+ virtual ~RadarSeriesContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a data series context for scatter chart types (c:ser element).
+ */
+class ScatterSeriesContext : public SeriesContextBase
+{
+public:
+ explicit ScatterSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
+ virtual ~ScatterSeriesContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a data series context for scatter chart types (c:ser element).
+ */
+class SurfaceSeriesContext : public SeriesContextBase
+{
+public:
+ explicit SurfaceSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
+ virtual ~SurfaceSeriesContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/seriesconverter.hxx b/include/oox/drawingml/chart/seriesconverter.hxx
new file mode 100644
index 000000000000..073073c5bbe7
--- /dev/null
+++ b/include/oox/drawingml/chart/seriesconverter.hxx
@@ -0,0 +1,167 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_SERIESCONVERTER_HXX
+#define OOX_DRAWINGML_CHART_SERIESCONVERTER_HXX
+
+#include "oox/drawingml/chart/converterbase.hxx"
+#include "oox/drawingml/chart/seriesmodel.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace chart2 { class XDataSeries; }
+ namespace chart2 { namespace data { class XLabeledDataSequence; } }
+} } }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+class TypeGroupConverter;
+
+// #i66858# enable this when Chart2 supports smoothed lines per data series
+#define OOX_CHART_SMOOTHED_PER_SERIES 0
+
+// ============================================================================
+
+class DataLabelConverter : public ConverterBase< DataLabelModel >
+{
+public:
+ explicit DataLabelConverter( const ConverterRoot& rParent, DataLabelModel& rModel );
+ virtual ~DataLabelConverter();
+
+ /** Converts OOXML data label settings for the passed data point. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& rxDataSeries,
+ const TypeGroupConverter& rTypeGroup );
+
+ /** Conversion helper for data series and data points. */
+ static void convertLabelFormatting(
+ PropertySet& rPropSet,
+ ObjectFormatter& rFormatter,
+ const DataLabelModelBase& rDataLabel,
+ const TypeGroupConverter& rTypeGroup,
+ bool bDataSeriesLabel );
+};
+
+// ============================================================================
+
+class DataLabelsConverter : public ConverterBase< DataLabelsModel >
+{
+public:
+ explicit DataLabelsConverter( const ConverterRoot& rParent, DataLabelsModel& rModel );
+ virtual ~DataLabelsConverter();
+
+ /** Converts OOXML data label settings for the passed data series. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& rxDataSeries,
+ const TypeGroupConverter& rTypeGroup );
+};
+
+// ============================================================================
+
+class ErrorBarConverter : public ConverterBase< ErrorBarModel >
+{
+public:
+ explicit ErrorBarConverter( const ConverterRoot& rParent, ErrorBarModel& rModel );
+ virtual ~ErrorBarConverter();
+
+ /** Converts an OOXML errorbar and inserts it into the passed data series. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& rxDataSeries );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence >
+ createLabeledDataSequence( ErrorBarModel::SourceType eSourceType );
+};
+
+// ============================================================================
+
+class TrendlineLabelConverter : public ConverterBase< TrendlineLabelModel >
+{
+public:
+ explicit TrendlineLabelConverter( const ConverterRoot& rParent, TrendlineLabelModel& rModel );
+ virtual ~TrendlineLabelConverter();
+
+ /** Converts the OOXML trendline label. */
+ void convertFromModel( PropertySet& rPropSet );
+};
+
+// ============================================================================
+
+class TrendlineConverter : public ConverterBase< TrendlineModel >
+{
+public:
+ explicit TrendlineConverter( const ConverterRoot& rParent, TrendlineModel& rModel );
+ virtual ~TrendlineConverter();
+
+ /** Converts an OOXML trendline and inserts it into the passed data series. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& rxDataSeries );
+};
+
+// ============================================================================
+
+class DataPointConverter : public ConverterBase< DataPointModel >
+{
+public:
+ explicit DataPointConverter( const ConverterRoot& rParent, DataPointModel& rModel );
+ virtual ~DataPointConverter();
+
+ /** Converts settings for a data point in the passed series. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& rxDataSeries,
+ const TypeGroupConverter& rTypeGroup,
+ const SeriesModel& rSeries );
+};
+
+// ============================================================================
+
+class SeriesConverter : public ConverterBase< SeriesModel >
+{
+public:
+ explicit SeriesConverter( const ConverterRoot& rParent, SeriesModel& rModel );
+ virtual ~SeriesConverter();
+
+ /** Creates a labeled data sequence object from category data link. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence >
+ createCategorySequence( const OUString& rRole );
+ /** Creates a labeled data sequence object from value data link. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence >
+ createValueSequence( const OUString& rRole );
+ /** Creates a data series object with initialized source links. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >
+ createDataSeries( const TypeGroupConverter& rTypeGroup, bool bVaryColorsByPoint );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence >
+ createLabeledDataSequence(
+ SeriesModel::SourceType eSourceType,
+ const OUString& rRole,
+ bool bUseTextLabel );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/seriesmodel.hxx b/include/oox/drawingml/chart/seriesmodel.hxx
new file mode 100644
index 000000000000..998065f7f8ad
--- /dev/null
+++ b/include/oox/drawingml/chart/seriesmodel.hxx
@@ -0,0 +1,237 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_SERIESMODEL_HXX
+#define OOX_DRAWINGML_CHART_SERIESMODEL_HXX
+
+#include "oox/drawingml/chart/datasourcemodel.hxx"
+#include "oox/drawingml/chart/titlemodel.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct DataLabelModelBase
+{
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< TextBody > TextBodyRef;
+
+ ShapeRef mxShapeProp; /// Data label frame formatting.
+ TextBodyRef mxTextProp; /// Data label text formatting.
+ NumberFormat maNumberFormat; /// Number format for numeric data labels.
+ OptValue< OUString > moaSeparator;/// Separator between label components.
+ OptValue< sal_Int32 > monLabelPos; /// Data label position.
+ OptValue< bool > mobShowBubbleSize; /// True = show size of bubbles in bubble charts.
+ OptValue< bool > mobShowCatName; /// True = show category name of data points.
+ OptValue< bool > mobShowLegendKey; /// True = show legend key of data series.
+ OptValue< bool > mobShowPercent; /// True = show percentual value in pie/doughnut charts.
+ OptValue< bool > mobShowSerName; /// True = show series name.
+ OptValue< bool > mobShowVal; /// True = show data point value.
+ bool mbDeleted; /// True = data label(s) deleted.
+
+ explicit DataLabelModelBase();
+ ~DataLabelModelBase();
+};
+
+// ============================================================================
+
+struct DataLabelModel : public DataLabelModelBase
+{
+ typedef ModelRef< LayoutModel > LayoutRef;
+ typedef ModelRef< TextModel > TextRef;
+
+ LayoutRef mxLayout; /// Layout/position of the data point label frame.
+ TextRef mxText; /// Manual or linked text for this data point label.
+ sal_Int32 mnIndex; /// Data point index for this data label.
+
+ explicit DataLabelModel();
+ ~DataLabelModel();
+};
+
+// ============================================================================
+
+struct DataLabelsModel : public DataLabelModelBase
+{
+ typedef ModelVector< DataLabelModel > DataLabelVector;
+ typedef ModelRef< Shape > ShapeRef;
+
+ DataLabelVector maPointLabels; /// Settings for individual data point labels.
+ ShapeRef mxLeaderLines; /// Formatting of connector lines between data points and labels.
+ bool mbShowLeaderLines; /// True = show connector lines between data points and labels.
+
+ explicit DataLabelsModel();
+ ~DataLabelsModel();
+};
+
+// ============================================================================
+
+struct PictureOptionsModel
+{
+ double mfStackUnit; /// Bitmap stacking unit.
+ sal_Int32 mnPictureFormat; /// Bitmap mode (stretch/tile).
+ bool mbApplyToFront; /// True = draw picture at front/back side of 3D data points.
+ bool mbApplyToSides; /// True = draw picture at left/right side of 3D data points.
+ bool mbApplyToEnd; /// True = draw picture at top/bottom side of 3D data points.
+
+ explicit PictureOptionsModel();
+ ~PictureOptionsModel();
+};
+
+// ============================================================================
+
+struct ErrorBarModel
+{
+ enum SourceType
+ {
+ PLUS, /// Plus error bar values.
+ MINUS /// Minus error bar values.
+ };
+
+ typedef ModelMap< SourceType, DataSourceModel > DataSourceMap;
+ typedef ModelRef< Shape > ShapeRef;
+
+ DataSourceMap maSources; /// Source ranges for manual error bar values.
+ ShapeRef mxShapeProp; /// Error line formatting.
+ double mfValue; /// Fixed value for several error bar types.
+ sal_Int32 mnDirection; /// Direction of the error bars (x/y).
+ sal_Int32 mnTypeId; /// Type of the error bars (plus/minus/both).
+ sal_Int32 mnValueType; /// Type of the values.
+ bool mbNoEndCap; /// True = no end cap at error bar lines.
+
+ explicit ErrorBarModel();
+ ~ErrorBarModel();
+};
+
+// ============================================================================
+
+struct TrendlineLabelModel
+{
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< TextBody > TextBodyRef;
+ typedef ModelRef< LayoutModel > LayoutRef;
+ typedef ModelRef< TextModel > TextRef;
+
+ ShapeRef mxShapeProp; /// Label frame formatting.
+ TextBodyRef mxTextProp; /// Label text formatting.
+ LayoutRef mxLayout; /// Layout/position of the frame.
+ TextRef mxText; /// Text source of the label.
+ NumberFormat maNumberFormat; /// Number format for coefficients.
+
+ explicit TrendlineLabelModel();
+ ~TrendlineLabelModel();
+};
+
+// ============================================================================
+
+struct TrendlineModel
+{
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< TrendlineLabelModel > TrendlineLabelRef;
+
+ ShapeRef mxShapeProp; /// Trendline formatting.
+ TrendlineLabelRef mxLabel; /// Trendline label text object.
+ OUString maName; /// User-defined name of the trendline.
+ OptValue< double > mfBackward; /// Size of trendline before first data point.
+ OptValue< double > mfForward; /// Size of trendline behind last data point.
+ OptValue< double > mfIntercept; /// Crossing point with Y axis.
+ sal_Int32 mnOrder; /// Polynomial order in range [2, 6].
+ sal_Int32 mnPeriod; /// Moving average period in range [2, 255].
+ sal_Int32 mnTypeId; /// Type of the trendline.
+ bool mbDispEquation; /// True = show equation of the trendline.
+ bool mbDispRSquared; /// True = show R-squared of the trendline.
+
+ explicit TrendlineModel();
+ ~TrendlineModel();
+};
+
+// ============================================================================
+
+struct DataPointModel
+{
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< PictureOptionsModel > PictureOptionsRef;
+
+ ShapeRef mxShapeProp; /// Data point formatting.
+ PictureOptionsRef mxPicOptions; /// Fill bitmap settings.
+ ShapeRef mxMarkerProp; /// Data point marker formatting.
+ OptValue< sal_Int32 > monExplosion; /// Pie slice moved from pie center.
+ OptValue< sal_Int32 > monMarkerSize; /// Size of the series line marker (2...72).
+ OptValue< sal_Int32 > monMarkerSymbol; /// Series line marker symbol.
+ OptValue< bool > mobBubble3d; /// True = show bubbles with 3D shade.
+ sal_Int32 mnIndex; /// Unique data point index.
+ bool mbInvertNeg; /// True = invert negative data points (not derived from series!).
+
+ explicit DataPointModel();
+ ~DataPointModel();
+};
+
+// ============================================================================
+
+struct SeriesModel
+{
+ enum SourceType
+ {
+ CATEGORIES, /// Data point categories.
+ VALUES, /// Data point values.
+ POINTS /// Data point size (e.g. bubble size in bubble charts).
+ };
+
+ typedef ModelMap< SourceType, DataSourceModel > DataSourceMap;
+ typedef ModelVector< ErrorBarModel > ErrorBarVector;
+ typedef ModelVector< TrendlineModel > TrendlineVector;
+ typedef ModelVector< DataPointModel > DataPointVector;
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< PictureOptionsModel > PictureOptionsRef;
+ typedef ModelRef< TextModel > TextRef;
+ typedef ModelRef< DataLabelsModel > DataLabelsRef;
+
+ DataSourceMap maSources; /// Series source ranges.
+ ErrorBarVector maErrorBars; /// All error bars of this series.
+ TrendlineVector maTrendlines; /// All trendlines of this series.
+ DataPointVector maPoints; /// Explicit formatted data points.
+ ShapeRef mxShapeProp; /// Series formatting.
+ PictureOptionsRef mxPicOptions; /// Fill bitmap settings.
+ ShapeRef mxMarkerProp; /// Data point marker formatting.
+ TextRef mxText; /// Series title source.
+ DataLabelsRef mxLabels; /// Data point label settings for all points.
+ OptValue< sal_Int32 > monShape; /// 3D bar shape type.
+ sal_Int32 mnExplosion; /// Pie slice moved from pie center.
+ sal_Int32 mnIndex; /// Series index used for automatic formatting.
+ sal_Int32 mnMarkerSize; /// Size of the series line marker (2...72).
+ sal_Int32 mnMarkerSymbol; /// Series line marker symbol.
+ sal_Int32 mnOrder; /// Series order.
+ bool mbBubble3d; /// True = show bubbles with 3D shade.
+ bool mbInvertNeg; /// True = invert negative data points.
+ bool mbSmooth; /// True = smooth series line.
+
+ explicit SeriesModel();
+ ~SeriesModel();
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/titlecontext.hxx b/include/oox/drawingml/chart/titlecontext.hxx
new file mode 100644
index 000000000000..b00a9ed45b6d
--- /dev/null
+++ b/include/oox/drawingml/chart/titlecontext.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_TITLECONTEXT_HXX
+#define OOX_DRAWINGML_CHART_TITLECONTEXT_HXX
+
+#include "oox/drawingml/chart/chartcontextbase.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct TextModel;
+
+/** Handler for a chart text context (c:tx element).
+ */
+class TextContext : public ContextBase< TextModel >
+{
+public:
+ explicit TextContext( ::oox::core::ContextHandler2Helper& rParent, TextModel& rModel );
+ virtual ~TextContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onCharacters( const OUString& rChars );
+};
+
+// ============================================================================
+
+struct TitleModel;
+
+/** Handler for a chart title context (c:title element).
+ */
+class TitleContext : public ContextBase< TitleModel >
+{
+public:
+ explicit TitleContext( ::oox::core::ContextHandler2Helper& rParent, TitleModel& rModel );
+ virtual ~TitleContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct LegendModel;
+
+/** Handler for a chart legend context (c:legend element).
+ */
+class LegendContext : public ContextBase< LegendModel >
+{
+public:
+ explicit LegendContext( ::oox::core::ContextHandler2Helper& rParent, LegendModel& rModel );
+ virtual ~LegendContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/titleconverter.hxx b/include/oox/drawingml/chart/titleconverter.hxx
new file mode 100644
index 000000000000..ad3694568efe
--- /dev/null
+++ b/include/oox/drawingml/chart/titleconverter.hxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_TITLECONVERTER_HXX
+#define OOX_DRAWINGML_CHART_TITLECONVERTER_HXX
+
+#include "oox/drawingml/chart/converterbase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace chart2 { class XDiagram; }
+ namespace chart2 { class XFormattedString; }
+ namespace chart2 { class XTitled; }
+ namespace chart2 { namespace data { class XDataSequence; } }
+} } }
+
+namespace oox { namespace drawingml { struct TextCharacterProperties; } }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct TextModel;
+
+class TextConverter : public ConverterBase< TextModel >
+{
+public:
+ explicit TextConverter( const ConverterRoot& rParent, TextModel& rModel );
+ virtual ~TextConverter();
+
+ /** Creates a data sequence object from the contained text data. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >
+ createDataSequence( const OUString& rRole );
+ /** Creates a sequence of formatted string objects. */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XFormattedString > >
+ createStringSequence(
+ const OUString& rDefaultText,
+ const ModelRef< TextBody >& rxTextProp,
+ ObjectType eObjType );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XFormattedString >
+ appendFormattedString(
+ ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XFormattedString > >& orStringVec,
+ const OUString& rString,
+ bool bAddNewLine ) const;
+};
+
+// ============================================================================
+
+struct TitleModel;
+
+class TitleConverter : public ConverterBase< TitleModel >
+{
+public:
+ explicit TitleConverter( const ConverterRoot& rParent, TitleModel& rModel );
+ virtual ~TitleConverter();
+
+ /** Creates a title text object and attaches it at the passed interface. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTitled >& rxTitled,
+ const OUString& rAutoTitle, ObjectType eObjType,
+ sal_Int32 nMainIdx = -1, sal_Int32 nSubIdx = -1 );
+};
+
+// ============================================================================
+
+struct LegendModel;
+
+class LegendConverter : public ConverterBase< LegendModel >
+{
+public:
+ explicit LegendConverter( const ConverterRoot& rParent, LegendModel& rModel );
+ virtual ~LegendConverter();
+
+ /** Creates a legend object and attaches it at the passed diagram. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& rxDiagram );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/titlemodel.hxx b/include/oox/drawingml/chart/titlemodel.hxx
new file mode 100644
index 000000000000..f365d0b6ec89
--- /dev/null
+++ b/include/oox/drawingml/chart/titlemodel.hxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_TITLEMODEL_HXX
+#define OOX_DRAWINGML_CHART_TITLEMODEL_HXX
+
+#include "oox/drawingml/shape.hxx"
+#include "oox/drawingml/chart/datasourcemodel.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct TextModel
+{
+ typedef ModelRef< DataSequenceModel > DataSequenceRef;
+ typedef ModelRef< TextBody > TextBodyRef;
+
+ DataSequenceRef mxDataSeq; /// The string data or formula link of this text.
+ TextBodyRef mxTextBody; /// Rich-formatted literal text (for title objects only).
+
+ explicit TextModel();
+ ~TextModel();
+};
+
+// ============================================================================
+
+struct TitleModel
+{
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< TextBody > TextBodyRef;
+ typedef ModelRef< LayoutModel > LayoutRef;
+ typedef ModelRef< TextModel > TextRef;
+
+ ShapeRef mxShapeProp; /// Title shape formatting.
+ TextBodyRef mxTextProp; /// Title text formatting.
+ LayoutRef mxLayout; /// Layout/position of the frame.
+ TextRef mxText; /// Text source of the title.
+ bool mbOverlay; /// True = title may overlay other objects.
+
+ explicit TitleModel();
+ ~TitleModel();
+};
+
+// ============================================================================
+
+struct LegendModel
+{
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< TextBody > TextBodyRef;
+ typedef ModelRef< LayoutModel > LayoutRef;
+
+ ShapeRef mxShapeProp; /// Legend shape formatting.
+ TextBodyRef mxTextProp; /// Legend text formatting.
+ LayoutRef mxLayout; /// Layout/position of the legend.
+ sal_Int32 mnPosition; /// Legend position.
+ bool mbOverlay; /// True = legend may overlay other objects.
+
+ explicit LegendModel();
+ ~LegendModel();
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/typegroupcontext.hxx b/include/oox/drawingml/chart/typegroupcontext.hxx
new file mode 100644
index 000000000000..52667817ff0d
--- /dev/null
+++ b/include/oox/drawingml/chart/typegroupcontext.hxx
@@ -0,0 +1,164 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_TYPEGROUPCONTEXT_HXX
+#define OOX_DRAWINGML_CHART_TYPEGROUPCONTEXT_HXX
+
+#include "oox/drawingml/chart/chartcontextbase.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct UpDownBarsModel;
+
+/** Handler for an up/down bars context (c:upDownBars element).
+ */
+class UpDownBarsContext : public ContextBase< UpDownBarsModel >
+{
+public:
+ explicit UpDownBarsContext( ::oox::core::ContextHandler2Helper& rParent, UpDownBarsModel& rModel );
+ virtual ~UpDownBarsContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct TypeGroupModel;
+typedef ContextBase< TypeGroupModel > TypeGroupContextBase;
+
+// ============================================================================
+
+/** Handler for area type group contexts (c:area3DChart, c:areaChart elements).
+ */
+class AreaTypeGroupContext : public TypeGroupContextBase
+{
+public:
+ explicit AreaTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
+ virtual ~AreaTypeGroupContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for bar type group contexts (c:bar3DChart, c:barChart elements).
+ */
+class BarTypeGroupContext : public TypeGroupContextBase
+{
+public:
+ explicit BarTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
+ virtual ~BarTypeGroupContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for bubble type group context (c:bubbleChart element).
+ */
+class BubbleTypeGroupContext : public TypeGroupContextBase
+{
+public:
+ explicit BubbleTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
+ virtual ~BubbleTypeGroupContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for line type group contexts (c:line3DChart, c:lineChart,
+ c:stockChart elements).
+ */
+class LineTypeGroupContext : public TypeGroupContextBase
+{
+public:
+ explicit LineTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
+ virtual ~LineTypeGroupContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for pie type group contexts (c:doughnutChart, c:ofPieChart,
+ c:pie3DChart, c:pieChart elements).
+ */
+class PieTypeGroupContext : public TypeGroupContextBase
+{
+public:
+ explicit PieTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
+ virtual ~PieTypeGroupContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for radar type group context (c:radarChart element).
+ */
+class RadarTypeGroupContext : public TypeGroupContextBase
+{
+public:
+ explicit RadarTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
+ virtual ~RadarTypeGroupContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for scatter type group context (c:scatterChart element).
+ */
+class ScatterTypeGroupContext : public TypeGroupContextBase
+{
+public:
+ explicit ScatterTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
+ virtual ~ScatterTypeGroupContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for surface type group contexts (c:surface3DChart, c:surfaceChart
+ elements).
+ */
+class SurfaceTypeGroupContext : public TypeGroupContextBase
+{
+public:
+ explicit SurfaceTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
+ virtual ~SurfaceTypeGroupContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/typegroupconverter.hxx b/include/oox/drawingml/chart/typegroupconverter.hxx
new file mode 100644
index 000000000000..dfce05065c18
--- /dev/null
+++ b/include/oox/drawingml/chart/typegroupconverter.hxx
@@ -0,0 +1,198 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_TYPEGROUPCONVERTER_HXX
+#define OOX_DRAWINGML_CHART_TYPEGROUPCONVERTER_HXX
+
+#include "oox/drawingml/chart/converterbase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace chart2 { class XChartType; }
+ namespace chart2 { class XCoordinateSystem; }
+ namespace chart2 { class XDataSeries; }
+ namespace chart2 { class XDiagram; }
+ namespace chart2 { namespace data { class XLabeledDataSequence; } }
+} } }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+/** Enumerates different chart types. */
+enum TypeId
+{
+ TYPEID_BAR, /// Vertical bar chart.
+ TYPEID_HORBAR, /// Horizontal bar chart.
+ TYPEID_LINE, /// Line chart.
+ TYPEID_AREA, /// Area chart.
+ TYPEID_STOCK, /// Stock chart.
+ TYPEID_RADARLINE, /// Linear radar chart.
+ TYPEID_RADARAREA, /// Filled radar chart.
+ TYPEID_PIE, /// Pie chart.
+ TYPEID_DOUGHNUT, /// Doughnut (ring) chart.
+ TYPEID_OFPIE, /// Pie-to-pie or pie-to-bar chart.
+ TYPEID_SCATTER, /// Scatter (XY) chart.
+ TYPEID_BUBBLE, /// Bubble chart.
+ TYPEID_SURFACE, /// Surface chart.
+ TYPEID_UNKNOWN /// Default for unknown chart types.
+};
+
+// ----------------------------------------------------------------------------
+
+/** Enumerates different categories of similar chart types. */
+enum TypeCategory
+{
+ TYPECATEGORY_BAR, /// Bar charts (horizontal or vertical).
+ TYPECATEGORY_LINE, /// Line charts (line, area, stock charts).
+ TYPECATEGORY_RADAR, /// Radar charts (linear or filled).
+ TYPECATEGORY_PIE, /// Pie and donut charts.
+ TYPECATEGORY_SCATTER, /// Scatter and bubble charts.
+ TYPECATEGORY_SURFACE /// Surface charts.
+};
+
+// ----------------------------------------------------------------------------
+
+/** Enumerates modes for varying point colors in a series. */
+enum VarPointMode
+{
+ VARPOINTMODE_NONE, /// No varied colors supported.
+ VARPOINTMODE_SINGLE, /// Only supported, if type group contains only one series.
+ VARPOINTMODE_MULTI /// Supported for multiple series in a chart type group.
+};
+
+// ============================================================================
+
+/** Contains info for a chart type related to the OpenOffice.org chart module. */
+struct TypeGroupInfo
+{
+ TypeId meTypeId; /// Unique chart type identifier.
+ TypeCategory meTypeCategory; /// Category this chart type belongs to.
+ const sal_Char* mpcServiceName; /// Service name of the type.
+ VarPointMode meVarPointMode; /// Mode for varying point colors.
+ sal_Int32 mnDefLabelPos; /// Default data label position (API constant).
+ bool mbCombinable2d; /// True = types can be combined in one axes set.
+ bool mbSupports3d; /// True = 3D type allowed, false = only 2D type.
+ bool mbPolarCoordSystem; /// True = polar, false = cartesian.
+ bool mbSeriesIsFrame2d; /// True = 2D type series with area formatting.
+ bool mbSingleSeriesVis; /// True = only first series visible (e.g. pie charts).
+ bool mbCategoryAxis; /// True = X axis contains categories.
+ bool mbSwappedAxesSet; /// True = X axis and Y axis are swapped.
+ bool mbSupportsStacking; /// True = data points can be stacked on each other.
+ bool mbReverseSeries; /// True = insert unstacked series in reverse order.
+ bool mbTicksBetweenCateg; /// True = X axis ticks between categories.
+ bool mbPictureOptions; /// True = bitmaps support options from c:pictureOptions.
+};
+
+// ============================================================================
+
+struct UpDownBarsModel;
+
+class UpDownBarsConverter : public ConverterBase< UpDownBarsModel >
+{
+public:
+ explicit UpDownBarsConverter( const ConverterRoot& rParent, UpDownBarsModel& rModel );
+ virtual ~UpDownBarsConverter();
+
+ /** Converts the OOXML up/down bars. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& rxChartType );
+};
+
+// ============================================================================
+
+struct TypeGroupModel;
+struct View3DModel;
+
+class TypeGroupConverter : public ConverterBase< TypeGroupModel >
+{
+public:
+ explicit TypeGroupConverter( const ConverterRoot& rParent, TypeGroupModel& rModel );
+ virtual ~TypeGroupConverter();
+
+ /** Returns the type info struct that describes this chart type group. */
+ inline const TypeGroupInfo& getTypeInfo() const { return maTypeInfo; }
+
+ /** Returns true, if the series in this chart type group are stacked on each other (no percentage). */
+ bool isStacked() const;
+ /** Returns true, if the series in this chart type group are stacked on each other as percentage. */
+ bool isPercent() const;
+ /** Returns true, if the chart is three-dimensional. */
+ bool is3dChart() const;
+ /** Returns true, if chart type supports wall and floor format in 3D mode. */
+ bool isWall3dChart() const;
+ /** Returns true, if the series in this chart type group are ordered on the Z axis. */
+ bool isDeep3dChart() const;
+
+ /** Returns true, if this chart type supports area formatting for its series. */
+ bool isSeriesFrameFormat() const;
+ /** Returns the object type for a series depending on the chart type. */
+ ObjectType getSeriesObjectType() const;
+
+ /** Returns true, if this chart type has to reverse its series order. */
+ bool isReverseSeries() const;
+ /** Returns series title, if the chart type group contains only one single series. */
+ OUString getSingleSeriesTitle() const;
+
+ /** Creates a coordinate system according to the contained chart type. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem >
+ createCoordinateSystem();
+ /** Creates a labeled data sequence object for axis categories. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence >
+ createCategorySequence();
+
+ /** Converts the OOXML type group model into a chart2 coordinate system. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& rxDiagram,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem >& rxCoordSystem,
+ sal_Int32 nAxesSetIdx, bool bSupportsVaryColorsByPoint );
+
+ /** Sets the passed OOXML marker style at the passed property set. */
+ void convertMarker( PropertySet& rPropSet, sal_Int32 nOoxSymbol, sal_Int32 nOoxSize ) const;
+ /** Sets the passed OOXML line smoothing at the passed property set. */
+ void convertLineSmooth( PropertySet& rPropSet, bool bOoxSmooth ) const;
+ /** Sets the passed OOXML bar 3D geometry at the passed property set. */
+ void convertBarGeometry( PropertySet& rPropSet, sal_Int32 nOoxShape ) const;
+ /** Sets the passed OOXML pie rotation at the passed property set. */
+ void convertPieRotation( PropertySet& rPropSet, sal_Int32 nOoxAngle ) const;
+ /** Sets the passed OOXML pie explosion at the passed property set. */
+ void convertPieExplosion( PropertySet& rPropSet, sal_Int32 nOoxExplosion ) const;
+
+private:
+ /** Inserts the passed series into the chart type. Adds additional properties to the series. */
+ void insertDataSeries(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& rxChartType,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& rxSeries,
+ sal_Int32 nAxesSetIdx );
+
+private:
+ TypeGroupInfo maTypeInfo; /// Extended type info for contained chart type model.
+ bool mb3dChart; /// True = type is a 3D chart type.
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/typegroupmodel.hxx b/include/oox/drawingml/chart/typegroupmodel.hxx
new file mode 100644
index 000000000000..1949a3ee892e
--- /dev/null
+++ b/include/oox/drawingml/chart/typegroupmodel.hxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_TYPEGROUPMODEL_HXX
+#define OOX_DRAWINGML_CHART_TYPEGROUPMODEL_HXX
+
+#include "oox/drawingml/chart/seriesmodel.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct UpDownBarsModel
+{
+ typedef ModelRef< Shape > ShapeRef;
+
+ ShapeRef mxDownBars; /// Formatting of down bars.
+ ShapeRef mxUpBars; /// Formatting of up bars.
+ sal_Int32 mnGapWidth; /// Space between up/down bars.
+
+ explicit UpDownBarsModel();
+ ~UpDownBarsModel();
+};
+
+// ============================================================================
+
+struct TypeGroupModel
+{
+ typedef ModelVector< SeriesModel > SeriesVector;
+ typedef ::std::vector< sal_Int32 > AxisIdVector;
+ typedef ModelRef< DataLabelsModel > DataLabelsRef;
+ typedef ModelRef< UpDownBarsModel > UpDownBarsRef;
+ typedef ModelRef< Shape > ShapeRef;
+
+ SeriesVector maSeries; /// Series attached to this chart type group.
+ AxisIdVector maAxisIds; /// List of axis identifiers used by this chart type.
+ DataLabelsRef mxLabels; /// Data point label settings for all series.
+ UpDownBarsRef mxUpDownBars; /// Up/down bars in stock charts.
+ ShapeRef mxSerLines; /// Connector lines in stacked bar charts.
+ ShapeRef mxDropLines; /// Drop lines connecting data points with X axis.
+ ShapeRef mxHiLowLines; /// High/low lines connecting lowest and highest data points.
+ double mfSplitPos; /// Threshold value in pie-to charts.
+ sal_Int32 mnBarDir; /// Bar direction in bar charts (vertical/horizontal).
+ sal_Int32 mnBubbleScale; /// Relative scaling of bubble size (percent).
+ sal_Int32 mnFirstAngle; /// Rotation angle of first slice in pie charts.
+ sal_Int32 mnGapDepth; /// Space between series in deep 3D charts.
+ sal_Int32 mnGapWidth; /// Space between bars in bar charts, or space in pie-to charts.
+ sal_Int32 mnGrouping; /// Series grouping mode.
+ sal_Int32 mnHoleSize; /// Hole size in doughnut charts.
+ sal_Int32 mnOfPieType; /// Pie-to-pie or pie-to-bar chart.
+ sal_Int32 mnOverlap; /// Bar overlap per category (2D bar charts only).
+ sal_Int32 mnRadarStyle; /// Type of radar chart (lines, markers, filled).
+ sal_Int32 mnScatterStyle; /// Type of scatter chart (lines, markers, smooth).
+ sal_Int32 mnSecondPieSize; /// relative size of second pie/bar in pie-to charts (percent).
+ sal_Int32 mnShape; /// 3D bar shape type.
+ sal_Int32 mnSizeRepresents; /// Bubble size represents area or width.
+ sal_Int32 mnSplitType; /// Split type in pie-to charts.
+ sal_Int32 mnTypeId; /// Chart type identifier.
+ bool mbBubble3d; /// True = show bubbles with 3D shade.
+ bool mbShowMarker; /// True = show point markers in line charts.
+ bool mbShowNegBubbles; /// True = show absolute value of negative bubbles.
+ bool mbSmooth; /// True = smooth lines in line charts.
+ bool mbVaryColors; /// True = different automatic colors for each point.
+ bool mbWireframe; /// True = wireframe surface chart, false = filled surface chart.
+
+ explicit TypeGroupModel( sal_Int32 nTypeId );
+ ~TypeGroupModel();
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/clrscheme.hxx b/include/oox/drawingml/clrscheme.hxx
new file mode 100644
index 000000000000..7c4f0106cb43
--- /dev/null
+++ b/include/oox/drawingml/clrscheme.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CLRSCHEME_HXX
+#define OOX_DRAWINGML_CLRSCHEME_HXX
+
+#include <boost/shared_ptr.hpp>
+#include <map>
+#include <vector>
+#include "oox/drawingml/color.hxx"
+#include "oox/dllapi.h"
+
+namespace oox { namespace drawingml {
+
+class ClrMap
+{
+ std::map < sal_Int32, sal_Int32 > maClrMap;
+
+public:
+
+ sal_Bool getColorMap( sal_Int32& nClrToken );
+ void setColorMap( sal_Int32 nClrToken, sal_Int32 nMappedClrToken );
+};
+
+typedef boost::shared_ptr< ClrMap > ClrMapPtr;
+
+class OOX_DLLPUBLIC ClrScheme
+{
+ std::map < sal_Int32, sal_Int32 > maClrScheme;
+
+public:
+
+ ClrScheme();
+ ~ClrScheme();
+
+ sal_Bool getColor( sal_Int32 nSchemeClrToken, sal_Int32& rColor ) const;
+ void setColor( sal_Int32 nSchemeClrToken, sal_Int32 nColor );
+};
+
+typedef boost::shared_ptr< ClrScheme > ClrSchemePtr;
+
+} }
+
+#endif // OOX_DRAWINGML_CLRSCHEME_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/clrschemecontext.hxx b/include/oox/drawingml/clrschemecontext.hxx
new file mode 100644
index 000000000000..466b852a37cf
--- /dev/null
+++ b/include/oox/drawingml/clrschemecontext.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CLRSCHEMECONTEXT_HXX
+#define OOX_DRAWINGML_CLRSCHEMECONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+#include "oox/drawingml/clrscheme.hxx"
+#include "oox/drawingml/color.hxx"
+#include "oox/drawingml/colorchoicecontext.hxx"
+
+namespace oox { namespace drawingml {
+
+class clrMapContext : public oox::core::ContextHandler
+{
+public:
+ clrMapContext( ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes, ClrMap& rClrMap );
+};
+
+class clrSchemeColorContext : private Color, public ColorContext
+{
+public:
+ clrSchemeColorContext( ::oox::core::ContextHandler& rParent, ClrScheme& rClrScheme, sal_Int32 nColorToken );
+ virtual ~clrSchemeColorContext();
+
+private:
+ ClrScheme& mrClrScheme;
+ sal_Int32 mnColorToken;
+};
+
+class clrSchemeContext : public oox::core::ContextHandler
+{
+public:
+ clrSchemeContext( ::oox::core::ContextHandler& rParent, ClrScheme& rClrScheme );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ ClrScheme& mrClrScheme;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_CLRSCHEMECONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/color.hxx b/include/oox/drawingml/color.hxx
new file mode 100644
index 000000000000..b58f0b8ae5b3
--- /dev/null
+++ b/include/oox/drawingml/color.hxx
@@ -0,0 +1,144 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_COLOR_HXX
+#define OOX_DRAWINGML_COLOR_HXX
+
+#include <vector>
+#include <boost/shared_ptr.hpp>
+#include <sal/types.h>
+#include <rtl/instance.hxx>
+#include <rtl/ustring.hxx>
+#include "oox/helper/helper.hxx"
+#include "oox/dllapi.h"
+
+namespace oox { class GraphicHelper; }
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+class OOX_DLLPUBLIC Color
+{
+public:
+ Color();
+ ~Color();
+
+ /** Returns the RGB value for the passed DrawingML color token, or nDefaultRgb on error. */
+ static sal_Int32 getDmlPresetColor( sal_Int32 nToken, sal_Int32 nDefaultRgb );
+ /** Returns the RGB value for the passed VML color token, or nDefaultRgb on error. */
+ static sal_Int32 getVmlPresetColor( sal_Int32 nToken, sal_Int32 nDefaultRgb );
+
+ /** Sets the color to unused state. */
+ void setUnused();
+ /** Sets an RGB value (hexadecimal RRGGBB) from the a:srgbClr element. */
+ void setSrgbClr( sal_Int32 nRgb );
+ /** Sets the percentual RGB values from the a:scrgbClr element. */
+ void setScrgbClr( sal_Int32 nR, sal_Int32 nG, sal_Int32 nB );
+ /** Sets the HSL values from the a:hslClr element. */
+ void setHslClr( sal_Int32 nHue, sal_Int32 nSat, sal_Int32 nLum );
+ /** Sets a predefined color from the a:prstClr element. */
+ void setPrstClr( sal_Int32 nToken );
+ /** Sets a scheme color from the a:schemeClr element. */
+ void setSchemeClr( sal_Int32 nToken );
+ /** Sets a system color from the a:sysClr element. */
+ void setSysClr( sal_Int32 nToken, sal_Int32 nLastRgb );
+ /** Sets a palette color index. */
+ void setPaletteClr( sal_Int32 nPaletteIdx );
+
+ /** Inserts the passed color transformation. */
+ void addTransformation( sal_Int32 nElement, sal_Int32 nValue = -1 );
+ /** Inserts Chart specific color tint (-1.0...0.0 = shade, 0.0...1.0 = tint). */
+ void addChartTintTransformation( double fTint );
+ /** Inserts Excel specific color tint (-1.0...0.0 = shade, 0.0...1.0 = tint). */
+ void addExcelTintTransformation( double fTint );
+ /** Removes all color transformations. */
+ void clearTransformations();
+ /** Removes transparence from the color. */
+ void clearTransparence();
+
+ /** Overwrites this color with the passed color, if it is used. */
+ inline void assignIfUsed( const Color& rColor ) { if( rColor.isUsed() ) *this = rColor; }
+
+ /** Returns true, if the color is initialized. */
+ bool isUsed() const { return meMode != COLOR_UNUSED; }
+ /** Returns true, if the color is a placeholder color in theme style lists. */
+ bool isPlaceHolder() const { return meMode == COLOR_PH; }
+ /** Returns the final RGB color value.
+ @param nPhClr Actual color for the phClr placeholder color used in theme style lists. */
+ sal_Int32 getColor( const GraphicHelper& rGraphicHelper, sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
+
+ /** Returns true, if the color is transparent. */
+ bool hasTransparency() const;
+ /** Returns the transparency of the color (0 = opaque, 100 = full transparent). */
+ sal_Int16 getTransparency() const;
+
+private:
+ /** Internal helper for getColor(). */
+ void setResolvedRgb( sal_Int32 nRgb ) const;
+
+ /** Converts the color components to RGB values. */
+ void toRgb() const;
+ /** Converts the color components to CRGB values (gamma corrected percentage). */
+ void toCrgb() const;
+ /** Converts the color components to HSL values. */
+ void toHsl() const;
+
+private:
+ enum ColorMode
+ {
+ COLOR_UNUSED, /// Color is not used, or undefined.
+ COLOR_RGB, /// Absolute RGB (r/g/b: 0...255).
+ COLOR_CRGB, /// Relative RGB (r/g/b: 0...100000).
+ COLOR_HSL, /// HSL (hue: 0...21600000, sat/lum: 0...100000).
+ COLOR_SCHEME, /// Color from scheme.
+ COLOR_PALETTE, /// Color from application defined palette.
+ COLOR_SYSTEM, /// Color from system palette.
+ COLOR_PH, /// Placeholder color in theme style lists.
+ COLOR_FINAL /// Finalized RGB color.
+ };
+
+ struct Transformation
+ {
+ sal_Int32 mnToken;
+ sal_Int32 mnValue;
+
+ explicit Transformation( sal_Int32 nToken, sal_Int32 nValue ) : mnToken( nToken ), mnValue( nValue ) {}
+ };
+ typedef ::std::vector< Transformation > TransformVec;
+
+ mutable ColorMode meMode; /// Current color mode.
+ mutable TransformVec maTransforms; /// Color transformations.
+ mutable sal_Int32 mnC1; /// Red, red%, hue, scheme token, palette index, system token, or final RGB.
+ mutable sal_Int32 mnC2; /// Green, green%, saturation, or system default RGB.
+ mutable sal_Int32 mnC3; /// Blue, blue%, or luminance.
+ sal_Int32 mnAlpha; /// Alpha value (color opacity).
+};
+
+typedef boost::shared_ptr< Color > ColorPtr;
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/colorchoicecontext.hxx b/include/oox/drawingml/colorchoicecontext.hxx
new file mode 100644
index 000000000000..aaacfd44d5b7
--- /dev/null
+++ b/include/oox/drawingml/colorchoicecontext.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_COLORCHOICECONTEXT_HXX
+#define OOX_DRAWINGML_COLORCHOICECONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+
+namespace oox {
+namespace drawingml {
+
+class Color;
+
+// ============================================================================
+
+/** Context handler for the different color value elements (a:scrgbClr,
+ a:srgbClr, a:hslClr, a:sysClr, a:schemeClr, a:prstClr). */
+class ColorValueContext : public ::oox::core::ContextHandler
+{
+public:
+ explicit ColorValueContext( ::oox::core::ContextHandler& rParent, Color& rColor );
+
+ virtual void SAL_CALL startFastElement(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ Color& mrColor;
+};
+
+// ============================================================================
+
+/** Context handler for elements that *contain* a color value element
+ (a:scrgbClr, a:srgbClr, a:hslClr, a:sysClr, a:schemeClr, a:prstClr). */
+class ColorContext : public ::oox::core::ContextHandler
+{
+public:
+ explicit ColorContext( ::oox::core::ContextHandler& rParent, Color& rColor );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ Color& mrColor;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/connectorshapecontext.hxx b/include/oox/drawingml/connectorshapecontext.hxx
new file mode 100644
index 000000000000..48a03ae317af
--- /dev/null
+++ b/include/oox/drawingml/connectorshapecontext.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CONNECTORSHAPECONTEXT_HXX
+#define OOX_DRAWINGML_CONNECTORSHAPECONTEXT_HXX
+
+#include "oox/drawingml/shape.hxx"
+#include "oox/drawingml/shapecontext.hxx"
+#include "oox/dllapi.h"
+
+namespace oox { namespace drawingml {
+
+class OOX_DLLPUBLIC ConnectorShapeContext : public ShapeContext
+{
+public:
+ ConnectorShapeContext( ::oox::core::ContextHandler& rParent, ShapePtr pMasterShapePtr, ShapePtr pGroupShapePtr );
+ virtual ~ConnectorShapeContext();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+};
+
+} }
+
+#endif // OOX_DRAWINGML_CONNECTORSHAPECONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/customshapegeometry.hxx b/include/oox/drawingml/customshapegeometry.hxx
new file mode 100644
index 000000000000..3920881f123a
--- /dev/null
+++ b/include/oox/drawingml/customshapegeometry.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CUSTOMSHAPEGEOMETRY_HXX
+#define OOX_DRAWINGML_CUSTOMSHAPEGEOMETRY_HXX
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include "oox/helper/propertymap.hxx"
+#include "oox/core/contexthandler.hxx"
+#include "oox/drawingml/shape.hxx"
+
+namespace oox { namespace drawingml {
+
+
+// ---------------------------------------------------------------------
+// CT_CustomGeometry2D
+class CustomShapeGeometryContext : public ::oox::core::ContextHandler
+{
+public:
+ CustomShapeGeometryContext( ::oox::core::ContextHandler& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes, CustomShapeProperties& rCustomShapeProperties );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ CustomShapeProperties& mrCustomShapeProperties;
+};
+
+// ---------------------------------------------------------------------
+// CT_PresetGeometry2D
+class PresetShapeGeometryContext : public ::oox::core::ContextHandler
+{
+public:
+ PresetShapeGeometryContext( ::oox::core::ContextHandler& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes, CustomShapeProperties& rCustomShapeProperties );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ CustomShapeProperties& mrCustomShapeProperties;
+};
+
+// ---------------------------------------------------------------------
+// CT_PresetTextShape
+class PresetTextShapeContext : public ::oox::core::ContextHandler
+{
+public:
+ PresetTextShapeContext( ::oox::core::ContextHandler& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes, CustomShapeProperties& rCustomShapeProperties );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ CustomShapeProperties& mrCustomShapeProperties;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_CUSTOMSHAPEGEOMETRY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/customshapeproperties.hxx b/include/oox/drawingml/customshapeproperties.hxx
new file mode 100644
index 000000000000..e44f20db95e2
--- /dev/null
+++ b/include/oox/drawingml/customshapeproperties.hxx
@@ -0,0 +1,189 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CUSTOMSHAPEPROPERTIES_HXX
+#define OOX_DRAWINGML_CUSTOMSHAPEPROPERTIES_HXX
+
+#include <boost/shared_ptr.hpp>
+#include <boost/unordered_map.hpp>
+#include <vector>
+#include <map>
+#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeGluePointType.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp>
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/drawing/ProjectionMode.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include "oox/core/xmlfilterbase.hxx"
+#include "oox/drawingml/color.hxx"
+#include "oox/helper/helper.hxx"
+#include "oox/helper/propertymap.hxx"
+#include "oox/token/tokens.hxx"
+
+namespace oox { namespace drawingml {
+
+class CustomShapeProperties;
+
+typedef boost::shared_ptr< CustomShapeProperties > CustomShapePropertiesPtr;
+
+struct CustomShapeGuide
+{
+ OUString maName;
+ OUString maFormula;
+};
+
+struct AdjustHandle
+{
+ sal_Bool polar;
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair
+ pos;
+
+ // depending to the type (polar or not):
+ OptValue< OUString > gdRef1; // gdRefX or gdRefR
+ OptValue< com::sun::star::drawing::EnhancedCustomShapeParameter >
+ min1; // minX or minR
+ OptValue< com::sun::star::drawing::EnhancedCustomShapeParameter >
+ max1; // maxX or maxR
+ OptValue< OUString > gdRef2; // gdRefY or gdRefAng
+ OptValue< com::sun::star::drawing::EnhancedCustomShapeParameter >
+ min2; // minX or minAng
+ OptValue< com::sun::star::drawing::EnhancedCustomShapeParameter >
+ max2; // maxY or maxAng
+
+ AdjustHandle( sal_Bool bPolar ) : polar( bPolar ) {};
+};
+
+struct ConnectionSite
+{
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair
+ pos;
+ com::sun::star::drawing::EnhancedCustomShapeParameter
+ ang;
+};
+
+struct GeomRect
+{
+ com::sun::star::drawing::EnhancedCustomShapeParameter l;
+ com::sun::star::drawing::EnhancedCustomShapeParameter t;
+ com::sun::star::drawing::EnhancedCustomShapeParameter r;
+ com::sun::star::drawing::EnhancedCustomShapeParameter b;
+};
+
+struct Path2D
+{
+ sal_Int64 w;
+ sal_Int64 h;
+ sal_Int32 fill;
+ sal_Bool stroke;
+ sal_Bool extrusionOk;
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeParameterPair > parameter;
+
+ Path2D() : w( 0 ), h( 0 ), fill( XML_norm ), stroke( sal_True ), extrusionOk( sal_True ) {};
+};
+
+
+class CustomShapeProvider {
+protected:
+ struct ParameterPairData {
+ sal_uInt16 nFirstType;
+ sal_uInt16 nSecondType;
+ sal_uInt32 nFirstValue;
+ sal_uInt32 nSecondValue;
+ };
+ static com::sun::star::uno::Any createStringSequence( size_t nStrings, const char **pStrings );
+ static com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment > createSegmentSequence( size_t nElems, const sal_uInt16 *pValues );
+ static com::sun::star::drawing::EnhancedCustomShapeParameterPair createParameterPair( const ParameterPairData *pData );
+ static com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair > createParameterPairSequence( size_t nElems, const ParameterPairData *pData );
+public:
+ virtual ~CustomShapeProvider() {}
+ virtual PropertyMap getProperties() = 0;
+};
+
+class CustomShapeProperties
+{
+public:
+
+ CustomShapeProperties();
+ virtual ~CustomShapeProperties();
+
+ void pushToPropSet( const ::oox::core::FilterBase& rFilterBase,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & xPropSet,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::drawing::XShape > & xShape);
+
+ sal_Int32 getShapePresetType() const { return mnShapePresetType; }
+ OUString getShapePresetTypeName() const;
+ void setShapePresetType( sal_Int32 nShapePresetType ){ mnShapePresetType = nShapePresetType; };
+
+ std::vector< CustomShapeGuide >& getAdjustmentGuideList(){ return maAdjustmentGuideList; };
+ std::vector< CustomShapeGuide >& getGuideList(){ return maGuideList; };
+ std::vector< AdjustHandle >& getAdjustHandleList(){ return maAdjustHandleList; };
+ std::vector< ConnectionSite >& getConnectionSiteList(){ return maConnectionSiteList; };
+ OptValue< GeomRect >& getTextRect(){ return maTextRect; };
+ std::vector< Path2D >& getPath2DList(){ return maPath2DList; };
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >& getSegments(){ return maSegments; };
+ void setMirroredX( sal_Bool bMirroredX ) { mbMirroredX = bMirroredX; };
+ void setMirroredY( sal_Bool bMirroredY ) { mbMirroredY = bMirroredY; };
+ void setTextRotateAngle( sal_Int32 nAngle ) { mnTextRotateAngle = nAngle; };
+
+ static sal_Int32 SetCustomShapeGuideValue( std::vector< CustomShapeGuide >& rGuideList, const CustomShapeGuide& rGuide );
+ static sal_Int32 GetCustomShapeGuideValue( const std::vector< CustomShapeGuide >& rGuideList, const OUString& rFormulaName );
+
+ sal_Int32 getArcNum() { return mnArcNum++; }
+
+private:
+
+ sal_Int32 mnShapePresetType;
+ std::vector< CustomShapeGuide > maAdjustmentGuideList;
+ std::vector< CustomShapeGuide > maGuideList;
+ std::vector< AdjustHandle > maAdjustHandleList;
+ std::vector< ConnectionSite > maConnectionSiteList;
+ OptValue< GeomRect > maTextRect;
+ std::vector< Path2D > maPath2DList;
+
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >
+ maSegments;
+ sal_Bool mbMirroredX;
+ sal_Bool mbMirroredY;
+ sal_Int32 mnTextRotateAngle;
+
+ typedef boost::unordered_map< sal_Int32, CustomShapeProvider * > PresetsMap;
+
+ static PresetsMap maPresetsMap;
+ static void initializePresetsMap();
+ static void initializePresetsMap1();
+ static void initializePresetsMap2();
+ static void initializePresetsMap3();
+ static void initializePresetsMap4();
+ static void initializePresetsMap5();
+ static void initializePresetsMap6();
+
+ sal_Int32 mnArcNum;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_CUSTOMSHAPEPROPERTIES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/diagram/diagram.hxx b/include/oox/drawingml/diagram/diagram.hxx
new file mode 100644
index 000000000000..e37c1a44e42f
--- /dev/null
+++ b/include/oox/drawingml/diagram/diagram.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_DIAGRAM_HXX
+#define OOX_DRAWINGML_DIAGRAM_HXX
+
+#include <rtl/ustring.hxx>
+#include "oox/drawingml/shape.hxx"
+#include "oox/core/xmlfilterbase.hxx"
+
+#include <com/sun/star/xml/dom/XDocument.hpp>
+
+namespace oox { namespace drawingml {
+
+/** load diagram data, and put resulting graphic into shape
+
+ This method loads the diagram data fragments from the given paths,
+ generate and layout the shapes, and push it as children into the
+ referenced shape.
+ */
+void loadDiagram( ShapePtr& pShape,
+ core::XmlFilterBase& rFilter,
+ const OUString& rDataModelPath,
+ const OUString& rLayoutPath,
+ const OUString& rQStylePath,
+ const OUString& rColorStylePath );
+
+void loadDiagram( const ShapePtr& pShape,
+ core::XmlFilterBase& rFilter,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::dom::XDocument>& rXDataModelDom,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::dom::XDocument>& rXLayoutDom,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::dom::XDocument>& rXQStyleDom,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::dom::XDocument>& rXColorStyleDom );
+} }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/drawingmltypes.hxx b/include/oox/drawingml/drawingmltypes.hxx
new file mode 100644
index 000000000000..5df664ee66a4
--- /dev/null
+++ b/include/oox/drawingml/drawingmltypes.hxx
@@ -0,0 +1,200 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TYPES_HXX
+#define OOX_DRAWINGML_TYPES_HXX
+
+#include <boost/shared_ptr.hpp>
+#include <com/sun/star/style/TabAlign.hpp>
+#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
+#include <com/sun/star/geometry/IntegerRectangle2D.hpp>
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/xml/sax/XFastAttributeList.hpp>
+#include "oox/helper/helper.hxx"
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+const sal_Int32 PER_PERCENT = 1000;
+const sal_Int32 MAX_PERCENT = 100 * PER_PERCENT;
+
+const sal_Int32 PER_DEGREE = 60000;
+const sal_Int32 MAX_DEGREE = 360 * PER_DEGREE;
+
+// ============================================================================
+
+struct LineProperties;
+typedef ::boost::shared_ptr< LineProperties > LinePropertiesPtr;
+
+struct FillProperties;
+typedef ::boost::shared_ptr< FillProperties > FillPropertiesPtr;
+
+struct GraphicProperties;
+typedef ::boost::shared_ptr< GraphicProperties > GraphicPropertiesPtr;
+
+struct Shape3DProperties;
+typedef ::boost::shared_ptr< Shape3DProperties > Shape3DPropertiesPtr;
+
+struct TextCharacterProperties;
+typedef ::boost::shared_ptr< TextCharacterProperties > TextCharacterPropertiesPtr;
+
+struct TextBodyProperties;
+typedef ::boost::shared_ptr< TextBodyProperties > TextBodyPropertiesPtr;
+
+struct EffectProperties;
+typedef ::boost::shared_ptr< EffectProperties > EffectPropertiesPtr;
+
+class TextBody;
+typedef ::boost::shared_ptr< TextBody > TextBodyPtr;
+
+class Shape;
+typedef ::boost::shared_ptr< Shape > ShapePtr;
+
+class Theme;
+typedef ::boost::shared_ptr< Theme > ThemePtr;
+
+// ---------------------------------------------------------------------------
+
+namespace table {
+
+class TableProperties;
+typedef ::boost::shared_ptr< TableProperties > TablePropertiesPtr;
+
+} // namespace table
+
+// ============================================================================
+
+/** converts the attributes from an CT_TLPoint into an awt Point with 1/1000% */
+com::sun::star::awt::Point GetPointPercent( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs );
+
+
+/** converts the attributes from an CT_Size2D into an awt Size with 1/100th mm */
+com::sun::star::awt::Size GetSize2D( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes );
+
+/** converts the attributes from a CT_RelativeRect to an IntegerRectangle2D */
+com::sun::star::geometry::IntegerRectangle2D GetRelativeRect( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes );
+
+/** converts EMUs into 1/100th mmm */
+sal_Int32 GetCoordinate( sal_Int32 nValue );
+
+/** converts an emu string into 1/100th mmm */
+sal_Int32 GetCoordinate( const OUString& sValue );
+
+/** converts a ST_Percentage % string into 1/1000th of % */
+sal_Int32 GetPercent( const OUString& sValue );
+
+/** Converts a ST_PositiveFixedPercentage to a float. 1.0 == 100% */
+double GetPositiveFixedPercentage( const OUString& sValue );
+
+/** converts the ST_TextFontSize to point */
+float GetTextSize( const OUString& rValue );
+
+/** converts the ST_TextSpacingPoint to 1/100mm */
+sal_Int32 GetTextSpacingPoint( const OUString& sValue );
+sal_Int32 GetTextSpacingPoint( const sal_Int32 nValue );
+
+/** */
+::com::sun::star::style::TabAlign GetTabAlign( ::sal_Int32 aToken );
+
+float GetFontHeight( sal_Int32 nHeight );
+
+sal_Int16 GetFontUnderline( sal_Int32 nToken );
+
+sal_Int16 GetFontStrikeout( sal_Int32 nToken );
+
+sal_Int16 GetCaseMap( sal_Int32 nToken );
+
+/** converts a paragraph align to a ParaAdjust */
+sal_Int16 GetParaAdjust( sal_Int32 nAlign );
+
+// ============================================================================
+
+// CT_IndexRange
+struct IndexRange {
+ sal_Int32 start;
+ sal_Int32 end;
+};
+
+/** retrieve the content of CT_IndexRange */
+IndexRange GetIndexRange( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes );
+
+// ============================================================================
+
+const sal_Int32 EMU_PER_HMM = 360; /// 360 EMUs per 1/100 mm.
+
+/** Converts the passed 32-bit integer value from 1/100 mm to EMUs. */
+inline sal_Int64 convertHmmToEmu( sal_Int32 nValue )
+{
+ return static_cast< sal_Int64 >( nValue ) * EMU_PER_HMM;
+}
+
+/** Converts the passed 64-bit integer value from EMUs to 1/100 mm. */
+inline sal_Int32 convertEmuToHmm( sal_Int64 nValue )
+{
+ return getLimitedValue< sal_Int32, sal_Int64 >( (nValue + EMU_PER_HMM / 2) / EMU_PER_HMM, SAL_MIN_INT32, SAL_MAX_INT32 );
+}
+
+// ============================================================================
+
+/** A structure for a point with 64-bit interger components. */
+struct EmuPoint
+{
+ sal_Int64 X;
+ sal_Int64 Y;
+
+ inline explicit EmuPoint() : X( 0 ), Y( 0 ) {}
+ inline explicit EmuPoint( sal_Int64 nX, sal_Int64 nY ) : X( nX ), Y( nY ) {}
+};
+
+// ============================================================================
+
+/** A structure for a size with 64-bit interger components. */
+struct EmuSize
+{
+ sal_Int64 Width;
+ sal_Int64 Height;
+
+ inline explicit EmuSize() : Width( 0 ), Height( 0 ) {}
+ inline explicit EmuSize( sal_Int64 nWidth, sal_Int64 nHeight ) : Width( nWidth ), Height( nHeight ) {}
+};
+
+// ============================================================================
+
+/** A structure for a rectangle with 64-bit interger components. */
+struct EmuRectangle : public EmuPoint, public EmuSize
+{
+ inline explicit EmuRectangle() {}
+ inline explicit EmuRectangle( const EmuPoint& rPos, const EmuSize& rSize ) : EmuPoint( rPos ), EmuSize( rSize ) {}
+ inline explicit EmuRectangle( sal_Int64 nX, sal_Int64 nY, sal_Int64 nWidth, sal_Int64 nHeight ) : EmuPoint( nX, nY ), EmuSize( nWidth, nHeight ) {}
+
+ inline void setPos( const EmuPoint& rPos ) { static_cast< EmuPoint& >( *this ) = rPos; }
+ inline void setSize( const EmuSize& rSize ) { static_cast< EmuSize& >( *this ) = rSize; }
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/effectproperties.hxx b/include/oox/drawingml/effectproperties.hxx
new file mode 100644
index 000000000000..55c5ec34a20f
--- /dev/null
+++ b/include/oox/drawingml/effectproperties.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef OOX_DRAWINGML_EFFECTPROPERTIES_HXX
+#define OOX_DRAWINGML_EFFECTPROPERTIES_HXX
+
+#include "oox/drawingml/fillproperties.hxx"
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+struct EffectShadowProperties
+{
+ OptValue< sal_Int64 > moShadowDist;
+ OptValue< sal_Int64 > moShadowDir;
+ OptValue< sal_Int64 > moShadowAlpha;
+ Color moShadowColor;
+
+ /** Overwrites all members that are explicitly set in rSourceProps. */
+ void assignUsed( const EffectShadowProperties& rSourceProps );
+};
+
+// ============================================================================
+
+struct OOX_DLLPUBLIC EffectProperties
+{
+ EffectShadowProperties maShadow;
+
+ /** Overwrites all members that are explicitly set in rSourceProps. */
+ void assignUsed( const EffectProperties& rSourceProps );
+
+ /** Writes the properties to the passed property map. */
+ void pushToPropMap(
+ PropertyMap& rPropMap,
+ const GraphicHelper& rGraphicHelper ) const;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/effectpropertiescontext.hxx b/include/oox/drawingml/effectpropertiescontext.hxx
new file mode 100644
index 000000000000..cd5e2eba28f5
--- /dev/null
+++ b/include/oox/drawingml/effectpropertiescontext.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef OOX_DRAWINGML_EFFECTPROPERTIESCONTEXT_HXX
+#define OOX_DRAWINGML_EFFECTPROPERTIESCONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+#include "oox/dllapi.h"
+
+namespace oox { namespace drawingml {
+
+// ---------------------------------------------------------------------
+
+struct EffectProperties;
+
+class OOX_DLLPUBLIC EffectPropertiesContext : public ::oox::core::ContextHandler
+{
+public:
+ EffectPropertiesContext( ::oox::core::ContextHandler& rParent,
+ EffectProperties& rEffectProperties ) throw();
+ ~EffectPropertiesContext();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ EffectProperties& mrEffectProperties;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_EFFECTPROPERTIESCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/embeddedwavaudiofile.hxx b/include/oox/drawingml/embeddedwavaudiofile.hxx
new file mode 100644
index 000000000000..97cebd54947b
--- /dev/null
+++ b/include/oox/drawingml/embeddedwavaudiofile.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_EMBEDDEDWAVAUDIOFILE_HXX
+#define OOX_DRAWINGML_EMBEDDEDWAVAUDIOFILE_HXX
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/xml/sax/XFastAttributeList.hpp>
+
+#include "oox/core/fragmenthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+ struct EmbeddedWAVAudioFile
+ {
+ EmbeddedWAVAudioFile()
+ : mbBuiltIn(false)
+ {
+ }
+ bool mbBuiltIn;
+ OUString msName;
+ OUString msEmbed;
+ };
+
+ void getEmbeddedWAVAudioFile(
+ const ::oox::core::Relations& rRelations,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs,
+ EmbeddedWAVAudioFile & aAudio );
+
+} }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/fillproperties.hxx b/include/oox/drawingml/fillproperties.hxx
new file mode 100644
index 000000000000..fb9aa849e92e
--- /dev/null
+++ b/include/oox/drawingml/fillproperties.hxx
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_FILLPROPERTIES_HXX
+#define OOX_DRAWINGML_FILLPROPERTIES_HXX
+
+#include <map>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/geometry/IntegerRectangle2D.hpp>
+#include "oox/drawingml/color.hxx"
+#include "oox/helper/helper.hxx"
+#include "oox/drawingml/embeddedwavaudiofile.hxx"
+
+namespace oox {
+ class GraphicHelper;
+ class PropertyMap;
+ class PropertySet;
+}
+
+namespace oox {
+namespace drawingml {
+
+class ShapePropertyMap;
+
+// ============================================================================
+
+struct GradientFillProperties
+{
+ typedef ::std::map< double, Color > GradientStopMap;
+
+ GradientStopMap maGradientStops; /// Gradient stops (colors/transparence).
+ OptValue< ::com::sun::star::geometry::IntegerRectangle2D > moFillToRect;
+ OptValue< ::com::sun::star::geometry::IntegerRectangle2D > moTileRect;
+ OptValue< sal_Int32 > moGradientPath; /// If set, gradient follows rectangle, circle, or shape.
+ OptValue< sal_Int32 > moShadeAngle; /// Rotation angle of linear gradients.
+ OptValue< sal_Int32 > moShadeFlip; /// Flip mode of gradient, if not stretched to shape.
+ OptValue< bool > moShadeScaled; /// True = scale gradient into shape.
+ OptValue< bool > moRotateWithShape; /// True = rotate gradient with shape.
+
+ /** Overwrites all members that are explicitly set in rSourceProps. */
+ void assignUsed( const GradientFillProperties& rSourceProps );
+};
+
+// ============================================================================
+
+struct PatternFillProperties
+{
+ Color maPattFgColor; /// Pattern foreground color.
+ Color maPattBgColor; /// Pattern background color.
+ OptValue< sal_Int32 > moPattPreset; /// Preset pattern type.
+
+ /** Overwrites all members that are explicitly set in rSourceProps. */
+ void assignUsed( const PatternFillProperties& rSourceProps );
+};
+
+// ============================================================================
+
+struct BlipFillProperties
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >
+ mxGraphic; /// The fill graphic.
+ OptValue< sal_Int32 > moBitmapMode; /// Bitmap tile or stretch.
+ OptValue< ::com::sun::star::geometry::IntegerRectangle2D >
+ moFillRect; /// Stretch fill offsets.
+ OptValue< ::com::sun::star::geometry::IntegerRectangle2D >
+ moClipRect;
+ OptValue< sal_Int32 > moTileOffsetX; /// Width of bitmap tiles (EMUs).
+ OptValue< sal_Int32 > moTileOffsetY; /// Height of bitmap tiles (EMUs).
+ OptValue< sal_Int32 > moTileScaleX; /// Horizontal scaling of bitmap tiles (1/1000 percent).
+ OptValue< sal_Int32 > moTileScaleY; /// Vertical scaling of bitmap tiles (1/1000 percent).
+ OptValue< sal_Int32 > moTileAlign; /// Anchor point inside bitmap.
+ OptValue< sal_Int32 > moTileFlip; /// Flip mode of bitmap tiles.
+ OptValue< bool > moRotateWithShape; /// True = rotate bitmap with shape.
+ // effects
+ OptValue< sal_Int32 > moColorEffect; /// XML token for a color effect.
+ OptValue< sal_Int32 > moBrightness; /// Brightness in the range [-100000,100000].
+ OptValue< sal_Int32 > moContrast; /// Contrast in the range [-100000,100000].
+ Color maColorChangeFrom; /// Start color of color transformation.
+ Color maColorChangeTo; /// Destination color of color transformation.
+
+ /** Overwrites all members that are explicitly set in rSourceProps. */
+ void assignUsed( const BlipFillProperties& rSourceProps );
+};
+
+// ============================================================================
+
+struct OOX_DLLPUBLIC FillProperties
+{
+ OptValue< sal_Int32 > moFillType; /// Fill type (OOXML token).
+ Color maFillColor; /// Solid fill color and transparence.
+ GradientFillProperties maGradientProps; /// Properties for gradient fills.
+ PatternFillProperties maPatternProps; /// Properties for pattern fills.
+ BlipFillProperties maBlipProps; /// Properties for bitmap fills.
+
+ /** Overwrites all members that are explicitly set in rSourceProps. */
+ void assignUsed( const FillProperties& rSourceProps );
+
+ /** Tries to resolve current settings to a solid color, e.g. returns the
+ start color of a gradient. */
+ Color getBestSolidColor() const;
+
+ /** Writes the properties to the passed property map. */
+ void pushToPropMap(
+ ShapePropertyMap& rPropMap,
+ const GraphicHelper& rGraphicHelper,
+ sal_Int32 nShapeRotation = 0,
+ sal_Int32 nPhClr = API_RGB_TRANSPARENT,
+ bool bFlipH = false,
+ bool bFlipV = false ) const;
+};
+
+// ============================================================================
+
+struct GraphicProperties
+{
+ BlipFillProperties maBlipProps; /// Properties for the graphic.
+ EmbeddedWAVAudioFile maAudio; /// Audio file details
+
+ /** Overwrites all members that are explicitly set in rSourceProps. */
+ void assignUsed( const GraphicProperties& rSourceProps );
+
+ /** Writes the properties to the passed property map. */
+ void pushToPropMap(
+ PropertyMap& rPropMap,
+ const GraphicHelper& rGraphicHelper,
+ sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/fillpropertiesgroupcontext.hxx b/include/oox/drawingml/fillpropertiesgroupcontext.hxx
new file mode 100644
index 000000000000..81d8a6e0db20
--- /dev/null
+++ b/include/oox/drawingml/fillpropertiesgroupcontext.hxx
@@ -0,0 +1,208 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_FILLPROPERTIESGROUPCONTEXT_HPP
+#define OOX_DRAWINGML_FILLPROPERTIESGROUPCONTEXT_HPP
+
+#include "oox/drawingml/colorchoicecontext.hxx"
+#include "oox/drawingml/fillproperties.hxx"
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+/** Context handler that imports the a:solidFill element. */
+class SolidFillContext : public ColorContext
+{
+public:
+ explicit SolidFillContext(
+ ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
+ FillProperties& rFillProps );
+};
+
+// ============================================================================
+
+/** Context handler that imports the a:gradFill element. */
+class GradientFillContext : public ::oox::core::ContextHandler
+{
+public:
+ explicit GradientFillContext(
+ ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
+ GradientFillProperties& rGradientProps );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+
+private:
+ GradientFillProperties& mrGradientProps;
+};
+
+// ============================================================================
+
+/** Context handler that imports the a:pattFill element. */
+class PatternFillContext : public ::oox::core::ContextHandler
+{
+public:
+ explicit PatternFillContext(
+ ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
+ PatternFillProperties& rPatternProps );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+
+private:
+ PatternFillProperties& mrPatternProps;
+};
+
+// ============================================================================
+// ============================================================================
+
+/** Context handler that imports the a:clrChange element containing the colors
+ of a bitmap color change transformation. */
+class ColorChangeContext : public ::oox::core::ContextHandler
+{
+public:
+ explicit ColorChangeContext(
+ ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
+ BlipFillProperties& rBlipProps );
+ virtual ~ColorChangeContext();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+
+private:
+ BlipFillProperties& mrBlipProps;
+ bool mbUseAlpha;
+};
+
+// ============================================================================
+
+/** Context handler that imports the a:blip element containing the fill bitmap
+ and bitmap color transformation settings. */
+class BlipContext : public ::oox::core::ContextHandler
+{
+public:
+ explicit BlipContext(
+ ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
+ BlipFillProperties& rBlipProps );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+
+private:
+ BlipFillProperties& mrBlipProps;
+};
+
+// ============================================================================
+
+/** Context handler that imports the a:blipFill element. */
+class BlipFillContext : public ::oox::core::ContextHandler
+{
+public:
+ explicit BlipFillContext(
+ ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
+ BlipFillProperties& rBlipProps );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+
+private:
+ BlipFillProperties& mrBlipProps;
+};
+
+// ============================================================================
+// ============================================================================
+
+/** Context handler for elements that contain a fill property element
+ (a:noFill, a:solidFill, a:gradFill, a:pattFill, a:blipFill, a:grpFill). */
+class FillPropertiesContext : public ::oox::core::ContextHandler
+{
+public:
+ explicit FillPropertiesContext(
+ ::oox::core::ContextHandler& rParent,
+ FillProperties& rFillProps );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler >
+ createFillContext(
+ ::oox::core::ContextHandler& rParent,
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
+ FillProperties& rFillProps );
+
+protected:
+ FillProperties& mrFillProps;
+};
+
+// ============================================================================
+
+/** Context handler for elements that contain a fill property element
+ (a:noFill, a:solidFill, a:gradFill, a:pattFill, a:blipFill, a:grpFill).
+
+ This context handler takes a simple color instead of a fill properties
+ struct. The imported fill properties are converted automatically to the
+ best fitting solid color.
+ */
+class SimpleFillPropertiesContext : private FillProperties, public FillPropertiesContext
+{
+public:
+ explicit SimpleFillPropertiesContext(
+ ::oox::core::ContextHandler& rParent,
+ Color& rColor );
+ virtual ~SimpleFillPropertiesContext();
+
+protected:
+ Color& mrColor;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/graphicshapecontext.hxx b/include/oox/drawingml/graphicshapecontext.hxx
new file mode 100644
index 000000000000..c5984d503363
--- /dev/null
+++ b/include/oox/drawingml/graphicshapecontext.hxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_GRAPHICSHAPECONTEXT_HXX
+#define OOX_DRAWINGML_GRAPHICSHAPECONTEXT_HXX
+
+#include "oox/drawingml/shape.hxx"
+#include "oox/drawingml/shapecontext.hxx"
+#include "oox/dllapi.h"
+
+namespace oox { namespace vml { struct OleObjectInfo; } }
+
+namespace oox { namespace drawingml {
+
+class OOX_DLLPUBLIC GraphicShapeContext : public ShapeContext
+{
+public:
+ GraphicShapeContext( ::oox::core::ContextHandler& rParent, ShapePtr pMasterShapePtr, ShapePtr pShapePtr );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+};
+
+// ====================================================================
+
+class OOX_DLLPUBLIC GraphicalObjectFrameContext : public ShapeContext
+{
+public:
+ GraphicalObjectFrameContext( ::oox::core::ContextHandler& rParent, ShapePtr pMasterShapePtr, ShapePtr pShapePtr, bool bEmbedShapesInChart );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ bool mbEmbedShapesInChart;
+};
+
+// ====================================================================
+
+class OleObjectGraphicDataContext : public ShapeContext
+{
+public:
+ OleObjectGraphicDataContext( ::oox::core::ContextHandler& rParent, ShapePtr pShapePtr );
+ ~OleObjectGraphicDataContext();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ ::oox::vml::OleObjectInfo& mrOleObjectInfo;
+};
+
+// ====================================================================
+
+class Diagram;
+
+class DiagramGraphicDataContext
+ : public ShapeContext
+{
+public:
+ DiagramGraphicDataContext( ::oox::core::ContextHandler& rParent, ShapePtr pShapePtr );
+ virtual ~DiagramGraphicDataContext();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ OUString msDm;
+ OUString msLo;
+ OUString msQs;
+ OUString msCs;
+};
+
+// ====================================================================
+
+class ChartGraphicDataContext : public ShapeContext
+{
+public:
+ explicit ChartGraphicDataContext(
+ ::oox::core::ContextHandler& rParent,
+ const ShapePtr& rxShape, bool bEmbedShapes );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ ChartShapeInfo& mrChartShapeInfo;
+};
+
+// ====================================================================
+
+} }
+
+#endif // OOX_DRAWINGML_GRAPHICSHAPECONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/guidcontext.hxx b/include/oox/drawingml/guidcontext.hxx
new file mode 100644
index 000000000000..8a60bf20ab5c
--- /dev/null
+++ b/include/oox/drawingml/guidcontext.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_GUIDCONTEXT_HXX
+#define OOX_DRAWINGML_GUIDCONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+ class GuidContext : public ::oox::core::ContextHandler
+ {
+
+ public:
+ GuidContext( ::oox::core::ContextHandler& rParent, OUString& rGuidId );
+ virtual void SAL_CALL characters( const OUString& aChars ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+ private:
+
+ OUString& mrGuidId;
+ };
+
+} }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/lineproperties.hxx b/include/oox/drawingml/lineproperties.hxx
new file mode 100644
index 000000000000..7ffdc04230a0
--- /dev/null
+++ b/include/oox/drawingml/lineproperties.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_LINEPROPERTIES_HXX
+#define OOX_DRAWINGML_LINEPROPERTIES_HXX
+
+#include "oox/drawingml/fillproperties.hxx"
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+struct LineArrowProperties
+{
+ OptValue< sal_Int32 > moArrowType;
+ OptValue< sal_Int32 > moArrowWidth;
+ OptValue< sal_Int32 > moArrowLength;
+
+ /** Overwrites all members that are explicitly set in rSourceProps. */
+ void assignUsed( const LineArrowProperties& rSourceProps );
+};
+
+// ============================================================================
+
+struct OOX_DLLPUBLIC LineProperties
+{
+ typedef ::std::pair< sal_Int32, sal_Int32 > DashStop;
+ typedef ::std::vector< DashStop > DashStopVector;
+
+ LineArrowProperties maStartArrow; /// Start line arrow style.
+ LineArrowProperties maEndArrow; /// End line arrow style.
+ FillProperties maLineFill; /// Line fill (solid, gradient, ...).
+ DashStopVector maCustomDash; /// User-defined line dash style.
+ OptValue< sal_Int32 > moLineWidth; /// Line width (EMUs).
+ OptValue< sal_Int32 > moPresetDash; /// Preset dash (OOXML token).
+ OptValue< sal_Int32 > moLineCompound; /// Line compound type (OOXML token).
+ OptValue< sal_Int32 > moLineCap; /// Line cap (OOXML token).
+ OptValue< sal_Int32 > moLineJoint; /// Line joint type (OOXML token).
+
+ /** Overwrites all members that are explicitly set in rSourceProps. */
+ void assignUsed( const LineProperties& rSourceProps );
+
+ /** Writes the properties to the passed property map. */
+ void pushToPropMap(
+ ShapePropertyMap& rPropMap,
+ const GraphicHelper& rGraphicHelper,
+ sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/linepropertiescontext.hxx b/include/oox/drawingml/linepropertiescontext.hxx
new file mode 100644
index 000000000000..e0454ddb2250
--- /dev/null
+++ b/include/oox/drawingml/linepropertiescontext.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_LINEPROPERTIESCONTEXT_HXX
+#define OOX_DRAWINGML_LINEPROPERTIESCONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+#include "oox/dllapi.h"
+
+namespace oox { namespace drawingml {
+
+// ---------------------------------------------------------------------
+
+struct LineProperties;
+
+class OOX_DLLPUBLIC LinePropertiesContext : public ::oox::core::ContextHandler
+{
+public:
+ LinePropertiesContext( ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes,
+ LineProperties& rLineProperties ) throw();
+ ~LinePropertiesContext();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ LineProperties& mrLineProperties;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_LINEPROPERTIESCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/objectdefaultcontext.hxx b/include/oox/drawingml/objectdefaultcontext.hxx
new file mode 100644
index 000000000000..b8b1d5b95ede
--- /dev/null
+++ b/include/oox/drawingml/objectdefaultcontext.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_OBJECTDEFAULTCONTEXT_HXX
+#define OOX_DRAWINGML_OBJECTDEFAULTCONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+class Theme;
+
+class objectDefaultContext : public oox::core::ContextHandler
+{
+public:
+ objectDefaultContext( ::oox::core::ContextHandler& rParent, Theme& rTheme );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ Theme& mrTheme;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_OBJECTDEFAULTCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/scene3dcontext.hxx b/include/oox/drawingml/scene3dcontext.hxx
new file mode 100644
index 000000000000..cc3341ddf310
--- /dev/null
+++ b/include/oox/drawingml/scene3dcontext.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_SCENE3DPROPERTIESCONTEXT_HPP
+#define OOX_DRAWINGML_SCENE3DPROPERTIESCONTEXT_HPP
+
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+struct Shape3DProperties;
+
+// ---------------------------------------------------------------------
+
+class Scene3DPropertiesContext : public ::oox::core::ContextHandler
+{
+public:
+ Scene3DPropertiesContext( ::oox::core::ContextHandler& rParent, Shape3DProperties& r3DProperties ) throw();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+
+private:
+ Shape3DProperties& mr3DProperties;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_SCENE3DPROPERTIESCONTEXT_HPP
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
new file mode 100644
index 000000000000..f8a58ec5340b
--- /dev/null
+++ b/include/oox/drawingml/shape.hxx
@@ -0,0 +1,273 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_SHAPE_HXX
+#define OOX_DRAWINGML_SHAPE_HXX
+
+#include "oox/helper/propertymap.hxx"
+#include "oox/drawingml/drawingmltypes.hxx"
+#include "oox/drawingml/customshapeproperties.hxx"
+#include "oox/drawingml/textliststyle.hxx"
+#include "oox/drawingml/shape3dproperties.hxx"
+
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/enable_shared_from_this.hpp>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <vector>
+#include <map>
+#include "oox/dllapi.h"
+
+namespace oox { namespace vml {
+ struct OleObjectInfo;
+} }
+
+namespace oox { namespace drawingml {
+
+class CustomShapeProperties;
+typedef boost::shared_ptr< CustomShapeProperties > CustomShapePropertiesPtr;
+
+typedef ::std::map< OUString, ShapePtr > ShapeIdMap;
+
+struct ShapeStyleRef
+{
+ Color maPhClr;
+ sal_Int32 mnThemedIdx;
+};
+
+typedef ::std::map< sal_Int32, ShapeStyleRef > ShapeStyleRefMap;
+
+// ============================================================================
+
+/** Additional information for a chart embedded in a drawing shape. */
+struct ChartShapeInfo
+{
+ OUString maFragmentPath; ///< Path to related XML stream, e.g. for charts.
+ bool mbEmbedShapes; ///< True = load chart shapes into chart, false = load into parent drawpage.
+
+ inline explicit ChartShapeInfo( bool bEmbedShapes ) : mbEmbedShapes( bEmbedShapes ) {}
+};
+
+// ============================================================================
+
+class OOX_DLLPUBLIC Shape
+ : public boost::enable_shared_from_this< Shape >
+{
+public:
+
+ explicit Shape( const sal_Char* pServiceType = 0 );
+ explicit Shape( const ShapePtr& pSourceShape );
+ virtual ~Shape();
+
+ OUString& getServiceName(){ return msServiceName; }
+ void setServiceName( const sal_Char* pServiceName );
+
+ PropertyMap& getShapeProperties(){ return maShapeProperties; }
+
+ inline LineProperties& getLineProperties() { return *mpLinePropertiesPtr; }
+ inline const LineProperties& getLineProperties() const { return *mpLinePropertiesPtr; }
+
+ inline FillProperties& getFillProperties() { return *mpFillPropertiesPtr; }
+ inline const FillProperties& getFillProperties() const { return *mpFillPropertiesPtr; }
+
+ inline GraphicProperties& getGraphicProperties() { return *mpGraphicPropertiesPtr; }
+ inline const GraphicProperties& getGraphicProperties() const { return *mpGraphicPropertiesPtr; }
+
+ CustomShapePropertiesPtr getCustomShapeProperties(){ return mpCustomShapePropertiesPtr; }
+
+ Shape3DProperties& get3DProperties() { return *mp3DPropertiesPtr; }
+ const Shape3DProperties& get3DProperties() const { return *mp3DPropertiesPtr; }
+
+ table::TablePropertiesPtr getTableProperties();
+
+ inline EffectProperties& getEffectProperties() { return *mpEffectPropertiesPtr; }
+
+ void setChildPosition( com::sun::star::awt::Point nPosition ){ maChPosition = nPosition; }
+ void setChildSize( com::sun::star::awt::Size aSize ){ maChSize = aSize; }
+ void moveAllToPosition( const com::sun::star::awt::Point &rPoint );
+
+ void setPosition( com::sun::star::awt::Point nPosition ){ maPosition = nPosition; }
+ const com::sun::star::awt::Point& getPosition() const { return maPosition; }
+
+ void setSize( com::sun::star::awt::Size aSize ){ maSize = aSize; }
+ const com::sun::star::awt::Size& getSize() const { return maSize; }
+
+ void setRotation( sal_Int32 nRotation ) { mnRotation = nRotation; }
+ void setFlip( sal_Bool bFlipH, sal_Bool bFlipV ) { mbFlipH = bFlipH; mbFlipV = bFlipV; }
+ void addChild( const ShapePtr pChildPtr ) { maChildren.push_back( pChildPtr ); }
+ std::vector< ShapePtr >& getChildren() { return maChildren; }
+
+ void setName( const OUString& rName ) { msName = rName; }
+ OUString getName( ) { return msName; }
+ void setId( const OUString& rId ) { msId = rId; }
+ OUString getId() { return msId; }
+ void setHidden( sal_Bool bHidden ) { mbHidden = bHidden; }
+ sal_Bool getHidden() const { return mbHidden; };
+ void setHiddenMasterShape( sal_Bool bHiddenMasterShape ) { mbHiddenMasterShape = bHiddenMasterShape; }
+ void setSubType( sal_Int32 nSubType ) { mnSubType = nSubType; }
+ sal_Int32 getSubType() const { return mnSubType; }
+ void setSubTypeIndex( sal_Int32 nSubTypeIndex ) { moSubTypeIndex = nSubTypeIndex; }
+ const OptValue< sal_Int32 >& getSubTypeIndex() const { return moSubTypeIndex; }
+
+ // setDefaults has to be called if styles are imported (OfficeXML is not storing properties having the default value)
+ void setDefaults();
+
+ ::oox::vml::OleObjectInfo& setOleObjectType();
+ ChartShapeInfo& setChartType( bool bEmbedShapes );
+ void setDiagramType();
+ void setTableType();
+
+ void setTextBody(const TextBodyPtr & pTextBody);
+ TextBodyPtr getTextBody();
+ void setMasterTextListStyle( const TextListStylePtr& pMasterTextListStyle );
+ TextListStylePtr getMasterTextListStyle() const { return mpMasterTextListStyle; }
+
+ inline ShapeStyleRefMap& getShapeStyleRefs() { return maShapeStyleRefs; }
+ inline const ShapeStyleRefMap& getShapeStyleRefs() const { return maShapeStyleRefs; }
+ const ShapeStyleRef* getShapeStyleRef( sal_Int32 nRefType ) const;
+
+ // addShape is creating and inserting the corresponding XShape.
+ void addShape(
+ ::oox::core::XmlFilterBase& rFilterBase,
+ const Theme* pTheme,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ basegfx::B2DHomMatrix& aTransformation,
+ FillProperties& rShapeOrParentShapeFillProps,
+ const ::com::sun::star::awt::Rectangle* pShapeRect = 0,
+ ShapeIdMap* pShapeMap = 0 );
+
+ void dropChildren() { maChildren.clear(); }
+
+ void addChildren(
+ ::oox::core::XmlFilterBase& rFilterBase,
+ const Theme* pTheme,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ basegfx::B2DHomMatrix& aTransformation,
+ const ::com::sun::star::awt::Rectangle* pShapeRect = 0,
+ ShapeIdMap* pShapeMap = 0 );
+
+ void setXShape( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rXShape )
+ { mxShape = rXShape; };
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > &
+ getXShape() const { return mxShape; }
+
+ virtual void applyShapeReference( const Shape& rReferencedShape, bool bUseText = true );
+ const ::std::vector<OUString>&
+ getExtDrawings() { return maExtDrawings; }
+ void addExtDrawingRelId( const OUString &rRelId ) { maExtDrawings.push_back( rRelId ); }
+
+protected:
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createAndInsert(
+ ::oox::core::XmlFilterBase& rFilterBase,
+ const OUString& rServiceName,
+ const Theme* pTheme,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle* pShapeRect,
+ sal_Bool bClearText,
+ sal_Bool bDoNotInsertEmptyTextBody,
+ basegfx::B2DHomMatrix& aTransformation,
+ FillProperties& rShapeOrParentShapeFillProps
+ );
+
+ void addChildren(
+ ::oox::core::XmlFilterBase& rFilterBase,
+ Shape& rMaster,
+ const Theme* pTheme,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle& rClientRect,
+ ShapeIdMap* pShapeMap,
+ basegfx::B2DHomMatrix& aTransformation );
+
+ virtual OUString finalizeServiceName(
+ ::oox::core::XmlFilterBase& rFilter,
+ const OUString& rServiceName,
+ const ::com::sun::star::awt::Rectangle& rShapeRect );
+
+ virtual void finalizeXShape(
+ ::oox::core::XmlFilterBase& rFilter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes );
+
+ std::vector< ShapePtr > maChildren; // only used for group shapes
+ com::sun::star::awt::Size maChSize; // only used for group shapes
+ com::sun::star::awt::Point maChPosition; // only used for group shapes
+ com::sun::star::awt::Size maAbsoluteSize; // only used for group shapes
+ com::sun::star::awt::Point maAbsolutePosition; // only used for group shapes
+ sal_Bool mbIsChild;
+
+ TextBodyPtr mpTextBody;
+ LinePropertiesPtr mpLinePropertiesPtr;
+ FillPropertiesPtr mpFillPropertiesPtr;
+ GraphicPropertiesPtr mpGraphicPropertiesPtr;
+ CustomShapePropertiesPtr mpCustomShapePropertiesPtr;
+ table::TablePropertiesPtr mpTablePropertiesPtr;
+ Shape3DPropertiesPtr mp3DPropertiesPtr;
+ EffectPropertiesPtr mpEffectPropertiesPtr;
+ PropertyMap maShapeProperties;
+ PropertyMap maDefaultShapeProperties;
+ TextListStylePtr mpMasterTextListStyle;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxShape;
+
+ OUString msServiceName;
+ OUString msName;
+ OUString msId;
+ sal_Int32 mnSubType; // if this type is not zero, then the shape is a placeholder
+ OptValue< sal_Int32 > moSubTypeIndex;
+
+ ShapeStyleRefMap maShapeStyleRefs;
+
+ com::sun::star::awt::Size maSize;
+ com::sun::star::awt::Point maPosition;
+ ::std::vector<OUString> maExtDrawings;
+
+private:
+ enum FrameType
+ {
+ FRAMETYPE_GENERIC, ///< Generic shape, no special type.
+ FRAMETYPE_OLEOBJECT, ///< OLE object embedded in a shape.
+ FRAMETYPE_CHART, ///< Chart embedded in a shape.
+ FRAMETYPE_DIAGRAM, ///< Complex diagram drawing shape.
+ FRAMETYPE_TABLE ///< A table embedded in a shape.
+ };
+
+ typedef ::boost::shared_ptr< ::oox::vml::OleObjectInfo > OleObjectInfoRef;
+ typedef ::boost::shared_ptr< ChartShapeInfo > ChartShapeInfoRef;
+
+ FrameType meFrameType; ///< Type for graphic frame shapes.
+ OleObjectInfoRef mxOleObjectInfo; ///< Additional data for OLE objects.
+ ChartShapeInfoRef mxChartShapeInfo; ///< Additional data for chart shapes.
+
+ sal_Int32 mnRotation;
+ sal_Bool mbFlipH;
+ sal_Bool mbFlipV;
+ sal_Bool mbHidden;
+ sal_Bool mbHiddenMasterShape; // master shapes can be hidden in layout slides
+ // we need separate flag because we don't want
+ // to propagate it when applying reference shape
+};
+
+// ============================================================================
+
+} }
+
+#endif // OOX_DRAWINGML_SHAPE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/shape3dproperties.hxx b/include/oox/drawingml/shape3dproperties.hxx
new file mode 100644
index 000000000000..d1891402757c
--- /dev/null
+++ b/include/oox/drawingml/shape3dproperties.hxx
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_SHAPE3DPROPERTIES_HXX
+#define OOX_DRAWINGML_SHAPE3DPROPERTIES_HXX
+
+#include <map>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/geometry/IntegerRectangle2D.hpp>
+#include "oox/core/xmlfilterbase.hxx"
+#include "oox/drawingml/color.hxx"
+#include "oox/helper/helper.hxx"
+
+namespace oox { class PropertyMap; }
+namespace oox { class PropertySet; }
+namespace oox { namespace core { class ModelObjectContainer; } }
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+struct Shape3DPropertyNames
+{
+ OUString maFillStyle;
+ OUString maFillColor;
+ OUString maFillTransparence;
+ OUString maFillGradient;
+ OUString maFillBitmap;
+ OUString maFillBitmapMode;
+ OUString maFillBitmapTile;
+ OUString maFillBitmapStretch;
+ OUString maFillBitmapLogicalSize;
+ OUString maFillBitmapSizeX;
+ OUString maFillBitmapSizeY;
+ OUString maFillBitmapOffsetX;
+ OUString maFillBitmapOffsetY;
+ OUString maFillBitmapRectanglePoint;
+ bool mbNamedFillGradient;
+ bool mbNamedFillBitmap;
+ bool mbTransformGraphic;
+
+ Shape3DPropertyNames();
+};
+
+// ============================================================================
+
+struct Shape3DProperties
+{
+ typedef ::std::map< double, Color > GradientStopMap;
+
+ OptValue< sal_Int32 > moFillType; /// Fill type (OOXML token).
+ OptValue< bool > moRotateWithShape; /// True = rotate gradient/bitmap with shape.
+ Color maFillColor; /// Solid fill color and transparence.
+ GradientStopMap maGradientStops; /// Gradient stops (colors/transparence).
+ OptValue< sal_Int32 > moGradientPath; /// If set, gradient follows rectangle, circle, or shape.
+ OptValue< sal_Int32 > moShadeAngle; /// Rotation angle of linear gradients.
+ OptValue< bool > moShadeScaled;
+ OptValue< sal_Int32 > moFlipModeToken;
+ OptValue< com::sun::star::geometry::IntegerRectangle2D > moFillToRect;
+ OptValue< com::sun::star::geometry::IntegerRectangle2D > moTileRect;
+ OptValue< sal_Int32 > moPattPreset; /// Preset pattern type.
+ Color maPattFgColor; /// Pattern foreground color.
+ Color maPattBgColor; /// Pattern background color.
+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > mxGraphic;
+ Color maColorChangeFrom; /// Start color of color transformation.
+ Color maColorChangeTo; /// Destination color of color transformation.
+ OptValue< sal_Int32 > moBitmapMode; /// Bitmap tile or stretch.
+ OptValue< sal_Int32 > moTileX; /// Width of bitmap tiles.
+ OptValue< sal_Int32 > moTileY; /// Height of bitmap tiles.
+ OptValue< sal_Int32 > moTileSX;
+ OptValue< sal_Int32 > moTileSY;
+ OptValue< sal_Int32 > moTileAlign; /// Anchor point inside bitmap.
+
+ static Shape3DPropertyNames DEFAULTNAMES; /// Default fill property names for shape fill.
+ static Shape3DPropertyNames DEFAULTPICNAMES; /// Default fill property names for pictures.
+
+ /** Overwrites all members that are explicitly set in rSourceProps. */
+ void assignUsed( const Shape3DProperties& rSourceProps );
+
+ /** Tries to resolve current settings to a solid color, e.g. returns the
+ start color of a gradient. */
+ Color getBestSolidColor() const;
+
+ /** Writes the properties to the passed property map. */
+ void pushToPropMap(
+ PropertyMap& rPropMap,
+ const Shape3DPropertyNames& rPropNames,
+ const ::oox::core::XmlFilterBase& rFilter,
+ ::oox::core::ModelObjectContainer& rObjContainer,
+ sal_Int32 nShapeRotation, sal_Int32 nPhClr ) const;
+
+ /** Writes the properties to the passed property set. */
+ void pushToPropSet(
+ PropertySet& rPropSet,
+ const Shape3DPropertyNames& rPropNames,
+ const ::oox::core::XmlFilterBase& rFilter,
+ ::oox::core::ModelObjectContainer& rObjContainer,
+ sal_Int32 nShapeRotation, sal_Int32 nPhClr ) const;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/shapecontext.hxx b/include/oox/drawingml/shapecontext.hxx
new file mode 100644
index 000000000000..277ee91017ec
--- /dev/null
+++ b/include/oox/drawingml/shapecontext.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_SHAPECONTEXT_HXX
+#define OOX_DRAWINGML_SHAPECONTEXT_HXX
+
+#include <com/sun/star/drawing/XShapes.hpp>
+
+#include "oox/core/contexthandler.hxx"
+#include "oox/drawingml/shape.hxx"
+#include "oox/drawingml/shapepropertiescontext.hxx"
+#include "oox/dllapi.h"
+
+namespace oox { namespace drawingml {
+
+class OOX_DLLPUBLIC ShapeContext : public ::oox::core::ContextHandler
+{
+public:
+ ShapeContext( ::oox::core::ContextHandler& rParent, ShapePtr pMasterShapePtr, ShapePtr pShapePtr );
+ virtual ~ShapeContext();
+
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+ ShapePtr getShape();
+
+protected:
+
+ ShapePtr mpMasterShapePtr;
+ ShapePtr mpShapePtr;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_SHAPEGROUPCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/shapegroupcontext.hxx b/include/oox/drawingml/shapegroupcontext.hxx
new file mode 100644
index 000000000000..65b86ac99567
--- /dev/null
+++ b/include/oox/drawingml/shapegroupcontext.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_SHAPEGROUPCONTEXT_HXX
+#define OOX_DRAWINGML_SHAPEGROUPCONTEXT_HXX
+
+#include "oox/drawingml/shape.hxx"
+#include "oox/drawingml/shapecontext.hxx"
+#include "oox/dllapi.h"
+
+namespace oox { namespace drawingml {
+
+class OOX_DLLPUBLIC ShapeGroupContext : public ::oox::core::ContextHandler
+{
+public:
+ ShapeGroupContext( ::oox::core::ContextHandler& rParent, ShapePtr pMasterShapePtr, ShapePtr pGroupShapePtr );
+ virtual ~ShapeGroupContext();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+
+ ShapePtr mpGroupShapePtr;
+ ShapePtr mpMasterShapePtr;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_SHAPEGROUPCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/shapepropertiescontext.hxx b/include/oox/drawingml/shapepropertiescontext.hxx
new file mode 100644
index 000000000000..31da8a9c0f23
--- /dev/null
+++ b/include/oox/drawingml/shapepropertiescontext.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_SHAPEPROPERTIESCONTEXT_HXX
+#define OOX_DRAWINGML_SHAPEPROPERTIESCONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+#include "oox/drawingml/shape.hxx"
+
+namespace oox { namespace drawingml {
+
+class ShapePropertiesContext : public ::oox::core::ContextHandler
+{
+public:
+ ShapePropertiesContext( ::oox::core::ContextHandler& rParent, Shape& rShape );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ Shape& mrShape;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_SHAPEPROPERTIESCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/shapepropertymap.hxx b/include/oox/drawingml/shapepropertymap.hxx
new file mode 100644
index 000000000000..a5cc12f5484c
--- /dev/null
+++ b/include/oox/drawingml/shapepropertymap.hxx
@@ -0,0 +1,147 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_SHAPEPROPERTYMAP_HXX
+#define OOX_DRAWINGML_SHAPEPROPERTYMAP_HXX
+
+#include "oox/helper/propertymap.hxx"
+#include "oox/dllapi.h"
+
+namespace oox { class ModelObjectHelper; }
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+/** Enumeration for various properties related to drawing shape formatting.
+
+ This is an abstraction for shape formatting properties that have different
+ names in various implementations, e.g. drawing shapes vs. chart objects.
+ */
+enum ShapePropertyId
+{
+ SHAPEPROP_LineStyle,
+ SHAPEPROP_LineWidth,
+ SHAPEPROP_LineColor,
+ SHAPEPROP_LineTransparency,
+ SHAPEPROP_LineDash, /// Explicit line dash or name of a line dash stored in a global container.
+ SHAPEPROP_LineJoint,
+ SHAPEPROP_LineStart, /// Explicit line start marker or name of a line marker stored in a global container.
+ SHAPEPROP_LineStartWidth,
+ SHAPEPROP_LineStartCenter,
+ SHAPEPROP_LineEnd, /// Explicit line end marker or name of a line marker stored in a global container.
+ SHAPEPROP_LineEndWidth,
+ SHAPEPROP_LineEndCenter,
+ SHAPEPROP_FillStyle,
+ SHAPEPROP_FillColor,
+ SHAPEPROP_FillTransparency,
+ SHAPEPROP_GradientTransparency,
+ SHAPEPROP_FillGradient, /// Explicit fill gradient or name of a fill gradient stored in a global container.
+ SHAPEPROP_FillBitmapUrl, /// Explicit fill bitmap URL or name of a fill bitmap URL stored in a global container.
+ SHAPEPROP_FillBitmapMode,
+ SHAPEPROP_FillBitmapSizeX,
+ SHAPEPROP_FillBitmapSizeY,
+ SHAPEPROP_FillBitmapOffsetX,
+ SHAPEPROP_FillBitmapOffsetY,
+ SHAPEPROP_FillBitmapRectanglePoint,
+ SHAPEPROP_ShadowXDistance,
+ SHAPEPROP_END
+};
+
+// ============================================================================
+
+struct OOX_DLLPUBLIC ShapePropertyInfo
+{
+ const sal_Int32* mpnPropertyIds; /// Pointer to array of property identifiers for all SHAPEPROP properties.
+ bool mbNamedLineMarker; /// True = use named line marker instead of explicit line marker.
+ bool mbNamedLineDash; /// True = use named line dash instead of explicit line dash.
+ bool mbNamedFillGradient; /// True = use named fill gradient instead of explicit fill gradient.
+ bool mbNamedFillBitmapUrl; /// True = use named fill bitmap URL instead of explicit fill bitmap URL.
+
+ static ShapePropertyInfo DEFAULT; /// Default property info (used as default parameter of other methods).
+
+ explicit ShapePropertyInfo(
+ const sal_Int32* pnPropertyIds,
+ bool bNamedLineMarker,
+ bool bNamedLineDash,
+ bool bNamedFillGradient,
+ bool bNamedFillBitmapUrl );
+
+ inline bool has( ShapePropertyId ePropId ) const { return mpnPropertyIds[ ePropId ] >= 0; }
+ inline sal_Int32 operator[]( ShapePropertyId ePropId ) const { return mpnPropertyIds[ ePropId ]; }
+};
+
+// ============================================================================
+
+class OOX_DLLPUBLIC ShapePropertyMap : public PropertyMap
+{
+public:
+ explicit ShapePropertyMap(
+ ModelObjectHelper& rModelObjHelper,
+ const ShapePropertyInfo& rShapePropInfo = ShapePropertyInfo::DEFAULT );
+
+ /** Returns true, if the specified property is supported. */
+ bool supportsProperty( ShapePropertyId ePropId ) const;
+
+ /** Returns true, if named line markers are supported, and the specified
+ line marker has already been inserted into the marker table. */
+ bool hasNamedLineMarkerInTable( const OUString& rMarkerName ) const;
+
+ /** Sets the specified shape property to the passed value. */
+ bool setAnyProperty( ShapePropertyId ePropId, const ::com::sun::star::uno::Any& rValue );
+
+ /** Sets the specified shape property to the passed value. */
+ template< typename Type >
+ inline bool setProperty( ShapePropertyId ePropId, const Type& rValue )
+ { return setAnyProperty( ePropId, ::com::sun::star::uno::Any( rValue ) ); }
+
+ using PropertyMap::setAnyProperty;
+ using PropertyMap::setProperty;
+ using PropertyMap::operator[];
+
+private:
+ /** Sets an explicit line marker, or creates a named line marker. */
+ bool setLineMarker( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
+ /** Sets an explicit line dash, or creates a named line dash. */
+ bool setLineDash( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
+ /** Sets an explicit fill gradient, or creates a named fill gradient. */
+ bool setFillGradient( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
+ /** Creates a named transparency gradient. */
+ bool setGradientTrans( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
+ /** Sets an explicit fill bitmap URL, or creates a named fill bitmap URL. */
+ bool setFillBitmapUrl( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
+
+ // not implemented, to prevent implicit conversion from enum to int
+ ::com::sun::star::uno::Any& operator[]( ShapePropertyId ePropId );
+ const ::com::sun::star::uno::Any& operator[]( ShapePropertyId ePropId ) const;
+
+private:
+ ModelObjectHelper& mrModelObjHelper;
+ ShapePropertyInfo maShapePropInfo;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/shapestylecontext.hxx b/include/oox/drawingml/shapestylecontext.hxx
new file mode 100644
index 000000000000..88338a16b59a
--- /dev/null
+++ b/include/oox/drawingml/shapestylecontext.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_SHAPESTYLECONTEXT_HXX
+#define OOX_DRAWINGML_SHAPESTYLECONTEXT_HXX
+
+#include "oox/drawingml/shape.hxx"
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+class ShapeStyleContext : public ::oox::core::ContextHandler
+{
+public:
+ ShapeStyleContext( ::oox::core::ContextHandler& rParent, Shape& rShape );
+ ~ShapeStyleContext();
+
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ Shape& mrShape;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_SHAPESTYLECONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/spdefcontext.hxx b/include/oox/drawingml/spdefcontext.hxx
new file mode 100644
index 000000000000..1fa773fb57dc
--- /dev/null
+++ b/include/oox/drawingml/spdefcontext.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_SPDEFCONTEXT_HXX
+#define OOX_DRAWINGML_SPDEFCONTEXT_HXX
+
+#include "oox/drawingml/shape.hxx"
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+class spDefContext : public oox::core::ContextHandler
+{
+public:
+ spDefContext( ::oox::core::ContextHandler& rParent, Shape& rDefaultObject );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ Shape& mrDefaultObject;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_SPDEFCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablebackgroundstylecontext.hxx b/include/oox/drawingml/table/tablebackgroundstylecontext.hxx
new file mode 100644
index 000000000000..185987df8ad7
--- /dev/null
+++ b/include/oox/drawingml/table/tablebackgroundstylecontext.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef OOX_DRAWINGML_TABLEBACKGROUNDSTYLECONTEXT
+#define OOX_DRAWINGML_TABLEBACKGROUNDSTYLECONTEXT
+
+#include "oox/core/contexthandler.hxx"
+#include "oox/drawingml/table/tablestyle.hxx"
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableBackgroundStyleContext : public ::oox::core::ContextHandler
+{
+public:
+ TableBackgroundStyleContext( ::oox::core::ContextHandler& rParent, TableStyle& rTableStyle );
+ ~TableBackgroundStyleContext();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+
+ TableStyle& mrTableStyle;
+};
+
+} } }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablecell.hxx b/include/oox/drawingml/table/tablecell.hxx
new file mode 100644
index 000000000000..9bb721f8599a
--- /dev/null
+++ b/include/oox/drawingml/table/tablecell.hxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TABLECELL_HXX
+#define OOX_DRAWINGML_TABLECELL_HXX
+
+#include "oox/helper/propertymap.hxx"
+#include "oox/drawingml/color.hxx"
+#include "oox/drawingml/drawingmltypes.hxx"
+#include "oox/drawingml/lineproperties.hxx"
+#include "oox/drawingml/fillproperties.hxx"
+#include "oox/drawingml/textliststyle.hxx"
+#include <com/sun/star/table/XCell.hpp>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/optional.hpp>
+#include <vector>
+#include <map>
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableCellContext;
+class TableProperties;
+class TableStyle;
+
+class TableCell
+{
+ friend class TableCellContext;
+
+public:
+
+ TableCell();
+ ~TableCell();
+
+ sal_Int32 getRowSpan() const { return mnRowSpan; };
+ void setRowSpan( sal_Int32 nRowSpan ){ mnRowSpan = nRowSpan; };
+ sal_Int32 getGridSpan() const { return mnGridSpan; };
+ void setGridSpan( sal_Int32 nGridSpan ){ mnGridSpan = nGridSpan; };
+ sal_Bool gethMerge() const { return mbhMerge; };
+ void sethMerge( sal_Bool bhMerge ){ mbhMerge = bhMerge; };
+ sal_Bool getvMerge() const { return mbvMerge; };
+ void setvMerge( sal_Bool bvMerge ){ mbvMerge = bvMerge; };
+ sal_Int32 getLeftMargin() const { return mnMarL; };
+ void setLeftMargin( sal_Int32 nMargin ){ mnMarL = nMargin; };
+ sal_Int32 getRightMargin() const { return mnMarR; };
+ void setRightMargin( sal_Int32 nMargin ){ mnMarR = nMargin; };
+ sal_Int32 getTopMargin() const { return mnMarT; };
+ void setTopMargin( sal_Int32 nMargin ){ mnMarT = nMargin; };
+ sal_Int32 getBottomMargin() const { return mnMarB; };
+ void setBottomMargin( sal_Int32 nMargin ){ mnMarB = nMargin; };
+ sal_Int32 getVertToken() const { return mnVertToken; };
+ void setVertToken( sal_Int32 nToken ){ mnVertToken = nToken; };
+ sal_Int32 getAnchorToken() const { return mnAnchorToken; };
+ void setAnchorToken( sal_Int32 nToken ){ mnAnchorToken = nToken; };
+ sal_Bool getAnchorCtr() const { return mbAnchorCtr; };
+ void setAnchorCtr( sal_Bool bAnchorCtr ){ mbAnchorCtr = bAnchorCtr; };
+ sal_Int32 getHorzOverflowToken() const { return mnHorzOverflowToken; };
+ void setHorzOverflowToken( sal_Int32 nToken ){ mnHorzOverflowToken = nToken; };
+
+ void setTextBody( const oox::drawingml::TextBodyPtr& pTextBody ){ mpTextBody = pTextBody; };
+ oox::drawingml::TextBodyPtr getTextBody(){ return mpTextBody; };
+
+ void pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oox::drawingml::TextListStylePtr pMasterTextListStyle,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::table::XCell >& rxCell, const TableProperties& rTableProperties,
+ const TableStyle& rTable, sal_Int32 nColumn, sal_Int32 nMaxColumn, sal_Int32 nRow, sal_Int32 nMaxRow );
+
+private:
+
+ oox::drawingml::TextBodyPtr mpTextBody;
+
+ oox::drawingml::LineProperties maLinePropertiesLeft;
+ oox::drawingml::LineProperties maLinePropertiesRight;
+ oox::drawingml::LineProperties maLinePropertiesTop;
+ oox::drawingml::LineProperties maLinePropertiesBottom;
+ oox::drawingml::LineProperties maLinePropertiesTopLeftToBottomRight;
+ oox::drawingml::LineProperties maLinePropertiesBottomLeftToTopRight;
+
+ oox::drawingml::FillProperties maFillProperties;
+
+ sal_Int32 mnRowSpan;
+ sal_Int32 mnGridSpan;
+ sal_Bool mbhMerge;
+ sal_Bool mbvMerge;
+
+ sal_Int32 mnMarL;
+ sal_Int32 mnMarR;
+ sal_Int32 mnMarT;
+ sal_Int32 mnMarB;
+ sal_Int32 mnVertToken;
+ sal_Int32 mnAnchorToken;
+ sal_Bool mbAnchorCtr;
+ sal_Int32 mnHorzOverflowToken;
+};
+
+} } }
+
+#endif // OOX_DRAWINGML_TABLECELL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablecellcontext.hxx b/include/oox/drawingml/table/tablecellcontext.hxx
new file mode 100644
index 000000000000..a2c04bbff9a7
--- /dev/null
+++ b/include/oox/drawingml/table/tablecellcontext.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef OOX_DRAWINGML_TABLECELLCONTEXT
+#define OOX_DRAWINGML_TABLECELLCONTEXT
+
+#include "oox/drawingml/shapecontext.hxx"
+#include "oox/drawingml/table/tablecell.hxx"
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableCellContext : public ::oox::core::ContextHandler
+{
+public:
+ TableCellContext( ::oox::core::ContextHandler& rParent,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XFastAttributeList >& xAttribs, TableCell& rTableCell );
+ ~TableCellContext();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+
+ TableCell& mrTableCell;
+};
+
+} } }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablecontext.hxx b/include/oox/drawingml/table/tablecontext.hxx
new file mode 100644
index 000000000000..175f7f84cb43
--- /dev/null
+++ b/include/oox/drawingml/table/tablecontext.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef OOX_DRAWINGML_TABLECONTEXT
+#define OOX_DRAWINGML_TABLECONTEXT
+
+#include "oox/drawingml/shapecontext.hxx"
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableProperties;
+
+class TableContext : public ShapeContext
+{
+public:
+ TableContext( ::oox::core::ContextHandler& rParent, ShapePtr pShapePtr );
+ ~TableContext();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+
+ TableProperties& mrTableProperties;
+};
+
+} } }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablepartstylecontext.hxx b/include/oox/drawingml/table/tablepartstylecontext.hxx
new file mode 100644
index 000000000000..14b38547d9f4
--- /dev/null
+++ b/include/oox/drawingml/table/tablepartstylecontext.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef OOX_DRAWINGML_TABLEPARTSTYLECONTEXT
+#define OOX_DRAWINGML_TABLEPARTSTYLECONTEXT
+
+#include "oox/core/contexthandler.hxx"
+#include "oox/drawingml/table/tablestylepart.hxx"
+
+namespace oox { namespace drawingml { namespace table {
+
+class TablePartStyleContext : public ::oox::core::ContextHandler
+{
+public:
+ TablePartStyleContext( ::oox::core::ContextHandler& rParent, TableStylePart& rTableStylePart );
+ ~TablePartStyleContext();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+
+ TableStylePart& mrTableStylePart;
+};
+
+} } }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tableproperties.hxx b/include/oox/drawingml/table/tableproperties.hxx
new file mode 100644
index 000000000000..8c584b1f8959
--- /dev/null
+++ b/include/oox/drawingml/table/tableproperties.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TABLEPROPERTIES_HXX
+#define OOX_DRAWINGML_TABLEPROPERTIES_HXX
+
+#include "oox/drawingml/table/tablerow.hxx"
+#include "oox/drawingml/table/tablestyle.hxx"
+#include "oox/helper/propertymap.hxx"
+#include "oox/drawingml/color.hxx"
+
+#include <boost/shared_ptr.hpp>
+#include <boost/optional.hpp>
+#include <vector>
+#include <map>
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableProperties
+{
+public:
+
+ TableProperties();
+ ~TableProperties();
+
+ std::vector< sal_Int32 >& getTableGrid() { return mvTableGrid; };
+ std::vector< TableRow >& getTableRows() { return mvTableRows; };
+
+ OUString& getStyleId(){ return maStyleId; };
+ boost::shared_ptr< TableStyle >& getTableStyle(){ return mpTableStyle; };
+ sal_Bool& isRtl(){ return mbRtl; };
+ sal_Bool& isFirstRow(){ return mbFirstRow; };
+ sal_Bool& isFirstCol(){ return mbFirstCol; };
+ sal_Bool& isLastRow(){ return mbLastRow; };
+ sal_Bool& isLastCol(){ return mbLastCol; };
+ sal_Bool& isBandRow(){ return mbBandRow; };
+ sal_Bool& isBandCol(){ return mbBandCol; };
+
+ void pushToPropSet( const ::oox::core::XmlFilterBase& rFilterBase,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & xPropSet, ::oox::drawingml::TextListStylePtr pMasterTextListStyle );
+
+private:
+
+ const TableStyle& getUsedTableStyle( const ::oox::core::XmlFilterBase& rFilterBase );
+
+ OUString maStyleId; // either StyleId is available
+ boost::shared_ptr< TableStyle > mpTableStyle; // or the complete TableStyle
+ std::vector< sal_Int32 > mvTableGrid;
+ std::vector< TableRow > mvTableRows;
+
+ sal_Bool mbRtl;
+ sal_Bool mbFirstRow;
+ sal_Bool mbFirstCol;
+ sal_Bool mbLastRow;
+ sal_Bool mbLastCol;
+ sal_Bool mbBandRow;
+ sal_Bool mbBandCol;
+};
+
+} } }
+
+#endif // OOX_DRAWINGML_TABLEPROPERTIES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablerow.hxx b/include/oox/drawingml/table/tablerow.hxx
new file mode 100644
index 000000000000..299ffabfd8b1
--- /dev/null
+++ b/include/oox/drawingml/table/tablerow.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TABLEROW_HXX
+#define OOX_DRAWINGML_TABLEROW_HXX
+
+#include "oox/drawingml/table/tablecell.hxx"
+#include <vector>
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableRow
+{
+public:
+
+ TableRow();
+ ~TableRow();
+
+ void setHeight( sal_Int32 nHeight ){ mnHeight = nHeight; };
+ sal_Int32 getHeight() const { return mnHeight; };
+ std::vector< TableCell >& getTableCells() { return mvTableCells; };
+
+private:
+
+ sal_Int32 mnHeight;
+ std::vector< TableCell > mvTableCells;
+};
+
+} } }
+
+#endif // OOX_DRAWINGML_TABLEROW_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablerowcontext.hxx b/include/oox/drawingml/table/tablerowcontext.hxx
new file mode 100644
index 000000000000..58ab0da0cd3a
--- /dev/null
+++ b/include/oox/drawingml/table/tablerowcontext.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef OOX_DRAWINGML_TABLEROWCONTEXT
+#define OOX_DRAWINGML_TABLEROWCONTEXT
+
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableRow;
+
+class TableRowContext : public ::oox::core::ContextHandler
+{
+public:
+ TableRowContext( ::oox::core::ContextHandler& rParent,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XFastAttributeList >& xAttribs, TableRow& rTableRow );
+ ~TableRowContext();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+
+ TableRow& mrTableRow;
+};
+
+} } }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablestyle.hxx b/include/oox/drawingml/table/tablestyle.hxx
new file mode 100644
index 000000000000..b31b5891a32b
--- /dev/null
+++ b/include/oox/drawingml/table/tablestyle.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TABLESTYLE_HXX
+#define OOX_DRAWINGML_TABLESTYLE_HXX
+
+#include "oox/drawingml/table/tablestylepart.hxx"
+#include "oox/drawingml/drawingmltypes.hxx"
+#include "oox/drawingml/shape.hxx"
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableStyle
+{
+public:
+
+ TableStyle();
+ ~TableStyle();
+
+ OUString& getStyleId(){ return maStyleId; }
+ OUString& getStyleName() { return maStyleName; }
+
+ ::oox::drawingml::ShapeStyleRef& getBackgroundFillStyleRef(){ return maFillStyleRef; }
+
+ ::oox::drawingml::FillPropertiesPtr& getBackgroundFillProperties(){ return mpFillProperties; }
+
+ TableStylePart& getWholeTbl() { return maWholeTbl; }
+ TableStylePart& getBand1H() { return maBand1H; }
+ TableStylePart& getBand2H() { return maBand2H; }
+ TableStylePart& getBand1V() { return maBand1V; }
+ TableStylePart& getBand2V() { return maBand2V; }
+ TableStylePart& getLastCol() { return maLastCol; }
+ TableStylePart& getFirstCol() { return maFirstCol; }
+ TableStylePart& getLastRow() { return maLastRow; }
+ TableStylePart& getSeCell() { return maSeCell; }
+ TableStylePart& getSwCell() { return maSwCell; }
+ TableStylePart& getFirstRow() { return maFirstRow; }
+ TableStylePart& getNeCell() { return maNeCell; }
+ TableStylePart& getNwCell() { return maNwCell; }
+
+private:
+
+ OUString maStyleId;
+ OUString maStyleName;
+
+ ::oox::drawingml::ShapeStyleRef maFillStyleRef;
+
+ ::oox::drawingml::FillPropertiesPtr mpFillProperties;
+
+ TableStylePart maWholeTbl;
+ TableStylePart maBand1H;
+ TableStylePart maBand2H;
+ TableStylePart maBand1V;
+ TableStylePart maBand2V;
+ TableStylePart maLastCol;
+ TableStylePart maFirstCol;
+ TableStylePart maLastRow;
+ TableStylePart maSeCell;
+ TableStylePart maSwCell;
+ TableStylePart maFirstRow;
+ TableStylePart maNeCell;
+ TableStylePart maNwCell;
+};
+
+} } }
+
+#endif // OOX_DRAWINGML_TABLESTYLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablestylecellstylecontext.hxx b/include/oox/drawingml/table/tablestylecellstylecontext.hxx
new file mode 100644
index 000000000000..ae0997ab6d88
--- /dev/null
+++ b/include/oox/drawingml/table/tablestylecellstylecontext.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef OOX_DRAWINGML_TABLESTYLECELLSTYLECONTEXT
+#define OOX_DRAWINGML_TABLESTYLECELLSTYLECONTEXT
+
+#include "oox/core/contexthandler.hxx"
+#include "oox/drawingml/table/tablestylepart.hxx"
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableStyleCellStyleContext : public ::oox::core::ContextHandler
+{
+public:
+ TableStyleCellStyleContext( ::oox::core::ContextHandler& rParent, TableStylePart& rTableStylePart );
+ ~TableStyleCellStyleContext();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+
+ TableStylePart& mrTableStylePart;
+ sal_Int32 mnLineType;
+};
+
+} } }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablestylecontext.hxx b/include/oox/drawingml/table/tablestylecontext.hxx
new file mode 100644
index 000000000000..f9600d38365c
--- /dev/null
+++ b/include/oox/drawingml/table/tablestylecontext.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef OOX_DRAWINGML_TABLESTYLECONTEXT
+#define OOX_DRAWINGML_TABLESTYLECONTEXT
+
+#include "oox/core/contexthandler.hxx"
+#include "oox/drawingml/table/tablestyle.hxx"
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableStyleContext : public ::oox::core::ContextHandler
+{
+public:
+ TableStyleContext( ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs,
+ TableStyle& rTableStyle );
+ ~TableStyleContext();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+
+ TableStyle& mrTableStyle;
+};
+
+} } }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablestylelist.hxx b/include/oox/drawingml/table/tablestylelist.hxx
new file mode 100644
index 000000000000..320609d064d9
--- /dev/null
+++ b/include/oox/drawingml/table/tablestylelist.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TABLESTYLELIST_HXX
+#define OOX_DRAWINGML_TABLESTYLELIST_HXX
+
+#include <rtl/ustring.hxx>
+#include <boost/shared_ptr.hpp>
+#include <vector>
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableStyle;
+
+class TableStyleList
+{
+public:
+
+ TableStyleList();
+ ~TableStyleList();
+
+ OUString& getDefaultStyleId() { return maDefaultStyleId; };
+ std::vector< TableStyle >& getTableStyles(){ return maTableStyles; };
+
+private:
+
+ OUString maDefaultStyleId;
+ std::vector< TableStyle > maTableStyles;
+
+};
+
+typedef boost::shared_ptr< TableStyleList > TableStyleListPtr;
+
+} } }
+
+#endif // OOX_DRAWINGML_TABLESTYLELIST_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablestylelistfragmenthandler.hxx b/include/oox/drawingml/table/tablestylelistfragmenthandler.hxx
new file mode 100644
index 000000000000..d6ef77f8614c
--- /dev/null
+++ b/include/oox/drawingml/table/tablestylelistfragmenthandler.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TABLESTYLELISTFRAGMENTHANDLER_HXX
+#define OOX_DRAWINGML_TABLESTYLELISTFRAGMENTHANDLER_HXX
+
+#include "oox/drawingml/table/tablestylelist.hxx"
+#include "oox/core/fragmenthandler2.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace table {
+
+// ============================================================================
+
+class TableStyleListFragmentHandler : public ::oox::core::FragmentHandler2
+{
+public:
+ explicit TableStyleListFragmentHandler(
+ ::oox::core::XmlFilterBase& rFilter,
+ const OUString& rFragmentPath,
+ TableStyleList& rTableStyleList );
+ virtual ~TableStyleListFragmentHandler();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+
+ TableStyleList& mrTableStyleList;
+};
+
+// ============================================================================
+
+} // namespace table
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablestylepart.hxx b/include/oox/drawingml/table/tablestylepart.hxx
new file mode 100644
index 000000000000..abfb21c890d9
--- /dev/null
+++ b/include/oox/drawingml/table/tablestylepart.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TABLESTYLEPART_HXX
+#define OOX_DRAWINGML_TABLESTYLEPART_HXX
+
+#include <rtl/ustring.hxx>
+#include <boost/optional.hpp>
+#include "oox/drawingml/color.hxx"
+#include "oox/drawingml/textfont.hxx"
+#include "oox/drawingml/fillproperties.hxx"
+#include "oox/drawingml/lineproperties.hxx"
+#include "oox/drawingml/shape.hxx"
+#include <map>
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableStylePart
+{
+public:
+
+ TableStylePart();
+ ~TableStylePart();
+
+ ::oox::drawingml::Color& getTextColor(){ return maTextColor; }
+ ::boost::optional< sal_Bool >& getTextBoldStyle(){ return maTextBoldStyle; }
+ ::boost::optional< sal_Bool >& getTextItalicStyle(){ return maTextItalicStyle; }
+ ::oox::drawingml::TextFont& getAsianFont(){ return maAsianFont; }
+ ::oox::drawingml::TextFont& getComplexFont(){ return maComplexFont; }
+ ::oox::drawingml::TextFont& getSymbolFont(){ return maSymbolFont; }
+ ::oox::drawingml::TextFont& getLatinFont(){ return maLatinFont; }
+
+ ::oox::drawingml::FillPropertiesPtr& getFillProperties(){ return mpFillProperties; }
+ std::map < sal_Int32, ::oox::drawingml::LinePropertiesPtr >& getLineBorders(){ return maLineBorders; }
+
+ ::oox::drawingml::ShapeStyleRefMap& getStyleRefs(){ return maStyleRefs; }
+
+private:
+
+ ::oox::drawingml::Color maTextColor;
+ ::boost::optional< sal_Bool > maTextBoldStyle;
+ ::boost::optional< sal_Bool > maTextItalicStyle;
+ ::oox::drawingml::TextFont maAsianFont;
+ ::oox::drawingml::TextFont maComplexFont;
+ ::oox::drawingml::TextFont maSymbolFont;
+ ::oox::drawingml::TextFont maLatinFont;
+
+ ::oox::drawingml::FillPropertiesPtr mpFillProperties;
+ std::map < sal_Int32, ::oox::drawingml::LinePropertiesPtr > maLineBorders;
+ ::oox::drawingml::ShapeStyleRefMap maStyleRefs;
+};
+
+} } }
+
+#endif // OOX_DRAWINGML_TABLESTYLEPART_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablestyletextstylecontext.hxx b/include/oox/drawingml/table/tablestyletextstylecontext.hxx
new file mode 100644
index 000000000000..10714743ad58
--- /dev/null
+++ b/include/oox/drawingml/table/tablestyletextstylecontext.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef OOX_DRAWINGML_TABLESTYLETEXTSTYLECONTEXT
+#define OOX_DRAWINGML_TABLESTYLETEXTSTYLECONTEXT
+
+#include "oox/core/contexthandler.hxx"
+#include "oox/drawingml/table/tablestylepart.hxx"
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableStyleTextStyleContext : public ::oox::core::ContextHandler
+{
+public:
+ TableStyleTextStyleContext( ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs,
+ TableStylePart& rTableStylePart );
+ ~TableStyleTextStyleContext();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+
+ TableStylePart& mrTableStylePart;
+};
+
+} } }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textbody.hxx b/include/oox/drawingml/textbody.hxx
new file mode 100644
index 000000000000..2d77cf277df6
--- /dev/null
+++ b/include/oox/drawingml/textbody.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TEXTBODY_HXX
+#define OOX_DRAWINGML_TEXTBODY_HXX
+
+#include "oox/drawingml/drawingmltypes.hxx"
+#include "oox/drawingml/textbodyproperties.hxx"
+#include "oox/drawingml/textliststyle.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace text { class XText; }
+ namespace text { class XTextCursor; }
+} } }
+
+namespace oox { namespace core { class XmlFilterBase; } }
+
+namespace oox { namespace drawingml {
+
+class TextParagraph;
+typedef RefVector< TextParagraph > TextParagraphVector;
+
+class TextBody
+{
+public:
+ TextBody();
+ TextBody( TextBodyPtr pBody );
+ ~TextBody();
+
+ inline const TextParagraphVector& getParagraphs() const { return maParagraphs; }
+ TextParagraph& addParagraph();
+
+ inline const TextListStyle& getTextListStyle() const { return maTextListStyle; }
+ inline TextListStyle& getTextListStyle() { return maTextListStyle; }
+
+ inline const TextBodyProperties& getTextProperties() const { return maTextProperties; }
+ inline TextBodyProperties& getTextProperties() { return maTextProperties; }
+
+ /** insert the text body at the text cursor */
+ void insertAt(
+ const ::oox::core::XmlFilterBase& rFilterBase,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::text::XText > & xText,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::text::XTextCursor > & xAt,
+ const TextCharacterProperties& rTextStyleProperties,
+ const TextListStylePtr& pMasterTextListStyle ) const;
+ bool isEmpty();
+protected:
+ TextParagraphVector maParagraphs;
+ TextBodyProperties maTextProperties;
+ TextListStyle maTextListStyle;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_TEXTBODY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textbodycontext.hxx b/include/oox/drawingml/textbodycontext.hxx
new file mode 100644
index 000000000000..d46272e853a6
--- /dev/null
+++ b/include/oox/drawingml/textbodycontext.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TEXTBODYCONTEXT_HXX
+#define OOX_DRAWINGML_TEXTBODYCONTEXT_HXX
+
+#include <com/sun/star/text/XText.hpp>
+
+#include "oox/drawingml/textbody.hxx"
+#include "oox/drawingml/textrun.hxx"
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+class TextBodyContext : public ::oox::core::ContextHandler
+{
+public:
+ TextBodyContext( ::oox::core::ContextHandler& rParent, TextBody& rTextBody );
+
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ TextBody& mrTextBody;
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > mxText;
+};
+
+// CT_RegularTextRun
+class RegularTextRunContext : public ::oox::core::ContextHandler
+{
+public:
+ RegularTextRunContext( ::oox::core::ContextHandler& rParent, TextRunPtr pRunPtr );
+
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL characters( const OUString& aChars ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ TextRunPtr mpRunPtr;
+ bool mbIsInText;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_TEXTBODYCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textbodyproperties.hxx b/include/oox/drawingml/textbodyproperties.hxx
new file mode 100644
index 000000000000..f8800be29659
--- /dev/null
+++ b/include/oox/drawingml/textbodyproperties.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TEXTBODYPROPERTIES_HXX
+#define OOX_DRAWINGML_TEXTBODYPROPERTIES_HXX
+
+#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
+#include "oox/helper/helper.hxx"
+#include "oox/helper/propertymap.hxx"
+#include <boost/optional.hpp>
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+struct TextBodyProperties
+{
+ PropertyMap maPropertyMap;
+ OptValue< sal_Int32 > moRotation;
+ OptValue< sal_Int32 > moVert;
+ boost::optional< sal_Int32 > moInsets[4];
+ boost::optional< sal_Int32 > moTextOffX;
+ boost::optional< sal_Int32 > moTextOffY;
+ ::com::sun::star::drawing::TextVerticalAdjust meVA;
+
+ explicit TextBodyProperties();
+
+ void pushRotationAdjustments( sal_Int32 nRotation );
+ void pushVertSimulation();
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textbodypropertiescontext.hxx b/include/oox/drawingml/textbodypropertiescontext.hxx
new file mode 100644
index 000000000000..e907a60b94d8
--- /dev/null
+++ b/include/oox/drawingml/textbodypropertiescontext.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TEXTBODYPROPERTIESCONTEXT_HXX
+#define OOX_DRAWINGML_TEXTBODYPROPERTIESCONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+struct TextBodyProperties;
+
+class TextBodyPropertiesContext : public ::oox::core::ContextHandler
+{
+public:
+ TextBodyPropertiesContext( ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes,
+ TextBodyProperties& rTextBodyProp );
+
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ TextBodyProperties& mrTextBodyProp;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_TEXTBODYPROPERTIESCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textcharacterproperties.hxx b/include/oox/drawingml/textcharacterproperties.hxx
new file mode 100644
index 000000000000..99792fe7725d
--- /dev/null
+++ b/include/oox/drawingml/textcharacterproperties.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TEXTCHARACTERPROPERTIES_HXX
+#define OOX_DRAWINGML_TEXTCHARACTERPROPERTIES_HXX
+
+#include "oox/helper/helper.hxx"
+#include "oox/helper/propertymap.hxx"
+#include "oox/drawingml/color.hxx"
+#include "oox/drawingml/textfont.hxx"
+
+namespace oox { class PropertySet; }
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+struct TextCharacterProperties
+{
+ PropertyMap maHyperlinkPropertyMap;
+ TextFont maLatinFont;
+ TextFont maAsianFont;
+ TextFont maComplexFont;
+ TextFont maSymbolFont;
+ Color maCharColor;
+ Color maUnderlineColor;
+ Color maHighlightColor;
+ OptValue< OUString > moLang;
+ OptValue< sal_Int32 > moHeight;
+ OptValue< sal_Int32 > moSpacing;
+ OptValue< sal_Int32 > moUnderline;
+ OptValue< sal_Int32 > moStrikeout;
+ OptValue< sal_Int32 > moCaseMap;
+ OptValue< bool > moBold;
+ OptValue< bool > moItalic;
+ OptValue< bool > moUnderlineLineFollowText;
+ OptValue< bool > moUnderlineFillFollowText;
+
+ /** Overwrites all members that are explicitly set in rSourceProps. */
+ void assignUsed( const TextCharacterProperties& rSourceProps );
+
+ /** Returns the current character size. If possible the masterstyle should
+ have been applied before, otherwise the character size can be zero and
+ the default value is returned. */
+ float getCharHeightPoints( float fDefault ) const;
+
+ /** Writes the properties to the passed property map. */
+ void pushToPropMap(
+ PropertyMap& rPropMap,
+ const ::oox::core::XmlFilterBase& rFilter,
+ bool bUseOptional = false ) const;
+
+ /** Writes the properties to the passed property set. */
+ void pushToPropSet(
+ PropertySet& rPropSet,
+ const ::oox::core::XmlFilterBase& rFilter,
+ bool bUseOptional = false ) const;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textcharacterpropertiescontext.hxx b/include/oox/drawingml/textcharacterpropertiescontext.hxx
new file mode 100644
index 000000000000..f31e86b27ca4
--- /dev/null
+++ b/include/oox/drawingml/textcharacterpropertiescontext.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TEXTCHARACTERPROPERTIESCONTEXT_HXX
+#define OOX_DRAWINGML_TEXTCHARACTERPROPERTIESCONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+struct TextCharacterProperties;
+
+class TextCharacterPropertiesContext : public ::oox::core::ContextHandler
+{
+public:
+ TextCharacterPropertiesContext( ::oox::core::ContextHandler& rParent,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XFastAttributeList >& rXAttributes,
+ TextCharacterProperties& rTextCharacterProperties );
+ virtual ~TextCharacterPropertiesContext();
+
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ TextCharacterProperties& mrTextCharacterProperties;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_TEXTCHARACTERPROPERTIESCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textfield.hxx b/include/oox/drawingml/textfield.hxx
new file mode 100644
index 000000000000..df98b0302560
--- /dev/null
+++ b/include/oox/drawingml/textfield.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TEXTFIELD_HXX
+#define OOX_DRAWINGML_TEXTFIELD_HXX
+
+#include <boost/shared_ptr.hpp>
+
+#include "oox/drawingml/textrun.hxx"
+#include "oox/drawingml/textparagraphproperties.hxx"
+
+namespace oox { namespace drawingml {
+
+struct TextCharacterProperties;
+
+class TextField
+ : public TextRun
+{
+public:
+ TextField();
+
+ inline TextParagraphProperties& getTextParagraphProperties() { return maTextParagraphProperties; }
+ inline const TextParagraphProperties& getTextParagraphProperties() const { return maTextParagraphProperties; }
+
+ inline void setType( const OUString& sType ) { msType = sType; }
+ inline void setUuid( const OUString & sUuid ) { msUuid = sUuid; }
+
+ virtual sal_Int32 insertAt(
+ const ::oox::core::XmlFilterBase& rFilterBase,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::text::XText > & xText,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::text::XTextCursor > &xAt,
+ const TextCharacterProperties& rTextCharacterStyle ) const;
+
+private:
+ TextParagraphProperties maTextParagraphProperties;
+ OUString msType;
+ OUString msUuid;
+};
+
+typedef boost::shared_ptr< TextField > TextFieldPtr;
+
+} }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textfieldcontext.hxx b/include/oox/drawingml/textfieldcontext.hxx
new file mode 100644
index 000000000000..3a50ea93620f
--- /dev/null
+++ b/include/oox/drawingml/textfieldcontext.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TEXTFIELDCONTEXT_HXX
+#define OOX_DRAWINGML_TEXTFIELDCONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+class TextField;
+
+class TextFieldContext
+ : public ::oox::core::ContextHandler
+{
+public:
+ TextFieldContext( ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rXAttributes,
+ TextField& rTextField);
+ virtual void SAL_CALL endFastElement( sal_Int32 aElementToken ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL characters( const OUString& aChars ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
+ sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rXAttributes )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ TextField& mrTextField;
+ bool mbIsInText;
+};
+
+} }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textfont.hxx b/include/oox/drawingml/textfont.hxx
new file mode 100644
index 000000000000..95a7a1716a0d
--- /dev/null
+++ b/include/oox/drawingml/textfont.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGNML_TEXTFONT_HXX
+#define OOX_DRAWINGNML_TEXTFONT_HXX
+
+#include <rtl/ustring.hxx>
+
+namespace oox { class AttributeList; }
+namespace oox { namespace core { class XmlFilterBase; } }
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+/** carries a CT_TextFont*/
+class TextFont
+{
+public:
+ explicit TextFont();
+
+ /** Sets attributes from the passed attribute list. */
+ void setAttributes( const AttributeList& rAttribs );
+
+ /** Overwrites this text font with the passed text font, if it is used. */
+ void assignIfUsed( const TextFont& rTextFont );
+
+ /** Returns the font name, pitch, and family; tries to resolve theme
+ placeholder names, e.g. '+mj-lt' for the major latin theme font. */
+ bool getFontData(
+ OUString& rFontName,
+ sal_Int16& rnFontPitch,
+ sal_Int16& rnFontFamily,
+ const ::oox::core::XmlFilterBase& rFilter ) const;
+
+private:
+ bool implGetFontData(
+ OUString& rFontName,
+ sal_Int16& rnFontPitch,
+ sal_Int16& rnFontFamily ) const;
+
+private:
+ OUString maTypeface;
+ OUString maPanose;
+ sal_Int32 mnPitch;
+ sal_Int32 mnCharset;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textliststyle.hxx b/include/oox/drawingml/textliststyle.hxx
new file mode 100644
index 000000000000..851c506af17e
--- /dev/null
+++ b/include/oox/drawingml/textliststyle.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TEXTLISTSTYLE_HXX
+#define OOX_DRAWINGML_TEXTLISTSTYLE_HXX
+
+#include "oox/drawingml/textparagraphproperties.hxx"
+#include "oox/helper/refvector.hxx"
+
+namespace oox { namespace drawingml {
+
+typedef RefVector< TextParagraphProperties > TextParagraphPropertiesVector;
+
+class TextListStyle
+{
+public:
+
+ TextListStyle();
+ ~TextListStyle();
+
+ void apply( const TextListStyle& rTextListStyle );
+
+ inline const TextParagraphPropertiesVector& getListStyle() const { return maListStyle; };
+ inline TextParagraphPropertiesVector& getListStyle() { return maListStyle; };
+
+ inline const TextParagraphPropertiesVector& getAggregationListStyle() const { return maAggregationListStyle; };
+ inline TextParagraphPropertiesVector& getAggregationListStyle() { return maAggregationListStyle; };
+
+#if defined(DBG_UTIL) && OSL_DEBUG_LEVEL > 1
+ void dump() const;
+#endif
+
+protected:
+
+ TextParagraphPropertiesVector maListStyle;
+ TextParagraphPropertiesVector maAggregationListStyle;
+};
+
+typedef boost::shared_ptr< TextListStyle > TextListStylePtr;
+
+} }
+
+#endif // OOX_DRAWINGML_TEXTLISTSTYLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textliststylecontext.hxx b/include/oox/drawingml/textliststylecontext.hxx
new file mode 100644
index 000000000000..2d480c709be5
--- /dev/null
+++ b/include/oox/drawingml/textliststylecontext.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TEXTLISTSTYLECONTEXT_HXX
+#define OOX_DRAWINGML_TEXTLISTSTYLECONTEXT_HXX
+
+#include "oox/drawingml/textliststyle.hxx"
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+class TextListStyleContext : public ::oox::core::ContextHandler
+{
+public:
+ TextListStyleContext( ::oox::core::ContextHandler& rParent, TextListStyle& rTextListStyle );
+ ~TextListStyleContext();
+
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ TextListStyle& mrTextListStyle;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_TEXTLISTSTYLECONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textparagraph.hxx b/include/oox/drawingml/textparagraph.hxx
new file mode 100644
index 000000000000..37c53268b001
--- /dev/null
+++ b/include/oox/drawingml/textparagraph.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TEXTPARAGRAPH_HXX
+#define OOX_DRAWINGML_TEXTPARAGRAPH_HXX
+
+#include <com/sun/star/text/XTextCursor.hpp>
+#include <com/sun/star/text/XText.hpp>
+
+#include "oox/core/xmlfilterbase.hxx"
+#include "oox/drawingml/textrun.hxx"
+#include "oox/drawingml/textliststyle.hxx"
+#include "oox/drawingml/textparagraphproperties.hxx"
+
+namespace oox { namespace drawingml {
+
+typedef RefVector< TextRun > TextRunVector;
+
+class TextParagraph
+{
+public:
+ TextParagraph();
+ ~TextParagraph();
+
+ inline TextRunVector& getRuns() { return maRuns; }
+ inline const TextRunVector& getRuns() const { return maRuns; }
+ inline void addRun( const TextRunPtr & pRun ) { maRuns.push_back( pRun ); }
+
+ inline TextParagraphProperties& getProperties() { return maProperties; }
+ inline const TextParagraphProperties& getProperties() const { return maProperties; }
+
+ inline TextCharacterProperties& getEndProperties() { return maEndProperties; }
+ inline const TextCharacterProperties& getEndProperties() const { return maEndProperties; }
+
+ //inline void setProperties( TextParagraphPropertiesPtr pProps ) { mpProperties = pProps; }
+
+ void insertAt(
+ const ::oox::core::XmlFilterBase& rFilterBase,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::text::XText > & xText,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::text::XTextCursor > &xAt,
+ const TextCharacterProperties& rTextStyleProperties,
+ const TextListStyle& rTextListStyle,
+ bool bFirst = false ) const;
+
+private:
+ TextParagraphProperties maProperties;
+ TextCharacterProperties maEndProperties;
+ TextRunVector maRuns;
+};
+
+typedef boost::shared_ptr< TextParagraph > TextParagraphPtr;
+
+} }
+
+#endif // OOX_DRAWINGML_TEXTPARAGRAPH_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textparagraphproperties.hxx b/include/oox/drawingml/textparagraphproperties.hxx
new file mode 100644
index 000000000000..1cb8215a3fc1
--- /dev/null
+++ b/include/oox/drawingml/textparagraphproperties.hxx
@@ -0,0 +1,128 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIES_HXX
+#define OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIES_HXX
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include "oox/drawingml/fillpropertiesgroupcontext.hxx"
+#include "oox/drawingml/textcharacterproperties.hxx"
+#include <com/sun/star/style/NumberingType.hpp>
+#include "oox/drawingml/textfont.hxx"
+#include "textspacing.hxx"
+#include <boost/optional.hpp>
+
+namespace com { namespace sun { namespace star {
+ namespace graphic { class XGraphic; }
+} } }
+
+namespace oox { namespace drawingml {
+
+class TextParagraphProperties;
+
+typedef boost::shared_ptr< TextParagraphProperties > TextParagraphPropertiesPtr;
+
+class BulletList
+{
+public:
+ BulletList( );
+ bool is() const;
+ void apply( const BulletList& );
+ void pushToPropMap( const ::oox::core::XmlFilterBase* pFilterBase, PropertyMap& xPropMap ) const;
+ void setBulletChar( const OUString & sChar );
+ void setStartAt( sal_Int32 nStartAt ){ mnStartAt <<= static_cast< sal_Int16 >( nStartAt ); }
+ void setType( sal_Int32 nType );
+ void setNone( );
+ void setSuffixParenBoth();
+ void setSuffixParenRight();
+ void setSuffixPeriod();
+ void setSuffixNone();
+ void setSuffixMinusRight();
+ void setBulletSize(sal_Int16 nSize);
+ void setFontSize(sal_Int16 nSize);
+ void setStyleName( const OUString& rStyleName ) { maStyleName <<= rStyleName; }
+ void setGraphic( ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& rXGraphic );
+
+ ::oox::drawingml::ColorPtr maBulletColorPtr;
+ ::com::sun::star::uno::Any mbBulletColorFollowText;
+ ::com::sun::star::uno::Any mbBulletFontFollowText;
+ ::oox::drawingml::TextFont maBulletFont;
+ ::com::sun::star::uno::Any msBulletChar;
+ ::com::sun::star::uno::Any mnStartAt;
+ ::com::sun::star::uno::Any mnNumberingType;
+ ::com::sun::star::uno::Any msNumberingPrefix;
+ ::com::sun::star::uno::Any msNumberingSuffix;
+ ::com::sun::star::uno::Any mnSize;
+ ::com::sun::star::uno::Any mnFontSize;
+ ::com::sun::star::uno::Any maStyleName;
+ ::com::sun::star::uno::Any maGraphic;
+ boost::optional< float > maFollowFontSize;
+};
+
+class TextParagraphProperties
+{
+public:
+
+ TextParagraphProperties();
+ ~TextParagraphProperties();
+
+ void setLevel( sal_Int16 nLevel ) { mnLevel = nLevel; }
+ sal_Int16 getLevel( ) const { return mnLevel; }
+ PropertyMap& getTextParagraphPropertyMap() { return maTextParagraphPropertyMap; }
+ BulletList& getBulletList() { return maBulletList; }
+ TextCharacterProperties& getTextCharacterProperties() { return maTextCharacterProperties; }
+ const TextCharacterProperties& getTextCharacterProperties() const { return maTextCharacterProperties; }
+
+ TextSpacing& getParaTopMargin() { return maParaTopMargin; }
+ TextSpacing& getParaBottomMargin() { return maParaBottomMargin; }
+ boost::optional< sal_Int32 >& getParaLeftMargin(){ return moParaLeftMargin; }
+ boost::optional< sal_Int32 >& getFirstLineIndentation(){ return moFirstLineIndentation; }
+
+ void apply( const TextParagraphProperties& rSourceProps );
+ void pushToPropSet( const ::oox::core::XmlFilterBase* pFilterBase,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & xPropSet,
+ PropertyMap& rioBulletList, const BulletList* pMasterBuList, sal_Bool bApplyBulletList, float fFontSize, bool bPushDefaultValues = false ) const;
+ void pushToPropSet( const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & xPropSet) const;
+
+ /** Returns the largest character size of this paragraph. If possible the
+ masterstyle should have been applied before, otherwise the character
+ size can be zero and the default value is returned. */
+ float getCharHeightPoints( float fDefault ) const;
+
+#ifdef DBG_UTIL
+ void dump() const;
+#endif
+
+protected:
+
+ TextCharacterProperties maTextCharacterProperties;
+ PropertyMap maTextParagraphPropertyMap;
+ BulletList maBulletList;
+ TextSpacing maParaTopMargin;
+ TextSpacing maParaBottomMargin;
+ boost::optional< sal_Int32 > moParaLeftMargin;
+ boost::optional< sal_Int32 > moFirstLineIndentation;
+ sal_Int16 mnLevel;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textparagraphpropertiescontext.hxx b/include/oox/drawingml/textparagraphpropertiescontext.hxx
new file mode 100644
index 000000000000..db0f3426a680
--- /dev/null
+++ b/include/oox/drawingml/textparagraphpropertiescontext.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIESCONTEXT_HXX
+#define OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIESCONTEXT_HXX
+
+#include <list>
+
+#include <com/sun/star/style/TabStop.hpp>
+#include "oox/drawingml/drawingmltypes.hxx"
+#include "oox/drawingml/textparagraphproperties.hxx"
+#include "oox/drawingml/textspacing.hxx"
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+class TextParagraphPropertiesContext : public ::oox::core::ContextHandler
+{
+public:
+ TextParagraphPropertiesContext( ::oox::core::ContextHandler& rParent,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XFastAttributeList >& rXAttributes,
+ TextParagraphProperties& rTextParagraphProperties );
+ ~TextParagraphPropertiesContext();
+
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ TextParagraphProperties& mrTextParagraphProperties;
+ TextSpacing maLineSpacing;
+ TextSpacing& mrSpaceBefore;
+ TextSpacing& mrSpaceAfter;
+ BulletList& mrBulletList;
+ ::std::list< ::com::sun::star::style::TabStop > maTabList;
+ ::boost::shared_ptr< BlipFillProperties > mxBlipProps;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIESCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textrun.hxx b/include/oox/drawingml/textrun.hxx
new file mode 100644
index 000000000000..0e215bf68973
--- /dev/null
+++ b/include/oox/drawingml/textrun.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TEXTRUN_HXX
+#define OOX_DRAWINGML_TEXTRUN_HXX
+
+#include <com/sun/star/text/XTextCursor.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include "oox/drawingml/textcharacterproperties.hxx"
+
+namespace oox { namespace drawingml {
+
+class TextRun
+{
+public:
+ TextRun();
+ virtual ~TextRun();
+
+ inline OUString& getText() { return msText; }
+ inline const OUString& getText() const { return msText; }
+
+ inline TextCharacterProperties& getTextCharacterProperties() { return maTextCharacterProperties; }
+ inline const TextCharacterProperties& getTextCharacterProperties() const { return maTextCharacterProperties; }
+
+ inline void setLineBreak() { mbIsLineBreak = true; }
+
+ virtual sal_Int32 insertAt(
+ const ::oox::core::XmlFilterBase& rFilterBase,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::text::XText >& xText,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::text::XTextCursor >& xAt,
+ const TextCharacterProperties& rTextCharacterStyle ) const;
+
+private:
+ OUString msText;
+ TextCharacterProperties maTextCharacterProperties;
+ bool mbIsLineBreak;
+};
+
+typedef boost::shared_ptr< TextRun > TextRunPtr;
+
+} }
+
+#endif // OOX_DRAWINGML_TEXTRUN_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textspacing.hxx b/include/oox/drawingml/textspacing.hxx
new file mode 100644
index 000000000000..c85936283b4b
--- /dev/null
+++ b/include/oox/drawingml/textspacing.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGNML__TEXTSPACING_HXX
+#define OOX_DRAWINGNML__TEXTSPACING_HXX
+
+#include <rtl/ustring.hxx>
+
+#include <com/sun/star/style/LineSpacing.hpp>
+#include <com/sun/star/style/LineSpacingMode.hpp>
+
+namespace oox { namespace drawingml {
+
+
+ /** carries a CT_TextSpacing */
+ class TextSpacing
+ {
+ public:
+ enum {
+ POINTS = 0,
+ PERCENT
+ };
+ TextSpacing()
+ : nUnit( POINTS ), nValue( 0 ), bHasValue( false )
+ {
+ }
+ TextSpacing( sal_Int32 nPoints ) : nUnit( POINTS ), nValue( nPoints ), bHasValue( true ){};
+ ::com::sun::star::style::LineSpacing toLineSpacing() const
+ {
+ ::com::sun::star::style::LineSpacing aSpacing;
+ aSpacing.Mode = ( nUnit == PERCENT
+ ? ::com::sun::star::style::LineSpacingMode::PROP
+ : ::com::sun::star::style::LineSpacingMode::MINIMUM );
+ aSpacing.Height = static_cast< sal_Int16 >( nUnit == PERCENT ? nValue / 1000 : nValue );
+ return aSpacing;
+ }
+ sal_Int32 toMargin( float fFontSize ) const
+ {
+ if ( nUnit == PERCENT )
+ return (sal_Int32) ((((fFontSize*nValue)/1000)*254 + 360)/720);
+ else
+ return nValue;
+ }
+ sal_Int32 nUnit;
+ sal_Int32 nValue;
+ bool bHasValue;
+ };
+
+} }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/theme.hxx b/include/oox/drawingml/theme.hxx
new file mode 100644
index 000000000000..f167c43a4fd4
--- /dev/null
+++ b/include/oox/drawingml/theme.hxx
@@ -0,0 +1,116 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_THEME_HXX
+#define OOX_DRAWINGML_THEME_HXX
+
+#include "oox/drawingml/clrscheme.hxx"
+#include "oox/drawingml/shape.hxx"
+#include "oox/drawingml/textfont.hxx"
+#include <com/sun/star/xml/dom/XDocument.hpp>
+#include "oox/dllapi.h"
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+const sal_Int32 THEMED_STYLE_SUBTLE = 1;
+const sal_Int32 THEMED_STYLE_MODERATE = 2;
+const sal_Int32 THEMED_STYLE_INTENSE = 3;
+
+typedef RefVector< FillProperties > FillStyleList;
+typedef RefVector< LineProperties > LineStyleList;
+typedef RefVector< EffectProperties > EffectStyleList;
+typedef RefMap< sal_Int32, TextCharacterProperties > FontScheme;
+
+// ============================================================================
+
+class OOX_DLLPUBLIC Theme
+{
+public:
+ explicit Theme();
+ ~Theme();
+
+ inline void setStyleName( const OUString& rStyleName ) { maStyleName = rStyleName; }
+ inline const OUString& getStyleName() const { return maStyleName; }
+
+ inline ClrScheme& getClrScheme() { return maClrScheme; }
+ inline const ClrScheme& getClrScheme() const { return maClrScheme; }
+
+ inline FillStyleList& getFillStyleList() { return maFillStyleList; }
+ inline const FillStyleList& getFillStyleList() const { return maFillStyleList; }
+ inline FillStyleList& getBgFillStyleList() { return maBgFillStyleList; }
+ inline const FillStyleList& getBgFillStyleList() const { return maBgFillStyleList; }
+ /** Returns the fill properties of the passed one-based themed style index. */
+ const FillProperties* getFillStyle( sal_Int32 nIndex ) const;
+
+ inline LineStyleList& getLineStyleList() { return maLineStyleList; }
+ inline const LineStyleList& getLineStyleList() const { return maLineStyleList; }
+ /** Returns the line properties of the passed one-based themed style index. */
+ const LineProperties* getLineStyle( sal_Int32 nIndex ) const;
+
+ inline EffectStyleList& getEffectStyleList() { return maEffectStyleList; }
+ inline const EffectStyleList& getEffectStyleList() const { return maEffectStyleList; }
+ const EffectProperties* getEffectStyle( sal_Int32 nIndex ) const;
+
+ inline FontScheme& getFontScheme() { return maFontScheme; }
+ inline const FontScheme& getFontScheme() const { return maFontScheme; }
+ /** Returns theme font properties by scheme type (major/minor). */
+ const TextCharacterProperties* getFontStyle( sal_Int32 nSchemeType ) const;
+ /** Returns theme font by placeholder name, e.g. the major latin theme font for the font name '+mj-lt'. */
+ const TextFont* resolveFont( const OUString& rName ) const;
+
+ inline Shape& getSpDef() { return maSpDef; }
+ inline const Shape& getSpDef() const { return maSpDef; }
+
+ inline Shape& getLnDef() { return maLnDef; }
+ inline const Shape& getLnDef() const { return maLnDef; }
+
+ inline Shape& getTxDef() { return maTxDef; }
+ inline const Shape& getTxDef() const { return maTxDef; }
+
+ void setFragment( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::dom::XDocument>& xRef ) { mxFragment=xRef; }
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::dom::XDocument>& getFragment() const { return mxFragment; }
+
+private:
+ OUString maStyleName;
+ ClrScheme maClrScheme;
+ FillStyleList maFillStyleList;
+ FillStyleList maBgFillStyleList;
+ LineStyleList maLineStyleList;
+ EffectStyleList maEffectStyleList;
+ FontScheme maFontScheme;
+ Shape maSpDef;
+ Shape maLnDef;
+ Shape maTxDef;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::dom::XDocument> mxFragment;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/themeelementscontext.hxx b/include/oox/drawingml/themeelementscontext.hxx
new file mode 100644
index 000000000000..a3d36a9d8225
--- /dev/null
+++ b/include/oox/drawingml/themeelementscontext.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_THEMEELEMENTSCONTEXT_HXX
+#define OOX_DRAWINGML_THEMEELEMENTSCONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+
+namespace oox {
+namespace drawingml {
+
+class Theme;
+
+// ============================================================================
+
+class ThemeElementsContext : public oox::core::ContextHandler
+{
+public:
+ ThemeElementsContext( ::oox::core::ContextHandler& rParent, Theme& rTheme );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ Theme& mrTheme;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/themefragmenthandler.hxx b/include/oox/drawingml/themefragmenthandler.hxx
new file mode 100644
index 000000000000..61062775fa37
--- /dev/null
+++ b/include/oox/drawingml/themefragmenthandler.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_THEMEFRAGMENTHANDLER_HXX
+#define OOX_DRAWINGML_THEMEFRAGMENTHANDLER_HXX
+
+#include "oox/core/fragmenthandler2.hxx"
+#include "oox/dllapi.h"
+
+namespace oox {
+namespace drawingml {
+
+class Theme;
+
+// ============================================================================
+
+class OOX_DLLPUBLIC ThemeFragmentHandler : public ::oox::core::FragmentHandler2
+{
+public:
+ explicit ThemeFragmentHandler(
+ ::oox::core::XmlFilterBase& rFilter,
+ const OUString& rFragmentPath,
+ Theme& rTheme );
+ virtual ~ThemeFragmentHandler();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+
+private:
+ Theme& mrTheme;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/transform2dcontext.hxx b/include/oox/drawingml/transform2dcontext.hxx
new file mode 100644
index 000000000000..6bbbe191e77c
--- /dev/null
+++ b/include/oox/drawingml/transform2dcontext.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TRANSFORM2DCONTEXT_HXX
+#define OOX_DRAWINGML_TRANSFORM2DCONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+class Shape;
+
+/** context to import a CT_Transform2D */
+class Transform2DContext : public ::oox::core::ContextHandler
+{
+public:
+ Transform2DContext( ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes, Shape& rShape, bool btxXfrm = false ) throw();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ Shape& mrShape;
+ bool mbtxXfrm;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/dump/dffdumper.hxx b/include/oox/dump/dffdumper.hxx
new file mode 100644
index 000000000000..d041dcc0be66
--- /dev/null
+++ b/include/oox/dump/dffdumper.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DUMP_DFFDUMPER_HXX
+#define OOX_DUMP_DFFDUMPER_HXX
+
+#include "oox/dump/dumperbase.hxx"
+
+#if OOX_INCLUDE_DUMPER
+
+namespace oox {
+namespace dump {
+
+// ============================================================================
+
+class DffStreamObject : public SequenceRecordObjectBase
+{
+public:
+ inline sal_uInt16 getVer() const { return mnInstVer & 0x000F; }
+ inline sal_uInt16 getInst() const { return (mnInstVer & 0xFFF0) >> 4; }
+ inline bool isContainer() const { return getVer() == 15; }
+
+protected:
+ inline explicit DffStreamObject() {}
+
+ using SequenceRecordObjectBase::construct;
+
+ virtual bool implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize );
+ virtual void implWriteExtHeader();
+ virtual void implDumpRecordBody();
+ virtual void implDumpClientAnchor();
+
+private:
+ sal_uInt32 dumpDffSimpleColor( const String& rName );
+
+ void dumpDffOpt();
+ sal_uInt16 dumpDffOptPropHeader();
+
+private:
+ ItemFormatMap maSimpleProps;
+ ItemFormatMap maComplexProps;
+ sal_uInt16 mnInstVer;
+ sal_Int32 mnRealSize;
+};
+
+// ============================================================================
+
+} // namespace dump
+} // namespace oox
+
+#endif
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/dump/dumperbase.hxx b/include/oox/dump/dumperbase.hxx
new file mode 100644
index 000000000000..043bb73ecfa8
--- /dev/null
+++ b/include/oox/dump/dumperbase.hxx
@@ -0,0 +1,1871 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DUMP_DUMPERBASE_HXX
+#define OOX_DUMP_DUMPERBASE_HXX
+
+#include <math.h>
+#include <vector>
+#include <stack>
+#include <set>
+#include <map>
+#include <boost/shared_ptr.hpp>
+#include <rtl/strbuf.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/util/DateTime.hpp>
+#include "oox/helper/binaryinputstream.hxx"
+#include "oox/helper/helper.hxx"
+#include "oox/helper/storagebase.hxx"
+
+#define OOX_INCLUDE_DUMPER (OSL_DEBUG_LEVEL > 0)
+
+#if OOX_INCLUDE_DUMPER
+
+namespace com { namespace sun { namespace star {
+ namespace io { class XInputStream; }
+ namespace io { class XOutputStream; }
+ namespace io { class XTextOutputStream2; }
+ namespace uno { class XComponentContext; }
+} } }
+
+namespace comphelper {
+ class IDocPasswordVerifier;
+}
+
+namespace oox {
+ class BinaryOutputStream;
+ class TextInputStream;
+}
+
+namespace oox { namespace core {
+ class FilterBase;
+} }
+
+namespace oox {
+namespace dump {
+
+// ============================================================================
+
+#define OOX_DUMP_UNUSED "unused"
+#define OOX_DUMP_UNKNOWN "?unknown"
+
+#define OOX_DUMP_ERRASCII( ascii ) "?err:" ascii
+
+#define OOX_DUMP_ERR_NOMAP "no-map"
+#define OOX_DUMP_ERR_NONAME "no-name"
+#define OOX_DUMP_ERR_STREAM "stream-error"
+
+#define OOX_DUMP_DUMPEXT ".dump"
+
+const sal_Unicode OOX_DUMP_STRQUOTE = '\'';
+const sal_Unicode OOX_DUMP_FMLASTRQUOTE = '"';
+const sal_Unicode OOX_DUMP_ADDRABS = '$';
+const sal_Unicode OOX_DUMP_R1C1ROW = 'R';
+const sal_Unicode OOX_DUMP_R1C1COL = 'C';
+const sal_Unicode OOX_DUMP_R1C1OPEN = '[';
+const sal_Unicode OOX_DUMP_R1C1CLOSE = ']';
+const sal_Unicode OOX_DUMP_RANGESEP = ':';
+const sal_Unicode OOX_DUMP_BASECLASS = 'B';
+const sal_Unicode OOX_DUMP_FUNCSEP = ',';
+const sal_Unicode OOX_DUMP_LISTSEP = ',';
+const sal_Unicode OOX_DUMP_TABSEP = '!';
+const sal_Unicode OOX_DUMP_ARRAYSEP = ';';
+const sal_Unicode OOX_DUMP_EMPTYVALUE = '~';
+const sal_Unicode OOX_DUMP_CMDPROMPT = '?';
+const sal_Unicode OOX_DUMP_PLACEHOLDER = '\x01';
+
+typedef ::std::pair< OUString, OUString > OUStringPair;
+typedef ::std::pair< sal_Int64, sal_Int64 > Int64Pair;
+
+typedef ::std::vector< OUString > OUStringVector;
+typedef ::std::vector< sal_Int64 > Int64Vector;
+
+// ============================================================================
+// ============================================================================
+
+/** Static helper functions for system file and stream access. */
+class InputOutputHelper
+{
+public:
+ // file names -------------------------------------------------------------
+
+ static OUString convertFileNameToUrl( const OUString& rFileName );
+ static sal_Int32 getFileNamePos( const OUString& rFileUrl );
+ static OUString getFileNameExtension( const OUString& rFileUrl );
+
+ // input streams ----------------------------------------------------------
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ openInputStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const OUString& rFileName );
+
+ // output streams ---------------------------------------------------------
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
+ openOutputStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const OUString& rFileName );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextOutputStream2 >
+ openTextOutputStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rxOutStrm,
+ rtl_TextEncoding eTextEnc );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextOutputStream2 >
+ openTextOutputStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const OUString& rFileName,
+ rtl_TextEncoding eTextEnc );
+};
+
+// ============================================================================
+
+class BinaryInputStreamRef : public ::oox::BinaryInputStreamRef
+{
+public:
+ inline BinaryInputStreamRef() {}
+
+ inline /*implicit*/ BinaryInputStreamRef( BinaryInputStream* pInStrm ) :
+ ::oox::BinaryInputStreamRef( pInStrm ) {}
+
+ inline /*implicit*/ BinaryInputStreamRef( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm ) :
+ ::oox::BinaryInputStreamRef( new BinaryXInputStream( rxInStrm, true ) ) {}
+
+ template< typename StreamType >
+ inline /*implicit*/ BinaryInputStreamRef( const ::boost::shared_ptr< StreamType >& rxInStrm ) :
+ ::oox::BinaryInputStreamRef( rxInStrm ) {}
+};
+
+// ============================================================================
+// ============================================================================
+
+/** Specifiers for atomic data types. */
+enum DataType
+{
+ DATATYPE_VOID, ///< No data type.
+ DATATYPE_INT8, ///< Signed 8-bit integer.
+ DATATYPE_UINT8, ///< Unsigned 8-bit integer.
+ DATATYPE_INT16, ///< Signed 16-bit integer.
+ DATATYPE_UINT16, ///< Unsigned 16-bit integer.
+ DATATYPE_INT32, ///< Signed 32-bit integer.
+ DATATYPE_UINT32, ///< Unsigned 32-bit integer.
+ DATATYPE_INT64, ///< Signed 64-bit integer.
+ DATATYPE_UINT64, ///< Unsigned 64-bit integer.
+ DATATYPE_FLOAT, ///< Floating-point, single precision.
+ DATATYPE_DOUBLE ///< Floating-point, double precision.
+};
+
+// ----------------------------------------------------------------------------
+
+/** Specifiers for the output format of values. */
+enum FormatType
+{
+ FORMATTYPE_NONE, ///< No numeric format (e.g. show name only).
+ FORMATTYPE_DEC, ///< Decimal.
+ FORMATTYPE_HEX, ///< Hexadecimal.
+ FORMATTYPE_SHORTHEX, ///< Hexadecimal, as short as possible (no leading zeros).
+ FORMATTYPE_BIN, ///< Binary.
+ FORMATTYPE_FIX, ///< Fixed-point.
+ FORMATTYPE_BOOL ///< Boolean ('true' or 'false').
+};
+
+// ----------------------------------------------------------------------------
+
+/** Describes the output format of a data item.
+
+ Data items are written in the following format:
+
+ <NAME>=<VALUE>=<NAME-FROM-LIST>
+
+ NAME is the name of the data item. The name is contained in the member
+ maItemName. If the name is empty, only the value is written (without a
+ leading equality sign).
+
+ VALUE is the numeric value of the data item. Its format is dependent on the
+ output format given in the member meFmtType. If the format type is
+ FORMATTYPE_NONE, no value is written.
+
+ NAME-FROM-LIST is a symbolic name for the current value of the data item.
+ Various types of name lists produce different names for values, which can
+ be used for enumerations or names for single bits in bitfields (see class
+ NameListBase and derived classes). The name of the list is given in the
+ member maListName. If it is empty, no name is written for the value.
+ */
+struct ItemFormat
+{
+ DataType meDataType; ///< Data type of the item.
+ FormatType meFmtType; ///< Output format for the value.
+ OUString maItemName; ///< Name of the item.
+ OUString maListName; ///< Name of a name list to be used for this item.
+
+ explicit ItemFormat();
+
+ void set( DataType eDataType, FormatType eFmtType, const OUString& rItemName );
+
+ /** Initializes the struct from a vector of strings containing the item format.
+
+ The vector must contain at least 2 strings. The struct is filled from
+ the strings in the vector in the following order:
+ 1) Data type (one of: [u]int8, [u]int16, [u]int32, [u]int64, float, double).
+ 2) Format type (one of: dec, hex, shorthex, bin, fix, bool, unused, unknown).
+ 3) Item name (optional).
+ 4) Name list name (optional).
+
+ @return Iterator pointing to the first unhandled string.
+ */
+ OUStringVector::const_iterator parse( const OUStringVector& rFormatVec );
+
+ /** Initializes the struct from a string containing the item format.
+
+ The string must have the following format:
+ DATATYPE,FORMATTYPE[,ITEMNAME[,LISTNAME]]
+
+ DATATYPE is the data type of the item (see above for possible values).
+ FORMATTYPE is the format type of the item (see above for possible values).
+ ITEMNAME is the name of the item (optional).
+ LISTNAME is the name of a name list (optional).
+
+ @return List containing remaining unhandled format strings.
+ */
+ OUStringVector parse( const OUString& rFormatStr );
+};
+
+// ============================================================================
+// ============================================================================
+
+struct Address
+{
+ sal_Int32 mnCol;
+ sal_Int32 mnRow;
+ inline explicit Address() : mnCol( 0 ), mnRow( 0 ) {}
+ inline explicit Address( sal_Int32 nCol, sal_Int32 nRow ) : mnCol( nCol ), mnRow( nRow ) {}
+};
+
+// ----------------------------------------------------------------------------
+
+struct Range
+{
+ Address maFirst;
+ Address maLast;
+ inline explicit Range() {}
+};
+
+// ----------------------------------------------------------------------------
+
+typedef ::std::vector< Range > RangeList;
+
+// ============================================================================
+
+struct TokenAddress : public Address
+{
+ bool mbRelCol;
+ bool mbRelRow;
+ inline explicit TokenAddress() : mbRelCol( false ), mbRelRow( false ) {}
+};
+
+// ----------------------------------------------------------------------------
+
+struct TokenRange
+{
+ TokenAddress maFirst;
+ TokenAddress maLast;
+ inline explicit TokenRange() {}
+};
+
+// ============================================================================
+// ============================================================================
+
+/** Static helper functions for formatted output to strings. */
+class StringHelper
+{
+public:
+ // append string to string ------------------------------------------------
+
+ static void appendChar( OUStringBuffer& rStr, sal_Unicode cChar, sal_Int32 nCount = 1 );
+ static void appendString( OUStringBuffer& rStr, const OUString& rData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+
+ // append decimal ---------------------------------------------------------
+
+ static void appendDec( OUStringBuffer& rStr, sal_uInt8 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+ static void appendDec( OUStringBuffer& rStr, sal_Int8 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+ static void appendDec( OUStringBuffer& rStr, sal_uInt16 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+ static void appendDec( OUStringBuffer& rStr, sal_Int16 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+ static void appendDec( OUStringBuffer& rStr, sal_uInt32 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+ static void appendDec( OUStringBuffer& rStr, sal_Int32 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+ static void appendDec( OUStringBuffer& rStr, sal_uInt64 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+ static void appendDec( OUStringBuffer& rStr, sal_Int64 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+ static void appendDec( OUStringBuffer& rStr, double fData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+
+ // append hexadecimal -----------------------------------------------------
+
+ static void appendHex( OUStringBuffer& rStr, sal_uInt8 nData, bool bPrefix = true );
+ static void appendHex( OUStringBuffer& rStr, sal_Int8 nData, bool bPrefix = true );
+ static void appendHex( OUStringBuffer& rStr, sal_uInt16 nData, bool bPrefix = true );
+ static void appendHex( OUStringBuffer& rStr, sal_Int16 nData, bool bPrefix = true );
+ static void appendHex( OUStringBuffer& rStr, sal_uInt32 nData, bool bPrefix = true );
+ static void appendHex( OUStringBuffer& rStr, sal_Int32 nData, bool bPrefix = true );
+ static void appendHex( OUStringBuffer& rStr, sal_uInt64 nData, bool bPrefix = true );
+ static void appendHex( OUStringBuffer& rStr, sal_Int64 nData, bool bPrefix = true );
+ static void appendHex( OUStringBuffer& rStr, double fData, bool bPrefix = true );
+
+ // append shortened hexadecimal -------------------------------------------
+
+ static void appendShortHex( OUStringBuffer& rStr, sal_uInt8 nData, bool bPrefix = true );
+ static void appendShortHex( OUStringBuffer& rStr, sal_Int8 nData, bool bPrefix = true );
+ static void appendShortHex( OUStringBuffer& rStr, sal_uInt16 nData, bool bPrefix = true );
+ static void appendShortHex( OUStringBuffer& rStr, sal_Int16 nData, bool bPrefix = true );
+ static void appendShortHex( OUStringBuffer& rStr, sal_uInt32 nData, bool bPrefix = true );
+ static void appendShortHex( OUStringBuffer& rStr, sal_Int32 nData, bool bPrefix = true );
+ static void appendShortHex( OUStringBuffer& rStr, sal_uInt64 nData, bool bPrefix = true );
+ static void appendShortHex( OUStringBuffer& rStr, sal_Int64 nData, bool bPrefix = true );
+ static void appendShortHex( OUStringBuffer& rStr, double fData, bool bPrefix = true );
+
+ // append binary ----------------------------------------------------------
+
+ static void appendBin( OUStringBuffer& rStr, sal_uInt8 nData, bool bDots = true );
+ static void appendBin( OUStringBuffer& rStr, sal_Int8 nData, bool bDots = true );
+ static void appendBin( OUStringBuffer& rStr, sal_uInt16 nData, bool bDots = true );
+ static void appendBin( OUStringBuffer& rStr, sal_Int16 nData, bool bDots = true );
+ static void appendBin( OUStringBuffer& rStr, sal_uInt32 nData, bool bDots = true );
+ static void appendBin( OUStringBuffer& rStr, sal_Int32 nData, bool bDots = true );
+ static void appendBin( OUStringBuffer& rStr, sal_uInt64 nData, bool bDots = true );
+ static void appendBin( OUStringBuffer& rStr, sal_Int64 nData, bool bDots = true );
+ static void appendBin( OUStringBuffer& rStr, double fData, bool bDots = true );
+
+ // append fixed-point decimal ---------------------------------------------
+
+ template< typename Type >
+ static void appendFix( OUStringBuffer& rStr, Type nData, sal_Int32 nWidth = 0 );
+
+ // append formatted value -------------------------------------------------
+
+ static void appendBool( OUStringBuffer& rStr, bool bData );
+ template< typename Type >
+ static void appendValue( OUStringBuffer& rStr, Type nData, FormatType eFmtType );
+
+ // encoded text output ----------------------------------------------------
+
+ static void appendCChar( OUStringBuffer& rStr, sal_Unicode cChar, bool bPrefix = true );
+ static void appendEncChar( OUStringBuffer& rStr, sal_Unicode cChar, sal_Int32 nCount = 1, bool bPrefix = true );
+ static void appendEncString( OUStringBuffer& rStr, const OUString& rData, bool bPrefix = true );
+
+ // token list -------------------------------------------------------------
+
+ static void appendToken( OUStringBuffer& rStr, const OUString& rToken, sal_Unicode cSep = OOX_DUMP_LISTSEP );
+
+ static void appendIndex( OUStringBuffer& rStr, const OUString& rIdx );
+ static void appendIndex( OUStringBuffer& rStr, sal_Int64 nIdx );
+
+ static OUString getToken( const OUString& rData, sal_Int32& rnPos, sal_Unicode cSep = OOX_DUMP_LISTSEP );
+
+ /** Encloses the passed string with the passed characters. Uses cOpen, if cClose is NUL. */
+ static void enclose( OUStringBuffer& rStr, sal_Unicode cOpen, sal_Unicode cClose = '\0' );
+
+ // string conversion ------------------------------------------------------
+
+ static OUString trimSpaces( const OUString& rStr );
+ static OUString trimTrailingNul( const OUString& rStr );
+
+ static OString convertToUtf8( const OUString& rStr );
+ static DataType convertToDataType( const OUString& rStr );
+ static FormatType convertToFormatType( const OUString& rStr );
+
+ static bool convertFromDec( sal_Int64& ornData, const OUString& rData );
+ static bool convertFromHex( sal_Int64& ornData, const OUString& rData );
+
+ static bool convertStringToInt( sal_Int64& ornData, const OUString& rData );
+ static bool convertStringToDouble( double& orfData, const OUString& rData );
+ static bool convertStringToBool( const OUString& rData );
+
+ static OUStringPair convertStringToPair( const OUString& rString, sal_Unicode cSep = '=' );
+
+ // string to list conversion ----------------------------------------------
+
+ static void convertStringToStringList( OUStringVector& orVec, const OUString& rData, bool bIgnoreEmpty );
+ static void convertStringToIntList( Int64Vector& orVec, const OUString& rData, bool bIgnoreEmpty );
+};
+
+// ----------------------------------------------------------------------------
+
+template< typename Type >
+void StringHelper::appendFix( OUStringBuffer& rStr, Type nData, sal_Int32 nWidth )
+{
+ appendDec( rStr, static_cast< double >( nData ) / pow( 2.0, 4.0 * sizeof( Type ) ), nWidth );
+}
+
+template< typename Type >
+void StringHelper::appendValue( OUStringBuffer& rStr, Type nData, FormatType eFmtType )
+{
+ switch( eFmtType )
+ {
+ case FORMATTYPE_DEC: appendDec( rStr, nData ); break;
+ case FORMATTYPE_HEX: appendHex( rStr, nData ); break;
+ case FORMATTYPE_SHORTHEX: appendShortHex( rStr, nData ); break;
+ case FORMATTYPE_BIN: appendBin( rStr, nData ); break;
+ case FORMATTYPE_FIX: appendFix( rStr, nData ); break;
+ case FORMATTYPE_BOOL: appendBool( rStr, nData ); break;
+ default:;
+ }
+}
+
+// ============================================================================
+
+class String : public OUString
+{
+public:
+ inline String() {}
+ inline /*implicit*/ String( const OUString& rStr ) : OUString( rStr ) {}
+ inline /*implicit*/ String( const sal_Char* pcStr ) : OUString( OUString::createFromAscii( pcStr ? pcStr : "" ) ) {}
+ inline /*implicit*/ String( sal_Unicode cChar ) : OUString( cChar ) {}
+
+ inline bool has() const { return getLength() > 0; }
+ inline OUString operator()( const sal_Char* pcDefault ) const { if( has() ) return *this; return String( pcDefault ); }
+};
+
+static const String EMPTY_STRING;
+
+// ============================================================================
+// ============================================================================
+
+class Base;
+typedef ::boost::shared_ptr< Base > BaseRef;
+
+/** Base class for all dumper classes.
+
+ Derived classes implement the virtual function implIsValid(). It should
+ check all members the other functions rely on. If the function
+ implIsValid() returns true, all references and pointers can be used without
+ further checking.
+
+ Overview of all classes in this header file based on this Base class:
+
+ Base
+ |
+ +----> NameListBase
+ | |
+ | +----> ConstList ------> MultiList
+ | |
+ | +----> FlagsList ------> CombiList
+ | |
+ | +----> UnitConverter
+ |
+ +----> SharedConfigData
+ |
+ +----> Config
+ |
+ +----> Output
+ |
+ +----> StorageIterator
+ |
+ +----> ObjectBase
+ |
+ +----> StorageObjectBase
+ |
+ +----> OutputObjectBase
+ | |
+ | +----> InputObjectBase
+ | |
+ | +----> BinaryStreamObject
+ | |
+ | +----> TextStreamObjectBase
+ | | |
+ | | +----> TextStreamObject
+ | | |
+ | | +----> XmlStreamObject
+ | |
+ | +----> RecordObjectBase
+ | |
+ | +----> SequenceRecordObjectBase
+ |
+ +----> DumperBase
+ */
+class Base
+{
+public:
+ virtual ~Base();
+
+ inline bool isValid() const { return implIsValid(); }
+ inline static bool isValid( const BaseRef& rxBase ) { return rxBase.get() && rxBase->isValid(); }
+
+protected:
+ inline explicit Base() {}
+
+ virtual bool implIsValid() const = 0;
+};
+
+// ============================================================================
+// ============================================================================
+
+class ConfigItemBase
+{
+public:
+ virtual ~ConfigItemBase();
+ void readConfigBlock( TextInputStream& rStrm );
+
+protected:
+ inline explicit ConfigItemBase() {}
+
+ virtual void implProcessConfigItemStr(
+ TextInputStream& rStrm,
+ const OUString& rKey,
+ const OUString& rData );
+
+ virtual void implProcessConfigItemInt(
+ TextInputStream& rStrm,
+ sal_Int64 nKey,
+ const OUString& rData );
+
+ void readConfigBlockContents(
+ TextInputStream& rStrm );
+
+private:
+ enum LineType { LINETYPE_DATA, LINETYPE_END };
+
+ LineType readConfigLine(
+ TextInputStream& rStrm,
+ OUString& orKey,
+ OUString& orData ) const;
+
+ void processConfigItem(
+ TextInputStream& rStrm,
+ const OUString& rKey,
+ const OUString& rData );
+};
+
+// ============================================================================
+
+class SharedConfigData;
+class Config;
+
+class NameListBase;
+typedef ::boost::shared_ptr< NameListBase > NameListRef;
+
+/** Base class of all classes providing names for specific values (name lists).
+
+ The idea is to provide a unique interfase for all different methods to
+ write specific names for any values. This can be enumerations (dedicated
+ names for a subset of values), or names for bits in bit fields. Classes
+ derived from this base class implement the specific behaviour for the
+ desired purpose.
+ */
+class NameListBase : public Base, public ConfigItemBase
+{
+public:
+ typedef ::std::map< sal_Int64, OUString > OUStringMap;
+ typedef OUStringMap::const_iterator const_iterator;
+
+public:
+ virtual ~NameListBase();
+
+ /** Sets a name for the specified key. */
+ void setName( sal_Int64 nKey, const String& rName );
+
+ /** Include all names of the passed list. */
+ void includeList( const NameListRef& rxList );
+
+ /** Returns true, if the map contains an entry for the passed key. */
+ template< typename Type >
+ inline bool hasName( Type nKey ) const
+ { return maMap.count( static_cast< sal_Int64 >( nKey ) ) != 0; }
+
+ /** Returns the name for the passed key. */
+ template< typename Type >
+ inline OUString getName( const Config& rCfg, Type nKey ) const
+ { return implGetName( rCfg, static_cast< sal_Int64 >( nKey ) ); }
+
+ /** Returns a display name for the passed double value. */
+ inline OUString getName( const Config& rCfg, double fValue ) const
+ { return implGetNameDbl( rCfg, fValue ); }
+
+ /** Returns a map iterator pointing to the first contained name. */
+ inline const_iterator begin() const { return maMap.begin(); }
+ /** Returns a map iterator pointing one past the last contained name. */
+ inline const_iterator end() const { return maMap.end(); }
+
+protected:
+ inline explicit NameListBase( const SharedConfigData& rCfgData ) : mrCfgData( rCfgData ) {}
+
+ virtual bool implIsValid() const;
+
+ virtual void implProcessConfigItemStr(
+ TextInputStream& rStrm,
+ const OUString& rKey,
+ const OUString& rData );
+
+ virtual void implProcessConfigItemInt(
+ TextInputStream& rStrm,
+ sal_Int64 nKey,
+ const OUString& rData );
+
+ /** Derived classes set the name for the passed key. */
+ virtual void implSetName( sal_Int64 nKey, const OUString& rName ) = 0;
+ /** Derived classes generate and return the name for the passed key. */
+ virtual OUString implGetName( const Config& rCfg, sal_Int64 nKey ) const = 0;
+ /** Derived classes generate and return the name for the passed double value. */
+ virtual OUString implGetNameDbl( const Config& rCfg, double fValue ) const = 0;
+ /** Derived classes insert all names and other settings from the passed list. */
+ virtual void implIncludeList( const NameListBase& rList ) = 0;
+
+ /** Inserts the passed name into the internal map. */
+ void insertRawName( sal_Int64 nKey, const OUString& rName );
+ /** Returns the name for the passed key, or 0, if nothing found. */
+ const OUString* findRawName( sal_Int64 nKey ) const;
+
+private:
+ /** Includes name lists, given in a comma separated list of names of the lists. */
+ void include( const OUString& rListKeys );
+ /** Excludes names from the list, given in a comma separated list of their keys. */
+ void exclude( const OUString& rKeys );
+
+private:
+ OUStringMap maMap;
+ const SharedConfigData& mrCfgData;
+};
+
+// ============================================================================
+
+class ConstList : public NameListBase
+{
+public:
+ explicit ConstList( const SharedConfigData& rCfgData );
+
+ /** Sets a default name for unknown keys. */
+ inline void setDefaultName( const String& rDefName ) { maDefName = rDefName; }
+ /** Enables or disables automatic quotation of returned names. */
+ inline void setQuoteNames( bool bQuoteNames ) { mbQuoteNames = bQuoteNames; }
+
+protected:
+ virtual void implProcessConfigItemStr(
+ TextInputStream& rStrm,
+ const OUString& rKey,
+ const OUString& rData );
+
+ /** Sets the name for the passed key. */
+ virtual void implSetName( sal_Int64 nKey, const OUString& rName );
+ /** Returns the name for the passed key, or the default name, if key is not contained. */
+ virtual OUString implGetName( const Config& rCfg, sal_Int64 nKey ) const;
+ /** Returns the name for the passed double value. */
+ virtual OUString implGetNameDbl( const Config& rCfg, double fValue ) const;
+ /** Inserts all names from the passed list. */
+ virtual void implIncludeList( const NameListBase& rList );
+
+private:
+ OUString maDefName;
+ bool mbQuoteNames;
+};
+
+// ============================================================================
+
+class MultiList : public ConstList
+{
+public:
+ explicit MultiList( const SharedConfigData& rCfgData );
+
+ void setNamesFromVec( sal_Int64 nStartKey, const OUStringVector& rNames );
+
+protected:
+ virtual void implProcessConfigItemStr(
+ TextInputStream& rStrm,
+ const OUString& rKey,
+ const OUString& rData );
+
+ virtual void implSetName( sal_Int64 nKey, const OUString& rName );
+
+private:
+ void insertNames( sal_Int64 nStartKey, const OUString& rData );
+
+private:
+ bool mbIgnoreEmpty;
+};
+
+// ============================================================================
+
+class FlagsList : public NameListBase
+{
+public:
+ explicit FlagsList( const SharedConfigData& rCfgData );
+
+ /** Returns the flags to be ignored on output. */
+ inline sal_Int64 getIgnoreFlags() const { return mnIgnore; }
+ /** Sets flags to be ignored on output. */
+ inline void setIgnoreFlags( sal_Int64 nIgnore ) { mnIgnore = nIgnore; }
+
+protected:
+ virtual void implProcessConfigItemStr(
+ TextInputStream& rStrm,
+ const OUString& rKey,
+ const OUString& rData );
+
+ /** Sets the name for the passed key. */
+ virtual void implSetName( sal_Int64 nKey, const OUString& rName );
+ /** Returns the name for the passed key. */
+ virtual OUString implGetName( const Config& rCfg, sal_Int64 nKey ) const;
+ /** Returns the name for the passed double value. */
+ virtual OUString implGetNameDbl( const Config& rCfg, double fValue ) const;
+ /** Inserts all flags from the passed list. */
+ virtual void implIncludeList( const NameListBase& rList );
+
+private:
+ sal_Int64 mnIgnore;
+};
+
+// ============================================================================
+
+class CombiList : public FlagsList
+{
+public:
+ explicit CombiList( const SharedConfigData& rCfgData );
+
+protected:
+ /** Sets the name for the passed key. */
+ virtual void implSetName( sal_Int64 nKey, const OUString& rName );
+ /** Returns the name for the passed key. */
+ virtual OUString implGetName( const Config& rCfg, sal_Int64 nKey ) const;
+ /** Inserts all flags from the passed list. */
+ virtual void implIncludeList( const NameListBase& rList );
+
+private:
+ struct ExtItemFormatKey
+ {
+ sal_Int64 mnKey;
+ Int64Pair maFilter;
+ inline explicit ExtItemFormatKey( sal_Int64 nKey ) : mnKey( nKey ), maFilter( 0, 0 ) {}
+ bool operator<( const ExtItemFormatKey& rRight ) const;
+
+ };
+ struct ExtItemFormat : public ItemFormat
+ {
+ bool mbShiftValue;
+ inline explicit ExtItemFormat() : mbShiftValue( true ) {}
+ };
+ typedef ::std::map< ExtItemFormatKey, ExtItemFormat > ExtItemFormatMap;
+ ExtItemFormatMap maFmtMap;
+};
+
+// ============================================================================
+
+class UnitConverter : public NameListBase
+{
+public:
+ explicit UnitConverter( const SharedConfigData& rCfgData );
+
+ inline void setUnitName( const String& rUnitName ) { maUnitName = rUnitName; }
+ inline void setFactor( double fFactor ) { mfFactor = fFactor; }
+
+protected:
+ /** Sets the name for the passed key. */
+ virtual void implSetName( sal_Int64 nKey, const OUString& rName );
+ /** Returns the converted value with appended unit name. */
+ virtual OUString implGetName( const Config& rCfg, sal_Int64 nKey ) const;
+ /** Returns the converted value with appended unit name. */
+ virtual OUString implGetNameDbl( const Config& rCfg, double fValue ) const;
+ /** Empty implementation. */
+ virtual void implIncludeList( const NameListBase& rList );
+
+private:
+ OUString maUnitName;
+ double mfFactor;
+};
+
+// ============================================================================
+
+class NameListWrapper
+{
+public:
+ inline NameListWrapper() {}
+ inline /*implicit*/ NameListWrapper( const OUString& rListName ) : maName( rListName ) {}
+ inline /*implicit*/ NameListWrapper( const sal_Char* pcListName ) : maName( pcListName ) {}
+ inline /*implicit*/ NameListWrapper( const NameListRef& rxList ) : mxList( rxList ) {}
+
+ inline bool isEmpty() const { return !mxList && !maName.has(); }
+ NameListRef getNameList( const Config& rCfg ) const;
+
+private:
+ String maName;
+ mutable NameListRef mxList;
+};
+
+static const NameListWrapper NO_LIST;
+
+// ============================================================================
+
+class ItemFormatMap : public ::std::map< sal_Int64, ItemFormat >
+{
+public:
+ inline explicit ItemFormatMap() {}
+ inline explicit ItemFormatMap( const NameListRef& rxNameList ) { insertFormats( rxNameList ); }
+
+ void insertFormats( const NameListRef& rxNameList );
+};
+
+// ============================================================================
+// ============================================================================
+
+class SharedConfigData : public Base, public ConfigItemBase
+{
+public:
+ explicit SharedConfigData(
+ const OUString& rFileName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const StorageRef& rxRootStrg,
+ const OUString& rSysFileName );
+
+ virtual ~SharedConfigData();
+
+ inline const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& getContext() const { return mxContext; }
+ inline const StorageRef& getRootStorage() const { return mxRootStrg; }
+ inline const OUString& getSysFileName() const { return maSysFileName; }
+
+ void setOption( const OUString& rKey, const OUString& rData );
+ const OUString* getOption( const OUString& rKey ) const;
+
+ template< typename ListType >
+ ::boost::shared_ptr< ListType > createNameList( const OUString& rListName );
+ void setNameList( const OUString& rListName, const NameListRef& rxList );
+ void eraseNameList( const OUString& rListName );
+ NameListRef getNameList( const OUString& rListName ) const;
+
+ inline bool isPasswordCancelled() const { return mbPwCancelled; }
+
+protected:
+ virtual bool implIsValid() const;
+ virtual void implProcessConfigItemStr(
+ TextInputStream& rStrm,
+ const OUString& rKey,
+ const OUString& rData );
+
+private:
+ bool readConfigFile( const OUString& rFileUrl );
+ template< typename ListType >
+ void readNameList( TextInputStream& rStrm, const OUString& rListName );
+ void createShortList( const OUString& rData );
+ void createUnitConverter( const OUString& rData );
+
+private:
+ typedef ::std::set< OUString > ConfigFileSet;
+ typedef ::std::map< OUString, OUString > ConfigDataMap;
+ typedef ::std::map< OUString, NameListRef > NameListMap;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext;
+ StorageRef mxRootStrg;
+ OUString maSysFileName;
+ ConfigFileSet maConfigFiles;
+ ConfigDataMap maConfigData;
+ NameListMap maNameLists;
+ OUString maConfigPath;
+ bool mbLoaded;
+ bool mbPwCancelled;
+};
+
+// ----------------------------------------------------------------------------
+
+template< typename ListType >
+::boost::shared_ptr< ListType > SharedConfigData::createNameList( const OUString& rListName )
+{
+ ::boost::shared_ptr< ListType > xList;
+ if( !rListName.isEmpty() )
+ {
+ xList.reset( new ListType( *this ) );
+ setNameList( rListName, xList );
+ }
+ return xList;
+}
+
+template< typename ListType >
+void SharedConfigData::readNameList( TextInputStream& rStrm, const OUString& rListName )
+{
+ NameListRef xList = createNameList< ListType >( rListName );
+ if( xList.get() )
+ xList->readConfigBlock( rStrm );
+}
+
+// ============================================================================
+
+class Config : public Base
+{
+public:
+ explicit Config( const Config& rParent );
+ explicit Config(
+ const sal_Char* pcEnvVar,
+ const ::oox::core::FilterBase& rFilter );
+ explicit Config(
+ const sal_Char* pcEnvVar,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const StorageRef& rxRootStrg,
+ const OUString& rSysFileName );
+
+ virtual ~Config();
+
+ inline const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& getContext() const { return mxCfgData->getContext(); }
+ inline const StorageRef& getRootStorage() const { return mxCfgData->getRootStorage(); }
+ inline const OUString& getSysFileName() const { return mxCfgData->getSysFileName(); }
+
+ const OUString& getStringOption( const String& rKey, const OUString& rDefault ) const;
+ bool getBoolOption( const String& rKey, bool bDefault ) const;
+ template< typename Type >
+ Type getIntOption( const String& rKey, Type nDefault ) const;
+
+ bool isDumperEnabled() const;
+ bool isImportEnabled() const;
+
+ template< typename ListType >
+ ::boost::shared_ptr< ListType > createNameList( const String& rListName );
+ void eraseNameList( const String& rListName );
+ NameListRef getNameList( const String& rListName ) const;
+
+ /** Returns the name for the passed key from the passed name list. */
+ template< typename Type >
+ OUString getName( const NameListWrapper& rListWrp, Type nKey ) const;
+ /** Returns true, if the passed name list contains an entry for the passed key. */
+ template< typename Type >
+ bool hasName( const NameListWrapper& rListWrp, Type nKey ) const;
+
+ bool isPasswordCancelled() const;
+
+protected:
+ inline explicit Config() {}
+ void construct( const Config& rParent );
+ void construct(
+ const sal_Char* pcEnvVar,
+ const ::oox::core::FilterBase& rFilter );
+ void construct(
+ const sal_Char* pcEnvVar,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const StorageRef& rxRootStrg,
+ const OUString& rSysFileName );
+
+ virtual bool implIsValid() const;
+ virtual const OUString* implGetOption( const OUString& rKey ) const;
+ virtual NameListRef implGetNameList( const OUString& rListName ) const;
+
+private:
+ typedef ::boost::shared_ptr< SharedConfigData > SharedConfigDataRef;
+ SharedConfigDataRef mxCfgData;
+};
+
+typedef ::boost::shared_ptr< Config > ConfigRef;
+
+// ----------------------------------------------------------------------------
+
+template< typename Type >
+Type Config::getIntOption( const String& rKey, Type nDefault ) const
+{
+ sal_Int64 nRawData;
+ const OUString* pData = implGetOption( rKey );
+ return (pData && StringHelper::convertStringToInt( nRawData, *pData )) ?
+ static_cast< Type >( nRawData ) : nDefault;
+}
+
+template< typename ListType >
+::boost::shared_ptr< ListType > Config::createNameList( const String& rListName )
+{
+ return mxCfgData->createNameList< ListType >( rListName );
+}
+
+template< typename Type >
+OUString Config::getName( const NameListWrapper& rListWrp, Type nKey ) const
+{
+ NameListRef xList = rListWrp.getNameList( *this );
+ return xList.get() ? xList->getName( *this, nKey ) : OOX_DUMP_ERR_NOMAP;
+}
+
+template< typename Type >
+bool Config::hasName( const NameListWrapper& rListWrp, Type nKey ) const
+{
+ NameListRef xList = rListWrp.getNameList( *this );
+ return xList.get() && xList->hasName( nKey );
+}
+
+// ============================================================================
+// ============================================================================
+
+class Output : public Base
+{
+public:
+ explicit Output(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const OUString& rFileName );
+
+ // ------------------------------------------------------------------------
+
+ void newLine();
+ void emptyLine( size_t nCount = 1 );
+ inline OUStringBuffer& getLine() { return maLine; }
+
+ void incIndent();
+ void decIndent();
+
+ void startTable( sal_Int32 nW1 );
+ void startTable( sal_Int32 nW1, sal_Int32 nW2 );
+ void startTable( sal_Int32 nW1, sal_Int32 nW2, sal_Int32 nW3, sal_Int32 nW4 );
+ void startTable( size_t nColCount, const sal_Int32* pnColWidths );
+ void tab();
+ void tab( size_t nCol );
+ void endTable();
+
+ void resetItemIndex( sal_Int64 nIdx = 0 );
+ void startItem( const String& rItemName );
+ void contItem();
+ void endItem();
+ inline const OUString& getLastItemValue() const { return maLastItem; }
+
+ void startMultiItems();
+ void endMultiItems();
+
+ // ------------------------------------------------------------------------
+
+ void writeChar( sal_Unicode cChar, sal_Int32 nCount = 1 );
+ void writeAscii( const sal_Char* pcStr );
+ void writeString( const OUString& rStr );
+ void writeArray( const sal_uInt8* pnData, sal_Size nSize, sal_Unicode cSep = OOX_DUMP_LISTSEP );
+ void writeBool( bool bData );
+ void writeDateTime( const ::com::sun::star::util::DateTime& rDateTime );
+
+ template< typename Type >
+ inline void writeDec( Type nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' )
+ { StringHelper::appendDec( maLine, nData, nWidth, cFill ); }
+ template< typename Type >
+ inline void writeHex( Type nData, bool bPrefix = true )
+ { StringHelper::appendHex( maLine, nData, bPrefix ); }
+ template< typename Type >
+ inline void writeShortHex( Type nData, bool bPrefix = true )
+ { StringHelper::appendShortHex( maLine, nData, bPrefix ); }
+ template< typename Type >
+ inline void writeBin( Type nData, bool bDots = true )
+ { StringHelper::appendBin( maLine, nData, bDots ); }
+ template< typename Type >
+ inline void writeFix( Type nData, sal_Int32 nWidth = 0 )
+ { StringHelper::appendFix( maLine, nData, nWidth ); }
+ template< typename Type >
+ inline void writeValue( Type nData, FormatType eFmtType )
+ { StringHelper::appendValue( maLine, nData, eFmtType ); }
+ template< typename Type >
+ inline void writeName( const Config& rCfg, Type nData, const NameListWrapper& rListWrp )
+ { writeString( rCfg.getName( rListWrp, nData ) ); }
+
+ // ------------------------------------------------------------------------
+protected:
+ virtual bool implIsValid() const;
+
+private:
+ void writeItemName( const String& rItemName );
+
+private:
+ typedef ::std::vector< sal_Int32 > StringLenVec;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextOutputStream2 > mxStrm;
+ OUString maIndent;
+ OUStringBuffer maLine;
+ OUString maLastItem;
+ StringLenVec maColPos;
+ size_t mnCol;
+ size_t mnItemLevel;
+ size_t mnMultiLevel;
+ sal_Int64 mnItemIdx;
+ sal_Int32 mnLastItem;
+};
+
+typedef ::boost::shared_ptr< Output > OutputRef;
+
+// ============================================================================
+
+class IndentGuard
+{
+public:
+ inline explicit IndentGuard( const OutputRef& rxOut ) : mrOut( *rxOut ) { mrOut.incIndent(); }
+ inline ~IndentGuard() { mrOut.decIndent(); }
+private:
+ IndentGuard( const IndentGuard& );
+ IndentGuard& operator=( const IndentGuard& );
+private:
+ Output& mrOut;
+};
+
+// ----------------------------------------------------------------------------
+
+class TableGuard
+{
+public:
+ inline explicit TableGuard( const OutputRef& rxOut, sal_Int32 nW1 ) :
+ mrOut( *rxOut ) { mrOut.startTable( nW1 ); }
+ inline explicit TableGuard( const OutputRef& rxOut, sal_Int32 nW1, sal_Int32 nW2 ) :
+ mrOut( *rxOut ) { mrOut.startTable( nW1, nW2 ); }
+ inline explicit TableGuard( const OutputRef& rxOut, sal_Int32 nW1, sal_Int32 nW2, sal_Int32 nW3, sal_Int32 nW4 ) :
+ mrOut( *rxOut ) { mrOut.startTable( nW1, nW2, nW3, nW4 ); }
+ inline explicit TableGuard( const OutputRef& rxOut, size_t nColCount,
+ const sal_Int32* pnColWidths ) :
+ mrOut( *rxOut ) { mrOut.startTable( nColCount, pnColWidths ); }
+ inline ~TableGuard() { mrOut.endTable(); }
+ inline void tab() { mrOut.tab(); }
+ inline void tab( size_t nCol ) { mrOut.tab( nCol ); }
+private:
+ TableGuard( const TableGuard& );
+ TableGuard& operator=( const TableGuard& );
+private:
+ Output& mrOut;
+};
+
+// ----------------------------------------------------------------------------
+
+class ItemGuard
+{
+public:
+ inline explicit ItemGuard( const OutputRef& rxOut, const String& rName = EMPTY_STRING ) :
+ mrOut( *rxOut ) { mrOut.startItem( rName ); }
+ inline ~ItemGuard() { mrOut.endItem(); }
+ inline void cont() { mrOut.contItem(); }
+private:
+ ItemGuard( const ItemGuard& );
+ ItemGuard& operator=( const ItemGuard& );
+private:
+ Output& mrOut;
+};
+
+// ----------------------------------------------------------------------------
+
+class MultiItemsGuard
+{
+public:
+ inline explicit MultiItemsGuard( const OutputRef& rxOut ) : mrOut( *rxOut ) { mrOut.startMultiItems(); }
+ inline ~MultiItemsGuard() { mrOut.endMultiItems(); }
+private:
+ MultiItemsGuard( const MultiItemsGuard& );
+ MultiItemsGuard& operator=( const MultiItemsGuard& );
+private:
+ Output& mrOut;
+};
+
+// ============================================================================
+
+class StorageIterator : public Base
+{
+public:
+ explicit StorageIterator( const StorageRef& rxStrg );
+ virtual ~StorageIterator();
+
+ StorageIterator& operator++();
+
+ OUString getName() const;
+ bool isStream() const;
+ bool isStorage() const;
+
+private:
+ virtual bool implIsValid() const;
+
+private:
+ StorageRef mxStrg;
+ OUStringVector maNames;
+ OUStringVector::const_iterator maIt;
+};
+
+// ============================================================================
+// ============================================================================
+
+class ObjectBase : public Base
+{
+public:
+ virtual ~ObjectBase();
+
+ inline const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&
+ getContext() const { return mxConfig->getContext(); }
+
+ void dump();
+
+ // ------------------------------------------------------------------------
+protected:
+ inline explicit ObjectBase() {}
+
+ void construct( const ConfigRef& rxConfig );
+ void construct( const ObjectBase& rParent );
+
+ virtual bool implIsValid() const;
+ virtual void implDump();
+
+ // ------------------------------------------------------------------------
+
+ inline Config& cfg() const { return *mxConfig; }
+
+private:
+ ConfigRef mxConfig;
+};
+
+typedef ::boost::shared_ptr< ObjectBase > ObjectRef;
+
+// ============================================================================
+// ============================================================================
+
+class StorageObjectBase : public ObjectBase
+{
+protected:
+ inline explicit StorageObjectBase() {}
+
+protected:
+ using ObjectBase::construct;
+ void construct( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath );
+ void construct( const ObjectBase& rParent );
+
+ virtual bool implIsValid() const;
+ virtual void implDump();
+
+ virtual void implDumpStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName );
+
+ virtual void implDumpStorage(
+ const StorageRef& rxStrg,
+ const OUString& rStrgPath,
+ const OUString& rSysPath );
+
+ virtual void implDumpBaseStream(
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName );
+
+ void addPreferredStream( const String& rStrmName );
+ void addPreferredStorage( const String& rStrgPath );
+
+private:
+ OUString getSysFileName(
+ const OUString& rStrmName,
+ const OUString& rSysOutPath );
+
+ void extractStream(
+ StorageBase& rStrg,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName );
+ void extractStorage(
+ const StorageRef& rxStrg,
+ const OUString& rStrgPath,
+ const OUString& rSysPath );
+
+ void extractItem(
+ const StorageRef& rxStrg,
+ const OUString& rStrgPath,
+ const OUString& rItemName,
+ const OUString& rSysPath,
+ bool bIsStrg, bool bIsStrm );
+
+private:
+ struct PreferredItem
+ {
+ OUString maName;
+ bool mbStorage;
+
+ inline explicit PreferredItem( const OUString rName, bool bStorage ) :
+ maName( rName ), mbStorage( bStorage ) {}
+ };
+ typedef ::std::vector< PreferredItem > PreferredItemVector;
+
+ StorageRef mxStrg;
+ OUString maSysPath;
+ PreferredItemVector maPreferred;
+};
+
+typedef ::boost::shared_ptr< StorageObjectBase > StorageObjectRef;
+
+// ============================================================================
+// ============================================================================
+
+class OutputObjectBase : public ObjectBase
+{
+public:
+ virtual ~OutputObjectBase();
+
+ // ------------------------------------------------------------------------
+protected:
+ inline explicit OutputObjectBase() {}
+
+ using ObjectBase::construct;
+ void construct( const ObjectBase& rParent, const OUString& rSysFileName );
+ void construct( const OutputObjectBase& rParent );
+
+ virtual bool implIsValid() const;
+
+ // ------------------------------------------------------------------------
+
+ void writeEmptyItem( const String& rName );
+ void writeInfoItem( const String& rName, const String& rData );
+ void writeCharItem( const String& rName, sal_Unicode cData );
+ void writeStringItem( const String& rName, const OUString& rData );
+ void writeArrayItem( const String& rName, const sal_uInt8* pnData, sal_Size nSize, sal_Unicode cSep = OOX_DUMP_LISTSEP );
+ void writeDateTimeItem( const String& rName, const ::com::sun::star::util::DateTime& rDateTime );
+ void writeGuidItem( const String& rName, const OUString& rGuid );
+
+ template< typename Type >
+ void addNameToItem( Type nData, const NameListWrapper& rListWrp );
+
+ template< typename Type >
+ void writeNameItem( const String& rName, Type nData, const NameListWrapper& rListWrp );
+ template< typename Type >
+ void writeDecItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ void writeHexItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ void writeShortHexItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ void writeBinItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ void writeFixItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ void writeDecBoolItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ void writeValueItem( const String& rName, Type nData, FormatType eFmtType, const NameListWrapper& rListWrp = NO_LIST );
+
+ template< typename Type >
+ void writeValueItem( const ItemFormat& rItemFmt, Type nData );
+
+ template< typename Type >
+ void writeDecPairItem( const String& rName, Type nData1, Type nData2, sal_Unicode cSep = ',' );
+ template< typename Type >
+ void writeHexPairItem( const String& rName, Type nData1, Type nData2, sal_Unicode cSep = ',' );
+
+protected:
+ OutputRef mxOut;
+ OUString maSysFileName;
+};
+
+typedef ::boost::shared_ptr< OutputObjectBase > OutputObjectRef;
+
+// ----------------------------------------------------------------------------
+
+template< typename Type >
+void OutputObjectBase::addNameToItem( Type nData, const NameListWrapper& rListWrp )
+{
+ if( !rListWrp.isEmpty() )
+ {
+ mxOut->contItem();
+ mxOut->writeName( cfg(), nData, rListWrp );
+ }
+}
+
+template< typename Type >
+void OutputObjectBase::writeNameItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeName( cfg(), nData, rListWrp );
+}
+
+template< typename Type >
+void OutputObjectBase::writeDecItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeDec( nData );
+ addNameToItem( nData, rListWrp );
+}
+
+template< typename Type >
+void OutputObjectBase::writeHexItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeHex( nData );
+ addNameToItem( nData, rListWrp );
+}
+
+template< typename Type >
+void OutputObjectBase::writeShortHexItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeShortHex( nData );
+ addNameToItem( nData, rListWrp );
+}
+
+template< typename Type >
+void OutputObjectBase::writeBinItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeBin( nData );
+ addNameToItem( nData, rListWrp );
+}
+
+template< typename Type >
+void OutputObjectBase::writeFixItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeFix( nData );
+ addNameToItem( nData, rListWrp );
+}
+
+template< typename Type >
+void OutputObjectBase::writeDecBoolItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeDec( nData );
+ aItem.cont();
+ mxOut->writeBool( nData != 0 );
+ addNameToItem( nData, rListWrp );
+}
+
+template< typename Type >
+void OutputObjectBase::writeValueItem( const String& rName, Type nData, FormatType eFmtType, const NameListWrapper& rListWrp )
+{
+ if( eFmtType == FORMATTYPE_BOOL )
+ writeDecBoolItem( rName, nData, rListWrp );
+ else
+ {
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeValue( nData, eFmtType );
+ addNameToItem( nData, rListWrp );
+ }
+}
+
+template< typename Type >
+void OutputObjectBase::writeValueItem( const ItemFormat& rItemFmt, Type nData )
+{
+ OString aNameUtf8 = StringHelper::convertToUtf8( rItemFmt.maItemName );
+ writeValueItem( aNameUtf8.getStr(), nData, rItemFmt.meFmtType, rItemFmt.maListName );
+}
+
+template< typename Type >
+void OutputObjectBase::writeDecPairItem( const String& rName, Type nData1, Type nData2, sal_Unicode cSep )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeDec( nData1 );
+ mxOut->writeChar( cSep );
+ mxOut->writeDec( nData2 );
+}
+
+template< typename Type >
+void OutputObjectBase::writeHexPairItem( const String& rName, Type nData1, Type nData2, sal_Unicode cSep )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeHex( nData1 );
+ mxOut->writeChar( cSep );
+ mxOut->writeHex( nData2 );
+}
+
+// ============================================================================
+// ============================================================================
+
+class InputObjectBase : public OutputObjectBase
+{
+public:
+ virtual ~InputObjectBase();
+
+ // ------------------------------------------------------------------------
+protected:
+ inline explicit InputObjectBase() {}
+
+ using OutputObjectBase::construct;
+ void construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName );
+ void construct( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm );
+ void construct( const InputObjectBase& rParent );
+
+ virtual bool implIsValid() const;
+
+ // ------------------------------------------------------------------------
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ getXInputStream() const;
+
+ // ------------------------------------------------------------------------
+
+ void skipBlock( sal_Int64 nBytes, bool bShowSize = true );
+ void dumpRawBinary( sal_Int64 nBytes, bool bShowOffset = true, bool bStream = false );
+
+ void dumpBinary( const String& rName, sal_Int64 nBytes, bool bShowOffset = true );
+ void dumpRemaining( sal_Int64 nBytes );
+ void dumpRemainingTo( sal_Int64 nPos );
+ void dumpRemainingStream();
+
+ void dumpArray( const String& rName, sal_Int32 nBytes, sal_Unicode cSep = OOX_DUMP_LISTSEP );
+ inline void dumpUnused( sal_Int32 nBytes ) { dumpArray( OOX_DUMP_UNUSED, nBytes ); }
+ inline void dumpUnknown( sal_Int32 nBytes ) { dumpArray( OOX_DUMP_UNKNOWN, nBytes ); }
+
+ sal_Unicode dumpUnicode( const String& rName );
+
+ OUString dumpCharArray( const String& rName, sal_Int32 nLen, rtl_TextEncoding eTextEnc, bool bHideTrailingNul = false );
+ OUString dumpUnicodeArray( const String& rName, sal_Int32 nLen, bool bHideTrailingNul = false );
+
+ ::com::sun::star::util::DateTime dumpFileTime( const String& rName = EMPTY_STRING );
+ OUString dumpGuid( const String& rName = EMPTY_STRING );
+
+ void dumpItem( const ItemFormat& rItemFmt );
+
+ template< typename Type >
+ Type dumpName( const String& rName, const NameListWrapper& rListWrp );
+ template< typename Type >
+ Type dumpDec( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ Type dumpHex( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ Type dumpBin( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ Type dumpFix( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ Type dumpBool( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ Type dumpValue( const ItemFormat& rItemFmt );
+
+ template< typename Type1, typename Type2 >
+ Type1 dumpName( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type1, typename Type2 >
+ Type1 dumpDec( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type1, typename Type2 >
+ Type1 dumpHex( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type1, typename Type2 >
+ Type1 dumpBin( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type1, typename Type2 >
+ Type1 dumpFix( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type1, typename Type2 >
+ Type1 dumpBool( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type1, typename Type2 >
+ Type1 dumpValue( bool bType1, const ItemFormat& rItemFmt );
+
+ template< typename Type >
+ void dumpDecPair( const String& rName, sal_Unicode cSep = ',' );
+ template< typename Type >
+ void dumpHexPair( const String& rName, sal_Unicode cSep = ',' );
+
+protected:
+ BinaryInputStreamRef mxStrm;
+};
+
+typedef ::boost::shared_ptr< InputObjectBase > InputObjectRef;
+
+// ----------------------------------------------------------------------------
+
+template< typename Type >
+Type InputObjectBase::dumpName( const String& rName, const NameListWrapper& rListWrp )
+{
+ Type nData;
+ *mxStrm >> nData;
+ writeNameItem( rName, nData, rListWrp );
+ return nData;
+}
+
+template< typename Type >
+Type InputObjectBase::dumpDec( const String& rName, const NameListWrapper& rListWrp )
+{
+ Type nData;
+ *mxStrm >> nData;
+ writeDecItem( rName, nData, rListWrp );
+ return nData;
+}
+
+template< typename Type >
+Type InputObjectBase::dumpHex( const String& rName, const NameListWrapper& rListWrp )
+{
+ Type nData;
+ *mxStrm >> nData;
+ writeHexItem( rName, nData, rListWrp );
+ return nData;
+}
+
+template< typename Type >
+Type InputObjectBase::dumpBin( const String& rName, const NameListWrapper& rListWrp )
+{
+ Type nData;
+ *mxStrm >> nData;
+ writeBinItem( rName, nData, rListWrp );
+ return nData;
+}
+
+template< typename Type >
+Type InputObjectBase::dumpFix( const String& rName, const NameListWrapper& rListWrp )
+{
+ Type nData;
+ *mxStrm >> nData;
+ writeFixItem( rName, nData, rListWrp );
+ return nData;
+}
+
+template< typename Type >
+Type InputObjectBase::dumpBool( const String& rName, const NameListWrapper& rListWrp )
+{
+ Type nData;
+ *mxStrm >> nData;
+ writeDecBoolItem( rName, nData, rListWrp );
+ return nData;
+}
+
+template< typename Type >
+Type InputObjectBase::dumpValue( const ItemFormat& rItemFmt )
+{
+ Type nData;
+ *mxStrm >> nData;
+ writeValueItem( rItemFmt, nData );
+ return nData;
+}
+
+template< typename Type1, typename Type2 >
+Type1 InputObjectBase::dumpName( bool bType1, const String& rName, const NameListWrapper& rListWrp )
+{
+ return bType1 ? dumpName< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpName< Type2 >( rName, rListWrp ) );
+}
+
+template< typename Type1, typename Type2 >
+Type1 InputObjectBase::dumpDec( bool bType1, const String& rName, const NameListWrapper& rListWrp )
+{
+ return bType1 ? dumpDec< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpDec< Type2 >( rName, rListWrp ) );
+}
+
+template< typename Type1, typename Type2 >
+Type1 InputObjectBase::dumpHex( bool bType1, const String& rName, const NameListWrapper& rListWrp )
+{
+ return bType1 ? dumpHex< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpHex< Type2 >( rName, rListWrp ) );
+}
+
+template< typename Type1, typename Type2 >
+Type1 InputObjectBase::dumpBin( bool bType1, const String& rName, const NameListWrapper& rListWrp )
+{
+ return bType1 ? dumpBin< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpBin< Type2 >( rName, rListWrp ) );
+}
+
+template< typename Type1, typename Type2 >
+Type1 InputObjectBase::dumpFix( bool bType1, const String& rName, const NameListWrapper& rListWrp )
+{
+ return bType1 ? dumpFix< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpFix< Type2 >( rName, rListWrp ) );
+}
+
+template< typename Type1, typename Type2 >
+Type1 InputObjectBase::dumpBool( bool bType1, const String& rName, const NameListWrapper& rListWrp )
+{
+ return bType1 ? dumpBool< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpBool< Type2 >( rName, rListWrp ) );
+}
+
+template< typename Type1, typename Type2 >
+Type1 InputObjectBase::dumpValue( bool bType1, const ItemFormat& rItemFmt )
+{
+ return bType1 ? dumpValue< Type1 >( rItemFmt ) : static_cast< Type1 >( dumpValue< Type2 >( rItemFmt ) );
+}
+
+template< typename Type >
+void InputObjectBase::dumpDecPair( const String& rName, sal_Unicode cSep )
+{
+ Type nData1, nData2;
+ *mxStrm >> nData1 >> nData2;
+ writeDecPairItem( rName, nData1, nData2, cSep );
+}
+
+template< typename Type >
+void InputObjectBase::dumpHexPair( const String& rName, sal_Unicode cSep )
+{
+ Type nData1, nData2;
+ *mxStrm >> nData1 >> nData2;
+ writeHexPairItem( rName, nData1, nData2, cSep );
+}
+
+// ============================================================================
+// ============================================================================
+
+class BinaryStreamObject : public InputObjectBase
+{
+public:
+ explicit BinaryStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName );
+
+protected:
+ void dumpBinaryStream( bool bShowOffset = true );
+
+ virtual void implDump();
+};
+
+// ============================================================================
+// ============================================================================
+
+class TextStreamObjectBase : public InputObjectBase
+{
+protected:
+ inline TextStreamObjectBase() {}
+
+ using InputObjectBase::construct;
+ void construct(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ rtl_TextEncoding eTextEnc,
+ const OUString& rSysFileName );
+ void construct(
+ const OutputObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ rtl_TextEncoding eTextEnc );
+
+ virtual bool implIsValid() const;
+ virtual void implDump();
+
+ virtual void implDumpText( TextInputStream& rTextStrm ) = 0;
+
+private:
+ void constructTextStrmObj( rtl_TextEncoding eTextEnc );
+
+protected:
+ ::boost::shared_ptr< TextInputStream > mxTextStrm;
+};
+
+// ============================================================================
+
+class TextLineStreamObject : public TextStreamObjectBase
+{
+public:
+ explicit TextLineStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ rtl_TextEncoding eTextEnc,
+ const OUString& rSysFileName );
+
+ explicit TextLineStreamObject(
+ const OutputObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ rtl_TextEncoding eTextEnc );
+
+protected:
+ virtual void implDumpText( TextInputStream& rTextStrm );
+ virtual void implDumpLine( const OUString& rLine, sal_uInt32 nLine );
+};
+
+// ============================================================================
+
+class XmlStreamObject : public TextStreamObjectBase
+{
+public:
+ explicit XmlStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName );
+
+protected:
+ virtual void implDumpText( TextInputStream& rTextStrm );
+};
+
+// ============================================================================
+// ============================================================================
+
+class RecordObjectBase : public InputObjectBase
+{
+protected:
+ inline explicit RecordObjectBase() {}
+
+ using InputObjectBase::construct;
+ void construct(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxBaseStrm,
+ const OUString& rSysFileName,
+ const BinaryInputStreamRef& rxRecStrm,
+ const String& rRecNames,
+ const String& rSimpleRecs = EMPTY_STRING );
+
+ inline sal_Int64 getRecPos() const { return mnRecPos; }
+ inline sal_Int64 getRecId() const { return mnRecId; }
+ inline sal_Int64 getRecSize() const { return mnRecSize; }
+ inline NameListRef getRecNames() const { return maRecNames.getNameList( cfg() ); }
+
+ inline void setBinaryOnlyMode( bool bBinaryOnly ) { mbBinaryOnly = bBinaryOnly; }
+ inline bool isBinaryOnlyMode() const { return mbBinaryOnly; }
+
+ virtual bool implIsValid() const;
+ virtual void implDump();
+
+ virtual bool implStartRecord( BinaryInputStream& rBaseStrm, sal_Int64& ornRecPos, sal_Int64& ornRecId, sal_Int64& ornRecSize ) = 0;
+ virtual void implWriteExtHeader();
+ virtual void implDumpRecordBody();
+
+private:
+ void constructRecObjBase(
+ const BinaryInputStreamRef& rxBaseStrm,
+ const String& rRecNames,
+ const String& rSimpleRecs );
+
+ void writeHeader();
+
+private:
+ BinaryInputStreamRef mxBaseStrm;
+ NameListWrapper maRecNames;
+ NameListWrapper maSimpleRecs;
+ sal_Int64 mnRecPos;
+ sal_Int64 mnRecId;
+ sal_Int64 mnRecSize;
+ bool mbShowRecPos;
+ bool mbBinaryOnly;
+};
+
+// ============================================================================
+
+class SequenceRecordObjectBase : public RecordObjectBase
+{
+protected:
+ inline explicit SequenceRecordObjectBase() : mxRecData( new StreamDataSequence ) {}
+
+ inline StreamDataSequence& getRecordDataSequence() { return *mxRecData; }
+
+ using RecordObjectBase::construct;
+ void construct(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxBaseStrm,
+ const OUString& rSysFileName,
+ const String& rRecNames,
+ const String& rSimpleRecs = EMPTY_STRING );
+
+ virtual bool implStartRecord( BinaryInputStream& rBaseStrm, sal_Int64& ornRecPos, sal_Int64& ornRecId, sal_Int64& ornRecSize );
+ virtual bool implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize ) = 0;
+
+private:
+ typedef ::boost::shared_ptr< StreamDataSequence > StreamDataSeqRef;
+ StreamDataSeqRef mxRecData;
+};
+
+// ============================================================================
+// ============================================================================
+
+/** Base class for a file dumper. Derived classes implement the implDump()
+ function to add functionality.
+ */
+class DumperBase : public ObjectBase
+{
+public:
+ virtual ~DumperBase();
+
+ bool isImportEnabled() const;
+ bool isImportCancelled() const;
+
+protected:
+ inline explicit DumperBase() {}
+
+ using ObjectBase::construct;
+ void construct( const ConfigRef& rxConfig );
+};
+
+// ============================================================================
+// ============================================================================
+
+} // namespace dump
+} // namespace oox
+
+#define OOX_DUMP_FILE( DumperClassName ) \
+do { \
+ DumperClassName aDumper( *this ); \
+ aDumper.dump(); \
+ bool bCancelled = aDumper.isImportCancelled(); \
+ if( !aDumper.isImportEnabled() || bCancelled ) \
+ return aDumper.isValid() && !bCancelled; \
+} while( false )
+
+#else // OOX_INCLUDE_DUMPER
+
+#define OOX_DUMP_FILE( DumperClassName ) (void)0
+
+#endif // OOX_INCLUDE_DUMPER
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/dump/oledumper.hxx b/include/oox/dump/oledumper.hxx
new file mode 100644
index 000000000000..b58500ef8f3c
--- /dev/null
+++ b/include/oox/dump/oledumper.hxx
@@ -0,0 +1,905 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DUMP_OLEDUMPER_HXX
+#define OOX_DUMP_OLEDUMPER_HXX
+
+#include "oox/helper/storagebase.hxx"
+#include "oox/dump/dumperbase.hxx"
+
+#if OOX_INCLUDE_DUMPER
+
+namespace com { namespace sun { namespace star {
+ namespace io { class XInputStream; }
+} } }
+
+namespace oox {
+namespace dump {
+
+// ============================================================================
+// ============================================================================
+
+class OleInputObjectBase : public InputObjectBase
+{
+protected:
+ inline explicit OleInputObjectBase() {}
+
+ OUString dumpAnsiString32( const String& rName );
+ OUString dumpUniString32( const String& rName );
+
+ sal_Int32 dumpStdClipboardFormat( const String& rName = EMPTY_STRING );
+ OUString dumpAnsiString32OrStdClip( const String& rName );
+ OUString dumpUniString32OrStdClip( const String& rName );
+
+ void writeOleColorItem( const String& rName, sal_uInt32 nColor );
+ sal_uInt32 dumpOleColor( const String& rName );
+};
+
+// ============================================================================
+// ============================================================================
+
+class StdFontObject : public OleInputObjectBase
+{
+public:
+ explicit StdFontObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDump();
+};
+
+// ============================================================================
+
+class StdPicObject : public OleInputObjectBase
+{
+public:
+ explicit StdPicObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDump();
+};
+
+// ============================================================================
+// ============================================================================
+
+class OleStreamObject : public OleInputObjectBase
+{
+public:
+ explicit OleStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName );
+};
+
+// ============================================================================
+
+class OleCompObjObject : public OleStreamObject
+{
+public:
+ explicit OleCompObjObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName );
+
+protected:
+ virtual void implDump();
+};
+
+// ============================================================================
+// ============================================================================
+
+class OlePropertyStreamObject : public InputObjectBase
+{
+public:
+ explicit OlePropertyStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName );
+
+protected:
+ virtual void implDump();
+
+private:
+ void dumpSection( const OUString& rGuid, sal_uInt32 nStartPos );
+
+ void dumpProperty( sal_Int32 nPropId, sal_uInt32 nStartPos );
+ void dumpCodePageProperty( sal_uInt32 nStartPos );
+ void dumpDictionaryProperty( sal_uInt32 nStartPos );
+
+ sal_uInt16 dumpPropertyContents( sal_Int32 nPropId );
+ void dumpPropertyValue( sal_Int32 nPropId, sal_uInt16 nBaseType );
+ void dumpPropertyVector( sal_Int32 nPropId, sal_uInt16 nBaseType );
+ void dumpPropertyArray( sal_Int32 nPropId, sal_uInt16 nBaseType );
+
+ sal_uInt16 dumpPropertyType();
+ void dumpBlob( sal_Int32 nPropId, const String& rName );
+ OUString dumpString8( const String& rName );
+ OUString dumpCharArray8( const String& rName, sal_Int32 nLen );
+ OUString dumpString16( const String& rName );
+ OUString dumpCharArray16( const String& rName, sal_Int32 nLen );
+ bool dumpTypedProperty( const String& rName, sal_uInt16 nExpectedType );
+ void dumpHlinks( sal_Int32 nSize );
+
+ bool startElement( sal_uInt32 nStartPos );
+ void writeSectionHeader( const OUString& rGuid, sal_uInt32 nStartPos );
+ void writePropertyHeader( sal_Int32 nPropId, sal_uInt32 nStartPos );
+
+private:
+ NameListRef mxPropIds;
+ rtl_TextEncoding meTextEnc;
+ bool mbIsUnicode;
+};
+
+// ============================================================================
+
+class OleStorageObject : public StorageObjectBase
+{
+public:
+ explicit OleStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath );
+
+protected:
+ inline explicit OleStorageObject() {}
+
+ using StorageObjectBase::construct;
+ void construct( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath );
+
+ virtual void implDumpStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName );
+};
+
+// ============================================================================
+// ============================================================================
+
+class ComCtlObjectBase : public OleInputObjectBase
+{
+protected:
+ explicit ComCtlObjectBase(
+ const InputObjectBase& rParent,
+ sal_uInt32 nDataId5, sal_uInt32 nDataId6, sal_uInt16 nVersion,
+ bool bCommonPart, bool bComplexPart );
+
+ virtual void implDump();
+ virtual void implDumpProperties() = 0;
+ virtual void implDumpCommonExtra( sal_Int64 nEndPos );
+ virtual void implDumpCommonTrailing();
+
+private:
+ bool dumpComCtlHeader( sal_uInt32 nExpId, sal_uInt16 nExpMajor = SAL_MAX_UINT16, sal_uInt16 nExpMinor = SAL_MAX_UINT16 );
+ bool dumpComCtlSize();
+ bool dumpComCtlData( sal_uInt32& ornCommonPartSize );
+ bool dumpComCtlCommon( sal_uInt32 nPartSize );
+ bool dumpComCtlComplex();
+
+protected:
+ sal_uInt32 mnDataId5;
+ sal_uInt32 mnDataId6;
+ sal_uInt16 mnVersion;
+ bool mbCommonPart;
+ bool mbComplexPart;
+};
+
+// ============================================================================
+
+class ComCtlScrollBarObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlScrollBarObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties();
+};
+
+// ============================================================================
+
+class ComCtlProgressBarObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlProgressBarObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties();
+};
+
+// ============================================================================
+
+class ComCtlSliderObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlSliderObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties();
+};
+
+// ============================================================================
+
+class ComCtlUpDownObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlUpDownObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties();
+};
+
+// ============================================================================
+
+class ComCtlImageListObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlImageListObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties();
+ virtual void implDumpCommonExtra( sal_Int64 nEndPos );
+ virtual void implDumpCommonTrailing();
+};
+
+// ============================================================================
+
+class ComCtlTabStripObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlTabStripObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties();
+ virtual void implDumpCommonExtra( sal_Int64 nEndPos );
+};
+
+// ============================================================================
+
+class ComCtlTreeViewObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlTreeViewObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties();
+ virtual void implDumpCommonExtra( sal_Int64 nEndPos );
+
+private:
+ sal_uInt32 mnStringFlags;
+};
+
+// ============================================================================
+
+class ComCtlStatusBarObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlStatusBarObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties();
+ virtual void implDumpCommonExtra( sal_Int64 nEndPos );
+ virtual void implDumpCommonTrailing();
+};
+
+// ============================================================================
+// ============================================================================
+
+class AxPropertyObjectBase : public OleInputObjectBase
+{
+protected:
+ inline explicit AxPropertyObjectBase() {}
+
+ using OleInputObjectBase::construct;
+ void construct(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName,
+ const String& rPropNameList,
+ bool b64BitPropFlags = false );
+ void construct(
+ const InputObjectBase& rParent,
+ const String& rPropNameList,
+ bool b64BitPropFlags = false );
+
+ virtual bool implIsValid() const;
+ virtual void implDump();
+
+ virtual void implDumpShortProperties();
+ virtual void implDumpExtended();
+
+ bool ensureValid( bool bCondition = true );
+
+ template< typename Type >
+ void alignInput();
+
+ void setAlignAnchor();
+ bool startNextProperty();
+ OUString getPropertyName() const;
+
+ template< typename Type >
+ Type dumpDecProperty( Type nDefault, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ Type dumpHexProperty( Type nDefault, const NameListWrapper& rListWrp = NO_LIST );
+
+ inline bool dumpBoolProperty() { return startNextProperty(); }
+ inline sal_Int32 dumpHmmProperty() { return dumpDecProperty< sal_Int32 >( 0, "CONV-HMM-TO-CM" ); }
+ inline sal_uInt8 dumpMousePtrProperty() { return dumpDecProperty< sal_uInt8 >( 0, "OLE-MOUSEPTR" ); }
+ template< typename Type >
+ inline Type dumpBorderStyleProperty( Type nDefault ) { return dumpDecProperty< Type >( nDefault, "AX-BORDERSTYLE" ); }
+ template< typename Type >
+ inline Type dumpSpecialEffectProperty( Type nDefault ) { return dumpDecProperty< Type >( nDefault, "AX-SPECIALEFFECT" ); }
+ inline sal_uInt32 dumpEnabledProperty() { return dumpDecProperty< sal_uInt32 >( 1, "AX-ENABLED" ); }
+ inline sal_Int32 dumpOrientationProperty() { return dumpDecProperty< sal_Int32 >( -1, "AX-ORIENTATION" ); }
+ inline sal_Int32 dumpDelayProperty() { return dumpDecProperty< sal_Int32 >( 50, "AX-CONV-MS" ); }
+ inline sal_uInt32 dumpImagePosProperty() { return dumpHexProperty< sal_uInt32 >( 0x00070001, "AX-IMAGEPOS" ); }
+ inline sal_uInt8 dumpImageSizeModeProperty() { return dumpDecProperty< sal_uInt8 >( 0, "AX-IMAGESIZEMODE" ); }
+ inline sal_uInt8 dumpImageAlignProperty() { return dumpDecProperty< sal_uInt8 >( 2, "AX-IMAGEALIGN" ); }
+
+ sal_uInt32 dumpFlagsProperty( sal_uInt32 nDefault, const sal_Char* pcNameList = "AX-FLAGS" );
+ sal_uInt32 dumpColorProperty( sal_uInt32 nDefault );
+ sal_Unicode dumpUnicodeProperty();
+ void dumpUnknownProperty();
+
+ void dumpPosProperty();
+ void dumpSizeProperty();
+ void dumpGuidProperty( OUString* pValue = 0 );
+ void dumpStringProperty( OUString* pValue = 0 );
+ void dumpStringArrayProperty();
+ void dumpStreamProperty();
+
+ void dumpEmbeddedFont();
+ void dumpToPosition( sal_Int64 nPos );
+
+private:
+ void constructAxPropObj( const String& rPropNameList, bool b64BitPropFlags );
+
+ void dumpVersion();
+ OUString dumpString( const String& rName, sal_uInt32 nSize, bool bArray );
+ void dumpShortProperties();
+ void dumpLargeProperties();
+
+private:
+ struct LargeProperty
+ {
+ enum LargePropertyType { PROPTYPE_POS, PROPTYPE_SIZE, PROPTYPE_GUID, PROPTYPE_STRING, PROPTYPE_STRINGARRAY };
+
+ LargePropertyType mePropType;
+ OUString maItemName;
+ sal_uInt32 mnDataSize;
+ OUString* mpItemValue;
+ inline explicit LargeProperty( LargePropertyType ePropType, const String& rItemName, sal_uInt32 nDataSize, OUString* pItemValue = 0 ) :
+ mePropType( ePropType ), maItemName( rItemName ), mnDataSize( nDataSize ), mpItemValue( pItemValue ) {}
+ };
+ typedef ::std::vector< LargeProperty > LargePropertyVector;
+
+ struct StreamProperty
+ {
+ OUString maItemName;
+ sal_uInt16 mnData;
+ inline explicit StreamProperty( const String& rItemName, sal_uInt16 nData ) :
+ maItemName( rItemName ), mnData( nData ) {}
+ };
+ typedef ::std::vector< StreamProperty > StreamPropertyVector;
+
+ LargePropertyVector maLargeProps;
+ StreamPropertyVector maStreamProps;
+ NameListRef mxPropNames;
+ sal_Int64 mnPropertiesStart;
+ sal_Int64 mnPropertiesEnd;
+ sal_Int64 mnPropFlags;
+ sal_Int64 mnCurrProp;
+ bool mb64BitPropFlags;
+ bool mbValid;
+};
+
+// ----------------------------------------------------------------------------
+
+template< typename Type >
+void AxPropertyObjectBase::alignInput()
+{
+ mxStrm->skip( (sizeof( Type ) - ((mxStrm->tell() - mnPropertiesStart) % sizeof( Type ))) % sizeof( Type ) );
+}
+
+template< typename Type >
+Type AxPropertyObjectBase::dumpDecProperty( Type nDefault, const NameListWrapper& rListWrp )
+{
+ if( startNextProperty() )
+ {
+ alignInput< Type >();
+ return dumpDec< Type >( getPropertyName(), rListWrp );
+ }
+ return nDefault;
+}
+
+template< typename Type >
+Type AxPropertyObjectBase::dumpHexProperty( Type nDefault, const NameListWrapper& rListWrp )
+{
+ if( startNextProperty() )
+ {
+ alignInput< Type >();
+ return dumpHex< Type >( getPropertyName(), rListWrp );
+ }
+ return nDefault;
+}
+
+// ============================================================================
+
+class AxCFontNewObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxCFontNewObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+};
+
+// ============================================================================
+
+class AxColumnInfoObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxColumnInfoObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+};
+
+// ============================================================================
+
+class AxCommandButtonObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxCommandButtonObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+ virtual void implDumpExtended();
+};
+
+// ============================================================================
+
+class AxMorphControlObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxMorphControlObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+ virtual void implDumpExtended();
+
+private:
+ void dumpColumnInfos();
+
+private:
+ sal_uInt16 mnColInfoCount;
+ sal_uInt8 mnCtrlType;
+};
+
+// ============================================================================
+
+class AxLabelObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxLabelObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+ virtual void implDumpExtended();
+};
+
+// ============================================================================
+
+class AxImageObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxImageObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+};
+
+// ============================================================================
+
+class AxScrollBarObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxScrollBarObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+};
+
+// ============================================================================
+
+class AxSpinButtonObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxSpinButtonObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+};
+
+// ============================================================================
+
+class AxTabStripObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxTabStripObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+ virtual void implDumpExtended();
+
+private:
+ sal_Int32 mnTabFlagCount;
+};
+
+// ============================================================================
+// ============================================================================
+
+class FormControlStreamObject : public OleInputObjectBase
+{
+public:
+ explicit FormControlStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName,
+ const OUString* pProgId = 0 );
+ explicit FormControlStreamObject(
+ const OutputObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString* pProgId = 0 );
+
+protected:
+ virtual void implDump();
+
+private:
+ void constructFormCtrlStrmObj( const OUString* pProgId );
+
+private:
+ OUString maProgId;
+ bool mbReadGuid;
+};
+
+// ============================================================================
+// ============================================================================
+
+struct VbaFormSiteInfo
+{
+ OUString maProgId;
+ sal_Int32 mnId;
+ sal_uInt32 mnLength;
+ bool mbInStream;
+
+ inline explicit VbaFormSiteInfo() : mnId( 0 ), mnLength( 0 ), mbInStream( false ) {}
+};
+
+typedef ::std::vector< VbaFormSiteInfo > VbaFormSiteInfoVector;
+
+// ============================================================================
+
+struct VbaFormSharedData
+{
+ OUStringVector maClassInfoProgIds;
+ VbaFormSiteInfoVector maSiteInfos;
+};
+
+// ============================================================================
+
+class VbaFormClassInfoObject : public AxPropertyObjectBase
+{
+public:
+ explicit VbaFormClassInfoObject( const InputObjectBase& rParent, VbaFormSharedData& rFormData );
+
+protected:
+ virtual void implDumpShortProperties();
+
+private:
+ VbaFormSharedData& mrFormData;
+};
+
+// ============================================================================
+
+class VbaFormSiteObject : public AxPropertyObjectBase
+{
+public:
+ explicit VbaFormSiteObject( const InputObjectBase& rParent, VbaFormSharedData& rFormData );
+
+protected:
+ virtual void implDumpShortProperties();
+
+private:
+ VbaFormSharedData& mrFormData;
+};
+
+// ============================================================================
+
+class VbaFormDesignExtObject : public AxPropertyObjectBase
+{
+public:
+ explicit VbaFormDesignExtObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+};
+
+// ============================================================================
+
+class VbaFStreamObject : public AxPropertyObjectBase
+{
+public:
+ explicit VbaFStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName,
+ VbaFormSharedData& rFormData );
+
+protected:
+ virtual void implDumpShortProperties();
+ virtual void implDumpExtended();
+
+private:
+ void dumpClassInfos();
+ void dumpFormSites( sal_uInt32 nCount );
+ void dumpSiteData();
+ void dumpDesignExtender();
+
+private:
+ VbaFormSharedData& mrFormData;
+ sal_uInt32 mnFlags;
+};
+
+// ============================================================================
+
+class VbaOStreamObject : public OleInputObjectBase
+{
+public:
+ explicit VbaOStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName,
+ VbaFormSharedData& rFormData );
+
+protected:
+ virtual void implDump();
+
+private:
+ VbaFormSharedData& mrFormData;
+};
+
+// ============================================================================
+
+class VbaPageObject : public AxPropertyObjectBase
+{
+public:
+ explicit VbaPageObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+};
+
+// ============================================================================
+
+class VbaMultiPageObject : public AxPropertyObjectBase
+{
+public:
+ explicit VbaMultiPageObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+ virtual void implDumpExtended();
+
+private:
+ sal_Int32 mnPageCount;
+};
+
+// ============================================================================
+
+class VbaXStreamObject : public InputObjectBase
+{
+public:
+ explicit VbaXStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName,
+ VbaFormSharedData& rFormData );
+
+protected:
+ virtual void implDump();
+
+private:
+ VbaFormSharedData& mrFormData;
+};
+
+// ============================================================================
+
+class VbaContainerStorageObject : public OleStorageObject
+{
+public:
+ explicit VbaContainerStorageObject(
+ const ObjectBase& rParent,
+ const StorageRef& rxStrg,
+ const OUString& rSysPath );
+
+protected:
+ virtual void implDumpStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName );
+
+ virtual void implDumpStorage(
+ const StorageRef& rxStrg,
+ const OUString& rStrgPath,
+ const OUString& rSysPath );
+
+private:
+ bool isFormStorage( const OUString& rStrgPath ) const;
+
+private:
+ VbaFormSharedData maFormData;
+};
+
+// ============================================================================
+// ============================================================================
+
+struct VbaSharedData
+{
+ typedef ::std::map< OUString, sal_Int32 > StreamOffsetMap;
+
+ StreamOffsetMap maStrmOffsets;
+ rtl_TextEncoding meTextEnc;
+
+ explicit VbaSharedData();
+
+ bool isModuleStream( const OUString& rStrmName ) const;
+ sal_Int32 getStreamOffset( const OUString& rStrmName ) const;
+};
+
+// ============================================================================
+
+class VbaDirStreamObject : public SequenceRecordObjectBase
+{
+public:
+ explicit VbaDirStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName,
+ VbaSharedData& rVbaData );
+
+protected:
+ virtual bool implIsValid() const;
+ virtual bool implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize );
+ virtual void implDumpRecordBody();
+
+private:
+ OUString dumpByteString( const String& rName = EMPTY_STRING );
+ OUString dumpUniString( const String& rName = EMPTY_STRING );
+
+ OUString dumpByteStringWithLength( const String& rName = EMPTY_STRING );
+
+private:
+ VbaSharedData& mrVbaData;
+ BinaryInputStreamRef mxInStrm;
+ OUString maCurrStream;
+ sal_Int32 mnCurrOffset;
+};
+
+// ============================================================================
+
+class VbaModuleStreamObject : public InputObjectBase
+{
+public:
+ explicit VbaModuleStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName,
+ VbaSharedData& rVbaData,
+ sal_Int32 nStrmOffset );
+
+protected:
+ virtual void implDump();
+
+private:
+ VbaSharedData& mrVbaData;
+ sal_Int32 mnStrmOffset;
+};
+
+// ============================================================================
+
+class VbaStorageObject : public OleStorageObject
+{
+public:
+ explicit VbaStorageObject(
+ const ObjectBase& rParent,
+ const StorageRef& rxStrg,
+ const OUString& rSysPath,
+ VbaSharedData& rVbaData );
+
+protected:
+ virtual void implDumpStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName );
+
+private:
+ VbaSharedData& mrVbaData;
+};
+
+// ============================================================================
+
+class VbaFormStorageObject : public VbaContainerStorageObject
+{
+public:
+ explicit VbaFormStorageObject(
+ const ObjectBase& rParent,
+ const StorageRef& rxStrg,
+ const OUString& rSysPath,
+ VbaSharedData& rVbaData );
+
+protected:
+ virtual void implDumpStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName );
+
+private:
+ VbaSharedData& mrVbaData;
+};
+
+// ============================================================================
+
+class VbaProjectStorageObject : public OleStorageObject
+{
+public:
+ explicit VbaProjectStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath );
+
+protected:
+ virtual void implDumpStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName );
+
+ virtual void implDumpStorage(
+ const StorageRef& rxStrg,
+ const OUString& rStrgPath,
+ const OUString& rSysPath );
+
+private:
+ VbaSharedData maVbaData;
+};
+
+// ============================================================================
+// ============================================================================
+
+class ActiveXStorageObject : public VbaContainerStorageObject
+{
+public:
+ explicit ActiveXStorageObject(
+ const ObjectBase& rParent,
+ const StorageRef& rxStrg,
+ const OUString& rSysPath );
+
+protected:
+ virtual void implDumpBaseStream(
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName );
+};
+
+// ============================================================================
+// ============================================================================
+
+} // namespace dump
+} // namespace oox
+
+#endif
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/dump/pptxdumper.hxx b/include/oox/dump/pptxdumper.hxx
new file mode 100644
index 000000000000..43f39002059b
--- /dev/null
+++ b/include/oox/dump/pptxdumper.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DUMP_PPTXDUMPER_HXX
+#define OOX_DUMP_PPTXDUMPER_HXX
+
+#include "oox/dump/dumperbase.hxx"
+
+#if OOX_INCLUDE_DUMPER
+
+namespace oox {
+namespace dump {
+namespace pptx {
+
+// ============================================================================
+
+class RootStorageObject : public StorageObjectBase
+{
+public:
+ explicit RootStorageObject( const DumperBase& rParent );
+
+protected:
+ virtual void implDumpStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName );
+};
+
+// ============================================================================
+
+class Dumper : public DumperBase
+{
+public:
+ explicit Dumper( const ::oox::core::FilterBase& rFilter );
+
+ explicit Dumper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
+ const OUString& rSysFileName );
+
+protected:
+ virtual void implDump();
+};
+
+// ============================================================================
+
+} // namespace pptx
+} // namespace dump
+} // namespace oox
+
+#endif
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/dump/xlsbdumper.hxx b/include/oox/dump/xlsbdumper.hxx
new file mode 100644
index 000000000000..ffd24d4de808
--- /dev/null
+++ b/include/oox/dump/xlsbdumper.hxx
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DUMP_XLSBDUMPER_HXX
+#define OOX_DUMP_XLSBDUMPER_HXX
+
+#include "oox/dump/dumperbase.hxx"
+
+#if OOX_INCLUDE_DUMPER
+
+namespace oox { namespace xls {
+ class FontPortionModelList;
+ class PhoneticPortionModelList;
+ struct FunctionInfo;
+ class FunctionProvider;
+} }
+
+namespace oox {
+namespace dump {
+namespace xlsb {
+
+// ============================================================================
+
+class RecordObjectBase : public SequenceRecordObjectBase
+{
+protected:
+ explicit RecordObjectBase();
+ virtual ~RecordObjectBase();
+
+ using SequenceRecordObjectBase::construct;
+ void construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName );
+ void construct( const RecordObjectBase& rParent );
+
+ virtual bool implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize );
+
+ OUString getErrorName( sal_uInt8 nErrCode ) const;
+
+ // ------------------------------------------------------------------------
+
+ void readAddress( Address& orAddress );
+ void readRange( Range& orRange );
+ void readRangeList( RangeList& orRanges );
+
+ // ------------------------------------------------------------------------
+
+ void writeBooleanItem( const String& rName, sal_uInt8 nBool );
+ void writeErrorCodeItem( const String& rName, sal_uInt8 nErrCode );
+
+ void writeFontPortions( const ::oox::xls::FontPortionModelList& rPortions );
+ void writePhoneticPortions( const ::oox::xls::PhoneticPortionModelList& rPhonetics );
+
+ // ------------------------------------------------------------------------
+
+ sal_uInt8 dumpBoolean( const String& rName = EMPTY_STRING );
+ sal_uInt8 dumpErrorCode( const String& rName = EMPTY_STRING );
+ OUString dumpString( const String& rName = EMPTY_STRING, bool bRich = false, bool b32BitLen = true );
+ void dumpColor( const String& rName = EMPTY_STRING );
+ ::com::sun::star::util::DateTime dumpPivotDateTime( const String& rName = EMPTY_STRING );
+
+ sal_Int32 dumpColIndex( const String& rName = EMPTY_STRING );
+ sal_Int32 dumpRowIndex( const String& rName = EMPTY_STRING );
+ sal_Int32 dumpColRange( const String& rName = EMPTY_STRING );
+ sal_Int32 dumpRowRange( const String& rName = EMPTY_STRING );
+
+ Address dumpAddress( const String& rName = EMPTY_STRING );
+ Range dumpRange( const String& rName = EMPTY_STRING );
+ void dumpRangeList( const String& rName = EMPTY_STRING );
+
+ // ------------------------------------------------------------------------
+private:
+ bool readCompressedInt( BinaryInputStream& rStrm, sal_Int32& ornValue );
+
+private:
+ typedef ::boost::shared_ptr< SequenceInputStream > SequenceInputStreamRef;
+
+ SequenceInputStreamRef mxBiffStrm;
+ NameListRef mxErrCodes;
+};
+
+// ============================================================================
+
+class RootStorageObject : public StorageObjectBase
+{
+public:
+ explicit RootStorageObject( const DumperBase& rParent );
+
+protected:
+ virtual void implDumpStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName );
+};
+
+// ============================================================================
+
+class Dumper : public DumperBase
+{
+public:
+ explicit Dumper( const ::oox::core::FilterBase& rFilter );
+
+ explicit Dumper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
+ const OUString& rSysFileName );
+
+protected:
+ virtual void implDump();
+};
+
+// ============================================================================
+
+} // namespace xlsb
+} // namespace dump
+} // namespace oox
+
+#endif
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/export/chartexport.hxx b/include/oox/export/chartexport.hxx
new file mode 100644
index 000000000000..10fc8922dc4a
--- /dev/null
+++ b/include/oox/export/chartexport.hxx
@@ -0,0 +1,204 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _OOX_EXPORT_CHART_HXX_
+#define _OOX_EXPORT_CHART_HXX_
+
+#include <oox/dllapi.h>
+#include <com/sun/star/uno/XReference.hpp>
+#include <oox/export/drawingml.hxx>
+#include <oox/token/tokens.hxx>
+#include <sax/fshelper.hxx>
+#include <vcl/mapmod.hxx>
+#include <boost/unordered_map.hpp>
+#include <map>
+
+namespace com { namespace sun { namespace star {
+ namespace chart {
+ class XDiagram;
+ class XChartDocument;
+ class XChartDataArray;
+ struct ChartSeriesAddress;
+ }
+ namespace chart2 {
+ class XDiagram;
+ class XChartDocument;
+ class XDataSeries;
+ class XChartType;
+ namespace data
+ {
+ class XDataProvider;
+ class XDataSequence;
+ }
+ }
+ namespace drawing {
+ class XShape;
+ class XShapes;
+ }
+ namespace task {
+ class XStatusIndicator;
+ }
+ namespace frame {
+ class XModel;
+ }
+}}}
+
+namespace oox { namespace drawingml {
+
+const sal_Int32 AXIS_PRIMARY_X = 1;
+const sal_Int32 AXIS_PRIMARY_Y = 2;
+const sal_Int32 AXIS_PRIMARY_Z = 3;
+const sal_Int32 AXIS_SECONDARY_X = 4;
+const sal_Int32 AXIS_SECONDARY_Y = 5;
+
+struct AxisIdPair{
+ sal_Int32 nAxisType;
+ sal_Int32 nAxisId;
+ sal_Int32 nCrossAx;
+
+ AxisIdPair( sal_Int32 nType, sal_Int32 nId, sal_Int32 nAx ): nAxisType( nType ),nAxisId( nId ),nCrossAx( nAx ) {}
+};
+
+class OOX_DLLPUBLIC ChartExport : public DrawingML {
+
+public:
+ // first: data sequence for label, second: data sequence for values.
+ typedef ::std::vector< AxisIdPair > AxisVector;
+
+private:
+ sal_Int32 mnXmlNamespace;
+ Fraction maFraction;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxChartModel;
+ com::sun::star::uno::Reference< com::sun::star::chart::XDiagram > mxDiagram;
+ com::sun::star::uno::Reference< com::sun::star::chart2::XDiagram > mxNewDiagram;
+
+ OUString msTableName;
+ OUStringBuffer msStringBuffer;
+ OUString msString;
+
+ // members filled by InitRangeSegmentationProperties (retrieved from DataProvider)
+ sal_Bool mbHasSeriesLabels;
+ sal_Bool mbHasCategoryLabels; //if the categories are only automatically generated this will be false
+ sal_Bool mbRowSourceColumns;
+ OUString msChartAddress;
+ OUString msTableNumberList;
+ ::com::sun::star::uno::Sequence< sal_Int32 > maSequenceMapping;
+
+ //::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mxAdditionalShapes;
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > mxCategoriesValues;
+
+ AxisVector maAxes;
+ sal_Bool mbHasXAxis;
+ sal_Bool mbHasYAxis;
+ sal_Bool mbHasZAxis;
+ sal_Bool mbHasSecondaryXAxis;
+ sal_Bool mbHasSecondaryYAxis;
+ sal_Bool mbIs3DChart;
+
+
+private:
+ sal_Int32 getChartType(
+ );
+
+ OUString parseFormula( const OUString& rRange );
+ void InitPlotArea();
+
+ void _ExportContent();
+ void exportChartSpace( com::sun::star::uno::Reference<
+ com::sun::star::chart::XChartDocument > rChartDoc,
+ sal_Bool bIncludeTable );
+ void exportChart( com::sun::star::uno::Reference<
+ com::sun::star::chart::XChartDocument > rChartDoc );
+ void exportLegend( com::sun::star::uno::Reference<
+ com::sun::star::chart::XChartDocument > rChartDoc );
+ void exportTitle( com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape > xShape );
+ void exportPlotArea( );
+
+ void exportAreaChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+ void exportBarChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+ void exportBubbleChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+ void exportDoughnutChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+ void exportLineChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+ void exportOfPieChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+ void exportPieChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+ void exportRadarChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+ void exportScatterChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+ void exportStockChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+ void exportSuffaceChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+
+ void exportSeries( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType, sal_Int32& nAttachedAxis );
+ void exportCandleStickSeries(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > > & aSeriesSeq,
+ sal_Bool bJapaneseCandleSticks, sal_Int32& nAttachedAxis );
+ void exportSeriesText(
+ const com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xValueSeq );
+ void exportSeriesCategory(
+ const com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xValueSeq );
+ void exportSeriesValues(
+ const com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xValueSeq, sal_Int32 nValueType = XML_val );
+ void exportShapeProps( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet );
+ void exportDataPoints(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesProperties,
+ sal_Int32 nSeriesLength );
+ void exportDataLabels(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesProperties,
+ sal_Int32 nSeriesLength );
+ void exportGrouping( sal_Bool isBar = sal_False );
+ void exportMarker();
+ void exportSmooth();
+ void exportFirstSliceAng();
+
+ void exportAxes( );
+ void exportAxis( AxisIdPair aAxisIdPair );
+ void _exportAxis(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xAxisProp,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xAxisTitle,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xMajorGrid,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xMinorGrid,
+ sal_Int32 nAxisType,
+ const char* sAxisPos,
+ AxisIdPair aAxisIdPair );
+ void exportAxesId( sal_Int32 nAttachedAxis );
+ void exportView3D();
+ sal_Bool isDeep3dChart();
+
+public:
+
+ ChartExport( sal_Int32 nXmlNamespace, ::sax_fastparser::FSHelperPtr pFS, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX );
+ virtual ~ChartExport() {}
+
+ sal_Int32 GetChartID( );
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > getModel(){ return mxChartModel; }
+
+ virtual ChartExport& WriteChartObj( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, sal_Int32 nChartCount );
+
+ void ExportContent();
+ void InitRangeSegmentationProperties(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > & xChartDoc );
+};
+
+}}
+
+#endif /* ndef _OOX_EXPORT_CHART_HXX_ */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
new file mode 100644
index 000000000000..fa13a49ea090
--- /dev/null
+++ b/include/oox/export/drawingml.hxx
@@ -0,0 +1,160 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _OOX_EXPORT_DRAWINGML_HXX_
+#define _OOX_EXPORT_DRAWINGML_HXX_
+
+#include <oox/dllapi.h>
+#include <sax/fshelper.hxx>
+#include <rtl/strbuf.hxx>
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/uno/XReference.hpp>
+#include <tools/poly.hxx>
+#include <filter/msfilter/escherex.hxx>
+#ifndef PPTX_EXPORT_ROTATE_CLOCKWISIFY
+#define PPTX_EXPORT_ROTATE_CLOCKWISIFY(input) ((21600000-input*600)%21600000)
+#endif
+
+class Graphic;
+class String;
+
+namespace com { namespace sun { namespace star {
+namespace beans {
+ class XPropertySet;
+ class XPropertyState;
+}
+namespace drawing {
+ class XShape;
+}
+namespace style {
+ struct LineSpacing;
+}
+namespace text {
+ class XTextContent;
+ class XTextRange;
+}
+namespace io {
+ class XOutputStream;
+}
+}}}
+
+namespace oox {
+namespace core {
+ class XmlFilterBase;
+}
+
+namespace drawingml {
+
+class OOX_DLLPUBLIC DrawingML {
+public:
+ enum DocumentType { DOCUMENT_DOCX, DOCUMENT_PPTX, DOCUMENT_XLSX };
+
+private:
+ static int mnImageCounter;
+
+ /// To specify where write eg. the images to (like 'ppt', or 'word' - according to the OPC).
+ DocumentType meDocumentType;
+
+protected:
+ ::com::sun::star::uno::Any mAny;
+ ::sax_fastparser::FSHelperPtr mpFS;
+ ::oox::core::XmlFilterBase* mpFB;
+
+ bool GetProperty( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, OUString aName );
+ bool GetPropertyAndState( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState > rXPropState,
+ String aName, ::com::sun::star::beans::PropertyState& eState );
+ const char* GetFieldType( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > rRun, sal_Bool& bIsField );
+
+ OUString WriteImage( const OUString& rURL );
+
+ const char* GetComponentDir();
+ const char* GetRelationCompPrefix();
+
+public:
+ DrawingML( ::sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX ) : meDocumentType( eDocumentType ), mpFS( pFS ), mpFB( pFB ) {}
+ void SetFS( ::sax_fastparser::FSHelperPtr pFS ) { mpFS = pFS; }
+ ::sax_fastparser::FSHelperPtr GetFS() { return mpFS; }
+ ::oox::core::XmlFilterBase* GetFB() { return mpFB; }
+ DocumentType GetDocumentType() { return meDocumentType; }
+
+ OUString WriteImage( const Graphic &rGraphic );
+
+ void WriteColor( sal_uInt32 nColor );
+ void WriteGradientStop( sal_uInt16 nStop, sal_uInt32 nColor );
+ void WriteLineArrow( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, sal_Bool bLineStart );
+ void WriteConnectorConnections( EscherConnectorListEntry& rConnectorEntry, sal_Int32 nStartID, sal_Int32 nEndID );
+
+ void WriteSolidFill( sal_uInt32 nColor );
+ void WriteSolidFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
+ void WriteGradientFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
+ void WriteBlipFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, OUString sURLPropName, sal_Int32 nXmlNamespace );
+ void WriteBlipFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, OUString sURLPropName );
+ void WriteSrcRect( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >, const OUString& );
+ void WriteOutline( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
+ void WriteStretch();
+ void WriteLinespacing( ::com::sun::star::style::LineSpacing& rLineSpacing );
+
+ OUString WriteBlip( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, OUString& rURL, const Graphic *pGraphic=NULL );
+ void WriteBlipMode( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
+
+ void WriteShapeTransformation( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rXShape,
+ sal_Int32 nXmlNamespace, sal_Bool bFlipH = false, sal_Bool bFlipV = false, sal_Bool bSuppressRotation = false );
+ void WriteTransformation( const Rectangle& rRectangle,
+ sal_Int32 nXmlNamespace, sal_Bool bFlipH = false, sal_Bool bFlipV = false, sal_Int32 nRotation = 0 );
+
+ void WriteText( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > rXIface );
+ void WriteParagraph( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > rParagraph );
+ void WriteParagraphProperties( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > rParagraph );
+ void WriteParagraphNumbering( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
+ sal_Int16 nLevel );
+ void WriteRun( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > rRun );
+ void WriteRunProperties( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rRun, sal_Bool bIsField );
+
+ void WritePresetShape( const char* pShape );
+ void WritePresetShape( const char* pShape, MSO_SPT eShapeType, sal_Bool bPredefinedHandlesUsed, sal_Int32 nAdjustmentsWhichNeedsToBeConverted, const ::com::sun::star::beans::PropertyValue& rProp );
+ void WritePolyPolygon( const PolyPolygon& rPolyPolygon );
+ void WriteFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet );
+
+ static void ResetCounters();
+
+ void GetUUID( OStringBuffer& rBuffer );
+
+ static sal_Unicode SubstituteBullet( sal_Unicode cBulletId, ::com::sun::star::awt::FontDescriptor& rFontDesc );
+
+ sal_uInt32 ColorWithIntensity( sal_uInt32 nColor, sal_uInt32 nIntensity );
+
+ static const char* GetAlignment( sal_Int32 nAlignment );
+
+ sax_fastparser::FSHelperPtr CreateOutputStream (
+ const OUString& sFullStream,
+ const OUString& sRelativeStream,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xParentRelation,
+ const char* sContentType,
+ const char* sRelationshipType,
+ OUString* pRelationshipId = NULL );
+
+};
+
+}
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/export/shapes.hxx b/include/oox/export/shapes.hxx
new file mode 100644
index 000000000000..39b4c0d9ec72
--- /dev/null
+++ b/include/oox/export/shapes.hxx
@@ -0,0 +1,170 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _OOX_EXPORT_SHAPES_HXX_
+#define _OOX_EXPORT_SHAPES_HXX_
+
+#include <oox/dllapi.h>
+#include <com/sun/star/uno/XReference.hpp>
+#include <oox/export/drawingml.hxx>
+#include <sax/fshelper.hxx>
+#include <vcl/mapmod.hxx>
+#include <boost/unordered_map.hpp>
+
+namespace com { namespace sun { namespace star {
+namespace beans {
+ class XPropertySet;
+}
+namespace drawing {
+ class XShape;
+ class XShapes;
+}
+}}}
+
+namespace oox { namespace drawingml {
+
+class OOX_DLLPUBLIC ShapeExport : public DrawingML {
+
+private:
+ static int mnSpreadsheetCounter;
+ struct ShapeCheck
+ {
+ bool operator()( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape> s1, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape> s2 ) const
+ {
+ return s1 == s2;
+ }
+ };
+
+ struct ShapeHash
+ {
+ size_t operator()( const ::com::sun::star::uno::Reference < ::com::sun::star::drawing::XShape > ) const;
+ };
+
+public:
+ typedef boost::unordered_map< const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape>, sal_Int32, ShapeHash, ShapeCheck> ShapeHashMap;
+
+protected:
+ sal_Int32 mnShapeIdMax, mnPictureIdMax;
+
+ void WriteGraphicObjectShapePart( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape, const Graphic *pGraphic=NULL );
+
+private:
+ sal_Int32 mnXmlNamespace;
+ Fraction maFraction;
+ MapMode maMapModeSrc, maMapModeDest;
+
+ ::com::sun::star::awt::Size MapSize( const ::com::sun::star::awt::Size& ) const;
+
+ ShapeHashMap maShapeMap;
+ ShapeHashMap* mpShapeMap;
+
+public:
+
+ ShapeExport( sal_Int32 nXmlNamespace, ::sax_fastparser::FSHelperPtr pFS, ShapeHashMap* pShapeMap = NULL, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX );
+ virtual ~ShapeExport() {}
+
+ static sal_Bool NonEmptyText( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xIface );
+
+ virtual ShapeExport&
+ WriteBezierShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape, sal_Bool bClosed );
+ virtual ShapeExport&
+ WriteClosedBezierShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteConnectorShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteCustomShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteEllipseShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteGraphicObjectShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteLineShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteNonVisualDrawingProperties( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape, const char* sName );
+ virtual ShapeExport&
+ WriteNonVisualProperties( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteOpenBezierShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteRectangleShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+
+ /**
+ * Write the DrawingML for a particular shape.
+ *
+ * <p>This is the member function you want. It performs the type lookup and
+ * invokes the appropriate corresponding Write*() method for the specific
+ * type.</p>
+ *
+ * <p>To write an XShape, XShape::getShapeType() is called to determine
+ * the shape type, and the corresponding method in this table is
+ * invoked:</p>
+ *
+ * <table>
+ * <tr><th>Shape Type</th><th>Method</th></tr>
+ * <tr><td><tt>com.sun.star.drawing.ClosedBezierShape</tt></td> <td>ShapeExport::WriteClosedBezierShape</td></tr>
+ * <tr><td><tt>com.sun.star.drawing.CustomShape</tt></td> <td>ShapeExport::WriteCustomShape</td></tr>
+ * <tr><td><tt>com.sun.star.drawing.EllipseShape</tt></td> <td>ShapeExport::WriteEllipseShape</td></tr>
+ * <tr><td><tt>com.sun.star.drawing.GraphicObjectShape</tt></td> <td>ShapeExport::WriteGraphicObjectShape</td></tr>
+ * <tr><td><tt>com.sun.star.drawing.LineShape</tt></td> <td>ShapeExport::WriteLineShape</td></tr>
+ * <tr><td><tt>com.sun.star.drawing.OpenBezierShape</tt></td> <td>ShapeExport::WriteOpenBezierShape</td></tr>
+ * <tr><td><tt>com.sun.star.drawing.RectangleShape</tt></td> <td>ShapeExport::WriteRectangleShape</td></tr>
+ * <tr><td><tt>com.sun.star.drawing.TableShape</tt></td> <td>ShapeExport::WriteTableShape</td></tr>
+ * <tr><td><tt>com.sun.star.drawing.TextShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr>
+ * <tr><td><tt>com.sun.star.presentation.DateTimeShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr>
+ * <tr><td><tt>com.sun.star.presentation.FooterShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr>
+ * <tr><td><tt>com.sun.star.presentation.HeaderShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr>
+ * <tr><td><tt>com.sun.star.presentation.NotesShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr>
+ * <tr><td><tt>com.sun.star.presentation.OutlinerShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr>
+ * <tr><td><tt>com.sun.star.presentation.SlideNumberShape</tt></td><td>ShapeExport::WriteTextShape</td></tr>
+ * <tr><td><tt>com.sun.star.presentation.TitleTextShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr>
+ * </table>
+ *
+ * <p>If the shape type is not recognized, then
+ * <tt>ShapeExport::WriteUnknownShape</tt> is called.</p>
+ *
+ * @param xShape The shape to export as DrawingML.
+ * @return <tt>*this</tt>
+ */
+ virtual ShapeExport&
+ WriteShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteTextBox( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xIface, sal_Int32 nXmlNamespace );
+ virtual ShapeExport&
+ WriteTextShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteTableShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteOLE2Shape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteUnknownShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+
+ void WriteTable( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rXShape );
+
+
+ sal_Int32 GetNewShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape );
+ sal_Int32 GetNewShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape, ::oox::core::XmlFilterBase* pFB );
+ sal_Int32 GetShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape );
+ static sal_Int32 GetShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape, ShapeHashMap* pShapeMap );
+};
+
+}}
+
+#endif /* ndef _OOX_EXPORT_SHAPES_HXX_ */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/export/utils.hxx b/include/oox/export/utils.hxx
new file mode 100644
index 000000000000..04c3b3375742
--- /dev/null
+++ b/include/oox/export/utils.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _OOX_EXPORT_UTILS_HXX_
+#define _OOX_EXPORT_UTILS_HXX_
+
+#define I32S(x) OString::valueOf( (sal_Int32) x ).getStr()
+#define I64S(x) OString::valueOf( (sal_Int64) x ).getStr()
+#define IS(x) OString::valueOf( x ).getStr()
+#define USS(x) OUStringToOString( x, RTL_TEXTENCODING_UTF8 ).getStr()
+
+#ifndef DBG
+# if OSL_DEBUG_LEVEL > 0
+# define DBG(x) x
+# else
+# define DBG(x)
+# endif
+#endif
+
+// ---------------------------------------------------------------------------------------------
+
+static inline sal_Int64 PPTtoEMU( sal_Int32 nPPT )
+{
+ return (sal_Int64)( (double)nPPT * 1587.5 );
+}
+
+// ---------------------------------------------------------------------------------------------
+
+static inline sal_Int64 MM100toEMU( sal_Int32 nMM100 )
+{
+ return (sal_Int64)nMM100 * 360;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+static inline sal_Int64 TwipsToEMU( sal_Int32 nTwips )
+{
+ return sal_Int64( nTwips ) * 635;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx
new file mode 100644
index 000000000000..54212a65bccf
--- /dev/null
+++ b/include/oox/export/vmlexport.hxx
@@ -0,0 +1,132 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _OOX_EXPORT_VMLEXPORT_HXX_
+#define _OOX_EXPORT_VMLEXPORT_HXX_
+
+#include <oox/dllapi.h>
+#include <oox/export/drawingml.hxx>
+#include <sax/fshelper.hxx>
+#include <filter/msfilter/escherex.hxx>
+#include <editeng/outlobj.hxx>
+
+
+namespace oox {
+
+namespace vml {
+
+/// Interface to be implemented by the parent exporter that knows how to handle shape text.
+class OOX_DLLPUBLIC VMLTextExport
+{
+public:
+ virtual void WriteOutliner(const OutlinerParaObject& rParaObj) = 0;
+ virtual oox::drawingml::DrawingML& GetDrawingML() = 0;
+protected:
+ VMLTextExport() {}
+ virtual ~VMLTextExport() {}
+};
+
+class OOX_DLLPUBLIC VMLExport : public EscherEx
+{
+ /// Fast serializer to output the data
+ ::sax_fastparser::FSHelperPtr m_pSerializer;
+
+ /// Parent exporter, used for text callback.
+ VMLTextExport* m_pTextExport;
+
+ /// The object we're exporting.
+ const SdrObject* m_pSdrObject;
+
+ /// Fill the shape attributes as they come.
+ ::sax_fastparser::FastAttributeList *m_pShapeAttrList;
+
+ /// Remember the shape type.
+ sal_uInt32 m_nShapeType;
+
+ /// Remember the shape flags.
+ sal_uInt32 m_nShapeFlags;
+
+ /// Remember style, the most important shape attribute ;-)
+ OStringBuffer *m_pShapeStyle;
+
+ /// Remember which shape types we had already written.
+ bool *m_pShapeTypeWritten;
+
+public:
+ VMLExport( ::sax_fastparser::FSHelperPtr pSerializer, VMLTextExport* pTextExport = 0 );
+ virtual ~VMLExport();
+
+ ::sax_fastparser::FSHelperPtr
+ GetFS() { return m_pSerializer; }
+
+ /// Export the sdr object as VML.
+ ///
+ /// Call this when you need to export the object as VML.
+ sal_uInt32 AddSdrObject( const SdrObject& rObj );
+
+protected:
+ /// Add an attribute to the generated <v:shape/> element.
+ ///
+ /// This should be called from within StartShape() to ensure that the
+ /// added attribute is preserved.
+ void AddShapeAttribute( sal_Int32 nAttribute, const OString& sValue );
+
+ using EscherEx::StartShape;
+ using EscherEx::EndShape;
+
+ /// Start the shape for which we just collected the information.
+ ///
+ /// Returns the element's tag number, -1 means we wrote nothing.
+ virtual sal_Int32 StartShape();
+
+ /// End the shape.
+ ///
+ /// The parameter is just what we got from StartShape().
+ virtual void EndShape( sal_Int32 nShapeElement );
+
+ virtual void Commit( EscherPropertyContainer& rProps, const Rectangle& rRect );
+
+private:
+
+ virtual void OpenContainer( sal_uInt16 nEscherContainer, int nRecInstance = 0 );
+ virtual void CloseContainer();
+
+ virtual sal_uInt32 EnterGroup( const OUString& rShapeName, const Rectangle* pBoundRect = 0 );
+ virtual void LeaveGroup();
+
+ virtual void AddShape( sal_uInt32 nShapeType, sal_uInt32 nShapeFlags, sal_uInt32 nShapeId = 0 );
+
+private:
+ /// Create an OString representing the id from a numerical id.
+ static OString ShapeIdString( sal_uInt32 nId );
+
+ /// Add starting and ending point of a line to the m_pShapeAttrList.
+ void AddLineDimensions( const Rectangle& rRectangle );
+
+ /// Add position and size to the OStringBuffer.
+ void AddRectangleDimensions( OStringBuffer& rBuffer, const Rectangle& rRectangle );
+};
+
+} // namespace vml
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/attributelist.hxx b/include/oox/helper/attributelist.hxx
new file mode 100644
index 000000000000..55f41cf0a3b3
--- /dev/null
+++ b/include/oox/helper/attributelist.hxx
@@ -0,0 +1,170 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_HELPER_ATTRIBUTELIST_HXX
+#define OOX_HELPER_ATTRIBUTELIST_HXX
+
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/xml/sax/XFastAttributeList.hpp>
+#include "oox/helper/helper.hxx"
+#include "oox/token/namespaces.hxx"
+#include "oox/token/tokens.hxx"
+#include "oox/dllapi.h"
+
+namespace oox {
+
+// ============================================================================
+
+/** Static helpers for conversion of strings to attribute values of various
+ different data types.
+ */
+class OOX_DLLPUBLIC AttributeConversion
+{
+public:
+ /** Returns the XML token identifier from the passed string. */
+ static sal_Int32 decodeToken( const OUString& rValue );
+
+ /** Returns the decoded string value. All characters in the format
+ '_xHHHH_' (H being a hexadecimal digit), will be decoded. */
+ static OUString decodeXString( const OUString& rValue );
+
+ /** Returns the double value from the passed string. */
+ static double decodeDouble( const OUString& rValue );
+
+ /** Returns the 32-bit signed integer value from the passed string (decimal). */
+ static sal_Int32 decodeInteger( const OUString& rValue );
+
+ /** Returns the 32-bit unsigned integer value from the passed string (decimal). */
+ static sal_uInt32 decodeUnsigned( const OUString& rValue );
+
+ /** Returns the 64-bit signed integer value from the passed string (decimal). */
+ static sal_Int64 decodeHyper( const OUString& rValue );
+
+ /** Returns the 32-bit signed integer value from the passed string (hexadecimal). */
+ static sal_Int32 decodeIntegerHex( const OUString& rValue );
+};
+
+// ============================================================================
+
+/** Provides access to attribute values of an element.
+
+ Wraps a com.sun.star.xml.sax.XFastAttributeList object. Provides
+ convenience functions that convert the string value of an attribute to
+ various other data types.
+ */
+class OOX_DLLPUBLIC AttributeList
+{
+public:
+ explicit AttributeList(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs );
+
+ /** Returns the wrapped com.sun.star.xml.sax.XFastAttributeList object. */
+ inline ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >
+ getFastAttributeList() const { return mxAttribs; }
+
+ /** Returns true, if the specified attribute is present. */
+ bool hasAttribute( sal_Int32 nAttrToken ) const;
+
+ // optional return values -------------------------------------------------
+
+ /** Returns the token identifier of the value of the specified attribute. */
+ OptValue< sal_Int32 > getToken( sal_Int32 nAttrToken ) const;
+
+ /** Returns the string value of the specified attribute. */
+ OptValue< OUString > getString( sal_Int32 nAttrToken ) const;
+
+ /** Returns the string value of the specified attribute. All characters in
+ the format '_xHHHH_' (H being a hexadecimal digit), will be decoded. */
+ OptValue< OUString > getXString( sal_Int32 nAttrToken ) const;
+
+ /** Returns the double value of the specified attribute. */
+ OptValue< double > getDouble( sal_Int32 nAttrToken ) const;
+
+ /** Returns the 32-bit signed integer value of the specified attribute (decimal). */
+ OptValue< sal_Int32 > getInteger( sal_Int32 nAttrToken ) const;
+
+ /** Returns the 32-bit unsigned integer value of the specified attribute (decimal). */
+ OptValue< sal_uInt32 > getUnsigned( sal_Int32 nAttrToken ) const;
+
+ /** Returns the 64-bit signed integer value of the specified attribute (decimal). */
+ OptValue< sal_Int64 > getHyper( sal_Int32 nAttrToken ) const;
+
+ /** Returns the 32-bit signed integer value of the specified attribute (hexadecimal). */
+ OptValue< sal_Int32 > getIntegerHex( sal_Int32 nAttrToken ) const;
+
+ /** Returns the boolean value of the specified attribute. */
+ OptValue< bool > getBool( sal_Int32 nAttrToken ) const;
+
+ /** Returns the date/time value of the specified attribute. */
+ OptValue< ::com::sun::star::util::DateTime > getDateTime( sal_Int32 nAttrToken ) const;
+
+ // defaulted return values ------------------------------------------------
+
+ /** Returns the token identifier of the value of the specified attribute,
+ or the passed default identifier if the attribute is missing. */
+ sal_Int32 getToken( sal_Int32 nAttrToken, sal_Int32 nDefault ) const;
+
+ /** Returns the string value of the specified attribute, or the passed
+ default string if the attribute is missing. */
+ OUString getString( sal_Int32 nAttrToken, const OUString& rDefault ) const;
+
+ /** Returns the decoded string value of the specified attribute, or the
+ passed default string if the attribute is missing. */
+ OUString getXString( sal_Int32 nAttrToken, const OUString& rDefault ) const;
+
+ /** Returns the double value of the specified attribute, or the passed
+ default value if the attribute is missing or not convertible to a double. */
+ double getDouble( sal_Int32 nAttrToken, double fDefault ) const;
+
+ /** Returns the 32-bit signed integer value of the specified attribute, or the
+ passed default value if the attribute is missing or not convertible to integer. */
+ sal_Int32 getInteger( sal_Int32 nAttrToken, sal_Int32 nDefault ) const;
+
+ /** Returns the 32-bit unsigned integer value of the specified attribute, or the
+ passed default value if the attribute is missing or not convertible to unsigned. */
+ sal_uInt32 getUnsigned( sal_Int32 nAttrToken, sal_uInt32 nDefault ) const;
+
+ /** Returns the 64-bit signed integer value of the specified attribute, or the
+ passed default value if the attribute is missing or not convertible to integer. */
+ sal_Int64 getHyper( sal_Int32 nAttrToken, sal_Int64 nDefault ) const;
+
+ /** Returns the 32-bit signed integer value of the specified attribute (hexadecimal),
+ or the passed default value if the attribute is missing or not convertible. */
+ sal_Int32 getIntegerHex( sal_Int32 nAttrToken, sal_Int32 nDefault ) const;
+
+ /** Returns the boolean value of the specified attribute, or the passed
+ default value if the attribute is missing or not convertible to bool. */
+ bool getBool( sal_Int32 nAttrToken, bool bDefault ) const;
+
+ /** Returns the date/time value of the specified attribute, or the default
+ value if the attribute is missing or not convertible to a date/time value. */
+ ::com::sun::star::util::DateTime getDateTime( sal_Int32 nAttrToken, const ::com::sun::star::util::DateTime& rDefault ) const;
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >
+ mxAttribs;
+};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/binaryinputstream.hxx b/include/oox/helper/binaryinputstream.hxx
new file mode 100644
index 000000000000..64d85357c2e8
--- /dev/null
+++ b/include/oox/helper/binaryinputstream.hxx
@@ -0,0 +1,438 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_HELPER_BINARYINPUTSTREAM_HXX
+#define OOX_HELPER_BINARYINPUTSTREAM_HXX
+
+#include <vector>
+#include <com/sun/star/io/XInputStream.hpp>
+#include "oox/helper/binarystreambase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace io { class XInputStream; }
+} } }
+
+namespace oox {
+
+class BinaryOutputStream;
+
+// ============================================================================
+
+/** Interface for binary input stream classes.
+
+ The binary data in the stream is assumed to be in little-endian format.
+ */
+class OOX_DLLPUBLIC BinaryInputStream : public virtual BinaryStreamBase
+{
+public:
+ /** Derived classes implement reading nBytes bytes to the passed sequence.
+ The sequence will be reallocated internally.
+
+ @param nAtomSize
+ The size of the elements in the memory block, if available. Derived
+ classes may be interested in this information.
+
+ @return
+ Number of bytes really read.
+ */
+ virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 ) = 0;
+
+ /** Derived classes implement reading nBytes bytes to the (preallocated!)
+ memory buffer opMem.
+
+ @param nAtomSize
+ The size of the elements in the memory block, if available. Derived
+ classes may be interested in this information.
+
+ @return
+ Number of bytes really read.
+ */
+ virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 ) = 0;
+
+ /** Derived classes implement seeking the stream forward by the passed
+ number of bytes. This should work for non-seekable streams too.
+
+ @param nAtomSize
+ The size of the elements in the memory block, if available. Derived
+ classes may be interested in this information.
+ */
+ virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 ) = 0;
+
+ /** Reads a value from the stream and converts it to platform byte order.
+ All data types supported by the ByteOrderConverter class can be used.
+ */
+ template< typename Type >
+ void readValue( Type& ornValue );
+
+ /** Reads a value from the stream and converts it to platform byte order.
+ All data types supported by the ByteOrderConverter class can be used.
+ */
+ template< typename Type >
+ inline Type readValue() { Type nValue; readValue( nValue ); return nValue; }
+
+ /** Stream operator for all data types supported by the readValue() function. */
+ template< typename Type >
+ inline BinaryInputStream& operator>>( Type& ornValue ) { readValue( ornValue ); return *this; }
+
+ inline sal_Int8 readInt8() { return readValue< sal_Int8 >(); }
+ inline sal_uInt8 readuInt8() { return readValue< sal_uInt8 >(); }
+ inline sal_Int16 readInt16() { return readValue< sal_Int16 >(); }
+ inline sal_uInt16 readuInt16() { return readValue< sal_uInt16 >(); }
+ inline sal_Int32 readInt32() { return readValue< sal_Int32 >(); }
+ inline sal_uInt32 readuInt32() { return readValue< sal_uInt32 >(); }
+ inline sal_Int64 readInt64() { return readValue< sal_Int64 >(); }
+ inline sal_uInt64 readuInt64() { return readValue< sal_uInt64 >(); }
+ inline float readFloat() { return readValue< float >(); }
+ inline double readDouble() { return readValue< double >(); }
+
+ /** Reads a (preallocated!) C array of values from the stream.
+
+ Converts all values in the array to platform byte order. All data types
+ supported by the ByteOrderConverter class can be used.
+
+ @param nElemCount
+ Number of array elements to read (NOT byte count).
+
+ @return
+ Number of array elements really read (NOT byte count).
+ */
+ template< typename Type >
+ sal_Int32 readArray( Type* opnArray, sal_Int32 nElemCount );
+
+ /** Reads a sequence of values from the stream.
+
+ The sequence will be reallocated internally. Converts all values in the
+ array to platform byte order. All data types supported by the
+ ByteOrderConverter class can be used.
+
+ @param nElemCount
+ Number of elements to put into the sequence (NOT byte count).
+
+ @return
+ Number of sequence elements really read (NOT byte count).
+ */
+ template< typename Type >
+ sal_Int32 readArray( ::com::sun::star::uno::Sequence< Type >& orSequence, sal_Int32 nElemCount );
+
+ /** Reads a vector of values from the stream.
+
+ The vector will be resized internally. Converts all values in the
+ vector to platform byte order. All data types supported by the
+ ByteOrderConverter class can be used.
+
+ @param nElemCount
+ Number of elements to put into the vector (NOT byte count).
+
+ @return
+ Number of vector elements really read (NOT byte count).
+ */
+ template< typename Type >
+ sal_Int32 readArray( ::std::vector< Type >& orVector, sal_Int32 nElemCount );
+
+ /** Skips an array of values of a certain type in the stream.
+
+ All data types supported by the ByteOrderConverter class can be used.
+
+ @param nElemCount
+ Number of array elements to skip (NOT byte count).
+ */
+ template< typename Type >
+ void skipArray( sal_Int32 nElemCount );
+
+ /** Reads a NUL-terminated Unicode character array and returns the string.
+ */
+ OUString readNulUnicodeArray();
+
+ /** Reads a byte character array and returns the string.
+
+ @param nChars
+ Number of characters (bytes) to read from the stream.
+
+ @param bAllowNulChars
+ True = NUL characters are inserted into the imported string.
+ False = NUL characters are replaced by question marks (default).
+ */
+ OString readCharArray( sal_Int32 nChars, bool bAllowNulChars = false );
+
+ /** Reads a byte character array and returns a Unicode string.
+
+ @param nChars
+ Number of characters (bytes) to read from the stream.
+
+ @param eTextEnc
+ The text encoding used to create the Unicode string.
+
+ @param bAllowNulChars
+ True = NUL characters are inserted into the imported string.
+ False = NUL characters are replaced by question marks (default).
+ */
+ OUString readCharArrayUC( sal_Int32 nChars, rtl_TextEncoding eTextEnc, bool bAllowNulChars = false );
+
+ /** Reads a Unicode character array and returns the string.
+
+ @param nChars
+ Number of 16-bit characters to read from the stream.
+
+ @param bAllowNulChars
+ True = NUL characters are inserted into the imported string.
+ False = NUL characters are replaced by question marks (default).
+ */
+ OUString readUnicodeArray( sal_Int32 nChars, bool bAllowNulChars = false );
+
+ /** Reads a Unicode character array (may be compressed) and returns the
+ string.
+
+ @param nChars
+ Number of 8-bit or 16-bit characters to read from the stream.
+
+ @param bCompressed
+ True = Character array is compressed (stored as 8-bit characters).
+ False = Character array is not compressed (stored as 16-bit characters).
+
+ @param bAllowNulChars
+ True = NUL characters are inserted into the imported string.
+ False = NUL characters are replaced by question marks (default).
+ */
+ OUString readCompressedUnicodeArray( sal_Int32 nChars, bool bCompressed, bool bAllowNulChars = false );
+
+ /** Copies nBytes bytes from the current position to the passed output stream.
+ */
+ void copyToStream( BinaryOutputStream& rOutStrm, sal_Int64 nBytes = SAL_MAX_INT64, sal_Int32 nAtomSize = 1 );
+
+protected:
+ /** This dummy default c'tor will never call the c'tor of the virtual base
+ class BinaryStreamBase as this class cannot be instanciated directly. */
+ inline explicit BinaryInputStream() : BinaryStreamBase( false ) {}
+};
+
+typedef ::boost::shared_ptr< BinaryInputStream > BinaryInputStreamRef;
+
+// ----------------------------------------------------------------------------
+
+template< typename Type >
+void BinaryInputStream::readValue( Type& ornValue )
+{
+ readMemory( &ornValue, static_cast< sal_Int32 >( sizeof( Type ) ), sizeof( Type ) );
+ ByteOrderConverter::convertLittleEndian( ornValue );
+}
+
+template< typename Type >
+sal_Int32 BinaryInputStream::readArray( Type* opnArray, sal_Int32 nElemCount )
+{
+ sal_Int32 nRet = 0;
+ if( !mbEof )
+ {
+ sal_Int32 nReadSize = getLimitedValue< sal_Int32, sal_Int32 >( nElemCount, 0, SAL_MAX_INT32 / sizeof( Type ) ) * sizeof( Type );
+ nRet = readMemory( opnArray, nReadSize, sizeof( Type ) ) / sizeof( Type );
+ ByteOrderConverter::convertLittleEndianArray( opnArray, static_cast< size_t >( nRet ) );
+ }
+ return nRet;
+}
+
+template< typename Type >
+sal_Int32 BinaryInputStream::readArray( ::com::sun::star::uno::Sequence< Type >& orSequence, sal_Int32 nElemCount )
+{
+ orSequence.reallocate( nElemCount );
+ return orSequence.hasElements() ? readArray( orSequence.getArray(), nElemCount ) : 0;
+}
+
+template< typename Type >
+sal_Int32 BinaryInputStream::readArray( ::std::vector< Type >& orVector, sal_Int32 nElemCount )
+{
+ orVector.resize( static_cast< size_t >( nElemCount ) );
+ return orVector.empty() ? 0 : readArray( &orVector.front(), nElemCount );
+}
+
+template< typename Type >
+void BinaryInputStream::skipArray( sal_Int32 nElemCount )
+{
+ sal_Int32 nSkipSize = getLimitedValue< sal_Int32, sal_Int32 >( nElemCount, 0, SAL_MAX_INT32 / sizeof( Type ) ) * sizeof( Type );
+ skip( nSkipSize, sizeof( Type ) );
+}
+
+// ============================================================================
+
+/** Wraps a UNO input stream and provides convenient access functions.
+
+ The binary data in the stream is assumed to be in little-endian format.
+ */
+class OOX_DLLPUBLIC BinaryXInputStream : public BinaryXSeekableStream, public BinaryInputStream
+{
+public:
+ /** Constructs the wrapper object for the passed input stream.
+
+ @param rxInStream
+ The com.sun.star.io.XInputStream interface of the UNO input stream
+ to be wrapped.
+
+ @param bAutoClose
+ True = automatically close the wrapped input stream on destruction
+ of this wrapper or when close() is called.
+ */
+ explicit BinaryXInputStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
+ bool bAutoClose );
+
+ virtual ~BinaryXInputStream();
+
+ /** Closes the input stream. Does also close the wrapped UNO input stream
+ if bAutoClose has been set to true in the constructor. */
+ virtual void close();
+
+ /** Reads nBytes bytes to the passed sequence.
+ @return Number of bytes really read. */
+ virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 );
+
+ /** Reads nBytes bytes to the (existing) buffer opMem.
+ @return Number of bytes really read. */
+ virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 );
+
+ /** Seeks the stream forward by the passed number of bytes. This works for
+ non-seekable streams too. */
+ virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 );
+
+ /** Stream operator for all data types supported by the readValue() function. */
+ template< typename Type >
+ inline BinaryXInputStream& operator>>( Type& ornValue ) { readValue( ornValue ); return *this; }
+
+private:
+ StreamDataSequence maBuffer; ///< Data buffer used in readMemory() function.
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ mxInStrm; ///< Reference to the input stream.
+ bool mbAutoClose; ///< True = automatically close stream on destruction.
+};
+
+// ============================================================================
+
+/** Wraps a StreamDataSequence and provides convenient access functions.
+
+ The binary data in the stream is assumed to be in little-endian format.
+ */
+class OOX_DLLPUBLIC SequenceInputStream : public SequenceSeekableStream, public BinaryInputStream
+{
+public:
+ /** Constructs the wrapper object for the passed data sequence.
+
+ @attention
+ The passed data sequence MUST live at least as long as this stream
+ wrapper. The data sequence MUST NOT be changed from outside as long
+ as this stream wrapper is used to read from it.
+ */
+ explicit SequenceInputStream( const StreamDataSequence& rData );
+
+ /** Reads nBytes bytes to the passed sequence.
+ @return Number of bytes really read. */
+ virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 );
+
+ /** Reads nBytes bytes to the (existing) buffer opMem.
+ @return Number of bytes really read. */
+ virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 );
+
+ /** Seeks the stream forward by the passed number of bytes. This works for
+ non-seekable streams too. */
+ virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 );
+
+ /** Stream operator for all data types supported by the readValue() function. */
+ template< typename Type >
+ inline SequenceInputStream& operator>>( Type& ornValue ) { readValue( ornValue ); return *this; }
+
+private:
+ /** Returns the number of bytes available in the sequence for the passed byte count. */
+ inline sal_Int32 getMaxBytes( sal_Int32 nBytes ) const
+ { return getLimitedValue< sal_Int32, sal_Int32 >( nBytes, 0, mpData->getLength() - mnPos ); }
+};
+
+// ============================================================================
+
+/** Wraps a BinaryInputStream and provides access to a specific part of the
+ stream data.
+
+ Provides access to the stream data block starting at the current position
+ of the stream, and with a specific length. If the wrapped stream is
+ seekable, this wrapper will treat the position of the wrapped stream at
+ construction time as position "0" (therefore the class name).
+
+ The passed input stream MUST live at least as long as this stream wrapper.
+ The stream MUST NOT be changed from outside as long as this stream wrapper
+ is used to read from it.
+ */
+class RelativeInputStream : public BinaryInputStream
+{
+public:
+ /** Constructs the wrapper object for the passed stream.
+
+ @param nSize
+ If specified, restricts the amount of data that can be read from
+ the passed input stream.
+ */
+ explicit RelativeInputStream(
+ BinaryInputStream& rInStrm,
+ sal_Int64 nSize = SAL_MAX_INT64 );
+
+ /** Returns the size of the data block in the wrapped stream offered by
+ this wrapper. */
+ virtual sal_Int64 size() const;
+
+ /** Returns the current relative stream position. */
+ virtual sal_Int64 tell() const;
+
+ /** Seeks the stream to the passed relative position, if the wrapped stream
+ is seekable. */
+ virtual void seek( sal_Int64 nPos );
+
+ /** Closes the input stream but not the wrapped stream. */
+ virtual void close();
+
+ /** Reads nBytes bytes to the passed sequence. Does not read out of the
+ data block whose size has been specified on construction.
+ @return Number of bytes really read. */
+ virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 );
+
+ /** Reads nBytes bytes to the (existing) buffer opMem. Does not read out of
+ the data block whose size has been specified on construction.
+ @return Number of bytes really read. */
+ virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 );
+
+ /** Seeks the stream forward by the passed number of bytes. This works for
+ non-seekable streams too. Does not seek out of the data block. */
+ virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 );
+
+ /** Stream operator for all data types supported by the readValue() function. */
+ template< typename Type >
+ inline RelativeInputStream& operator>>( Type& ornValue ) { readValue( ornValue ); return *this; }
+
+private:
+ /** Returns the number of bytes available in the sequence for the passed byte count. */
+ inline sal_Int32 getMaxBytes( sal_Int32 nBytes ) const
+ { return getLimitedValue< sal_Int32, sal_Int64 >( nBytes, 0, mnSize - mnRelPos ); }
+
+private:
+ BinaryInputStream* mpInStrm;
+ sal_Int64 mnStartPos;
+ sal_Int64 mnRelPos;
+ sal_Int64 mnSize;
+};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/binaryoutputstream.hxx b/include/oox/helper/binaryoutputstream.hxx
new file mode 100644
index 000000000000..0882821e9834
--- /dev/null
+++ b/include/oox/helper/binaryoutputstream.hxx
@@ -0,0 +1,189 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_HELPER_BINARYOUTPUTSTREAM_HXX
+#define OOX_HELPER_BINARYOUTPUTSTREAM_HXX
+
+#include "oox/helper/binarystreambase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace io { class XOutputStream; }
+} } }
+
+namespace oox {
+
+// ============================================================================
+
+/** Interface for binary output stream classes.
+
+ The binary data in the stream is written in little-endian format.
+ */
+class BinaryOutputStream : public virtual BinaryStreamBase
+{
+public:
+ /** Derived classes implement writing the contents of the passed data
+ sequence.
+
+ @param nAtomSize
+ The size of the elements in the memory block, if available. Derived
+ classes may be interested in this information.
+ */
+ virtual void writeData( const StreamDataSequence& rData, size_t nAtomSize = 1 ) = 0;
+
+ /** Derived classes implement writing the contents of the (preallocated!)
+ memory buffer pMem.
+
+ @param nAtomSize
+ The size of the elements in the memory block, if available. Derived
+ classes may be interested in this information.
+ */
+ virtual void writeMemory( const void* pMem, sal_Int32 nBytes, size_t nAtomSize = 1 ) = 0;
+
+ /** Writes a value to the stream and converts it to platform byte order.
+ All data types supported by the ByteOrderConverter class can be used.
+ */
+ template< typename Type >
+ void writeValue( Type nValue );
+
+ template< typename Type >
+ void writeArray( Type* opnArray, sal_Int32 nElemCount );
+
+ /** Stream operator for all data types supported by the writeValue() function. */
+ template< typename Type >
+ inline BinaryOutputStream& operator<<( Type nValue ) { writeValue( nValue ); return *this; }
+
+ void writeCompressedUnicodeArray( const OUString& rString, bool bCompressed, bool bAllowNulChars = false );
+
+ void writeCharArrayUC( const OUString& rString, rtl_TextEncoding eTextEnc, bool bAllowNulChars = false );
+
+ void writeUnicodeArray( const OUString& rString, bool bAllowNulChars = false );
+
+protected:
+ /** This dummy default c'tor will never call the c'tor of the virtual base
+ class BinaryStreamBase as this class cannot be instanciated directly. */
+ inline explicit BinaryOutputStream() : BinaryStreamBase( false ) {}
+};
+
+template< typename Type >
+void BinaryOutputStream::writeArray( Type* opnArray, sal_Int32 nElemCount )
+{
+ sal_Int32 nWriteSize = getLimitedValue< sal_Int32, sal_Int32 >( nElemCount, 0, SAL_MAX_INT32 / sizeof( Type ) ) * sizeof( Type );
+ ByteOrderConverter::convertLittleEndianArray( opnArray, static_cast< size_t >( nWriteSize ) );
+ writeMemory( opnArray, nWriteSize, sizeof( Type ) );
+}
+
+typedef ::boost::shared_ptr< BinaryOutputStream > BinaryOutputStreamRef;
+
+// ----------------------------------------------------------------------------
+
+template< typename Type >
+void BinaryOutputStream::writeValue( Type nValue )
+{
+ ByteOrderConverter::convertLittleEndian( nValue );
+ writeMemory( &nValue, static_cast< sal_Int32 >( sizeof( Type ) ), sizeof( Type ) );
+}
+
+// ============================================================================
+
+/** Wraps a UNO output stream and provides convenient access functions.
+
+ The binary data in the stream is written in little-endian format.
+ */
+class BinaryXOutputStream : public BinaryXSeekableStream, public BinaryOutputStream
+{
+public:
+ /** Constructs the wrapper object for the passed output stream.
+
+ @param rxOutStream
+ The com.sun.star.io.XOutputStream interface of the output stream to
+ be wrapped.
+
+ @param bAutoClose
+ True = automatically close the wrapped output stream on destruction
+ of this wrapper or when close() is called.
+ */
+ explicit BinaryXOutputStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rxOutStrm,
+ bool bAutoClose );
+
+ virtual ~BinaryXOutputStream();
+
+ /** Flushes and closes the output stream. Does also close the wrapped UNO
+ output stream if bAutoClose has been set to true in the constructor. */
+ void close();
+
+ /** Writes the passed data sequence. */
+ virtual void writeData( const StreamDataSequence& rData, size_t nAtomSize = 1 );
+
+ /** Write nBytes bytes from the (preallocated!) buffer pMem. */
+ virtual void writeMemory( const void* pMem, sal_Int32 nBytes, size_t nAtomSize = 1 );
+
+ /** Stream operator for all data types supported by the writeValue() function. */
+ template< typename Type >
+ inline BinaryXOutputStream& operator<<( Type nValue ) { writeValue( nValue ); return *this; }
+
+ /** Returns the XOutputStream interface of the wrapped output stream. */
+ inline ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
+ getXOutputStream() const { return mxOutStrm; }
+
+private:
+ StreamDataSequence maBuffer; ///< Data buffer used in writeMemory() function.
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
+ mxOutStrm; ///< Reference to the output stream.
+ bool mbAutoClose; ///< True = automatically close stream on destruction.
+};
+
+// ============================================================================
+
+/** Wraps a StreamDataSequence and provides convenient access functions.
+
+ The binary data in the stream is written in little-endian format. After
+ construction, the stream points to the beginning of the passed data
+ sequence. The data sequence is expanded automatically while writing to it.
+ */
+class OOX_DLLPUBLIC SequenceOutputStream : public SequenceSeekableStream, public BinaryOutputStream
+{
+public:
+ /** Constructs the wrapper object for the passed data sequence.
+
+ @attention
+ The passed data sequence MUST live at least as long as this stream
+ wrapper. The data sequence MUST NOT be changed from outside as long
+ as this stream wrapper is used to write to it.
+ */
+ explicit SequenceOutputStream( StreamDataSequence& rData );
+
+ /** Writes the passed data sequence. */
+ virtual void writeData( const StreamDataSequence& rData, size_t nAtomSize = 1 );
+
+ /** Write nBytes bytes from the (preallocated!) buffer pMem. */
+ virtual void writeMemory( const void* pMem, sal_Int32 nBytes, size_t nAtomSize = 1 );
+
+ /** Stream operator for all data types supported by the writeValue() function. */
+ template< typename Type >
+ inline SequenceOutputStream& operator<<( Type nValue ) { writeValue( nValue ); return *this; }
+};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/binarystreambase.hxx b/include/oox/helper/binarystreambase.hxx
new file mode 100644
index 000000000000..d9ab979de019
--- /dev/null
+++ b/include/oox/helper/binarystreambase.hxx
@@ -0,0 +1,187 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_HELPER_BINARYSTREAMBASE_HXX
+#define OOX_HELPER_BINARYSTREAMBASE_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <boost/shared_ptr.hpp>
+#include "oox/helper/helper.hxx"
+#include "oox/dllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace io { class XSeekable; }
+} } }
+
+namespace oox {
+
+typedef ::com::sun::star::uno::Sequence< sal_Int8 > StreamDataSequence;
+
+// ============================================================================
+
+/** Base class for binary stream classes.
+ */
+class OOX_DLLPUBLIC BinaryStreamBase
+{
+public:
+ virtual ~BinaryStreamBase();
+
+ /** Implementations return the size of the stream, if possible.
+
+ This function may be implemented for some types of unseekable streams,
+ and MUST be implemented for all seekable streams.
+
+ @return
+ The size of the stream in bytes, or -1, if not implemented.
+ */
+ virtual sal_Int64 size() const = 0;
+
+ /** Implementations return the current stream position, if possible.
+
+ This function may be implemented for some types of unseekable streams,
+ and MUST be implemented for all seekable streams.
+
+ @return
+ The current position in the stream, or -1, if not implemented.
+ */
+ virtual sal_Int64 tell() const = 0;
+
+ /** Implementations seek the stream to the passed position, if
+ the stream is seekable.
+ */
+ virtual void seek( sal_Int64 nPos ) = 0;
+
+ /** Implementations close the stream.
+ */
+ virtual void close() = 0;
+
+ /** Returns true, if the implementation supports the seek() operation.
+
+ Implementations may still implement size() and tell() even if the
+ stream is not seekable.
+ */
+ inline bool isSeekable() const { return mbSeekable; }
+
+ /** Returns true, if the stream position is invalid (EOF). This flag turns
+ true *after* the first attempt to seek/read beyond the stream end.
+ */
+ inline bool isEof() const { return mbEof; }
+
+ /** Returns the size of the remaining data available in the stream, if
+ stream supports size() and tell(), otherwise -1.
+ */
+ sal_Int64 getRemaining() const;
+
+ /** Seeks the stream to the beginning, if stream is seekable.
+ */
+ inline void seekToStart() { seek( 0 ); }
+
+ /** Seeks the stream to the end, if stream is seekable.
+ */
+ inline void seekToEnd() { seek( size() ); }
+
+ /** Seeks the stream forward to a position that is a multiple of the passed
+ block size, if stream is seekable.
+
+ @param nBlockSize
+ The size of the data blocks the streams needs to be aligned to.
+
+ @param nAnchorPos
+ Position in the stream the data blocks are aligned to.
+ */
+ void alignToBlock( sal_Int32 nBlockSize, sal_Int64 nAnchorPos = 0 );
+
+protected:
+ inline explicit BinaryStreamBase( bool bSeekable ) : mbEof( false ), mbSeekable( bSeekable ) {}
+
+private:
+ BinaryStreamBase( const BinaryStreamBase& );
+ BinaryStreamBase& operator=( const BinaryStreamBase& );
+
+protected:
+ bool mbEof; ///< End of stream flag.
+
+private:
+ const bool mbSeekable; ///< True = implementation supports seeking.
+};
+
+// ============================================================================
+
+/** Base class for binary input and output streams wrapping a UNO stream,
+ seekable via the com.sun.star.io.XSeekable interface.
+ */
+class OOX_DLLPUBLIC BinaryXSeekableStream : public virtual BinaryStreamBase
+{
+public:
+ virtual ~BinaryXSeekableStream();
+
+ /** Returns the size of the stream, if wrapped stream is seekable, otherwise -1. */
+ virtual sal_Int64 size() const;
+ /** Returns the current stream position, if wrapped stream is seekable, otherwise -1. */
+ virtual sal_Int64 tell() const;
+ /** Seeks the stream to the passed position, if wrapped stream is seekable. */
+ virtual void seek( sal_Int64 nPos );
+ /** Releases the reference to the UNO XSeekable interface. */
+ virtual void close();
+
+protected:
+ explicit BinaryXSeekableStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XSeekable >& rxSeekable );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XSeekable >
+ mxSeekable; ///< Stream seeking interface.
+};
+
+// ============================================================================
+
+/** Base class for binary input and output streams wrapping a
+ StreamDataSequence, which is always seekable.
+
+ The wrapped data sequence MUST live at least as long as this stream
+ wrapper. The data sequence MUST NOT be changed from outside as long as this
+ stream wrapper is used to modify it.
+ */
+class OOX_DLLPUBLIC SequenceSeekableStream : public virtual BinaryStreamBase
+{
+public:
+ /** Returns the size of the wrapped data sequence. */
+ virtual sal_Int64 size() const;
+ /** Returns the current stream position. */
+ virtual sal_Int64 tell() const;
+ /** Seeks the stream to the passed position. */
+ virtual void seek( sal_Int64 nPos );
+ /** Releases the reference to the data sequence. */
+ virtual void close();
+
+protected:
+ explicit SequenceSeekableStream( const StreamDataSequence& rData );
+
+protected:
+ const StreamDataSequence* mpData; ///< Wrapped data sequence.
+ sal_Int32 mnPos; ///< Current position in the sequence.
+};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/containerhelper.hxx b/include/oox/helper/containerhelper.hxx
new file mode 100644
index 000000000000..f3b27f05b1e2
--- /dev/null
+++ b/include/oox/helper/containerhelper.hxx
@@ -0,0 +1,410 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_HELPER_CONTAINERHELPER_HXX
+#define OOX_HELPER_CONTAINERHELPER_HXX
+
+#include <map>
+#include <vector>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+#include "oox/dllapi.h"
+
+
+namespace com { namespace sun { namespace star {
+ namespace container { class XIndexAccess; }
+ namespace container { class XIndexContainer; }
+ namespace container { class XNameAccess; }
+ namespace container { class XNameContainer; }
+ namespace uno { class XComponentContext; }
+} } }
+
+namespace oox {
+
+// ============================================================================
+
+/** A range of signed 32-bit integer values. */
+struct ValueRange
+{
+ sal_Int32 mnFirst;
+ sal_Int32 mnLast;
+
+ inline explicit ValueRange( sal_Int32 nValue = 0 ) : mnFirst( nValue ), mnLast( nValue ) {}
+ inline explicit ValueRange( sal_Int32 nFirst, sal_Int32 nLast ) : mnFirst( nFirst ), mnLast( nLast ) {}
+
+ inline bool operator==( const ValueRange& rRange ) const { return (mnFirst == rRange.mnFirst) && (mnLast == rRange.mnLast); }
+ inline bool operator!=( const ValueRange& rRange ) const { return !(*this == rRange); }
+ inline bool contains( sal_Int32 nValue ) const { return (mnFirst <= nValue) && (nValue <= mnLast); }
+ inline bool contains( const ValueRange& rRange ) const { return (mnFirst <= rRange.mnFirst) && (rRange.mnLast <= mnLast); }
+ inline bool intersects( const ValueRange& rRange ) const { return (mnFirst <= rRange.mnLast) && (rRange.mnFirst <= mnLast); }
+};
+
+// ----------------------------------------------------------------------------
+
+typedef ::std::vector< ValueRange > ValueRangeVector;
+
+// ----------------------------------------------------------------------------
+
+/** An ordered list of value ranges. The insertion operation will merge
+ consecutive value ranges.
+ */
+class OOX_DLLPUBLIC ValueRangeSet
+{
+public:
+ inline explicit ValueRangeSet() {}
+
+ /** Inserts the passed value into the range list. */
+ inline void insert( sal_Int32 nValue ) { insert( ValueRange( nValue ) ); }
+ /** Inserts the passed value range into the range list. */
+ void insert( const ValueRange& rRange );
+
+ /** Returns the ordered list of all value ranges. */
+ inline const ValueRangeVector& getRanges() const { return maRanges; }
+
+private:
+ ValueRangeVector maRanges;
+};
+
+// ============================================================================
+
+/** Template for a 2-dimensional array of objects.
+
+ This class template provides a similar interface to the ::std::vector
+ template.
+ */
+template< typename Type >
+class Matrix
+{
+public:
+ typedef ::std::vector< Type > container_type;
+ typedef typename container_type::value_type value_type;
+ typedef typename container_type::pointer pointer;
+ typedef typename container_type::reference reference;
+ typedef typename container_type::const_reference const_reference;
+ typedef typename container_type::size_type size_type;
+ typedef typename container_type::iterator iterator;
+ typedef typename container_type::const_iterator const_iterator;
+
+ inline explicit Matrix() : mnWidth( 0 ) {}
+ inline explicit Matrix( size_type nWidth, size_type nHeight ) { this->resize( nWidth, nHeight ); }
+ inline explicit Matrix( size_type nWidth, size_type nHeight, const_reference rData ) { this->resize( nWidth, nHeight, rData ); }
+
+ inline size_type capacity() const { return maData.capacity(); }
+ inline bool empty() const { return maData.empty(); }
+ inline size_type size() const { return maData.size(); }
+ inline size_type width() const { return mnWidth; }
+ inline size_type height() const { return this->empty() ? 0 : (this->size() / this->width()); }
+ inline bool has( size_type nX, size_type nY ) const { return (nX < this->width()) && (nY < this->height()); }
+
+ inline void reserve( size_type nWidth, size_type nHeight ) { maData.reserve( nWidth * nHeight ); }
+ inline void clear() { this->resize( 0, 0 ); }
+ inline void resize( size_type nWidth, size_type nHeight ) { mnWidth = nWidth; maData.resize( nWidth * nHeight ); }
+ inline void resize( size_type nWidth, size_type nHeight, const_reference rData ) { mnWidth = nWidth; maData.resize( nWidth * nHeight, rData ); }
+
+ inline iterator at( size_type nX, size_type nY ) { return maData.begin() + mnWidth * nY + nX; }
+ inline const_iterator at( size_type nX, size_type nY ) const { return maData.begin() + mnWidth * nY + nX; }
+
+ inline reference operator()( size_type nX, size_type nY ) { return *this->at( nX, nY ); }
+ inline const_reference operator()( size_type nX, size_type nY ) const { return *this->at( nX, nY ); }
+
+ inline iterator begin() { return maData.begin(); }
+ inline const_iterator begin() const { return maData.begin(); }
+ inline iterator end() { return maData.end(); }
+ inline const_iterator end() const { return maData.end(); }
+
+ inline reference front() { return maData.front(); }
+ inline const_reference front() const { return maData.front(); }
+ inline reference back() { return maData.back(); }
+ inline const_reference back() const { return maData.back(); }
+
+ inline iterator row_begin( size_type nY ) { return this->at( 0, nY ); }
+ inline const_iterator row_begin( size_type nY ) const { return this->at( 0, nY ); }
+ inline iterator row_end( size_type nY ) { return this->at( mnWidth, nY ); }
+ inline const_iterator row_end( size_type nY ) const { return this->at( mnWidth, nY ); }
+
+ inline reference row_front( size_type nY ) { return (*this)( 0, nY ); }
+ inline const_reference row_front( size_type nY ) const { return (*this)( 0, nY ); }
+ inline reference row_back( size_type nY ) { return (*this)( mnWidth - 1, nY ); }
+ inline const_reference row_back( size_type nY ) const { return (*this)( mnWidth - 1, nY ); }
+
+ inline void swap( Matrix& rMatrix ) { maData.swap( rMatrix.maData ); }
+
+private:
+ container_type maData;
+ size_type mnWidth;
+};
+
+// ============================================================================
+
+/** Static helper functions for improved API container handling. */
+class OOX_DLLPUBLIC ContainerHelper
+{
+public:
+
+ /** Returns a name that is not used in the passed name container.
+
+ @param rxNameAccess com.sun.star.container.XNameAccess interface of
+ the name container.
+
+ @param rSuggestedName Suggested name for the object.
+
+ @return An unused name. Will be equal to the suggested name, if not
+ contained, otherwise a numerical index will be appended.
+ */
+ static OUString getUnusedName(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& rxNameAccess,
+ const OUString& rSuggestedName,
+ sal_Unicode cSeparator,
+ sal_Int32 nFirstIndexToAppend = 1 );
+
+ /** Inserts an object into a name container.
+
+ @param rxNameContainer com.sun.star.container.XNameContainer interface
+ of the name container.
+
+ @param rName Exact name for the object.
+
+ @param rObject The object to be inserted.
+
+ @return True = object successfully inserted.
+ */
+ static bool insertByName(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxNameContainer,
+ const OUString& rName,
+ const ::com::sun::star::uno::Any& rObject,
+ bool bReplaceOldExisting = true );
+
+ /** Inserts an object into a name container.
+
+ The function will use an unused name to insert the object, based on the
+ suggested object name. It is possible to specify whether the existing
+ object or the new inserted object will be renamed, if the container
+ already has an object with the name suggested for the new object.
+
+ @param rxNameContainer com.sun.star.container.XNameContainer interface
+ of the name container.
+
+ @param rSuggestedName Suggested name for the object.
+
+ @param rObject The object to be inserted.
+
+ @param bRenameOldExisting Specifies behaviour if an object with the
+ suggested name already exists. If false (default), the new object
+ will be inserted with a name not yet extant in the container (this
+ is done by appending a numerical index to the suggested name). If
+ true, the existing object will be removed and inserted with an
+ unused name, and the new object will be inserted with the suggested
+ name.
+
+ @return The final name the object is inserted with. Will always be
+ equal to the suggested name, if parameter bRenameOldExisting is
+ true.
+ */
+ static OUString insertByUnusedName(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxNameContainer,
+ const OUString& rSuggestedName,
+ sal_Unicode cSeparator,
+ const ::com::sun::star::uno::Any& rObject,
+ bool bRenameOldExisting = false );
+
+ // std::vector and std::map element access --------------------------------
+
+ /** Returns the pointer to an existing element of the passed vector, or a
+ null pointer, if the passed index is out of bounds. */
+ template< typename VectorType >
+ static const typename VectorType::value_type*
+ getVectorElement( const VectorType& rVector, sal_Int32 nIndex );
+
+ /** Returns the pointer to an existing element of the passed vector, or a
+ null pointer, if the passed index is out of bounds. */
+ template< typename VectorType >
+ static typename VectorType::value_type*
+ getVectorElementAccess( VectorType& rVector, sal_Int32 nIndex );
+
+ /** Returns the reference to an existing element of the passed vector, or
+ the passed default value, if the passed index is out of bounds. */
+ template< typename VectorType >
+ static const typename VectorType::value_type&
+ getVectorElement( const VectorType& rVector, sal_Int32 nIndex, const typename VectorType::value_type& rDefault );
+
+ /** Returns the reference to an existing element of the passed vector, or
+ the passed default value, if the passed index is out of bounds. */
+ template< typename VectorType >
+ static typename VectorType::value_type&
+ getVectorElementAccess( VectorType& rVector, sal_Int32 nIndex, typename VectorType::value_type& rDefault );
+
+ /** Returns the pointer to an existing element of the passed map, or a null
+ pointer, if an element with the passed key does not exist. */
+ template< typename MapType >
+ static const typename MapType::mapped_type*
+ getMapElement( const MapType& rMap, const typename MapType::key_type& rKey );
+
+ /** Returns the pointer to an existing element of the passed map, or a null
+ pointer, if an element with the passed key does not exist. */
+ template< typename MapType >
+ static typename MapType::mapped_type*
+ getMapElementAccess( MapType& rMap, const typename MapType::key_type& rKey );
+
+ /** Returns the reference to an existing element of the passed map, or the
+ passed default value, if an element with the passed key does not exist. */
+ template< typename MapType >
+ static const typename MapType::mapped_type&
+ getMapElement( const MapType& rMap, const typename MapType::key_type& rKey, const typename MapType::mapped_type& rDefault );
+
+ /** Returns the reference to an existing element of the passed map, or the
+ passed default value, if an element with the passed key does not exist. */
+ template< typename MapType >
+ static typename MapType::mapped_type&
+ getMapElementAccess( MapType& rMap, const typename MapType::key_type& rKey, typename MapType::mapped_type& rDefault );
+
+ // vector/map/matrix to UNO sequence --------------------------------------
+
+ /** Creates a UNO sequence from a std::vector with copies of all elements.
+
+ @param rVector The vector to be converted to a sequence.
+
+ @return A com.sun.star.uno.Sequence object with copies of all objects
+ contained in the passed vector.
+ */
+ template< typename VectorType >
+ static ::com::sun::star::uno::Sequence< typename VectorType::value_type >
+ vectorToSequence( const VectorType& rVector );
+
+ /** Creates a UNO sequence from a std::map with copies of all elements.
+
+ @param rMap The map to be converted to a sequence.
+
+ @return A com.sun.star.uno.Sequence object with copies of all objects
+ contained in the passed map.
+ */
+ template< typename MapType >
+ static ::com::sun::star::uno::Sequence< typename MapType::mapped_type >
+ mapToSequence( const MapType& rMap );
+
+ /** Creates a UNO sequence of sequences from a matrix with copies of all elements.
+
+ @param rMatrix The matrix to be converted to a sequence of sequences.
+
+ @return A com.sun.star.uno.Sequence object containing
+ com.sun.star.uno.Sequence objects with copies of all objects
+ contained in the passed matrix.
+ */
+ template< typename MatrixType >
+ static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< typename MatrixType::value_type > >
+ matrixToSequenceSequence( const MatrixType& rMatrix );
+};
+
+// ----------------------------------------------------------------------------
+
+template< typename VectorType >
+/*static*/ const typename VectorType::value_type* ContainerHelper::getVectorElement( const VectorType& rVector, sal_Int32 nIndex )
+{
+ return ((0 <= nIndex) && (static_cast< size_t >( nIndex ) < rVector.size())) ? &rVector[ static_cast< size_t >( nIndex ) ] : 0;
+}
+
+template< typename VectorType >
+/*static*/ typename VectorType::value_type* ContainerHelper::getVectorElementAccess( VectorType& rVector, sal_Int32 nIndex )
+{
+ return ((0 <= nIndex) && (static_cast< size_t >( nIndex ) < rVector.size())) ? &rVector[ static_cast< size_t >( nIndex ) ] : 0;
+}
+
+template< typename VectorType >
+/*static*/ const typename VectorType::value_type& ContainerHelper::getVectorElement( const VectorType& rVector, sal_Int32 nIndex, const typename VectorType::value_type& rDefault )
+{
+ return ((0 <= nIndex) && (static_cast< size_t >( nIndex ) < rVector.size())) ? rVector[ static_cast< size_t >( nIndex ) ] : rDefault;
+}
+
+template< typename VectorType >
+/*static*/ typename VectorType::value_type& ContainerHelper::getVectorElementAccess( VectorType& rVector, sal_Int32 nIndex, typename VectorType::value_type& rDefault )
+{
+ return ((0 <= nIndex) && (static_cast< size_t >( nIndex ) < rVector.size())) ? rVector[ static_cast< size_t >( nIndex ) ] : rDefault;
+}
+
+template< typename MapType >
+/*static*/ const typename MapType::mapped_type* ContainerHelper::getMapElement( const MapType& rMap, const typename MapType::key_type& rKey )
+{
+ typename MapType::const_iterator aIt = rMap.find( rKey );
+ return (aIt == rMap.end()) ? 0 : &aIt->second;
+}
+
+template< typename MapType >
+/*static*/ typename MapType::mapped_type* ContainerHelper::getMapElementAccess( MapType& rMap, const typename MapType::key_type& rKey )
+{
+ typename MapType::iterator aIt = rMap.find( rKey );
+ return (aIt == rMap.end()) ? 0 : &aIt->second;
+}
+
+template< typename MapType >
+/*static*/ const typename MapType::mapped_type& ContainerHelper::getMapElement( const MapType& rMap, const typename MapType::key_type& rKey, const typename MapType::mapped_type& rDefault )
+{
+ typename MapType::const_iterator aIt = rMap.find( rKey );
+ return (aIt == rMap.end()) ? rDefault : aIt->second;
+}
+
+template< typename MapType >
+/*static*/ typename MapType::mapped_type& ContainerHelper::getMapElementAccess( MapType& rMap, const typename MapType::key_type& rKey, typename MapType::mapped_type& rDefault )
+{
+ typename MapType::iterator aIt = rMap.find( rKey );
+ return (aIt == rMap.end()) ? rDefault : aIt->second;
+}
+
+template< typename VectorType >
+/*static*/ ::com::sun::star::uno::Sequence< typename VectorType::value_type > ContainerHelper::vectorToSequence( const VectorType& rVector )
+{
+ typedef typename VectorType::value_type ValueType;
+ if( rVector.empty() )
+ return ::com::sun::star::uno::Sequence< ValueType >();
+ return ::com::sun::star::uno::Sequence< ValueType >( &rVector.front(), static_cast< sal_Int32 >( rVector.size() ) );
+}
+
+template< typename MapType >
+/*static*/ ::com::sun::star::uno::Sequence< typename MapType::mapped_type > ContainerHelper::mapToSequence( const MapType& rMap )
+{
+ typedef typename MapType::mapped_type ValueType;
+ if( rMap.empty() )
+ return ::com::sun::star::uno::Sequence< ValueType >();
+ ::com::sun::star::uno::Sequence< ValueType > aSeq( static_cast< sal_Int32 >( rMap.size() ) );
+ sal_Int32 nIndex = 0;
+ for( typename MapType::const_iterator aIt = rMap.begin(), aEnd = rMap.end(); aIt != aEnd; ++aIt, ++nIndex )
+ aSeq[ nIndex ] = *aIt;
+ return aSeq;
+}
+
+template< typename MatrixType >
+/*static*/ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< typename MatrixType::value_type > > ContainerHelper::matrixToSequenceSequence( const MatrixType& rMatrix )
+{
+ typedef typename MatrixType::value_type ValueType;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ValueType > > aSeq;
+ if( !rMatrix.empty() )
+ {
+ aSeq.realloc( static_cast< sal_Int32 >( rMatrix.height() ) );
+ for( size_t nRow = 0, nHeight = rMatrix.height(); nRow < nHeight; ++nRow )
+ aSeq[ static_cast< sal_Int32 >( nRow ) ] =
+ ::com::sun::star::uno::Sequence< ValueType >( &rMatrix.row_front( nRow ), static_cast< sal_Int32 >( rMatrix.width() ) );
+ }
+ return aSeq;
+}
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/graphichelper.hxx b/include/oox/helper/graphichelper.hxx
new file mode 100644
index 000000000000..0681716bc84f
--- /dev/null
+++ b/include/oox/helper/graphichelper.hxx
@@ -0,0 +1,168 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_HELPER_GRAPHICHELPER_HXX
+#define OOX_HELPER_GRAPHICHELPER_HXX
+
+#include <deque>
+#include <map>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/awt/DeviceInfo.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include "oox/helper/binarystreambase.hxx"
+#include "oox/helper/storagebase.hxx"
+
+struct WMF_EXTERNALHEADER;
+
+namespace com { namespace sun { namespace star {
+ namespace awt { struct Point; }
+ namespace awt { struct Size; }
+ namespace awt { class XUnitConversion; }
+ namespace io { class XInputStream; }
+ namespace frame { class XFrame; }
+ namespace graphic { class XGraphic; }
+ namespace graphic { class XGraphicObject; }
+ namespace graphic { class XGraphicProvider; }
+ namespace uno { class XComponentContext; }
+} } }
+
+namespace oox {
+
+// ============================================================================
+
+/** Provides helper functions for colors, device measurement conversion,
+ graphics, and graphic objects handling.
+
+ All createGraphicObject() and importGraphicObject() functions create
+ persistent graphic objects internally and store them in an internal
+ container to prevent their early destruction. This makes it possible to use
+ the returned URL of the graphic object in any way (e.g. insert it into a
+ property map) without needing to store it immediately at an object that
+ resolves the graphic object from the passed URL and thus prevents it from
+ being destroyed.
+ */
+class OOX_DLLPUBLIC GraphicHelper
+{
+public:
+ explicit GraphicHelper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxTargetFrame,
+ const StorageRef& rxStorage );
+ virtual ~GraphicHelper();
+
+ // System colors and predefined colors ------------------------------------
+
+ /** Returns a system color specified by the passed XML token identifier. */
+ sal_Int32 getSystemColor( sal_Int32 nToken, sal_Int32 nDefaultRgb = API_RGB_TRANSPARENT ) const;
+ /** Derived classes may implement to resolve a scheme color from the passed XML token identifier. */
+ virtual sal_Int32 getSchemeColor( sal_Int32 nToken ) const;
+ /** Derived classes may implement to resolve a palette index to an RGB color. */
+ virtual sal_Int32 getPaletteColor( sal_Int32 nPaletteIdx ) const;
+
+ // Device info and device dependent unit conversion -----------------------
+
+ /** Returns information about the output device. */
+ const ::com::sun::star::awt::DeviceInfo& getDeviceInfo() const;
+
+ /** Converts the passed value from horizontal screen pixels to 1/100 mm. */
+ sal_Int32 convertScreenPixelXToHmm( double fPixelX ) const;
+ /** Converts the passed value from vertical screen pixels to 1/100 mm. */
+ sal_Int32 convertScreenPixelYToHmm( double fPixelY ) const;
+ /** Converts the passed size from screen pixels to 1/100 mm. */
+ ::com::sun::star::awt::Size convertScreenPixelToHmm( const ::com::sun::star::awt::Size& rPixel ) const;
+
+ /** Converts the passed value from 1/100 mm to horizontal screen pixels. */
+ double convertHmmToScreenPixelX( sal_Int32 nHmmX ) const;
+ /** Converts the passed value from 1/100 mm to vertical screen pixels. */
+ double convertHmmToScreenPixelY( sal_Int32 nHmmY ) const;
+ /** Converts the passed point from 1/100 mm to screen pixels. */
+ ::com::sun::star::awt::Point convertHmmToScreenPixel( const ::com::sun::star::awt::Point& rHmm ) const;
+ /** Converts the passed size from 1/100 mm to screen pixels. */
+ ::com::sun::star::awt::Size convertHmmToScreenPixel( const ::com::sun::star::awt::Size& rHmm ) const;
+
+ /** Converts the passed point from 1/100 mm to AppFont units. */
+ ::com::sun::star::awt::Point convertHmmToAppFont( const ::com::sun::star::awt::Point& rHmm ) const;
+ /** Converts the passed size from 1/100 mm to AppFont units. */
+ ::com::sun::star::awt::Size convertHmmToAppFont( const ::com::sun::star::awt::Size& rHmm ) const;
+
+ // Graphics and graphic objects ------------------------------------------
+
+ /** Imports a graphic from the passed input stream. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >
+ importGraphic(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
+ const WMF_EXTERNALHEADER* pExtHeader = NULL ) const;
+
+ /** Imports a graphic from the passed binary memory block. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >
+ importGraphic( const StreamDataSequence& rGraphicData ) const;
+
+ /** Imports a graphic from the storage stream with the passed path and name. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >
+ importEmbeddedGraphic( const OUString& rStreamName ) const;
+
+ /** Creates a persistent graphic object from the passed graphic.
+ @return The URL of the created and internally cached graphic object. */
+ OUString createGraphicObject(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& rxGraphic ) const;
+
+ /** Creates a persistent graphic object from the passed input stream.
+ @return The URL of the created and internally cached graphic object. */
+ OUString importGraphicObject(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
+ const WMF_EXTERNALHEADER* pExtHeader = NULL ) const;
+
+ /** Creates a persistent graphic object from the passed binary memory block.
+ @return The URL of the created and internally cached graphic object. */
+ OUString importGraphicObject( const StreamDataSequence& rGraphicData ) const;
+
+ /** Imports a graphic object from the storage stream with the passed path and name.
+ @return The URL of the created and internally cached graphic object. */
+ OUString importEmbeddedGraphicObject( const OUString& rStreamName ) const;
+
+ /** calculates the orignal size of a graphic which is necessary to be able to calculate cropping values
+ @return The original Graphic size in 100thmm */
+ ::com::sun::star::awt::Size getOriginalSize( const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& rxGraphic ) const;
+
+ // ------------------------------------------------------------------------
+private:
+ typedef ::std::map< sal_Int32, sal_Int32 > SystemPalette;
+ typedef ::std::deque< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > > GraphicObjectDeque;
+ typedef ::std::map< OUString, ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > > EmbeddedGraphicMap;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicProvider > mxGraphicProvider;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XUnitConversion > mxUnitConversion;
+ ::com::sun::star::awt::DeviceInfo maDeviceInfo; ///< Current output device info.
+ SystemPalette maSystemPalette; ///< Maps system colors (XML tokens) to RGB color values.
+ StorageRef mxStorage; ///< Storage containing embedded graphics.
+ mutable GraphicObjectDeque maGraphicObjects; ///< Caches all created graphic objects to keep them alive.
+ mutable EmbeddedGraphicMap maEmbeddedGraphics; ///< Maps all embedded graphics by their storage path.
+ const OUString maGraphicObjScheme; ///< The URL scheme name for graphic objects.
+ double mfPixelPerHmmX; ///< Number of screen pixels per 1/100 mm in X direction.
+ double mfPixelPerHmmY; ///< Number of screen pixels per 1/100 mm in Y direction.
+};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx
new file mode 100644
index 000000000000..4f8e738354d4
--- /dev/null
+++ b/include/oox/helper/helper.hxx
@@ -0,0 +1,334 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_HELPER_HELPER_HXX
+#define OOX_HELPER_HELPER_HXX
+
+#include <algorithm>
+#include <limits>
+#include <boost/static_assert.hpp>
+#include <osl/endian.h>
+#include <rtl/math.hxx>
+#include <rtl/string.hxx>
+#include <rtl/ustring.hxx>
+#include <string.h>
+
+namespace oox {
+
+// Helper macros ==============================================================
+
+/** Expands to the number of elements in a STATIC data array. */
+#define STATIC_ARRAY_SIZE( array ) \
+ (sizeof(array)/sizeof(*(array)))
+
+/** Expands to a pointer behind the last element of a STATIC data array (like
+ STL end()). */
+#define STATIC_ARRAY_END( array ) \
+ ((array)+STATIC_ARRAY_SIZE(array))
+
+/** Expands to the 'index'-th element of a STATIC data array, or to 'def', if
+ 'index' is out of the array limits. */
+#define STATIC_ARRAY_SELECT( array, index, def ) \
+ ((static_cast<size_t>(index) < STATIC_ARRAY_SIZE(array)) ? ((array)[static_cast<size_t>(index)]) : (def))
+
+/** Expands to a temporary OString, created from a literal(!) character
+ array. */
+#define CREATE_OSTRING( ascii ) \
+ OString( RTL_CONSTASCII_STRINGPARAM( ascii ) )
+
+/** Convert an OUString to an ASCII C string. Use for debug purposes only. */
+#define OUSTRING_TO_CSTR( str ) \
+ OUStringToOString( str, RTL_TEXTENCODING_ASCII_US ).getStr()
+
+// Common constants ===========================================================
+
+const sal_uInt8 WINDOWS_CHARSET_ANSI = 0;
+const sal_uInt8 WINDOWS_CHARSET_DEFAULT = 1;
+const sal_uInt8 WINDOWS_CHARSET_SYMBOL = 2;
+const sal_uInt8 WINDOWS_CHARSET_APPLE_ROMAN = 77;
+const sal_uInt8 WINDOWS_CHARSET_SHIFTJIS = 128;
+const sal_uInt8 WINDOWS_CHARSET_HANGEUL = 129;
+const sal_uInt8 WINDOWS_CHARSET_JOHAB = 130;
+const sal_uInt8 WINDOWS_CHARSET_GB2312 = 134;
+const sal_uInt8 WINDOWS_CHARSET_BIG5 = 136;
+const sal_uInt8 WINDOWS_CHARSET_GREEK = 161;
+const sal_uInt8 WINDOWS_CHARSET_TURKISH = 162;
+const sal_uInt8 WINDOWS_CHARSET_VIETNAMESE = 163;
+const sal_uInt8 WINDOWS_CHARSET_HEBREW = 177;
+const sal_uInt8 WINDOWS_CHARSET_ARABIC = 178;
+const sal_uInt8 WINDOWS_CHARSET_BALTIC = 186;
+const sal_uInt8 WINDOWS_CHARSET_RUSSIAN = 204;
+const sal_uInt8 WINDOWS_CHARSET_THAI = 222;
+const sal_uInt8 WINDOWS_CHARSET_EASTERN = 238;
+const sal_uInt8 WINDOWS_CHARSET_OEM = 255;
+
+// ----------------------------------------------------------------------------
+
+const sal_Int32 API_RGB_TRANSPARENT = -1; ///< Transparent color for API calls.
+const sal_Int32 API_RGB_BLACK = 0x000000; ///< Black color for API calls.
+const sal_Int32 API_RGB_GRAY = 0x808080; ///< Gray color for API calls.
+const sal_Int32 API_RGB_WHITE = 0xFFFFFF; ///< White color for API calls.
+
+const sal_Int16 API_LINE_SOLID = 0;
+const sal_Int16 API_LINE_DOTTED = 1;
+const sal_Int16 API_LINE_DASHED = 2;
+
+const sal_Int16 API_LINE_NONE = 0;
+const sal_Int16 API_LINE_HAIR = 2;
+const sal_Int16 API_LINE_THIN = 35;
+const sal_Int16 API_LINE_MEDIUM = 88;
+const sal_Int16 API_LINE_THICK = 141;
+
+const sal_Int16 API_ESCAPE_NONE = 0; ///< No escapement.
+const sal_Int16 API_ESCAPE_SUPERSCRIPT = 101; ///< Superscript: raise characters automatically (magic value 101).
+const sal_Int16 API_ESCAPE_SUBSCRIPT = -101; ///< Subscript: lower characters automatically (magic value -101).
+
+const sal_Int8 API_ESCAPEHEIGHT_NONE = 100; ///< Relative character height if not escaped.
+const sal_Int8 API_ESCAPEHEIGHT_DEFAULT = 58; ///< Relative character height if escaped.
+
+// ============================================================================
+
+// Limitate values ------------------------------------------------------------
+
+template< typename ReturnType, typename Type >
+inline ReturnType getLimitedValue( Type nValue, Type nMin, Type nMax )
+{
+ return static_cast< ReturnType >( ::std::min( ::std::max( nValue, nMin ), nMax ) );
+}
+
+template< typename ReturnType, typename Type >
+inline ReturnType getIntervalValue( Type nValue, Type nBegin, Type nEnd )
+{
+// this BOOST_STATIC_ASSERT fails with suncc
+// BOOST_STATIC_ASSERT( ::std::numeric_limits< Type >::is_integer );
+ Type nInterval = nEnd - nBegin;
+ Type nCount = (nValue < nBegin) ? -((nBegin - nValue - 1) / nInterval + 1) : ((nValue - nBegin) / nInterval);
+ return static_cast< ReturnType >( nValue - nCount * nInterval );
+}
+
+template< typename ReturnType >
+inline ReturnType getDoubleIntervalValue( double fValue, double fBegin, double fEnd )
+{
+ double fInterval = fEnd - fBegin;
+ double fCount = (fValue < fBegin) ? -(::rtl::math::approxFloor( (fBegin - fValue - 1.0) / fInterval ) + 1.0) : ::rtl::math::approxFloor( (fValue - fBegin) / fInterval );
+ return static_cast< ReturnType >( fValue - fCount * fInterval );
+}
+
+// Read from bitfields --------------------------------------------------------
+
+/** Returns true, if at least one of the bits set in nMask is set in nBitField. */
+template< typename Type >
+inline bool getFlag( Type nBitField, Type nMask )
+{
+ return (nBitField & nMask) != 0;
+}
+
+/** Returns nSet, if at least one bit of nMask is set in nBitField, otherwise nUnset. */
+template< typename ReturnType, typename Type >
+inline ReturnType getFlagValue( Type nBitField, Type nMask, ReturnType nSet, ReturnType nUnset )
+{
+ return getFlag( nBitField, nMask ) ? nSet : nUnset;
+}
+
+/** Extracts a value from a bit field.
+
+ Returns the data fragment from nBitField, that starts at bit nStartBit
+ (0-based, bit 0 is rightmost) with the width of nBitCount. The returned
+ value will be right-aligned (normalized).
+ For instance: extractValue<T>(0x4321,8,4) returns 3 (value in bits 8-11).
+ */
+template< typename ReturnType, typename Type >
+inline ReturnType extractValue( Type nBitField, sal_uInt8 nStartBit, sal_uInt8 nBitCount )
+{
+ sal_uInt64 nMask = 1; nMask <<= nBitCount; --nMask;
+ return static_cast< ReturnType >( nMask & (nBitField >> nStartBit) );
+}
+
+// Write to bitfields ---------------------------------------------------------
+
+/** Sets or clears (according to bSet) all set bits of nMask in ornBitField. */
+template< typename Type >
+inline void setFlag( Type& ornBitField, Type nMask, bool bSet = true )
+{
+ if( bSet ) ornBitField |= nMask; else ornBitField &= ~nMask;
+}
+
+/** Inserts a value into a bitfield.
+
+ Inserts the lower nBitCount bits of nValue into ornBitField, starting
+ there at bit nStartBit. Other contents of ornBitField keep unchanged.
+ */
+template< typename Type, typename InsertType >
+void insertValue( Type& ornBitField, InsertType nValue, sal_uInt8 nStartBit, sal_uInt8 nBitCount )
+{
+ sal_uInt64 nMask = 1; nMask <<= nBitCount; --nMask;
+ Type nNewValue = static_cast< Type >( nValue & nMask );
+ (ornBitField &= ~(nMask << nStartBit)) |= (nNewValue << nStartBit);
+}
+
+// ============================================================================
+
+/** Optional value, similar to ::boost::optional<>, with convenience accessors.
+ */
+template< typename Type >
+class OptValue
+{
+public:
+ inline explicit OptValue() : maValue(), mbHasValue( false ) {}
+ inline explicit OptValue( const Type& rValue ) : maValue( rValue ), mbHasValue( true ) {}
+ inline explicit OptValue( bool bHasValue, const Type& rValue ) : maValue( rValue ), mbHasValue( bHasValue ) {}
+
+ inline bool has() const { return mbHasValue; }
+ inline bool operator!() const { return !mbHasValue; }
+ inline bool differsFrom( const Type& rValue ) const { return mbHasValue && (maValue != rValue); }
+
+ inline const Type& get() const { return maValue; }
+ inline const Type& get( const Type& rDefValue ) const { return mbHasValue ? maValue : rDefValue; }
+
+ inline void reset() { mbHasValue = false; }
+ inline void set( const Type& rValue ) { maValue = rValue; mbHasValue = true; }
+ inline Type& use() { mbHasValue = true; return maValue; }
+
+ inline OptValue& operator=( const Type& rValue ) { set( rValue ); return *this; }
+ inline bool operator==( const OptValue& rValue ) const {
+ return ( ( mbHasValue == false && rValue.mbHasValue == false ) ||
+ ( mbHasValue == rValue.mbHasValue && maValue == rValue.maValue ) );
+ }
+ inline void assignIfUsed( const OptValue& rValue ) { if( rValue.mbHasValue ) set( rValue.maValue ); }
+
+private:
+ Type maValue;
+ bool mbHasValue;
+};
+
+// ============================================================================
+
+/** Provides platform independent functions to convert from or to little-endian
+ byte order, e.g. for reading data from or writing data to memory or a
+ binary stream.
+
+ On big-endian platforms, the byte order in the passed values is swapped,
+ this can be used for converting big-endian to and from little-endian data.
+
+ On little-endian platforms, the conversion functions are implemented empty,
+ thus compilers should completely optimize away the function call.
+ */
+class ByteOrderConverter
+{
+public:
+#ifdef OSL_BIGENDIAN
+ inline static void convertLittleEndian( sal_Int8& ) {} // present for usage in templates
+ inline static void convertLittleEndian( sal_uInt8& ) {} // present for usage in templates
+ inline static void convertLittleEndian( sal_Int16& rnValue ) { swap2( reinterpret_cast< sal_uInt8* >( &rnValue ) ); }
+ inline static void convertLittleEndian( sal_uInt16& rnValue ) { swap2( reinterpret_cast< sal_uInt8* >( &rnValue ) ); }
+ inline static void convertLittleEndian( sal_Int32& rnValue ) { swap4( reinterpret_cast< sal_uInt8* >( &rnValue ) ); }
+ inline static void convertLittleEndian( sal_uInt32& rnValue ) { swap4( reinterpret_cast< sal_uInt8* >( &rnValue ) ); }
+ inline static void convertLittleEndian( sal_Int64& rnValue ) { swap8( reinterpret_cast< sal_uInt8* >( &rnValue ) ); }
+ inline static void convertLittleEndian( sal_uInt64& rnValue ) { swap8( reinterpret_cast< sal_uInt8* >( &rnValue ) ); }
+ inline static void convertLittleEndian( float& rfValue ) { swap4( reinterpret_cast< sal_uInt8* >( &rfValue ) ); }
+ inline static void convertLittleEndian( double& rfValue ) { swap8( reinterpret_cast< sal_uInt8* >( &rfValue ) ); }
+
+ template< typename Type >
+ inline static void convertLittleEndianArray( Type* pnArray, size_t nElemCount );
+
+ inline static void convertLittleEndianArray( sal_Int8*, size_t ) {}
+ inline static void convertLittleEndianArray( sal_uInt8*, size_t ) {}
+
+#else
+ template< typename Type >
+ inline static void convertLittleEndian( Type& ) {}
+
+ template< typename Type >
+ inline static void convertLittleEndianArray( Type*, size_t ) {}
+
+#endif
+
+ /** Reads a value from memory, assuming memory buffer in little-endian.
+ @param ornValue (out-parameter) Contains the value read from memory.
+ @param pSrcBuffer The memory buffer to read the value from.
+ */
+ template< typename Type >
+ inline static void readLittleEndian( Type& ornValue, const void* pSrcBuffer );
+
+ /** Writes a value to memory, while converting it to little-endian.
+ @param pDstBuffer The memory buffer to write the value to.
+ @param nValue The value to be written to memory in little-endian.
+ */
+ template< typename Type >
+ inline static void writeLittleEndian( void* pDstBuffer, Type nValue );
+
+#ifdef OSL_BIGENDIAN
+private:
+ inline static void swap2( sal_uInt8* pnData );
+ inline static void swap4( sal_uInt8* pnData );
+ inline static void swap8( sal_uInt8* pnData );
+#endif
+};
+
+// ----------------------------------------------------------------------------
+
+template< typename Type >
+inline void ByteOrderConverter::readLittleEndian( Type& ornValue, const void* pSrcBuffer )
+{
+ memcpy( &ornValue, pSrcBuffer, sizeof( Type ) );
+ convertLittleEndian( ornValue );
+}
+
+template< typename Type >
+inline void ByteOrderConverter::writeLittleEndian( void* pDstBuffer, Type nValue )
+{
+ convertLittleEndian( nValue );
+ memcpy( pDstBuffer, &nValue, sizeof( Type ) );
+}
+
+#ifdef OSL_BIGENDIAN
+template< typename Type >
+inline void ByteOrderConverter::convertLittleEndianArray( Type* pnArray, size_t nElemCount )
+{
+ for( Type* pnArrayEnd = pnArray + nElemCount; pnArray != pnArrayEnd; ++pnArray )
+ convertLittleEndian( *pnArray );
+}
+
+inline void ByteOrderConverter::swap2( sal_uInt8* pnData )
+{
+ ::std::swap( pnData[ 0 ], pnData[ 1 ] );
+}
+
+inline void ByteOrderConverter::swap4( sal_uInt8* pnData )
+{
+ ::std::swap( pnData[ 0 ], pnData[ 3 ] );
+ ::std::swap( pnData[ 1 ], pnData[ 2 ] );
+}
+
+inline void ByteOrderConverter::swap8( sal_uInt8* pnData )
+{
+ ::std::swap( pnData[ 0 ], pnData[ 7 ] );
+ ::std::swap( pnData[ 1 ], pnData[ 6 ] );
+ ::std::swap( pnData[ 2 ], pnData[ 5 ] );
+ ::std::swap( pnData[ 3 ], pnData[ 4 ] );
+}
+#endif
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/modelobjecthelper.hxx b/include/oox/helper/modelobjecthelper.hxx
new file mode 100644
index 000000000000..253279a4c05a
--- /dev/null
+++ b/include/oox/helper/modelobjecthelper.hxx
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_HELPER_MODELOBJECTHELPER_HXX
+#define OOX_HELPER_MODELOBJECTHELPER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include "oox/dllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace awt { struct Gradient; }
+ namespace container { class XNameContainer; }
+ namespace drawing { struct LineDash; }
+ namespace drawing { struct PolyPolygonBezierCoords; }
+ namespace lang { class XMultiServiceFactory; }
+} } }
+
+namespace oox {
+
+// ============================================================================
+
+/** This helper manages named objects in a container, which is created on demand.
+ */
+class OOX_DLLPUBLIC ObjectContainer
+{
+public:
+ explicit ObjectContainer(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxModelFactory,
+ const OUString& rServiceName );
+ ~ObjectContainer();
+
+ /** Returns true, if the object with the passed name exists in the container. */
+ bool hasObject( const OUString& rObjName ) const;
+
+ /** Inserts the passed object into the container, returns its final name. */
+ OUString insertObject(
+ const OUString& rObjName,
+ const ::com::sun::star::uno::Any& rObj,
+ bool bInsertByUnusedName );
+
+private:
+ void createContainer() const;
+
+private:
+ mutable ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
+ mxModelFactory; ///< Factory to create the container.
+ mutable ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
+ mxContainer; ///< Container for the objects.
+ OUString maServiceName; ///< Service name to create the container.
+ sal_Int32 mnIndex; ///< Index to create unique identifiers.
+};
+
+// ============================================================================
+
+/** Contains tables for named drawing objects for a document model.
+
+ Contains tables for named line markers, line dashes, fill gradients, and
+ fill bitmap URLs. The class is needed to handle different document models
+ in the same filter (e.g. embedded charts) which carry their own drawing
+ object tables.
+ */
+class OOX_DLLPUBLIC ModelObjectHelper
+{
+public:
+ explicit ModelObjectHelper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxModelFactory );
+
+ /** Returns true, if the model contains a line marker with the passed name. */
+ bool hasLineMarker( const OUString& rMarkerName ) const;
+
+ /** Inserts a new named line marker, overwrites an existing line marker
+ with the same name. Returns true, if the marker could be inserted. */
+ bool insertLineMarker(
+ const OUString& rMarkerName,
+ const ::com::sun::star::drawing::PolyPolygonBezierCoords& rMarker );
+
+ /** Inserts a new named line dash, returns the line dash name, based on an
+ internal constant name with a new unused index appended. */
+ OUString insertLineDash( const ::com::sun::star::drawing::LineDash& rDash );
+
+ /** Inserts a new named fill gradient, returns the gradient name, based on
+ an internal constant name with a new unused index appended. */
+ OUString insertFillGradient( const ::com::sun::star::awt::Gradient& rGradient );
+
+ OUString insertTransGrandient( const ::com::sun::star::awt::Gradient& rGradient );
+
+ /** Inserts a new named fill bitmap URL, returns the bitmap name, based on
+ an internal constant name with a new unused index appended. */
+ OUString insertFillBitmapUrl( const OUString& rGraphicUrl );
+
+private:
+ ObjectContainer maMarkerContainer; ///< Contains all named line markers (line end polygons).
+ ObjectContainer maDashContainer; ///< Contains all named line dsahes.
+ ObjectContainer maGradientContainer; ///< Contains all named fill gradients.
+ ObjectContainer maTransGradContainer; ///< Contains all named transparency Gradients.
+ ObjectContainer maBitmapUrlContainer; ///< Contains all named fill bitmap URLs.
+ const OUString maDashNameBase; ///< Base name for all named line dashes.
+ const OUString maGradientNameBase; ///< Base name for all named fill gradients.
+ const OUString maTransGradNameBase; ///< Base name for all named fill gradients.
+ const OUString maBitmapUrlNameBase; ///< Base name for all named fill bitmap URLs.
+};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/progressbar.hxx b/include/oox/helper/progressbar.hxx
new file mode 100644
index 000000000000..ba0bdcfbb5c9
--- /dev/null
+++ b/include/oox/helper/progressbar.hxx
@@ -0,0 +1,138 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_HELPER_PROGRESSBAR_HXX
+#define OOX_HELPER_PROGRESSBAR_HXX
+
+#include <boost/shared_ptr.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include "oox/dllapi.h"
+
+
+namespace com { namespace sun { namespace star {
+ namespace task { class XStatusIndicator; }
+} } }
+
+namespace oox {
+
+// Interfaces =================================================================
+
+/** Interface for progress bar classes.
+ */
+class IProgressBar
+{
+public:
+ virtual ~IProgressBar();
+
+ /** Returns the current position of the progress bar.
+
+ @return Position of the progress bar, in the range from 0.0 (beginning
+ of the progress bar) to 1.0 (end of the progress bar) inclusive.
+ */
+ virtual double getPosition() const = 0;
+
+ /** Sets the current position of the progress bar.
+
+ @param fPosition New position of the progress bar, in the range from
+ 0.0 (beginning of the progress bar) to 1.0 (end of the progress bar)
+ inclusive.
+ */
+ virtual void setPosition( double fPosition ) = 0;
+};
+
+typedef ::boost::shared_ptr< IProgressBar > IProgressBarRef;
+
+// ----------------------------------------------------------------------------
+
+class ISegmentProgressBar;
+typedef ::boost::shared_ptr< ISegmentProgressBar > ISegmentProgressBarRef;
+
+/** Interface for a segment in a progress bar, that is able to create sub
+ segments from itself.
+ */
+class ISegmentProgressBar : public IProgressBar
+{
+public:
+ virtual ~ISegmentProgressBar();
+
+ /** Returns the length that is still free for creating sub segments. */
+ virtual double getFreeLength() const = 0;
+
+ /** Adds a new segment with the specified length. */
+ virtual ISegmentProgressBarRef createSegment( double fLength ) = 0;
+};
+
+// ============================================================================
+// ============================================================================
+
+/** A simple progress bar.
+ */
+class OOX_DLLPUBLIC ProgressBar : public IProgressBar
+{
+public:
+ explicit ProgressBar(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator >& rxIndicator,
+ const OUString& rText );
+
+ virtual ~ProgressBar();
+
+ /** Returns the current position of the progress bar. */
+ virtual double getPosition() const;
+ /** Sets the current position of the progress bar. */
+ virtual void setPosition( double fPosition );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator >
+ mxIndicator;
+ double mfPosition;
+};
+
+// ============================================================================
+
+/** A progress bar containing several independent segments.
+ */
+class OOX_DLLPUBLIC SegmentProgressBar : public ISegmentProgressBar
+{
+public:
+ explicit SegmentProgressBar(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator >& rxIndicator,
+ const OUString& rText );
+
+ /** Returns the current position of the progress bar segment. */
+ virtual double getPosition() const;
+ /** Sets the current position of the progress bar segment. */
+ virtual void setPosition( double fPosition );
+
+ /** Returns the length that is still free for creating sub segments. */
+ virtual double getFreeLength() const;
+ /** Adds a new segment with the specified length. */
+ virtual ISegmentProgressBarRef createSegment( double fLength );
+
+private:
+ ProgressBar maProgress;
+ double mfFreeStart;
+};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/propertymap.hxx b/include/oox/helper/propertymap.hxx
new file mode 100644
index 000000000000..d03d891d93b5
--- /dev/null
+++ b/include/oox/helper/propertymap.hxx
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_HELPER_PROPERTYMAP_HXX
+#define OOX_HELPER_PROPERTYMAP_HXX
+
+#include <vector>
+#include <map>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <rtl/ustring.hxx>
+#include "oox/token/properties.hxx"
+#include "oox/dllapi.h"
+
+namespace com { namespace sun { namespace star { namespace beans {
+ struct PropertyValue;
+ class XPropertySet;
+} } } }
+
+namespace oox {
+
+struct PropertyNameVector;
+
+// ============================================================================
+
+typedef ::std::map< sal_Int32, ::com::sun::star::uno::Any > PropertyMapBase;
+
+/** A helper that maps property identifiers to property values.
+
+ The property identifiers are generated on compile time and refer to the
+ property name strings that are held by a static vector. The identifier to
+ name mapping is done internally while the properties are written to
+ property sets.
+ */
+class OOX_DLLPUBLIC PropertyMap : public PropertyMapBase
+{
+public:
+ explicit PropertyMap();
+
+ /** Returns the name of the passed property identifier. */
+ static const OUString& getPropertyName( sal_Int32 nPropId );
+
+ /** Returns true, if the map contains a property with the passed identifier. */
+ inline bool hasProperty( sal_Int32 nPropId ) const
+ { return find( nPropId ) != end(); }
+
+ /** Sets the specified property to the passed value. Does nothing, if the
+ identifier is invalid. */
+ inline bool setAnyProperty( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue )
+ { if( nPropId < 0 ) return false; (*this)[ nPropId ] = rValue; return true; }
+
+ /** Sets the specified property to the passed value. Does nothing, if the
+ identifier is invalid. */
+ template< typename Type >
+ inline bool setProperty( sal_Int32 nPropId, const Type& rValue )
+ { if( nPropId < 0 ) return false; (*this)[ nPropId ] <<= rValue; return true; }
+
+ /** Inserts all properties contained in the passed property map. */
+ inline void assignUsed( const PropertyMap& rPropMap )
+ { insert( rPropMap.begin(), rPropMap.end() ); }
+
+ /** Inserts all properties contained in the passed property map */
+ void assignAll( const PropertyMap& rPropMap );
+
+ /** Returns a sequence of property values, filled with all contained properties. */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
+ makePropertyValueSequence() const;
+
+ /** Fills the passed sequences of names and anys with all contained properties. */
+ void fillSequences(
+ ::com::sun::star::uno::Sequence< OUString >& rNames,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rValues ) const;
+
+ /** Creates a property set supporting the XPropertySet interface and inserts all properties. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ makePropertySet() const;
+
+#if OSL_DEBUG_LEVEL > 0
+#ifdef DBG_UTIL
+ static void dump( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet);
+#endif
+ static void dumpCode( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet);
+ void dumpCode();
+#endif
+private:
+ const PropertyNameVector* mpPropNames;
+};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/propertyset.hxx b/include/oox/helper/propertyset.hxx
new file mode 100644
index 000000000000..2c97b29677fa
--- /dev/null
+++ b/include/oox/helper/propertyset.hxx
@@ -0,0 +1,146 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_HELPER_PROPERTYSET_HXX
+#define OOX_HELPER_PROPERTYSET_HXX
+
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include "oox/dllapi.h"
+
+namespace oox {
+
+class PropertyMap;
+
+// ============================================================================
+
+/** A wrapper for a UNO property set.
+
+ This class provides functions to silently get and set properties (without
+ exceptions, without the need to check validity of the UNO property set).
+
+ An instance is constructed with the reference to a UNO property set or any
+ other interface (the constructor will query for the
+ com.sun.star.beans.XPropertySet interface then). The reference to the
+ property set will be kept as long as the instance of this class is alive.
+
+ The functions setProperties() tries to handle all passed values at once,
+ using the com.sun.star.beans.XMultiPropertySet interface. If the
+ implementation does not support the XMultiPropertySet interface, all
+ properties are handled separately in a loop.
+ */
+class OOX_DLLPUBLIC PropertySet
+{
+public:
+ inline explicit PropertySet() {}
+
+ /** Constructs a property set wrapper with the passed UNO property set. */
+ inline explicit PropertySet(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rxPropSet )
+ { set( rxPropSet ); }
+
+ /** Constructs a property set wrapper after querying the XPropertySet interface. */
+ template< typename Type >
+ inline explicit PropertySet( const Type& rObject ) { set( rObject ); }
+
+ /** Sets the passed UNO property set and releases the old UNO property set. */
+ void set( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rxPropSet );
+
+ /** Queries the passed object (interface or any) for an XPropertySet and releases the old UNO property set. */
+ template< typename Type >
+ inline void set( const Type& rObject )
+ { set( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >( rObject, ::com::sun::star::uno::UNO_QUERY ) ); }
+
+ /** Returns true, if the contained XPropertySet interface is valid. */
+ inline bool is() const { return mxPropSet.is(); }
+
+ /** Returns the contained XPropertySet interface. */
+ inline ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ getXPropertySet() const { return mxPropSet; }
+
+ /** Returns true, if the specified property is supported by the property set. */
+ bool hasProperty( sal_Int32 nPropId ) const;
+
+ // Get properties ---------------------------------------------------------
+
+ /** Gets the specified property from the property set.
+ @return the property value, or an empty Any, if the property is missing. */
+ ::com::sun::star::uno::Any getAnyProperty( sal_Int32 nPropId ) const;
+
+ /** Gets the specified property from the property set.
+ @return true, if the passed variable could be filled with the property value. */
+ template< typename Type >
+ inline bool getProperty( Type& orValue, sal_Int32 nPropId ) const
+ { return getAnyProperty( nPropId ) >>= orValue; }
+
+ /** Gets the specified boolean property from the property set.
+ @return true = property contains true; false = property contains false or error occurred. */
+ inline bool getBoolProperty( sal_Int32 nPropId ) const
+ { bool bValue = false; return getProperty( bValue, nPropId ) && bValue; }
+ // Set properties ---------------------------------------------------------
+
+ /** Puts the passed any into the property set. */
+ bool setAnyProperty( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
+
+ /** Puts the passed value into the property set. */
+ template< typename Type >
+ inline bool setProperty( sal_Int32 nPropId, const Type& rValue )
+ { return setAnyProperty( nPropId, ::com::sun::star::uno::Any( rValue ) ); }
+
+ /** Puts the passed properties into the property set. Tries to use the XMultiPropertySet interface.
+ @param rPropNames The property names. MUST be ordered alphabetically.
+ @param rValues The related property values. */
+ void setProperties(
+ const ::com::sun::star::uno::Sequence< OUString >& rPropNames,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rValues );
+
+ /** Puts the passed property map into the property set. Tries to use the XMultiPropertySet interface.
+ @param rPropertyMap The property map. */
+ void setProperties( const PropertyMap& rPropertyMap );
+
+#ifdef DBG_UTIL
+ void dump();
+#endif
+
+ // ------------------------------------------------------------------------
+private:
+ /** Gets the specified property from the property set.
+ @return true, if the any could be filled with the property value. */
+ bool implGetPropertyValue( ::com::sun::star::uno::Any& orValue, const OUString& rPropName ) const;
+
+ /** Puts the passed any into the property set. */
+ bool implSetPropertyValue( const OUString& rPropName, const ::com::sun::star::uno::Any& rValue );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ mxPropSet; ///< The mandatory property set interface.
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet >
+ mxMultiPropSet; ///< The optional multi property set interface.
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
+ mxPropSetInfo; ///< Property information.
+};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/refmap.hxx b/include/oox/helper/refmap.hxx
new file mode 100644
index 000000000000..c980039442b1
--- /dev/null
+++ b/include/oox/helper/refmap.hxx
@@ -0,0 +1,185 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_HELPER_REFMAP_HXX
+#define OOX_HELPER_REFMAP_HXX
+
+#include <map>
+#include <boost/bind.hpp>
+#include <boost/shared_ptr.hpp>
+#include <sal/types.h>
+
+namespace oox {
+
+// ============================================================================
+
+/** Template for a map of ref-counted objects with additional accessor functions.
+
+ An instance of the class RefMap< Type > stores elements of the type
+ ::boost::shared_ptr< Type >. The new accessor functions has() and get()
+ work correctly for nonexisting keys, there is no need to check the passed
+ key before.
+ */
+template< typename KeyType, typename ObjType, typename CompType = ::std::less< KeyType > >
+class RefMap : public ::std::map< KeyType, ::boost::shared_ptr< ObjType >, CompType >
+{
+public:
+ typedef ::std::map< KeyType, ::boost::shared_ptr< ObjType >, CompType > container_type;
+ typedef typename container_type::key_type key_type;
+ typedef typename container_type::mapped_type mapped_type;
+ typedef typename container_type::value_type value_type;
+ typedef typename container_type::key_compare key_compare;
+
+public:
+ /** Returns true, if the object associated to the passed key exists.
+ Returns false, if the key exists but points to an empty reference. */
+ inline bool has( key_type nKey ) const
+ {
+ const mapped_type* pxRef = getRef( nKey );
+ return pxRef && pxRef->get();
+ }
+
+ /** Returns a reference to the object associated to the passed key, or an
+ empty reference on error. */
+ inline mapped_type get( key_type nKey ) const
+ {
+ if( const mapped_type* pxRef = getRef( nKey ) ) return *pxRef;
+ return mapped_type();
+ }
+
+ /** Calls the passed functor for every contained object, automatically
+ skips all elements that are empty references. */
+ template< typename FunctorType >
+ inline void forEach( const FunctorType& rFunctor ) const
+ {
+ ::std::for_each( this->begin(), this->end(), ForEachFunctor< FunctorType >( rFunctor ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType >
+ inline void forEachMem( FuncType pFunc ) const
+ {
+ forEach( ::boost::bind( pFunc, _1 ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType, typename ParamType >
+ inline void forEachMem( FuncType pFunc, ParamType aParam ) const
+ {
+ forEach( ::boost::bind( pFunc, _1, aParam ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType, typename ParamType1, typename ParamType2 >
+ inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const
+ {
+ forEach( ::boost::bind( pFunc, _1, aParam1, aParam2 ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 >
+ inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const
+ {
+ forEach( ::boost::bind( pFunc, _1, aParam1, aParam2, aParam3 ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3, typename ParamType4 >
+ inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3, ParamType4 aParam4 ) const
+ {
+ forEach( ::boost::bind( pFunc, _1, aParam1, aParam2, aParam3, aParam4 ) );
+ }
+
+
+ /** Calls the passed functor for every contained object. Passes the key as
+ first argument and the object reference as second argument to rFunctor. */
+ template< typename FunctorType >
+ inline void forEachWithKey( const FunctorType& rFunctor ) const
+ {
+ ::std::for_each( this->begin(), this->end(), ForEachFunctorWithKey< FunctorType >( rFunctor ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object.
+ Passes the object key as argument to the member function. */
+ template< typename FuncType >
+ inline void forEachMemWithKey( FuncType pFunc ) const
+ {
+ forEachWithKey( ::boost::bind( pFunc, _2, _1 ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object.
+ Passes the object key as first argument to the member function. */
+ template< typename FuncType, typename ParamType >
+ inline void forEachMemWithKey( FuncType pFunc, ParamType aParam ) const
+ {
+ forEachWithKey( ::boost::bind( pFunc, _2, _1, aParam ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object.
+ Passes the object key as first argument to the member function. */
+ template< typename FuncType, typename ParamType1, typename ParamType2 >
+ inline void forEachMemWithKey( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const
+ {
+ forEachWithKey( ::boost::bind( pFunc, _2, _1, aParam1, aParam2 ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object.
+ Passes the object key as first argument to the member function. */
+ template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 >
+ inline void forEachMemWithKey( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const
+ {
+ forEachWithKey( ::boost::bind( pFunc, _2, _1, aParam1, aParam2, aParam3 ) );
+ }
+
+private:
+ template< typename FunctorType >
+ struct ForEachFunctor
+ {
+ FunctorType maFunctor;
+ inline explicit ForEachFunctor( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {}
+ inline void operator()( const value_type& rValue ) { if( rValue.second.get() ) maFunctor( *rValue.second ); }
+ };
+
+ template< typename FunctorType >
+ struct ForEachFunctorWithKey
+ {
+ FunctorType maFunctor;
+ inline explicit ForEachFunctorWithKey( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {}
+ inline void operator()( const value_type& rValue ) { if( rValue.second.get() ) maFunctor( rValue.first, *rValue.second ); }
+ };
+
+ inline const mapped_type* getRef( key_type nKey ) const
+ {
+ typename container_type::const_iterator aIt = this->find( nKey );
+ return (aIt == this->end()) ? 0 : &aIt->second;
+ }
+};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/refvector.hxx b/include/oox/helper/refvector.hxx
new file mode 100644
index 000000000000..c0602b571c23
--- /dev/null
+++ b/include/oox/helper/refvector.hxx
@@ -0,0 +1,195 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_HELPER_REFVECTOR_HXX
+#define OOX_HELPER_REFVECTOR_HXX
+
+#include <vector>
+#include <boost/bind.hpp>
+#include <boost/shared_ptr.hpp>
+#include <sal/types.h>
+
+namespace oox {
+
+// ============================================================================
+
+/** Template for a vector of ref-counted objects with additional accessor functions.
+
+ An instance of the class RefVector< Type > stores elements of the type
+ ::boost::shared_ptr< Type >. The new accessor functions has() and get()
+ work correctly for indexes out of the current range, there is no need to
+ check the passed index before.
+ */
+template< typename ObjType >
+class RefVector : public ::std::vector< ::boost::shared_ptr< ObjType > >
+{
+public:
+ typedef ::std::vector< ::boost::shared_ptr< ObjType > > container_type;
+ typedef typename container_type::value_type value_type;
+ typedef typename container_type::size_type size_type;
+
+public:
+ /** Returns true, if the object with the passed index exists. Returns
+ false, if the vector element exists but is an empty reference. */
+ inline bool has( sal_Int32 nIndex ) const
+ {
+ const value_type* pxRef = getRef( nIndex );
+ return pxRef && pxRef->get();
+ }
+
+ /** Returns a reference to the object with the passed index, or 0 on error. */
+ inline value_type get( sal_Int32 nIndex ) const
+ {
+ if( const value_type* pxRef = getRef( nIndex ) ) return *pxRef;
+ return value_type();
+ }
+
+ /** Returns the index of the last element, or -1, if the vector is empty.
+ Does *not* check whether the last element is an empty reference. */
+ inline sal_Int32 getLastIndex() const { return static_cast< sal_Int32 >( this->size() ) - 1; }
+
+ /** Calls the passed functor for every contained object, automatically
+ skips all elements that are empty references. */
+ template< typename FunctorType >
+ inline void forEach( FunctorType aFunctor ) const
+ {
+ ::std::for_each( this->begin(), this->end(), ForEachFunctor< FunctorType >( aFunctor ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType >
+ inline void forEachMem( FuncType pFunc ) const
+ {
+ forEach( ::boost::bind( pFunc, _1 ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType, typename ParamType >
+ inline void forEachMem( FuncType pFunc, ParamType aParam ) const
+ {
+ forEach( ::boost::bind( pFunc, _1, aParam ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType, typename ParamType1, typename ParamType2 >
+ inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const
+ {
+ forEach( ::boost::bind( pFunc, _1, aParam1, aParam2 ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object,
+ automatically skips all elements that are empty references. */
+ template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 >
+ inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const
+ {
+ forEach( ::boost::bind( pFunc, _1, aParam1, aParam2, aParam3 ) );
+ }
+
+ /** Calls the passed functor for every contained object. Passes the index as
+ first argument and the object reference as second argument to rFunctor. */
+ template< typename FunctorType >
+ inline void forEachWithIndex( const FunctorType& rFunctor ) const
+ {
+ ::std::for_each( this->begin(), this->end(), ForEachFunctorWithIndex< FunctorType >( rFunctor ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object.
+ Passes the vector index to the member function. */
+ template< typename FuncType >
+ inline void forEachMemWithIndex( FuncType pFunc ) const
+ {
+ forEachWithIndex( ::boost::bind( pFunc, _2, _1 ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object.
+ Passes the vector index as first argument to the member function. */
+ template< typename FuncType, typename ParamType >
+ inline void forEachMemWithIndex( FuncType pFunc, ParamType aParam ) const
+ {
+ forEachWithIndex( ::boost::bind( pFunc, _2, _1, aParam ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object.
+ Passes the vector index as first argument to the member function. */
+ template< typename FuncType, typename ParamType1, typename ParamType2 >
+ inline void forEachMemWithIndex( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const
+ {
+ forEachWithIndex( ::boost::bind( pFunc, _2, _1, aParam1, aParam2 ) );
+ }
+
+ /** Calls the passed member function of ObjType on every contained object.
+ Passes the vector index as first argument to the member function. */
+ template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 >
+ inline void forEachMemWithIndex( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const
+ {
+ forEachWithIndex( ::boost::bind( pFunc, _2, _1, aParam1, aParam2, aParam3 ) );
+ }
+
+ /** Searches for an element by using the passed functor that takes a
+ constant reference of the object type (const ObjType&). */
+ template< typename FunctorType >
+ inline value_type findIf( const FunctorType& rFunctor ) const
+ {
+ typename container_type::const_iterator aIt = ::std::find_if( this->begin(), this->end(), FindFunctor< FunctorType >( rFunctor ) );
+ return (aIt == this->end()) ? value_type() : *aIt;
+ }
+
+private:
+ template< typename FunctorType >
+ struct ForEachFunctor
+ {
+ FunctorType maFunctor;
+ inline explicit ForEachFunctor( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {}
+ inline void operator()( const value_type& rxValue ) { if( rxValue.get() ) maFunctor( *rxValue ); }
+ };
+
+ template< typename FunctorType >
+ struct ForEachFunctorWithIndex
+ {
+ FunctorType maFunctor;
+ sal_Int32 mnIndex;
+ inline explicit ForEachFunctorWithIndex( const FunctorType& rFunctor ) : maFunctor( rFunctor ), mnIndex( 0 ) {}
+ inline void operator()( const value_type& rxValue ) { if( rxValue.get() ) maFunctor( mnIndex, *rxValue ); ++mnIndex; }
+ };
+
+ template< typename FunctorType >
+ struct FindFunctor
+ {
+ FunctorType maFunctor;
+ inline explicit FindFunctor( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {}
+ inline bool operator()( const value_type& rxValue ) { return rxValue.get() && maFunctor( *rxValue ); }
+ };
+
+ inline const value_type* getRef( sal_Int32 nIndex ) const
+ {
+ return ((0 <= nIndex) && (static_cast< size_type >( nIndex ) < this->size())) ?
+ &(*this)[ static_cast< size_type >( nIndex ) ] : 0;
+ }
+};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/storagebase.hxx b/include/oox/helper/storagebase.hxx
new file mode 100644
index 000000000000..f318f01b4768
--- /dev/null
+++ b/include/oox/helper/storagebase.hxx
@@ -0,0 +1,191 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_HELPER_STORAGEBASE_HXX
+#define OOX_HELPER_STORAGEBASE_HXX
+
+#include <vector>
+#include <com/sun/star/uno/Reference.hxx>
+#include "oox/helper/refmap.hxx"
+#include "oox/dllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace embed { class XStorage; }
+ namespace io { class XInputStream; }
+ namespace io { class XOutputStream; }
+ namespace io { class XStream; }
+} } }
+
+namespace oox {
+
+// ============================================================================
+
+class StorageBase;
+typedef ::boost::shared_ptr< StorageBase > StorageRef;
+
+/** Base class for storage access implementations.
+
+ Derived classes will be used to encapsulate storage access implementations
+ for ZIP storages containing XML streams, and OLE storages containing binary
+ data streams.
+ */
+class OOX_DLLPUBLIC StorageBase
+{
+public:
+ explicit StorageBase(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream,
+ bool bBaseStreamAccess );
+
+ explicit StorageBase(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxOutStream,
+ bool bBaseStreamAccess );
+
+ virtual ~StorageBase();
+
+ /** Returns true, if the object represents a valid storage. */
+ bool isStorage() const;
+
+ /** Returns true, if the object represents the root storage. */
+ bool isRootStorage() const;
+
+ /** Returns true, if the storage operates in read-only mode (based on an
+ input stream). */
+ bool isReadOnly() const;
+
+ /** Returns the com.sun.star.embed.XStorage interface of the current storage. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
+ getXStorage() const;
+
+ /** Returns the element name of this storage. */
+ const OUString& getName() const;
+
+ /** Returns the full path of this storage. */
+ OUString getPath() const;
+
+ /** Fills the passed vector with the names of all direct elements of this
+ storage. */
+ void getElementNames( ::std::vector< OUString >& orElementNames ) const;
+
+ /** Opens and returns the specified sub storage from the storage.
+
+ @param rStorageName
+ The name of the embedded storage. The name may contain slashes to
+ open storages from embedded substorages.
+ @param bCreateMissing
+ True = create missing sub storages (for export filters). Must be
+ false for storages based on input streams.
+ */
+ StorageRef openSubStorage( const OUString& rStorageName, bool bCreateMissing );
+
+ /** Opens and returns the specified input stream from the storage.
+
+ @param rStreamName
+ The name of the embedded storage stream. The name may contain
+ slashes to open streams from embedded substorages. If base stream
+ access has been enabled in the constructor, the base stream can be
+ accessed by passing an empty string as stream name.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ openInputStream( const OUString& rStreamName );
+
+ /** Opens and returns the specified output stream from the storage.
+
+ @param rStreamName
+ The name of the embedded storage stream. The name may contain
+ slashes to create and open streams in embedded substorages. If base
+ stream access has been enabled in the constructor, the base stream
+ can be accessed by passing an empty string as stream name.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
+ openOutputStream( const OUString& rStreamName );
+
+ /** Copies the specified element from this storage to the passed
+ destination storage.
+
+ @param rElementName
+ The name of the embedded storage or stream. The name may contain
+ slashes to specify an element in an embedded substorage. In this
+ case, the element will be copied to the same substorage in the
+ destination storage.
+ */
+ void copyToStorage( StorageBase& rDestStrg, const OUString& rElementName );
+
+ /** Copies all streams of this storage and of all substorages to the passed
+ destination. */
+ void copyStorageToStorage( StorageBase& rDestStrg );
+
+ /** Commits the changes to the storage and all substorages. */
+ void commit();
+
+protected:
+ /** Special constructor for sub storage objects. */
+ explicit StorageBase( const StorageBase& rParentStorage, const OUString& rStorageName, bool bReadOnly );
+
+private:
+ StorageBase( const StorageBase& );
+ StorageBase& operator=( const StorageBase& );
+
+ /** Returns true, if the object represents a valid storage. */
+ virtual bool implIsStorage() const = 0;
+
+ /** Returns the com.sun.star.embed.XStorage interface of the current storage. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
+ implGetXStorage() const = 0;
+
+ /** Returns the names of all elements of this storage. */
+ virtual void implGetElementNames( ::std::vector< OUString >& orElementNames ) const = 0;
+
+ /** Implementation of opening a storage element. */
+ virtual StorageRef implOpenSubStorage( const OUString& rElementName, bool bCreate ) = 0;
+
+ /** Implementation of opening an input stream element. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ implOpenInputStream( const OUString& rElementName ) = 0;
+
+ /** Implementation of opening an output stream element. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
+ implOpenOutputStream( const OUString& rElementName ) = 0;
+
+ /** Commits the current storage. */
+ virtual void implCommit() const = 0;
+
+ /** Helper that opens and caches the specified direct substorage. */
+ StorageRef getSubStorage( const OUString& rElementName, bool bCreateMissing );
+
+private:
+ typedef RefMap< OUString, StorageBase > SubStorageMap;
+
+ SubStorageMap maSubStorages; ///< Map of direct sub storages.
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ mxInStream; ///< Cached base input stream (to keep it alive).
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >
+ mxOutStream; ///< Cached base output stream (to keep it alive).
+ OUString maParentPath; ///< Full path of parent storage.
+ OUString maStorageName; ///< Name of this storage, if it is a substorage.
+ bool mbBaseStreamAccess; ///< True = access base streams with empty stream name.
+ bool mbReadOnly; ///< True = storage opened read-only (based on input stream).
+};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/textinputstream.hxx b/include/oox/helper/textinputstream.hxx
new file mode 100644
index 000000000000..16a2d5145e9d
--- /dev/null
+++ b/include/oox/helper/textinputstream.hxx
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_HELPER_TEXTINPUTSTREAM_HXX
+#define OOX_HELPER_TEXTINPUTSTREAM_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <rtl/ustring.hxx>
+
+namespace com { namespace sun { namespace star {
+ namespace io { class XInputStream; }
+ namespace io { class XTextInputStream2; }
+ namespace uno { class XComponentContext; }
+} } }
+
+namespace oox {
+
+class BinaryInputStream;
+
+// ============================================================================
+
+class TextInputStream
+{
+public:
+ explicit TextInputStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
+ rtl_TextEncoding eTextEnc );
+
+ explicit TextInputStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ BinaryInputStream& rInStrm,
+ rtl_TextEncoding eTextEnc );
+
+ ~TextInputStream();
+
+ /** Returns true, if no more text is available in the stream.
+ */
+ bool isEof() const;
+
+ /** Reads a text line from the stream.
+
+ If the last line in the stream is not terminated with line-end
+ character(s), the stream will immediately go into EOF state and return
+ the text line. Otherwise, if the last character in the stream is a
+ line-end character, the next call to this function will turn the stream
+ into EOF state and return an empty string.
+ */
+ OUString readLine();
+
+ /** Reads a text portion from the stream until the specified character is
+ found.
+
+ If the end of the stream is not terminated with the specified
+ character, the stream will immediately go into EOF state and return the
+ remaining text portion. Otherwise, if the last character in the stream
+ is the specified character (and caller specifies to read and return it,
+ see parameter bIncludeChar), the next call to this function will turn
+ the stream into EOF state and return an empty string.
+
+ @param cChar
+ The separator character to be read to.
+
+ @param bIncludeChar
+ True = if found, the specified character will be read from stream
+ and included in the returned string.
+ False = the specified character will neither be read from the
+ stream nor included in the returned string, but will be
+ returned as first character in the next call of this function
+ or readLine().
+ */
+ OUString readToChar( sal_Unicode cChar, bool bIncludeChar );
+
+ // ------------------------------------------------------------------------
+
+ /** Creates a UNO text input stream object from the passed UNO input stream.
+ */
+ static ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextInputStream2 >
+ createXTextInputStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
+ rtl_TextEncoding eTextEnc );
+
+ // ------------------------------------------------------------------------
+private:
+ void init(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
+ rtl_TextEncoding eTextEnc );
+
+ /** Adds the pending character in front of the passed string, if existing. */
+ OUString createFinalString( const OUString& rString );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextInputStream2 >
+ mxTextStrm;
+ sal_Unicode mcPendingChar;
+};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/zipstorage.hxx b/include/oox/helper/zipstorage.hxx
new file mode 100644
index 000000000000..e46df41387d7
--- /dev/null
+++ b/include/oox/helper/zipstorage.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_HELPER_ZIPSTORAGE_HXX
+#define OOX_HELPER_ZIPSTORAGE_HXX
+
+#include "oox/helper/storagebase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace uno { class XComponentContext; }
+} } }
+
+namespace oox {
+
+// ============================================================================
+
+/** Implements stream access for ZIP storages containing XML streams. */
+class ZipStorage : public StorageBase
+{
+public:
+ explicit ZipStorage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream );
+
+ explicit ZipStorage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxStream );
+
+ virtual ~ZipStorage();
+
+private:
+ explicit ZipStorage(
+ const ZipStorage& rParentStorage,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& rxStorage,
+ const OUString& rElementName );
+
+ /** Returns true, if the object represents a valid storage. */
+ virtual bool implIsStorage() const;
+
+ /** Returns the com.sun.star.embed.XStorage interface of the current storage. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
+ implGetXStorage() const;
+
+ /** Returns the names of all elements of this storage. */
+ virtual void implGetElementNames( ::std::vector< OUString >& orElementNames ) const;
+
+ /** Opens and returns the specified sub storage from the storage. */
+ virtual StorageRef implOpenSubStorage( const OUString& rElementName, bool bCreateMissing );
+
+ /** Opens and returns the specified input stream from the storage. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ implOpenInputStream( const OUString& rElementName );
+
+ /** Opens and returns the specified output stream from the storage. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
+ implOpenOutputStream( const OUString& rElementName );
+
+ /** Commits the current storage. */
+ virtual void implCommit() const;
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
+ mxStorage; ///< Storage based on input or output stream.
+};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/mathml/export.hxx b/include/oox/mathml/export.hxx
new file mode 100644
index 000000000000..3a0f3788a77f
--- /dev/null
+++ b/include/oox/mathml/export.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef _OOXMLEXPORT_HXX
+#define _OOXMLEXPORT_HXX
+
+#include <sax/fshelper.hxx>
+#include <rtl/strbuf.hxx>
+#include <oox/core/filterbase.hxx>
+#include <oox/dllapi.h>
+
+namespace oox
+{
+
+/**
+ Interface class, StarMath will implement writeFormula*() to write out markup
+ representing the formula.
+ */
+class OOX_DLLPUBLIC FormulaExportBase
+{
+public:
+ virtual void writeFormulaOoxml( ::sax_fastparser::FSHelperPtr m_pSerializer, oox::core::OoxmlVersion version ) = 0;
+ virtual void writeFormulaRtf( OStringBuffer& rBuffer, rtl_TextEncoding nEncoding ) = 0;
+
+protected:
+ FormulaExportBase();
+
+ ~FormulaExportBase() {}
+};
+
+} // namespace
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/mathml/import.hxx b/include/oox/mathml/import.hxx
new file mode 100644
index 000000000000..fe436d41a047
--- /dev/null
+++ b/include/oox/mathml/import.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef _STARMATHIMPORT_HXX
+#define _STARMATHIMPORT_HXX
+
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include <tools/gen.hxx>
+
+#include <oox/dllapi.h>
+
+namespace oox
+{
+
+namespace formulaimport
+{
+class XmlStream;
+}
+
+/**
+ Interface class, StarMath will implement readFormulaOoxml() to read OOXML
+ representing the formula and getFormulaSize() to provide the size of the resulting
+ formula.
+ */
+class OOX_DLLPUBLIC FormulaImportBase
+{
+public:
+ virtual void readFormulaOoxml( oox::formulaimport::XmlStream& stream ) = 0;
+ virtual Size getFormulaSize() const = 0;
+
+protected:
+ FormulaImportBase();
+
+ ~FormulaImportBase() {}
+};
+
+} // namespace
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/mathml/importutils.hxx b/include/oox/mathml/importutils.hxx
new file mode 100644
index 000000000000..c3c16482164f
--- /dev/null
+++ b/include/oox/mathml/importutils.hxx
@@ -0,0 +1,254 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef _STARMATHIMPORTUTILS_HXX
+#define _STARMATHIMPORTUTILS_HXX
+
+#include <com/sun/star/xml/sax/XFastAttributeList.hpp>
+#include <oox/token/tokens.hxx>
+#include <map>
+#include <vector>
+
+#include <oox/dllapi.h>
+
+namespace oox
+{
+
+namespace formulaimport
+{
+
+// used to differentiate between tags that opening or closing
+const int TAG_OPENING = 1 << 29;
+const int TAG_CLOSING = 1 << 30;
+
+// you probably want to #define these to something shorter in the .cxx file,
+// but they must be done as macros, otherwise they wouldn't be usable for case values,
+// and macros cannot be namespaced
+#define XML_STREAM_OPENING( token ) ( TAG_OPENING | token )
+#define XML_STREAM_CLOSING( token ) ( TAG_CLOSING | token )
+
+/**
+ Class for storing a stream of xml tokens.
+
+ A part of an XML file can be parsed and stored in this stream, from which it can be read
+ as if parsed linearly. The purpose of this class is to allow simpler handling of XML
+ files, unlike the usual LO way of using callbacks, context handlers and similar needlesly
+ complicated stuff (YMMV).
+
+ The advantages of this approach is easy to read and debug code (as it is just functions
+ reading tokens one by one and calling other functions, compared to having to use callbacks
+ and temporary storage). The disadvantage is that the XML structure needs to be handled
+ manually by the code.
+
+ Note that tag identifiers are simply int values and the API does not care besides matching
+ their values to XML stream contents and requiring that the values are not as high as TAG_OPENING.
+ Be prepared for the fact that some of the functions may throw exceptions if the input
+ stream does not match the required token (TBD).
+
+ The API tries to make the common idioms as simple as possible, see the following examples.
+
+ Parse <tagone attr="value"><tagtwo>text</tagtwo></tagone> , where tagtwo is optional:
+ @code
+XmlStream::Tag tagoneTag = stream.ensureOpeningTag( tagone );
+if( attributeTag.hasAttribute( attr ))
+ ... = attributeTag.attribute( attr, defaultValueOfTheRightType );
+if( XmlStream::Tag tagtwoTag = stream.checkOpeningTag( tagtwo ))
+{
+ ... = tagtwoTag.text;
+ stream.ensureClosingTag( tagtwo );
+}
+stream.ensureClosingTag( tagone );
+ @endcode
+
+ Parse an element that may contain several sub-elements of different types in random order:
+ @code
+stream.ensureOpeningTag( element );
+while( !stream.atEnd() && stream.currentToken() != CLOSING( element ))
+ {
+ switch( stream.currentToken())
+ {
+ case OPENING( subelement1 ):
+ handleSubElement1();
+ break;
+ case OPENING( subelement2 ):
+ ... process subelement2;
+ break;
+ default:
+ stream.handleUnexpectedTag();
+ break;
+ }
+stream.ensureClosingTag( element );
+ @endcode
+
+ If there may not be a zero number of sub-elements, use a helper bool variable or use a do-while loop.
+
+ Parse an element that may contain an unknown number of sub-elements of the same type:
+ @code
+stream.ensureOpeningTag( element );
+while( !stream.atEnd() && stream.findTag( OPENING( subelement )))
+ {
+ handleSubelement();
+ }
+stream.ensureClosingTag( element );
+ @endcode
+
+ If there may not be a zero number of sub-elements, use a helper bool variable or use a do-while loop.
+
+ @since 3.5
+*/
+class OOX_DLLPUBLIC XmlStream
+{
+public:
+ XmlStream();
+ /**
+ Structure representing a list of attributes.
+ */
+ // One could theoretically use oox::AttributeList, but that complains if the passed reference is empty,
+ // which would be complicated to avoid here. Also, parsers apparently reuse the same instance of XFastAttributeList,
+ // which means using oox::AttributeList would make them all point to the one instance.
+ struct OOX_DLLPUBLIC AttributeList
+ {
+ bool hasAttribute( int token ) const;
+ OUString& operator[] (int token);
+ OUString attribute( int token, const OUString& def = OUString()) const;
+ bool attribute( int token, bool def ) const;
+ sal_Unicode attribute( int token, sal_Unicode def ) const;
+ // when adding more attribute() overloads, add also to XmlStream itself
+ protected:
+ std::map< int, OUString > attrs;
+ };
+ /**
+ Structure representing a tag, including its attributes and content text immediatelly following it.
+ */
+ struct OOX_DLLPUBLIC Tag
+ {
+ Tag( int token = XML_TOKEN_INVALID,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XFastAttributeList >& attributes = com::sun::star::uno::Reference< com::sun::star::xml::sax::XFastAttributeList >(),
+ const OUString& text = OUString());
+ Tag( int token,
+ const AttributeList& attribs);
+ int token; ///< tag type, or XML_TOKEN_INVALID
+ AttributeList attributes;
+ OUString text;
+ /**
+ This function returns value of the given attribute, or the passed default value if not found.
+ The type of the default value selects the return type (OUString here).
+ */
+ OUString attribute( int token, const OUString& def = OUString()) const;
+ /**
+ @overload
+ */
+ bool attribute( int token, bool def ) const;
+ /**
+ @overload
+ */
+ sal_Unicode attribute( int token, sal_Unicode def ) const;
+ // when adding more attribute() overloads, add also to XmlStream::AttributeList and inline below
+ /**
+ Converts to true if the tag has a valid token, false otherwise. Allows simple
+ usage in if(), for example 'if( XmlStream::Tag foo = stream.checkOpeningTag( footoken ))'.
+ */
+ operator bool() const;
+ };
+ /**
+ @return true if current position is at the end of the XML stream
+ */
+ bool atEnd() const;
+ /**
+ @return data about the current tag
+ */
+ Tag currentTag() const;
+ /**
+ @return the token for the current tag
+ */
+ int currentToken() const;
+ /**
+ Moves position to the next tag.
+ */
+ void moveToNextTag();
+ /**
+ Ensures that an opening tag with the given token is read. If the current tag does not match,
+ writes out a warning and tries to recover by skipping tags until found (or until the current element would end).
+ If found, the position in the stream is afterwards moved to the next tag.
+ @return the matching found opening tag, or empty tag if not found
+ */
+ Tag ensureOpeningTag( int token );
+ /**
+ Tries to find an opening tag with the given token. Works similarly like ensureOpeningTag(),
+ but if a matching tag is not found, the position in the stream is not altered. The primary
+ use of this function is to check for optional elements.
+ @return the matching found opening tag, or empty tag if not found
+ */
+ Tag checkOpeningTag( int token );
+ /**
+ Ensures that a closing tag with the given token is read. Like ensureOpeningTag(),
+ if not, writes out a warning and tries to recover by skiping tags until found (or until the current element would end).
+ If found, the position in the stream is afterwards moved to the next tag.
+ */
+ void ensureClosingTag( int token );
+ /**
+ Tries to find the given token, until either found (returns true) or end of current element.
+ Position in the stream is set to make the tag current (i.e. it will be the next one read).
+ */
+ bool findTag( int token );
+ /**
+ Handle the current (unexpected) tag.
+ */
+ void handleUnexpectedTag();
+protected:
+ Tag checkTag( int token, bool optional );
+ bool findTagInternal( int token, bool silent );
+ void skipElementInternal( int token, bool silent );
+ std::vector< Tag > tags;
+ unsigned int pos;
+};
+
+/**
+ This class is used for creating XmlStream.
+
+ Simply use this class and then pass it as XmlStream to the consumer.
+
+ @since 3.5.0
+*/
+class OOX_DLLPUBLIC XmlStreamBuilder
+: public XmlStream
+{
+public:
+ void appendOpeningTag( int token,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XFastAttributeList >& attributes = com::sun::star::uno::Reference< com::sun::star::xml::sax::XFastAttributeList >());
+ void appendOpeningTag( int token,
+ const AttributeList& attribs );
+ void appendClosingTag( int token );
+ // appends the characters after the last appended token
+ void appendCharacters( const OUString& characters );
+};
+
+inline
+OUString XmlStream::Tag::attribute( int t, const OUString& def ) const
+{
+ return attributes.attribute( t, def );
+}
+
+inline
+bool XmlStream::Tag::attribute( int t, bool def ) const
+{
+ return attributes.attribute( t, def );
+}
+
+inline
+sal_Unicode XmlStream::Tag::attribute( int t, sal_Unicode def ) const
+{
+ return attributes.attribute( t, def );
+}
+
+} // namespace
+} // namespace
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/axbinaryreader.hxx b/include/oox/ole/axbinaryreader.hxx
new file mode 100644
index 000000000000..b6a937d14c4c
--- /dev/null
+++ b/include/oox/ole/axbinaryreader.hxx
@@ -0,0 +1,257 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_OLE_AXBINARYREADER_HXX
+#define OOX_OLE_AXBINARYREADER_HXX
+
+#include <utility>
+#include "oox/helper/binaryinputstream.hxx"
+#include "oox/helper/refvector.hxx"
+#include "oox/ole/axfontdata.hxx"
+
+namespace oox {
+namespace ole {
+
+// ============================================================================
+
+/** A wrapper for a binary input stream that supports aligned read operations.
+
+ The implementation does not support seeking back the wrapped stream. All
+ seeking operations (tell, seekTo, align) are performed relative to the
+ position of the wrapped stream at construction time of this wrapper. It is
+ possible to construct this wrapper with an unseekable input stream without
+ loosing any functionality.
+ */
+class AxAlignedInputStream : public BinaryInputStream
+{
+public:
+ explicit AxAlignedInputStream( BinaryInputStream& rInStrm );
+
+ /** Returns the size of the data this stream represents, if the wrapped
+ stream supports the size() operation. */
+ virtual sal_Int64 size() const;
+ /** Return the current relative stream position (relative to position of
+ the wrapped stream at construction time). */
+ virtual sal_Int64 tell() const;
+ /** Seeks the stream to the passed relative position, if it is behind the
+ current position. */
+ virtual void seek( sal_Int64 nPos );
+ /** Closes the input stream but not the wrapped stream. */
+ virtual void close();
+
+ /** Reads nBytes bytes to the passed sequence.
+ @return Number of bytes really read. */
+ virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 );
+ /** Reads nBytes bytes to the (existing) buffer opMem.
+ @return Number of bytes really read. */
+ virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 );
+ /** Seeks the stream forward by the passed number of bytes. */
+ virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 );
+
+ /** Aligns the stream to a multiple of the passed size (relative to the
+ position of the wrapped stream at construction time). */
+ void align( size_t nSize );
+
+ /** Aligns the stream according to the passed type and reads a value. */
+ template< typename Type >
+ inline Type readAligned() { align( sizeof( Type ) ); return readValue< Type >(); }
+ /** Aligns the stream according to the passed type and skips the size of the type. */
+ template< typename Type >
+ inline void skipAligned() { align( sizeof( Type ) ); skip( sizeof( Type ) ); }
+
+private:
+ BinaryInputStream* mpInStrm; ///< The wrapped input stream.
+ sal_Int64 mnStrmPos; ///< Tracks relative position in the stream.
+ sal_Int64 mnStrmSize; ///< Size of the wrapped stream data.
+};
+
+// ============================================================================
+
+/** A pair of integer values as a property. */
+typedef ::std::pair< sal_Int32, sal_Int32 > AxPairData;
+
+/** An array of string values as a property. */
+typedef ::std::vector< OUString > AxArrayString;
+
+// ============================================================================
+
+/** Import helper to read simple and complex ActiveX form control properties
+ from a binary input stream. */
+class AxBinaryPropertyReader
+{
+public:
+ explicit AxBinaryPropertyReader( BinaryInputStream& rInStrm, bool b64BitPropFlags = false );
+
+ /** Reads the next integer property value from the stream, if the
+ respective flag in the property mask is set. */
+ template< typename StreamType, typename DataType >
+ inline void readIntProperty( DataType& ornValue )
+ { if( startNextProperty() ) ornValue = maInStrm.readAligned< StreamType >(); }
+ /** Reads the next boolean property value from the stream, if the
+ respective flag in the property mask is set. */
+ void readBoolProperty( bool& orbValue, bool bReverse = false );
+ /** Reads the next pair property from the stream, if the respective flag in
+ the property mask is set. */
+ void readPairProperty( AxPairData& orPairData );
+ /** Reads the next string property from the stream, if the respective flag
+ in the property mask is set. */
+ void readStringProperty( OUString& orValue );
+ /** Reads ArrayString, an array of fmString ( compressed or uncompressed )
+ is read from the stream and inserted into rStrings */
+ void readArrayStringProperty( std::vector< OUString >& rStrings );
+ /** Reads the next GUID property from the stream, if the respective flag
+ in the property mask is set. The GUID will be enclosed in braces. */
+ void readGuidProperty( OUString& orGuid );
+ /** Reads the next font property from the stream, if the respective flag in
+ the property mask is set. */
+ void readFontProperty( AxFontData& orFontData );
+ /** Reads the next picture property from the stream, if the respective flag
+ in the property mask is set. */
+ void readPictureProperty( StreamDataSequence& orPicData );
+
+ /** Skips the next integer property value in the stream, if the respective
+ flag in the property mask is set. */
+ template< typename StreamType >
+ inline void skipIntProperty() { if( startNextProperty() ) maInStrm.skipAligned< StreamType >(); }
+ /** Skips the next boolean property value in the stream, if the respective
+ flag in the property mask is set. */
+ inline void skipBoolProperty() { startNextProperty(); }
+ /** Skips the next pair property in the stream, if the respective flag in
+ the property mask is set. */
+ void skipPairProperty() { readPairProperty( maDummyPairData ); }
+ /** Skips the next string property in the stream, if the respective flag in
+ the property mask is set. */
+ inline void skipStringProperty() { readStringProperty( maDummyString ); }
+ /** Skips the next ArrayString property in the stream, if the respective flag in
+ the property mask is set. */
+ inline void skipArrayStringProperty() { readArrayStringProperty( maDummyArrayString ); }
+ /** Skips the next GUID property in the stream, if the respective flag in
+ the property mask is set. */
+ inline void skipGuidProperty() { readGuidProperty( maDummyString ); }
+ /** Skips the next font property in the stream, if the respective flag in
+ the property mask is set. */
+ inline void skipFontProperty() { readFontProperty( maDummyFontData ); }
+ /** Skips the next picture property in the stream, if the respective flag
+ in the property mask is set. */
+ inline void skipPictureProperty() { readPictureProperty( maDummyPicData ); }
+ /** Has to be called for undefined properties. If the respective flag in
+ the mask is set, the property import cannot be finished successfully. */
+ inline void skipUndefinedProperty() { ensureValid( !startNextProperty() ); }
+
+ /** Final processing, reads contents of all complex properties. */
+ bool finalizeImport();
+
+private:
+ bool ensureValid( bool bCondition = true );
+ bool startNextProperty();
+
+private:
+ /** Base class for complex properties such as string, point, size, GUID, picture. */
+ struct ComplexProperty
+ {
+ virtual ~ComplexProperty();
+ virtual bool readProperty( AxAlignedInputStream& rInStrm ) = 0;
+ };
+
+ /** Complex property for a 32-bit value pair, e.g. point or size. */
+ struct PairProperty : public ComplexProperty
+ {
+ AxPairData& mrPairData;
+
+ inline explicit PairProperty( AxPairData& rPairData ) :
+ mrPairData( rPairData ) {}
+ virtual bool readProperty( AxAlignedInputStream& rInStrm );
+ };
+
+ /** Complex property for a string value. */
+ struct StringProperty : public ComplexProperty
+ {
+ OUString& mrValue;
+ sal_uInt32 mnSize;
+
+ inline explicit StringProperty( OUString& rValue, sal_uInt32 nSize ) :
+ mrValue( rValue ), mnSize( nSize ) {}
+ virtual bool readProperty( AxAlignedInputStream& rInStrm );
+ };
+
+ /** Complex property for an array of strings. */
+ struct ArrayStringProperty : public ComplexProperty
+ {
+ AxArrayString& mrArray;
+ sal_uInt32 mnSize;
+ inline explicit ArrayStringProperty( AxArrayString& rArray, sal_uInt32 nSize ) :
+ mrArray( rArray ), mnSize( nSize ) {}
+ virtual bool readProperty( AxAlignedInputStream& rInStrm );
+ };
+
+ /** Complex property for a GUID value. */
+ struct GuidProperty : public ComplexProperty
+ {
+ OUString& mrGuid;
+
+ inline explicit GuidProperty( OUString& rGuid ) :
+ mrGuid( rGuid ) {}
+ virtual bool readProperty( AxAlignedInputStream& rInStrm );
+ };
+
+ /** Stream property for a font structure. */
+ struct FontProperty : public ComplexProperty
+ {
+ AxFontData& mrFontData;
+
+ inline explicit FontProperty( AxFontData& rFontData ) :
+ mrFontData( rFontData ) {}
+ virtual bool readProperty( AxAlignedInputStream& rInStrm );
+ };
+
+ /** Stream property for a picture or mouse icon. */
+ struct PictureProperty : public ComplexProperty
+ {
+ StreamDataSequence& mrPicData;
+
+ inline explicit PictureProperty( StreamDataSequence& rPicData ) :
+ mrPicData( rPicData ) {}
+ virtual bool readProperty( AxAlignedInputStream& rInStrm );
+ };
+
+ typedef RefVector< ComplexProperty > ComplexPropVector;
+
+private:
+ AxAlignedInputStream maInStrm; ///< The input stream to read from.
+ ComplexPropVector maLargeProps; ///< Stores info for all used large properties.
+ ComplexPropVector maStreamProps; ///< Stores info for all used stream data properties.
+ AxPairData maDummyPairData; ///< Dummy pair for unsupported properties.
+ AxFontData maDummyFontData; ///< Dummy font for unsupported properties.
+ StreamDataSequence maDummyPicData; ///< Dummy picture for unsupported properties.
+ OUString maDummyString; ///< Dummy string for unsupported properties.
+ AxArrayString maDummyArrayString; ///< Dummy strings for unsupported ArrayString properties.
+ sal_Int64 mnPropFlags; ///< Flags specifying existing properties.
+ sal_Int64 mnNextProp; ///< Next property to read.
+ sal_Int64 mnPropsEnd; ///< End position of simple/large properties.
+ bool mbValid; ///< True = stream still valid.
+};
+
+// ============================================================================
+
+} // namespace ole
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/axbinarywriter.hxx b/include/oox/ole/axbinarywriter.hxx
new file mode 100644
index 000000000000..eb4aec532d1f
--- /dev/null
+++ b/include/oox/ole/axbinarywriter.hxx
@@ -0,0 +1,194 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * [ Copyright (C) 2011 Noel Power<noel.power@suse.com> (initial developer) ]
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+#ifndef OOX_OLE_AXBINARYWRITER_HXX
+#define OOX_OLE_AXBINARYWRITER_HXX
+
+#include <utility>
+#include "oox/helper/binaryoutputstream.hxx"
+#include "oox/helper/refvector.hxx"
+
+namespace oox {
+namespace ole {
+// ============================================================================
+
+/** A wrapper for a binary output stream that supports aligned write operations.
+
+ The implementation does support seeking back the wrapped stream. All
+ seeking operations (tell, seekTo, align) are performed relative to the
+ position of the wrapped stream at construction time of this wrapper.
+ Unlike it's reader class counterpart it is NOT possible to construct this
+ wrapper with an unseekable output stream.
+ */
+class AxAlignedOutputStream : public BinaryOutputStream
+{
+public:
+ explicit AxAlignedOutputStream( BinaryOutputStream& rOutStrm );
+
+ /** Returns the size of the data this stream represents, if the wrapped
+ stream supports the size() operation. */
+ virtual sal_Int64 size() const;
+ /** Return the current relative stream position (relative to position of
+ the wrapped stream at construction time). */
+ virtual sal_Int64 tell() const;
+ /** Seeks the stream to the passed relative position, if it is behind the
+ current position. */
+ virtual void seek( sal_Int64 nPos );
+ /** Closes the input stream but not the wrapped stream. */
+ virtual void close();
+
+ /** Reads nBytes bytes to the passed sequence.
+ @return Number of bytes really read. */
+ virtual void writeData( const StreamDataSequence& orData, size_t nAtomSize = 1 );
+ /** Reads nBytes bytes to the (existing) buffer opMem.
+ @return Number of bytes really read. */
+ virtual void writeMemory( const void* pMem, sal_Int32 nBytes, size_t nAtomSize = 1 );
+
+ /** Aligns the stream to a multiple of the passed size (relative to the
+ position of the wrapped stream at construction time). */
+ void align( size_t nSize );
+
+ void pad( sal_Int32 nBytes, size_t nAtomSize = 1);
+ /** Aligns the stream according to the passed type and reads a value. */
+ template< typename Type >
+ inline void writeAligned( Type nVal ) { align( sizeof( Type ) ); writeValue( nVal ); }
+ /** Aligns the stream according to the passed type and skips the size of the type. */
+ template< typename Type >
+ inline void padAligned() { align( sizeof( Type ) ); pad( sizeof( Type ) ); }
+
+private:
+ BinaryOutputStream* mpOutStrm; ///< The wrapped input stream.
+ sal_Int64 mnStrmPos; ///< Tracks relative position in the stream.
+ sal_Int64 mnStrmSize; ///< Size of the wrapped stream data.
+ sal_Int64 mnWrappedBeginPos; ///< starting pos or wrapped stream
+};
+
+/** A pair of integer values as a property. */
+typedef ::std::pair< sal_Int32, sal_Int32 > AxPairData;
+
+/** An array of string values as a property. */
+typedef ::std::vector< OUString > AxStringArray;
+
+// ============================================================================
+
+/** Export helper to write simple and complex ActiveX form control properties
+ to a binary input stream. */
+class AxBinaryPropertyWriter
+{
+public:
+ explicit AxBinaryPropertyWriter( BinaryOutputStream& rOutStrm, bool b64BitPropFlags = false );
+
+ /** Write an integer property value to the stream, the
+ respective flag in the property mask is set. */
+ template< typename StreamType, typename DataType >
+ inline void writeIntProperty( DataType& ornValue )
+ { if( startNextProperty() ) maOutStrm.writeAligned< StreamType >( ornValue ); }
+ /** Write a boolean property value to the stream, the
+ respective flag in the property mask is set. */
+ void writeBoolProperty( bool orbValue, bool bReverse = false );
+ /** Write a pair property the stream, the respective flag in
+ the property mask is set. */
+ void writePairProperty( AxPairData& orPairData );
+ /** Write a string property to the stream, the respective flag
+ in the property mask is set. */
+ void writeStringProperty( OUString& orValue, bool bCompressed = true );
+
+ /** Skips the next property clears the respective
+ flag in the property mask. */
+ inline void skipProperty() { startNextProperty( true ); }
+
+ /** Final processing, write contents of all complex properties, writes record size */
+ bool finalizeExport();
+
+private:
+ bool ensureValid( bool bCondition = true );
+ bool startNextProperty( bool bSkip = false );
+
+private:
+ /** Base class for complex properties such as string, point, size, GUID, picture. */
+ struct ComplexProperty
+ {
+ virtual ~ComplexProperty();
+ virtual bool writeProperty( AxAlignedOutputStream& rOutStrm ) = 0;
+ };
+
+ /** Complex property for a 32-bit value pair, e.g. point or size. */
+ struct PairProperty : public ComplexProperty
+ {
+ AxPairData& mrPairData;
+
+ inline explicit PairProperty( AxPairData& rPairData ) :
+ mrPairData( rPairData ) {}
+ virtual bool writeProperty( AxAlignedOutputStream& rOutStrm );
+ };
+
+ /** Complex property for a string value. */
+ struct StringProperty : public ComplexProperty
+ {
+ OUString& mrValue;
+ sal_uInt32 mnSize;
+
+ inline explicit StringProperty( OUString& rValue, sal_uInt32 nSize ) :
+ mrValue( rValue ), mnSize( nSize ) {}
+ virtual bool writeProperty( AxAlignedOutputStream& rOutStrm );
+ };
+
+ /** Stream property for a picture or mouse icon. */
+ struct PictureProperty : public ComplexProperty
+ {
+ StreamDataSequence& mrPicData;
+
+ inline explicit PictureProperty( StreamDataSequence& rPicData ) :
+ mrPicData( rPicData ) {}
+ virtual bool writeProperty( AxAlignedOutputStream& rOutStrm );
+ };
+
+ typedef RefVector< ComplexProperty > ComplexPropVector;
+
+private:
+ AxAlignedOutputStream maOutStrm; ///< The input stream to read from.
+ ComplexPropVector maLargeProps; ///< Stores info for all used large properties.
+ ComplexPropVector maStreamProps; ///< Stores info for all used stream data properties.
+ AxPairData maDummyPairData; ///< Dummy pair for unsupported properties.
+ StreamDataSequence maDummyPicData; ///< Dummy picture for unsupported properties.
+ OUString maDummyString; ///< Dummy string for unsupported properties.
+ AxStringArray maDummyStringArray; ///< Dummy string array for unsupported properties.
+ sal_Int16 mnBlockSize;
+ sal_Int64 mnPropFlagsStart; ///< pos of Prop flags
+ sal_Int64 mnPropFlags; ///< Flags specifying existing properties.
+ sal_Int64 mnNextProp; ///< Next property to read.
+ bool mbValid; ///< True = stream still valid.
+ bool mb64BitPropFlags;
+};
+
+// ============================================================================
+} // namespace ole
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/axcontrol.hxx b/include/oox/ole/axcontrol.hxx
new file mode 100644
index 000000000000..84e3a3ecbcdd
--- /dev/null
+++ b/include/oox/ole/axcontrol.hxx
@@ -0,0 +1,1031 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_OLE_AXCONTROL_HXX
+#define OOX_OLE_AXCONTROL_HXX
+
+#include <boost/shared_ptr.hpp>
+#include "oox/helper/binarystreambase.hxx"
+#include "oox/helper/propertyset.hxx"
+#include "oox/ole/axbinaryreader.hxx"
+#include "oox/ole/olehelper.hxx"
+#include "oox/dllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace awt { class XControlModel; }
+ namespace container { class XIndexContainer; }
+ namespace drawing { class XDrawPage; }
+ namespace frame { class XModel; }
+ namespace form { class XFormsSupplier; }
+ namespace lang { class XMultiServiceFactory; }
+} } }
+
+namespace oox {
+ class BinaryInputStream;
+ class GraphicHelper;
+ class PropertyMap;
+}
+
+namespace oox {
+namespace ole {
+
+// ============================================================================
+
+#define COMCTL_GUID_SCROLLBAR_60 "{FE38753A-44A3-11D1-B5B7-0000C09000C4}"
+#define COMCTL_GUID_PROGRESSBAR_50 "{0713E8D2-850A-101B-AFC0-4210102A8DA7}"
+#define COMCTL_GUID_PROGRESSBAR_60 "{35053A22-8589-11D1-B16A-00C0F0283628}"
+
+const sal_uInt16 COMCTL_VERSION_50 = 5;
+const sal_uInt16 COMCTL_VERSION_60 = 6;
+
+// ----------------------------------------------------------------------------
+
+#define AX_GUID_COMMANDBUTTON "{D7053240-CE69-11CD-a777-00dd01143c57}"
+#define AX_GUID_LABEL "{978C9E23-D4B0-11CE-bf2d-00aa003f40d0}"
+#define AX_GUID_IMAGE "{4C599241-6926-101B-9992-00000b65c6f9}"
+#define AX_GUID_TOGGLEBUTTON "{8BD21D60-EC42-11CE-9e0d-00aa006002f3}"
+#define AX_GUID_CHECKBOX "{8BD21D40-EC42-11CE-9e0d-00aa006002f3}"
+#define AX_GUID_OPTIONBUTTON "{8BD21D50-EC42-11CE-9e0d-00aa006002f3}"
+#define AX_GUID_TEXTBOX "{8BD21D10-EC42-11CE-9e0d-00aa006002f3}"
+#define AX_GUID_LISTBOX "{8BD21D20-EC42-11CE-9e0d-00aa006002f3}"
+#define AX_GUID_COMBOBOX "{8BD21D30-EC42-11CE-9e0d-00aa006002f3}"
+#define AX_GUID_SPINBUTTON "{79176FB0-B7F2-11CE-97ef-00aa006d2776}"
+#define AX_GUID_SCROLLBAR "{DFD181E0-5E2F-11CE-a449-00aa004a803d}"
+#define AX_GUID_FRAME "{6E182020-F460-11CE-9bcd-00aa00608e01}"
+
+// Html control GUID(s)
+
+#define HTML_GUID_SELECT "{5512D122-5CC6-11CF-8d67-00aa00bdce1d}"
+#define HTML_GUID_TEXTBOX "{5512D124-5CC6-11CF-8d67-00aa00bdce1d}"
+
+const sal_uInt32 AX_SYSCOLOR_WINDOWBACK = 0x80000005;
+const sal_uInt32 AX_SYSCOLOR_WINDOWFRAME = 0x80000006;
+const sal_uInt32 AX_SYSCOLOR_WINDOWTEXT = 0x80000008;
+const sal_uInt32 AX_SYSCOLOR_BUTTONFACE = 0x8000000F;
+const sal_uInt32 AX_SYSCOLOR_BUTTONTEXT = 0x80000012;
+
+const sal_uInt32 AX_FLAGS_ENABLED = 0x00000002;
+const sal_uInt32 AX_FLAGS_LOCKED = 0x00000004;
+const sal_uInt32 AX_FLAGS_OPAQUE = 0x00000008;
+const sal_uInt32 AX_FLAGS_COLUMNHEADS = 0x00000400;
+const sal_uInt32 AX_FLAGS_ENTIREROWS = 0x00000800;
+const sal_uInt32 AX_FLAGS_EXISTINGENTRIES = 0x00001000;
+const sal_uInt32 AX_FLAGS_CAPTIONLEFT = 0x00002000;
+const sal_uInt32 AX_FLAGS_EDITABLE = 0x00004000;
+const sal_uInt32 AX_FLAGS_IMEMODE_MASK = 0x00078000;
+const sal_uInt32 AX_FLAGS_DRAGENABLED = 0x00080000;
+const sal_uInt32 AX_FLAGS_ENTERASNEWLINE = 0x00100000;
+const sal_uInt32 AX_FLAGS_KEEPSELECTION = 0x00200000;
+const sal_uInt32 AX_FLAGS_TABASCHARACTER = 0x00400000;
+const sal_uInt32 AX_FLAGS_WORDWRAP = 0x00800000;
+const sal_uInt32 AX_FLAGS_BORDERSSUPPRESSED = 0x02000000;
+const sal_uInt32 AX_FLAGS_SELECTLINE = 0x04000000;
+const sal_uInt32 AX_FLAGS_SINGLECHARSELECT = 0x08000000;
+const sal_uInt32 AX_FLAGS_AUTOSIZE = 0x10000000;
+const sal_uInt32 AX_FLAGS_HIDESELECTION = 0x20000000;
+const sal_uInt32 AX_FLAGS_MAXLENAUTOTAB = 0x40000000;
+const sal_uInt32 AX_FLAGS_MULTILINE = 0x80000000;
+
+const sal_Int32 AX_BORDERSTYLE_NONE = 0;
+const sal_Int32 AX_BORDERSTYLE_SINGLE = 1;
+
+const sal_Int32 AX_SPECIALEFFECT_FLAT = 0;
+const sal_Int32 AX_SPECIALEFFECT_RAISED = 1;
+const sal_Int32 AX_SPECIALEFFECT_SUNKEN = 2;
+const sal_Int32 AX_SPECIALEFFECT_ETCHED = 3;
+const sal_Int32 AX_SPECIALEFFECT_BUMPED = 6;
+
+const sal_Int32 AX_PICSIZE_CLIP = 0;
+const sal_Int32 AX_PICSIZE_STRETCH = 1;
+const sal_Int32 AX_PICSIZE_ZOOM = 3;
+
+const sal_Int32 AX_PICALIGN_TOPLEFT = 0;
+const sal_Int32 AX_PICALIGN_TOPRIGHT = 1;
+const sal_Int32 AX_PICALIGN_CENTER = 2;
+const sal_Int32 AX_PICALIGN_BOTTOMLEFT = 3;
+const sal_Int32 AX_PICALIGN_BOTTOMRIGHT = 4;
+
+const sal_Int32 AX_DISPLAYSTYLE_TEXT = 1;
+const sal_Int32 AX_DISPLAYSTYLE_LISTBOX = 2;
+const sal_Int32 AX_DISPLAYSTYLE_COMBOBOX = 3;
+const sal_Int32 AX_DISPLAYSTYLE_CHECKBOX = 4;
+const sal_Int32 AX_DISPLAYSTYLE_OPTBUTTON = 5;
+const sal_Int32 AX_DISPLAYSTYLE_TOGGLE = 6;
+const sal_Int32 AX_DISPLAYSTYLE_DROPDOWN = 7;
+
+const sal_Int32 AX_SELCTION_SINGLE = 0;
+const sal_Int32 AX_SELCTION_MULTI = 1;
+const sal_Int32 AX_SELCTION_EXTENDED = 2;
+
+const sal_Int32 AX_SHOWDROPBUTTON_NEVER = 0;
+const sal_Int32 AX_SHOWDROPBUTTON_FOCUS = 1;
+const sal_Int32 AX_SHOWDROPBUTTON_ALWAYS = 2;
+
+const sal_Int32 AX_SCROLLBAR_NONE = 0x00;
+const sal_Int32 AX_SCROLLBAR_HORIZONTAL = 0x01;
+const sal_Int32 AX_SCROLLBAR_VERTICAL = 0x02;
+
+// ----------------------------------------------------------------------------
+
+/** Enumerates all UNO API control types supported by these filters. */
+enum ApiControlType
+{
+ API_CONTROL_BUTTON,
+ API_CONTROL_FIXEDTEXT,
+ API_CONTROL_IMAGE,
+ API_CONTROL_CHECKBOX,
+ API_CONTROL_RADIOBUTTON,
+ API_CONTROL_EDIT,
+ API_CONTROL_NUMERIC,
+ API_CONTROL_LISTBOX,
+ API_CONTROL_COMBOBOX,
+ API_CONTROL_SPINBUTTON,
+ API_CONTROL_SCROLLBAR,
+ API_CONTROL_TABSTRIP, //11
+ API_CONTROL_PROGRESSBAR,
+ API_CONTROL_GROUPBOX,
+ API_CONTROL_FRAME, // 14
+ API_CONTROL_PAGE, // 15
+ API_CONTROL_MULTIPAGE, // 16
+ API_CONTROL_DIALOG // 17
+};
+
+// ============================================================================
+
+/** Specifies how a form control supports transparent background. */
+enum ApiTransparencyMode
+{
+ API_TRANSPARENCY_NOTSUPPORTED, ///< Control does not support transparency.
+ API_TRANSPARENCY_VOID, ///< Transparency is enabled by missing fill color.
+ API_TRANSPARENCY_PAINTTRANSPARENT ///< Transparency is enabled by the 'PaintTransparent' property.
+};
+
+/** Specifies how a form control supports the DefaultState property. */
+enum ApiDefaultStateMode
+{
+ API_DEFAULTSTATE_BOOLEAN, ///< Control does not support tri-state, state is given as boolean.
+ API_DEFAULTSTATE_SHORT, ///< Control does not support tri-state, state is given as short.
+ API_DEFAULTSTATE_TRISTATE ///< Control supports tri-state, state is given as short.
+};
+
+// ----------------------------------------------------------------------------
+
+/** A base class with useful helper functions for something that is able to
+ convert ActiveX and ComCtl form controls.
+ */
+class OOX_DLLPUBLIC ControlConverter
+{
+public:
+ explicit ControlConverter(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxDocModel,
+ const GraphicHelper& rGraphicHelper,
+ bool bDefaultColorBgr = true );
+ virtual ~ControlConverter();
+
+ // Generic conversion -----------------------------------------------------
+
+ /** Converts the passed position in 1/100 mm to UNO properties. */
+ void convertPosition(
+ PropertyMap& rPropMap,
+ const AxPairData& rPos ) const;
+
+ /** Converts the passed size in 1/100 mm to UNO properties. */
+ void convertSize(
+ PropertyMap& rPropMap,
+ const AxPairData& rSize ) const;
+
+ /** Converts the passed encoded OLE color to UNO properties. */
+ void convertColor(
+ PropertyMap& rPropMap,
+ sal_Int32 nPropId,
+ sal_uInt32 nOleColor ) const;
+
+ void convertToMSColor(
+ PropertySet& rPropSet,
+ sal_Int32 nPropId,
+ sal_uInt32& nOleColor,
+ sal_uInt32 nDefault = 0 ) const;
+
+
+ /** Converts the passed StdPic picture stream to UNO properties. */
+ void convertPicture(
+ PropertyMap& rPropMap,
+ const StreamDataSequence& rPicData ) const;
+
+ /** Converts the control orientation to UNO properties. */
+ void convertOrientation(
+ PropertyMap& rPropMap,
+ bool bHorizontal ) const;
+
+ void convertToMSOrientation(
+ PropertySet& rPropMap,
+ bool& bHorizontal ) const;
+
+ /** Converts the vertical alignment to UNO properties. */
+ void convertVerticalAlign(
+ PropertyMap& rPropMap,
+ sal_Int32 nVerticalAlign ) const;
+
+ /** Converts common scrollbar settings to UNO properties. */
+ void convertScrollBar(
+ PropertyMap& rPropMap,
+ sal_Int32 nMin, sal_Int32 nMax, sal_Int32 nPosition,
+ sal_Int32 nSmallChange, sal_Int32 nLargeChange, bool bAwtModel ) const;
+
+ /** Converts scrollability settings to UNO properties. */
+ void convertScrollabilitySettings(
+ PropertyMap& rPropMap,
+ const AxPairData& rScrollPos, const AxPairData& rScrollArea,
+ sal_Int32 nScrollBars ) const;
+
+ /** Binds the passed control model to the passed data sources. The
+ implementation will check which source types are supported. */
+ void bindToSources(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxCtrlModel,
+ const OUString& rCtrlSource,
+ const OUString& rRowSource,
+ sal_Int32 nRefSheet = 0 ) const;
+
+ // ActiveX (Forms 2.0) specific conversion --------------------------------
+
+ /** Converts the Forms 2.0 background formatting to UNO properties. */
+ void convertAxBackground(
+ PropertyMap& rPropMap,
+ sal_uInt32 nBackColor,
+ sal_uInt32 nFlags,
+ ApiTransparencyMode eTranspMode ) const;
+
+ /** Converts the Forms 2.0 border formatting to UNO properties. */
+ void convertAxBorder(
+ PropertyMap& rPropMap,
+ sal_uInt32 nBorderColor,
+ sal_Int32 nBorderStyle,
+ sal_Int32 nSpecialEffect ) const;
+
+ void convertToAxBorder(
+ PropertySet& rPropSet,
+ sal_uInt32& nBorderColor,
+ sal_Int32& nBorderStyle,
+ sal_Int32& nSpecialEffect ) const;
+
+ /** Converts the Forms 2.0 special effect to UNO properties. */
+ void convertAxVisualEffect(
+ PropertyMap& rPropMap,
+ sal_Int32 nSpecialEffect ) const;
+
+ void convertToAxVisualEffect(
+ PropertySet& rPropSet,
+ sal_Int32& nSpecialEffect ) const;
+
+ /** Converts the passed picture stream and Forms 2.0 position to UNO
+ properties. */
+ void convertAxPicture(
+ PropertyMap& rPropMap,
+ const StreamDataSequence& rPicData,
+ sal_uInt32 nPicPos ) const;
+
+ /** Converts the passed picture stream and Forms 2.0 position to UNO
+ properties. */
+ void convertAxPicture(
+ PropertyMap& rPropMap,
+ const StreamDataSequence& rPicData,
+ sal_Int32 nPicSizeMode,
+ sal_Int32 nPicAlign,
+ bool bPicTiling ) const;
+
+ /** Converts the Forms 2.0 value for checked/unchecked/dontknow to UNO
+ properties. */
+ void convertAxState(
+ PropertyMap& rPropMap,
+ const OUString& rValue,
+ sal_Int32 nMultiSelect,
+ ApiDefaultStateMode eDefStateMode,
+ bool bAwtModel ) const;
+
+ void convertToAxState(
+ PropertySet& rPropSet,
+ OUString& rValue,
+ sal_Int32& nMultiSelect,
+ ApiDefaultStateMode eDefStateMode,
+ bool bAwtModel ) const;
+
+ /** Converts the Forms 2.0 control orientation to UNO properties. */
+ void convertAxOrientation(
+ PropertyMap& rPropMap,
+ const AxPairData& rSize,
+ sal_Int32 nOrientation ) const;
+
+ void convertToAxOrientation(
+ PropertySet& rPropSet,
+ const AxPairData& rSize,
+ sal_Int32& nOrientation ) const;
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxDocModel;
+ const GraphicHelper& mrGraphicHelper;
+ mutable PropertySet maAddressConverter;
+ mutable PropertySet maRangeConverter;
+ bool mbDefaultColorBgr;
+};
+
+// ============================================================================
+
+/** Base class for all models of form controls. */
+class OOX_DLLPUBLIC ControlModelBase
+{
+public:
+ explicit ControlModelBase();
+ virtual ~ControlModelBase();
+
+ /** Sets this control model to AWT model mode. */
+ inline void setAwtModelMode() { mbAwtModel = true; }
+ /** Sets this control model to form component mode. */
+ inline void setFormComponentMode() { mbAwtModel = false; }
+
+ /** Returns the UNO service name used to construct the AWT control model,
+ or the control form component. */
+ OUString getServiceName() const;
+
+ /** Derived classes set specific OOXML properties at the model structure. */
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue );
+ /** Derived classes set binary data (picture, mouse icon) at the model structure. */
+ virtual void importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm );
+ /** Derived classes import a form control model from the passed input stream. */
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm ) = 0;
+ /** Derived classes export a form control model to the passed output stream. */
+ virtual void exportBinaryModel( BinaryOutputStream& /*rOutStrm*/ ) {}
+ /** Derived classes export CompObjStream contents. */
+ virtual void exportCompObj( BinaryOutputStream& /*rOutStrm*/ ) {}
+ /** Derived classes return the UNO control type enum value. */
+ virtual ApiControlType getControlType() const = 0;
+ /** Derived classes convert all control properties. */
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ /** Derived classes convert from uno control properties to equiv. MS values. */
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+
+ /** Converts the control size to UNO properties. */
+ void convertSize( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+
+public: // direct access needed for legacy VML drawing controls
+ AxPairData maSize; ///< Size of the control in 1/100 mm.
+
+protected:
+ bool mbAwtModel; ///< True = AWT control model, false = form component.
+};
+
+typedef ::boost::shared_ptr< ControlModelBase > ControlModelRef;
+
+// ============================================================================
+
+/** Base class for all models of ComCtl form controls. */
+class ComCtlModelBase : public ControlModelBase
+{
+public:
+ explicit ComCtlModelBase(
+ sal_uInt32 nDataPartId5, sal_uInt32 nDataPartId6, sal_uInt16 nVersion,
+ bool bCommonPart, bool bComplexPart );
+
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+
+protected:
+ virtual void importControlData( BinaryInputStream& rInStrm ) = 0;
+ virtual void importCommonExtraData( BinaryInputStream& rInStrm );
+ virtual void importCommonTrailingData( BinaryInputStream& rInStrm );
+
+private:
+ /** Returns the data part identifier according to the model version. */
+ sal_uInt32 getDataPartId() const;
+
+ bool readPartHeader( BinaryInputStream& rInStrm,
+ sal_uInt32 nExpPartId,
+ sal_uInt16 nExpMajor = SAL_MAX_UINT16,
+ sal_uInt16 nExpMinor = SAL_MAX_UINT16 );
+
+ bool importSizePart( BinaryInputStream& rInStrm );
+ bool importCommonPart( BinaryInputStream& rInStrm, sal_uInt32 nPartSize );
+ bool importComplexPart( BinaryInputStream& rInStrm );
+
+protected:
+ StdFontInfo maFontData; ///< Font formatting.
+ StreamDataSequence maMouseIcon; ///< Binary picture stream for mouse icon.
+ sal_uInt32 mnFlags; ///< Common flags for ComCtl controls.
+ const sal_uInt16 mnVersion; ///< Current version of the ComCtl control model.
+
+private:
+ sal_uInt32 mnDataPartId5; ///< Identifier for version 5.0 control data.
+ sal_uInt32 mnDataPartId6; ///< Identifier for version 6.0 control data.
+ bool mbCommonPart; ///< True = the COMCTL_COMMONDATA part exists.
+ bool mbComplexPart; ///< True = the COMCTL_COMPLEXDATA part exists.
+};
+
+// ============================================================================
+
+/** Model for a ComCtl scroll bar. */
+class ComCtlScrollBarModel : public ComCtlModelBase
+{
+public:
+ explicit ComCtlScrollBarModel( sal_uInt16 nVersion );
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+
+protected:
+ virtual void importControlData( BinaryInputStream& rInStrm );
+
+private:
+ sal_uInt32 mnScrollBarFlags; ///< Special flags for scroll bar model.
+ sal_Int32 mnLargeChange; ///< Increment step size (thumb).
+ sal_Int32 mnSmallChange; ///< Increment step size (buttons).
+ sal_Int32 mnMin; ///< Minimum of the value range.
+ sal_Int32 mnMax; ///< Maximum of the value range.
+ sal_Int32 mnPosition; ///< Value of the spin button.
+};
+
+// ============================================================================
+
+/** Model for a ComCtl progress bar. */
+class ComCtlProgressBarModel : public ComCtlModelBase
+{
+public:
+ explicit ComCtlProgressBarModel( sal_uInt16 nVersion );
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+
+protected:
+ virtual void importControlData( BinaryInputStream& rInStrm );
+
+private:
+ float mfMin; ///< Minimum of the value range.
+ float mfMax; ///< Maximum of the value range.
+ sal_uInt16 mnVertical; ///< 0 = horizontal, 1 = vertical.
+ sal_uInt16 mnSmooth; ///< 0 = progress blocks, 1 = pixel resolution.
+};
+
+// ============================================================================
+
+/** Base class for all models of Form 2.0 form controls. */
+class OOX_DLLPUBLIC AxControlModelBase : public ControlModelBase
+{
+public:
+ explicit AxControlModelBase();
+
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue );
+};
+
+// ============================================================================
+
+/** Base class for Forms 2.0 controls supporting text formatting. */
+class OOX_DLLPUBLIC AxFontDataModel : public AxControlModelBase
+{
+public:
+ explicit AxFontDataModel( bool bSupportsAlign = true );
+
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue );
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm );
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+
+ /** Returns the font height in points. */
+ inline sal_Int16 getFontHeight() const { return maFontData.getHeightPoints(); }
+
+public: // direct access needed for legacy VML drawing controls
+ AxFontData maFontData; ///< The font settings.
+
+private:
+ bool mbSupportsAlign; ///< True = UNO model supports Align property.
+};
+
+// ============================================================================
+
+/** Model for a Forms 2.0 command button. */
+class OOX_DLLPUBLIC AxCommandButtonModel : public AxFontDataModel
+{
+public:
+ explicit AxCommandButtonModel();
+
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue );
+ virtual void importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm );
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+
+public: // direct access needed for legacy VML drawing controls
+ StreamDataSequence maPictureData; ///< Binary picture stream.
+ OUString maCaption; ///< Visible caption of the button.
+ sal_uInt32 mnTextColor; ///< Text color.
+ sal_uInt32 mnBackColor; ///< Fill color.
+ sal_uInt32 mnFlags; ///< Various flags.
+ sal_uInt32 mnPicturePos; ///< Position of the picture relative to text.
+ sal_Int32 mnVerticalAlign; ///< Vertical alignment (legacy VML drawing controls only).
+ bool mbFocusOnClick; ///< True = take focus on click.
+};
+
+// ============================================================================
+
+/** Model for a Forms 2.0 label. */
+class OOX_DLLPUBLIC AxLabelModel : public AxFontDataModel
+{
+public:
+ explicit AxLabelModel();
+
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue );
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+
+public: // direct access needed for legacy VML drawing controls
+ OUString maCaption; ///< Visible caption of the button.
+ sal_uInt32 mnTextColor; ///< Text color.
+ sal_uInt32 mnBackColor; ///< Fill color.
+ sal_uInt32 mnFlags; ///< Various flags.
+ sal_uInt32 mnBorderColor; ///< Flat border color.
+ sal_Int32 mnBorderStyle; ///< Flat border style.
+ sal_Int32 mnSpecialEffect; ///< 3D border effect.
+ sal_Int32 mnVerticalAlign; ///< Vertical alignment (legacy VML drawing controls only).
+};
+
+// ============================================================================
+
+/** Model for a Forms 2.0 image. */
+class OOX_DLLPUBLIC AxImageModel : public AxControlModelBase
+{
+public:
+ explicit AxImageModel();
+
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue );
+ virtual void importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm );
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+
+private:
+ StreamDataSequence maPictureData; ///< Binary picture stream.
+ sal_uInt32 mnBackColor; ///< Fill color.
+ sal_uInt32 mnFlags; ///< Various flags.
+ sal_uInt32 mnBorderColor; ///< Flat border color.
+ sal_Int32 mnBorderStyle; ///< Flat border style.
+ sal_Int32 mnSpecialEffect; ///< 3D border effect.
+ sal_Int32 mnPicSizeMode; ///< Clip, stretch, zoom.
+ sal_Int32 mnPicAlign; ///< Anchor position of the picture.
+ bool mbPicTiling; ///< True = picture is repeated.
+};
+
+class OOX_DLLPUBLIC AxTabStripModel : public AxFontDataModel
+{
+public:
+ explicit AxTabStripModel();
+
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+
+ virtual ApiControlType getControlType() const;
+
+public:
+ sal_uInt32 mnListIndex;
+ sal_uInt32 mnTabStyle;
+ sal_uInt32 mnTabData;
+ sal_uInt32 mnVariousPropertyBits;
+ std::vector< ::rtl::OUString > maItems; // captions for each tab
+ std::vector< ::rtl::OUString > maTabNames; // names for each tab
+};
+
+// ============================================================================
+
+/** Base class for a Forms 2.0 morph data control. */
+class OOX_DLLPUBLIC AxMorphDataModelBase : public AxFontDataModel
+{
+public:
+ explicit AxMorphDataModelBase();
+
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue );
+ virtual void importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm );
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm );
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+
+public: // direct access needed for legacy VML drawing controls
+ StreamDataSequence maPictureData; ///< Binary picture stream.
+ OUString maCaption; ///< Visible caption of the button.
+ OUString maValue; ///< Current value of the control.
+ OUString maGroupName; ///< Group name for option buttons.
+ sal_uInt32 mnTextColor; ///< Text color.
+ sal_uInt32 mnBackColor; ///< Fill color.
+ sal_uInt32 mnFlags; ///< Various flags.
+ sal_uInt32 mnPicturePos; ///< Position of the picture relative to text.
+ sal_uInt32 mnBorderColor; ///< Flat border color.
+ sal_Int32 mnBorderStyle; ///< Flat border style.
+ sal_Int32 mnSpecialEffect; ///< 3D border effect.
+ sal_Int32 mnDisplayStyle; ///< Type of the morph control.
+ sal_Int32 mnMultiSelect; ///< Selection mode.
+ sal_Int32 mnScrollBars; ///< Horizontal/vertical scroll bar.
+ sal_Int32 mnMatchEntry; ///< Auto completion mode.
+ sal_Int32 mnShowDropButton; ///< When to show the dropdown button.
+ sal_Int32 mnMaxLength; ///< Maximum character count.
+ sal_Int32 mnPasswordChar; ///< Password character in edit fields.
+ sal_Int32 mnListRows; ///< Number of rows in dropdown box.
+ sal_Int32 mnVerticalAlign; ///< Vertical alignment (legacy VML drawing controls only).
+};
+
+// ============================================================================
+
+/** Model for a Forms 2.0 toggle button. */
+class OOX_DLLPUBLIC AxToggleButtonModel : public AxMorphDataModelBase
+{
+public:
+ explicit AxToggleButtonModel();
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
+};
+
+// ============================================================================
+
+/** Model for a Forms 2.0 check box. */
+class OOX_DLLPUBLIC AxCheckBoxModel : public AxMorphDataModelBase
+{
+public:
+ explicit AxCheckBoxModel();
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
+};
+
+// ============================================================================
+
+/** Model for a Forms 2.0 option button. */
+class OOX_DLLPUBLIC AxOptionButtonModel : public AxMorphDataModelBase
+{
+public:
+ explicit AxOptionButtonModel();
+
+ /** Returns the group name used to goup several option buttons gogether. */
+ inline const OUString& getGroupName() const { return maGroupName; }
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
+};
+
+// ============================================================================
+
+/** Model for a Forms 2.0 text box. */
+class OOX_DLLPUBLIC AxTextBoxModel : public AxMorphDataModelBase
+{
+public:
+ explicit AxTextBoxModel();
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
+};
+
+// ============================================================================
+
+/** Model for a numeric field (legacy drawing controls only). */
+class OOX_DLLPUBLIC AxNumericFieldModel : public AxMorphDataModelBase
+{
+public:
+ explicit AxNumericFieldModel();
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
+};
+
+// ============================================================================
+
+/** Model for a Forms 2.0 list box. */
+class OOX_DLLPUBLIC AxListBoxModel : public AxMorphDataModelBase
+{
+public:
+ explicit AxListBoxModel();
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
+};
+
+// ============================================================================
+
+/** Model for a Forms 2.0 combo box. */
+class OOX_DLLPUBLIC AxComboBoxModel : public AxMorphDataModelBase
+{
+public:
+ explicit AxComboBoxModel();
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
+};
+
+// ============================================================================
+
+/** Model for a Forms 2.0 spin button. */
+class OOX_DLLPUBLIC AxSpinButtonModel : public AxControlModelBase
+{
+public:
+ explicit AxSpinButtonModel();
+
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue );
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm );
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
+
+public: // direct access needed for legacy VML drawing controls
+ sal_uInt32 mnArrowColor; ///< Button arrow color.
+ sal_uInt32 mnBackColor; ///< Fill color.
+ sal_uInt32 mnFlags; ///< Various flags.
+ sal_Int32 mnOrientation; ///< Orientation of the buttons.
+ sal_Int32 mnMin; ///< Minimum of the value range.
+ sal_Int32 mnMax; ///< Maximum of the value range.
+ sal_Int32 mnPosition; ///< Value of the spin button.
+ sal_Int32 mnSmallChange; ///< Increment step size.
+ sal_Int32 mnDelay; ///< Repeat delay in milliseconds.
+};
+
+// ============================================================================
+
+/** Model for a Forms 2.0 scroll bar. */
+class OOX_DLLPUBLIC AxScrollBarModel : public AxControlModelBase
+{
+public:
+ explicit AxScrollBarModel();
+
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue );
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+
+public: // direct access needed for legacy VML drawing controls
+ sal_uInt32 mnArrowColor; ///< Button arrow color.
+ sal_uInt32 mnBackColor; ///< Fill color.
+ sal_uInt32 mnFlags; ///< Various flags.
+ sal_Int32 mnOrientation; ///< Orientation of the buttons.
+ sal_Int32 mnPropThumb; ///< Proportional thumb size.
+ sal_Int32 mnMin; ///< Minimum of the value range.
+ sal_Int32 mnMax; ///< Maximum of the value range.
+ sal_Int32 mnPosition; ///< Value of the spin button.
+ sal_Int32 mnSmallChange; ///< Increment step size (buttons).
+ sal_Int32 mnLargeChange; ///< Increment step size (thumb).
+ sal_Int32 mnDelay; ///< Repeat delay in milliseconds.
+};
+
+// ============================================================================
+
+typedef ::std::vector< OUString > AxClassTable;
+
+/** Base class for ActiveX container controls. */
+class OOX_DLLPUBLIC AxContainerModelBase : public AxFontDataModel
+{
+public:
+ explicit AxContainerModelBase( bool bFontSupport = false );
+
+ /** Allows to set single properties specified by XML token identifier. */
+ virtual void importProperty( sal_Int32 nPropId, const OUString& rValue );
+ /** Reads the leading structure in the 'f' stream containing the model for
+ this control. */
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+ /** Converts font settings if supported. */
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+
+ /** Reads the class table structure for embedded controls following the own
+ model from the 'f' stream. */
+ bool importClassTable( BinaryInputStream& rInStrm, AxClassTable& orClassTable );
+
+public: // direct access needed for legacy VML drawing controls
+ StreamDataSequence maPictureData; ///< Binary picture stream.
+ OUString maCaption; ///< Visible caption of the form.
+ AxPairData maLogicalSize; ///< Logical form size (scroll area).
+ AxPairData maScrollPos; ///< Scroll position.
+ sal_uInt32 mnBackColor; ///< Fill color.
+ sal_uInt32 mnTextColor; ///< Text color.
+ sal_uInt32 mnFlags; ///< Various flags.
+ sal_uInt32 mnBorderColor; ///< Flat border color.
+ sal_Int32 mnBorderStyle; ///< Flat border style.
+ sal_Int32 mnScrollBars; ///< Horizontal/vertical scroll bar.
+ sal_Int32 mnCycleType; ///< Cycle in all forms or in this form.
+ sal_Int32 mnSpecialEffect; ///< 3D border effect.
+ sal_Int32 mnPicAlign; ///< Anchor position of the picture.
+ sal_Int32 mnPicSizeMode; ///< Clip, stretch, zoom.
+ bool mbPicTiling; ///< True = picture is repeated.
+ bool mbFontSupport; ///< True = control supports the font property.
+};
+
+typedef ::boost::shared_ptr< AxContainerModelBase > AxContainerModelRef;
+
+// ============================================================================
+
+/** Model for a Forms 2.0 frame control. */
+class OOX_DLLPUBLIC AxFrameModel : public AxContainerModelBase
+{
+public:
+ explicit AxFrameModel();
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+};
+
+class OOX_DLLPUBLIC AxPageModel : public AxContainerModelBase
+{
+public:
+ explicit AxPageModel();
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+};
+
+class OOX_DLLPUBLIC AxMultiPageModel : public AxContainerModelBase
+{
+public:
+ explicit AxMultiPageModel();
+
+ virtual ApiControlType getControlType() const;
+ virtual bool importPageAndMultiPageProperties( BinaryInputStream& rInStrm, sal_Int32 nPages );
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ std::vector<sal_uInt32> mnIDs;
+ sal_uInt32 mnActiveTab;
+ sal_uInt32 mnTabStyle;
+};
+
+// ============================================================================
+
+
+/** Model for a Forms 2.0 user form. */
+class OOX_DLLPUBLIC AxUserFormModel : public AxContainerModelBase
+{
+public:
+ explicit AxUserFormModel();
+
+ virtual ApiControlType getControlType() const;
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+};
+
+class HtmlSelectModel : public AxListBoxModel
+{
+ com::sun::star::uno::Sequence< OUString > msListData;
+ com::sun::star::uno::Sequence< sal_Int16 > msIndices;
+public:
+ HtmlSelectModel();
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+ virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+};
+
+class HtmlTextBoxModel : public AxTextBoxModel
+{
+public:
+ explicit HtmlTextBoxModel();
+ virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+};
+// ============================================================================
+
+/** A form control embedded in a document draw page. Contains a specific model
+ structure according to the type of the control. */
+class OOX_DLLPUBLIC EmbeddedControl
+{
+public:
+ explicit EmbeddedControl( const OUString& rName );
+ virtual ~EmbeddedControl();
+
+ /** Creates and returns the internal control model of the specified type. */
+ template< typename ModelType >
+ inline ModelType& createModel();
+
+ /** Creates and returns the internal control model of the specified type. */
+ template< typename ModelType, typename ParamType >
+ inline ModelType& createModel( const ParamType& rParam );
+
+ /** Creates and returns the internal control model according to the passed
+ MS class identifier. */
+ ControlModelBase* createModelFromGuid( const OUString& rClassId );
+
+ /** Returns true, if the internal control model exists. */
+ inline bool hasModel() const { return mxModel.get() != 0; }
+ /** Returns read-only access to the internal control model. */
+ inline const ControlModelBase* getModel() const { return mxModel.get(); }
+ /** Returns read/write access to the internal control model. */
+ inline ControlModelBase* getModel() { return mxModel.get(); }
+
+ /** Returns the UNO service name needed to construct the control model. */
+ OUString getServiceName() const;
+
+ /** Converts all control properties and inserts them into the passed model. */
+ bool convertProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxCtrlModel,
+ const ControlConverter& rConv ) const;
+
+ bool convertFromProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxCtrlModel,
+ const ControlConverter& rConv );
+
+private:
+ ControlModelRef mxModel; ///< Control model containing the properties.
+ OUString maName; ///< Name of the control.
+};
+
+// ----------------------------------------------------------------------------
+
+template< typename ModelType >
+inline ModelType& EmbeddedControl::createModel()
+{
+ ::boost::shared_ptr< ModelType > xModel( new ModelType );
+ mxModel = xModel;
+ xModel->setFormComponentMode();
+ return *xModel;
+}
+
+template< typename ModelType, typename ParamType >
+inline ModelType& EmbeddedControl::createModel( const ParamType& rParam )
+{
+ ::boost::shared_ptr< ModelType > xModel( new ModelType( rParam ) );
+ mxModel = xModel;
+ xModel->setFormComponentMode();
+ return *xModel;
+}
+
+// ============================================================================
+
+/** A wrapper for a control form embedded directly in a draw page. */
+class EmbeddedForm
+{
+public:
+ explicit EmbeddedForm(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxDocModel,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& rxDrawPage,
+ const GraphicHelper& rGraphicHelper,
+ bool bDefaultColorBgr = true );
+
+ /** Converts the passed control and inserts the control model into the form.
+ @return The API control model, if conversion was successful. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >
+ convertAndInsert( const EmbeddedControl& rControl, sal_Int32& rnCtrlIndex );
+
+ /** Returns the XIndexContainer interface of the UNO control form, if existing. */
+ inline ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >
+ getXForm() const { return mxFormIC; }
+
+private:
+ /** Creates the form that will hold the form controls. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >
+ createXForm();
+
+private:
+ ControlConverter maControlConv;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxModelFactory;
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormsSupplier > mxFormsSupp;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > mxFormIC;
+};
+
+// ============================================================================
+
+} // namespace ole
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/axcontrolfragment.hxx b/include/oox/ole/axcontrolfragment.hxx
new file mode 100644
index 000000000000..653f23c30479
--- /dev/null
+++ b/include/oox/ole/axcontrolfragment.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_OLE_AXCONTROLFRAGMENT_HXX
+#define OOX_OLE_AXCONTROLFRAGMENT_HXX
+
+#include "oox/core/fragmenthandler2.hxx"
+
+namespace oox {
+namespace ole {
+
+class ControlModelBase;
+class EmbeddedControl;
+
+// ============================================================================
+
+/** Context handler for ActiveX form control model properties. */
+class AxControlPropertyContext : public ::oox::core::ContextHandler2
+{
+public:
+ explicit AxControlPropertyContext(
+ ::oox::core::FragmentHandler2& rFragment,
+ ControlModelBase& rModel );
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+
+private:
+ ControlModelBase& mrModel;
+ sal_Int32 mnPropId; ///< Identifier of currently processed property.
+};
+
+// ============================================================================
+
+/** Fragment handler for an embedded ActiveX form control fragment. */
+class AxControlFragment : public ::oox::core::FragmentHandler2
+{
+public:
+ explicit AxControlFragment(
+ ::oox::core::XmlFilterBase& rFilter,
+ const OUString& rFragmentPath,
+ EmbeddedControl& rControl );
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+
+private:
+ EmbeddedControl& mrControl;
+};
+
+// ============================================================================
+
+} // namespace ole
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/axfontdata.hxx b/include/oox/ole/axfontdata.hxx
new file mode 100644
index 000000000000..9dbec1786261
--- /dev/null
+++ b/include/oox/ole/axfontdata.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_OLE_AXFONTDATA_HXX
+#define OOX_OLE_AXFONTDATA_HXX
+
+#include "oox/helper/binaryinputstream.hxx"
+#include "oox/helper/binaryoutputstream.hxx"
+#include "oox/helper/refvector.hxx"
+#include "oox/dllapi.h"
+
+namespace oox {
+namespace ole {
+
+// ============================================================================
+
+const sal_Char* const AX_GUID_CFONT = "{AFC20920-DA4E-11CE-B943-00AA006887B4}";
+
+const sal_uInt32 AX_FONTDATA_BOLD = 0x00000001;
+const sal_uInt32 AX_FONTDATA_ITALIC = 0x00000002;
+const sal_uInt32 AX_FONTDATA_UNDERLINE = 0x00000004;
+const sal_uInt32 AX_FONTDATA_STRIKEOUT = 0x00000008;
+const sal_uInt32 AX_FONTDATA_DISABLED = 0x00002000;
+const sal_uInt32 AX_FONTDATA_AUTOCOLOR = 0x40000000;
+
+const sal_Int32 AX_FONTDATA_LEFT = 1;
+const sal_Int32 AX_FONTDATA_RIGHT = 2;
+const sal_Int32 AX_FONTDATA_CENTER = 3;
+
+/** All entries of a font property. */
+struct OOX_DLLPUBLIC AxFontData
+{
+ OUString maFontName; ///< Name of the used font.
+ sal_uInt32 mnFontEffects; ///< Font effect flags.
+ sal_Int32 mnFontHeight; ///< Height of the font (not really twips, see code).
+ sal_Int32 mnFontCharSet; ///< Windows character set of the font.
+ sal_Int32 mnHorAlign; ///< Horizontal text alignment.
+ bool mbDblUnderline; ///< True = double underline style (legacy VML drawing controls only).
+
+ explicit AxFontData();
+
+ /** Converts the internal representation of the font height to points. */
+ sal_Int16 getHeightPoints() const;
+ /** Converts the passed font height from points to the internal representation. */
+ void setHeightPoints( sal_Int16 nPoints );
+
+ /** Reads the font data settings from the passed input stream. */
+ bool importBinaryModel( BinaryInputStream& rInStrm );
+
+ void exportBinaryModel( BinaryOutputStream& rOutStrm );
+ /** Reads the font data settings from the passed input stream that contains
+ an OLE StdFont structure. */
+ bool importStdFont( BinaryInputStream& rInStrm );
+ /** Reads the font data settings from the passed input stream depending on
+ the GUID preceding the actual font data. */
+ bool importGuidAndFont( BinaryInputStream& rInStrm );
+};
+
+
+} // namespace ole
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/olehelper.hxx b/include/oox/ole/olehelper.hxx
new file mode 100644
index 000000000000..e75a0cd07588
--- /dev/null
+++ b/include/oox/ole/olehelper.hxx
@@ -0,0 +1,203 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_OLE_OLEHELPER_HXX
+#define OOX_OLE_OLEHELPER_HXX
+
+#include <rtl/ustring.hxx>
+#include "oox/helper/binarystreambase.hxx"
+#include "oox/helper/storagebase.hxx"
+#include "oox/helper/graphichelper.hxx"
+#include "com/sun/star/form/XFormComponent.hpp"
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "com/sun/star/lang/XMultiServiceFactory.hpp"
+#include "com/sun/star/frame/XModel.hpp"
+#include "com/sun/star/frame/XFrame.hpp"
+#include "com/sun/star/drawing/XShapes.hpp"
+#include "com/sun/star/awt/XControlModel.hpp"
+#include "com/sun/star/io/XInputStream.hpp"
+#include "com/sun/star/io/XOutputStream.hpp"
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include "com/sun/star/container/XIndexContainer.hpp"
+#include <filter/msfilter/msocximex.hxx>
+#include "oox/dllapi.h"
+#include "sot/storage.hxx"
+
+namespace oox {
+ class BinaryInputStream;
+ class BinaryOutputStream;
+ class BinaryXInputStream;
+ class GraphicHelper;
+}
+
+namespace oox {
+
+typedef ::boost::shared_ptr< oox::BinaryXInputStream > BinaryXInputStreamRef;
+
+namespace ole {
+
+
+// ============================================================================
+
+#define OLE_GUID_STDFONT "{0BE35203-8F91-11CE-9DE3-00AA004BB851}"
+#define OLE_GUID_STDPIC "{0BE35204-8F91-11CE-9DE3-00AA004BB851}"
+#define OLE_GUID_STDHLINK "{79EAC9D0-BAF9-11CE-8C82-00AA004BA90B}"
+
+// ============================================================================
+
+const sal_uInt16 OLE_STDFONT_NORMAL = 400;
+const sal_uInt16 OLE_STDFONT_BOLD = 700;
+
+const sal_uInt8 OLE_STDFONT_ITALIC = 0x02;
+const sal_uInt8 OLE_STDFONT_UNDERLINE = 0x04;
+const sal_uInt8 OLE_STDFONT_STRIKE = 0x08;
+
+/** Stores data about a StdFont font structure. */
+struct StdFontInfo
+{
+ OUString maName; ///< Font name.
+ sal_uInt32 mnHeight; ///< Font height (1/10,000 points).
+ sal_uInt16 mnWeight; ///< Font weight (normal/bold).
+ sal_uInt16 mnCharSet; ///< Font charset.
+ sal_uInt8 mnFlags; ///< Font flags.
+
+ explicit StdFontInfo();
+ explicit StdFontInfo(
+ const OUString& rName,
+ sal_uInt32 nHeight,
+ sal_uInt16 nWeight = OLE_STDFONT_NORMAL,
+ sal_uInt16 nCharSet = WINDOWS_CHARSET_ANSI,
+ sal_uInt8 nFlags = 0 );
+};
+
+// ============================================================================
+
+/** Stores data about a StdHlink hyperlink. */
+struct StdHlinkInfo
+{
+ OUString maTarget;
+ OUString maLocation;
+ OUString maDisplay;
+ OUString maFrame;
+};
+
+// ============================================================================
+
+/** Static helper functions for OLE import/export. */
+class OOX_DLLPUBLIC OleHelper
+{
+public:
+ /** Returns the UNO RGB color from the passed encoded OLE color.
+
+ @param bDefaultColorBgr
+ True = OLE default color type is treated as BGR color.
+ False = OLE default color type is treated as palette color.
+ */
+ static sal_Int32 decodeOleColor(
+ const GraphicHelper& rGraphicHelper,
+ sal_uInt32 nOleColor,
+ bool bDefaultColorBgr = true );
+
+ /** Returns the OLE color from the passed UNO RGB color.
+ */
+ static sal_uInt32 encodeOleColor( sal_Int32 nRgbColor );
+
+ /** Imports a GUID from the passed binary stream and returns its string
+ representation (in uppercase characters).
+ */
+ static OUString importGuid( BinaryInputStream& rInStrm );
+
+ /** Imports an OLE StdFont font structure from the current position of the
+ passed binary stream.
+ */
+ static bool importStdFont(
+ StdFontInfo& orFontInfo,
+ BinaryInputStream& rInStrm,
+ bool bWithGuid );
+
+ /** Imports an OLE StdPic picture from the current position of the passed
+ binary stream.
+ */
+ static bool importStdPic(
+ StreamDataSequence& orGraphicData,
+ BinaryInputStream& rInStrm,
+ bool bWithGuid );
+
+private:
+ OleHelper(); // not implemented
+ ~OleHelper(); // not implemented
+};
+
+// ideally it would be great to get rid of SvxMSConvertOCXControls
+// however msfilter/source/msfilter/svdfppt.cxx still uses
+// SvxMSConvertOCXControls as a base class, unfortunately oox depends on
+// msfilter. Probably the solution would be to move the svdfppt.cxx
+// implementation into the sd module itself.
+class OOX_DLLPUBLIC MSConvertOCXControls : public SvxMSConvertOCXControls
+{
+#ifdef SvxMSConvertOCXControlsRemoved
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > mxShapes;
+ com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > mxDrawPage;
+ com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer > mxFormComps;
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxServiceFactory;
+#endif
+protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxCtx;
+ ::oox::GraphicHelper maGrfHelper;
+
+ bool importControlFromStream( ::oox::BinaryInputStream& rInStrm,
+ ::com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rxFormComp,
+ const OUString& rGuidString );
+ bool importControlFromStream( ::oox::BinaryInputStream& rInStrm,
+ ::com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rxFormComp,
+ const OUString& rGuidString,
+ sal_Int32 nSize );
+public:
+ MSConvertOCXControls( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel );
+ ~MSConvertOCXControls();
+ sal_Bool ReadOCXStorage( SotStorageRef& rSrc1, ::com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rxFormComp );
+ sal_Bool ReadOCXCtlsStream(SotStorageStreamRef& rSrc1, ::com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rxFormComp,
+ sal_Int32 nPos, sal_Int32 nSize );
+ static sal_Bool WriteOCXStream( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel, SotStorageRef &rSrc1, const com::sun::star::uno::Reference< com::sun::star::awt::XControlModel > &rControlModel, const com::sun::star::awt::Size& rSize,OUString &rName);
+
+#ifdef SvxMSConvertOCXControlsRemoved
+ const com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > & GetShapes();
+ const com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer > & GetFormComps();
+ virtual const com::sun::star::uno::Reference<
+ com::sun::star::drawing::XDrawPage > & GetDrawPage();
+ const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & GetServiceFactory();
+ virtual sal_Bool InsertControl(
+ const com::sun::star::uno::Reference<
+ com::sun::star::form::XFormComponent >& /*rFComp*/,
+ const com::sun::star::awt::Size& /*rSize*/,
+ com::sun::star::uno::Reference<
+ com::sun::star::drawing::XShape >* /*pShape*/,
+ sal_Bool /*bFloatingCtrl*/ ) {return sal_False;}
+#endif
+};
+
+
+// ============================================================================
+
+} // namespace ole
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/oleobjecthelper.hxx b/include/oox/ole/oleobjecthelper.hxx
new file mode 100644
index 000000000000..9d97a8d95f71
--- /dev/null
+++ b/include/oox/ole/oleobjecthelper.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_OLE_OLEOBJECTHELPER_HXX
+#define OOX_OLE_OLEOBJECTHELPER_HXX
+
+#include "oox/helper/binarystreambase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace awt { struct Size; }
+ namespace document { class XEmbeddedObjectResolver; }
+ namespace lang { class XMultiServiceFactory; }
+} } }
+
+namespace oox { class PropertyMap; }
+
+namespace oox {
+namespace ole {
+
+// ============================================================================
+
+/** Contains generic information about an OLE object. */
+struct OleObjectInfo
+{
+ StreamDataSequence maEmbeddedData; ///< Data of an embedded OLE object.
+ OUString maTargetLink; ///< Path to external data for linked OLE object.
+ OUString maProgId;
+ bool mbLinked; ///< True = linked OLE object, false = embedded OLE object.
+ bool mbShowAsIcon; ///< True = show as icon, false = show contents.
+ bool mbAutoUpdate;
+
+ explicit OleObjectInfo();
+};
+
+// ============================================================================
+
+/** Helper for OLE object handling. */
+class OleObjectHelper
+{
+public:
+ explicit OleObjectHelper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxModelFactory );
+ ~OleObjectHelper();
+
+ bool importOleObject(
+ PropertyMap& rPropMap,
+ const OleObjectInfo& rOleObject,
+ const ::com::sun::star::awt::Size& rObjSize );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::document::XEmbeddedObjectResolver > mxResolver;
+ const OUString maEmbeddedObjScheme;
+ sal_Int32 mnObjectId;
+};
+
+// ============================================================================
+
+} // namespace ole
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/olestorage.hxx b/include/oox/ole/olestorage.hxx
new file mode 100644
index 000000000000..1b48eab8213d
--- /dev/null
+++ b/include/oox/ole/olestorage.hxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_OLE_OLESTORAGE_HXX
+#define OOX_OLE_OLESTORAGE_HXX
+
+#include "oox/helper/storagebase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace container { class XNameContainer; }
+ namespace uno { class XComponentContext; }
+} } }
+
+namespace oox {
+namespace ole {
+
+// ============================================================================
+
+/** Implements stream access for binary OLE storages. */
+class OOX_DLLPUBLIC OleStorage : public StorageBase
+{
+public:
+ explicit OleStorage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream,
+ bool bBaseStreamAccess );
+
+ explicit OleStorage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxOutStream,
+ bool bBaseStreamAccess );
+
+ virtual ~OleStorage();
+
+private:
+ explicit OleStorage(
+ const OleStorage& rParentStorage,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxStorage,
+ const OUString& rElementName,
+ bool bReadOnly );
+ explicit OleStorage(
+ const OleStorage& rParentStorage,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxOutStream,
+ const OUString& rElementName );
+
+ /** Initializes the API storage object for input. */
+ void initStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream );
+ /** Initializes the API storage object for input/output. */
+ void initStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxOutStream );
+
+ /** Returns true, if the object represents a valid storage. */
+ virtual bool implIsStorage() const;
+
+ /** Returns the com.sun.star.embed.XStorage interface of the current storage.
+
+ @attention
+ This function is not implemented for binary OLE storages.
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
+ implGetXStorage() const;
+
+ /** Returns the names of all elements of this storage. */
+ virtual void implGetElementNames( ::std::vector< OUString >& orElementNames ) const;
+
+ /** Opens and returns the specified sub storage from the storage. */
+ virtual StorageRef implOpenSubStorage( const OUString& rElementName, bool bCreateMissing );
+
+ /** Opens and returns the specified input stream from the storage. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ implOpenInputStream( const OUString& rElementName );
+
+ /** Opens and returns the specified output stream from the storage. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
+ implOpenOutputStream( const OUString& rElementName );
+
+ /** Commits the current storage. */
+ virtual void implCommit() const;
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ mxContext; ///< Component context with service manager.
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
+ mxStorage; ///< Access to elements of this sub storage.
+ const OleStorage* mpParentStorage; ///< Parent OLE storage that contains this storage.
+};
+
+// ============================================================================
+
+} // namespace ole
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/vbacontrol.hxx b/include/oox/ole/vbacontrol.hxx
new file mode 100644
index 000000000000..0de80153baed
--- /dev/null
+++ b/include/oox/ole/vbacontrol.hxx
@@ -0,0 +1,205 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_OLE_VBACONTROL_HXX
+#define OOX_OLE_VBACONTROL_HXX
+
+#include "oox/ole/axcontrol.hxx"
+#include <com/sun/star/frame/XModel.hpp>
+
+namespace com { namespace sun { namespace star {
+ namespace container { class XNameContainer; }
+ namespace uno { class XComponentContext; }
+} } }
+
+namespace oox { class StorageBase; }
+
+namespace oox {
+namespace ole {
+
+// ============================================================================
+
+/** Common properties for all controls that are part of a VBA user form or of
+ another container control in a VBA user form. */
+class VbaSiteModel
+{
+public:
+ explicit VbaSiteModel();
+ virtual ~VbaSiteModel();
+
+ /** Allows to set single properties specified by XML token identifier. */
+ void importProperty( sal_Int32 nPropId, const OUString& rValue );
+ /** Imports the site model data from the passed input stream. */
+ bool importBinaryModel( BinaryInputStream& rInStrm );
+ /** Moves the control relative to its current position by the passed distance. */
+ void moveRelative( const AxPairData& rDistance );
+
+ /** Returns the programmatical name of the control. */
+ inline const OUString& getName() const { return maName; }
+ /** Returns the position of the control in its parent. */
+ inline const AxPairData& getPosition() const { return maPos; }
+ /** Returns the unique identifier of this control. */
+ inline sal_Int32 getId() const { return mnId; }
+ /** Returns true, if this control is a container control. */
+ bool isContainer() const;
+ /** Returns the length of the stream data for stream based controls. */
+ sal_uInt32 getStreamLength() const;
+ /** Returns the name of the substorage for the container control data. */
+ OUString getSubStorageName() const;
+ /** Returns the tab index of the control. */
+ inline sal_Int16 getTabIndex() const { return mnTabIndex; }
+
+ /** Tries to create the control model according to the site model. */
+ ControlModelRef createControlModel( const AxClassTable& rClassTable ) const;
+ /** Converts all form site properties. */
+ void convertProperties(
+ PropertyMap& rPropMap,
+ const ControlConverter& rConv,
+ ApiControlType eCtrlType,
+ sal_Int32 nCtrlIndex ) const;
+
+protected:
+ OUString maName; ///< Name of the control.
+ OUString maTag; ///< User defined tag.
+ OUString maToolTip; ///< Tool tip for the control.
+ OUString maControlSource; ///< Linked cell for the control value in a spreadsheet.
+ OUString maRowSource; ///< Source data for the control in a spreadsheet.
+
+ AxPairData maPos; ///< Position in parent container.
+ sal_Int32 mnId; ///< Control identifier.
+ sal_Int32 mnHelpContextId; ///< Help context identifier.
+ sal_uInt32 mnFlags; ///< Various flags.
+ sal_uInt32 mnStreamLen; ///< Size of control stream data.
+ sal_Int16 mnTabIndex; ///< Tab order index.
+ sal_uInt16 mnClassIdOrCache; ///< Class name identifier or GUID cache index.
+ sal_uInt16 mnGroupId; ///< Group identifier for grouped controls.
+};
+
+typedef ::boost::shared_ptr< VbaSiteModel > VbaSiteModelRef;
+
+// ============================================================================
+
+/** A control that is embedded in a VBA user form or in another container
+ control in a VBA user form.
+
+ The control may be a 'simple' control with its data stored in the 'o'
+ stream, or it may be a container control with its data stored in an own
+ substorage.
+ */
+class VbaFormControl
+{
+public:
+ explicit VbaFormControl();
+ virtual ~VbaFormControl();
+
+ /** Imports the model from the passed stream or storage, depending on the
+ control's type. Imports all embedded controls, if this is a container. */
+ void importModelOrStorage(
+ BinaryInputStream& rInStrm,
+ StorageBase& rStrg,
+ const AxClassTable& rClassTable );
+
+ /** Returns the programmatical name of the control. */
+ OUString getControlName() const;
+
+ /** Creates the UNO control model, inserts it into the passed container,
+ and converts all control properties. */
+ void createAndConvert(
+ sal_Int32 nCtrlIndex,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxParentNC,
+ const ControlConverter& rConv ) const;
+
+protected:
+ /** Creates and imports the control model containing properties of the control. */
+ void importControlModel( BinaryInputStream& rInStrm, const AxClassTable& rClassTable );
+ /** Creates and imports the control model, and imports all embedded
+ controls from the passed substorage. */
+ void importStorage( StorageBase& rStrg, const AxClassTable& rClassTable );
+
+ /** Converts all control properties, and inserts and converts embedded controls. */
+ bool convertProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxCtrlModel,
+ const ControlConverter& rConv,
+ sal_Int32 nCtrlIndex ) const;
+
+private:
+ typedef RefVector< VbaFormControl > VbaFormControlVector;
+ typedef VbaFormControlVector::value_type VbaFormControlRef;
+
+ /** Creates the control model according to the current site model. */
+ void createControlModel( const AxClassTable& rClassTable );
+ /** Imports the site model data containing common properties of the control. */
+ bool importSiteModel( BinaryInputStream& rInStrm );
+
+ /** Imports the site models of all embedded controls from the 'f' stream. */
+ bool importEmbeddedSiteModels( BinaryInputStream& rInStrm );
+ /* Final processing of all embedded controls after import. */
+ void finalizeEmbeddedControls();
+
+ /** Moves the control relative to its current position by the passed distance. */
+ void moveRelative( const AxPairData& rDistance );
+ /** Moves all embedded controls from their relative position in this
+ control to an absolute position in the parent of this control. */
+ void moveEmbeddedToAbsoluteParent();
+
+ /** Functor for comparing controls by their tab index. */
+ static bool compareByTabIndex( const VbaFormControlRef& rxLeft, const VbaFormControlRef& rxRight );
+
+protected:
+ VbaSiteModelRef mxSiteModel; ///< Common control properties.
+ ControlModelRef mxCtrlModel; ///< Specific control properties.
+
+private:
+ VbaFormControlVector maControls; ///< All embedded form controls.
+ AxClassTable maClassTable; ///< Class identifiers for exotic embedded controls.
+};
+
+// ============================================================================
+
+class VbaUserForm : public VbaFormControl
+{
+public:
+ explicit VbaUserForm(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxDocModel,
+ const GraphicHelper& rGraphicHelper,
+ bool bDefaultColorBgr = true );
+
+ /** Imports the form and its embedded controls, and inserts the form with
+ all its controls into the passed dialog library. */
+ void importForm(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxDialogLib,
+ StorageBase& rVbaFormStrg,
+ const OUString& rModuleName,
+ rtl_TextEncoding eTextEnc );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxDocModel;
+ ControlConverter maConverter;
+};
+
+// ============================================================================
+
+} // namespace ole
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/vbahelper.hxx b/include/oox/ole/vbahelper.hxx
new file mode 100644
index 000000000000..a8faee21ff6e
--- /dev/null
+++ b/include/oox/ole/vbahelper.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_OLE_VBAHELPER_HXX
+#define OOX_OLE_VBAHELPER_HXX
+
+#include "oox/helper/binarystreambase.hxx"
+
+namespace oox { class BinaryInputStream; }
+
+namespace oox {
+namespace ole {
+
+// Directory stream record identifiers ========================================
+
+const sal_uInt16 VBA_ID_MODULECOOKIE = 0x002C;
+const sal_uInt16 VBA_ID_MODULEDOCSTRING = 0x001C;
+const sal_uInt16 VBA_ID_MODULEDOCSTRINGUNICODE = 0x0048;
+const sal_uInt16 VBA_ID_MODULEEND = 0x002B;
+const sal_uInt16 VBA_ID_MODULEHELPCONTEXT = 0x001E;
+const sal_uInt16 VBA_ID_MODULENAME = 0x0019;
+const sal_uInt16 VBA_ID_MODULENAMEUNICODE = 0x0047;
+const sal_uInt16 VBA_ID_MODULEOFFSET = 0x0031;
+const sal_uInt16 VBA_ID_MODULEPRIVATE = 0x0028;
+const sal_uInt16 VBA_ID_MODULEREADONLY = 0x0025;
+const sal_uInt16 VBA_ID_MODULESTREAMNAME = 0x001A;
+const sal_uInt16 VBA_ID_MODULESTREAMNAMEUNICODE = 0x0032;
+const sal_uInt16 VBA_ID_MODULETYPEDOCUMENT = 0x0022;
+const sal_uInt16 VBA_ID_MODULETYPEPROCEDURAL = 0x0021;
+const sal_uInt16 VBA_ID_PROJECTCODEPAGE = 0x0003;
+const sal_uInt16 VBA_ID_PROJECTEND = 0x0010;
+const sal_uInt16 VBA_ID_PROJECTMODULES = 0x000F;
+const sal_uInt16 VBA_ID_PROJECTNAME = 0x0004;
+const sal_uInt16 VBA_ID_PROJECTVERSION = 0x0009;
+
+// ============================================================================
+
+/** Static helper functions for the VBA filters. */
+class VbaHelper
+{
+public:
+ /** Reads the next record from the VBA directory stream 'dir'.
+
+ @param rnRecId (out parameter) The record identifier of the new record.
+ @param rRecData (out parameter) The contents of the new record.
+ @param rInStrm The 'dir' stream.
+
+ @return True = next record successfully read. False on any error, or
+ if the stream is EOF.
+ */
+ static bool readDirRecord(
+ sal_uInt16& rnRecId,
+ StreamDataSequence& rRecData,
+ BinaryInputStream& rInStrm );
+
+ /** Extracts a key/value pair from a string separated by an equality sign.
+
+ @param rKey (out parameter) The key before the separator.
+ @param rValue (out parameter) The value following the separator.
+ @param rCodeLine The source key/value pair.
+
+ @return True = Equality sign separator found, and the returned key and
+ value are not empty. False otherwise.
+ */
+ static bool extractKeyValue(
+ OUString& rKey,
+ OUString& rValue,
+ const OUString& rKeyValue );
+
+private:
+ VbaHelper();
+ ~VbaHelper();
+};
+
+// ============================================================================
+
+} // namespace ole
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/vbainputstream.hxx b/include/oox/ole/vbainputstream.hxx
new file mode 100644
index 000000000000..7e0cd4986bd7
--- /dev/null
+++ b/include/oox/ole/vbainputstream.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_OLE_VBAINPUTSTREAM_HXX
+#define OOX_OLE_VBAINPUTSTREAM_HXX
+
+#include <vector>
+#include "oox/helper/binaryinputstream.hxx"
+
+namespace oox {
+namespace ole {
+
+// ============================================================================
+
+/** A non-seekable input stream that implements run-length decompression. */
+class VbaInputStream : public BinaryInputStream
+{
+public:
+ explicit VbaInputStream( BinaryInputStream& rInStrm );
+
+ /** Returns -1, stream size is not determinable. */
+ virtual sal_Int64 size() const;
+ /** Returns -1, stream position is not tracked. */
+ virtual sal_Int64 tell() const;
+ /** Does nothing, stream is not seekable. */
+ virtual void seek( sal_Int64 nPos );
+ /** Closes the input stream but not the wrapped stream. */
+ virtual void close();
+
+ /** Reads nBytes bytes to the passed sequence.
+ @return Number of bytes really read. */
+ virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 );
+ /** Reads nBytes bytes to the (existing) buffer opMem.
+ @return Number of bytes really read. */
+ virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 );
+ /** Seeks the stream forward by the passed number of bytes. */
+ virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 );
+
+private:
+ /** If no data left in chunk buffer, reads the next chunk from stream. */
+ bool updateChunk();
+
+private:
+ typedef ::std::vector< sal_uInt8 > ChunkBuffer;
+
+ BinaryInputStream* mpInStrm;
+ ChunkBuffer maChunk;
+ size_t mnChunkPos;
+};
+
+// ============================================================================
+
+} // namespace ole
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/vbamodule.hxx b/include/oox/ole/vbamodule.hxx
new file mode 100644
index 000000000000..70dcd3913b9a
--- /dev/null
+++ b/include/oox/ole/vbamodule.hxx
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_OLE_VBAMODULE_HXX
+#define OOX_OLE_VBAMODULE_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <rtl/ustring.hxx>
+
+namespace com { namespace sun { namespace star {
+ namespace container { class XNameAccess; }
+ namespace container { class XNameContainer; }
+ namespace frame { class XModel; }
+ namespace uno { class XComponentContext; }
+} } }
+
+namespace oox {
+ class BinaryInputStream;
+ class StorageBase;
+}
+
+namespace oox {
+namespace ole {
+
+// ============================================================================
+
+class VbaModule
+{
+public:
+ explicit VbaModule(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxDocModel,
+ const OUString& rName,
+ rtl_TextEncoding eTextEnc,
+ bool bExecutable );
+
+ /** Returns the module type (com.sun.star.script.ModuleType constant). */
+ inline sal_Int32 getType() const { return mnType; }
+ /** Sets the passed module type. */
+ inline void setType( sal_Int32 nType ) { mnType = nType; }
+
+ /** Returns the name of the module. */
+ inline const OUString& getName() const { return maName; }
+ /** Returns the stream name of the module. */
+ inline const OUString& getStreamName() const { return maStreamName; }
+
+ /** Imports all records for this module until the MODULEEND record. */
+ void importDirRecords( BinaryInputStream& rDirStrm );
+
+ /** Imports the VBA source code into the passed Basic library. */
+ void createAndImportModule(
+ StorageBase& rVbaStrg,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxBasicLib,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& rxDocObjectNA ) const;
+ /** Creates an empty Basic module in the passed Basic library. */
+ void createEmptyModule(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxBasicLib,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& rxDocObjectNA ) const;
+
+private:
+ /** Reads and returns the VBA source code from the passed storage. */
+ OUString readSourceCode( StorageBase& rVbaStrg ) const;
+
+ /** Creates a new Basic module and inserts it into the passed Basic library. */
+ void createModule(
+ const OUString& rVBASourceCode,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxBasicLib,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& rxDocObjectNA ) const;
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ mxContext; ///< Component context with service manager.
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
+ mxDocModel; ///< Document model used to import/export the VBA project.
+ OUString maName;
+ OUString maStreamName;
+ OUString maDocString;
+ rtl_TextEncoding meTextEnc;
+ sal_Int32 mnType;
+ sal_uInt32 mnOffset;
+ bool mbReadOnly;
+ bool mbPrivate;
+ bool mbExecutable;
+};
+
+// ============================================================================
+
+} // namespace ole
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ole/vbaproject.hxx b/include/oox/ole/vbaproject.hxx
new file mode 100644
index 000000000000..f742138756b5
--- /dev/null
+++ b/include/oox/ole/vbaproject.hxx
@@ -0,0 +1,206 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_OLE_VBAPROJECT_HXX
+#define OOX_OLE_VBAPROJECT_HXX
+
+#include <map>
+#include <com/sun/star/uno/XInterface.hpp>
+#include "oox/helper/refvector.hxx"
+#include "oox/helper/storagebase.hxx"
+#include "oox/dllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace container { class XNameContainer; }
+ namespace document { class XEventsSupplier; }
+ namespace frame { class XModel; }
+ namespace script { class XLibraryContainer; }
+ namespace script { namespace vba { class XVBAMacroResolver; } }
+ namespace uno { class XComponentContext; }
+} } }
+
+namespace oox { class GraphicHelper; }
+
+namespace oox {
+namespace ole {
+
+// ============================================================================
+
+class OOX_DLLPUBLIC VbaFilterConfig
+{
+public:
+ explicit VbaFilterConfig(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const OUString& rConfigCompName );
+ ~VbaFilterConfig();
+
+ /** Returns true, if the VBA source code and forms should be imported. */
+ bool isImportVba() const;
+ /** Returns true, if the VBA source code should be imported executable. */
+ bool isImportVbaExecutable() const;
+ /** Returns true, if the VBA source code and forms should be exported. */
+ bool isExportVba() const;
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+ mxConfigAccess;
+};
+
+// ============================================================================
+
+/** Base class for objects that attach a amcro to a specific action.
+
+ Purpose is to collect objects that need to attach a VBA macro to an action.
+ The VBA project will be loaded at a very late point of the document import
+ process, because it depends on an initialized core document model (e.g.
+ spreadsheet codenames). Some objects that want to attach a VBA macro to an
+ action (e.g. mouse click action for drawing shapes) are loaded long before
+ the VBA project. The drawback is that in most cases macros are specified
+ without module name, or the VBA project name is part of the macro name.
+ In the former case, all code modules have to be scanned for the macro to be
+ able to create a valid script URL.
+
+ The import code will register these requests to attach a VBA macro with an
+ instance of a class derived from this base class. The derived class will
+ store all information needed to finally attach the macro to the action,
+ once the VBA project has been imported.
+ */
+class OOX_DLLPUBLIC VbaMacroAttacherBase
+{
+public:
+ explicit VbaMacroAttacherBase( const OUString& rMacroName );
+ virtual ~VbaMacroAttacherBase();
+
+ /** Resolves the internal macro name to the related macro URL, and attaches
+ the macro to the object. */
+ void resolveAndAttachMacro(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::script::vba::XVBAMacroResolver >& rxResolver );
+
+private:
+ /** Called after the VBA project has been imported. Derived classes will
+ attach the passed script to the object represented by this instance. */
+ virtual void attachMacro( const OUString& rScriptUrl ) = 0;
+
+private:
+ OUString maMacroName;
+};
+
+typedef ::boost::shared_ptr< VbaMacroAttacherBase > VbaMacroAttacherRef;
+
+// ============================================================================
+
+class OOX_DLLPUBLIC VbaProject : public VbaFilterConfig
+{
+public:
+ explicit VbaProject(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxDocModel,
+ const OUString& rConfigCompName );
+ virtual ~VbaProject();
+
+ /** Imports the entire VBA project from the passed storage.
+
+ @param rVbaPrjStrg The root storage of the entire VBA project.
+ */
+ void importVbaProject(
+ StorageBase& rVbaPrjStrg,
+ const GraphicHelper& rGraphicHelper,
+ bool bDefaultColorBgr = true );
+
+ bool importVbaProject(
+ StorageBase& rVbaPrjStrg );
+
+ /** Registers a macro atatcher object. For details, see description of the
+ VbaMacroAttacherBase class. */
+ void registerMacroAttacher( const VbaMacroAttacherRef& rxAttacher );
+
+ /** Returns true, if the document contains at least one code module. */
+ bool hasModules() const;
+
+ /** Returns true, if the document contains at least one dialog. */
+ bool hasDialogs() const;
+
+ void setOleOverridesSink( ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxOleOverridesSink ){ mxOleOverridesSink = rxOleOverridesSink; }
+
+protected:
+ /** Registers a dummy module that will be created when the VBA project is
+ imported. */
+ void addDummyModule( const OUString& rName, sal_Int32 nType );
+
+ /** Called when the import process of the VBA project has been started. */
+ virtual void prepareImport();
+ /** Called when the import process of the VBA project is finished. */
+ virtual void finalizeImport();
+
+private:
+ VbaProject( const VbaProject& );
+ VbaProject& operator=( const VbaProject& );
+
+ /** Returns the Basic or dialog library container. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::script::XLibraryContainer >
+ getLibraryContainer( sal_Int32 nPropId );
+ /** Opens a Basic or dialog library (creates missing if specified). */
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
+ openLibrary( sal_Int32 nPropId, bool bCreateMissing );
+ /** Creates and returns the Basic library of the document used for import. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
+ createBasicLibrary();
+ /** Creates and returns the dialog library of the document used for import. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
+ createDialogLibrary();
+
+ /** Imports the VBA code modules and forms. */
+ void importVba(
+ StorageBase& rVbaPrjStrg,
+ const GraphicHelper& rGraphicHelper,
+ bool bDefaultColorBgr );
+
+ /** Attaches VBA macros to objects registered via registerMacroAttacher(). */
+ void attachMacros();
+
+ /** Copies the entire VBA project storage to the passed document model. */
+ void copyStorage( StorageBase& rVbaPrjStrg );
+
+private:
+ typedef RefVector< VbaMacroAttacherBase > MacroAttacherVector;
+ typedef ::std::map< OUString, sal_Int32 > DummyModuleMap;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ mxContext; ///< Component context with service manager.
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
+ mxDocModel; ///< Document model used to import/export the VBA project.
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
+ mxBasicLib; ///< The Basic library of the document used for import.
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
+ mxDialogLib; ///< The dialog library of the document used for import.
+ MacroAttacherVector maMacroAttachers; ///< Objects that want to attach a VBA macro to an action.
+ DummyModuleMap maDummyModules; ///< Additional empty modules created on import.
+ OUString maPrjName; ///< Name of the VBA project.
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
+ mxOleOverridesSink;
+};
+
+// ============================================================================
+
+} // namespace ole
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/animationspersist.hxx b/include/oox/ppt/animationspersist.hxx
new file mode 100644
index 000000000000..ba63991def2a
--- /dev/null
+++ b/include/oox/ppt/animationspersist.hxx
@@ -0,0 +1,126 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef OOX_PPT_ANIMATIONPERSIST
+#define OOX_PPT_ANIMATIONPERSIST
+
+#include <list>
+#include <boost/shared_ptr.hpp>
+#include <boost/array.hpp>
+
+#include <rtl/ustring.hxx>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/drawing/XShape.hpp>
+
+#include "oox/drawingml/drawingmltypes.hxx"
+#include "oox/ppt/slidepersist.hxx"
+
+namespace oox { namespace ppt {
+
+ enum {
+ NP_TO = 0,
+ NP_FROM, NP_BY, NP_USERDATA, NP_ATTRIBUTENAME,
+ NP_ACCELERATION, NP_AUTOREVERSE, NP_DECELERATE, NP_DURATION, NP_FILL,
+ NP_REPEATCOUNT, NP_REPEATDURATION, NP_RESTART,
+ NP_DIRECTION, NP_COLORINTERPOLATION, NP_CALCMODE, NP_TRANSFORMTYPE,
+ NP_PATH,
+ NP_ENDSYNC, NP_ITERATETYPE, NP_ITERATEINTERVAL,
+ NP_SUBITEM, NP_TARGET, NP_COMMAND, NP_PARAMETER,
+ NP_VALUES, NP_FORMULA, NP_KEYTIMES, NP_DISPLAY,
+ _NP_SIZE
+ };
+
+ typedef boost::array< ::com::sun::star::uno::Any, _NP_SIZE > NodePropertyMap;
+
+
+ /** data for CT_TLShapeTargetElement */
+ struct ShapeTargetElement
+ {
+ ShapeTargetElement()
+ : mnType( 0 )
+ {}
+ void convert( ::com::sun::star::uno::Any & aAny, sal_Int16 & rSubType ) const;
+
+ sal_Int32 mnType;
+ sal_Int32 mnRangeType;
+ drawingml::IndexRange maRange;
+ OUString msSubShapeId;
+ };
+
+
+ /** data for CT_TLTimeTargetElement */
+ struct AnimTargetElement
+ {
+ AnimTargetElement()
+ : mnType( 0 )
+ {}
+ /** convert to a set of properties */
+ ::com::sun::star::uno::Any convert(const SlidePersistPtr & pSlide, sal_Int16 & nSubType) const;
+
+ sal_Int32 mnType;
+ OUString msValue;
+
+ ShapeTargetElement maShapeTarget;
+ };
+
+ typedef boost::shared_ptr< AnimTargetElement > AnimTargetElementPtr;
+
+ struct AnimationCondition;
+
+ typedef ::std::list< AnimationCondition > AnimationConditionList;
+
+ /** data for CT_TLTimeCondition */
+ struct AnimationCondition
+ {
+ AnimationCondition()
+ : mnType( 0 )
+ {}
+
+ ::com::sun::star::uno::Any convert(const SlidePersistPtr & pSlide) const;
+ static ::com::sun::star::uno::Any convertList(const SlidePersistPtr & pSlide, const AnimationConditionList & l);
+
+ AnimTargetElementPtr & getTarget()
+ { if(!mpTarget) mpTarget.reset( new AnimTargetElement ); return mpTarget; }
+ ::com::sun::star::uno::Any maValue;
+ sal_Int32 mnType;
+ private:
+ AnimTargetElementPtr mpTarget;
+ };
+
+
+ struct TimeAnimationValue
+ {
+ OUString msFormula;
+ OUString msTime;
+ ::com::sun::star::uno::Any maValue;
+ };
+
+ typedef ::std::list< TimeAnimationValue > TimeAnimationValueList;
+
+} }
+
+
+
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/backgroundproperties.hxx b/include/oox/ppt/backgroundproperties.hxx
new file mode 100644
index 000000000000..05926d44b796
--- /dev/null
+++ b/include/oox/ppt/backgroundproperties.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_POWERPOINT_BACKGROUNDPROPERTIES_HXX
+#define OOX_POWERPOINT_BACKGROUNDPROPERTIES_HXX
+
+#include "oox/core/fragmenthandler2.hxx"
+#include "oox/drawingml/fillproperties.hxx"
+
+namespace oox { namespace ppt {
+
+// ---------------------------------------------------------------------
+
+class BackgroundPropertiesContext : public ::oox::core::FragmentHandler2
+{
+public:
+ BackgroundPropertiesContext( ::oox::core::FragmentHandler2& rParent, ::oox::drawingml::FillProperties& rFillProperties );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs );
+
+protected:
+ ::oox::drawingml::FillProperties& mrFillProperties;
+};
+
+} }
+
+#endif // OOX_POWERPOINT_BACKGROUNDPROPERTIES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/comments.hxx b/include/oox/ppt/comments.hxx
new file mode 100644
index 000000000000..1095cd0223db
--- /dev/null
+++ b/include/oox/ppt/comments.hxx
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+
+#ifndef OOX_PPT_COMMENTS_HXX
+#define OOX_PPT_COMMENTS_HXX
+
+#include <vector>
+#include <com/sun/star/util/DateTime.hpp>
+
+namespace oox { namespace ppt {
+
+struct CommentAuthor
+{
+ OUString clrIdx;
+ OUString id;
+ OUString initials;
+ OUString lastIdx;
+ OUString name;
+};
+
+class CommentAuthorList
+{
+ private:
+ std::vector<CommentAuthor> cmAuthorLst;
+
+ public:
+ void setValues(const CommentAuthorList& list);
+
+ const std::vector<CommentAuthor>& getCmAuthorLst() const
+ {
+ return cmAuthorLst;
+ }
+
+ void addAuthor(const CommentAuthor& _author)
+ {
+ cmAuthorLst.push_back(_author);
+ }
+
+ friend class Comment;
+};
+
+class Comment
+{
+ private:
+ OUString authorId;
+ OUString dt;
+ OUString idx;
+ OUString x;
+ OUString y;
+ OUString text;
+ ::com::sun::star::util::DateTime aDateTime;
+
+ void setDateTime (OUString datetime);
+
+ public:
+ void setAuthorId(const OUString& _aId)
+ {
+ authorId = _aId;
+ }
+ void setdt(const OUString& _dt)
+ {
+ dt=_dt;
+ setDateTime(_dt);
+ }
+ void setidx(const OUString& _idx)
+ {
+ idx=_idx;
+ }
+ void setPoint(const OUString& _x, const OUString& _y)
+ {
+ x=_x;
+ y=_y;
+ }
+ void setText(const OUString& _text)
+ {
+ text = _text;
+ }
+ OUString getAuthorId()
+ {
+ return authorId;
+ }
+ OUString getdt()
+ {
+ return dt;
+ }
+ OUString getidx()
+ {
+ return idx;
+ }
+ OUString get_X()
+ {
+ return x;
+ }
+ OUString get_Y()
+ {
+ return y;
+ }
+ OUString get_text()
+ {
+ return text;
+ }
+ ::com::sun::star::util::DateTime getDateTime()
+ {
+ return aDateTime;
+ }
+ sal_Int32 getIntX()
+ {
+ return x.toInt32();
+ }
+ sal_Int32 getIntY()
+ {
+ return y.toInt32();
+ }
+ OUString getAuthor ( const CommentAuthorList& list );
+};
+
+class CommentList
+{
+ public:
+ std::vector<Comment> cmLst;
+ int getSize ()
+ {
+ return (int)cmLst.size();
+ }
+ const Comment& getCommentAtIndex (int index);
+};
+
+} }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/customshowlistcontext.hxx b/include/oox/ppt/customshowlistcontext.hxx
new file mode 100644
index 000000000000..ed913c8bbe2c
--- /dev/null
+++ b/include/oox/ppt/customshowlistcontext.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_POWERPOINT_CUSTOMSHOWLISTCONTEXT_HXX
+#define OOX_POWERPOINT_CUSTOMSHOWLISTCONTEXT_HXX
+
+#include "oox/core/fragmenthandler2.hxx"
+#include <vector>
+
+namespace oox { namespace ppt {
+
+
+ struct CustomShow
+ {
+ OUString maName;
+ OUString mnId;
+ std::vector< OUString >maSldLst;
+ };
+
+ /** CT_ */
+ class CustomShowListContext : public ::oox::core::FragmentHandler2
+ {
+ std::vector< CustomShow >& mrCustomShowList;
+
+ public:
+ CustomShowListContext( ::oox::core::FragmentHandler2& rParent,
+ std::vector< CustomShow >& rCustomShowList );
+
+ ~CustomShowListContext( );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs );
+ };
+
+} }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/dgmimport.hxx b/include/oox/ppt/dgmimport.hxx
new file mode 100644
index 000000000000..f369c5e526b8
--- /dev/null
+++ b/include/oox/ppt/dgmimport.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_POWERPOINT_QUICKDIAGRAMMINGIMPORT_HXX
+#define OOX_POWERPOINT_QUICKDIAGRAMMINGIMPORT_HXX
+
+#include "oox/core/xmlfilterbase.hxx"
+
+#include <com/sun/star/animations/XAnimationNode.hpp>
+#include <oox/drawingml/theme.hxx>
+#include "oox/ppt/presentationfragmenthandler.hxx"
+#include "oox/ppt/slidepersist.hxx"
+#include <vector>
+#include <map>
+
+namespace oox { namespace ppt {
+
+// ---------------------------------------------------------------------
+
+class QuickDiagrammingImport : public oox::core::XmlFilterBase
+{
+public:
+
+ QuickDiagrammingImport( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
+
+ // from FilterBase
+ virtual bool importDocument() throw();
+ virtual bool exportDocument() throw();
+
+ virtual const ::oox::drawingml::Theme* getCurrentTheme() const;
+ virtual sal_Int32 getSchemeClr( sal_Int32 nColorSchemeToken ) const;
+ virtual const oox::drawingml::table::TableStyleListPtr getTableStyles();
+
+ virtual oox::vml::Drawing* getVmlDrawing();
+ virtual oox::drawingml::chart::ChartConverter* getChartConverter();
+
+private:
+ virtual OUString implGetImplementationName() const;
+ virtual ::oox::ole::VbaProject* implCreateVbaProject() const;
+};
+
+} }
+
+#endif // OOX_POWERPOINT_QUICKDIAGRAMMINGIMPORT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/dgmlayout.hxx b/include/oox/ppt/dgmlayout.hxx
new file mode 100644
index 000000000000..bf964fe5d310
--- /dev/null
+++ b/include/oox/ppt/dgmlayout.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_POWERPOINT_QUICKDIAGRAMMINGLAYOUT_HXX
+#define OOX_POWERPOINT_QUICKDIAGRAMMINGLAYOUT_HXX
+
+#include "oox/core/xmlfilterbase.hxx"
+
+#include <com/sun/star/animations/XAnimationNode.hpp>
+#include <oox/drawingml/theme.hxx>
+#include "oox/ppt/presentationfragmenthandler.hxx"
+#include "oox/ppt/slidepersist.hxx"
+#include <vector>
+#include <map>
+
+namespace oox { namespace ppt {
+
+// ---------------------------------------------------------------------
+
+class QuickDiagrammingLayout : public oox::core::XmlFilterBase
+{
+public:
+
+ QuickDiagrammingLayout( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
+
+ // from FilterBase
+ virtual bool importDocument() throw();
+ virtual bool exportDocument() throw();
+
+ virtual const ::oox::drawingml::Theme* getCurrentTheme() const;
+ virtual sal_Int32 getSchemeClr( sal_Int32 nColorSchemeToken ) const;
+ virtual const oox::drawingml::table::TableStyleListPtr getTableStyles();
+
+ virtual ::oox::vml::Drawing* getVmlDrawing();
+ virtual ::oox::drawingml::chart::ChartConverter* getChartConverter();
+
+private:
+ virtual OUString implGetImplementationName() const;
+ virtual ::oox::ole::VbaProject* implCreateVbaProject() const;
+ drawingml::ThemePtr mpThemePtr;
+};
+
+} }
+
+#endif // OOX_POWERPOINT_QUICKDIAGRAMMINGLAYOUT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/headerfooter.hxx b/include/oox/ppt/headerfooter.hxx
new file mode 100644
index 000000000000..4d0a3cb65f1d
--- /dev/null
+++ b/include/oox/ppt/headerfooter.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_PPT_HEADERFOOTER
+#define OOX_PPT_HEADERFOOTER
+
+#include <sal/types.h>
+
+namespace oox { namespace ppt {
+
+ struct HeaderFooter
+ {
+ sal_Bool mbSlideNumber;
+ sal_Bool mbHeader;
+ sal_Bool mbFooter;
+ sal_Bool mbDateTime;
+
+ HeaderFooter()
+ : mbSlideNumber( sal_True )
+ , mbHeader( sal_True )
+ , mbFooter( sal_True )
+ , mbDateTime( sal_True ) {};
+ };
+
+} }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/layoutfragmenthandler.hxx b/include/oox/ppt/layoutfragmenthandler.hxx
new file mode 100644
index 000000000000..80983182b73d
--- /dev/null
+++ b/include/oox/ppt/layoutfragmenthandler.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_PPT_LAYOUTFRAGMENTHANDLER
+#define OOX_PPT_LAYOUTFRAGMENTHANDLER
+
+#include "oox/ppt/slidefragmenthandler.hxx"
+
+#include <vector>
+
+namespace oox { namespace ppt {
+
+class LayoutFragmentHandler : public SlideFragmentHandler
+{
+public:
+ LayoutFragmentHandler( ::oox::core::XmlFilterBase& rFilter, const OUString& rFragmentPath, SlidePersistPtr pMasterPersistPtr ) throw();
+ virtual ~LayoutFragmentHandler() throw();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs );
+};
+
+} }
+
+#endif // OOX_PPT_LAYOUTFRAGMENTHANDLER
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/pptgraphicshapecontext.hxx b/include/oox/ppt/pptgraphicshapecontext.hxx
new file mode 100644
index 000000000000..180098a67166
--- /dev/null
+++ b/include/oox/ppt/pptgraphicshapecontext.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_PPT_PPTGRAPHICSHAPECONTEXT_HXX
+#define OOX_PPT_PPTGRAPHICSHAPECONTEXT_HXX
+
+#include "oox/drawingml/graphicshapecontext.hxx"
+
+namespace oox { namespace ppt {
+
+class PPTGraphicShapeContext : public ::oox::drawingml::GraphicShapeContext
+{
+ SlidePersistPtr mpSlidePersistPtr;
+
+public:
+ PPTGraphicShapeContext( ::oox::core::ContextHandler& rParent, const SlidePersistPtr pSlidePersistPtr, oox::drawingml::ShapePtr pMasterShapePtr, oox::drawingml::ShapePtr pShapePtr );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+};
+
+} }
+
+#endif // OOX_PPT_PPTGRAPHICSHAPEGROUPCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/pptimport.hxx b/include/oox/ppt/pptimport.hxx
new file mode 100644
index 000000000000..035ea8cdc5c1
--- /dev/null
+++ b/include/oox/ppt/pptimport.hxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_POWERPOINT_POWERPOINTIMPORT_HXX
+#define OOX_POWERPOINT_POWERPOINTIMPORT_HXX
+
+#include "oox/core/xmlfilterbase.hxx"
+
+#include <com/sun/star/animations/XAnimationNode.hpp>
+#include <oox/drawingml/theme.hxx>
+#include "oox/ppt/presentationfragmenthandler.hxx"
+#include "oox/ppt/slidepersist.hxx"
+#include <vector>
+#include <map>
+
+namespace oox { namespace ppt {
+
+// ---------------------------------------------------------------------
+
+class PowerPointImport : public oox::core::XmlFilterBase
+{
+public:
+
+ PowerPointImport( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext )
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual ~PowerPointImport();
+
+ // from FilterBase
+ virtual bool importDocument() throw();
+ virtual bool exportDocument() throw();
+
+ virtual const ::oox::drawingml::Theme* getCurrentTheme() const;
+ virtual ::oox::vml::Drawing* getVmlDrawing();
+ virtual const oox::drawingml::table::TableStyleListPtr getTableStyles();
+ virtual ::oox::drawingml::chart::ChartConverter* getChartConverter();
+
+ void setActualSlidePersist( SlidePersistPtr pActualSlidePersist ){ mpActualSlidePersist = pActualSlidePersist; };
+ std::map< OUString, oox::drawingml::ThemePtr >& getThemes(){ return maThemes; };
+ std::vector< SlidePersistPtr >& getDrawPages(){ return maDrawPages; };
+ std::vector< SlidePersistPtr >& getMasterPages(){ return maMasterPages; };
+ std::vector< SlidePersistPtr >& getNotesPages(){ return maNotesPages; };
+
+ virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rDescriptor )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ sal_Int32 getSchemeColor( sal_Int32 nToken ) const;
+
+#if OSL_DEBUG_LEVEL > 0
+ static XmlFilterBase* mpDebugFilterBase;
+#endif
+
+private:
+ virtual GraphicHelper* implCreateGraphicHelper() const;
+ virtual ::oox::ole::VbaProject* implCreateVbaProject() const;
+ virtual OUString implGetImplementationName() const;
+
+private:
+ OUString maTableStyleListPath;
+ oox::drawingml::table::TableStyleListPtr mpTableStyleList;
+
+ SlidePersistPtr mpActualSlidePersist;
+ std::map< OUString, oox::drawingml::ThemePtr > maThemes;
+
+ std::vector< SlidePersistPtr > maDrawPages;
+ std::vector< SlidePersistPtr > maMasterPages;
+ std::vector< SlidePersistPtr > maNotesPages;
+
+ ::boost::shared_ptr< ::oox::drawingml::chart::ChartConverter > mxChartConv;
+};
+
+} }
+
+#endif // OOX_POWERPOINT_POWERPOINTIMPORT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/pptshape.hxx b/include/oox/ppt/pptshape.hxx
new file mode 100644
index 000000000000..aa485adf9347
--- /dev/null
+++ b/include/oox/ppt/pptshape.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_PPT_PRESENTATION_PPTSHAPE_HXX
+#define OOX_PPT_PRESENTATION_PPTSHAPE_HXX
+
+#include "oox/drawingml/shape.hxx"
+#include "oox/ppt/slidepersist.hxx"
+
+namespace oox { namespace ppt {
+
+class PPTShape : public oox::drawingml::Shape
+{
+ ShapeLocation meShapeLocation; // placeholdershapes (mnSubType != 0) on Master are never displayed
+ sal_Bool mbReferenced; // placeholdershapes on Layout are displayed only, if they are not referenced
+ // placeholdershapes on Slide are displayed always
+
+public:
+
+ PPTShape( const oox::ppt::ShapeLocation eShapeLocation,
+ const sal_Char* pServiceType = NULL );
+ virtual ~PPTShape();
+
+ using oox::drawingml::Shape::addShape;
+ // addShape is creating and inserting the corresponding XShape.
+ void addShape(
+ oox::core::XmlFilterBase& rFilterBase,
+ SlidePersist& rPersist,
+ const oox::drawingml::Theme* pTheme,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ basegfx::B2DHomMatrix& aTransformation,
+ const com::sun::star::awt::Rectangle* pShapeRect = 0,
+ ::oox::drawingml::ShapeIdMap* pShapeMap = 0 );
+
+ virtual void applyShapeReference( const oox::drawingml::Shape& rReferencedShape, bool bUseText = true );
+
+ void setShapeLocation( const oox::ppt::ShapeLocation eShapeLocation ) { meShapeLocation = eShapeLocation; };
+ ShapeLocation getShapeLocation() const { return meShapeLocation; };
+ sal_Bool isReferenced() const { return mbReferenced; };
+ void setReferenced( sal_Bool bReferenced ){ mbReferenced = bReferenced; };
+ void setPlaceholder( oox::drawingml::ShapePtr pPlaceholder ) { mpPlaceholder = pPlaceholder; }
+
+ static oox::drawingml::ShapePtr findPlaceholder( const sal_Int32 nMasterPlaceholder, std::vector< oox::drawingml::ShapePtr >& rShapes, bool bMasterOnly = false );
+ static oox::drawingml::ShapePtr findPlaceholderByIndex( const sal_Int32 nIdx, std::vector< oox::drawingml::ShapePtr >& rShapes, bool bMasterOnly = false );
+
+ static oox::drawingml::TextListStylePtr getSubTypeTextListStyle( const SlidePersist& rSlidePersist, sal_Int32 nSubType );
+
+protected:
+
+ oox::drawingml::ShapePtr mpPlaceholder;
+};
+
+} }
+
+#endif // OOX_PPT_PRESENTATION_PPTSHAPE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/pptshapecontext.hxx b/include/oox/ppt/pptshapecontext.hxx
new file mode 100644
index 000000000000..59e46b3d54b5
--- /dev/null
+++ b/include/oox/ppt/pptshapecontext.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_PPT_PPTSHAPECONTEXT_HXX
+#define OOX_PPT_PPTSHAPECONTEXT_HXX
+
+#include "oox/drawingml/shapecontext.hxx"
+
+namespace oox { namespace ppt {
+
+class PPTShapeContext : public ::oox::drawingml::ShapeContext
+{
+ SlidePersistPtr mpSlidePersistPtr;
+
+public:
+ PPTShapeContext( ::oox::core::ContextHandler& rParent, const SlidePersistPtr pSlidePersistPtr, oox::drawingml::ShapePtr pMasterShapePtr, oox::drawingml::ShapePtr pShapePtr );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+};
+
+} }
+
+#endif // OOX_PPT_PPTSHAPEGROUPCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/pptshapegroupcontext.hxx b/include/oox/ppt/pptshapegroupcontext.hxx
new file mode 100644
index 000000000000..c7e60c76e823
--- /dev/null
+++ b/include/oox/ppt/pptshapegroupcontext.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_PPT_PPTSHAPEGROUPCONTEXT_HXX
+#define OOX_PPT_PPTSHAPEGROUPCONTEXT_HXX
+
+#include "oox/drawingml/shapegroupcontext.hxx"
+#include "oox/ppt/slidepersist.hxx"
+
+namespace oox { namespace ppt {
+
+class PPTShapeGroupContext : public ::oox::drawingml::ShapeGroupContext
+{
+ SlidePersistPtr mpSlidePersistPtr;
+ ShapeLocation meShapeLocation;
+ oox::drawingml::ShapePtr pGraphicShape;
+ void importExtDrawings();
+
+public:
+ PPTShapeGroupContext(
+ ::oox::core::ContextHandler& rParent,
+ const oox::ppt::SlidePersistPtr pSlidePersistPtr,
+ const oox::ppt::ShapeLocation eShapeLocation,
+ oox::drawingml::ShapePtr pMasterShapePtr,
+ oox::drawingml::ShapePtr pGroupShapePtr );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+
+};
+
+} }
+
+#endif // OOX_PPT_PPTSHAPEGROUPCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/pptshapepropertiescontext.hxx b/include/oox/ppt/pptshapepropertiescontext.hxx
new file mode 100644
index 000000000000..f979c6efd3db
--- /dev/null
+++ b/include/oox/ppt/pptshapepropertiescontext.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_PPT_PPTSHAPEPROPERTIESCONTEXT_HXX
+#define OOX_PPT_PPTSHAPEPROPERTIESCONTEXT_HXX
+
+#include "oox/drawingml/shapepropertiescontext.hxx"
+
+namespace oox { namespace ppt {
+
+class PPTShapePropertiesContext : public ::oox::drawingml::ShapePropertiesContext
+{
+public:
+ PPTShapePropertiesContext( ::oox::core::ContextHandler& rParent, ::oox::drawingml::Shape& rShape );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+};
+
+} }
+
+#endif // OOX_PPT_PPTSHAPEGROUPCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/presentationfragmenthandler.hxx b/include/oox/ppt/presentationfragmenthandler.hxx
new file mode 100644
index 000000000000..ae26cb233e8c
--- /dev/null
+++ b/include/oox/ppt/presentationfragmenthandler.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_PPT_PRESENTATION_FRAGMENTHANDLER
+#define OOX_PPT_PRESENTATION_FRAGMENTHANDLER
+
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include "oox/drawingml/textliststyle.hxx"
+#include "oox/ppt/slidepersist.hxx"
+#include "oox/core/contexthandler.hxx"
+#include "oox/core/fragmenthandler.hxx"
+#include "oox/core/fragmenthandler2.hxx"
+#include "oox/core/relations.hxx"
+#include "oox/ppt/customshowlistcontext.hxx"
+#include "oox/ppt/comments.hxx"
+#include <stack>
+#include <vector>
+
+namespace oox { namespace ppt {
+
+class PresentationFragmentHandler : public ::oox::core::FragmentHandler2
+{
+public:
+ PresentationFragmentHandler( ::oox::core::XmlFilterBase& rFilter, const OUString& rFragmentPath ) throw();
+ virtual ~PresentationFragmentHandler() throw();
+ virtual void finalizeImport();
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs );
+
+protected:
+ bool importSlide( const ::oox::core::FragmentHandlerRef& rxSlideFragmentHandler,
+ const oox::ppt::SlidePersistPtr pPersist );
+
+private:
+
+ void importSlide(sal_uInt32 nSlide, sal_Bool bFirstSlide, sal_Bool bImportNotes);
+
+ std::vector< OUString > maSlideMasterVector;
+ std::vector< OUString > maSlidesVector;
+ std::vector< OUString > maNotesMasterVector;
+ ::oox::drawingml::TextListStylePtr mpTextListStyle;
+
+ ::com::sun::star::awt::Size maSlideSize;
+ ::com::sun::star::awt::Size maNotesSize;
+
+ std::vector< CustomShow > maCustomShowList;
+
+ CommentAuthorList maAuthorList;
+ bool mbCommentAuthorsRead; // read commentAuthors.xml only once
+};
+
+} }
+
+#endif // OOX_PPT_PRESENTATION_FRAGMENTHANDLER
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/slidefragmenthandler.hxx b/include/oox/ppt/slidefragmenthandler.hxx
new file mode 100644
index 000000000000..045f6ff1ccda
--- /dev/null
+++ b/include/oox/ppt/slidefragmenthandler.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_PPT_SLIDEFRAGMENTHANDLER
+#define OOX_PPT_SLIDEFRAGMENTHANDLER
+
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include "oox/helper/propertymap.hxx"
+#include "oox/core/fragmenthandler2.hxx"
+#include "oox/ppt/slidepersist.hxx"
+
+#include <stack>
+#include <vector>
+#include <map>
+
+namespace oox { namespace ppt {
+
+class SlideFragmentHandler : public ::oox::core::FragmentHandler2
+{
+public:
+ SlideFragmentHandler( ::oox::core::XmlFilterBase& rFilter, const OUString& rFragmentPath, SlidePersistPtr pPersistPtr, const ShapeLocation eShapeLocation ) throw();
+ virtual ~SlideFragmentHandler() throw();
+
+ virtual void finalizeImport();
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs );
+ virtual void onCharacters( const OUString& rChars );
+
+ const ::std::vector< OUString>& getCharVector() { return maCharVector; }
+
+protected:
+ SlidePersistPtr mpSlidePersistPtr;
+ ShapeLocation meShapeLocation;
+
+private:
+ OUString maSlideName;
+ PropertyMap maSlideProperties;
+ ::std::vector< OUString> maCharVector; // handle char in OnCharacters
+};
+
+} }
+
+#endif // OOX_PPT_SLIDEFRAGMENTHANDLER
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/slidemastertextstylescontext.hxx b/include/oox/ppt/slidemastertextstylescontext.hxx
new file mode 100644
index 000000000000..c1e9c1478ec6
--- /dev/null
+++ b/include/oox/ppt/slidemastertextstylescontext.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_SLIDEMASTERTEXTSTYLESCONTEXT_HXX
+#define OOX_DRAWINGML_SLIDEMASTERTEXTSTYLESCONTEXT_HXX
+
+#include "oox/drawingml/theme.hxx"
+#include "oox/core/contexthandler.hxx"
+#include "oox/core/fragmenthandler2.hxx"
+#include "oox/ppt/slidepersist.hxx"
+
+namespace oox { namespace ppt {
+
+class SlideMasterTextStylesContext : public oox::core::FragmentHandler2
+{
+public:
+ SlideMasterTextStylesContext( ::oox::core::FragmentHandler2& rParent, SlidePersistPtr pSlidePersistPtr );
+ ~SlideMasterTextStylesContext();
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs );
+
+protected:
+ SlidePersistPtr mpSlidePersistPtr;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_SLIDEMASTERTEXTSTYLESCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/slidepersist.hxx b/include/oox/ppt/slidepersist.hxx
new file mode 100644
index 000000000000..6f58d81813c3
--- /dev/null
+++ b/include/oox/ppt/slidepersist.hxx
@@ -0,0 +1,161 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_POWERPOINT_SLIDEPERSIST_HXX
+#define OOX_POWERPOINT_SLIDEPERSIST_HXX
+
+#include <boost/shared_ptr.hpp>
+#include "oox/drawingml/shape.hxx"
+#include "oox/drawingml/theme.hxx"
+#include "oox/drawingml/clrscheme.hxx"
+#include "oox/drawingml/textliststyle.hxx"
+#include "oox/drawingml/textparagraphproperties.hxx"
+#include <oox/ppt/headerfooter.hxx>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/animations/XAnimationNode.hpp>
+#include "oox/core/fragmenthandler.hxx"
+#include "oox/ppt/comments.hxx"
+
+#include <list>
+
+namespace oox { namespace vml { class Drawing; } }
+
+namespace oox { namespace ppt {
+
+enum ShapeLocation
+{
+ Master,
+ Layout,
+ Slide
+};
+
+// ---------------------------------------------------------------------
+class TimeNode;
+class SlidePersist;
+
+typedef boost::shared_ptr< SlidePersist > SlidePersistPtr;
+
+class SlidePersist : public boost::enable_shared_from_this< SlidePersist >
+{
+
+public:
+ SlidePersist( oox::core::XmlFilterBase& rFilter, sal_Bool bMaster, sal_Bool bNotes,
+ const com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage >&,
+ oox::drawingml::ShapePtr pShapesPtr, const ::oox::drawingml::TextListStylePtr & );
+ ~SlidePersist();
+
+ com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > getPage() const { return mxPage; };
+
+#if OSL_DEBUG_LEVEL > 0
+ static com::sun::star::uno::WeakReference< com::sun::star::drawing::XDrawPage > mxDebugPage;
+#endif
+
+ void setMasterPersist( SlidePersistPtr pMasterPersistPtr ){ mpMasterPagePtr = pMasterPersistPtr; }
+ SlidePersistPtr getMasterPersist() const { return mpMasterPagePtr; }
+
+ void setPath( const OUString& rPath ) { maPath = rPath; }
+ const OUString getPath() const { return maPath; }
+
+ void setLayoutPath( const OUString& rLayoutPath ) { maLayoutPath = rLayoutPath; }
+ const OUString getLayoutPath() const { return maLayoutPath; }
+
+ void setTheme( const oox::drawingml::ThemePtr pThemePtr ){ mpThemePtr = pThemePtr; }
+ oox::drawingml::ThemePtr getTheme() const { return mpThemePtr; }
+
+ void setClrScheme( const oox::drawingml::ClrSchemePtr pClrSchemePtr ){ mpClrSchemePtr = pClrSchemePtr; }
+ oox::drawingml::ClrSchemePtr getClrScheme() const { return mpClrSchemePtr; }
+
+ void setClrMap( const oox::drawingml::ClrMapPtr pClrMapPtr ){ mpClrMapPtr = pClrMapPtr; }
+ oox::drawingml::ClrMapPtr getClrMap() const { return mpClrMapPtr; }
+
+ void setBackgroundProperties( const oox::drawingml::FillPropertiesPtr pFillPropertiesPtr ){ mpBackgroundPropertiesPtr = pFillPropertiesPtr; }
+ oox::drawingml::FillPropertiesPtr getBackgroundProperties() const { return mpBackgroundPropertiesPtr; }
+ oox::drawingml::Color& getBackgroundColor() { return maBackgroundColor; }
+
+ sal_Bool isMasterPage() const { return mbMaster; }
+ sal_Bool isNotesPage() const { return mbNotes; }
+
+ void setLayoutValueToken( sal_Int32 nLayoutValueToken ) { mnLayoutValueToken = nLayoutValueToken; }
+ short getLayoutFromValueToken();
+
+
+ oox::drawingml::TextListStylePtr getDefaultTextStyle() const { return maDefaultTextStylePtr; }
+ oox::drawingml::TextListStylePtr getTitleTextStyle() const { return maTitleTextStylePtr; }
+ oox::drawingml::TextListStylePtr getBodyTextStyle() const { return maBodyTextStylePtr; }
+ oox::drawingml::TextListStylePtr getNotesTextStyle() const { return maNotesTextStylePtr; }
+ oox::drawingml::TextListStylePtr getOtherTextStyle() const { return maOtherTextStylePtr; }
+
+ oox::drawingml::ShapePtr getShapes() { return maShapesPtr; }
+ void hideShapesAsMasterShapes();
+ ::std::list< boost::shared_ptr< TimeNode > >& getTimeNodeList() { return maTimeNodeList; }
+ oox::ppt::HeaderFooter& getHeaderFooter(){ return maHeaderFooter; };
+
+ oox::vml::Drawing* getDrawing() { return mpDrawingPtr.get(); }
+
+ void createXShapes( oox::core::XmlFilterBase& rFilterBase );
+ void createBackground( const oox::core::XmlFilterBase& rFilterBase );
+ void applyTextStyles( const oox::core::XmlFilterBase& rFilterBase );
+
+ std::map< OUString, ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > >& getAnimNodesMap() { return maAnimNodesMap; };
+ ::oox::drawingml::ShapePtr getShape( const OUString & id ) { return maShapeMap[ id ]; }
+ ::oox::drawingml::ShapeIdMap& getShapeMap() { return maShapeMap; }
+
+ CommentList& getCommentsList() { return maCommentsList; }
+ CommentAuthorList& getCommentAuthors() { return maCommentAuthors; }
+
+private:
+ OUString maPath;
+ OUString maLayoutPath;
+ ::boost::shared_ptr< oox::vml::Drawing > mpDrawingPtr;
+ com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > mxPage;
+ oox::drawingml::ThemePtr mpThemePtr; // the theme that is used
+ oox::drawingml::ClrSchemePtr mpClrSchemePtr; // the local color scheme (if any)
+ oox::drawingml::ClrMapPtr mpClrMapPtr; // color mapping (if any)
+ SlidePersistPtr mpMasterPagePtr;
+
+ oox::drawingml::ShapePtr maShapesPtr;
+ oox::drawingml::Color maBackgroundColor;
+ oox::drawingml::FillPropertiesPtr mpBackgroundPropertiesPtr;
+ ::std::list< boost::shared_ptr< TimeNode > > maTimeNodeList;
+
+ oox::ppt::HeaderFooter maHeaderFooter;
+ sal_Int32 mnLayoutValueToken;
+ sal_Bool mbMaster;
+ sal_Bool mbNotes;
+
+ oox::drawingml::TextListStylePtr maDefaultTextStylePtr;
+ oox::drawingml::TextListStylePtr maTitleTextStylePtr;
+ oox::drawingml::TextListStylePtr maBodyTextStylePtr;
+ oox::drawingml::TextListStylePtr maNotesTextStylePtr;
+ oox::drawingml::TextListStylePtr maOtherTextStylePtr;
+
+ std::map< OUString, ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > > maAnimNodesMap;
+ std::map< OUString, ::oox::drawingml::ShapePtr > maShapeMap;
+
+ // slide comments
+ CommentList maCommentsList;
+ CommentAuthorList maCommentAuthors;
+};
+
+} }
+
+#endif // OOX_POWERPOINT_SLIDEPERSIST_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/slidetimingcontext.hxx b/include/oox/ppt/slidetimingcontext.hxx
new file mode 100644
index 000000000000..a50e8be60fd3
--- /dev/null
+++ b/include/oox/ppt/slidetimingcontext.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_PPT_SLIDETIMINGCONTEXT
+#define OOX_PPT_SLIDETIMINGCONTEXT
+
+#include <com/sun/star/animations/XTimeContainer.hpp>
+#include "oox/ppt/timenode.hxx"
+#include "oox/core/fragmenthandler2.hxx"
+
+#include <stack>
+#include <vector>
+
+namespace oox { namespace ppt {
+
+class SlideTimingContext : public ::oox::core::FragmentHandler2
+{
+public:
+ SlideTimingContext( ::oox::core::FragmentHandler2& rParent, TimeNodePtrList & aTimeNodeList ) throw();
+ virtual ~SlideTimingContext() throw();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs );
+
+private:
+ TimeNodePtrList & maTimeNodeList;
+};
+
+} }
+
+#endif // OOX_PPT_SLIDETIMINGCONTEXT
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/slidetransition.hxx b/include/oox/ppt/slidetransition.hxx
new file mode 100644
index 000000000000..01f701d63dfe
--- /dev/null
+++ b/include/oox/ppt/slidetransition.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef OOX_PPT_SLIDETRANSITION
+#define OOX_PPT_SLIDETRANSITION
+
+#include <rtl/ustring.hxx>
+
+#include <com/sun/star/animations/XTransitionFilter.hpp>
+
+namespace oox { class PropertyMap; }
+
+namespace oox { namespace ppt {
+
+ class SlideTransition
+ {
+ public:
+ SlideTransition();
+ explicit SlideTransition(const OUString & );
+
+ void setSlideProperties( PropertyMap& props );
+ void setTransitionFilterProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XTransitionFilter > & xFilter );
+
+ void setOoxTransitionSpeed( sal_Int32 nToken );
+ void setFadeColor( sal_Int32 nColor )
+ { mnFadeColor = nColor; }
+ void setMode( sal_Bool bMode )
+ { mbMode = bMode; }
+ void setOoxAdvanceTime( sal_Int32 nAdvanceTime )
+ { mnAdvanceTime = nAdvanceTime; }
+
+ static sal_Int16 ooxToOdpDirection( ::sal_Int32 nOoxType );
+ static sal_Int16 ooxToOdpEightDirections( ::sal_Int32 nOoxType );
+ static sal_Int16 ooxToOdpCornerDirections( ::sal_Int32 nOoxType );
+ static sal_Int16 ooxToOdpBorderDirections( ::sal_Int32 nOoxType );
+ static sal_Int16 ooxToOdpSideDirections( ::sal_Int32 nOoxType );
+ static sal_Bool ooxToOdpSideDirectionsDirectionNormal( ::sal_Int32 nOoxType );
+
+ void setOoxTransitionType( ::sal_Int32 OoxType,
+ ::sal_Int32 param1, ::sal_Int32 param2 );
+ private:
+ ::sal_Int16 mnTransitionType;
+ ::sal_Int16 mnTransitionSubType;
+ ::sal_Bool mbTransitionDirectionNormal;
+ ::sal_Int16 mnAnimationSpeed;
+ ::sal_Int32 mnFadeColor;
+ ::sal_Bool mbMode; /**< http://api.libreoffice.org/docs/common/ref/com/sun/star/animations/XTransitionFilter.html Mode property */
+ ::sal_Int32 mnAdvanceTime;
+ };
+
+} }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/slidetransitioncontext.hxx b/include/oox/ppt/slidetransitioncontext.hxx
new file mode 100644
index 000000000000..077d5a8f5813
--- /dev/null
+++ b/include/oox/ppt/slidetransitioncontext.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_PPT_SLIDETRANSITIONCONTEXT
+#define OOX_PPT_SLIDETRANSITIONCONTEXT
+
+#include "oox/core/fragmenthandler2.hxx"
+#include "oox/ppt/slidetransition.hxx"
+
+namespace oox { class PropertyMap; }
+
+namespace oox { namespace ppt {
+
+ class SlideTransitionContext : public ::oox::core::FragmentHandler2
+ {
+ public:
+ SlideTransitionContext( ::oox::core::FragmentHandler2& rParent,
+ const AttributeList& rAttributes,
+ PropertyMap & aProperties ) throw();
+ virtual ~SlideTransitionContext() throw();
+
+ virtual void onEndElement();
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs );
+
+
+ private:
+ PropertyMap& maSlideProperties;
+ ::sal_Bool mbHasTransition;
+ SlideTransition maTransition;
+ };
+
+} }
+
+#endif // OOX_PPT_SLIDEFRAGMENTHANDLER
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/soundactioncontext.hxx b/include/oox/ppt/soundactioncontext.hxx
new file mode 100644
index 000000000000..d1f1040c75ba
--- /dev/null
+++ b/include/oox/ppt/soundactioncontext.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef OOX_PPT_SOUNDACTIONCONTEXT
+#define OOX_PPT_SOUNDACTIONCONTEXT
+
+#include "oox/core/fragmenthandler2.hxx"
+
+namespace oox { class PropertyMap; }
+
+namespace oox { namespace ppt {
+
+class SoundActionContext : public ::oox::core::FragmentHandler2
+{
+public:
+ SoundActionContext( ::oox::core::FragmentHandler2& rParent, PropertyMap & aProperties ) throw();
+ virtual ~SoundActionContext() throw();
+
+ virtual void onEndElement();
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs );
+
+private:
+ PropertyMap& maSlideProperties;
+ bool mbHasStartSound;
+ bool mbLoopSound;
+ bool mbStopSound;
+ OUString msEmbedded;
+ OUString msLink;
+ OUString msSndName;
+};
+
+} }
+
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/timenode.hxx b/include/oox/ppt/timenode.hxx
new file mode 100644
index 000000000000..769cc0e03943
--- /dev/null
+++ b/include/oox/ppt/timenode.hxx
@@ -0,0 +1,128 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef OOX_DRAWINGML_TIMENODE_HXX
+#define OOX_DRAWINGML_TIMENODE_HXX
+
+#include <boost/shared_ptr.hpp>
+#include <vector>
+#include <list>
+#include <rtl/ustring.hxx>
+
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/animations/XAnimationNode.hpp>
+#include "oox/helper/propertymap.hxx"
+#include "oox/ppt/slidetransition.hxx"
+#include "oox/ppt/slidepersist.hxx"
+#include "oox/ppt/animationspersist.hxx"
+#include "oox/ppt/timenode.hxx"
+
+namespace oox { namespace ppt {
+
+ class TimeNode;
+ class SlideTransition;
+
+ typedef boost::shared_ptr< TimeNode > TimeNodePtr;
+ typedef ::std::list< TimeNodePtr > TimeNodePtrList;
+
+ class TimeNode
+ {
+ public:
+ typedef ::std::map< OUString, ::com::sun::star::uno::Any > UserDataMap;
+
+ TimeNode( sal_Int16 nNodeType );
+ virtual ~TimeNode();
+
+ NodePropertyMap & getNodeProperties() { return maNodeProperties; }
+ UserDataMap & getUserData() { return maUserData; }
+ void addChild( const TimeNodePtr & pChildPtr )
+ { maChildren.push_back( pChildPtr ); }
+
+ TimeNodePtrList & getChildren()
+ { return maChildren; }
+
+ void setId( sal_Int32 nId );
+ const OUString & getId() const { return msId; }
+
+ void addNode(
+ const ::oox::core::XmlFilterBase& rFilter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rxNode,
+ const SlidePersistPtr & slide);
+ // data setters
+ void setTo( const ::com::sun::star::uno::Any & aTo );
+ void setFrom( const ::com::sun::star::uno::Any & aFrom );
+ void setBy( const ::com::sun::star::uno::Any & aBy );
+ void setTransitionFilter( const SlideTransition & aTransition)
+ { maTransitionFilter = aTransition; }
+
+ void setNode(
+ const ::oox::core::XmlFilterBase& rFilter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode,
+ const SlidePersistPtr & pSlide );
+
+ AnimTargetElementPtr getTarget()
+ {
+ if( !mpTarget )
+ mpTarget.reset( new AnimTargetElement );
+ return mpTarget;
+ }
+
+ AnimationConditionList &getStartCondition()
+ { return maStCondList; }
+ AnimationConditionList &getEndCondition()
+ { return maEndCondList; }
+ AnimationConditionList &getNextCondition()
+ { return maNextCondList; }
+ AnimationConditionList &getPrevCondition()
+ { return maPrevCondList; }
+ AnimationCondition & getEndSyncValue()
+ { mbHasEndSyncValue = true; return maEndSyncValue; }
+ protected:
+
+ static OUString getServiceName( sal_Int16 nNodeType );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >
+ createAndInsert(
+ const ::oox::core::XmlFilterBase& rFilter,
+ const OUString& rServiceName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rxNode );
+
+ private:
+ const sal_Int16 mnNodeType;
+
+ TimeNodePtrList maChildren;
+
+ OUString msId;
+ NodePropertyMap maNodeProperties;
+ UserDataMap maUserData; // a sequence to be stored as "UserData" property
+ SlideTransition maTransitionFilter;
+ AnimTargetElementPtr mpTarget;
+ bool mbHasEndSyncValue; // set to true if we try to get the endSync.
+ AnimationCondition maEndSyncValue;
+ AnimationConditionList maStCondList, maEndCondList;
+ AnimationConditionList maPrevCondList, maNextCondList;
+ };
+
+} }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/timenodelistcontext.hxx b/include/oox/ppt/timenodelistcontext.hxx
new file mode 100644
index 000000000000..baacbc94add4
--- /dev/null
+++ b/include/oox/ppt/timenodelistcontext.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_PPT_TIMENODELISTCONTEXT
+#define OOX_PPT_TIMENODELISTCONTEXT
+
+#include "oox/core/fragmenthandler2.hxx"
+#include "oox/ppt/timenode.hxx"
+
+#include <com/sun/star/animations/XTimeContainer.hpp>
+
+namespace oox { namespace ppt {
+
+
+ class TimeNodeContext : public ::oox::core::FragmentHandler2
+ {
+ public:
+ virtual ~TimeNodeContext() throw();
+
+ static TimeNodeContext * SAL_CALL makeContext( ::oox::core::FragmentHandler2& rParent, sal_Int32 aElement, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, const TimeNodePtr & pNode );
+
+ protected:
+ TimeNodeContext( ::oox::core::FragmentHandler2& rParent, sal_Int32 aElement, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ) throw();
+
+ sal_Int32 mnElement;
+ TimeNodePtr mpNode;
+ };
+
+
+
+/** FastParser context for XML_tnLst, XML_subTnLst and XML_childTnLst */
+class TimeNodeListContext : public ::oox::core::FragmentHandler2
+{
+public:
+ TimeNodeListContext( ::oox::core::FragmentHandler2& rParent, TimeNodePtrList & aList ) throw();
+
+ virtual ~TimeNodeListContext() throw();
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs );
+
+
+private:
+ TimeNodePtrList & maList;
+};
+
+} }
+
+#endif // OOX_PPT_SLIDEFRAGMENTHANDLER
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/token/namespacemap.hxx b/include/oox/token/namespacemap.hxx
new file mode 100644
index 000000000000..78eeaa93cc40
--- /dev/null
+++ b/include/oox/token/namespacemap.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_TOKEN_NAMESPACEMAP_HXX
+#define OOX_TOKEN_NAMESPACEMAP_HXX
+
+#include <map>
+#include <rtl/instance.hxx>
+#include <rtl/ustring.hxx>
+
+namespace oox {
+
+// ============================================================================
+
+/** A map that contains all XML namespace URLs used in the filters. */
+struct NamespaceMap : public ::std::map< sal_Int32, OUString > { NamespaceMap(); };
+
+/** Thread-save singleton of a map of all supported XML namespace URLs. */
+struct StaticNamespaceMap : public ::rtl::Static< NamespaceMap, StaticNamespaceMap > {};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/token/propertynames.hxx b/include/oox/token/propertynames.hxx
new file mode 100644
index 000000000000..931eaed0172b
--- /dev/null
+++ b/include/oox/token/propertynames.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_TOKEN_PROPERTYNAMES_HXX
+#define OOX_TOKEN_PROPERTYNAMES_HXX
+
+#include <vector>
+#include <rtl/instance.hxx>
+#include <rtl/ustring.hxx>
+
+namespace oox {
+
+// ============================================================================
+
+/** A vector that contains all predefined property names used in the filters. */
+struct PropertyNameVector : public ::std::vector< OUString > { PropertyNameVector(); };
+
+/** Thread-save singleton of a vector of all supported property names. */
+struct StaticPropertyNameVector : public ::rtl::Static< PropertyNameVector, StaticPropertyNameVector > {};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/token/tokenmap.hxx b/include/oox/token/tokenmap.hxx
new file mode 100644
index 000000000000..84dc70d03fac
--- /dev/null
+++ b/include/oox/token/tokenmap.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_TOKEN_TOKENMAP_HXX
+#define OOX_TOKEN_TOKENMAP_HXX
+
+#include <vector>
+#include <rtl/instance.hxx>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+namespace oox {
+
+// ============================================================================
+
+class TokenMap
+{
+public:
+ explicit TokenMap();
+ ~TokenMap();
+
+ /** Returns the Unicode name of the passed token identifier. */
+ OUString getUnicodeTokenName( sal_Int32 nToken ) const;
+
+ /** Returns the token identifier for the passed Unicode token name. */
+ sal_Int32 getTokenFromUnicode( const OUString& rUnicodeName ) const;
+
+ /** Returns the UTF8 name of the passed token identifier as byte sequence. */
+ ::com::sun::star::uno::Sequence< sal_Int8 >
+ getUtf8TokenName( sal_Int32 nToken ) const;
+
+ /** Returns the token identifier for the passed UTF8 token name. */
+ sal_Int32 getTokenFromUtf8(
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& rUtf8Name ) const;
+
+private:
+ struct TokenName
+ {
+ OUString maUniName;
+ ::com::sun::star::uno::Sequence< sal_Int8 > maUtf8Name;
+ };
+ typedef ::std::vector< TokenName > TokenNameVector;
+
+ TokenNameVector maTokenNames;
+};
+
+// ============================================================================
+
+struct StaticTokenMap : public ::rtl::Static< TokenMap, StaticTokenMap > {};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/vml/vmldrawing.hxx b/include/oox/vml/vmldrawing.hxx
new file mode 100644
index 000000000000..ad7790962366
--- /dev/null
+++ b/include/oox/vml/vmldrawing.hxx
@@ -0,0 +1,213 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_VML_VMLDRAWING_HXX
+#define OOX_VML_VMLDRAWING_HXX
+
+#include <map>
+#include <memory>
+#include <vector>
+#include <oox/ole/axcontrol.hxx>
+#include <oox/ole/oleobjecthelper.hxx>
+#include <oox/vml/vmlshapecontainer.hxx>
+#include "oox/dllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace awt { struct Rectangle; }
+ namespace awt { class XControlModel; }
+ namespace drawing { class XDrawPage; }
+ namespace drawing { class XShape; }
+ namespace drawing { class XShapes; }
+} } }
+
+namespace oox {
+ namespace core { class XmlFilterBase; }
+ namespace ole { class EmbeddedControl; }
+}
+
+namespace oox {
+namespace vml {
+
+class ShapeBase;
+struct ClientData;
+
+// ============================================================================
+
+/** Enumerates different types of VML drawings. */
+enum DrawingType
+{
+ VMLDRAWING_WORD, ///< Word: One shape per drawing.
+ VMLDRAWING_EXCEL, ///< Excel: OLE objects are part of VML.
+ VMLDRAWING_POWERPOINT ///< PowerPoint: OLE objects are part of DrawingML.
+};
+
+// ============================================================================
+
+/** Contains information about an OLE object embedded in a draw page. */
+struct OOX_DLLPUBLIC OleObjectInfo : public ::oox::ole::OleObjectInfo
+{
+ OUString maShapeId; ///< Shape identifier for shape lookup.
+ OUString maName; ///< Programmatical name of the OLE object.
+ bool mbAutoLoad;
+ const bool mbDmlShape; ///< True = DrawingML shape (PowerPoint), false = VML shape (Excel/Word).
+
+ explicit OleObjectInfo( bool bDmlShape = false );
+
+ /** Sets the string representation of the passed numeric shape identifier. */
+ void setShapeId( sal_Int32 nShapeId );
+};
+
+// =========================================/===================================
+
+/** Contains information about a form control embedded in a draw page. */
+struct OOX_DLLPUBLIC ControlInfo
+{
+ OUString maShapeId; ///< Shape identifier for shape lookup.
+ OUString maFragmentPath; ///< Path to the fragment describing the form control properties.
+ OUString maName; ///< Programmatical name of the form control.
+
+ explicit ControlInfo();
+
+ /** Sets the string representation of the passed numeric shape identifier. */
+ void setShapeId( sal_Int32 nShapeId );
+};
+
+// ============================================================================
+
+/** Represents the collection of VML shapes for a complete draw page. */
+class OOX_DLLPUBLIC Drawing
+{
+public:
+ explicit Drawing(
+ ::oox::core::XmlFilterBase& rFilter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& rxDrawPage,
+ DrawingType eType );
+
+ virtual ~Drawing();
+
+ /** Returns the filter object that imports/exports this VML drawing. */
+ inline ::oox::core::XmlFilterBase& getFilter() const { return mrFilter; }
+ /** Returns the application type containing the drawing. */
+ inline DrawingType getType() const { return meType; }
+ /** Returns read/write access to the container of shapes and templates. */
+ inline ShapeContainer& getShapes() { return *mxShapes; }
+ /** Returns read access to the container of shapes and templates. */
+ inline const ShapeContainer& getShapes() const { return *mxShapes; }
+ /** Returns the form object used to process ActiveX form controls. */
+ ::oox::ole::EmbeddedForm& getControlForm() const;
+
+ /** Registers a block of shape identifiers reserved by this drawing. Block
+ size is 1024, shape identifiers are one-based (block 1 => 1025-2048). */
+ void registerBlockId( sal_Int32 nBlockId );
+ /** Registers the passed embedded OLE object. The related shape will then
+ load the OLE object data from the specified fragment. */
+ void registerOleObject( const OleObjectInfo& rOleObject );
+ /** Registers the passed embedded form control. The related shape will then
+ load the control properties from the specified fragment. */
+ void registerControl( const ControlInfo& rControl );
+
+ /** Final processing after import of the fragment. */
+ void finalizeFragmentImport();
+
+ /** Creates and inserts all UNO shapes into the draw page. The virtual
+ function notifyXShapeInserted() will be called for each new shape. */
+ void convertAndInsert() const;
+
+ /** Returns the local shape index from the passed global shape identifier. */
+ sal_Int32 getLocalShapeIndex( const OUString& rShapeId ) const;
+ /** Returns the registered info structure for an OLE object, if extant. */
+ const OleObjectInfo* getOleObjectInfo( const OUString& rShapeId ) const;
+ /** Returns the registered info structure for a form control, if extant. */
+ const ControlInfo* getControlInfo( const OUString& rShapeId ) const;
+
+ /** Creates a new UNO shape object, inserts it into the passed UNO shape
+ container, and sets the shape position and size. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createAndInsertXShape(
+ const OUString& rService,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle& rShapeRect ) const;
+
+ /** Creates a new UNO shape object for a form control, inserts the control
+ model into the form, and the shape into the passed UNO shape container. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createAndInsertXControlShape(
+ const ::oox::ole::EmbeddedControl& rControl,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle& rShapeRect,
+ sal_Int32& rnCtrlIndex ) const;
+
+ /** Derived classes may disable conversion of specific shapes. */
+ virtual bool isShapeSupported( const ShapeBase& rShape ) const;
+
+ /** Derived classes may return additional base names for automatic shape
+ name creation. */
+ virtual OUString getShapeBaseName( const ShapeBase& rShape ) const;
+
+ /** Derived classes may calculate the shape rectangle from a non-standard
+ anchor information string. */
+ virtual bool convertClientAnchor(
+ ::com::sun::star::awt::Rectangle& orShapeRect,
+ const OUString& rShapeAnchor ) const;
+
+ /** Derived classes create a UNO shape according to the passed shape model.
+ Called for shape models that specify being under host control. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createAndInsertClientXShape(
+ const ShapeBase& rShape,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle& rShapeRect ) const;
+
+ /** Derived classes may want to know that a UNO shape has been inserted.
+ Will be called from the convertAndInsert() implementation.
+ @param bGroupChild True = inserted into a group shape,
+ false = inserted directly into this drawing. */
+ virtual void notifyXShapeInserted(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape,
+ const ::com::sun::star::awt::Rectangle& rShapeRect,
+ const ShapeBase& rShape, bool bGroupChild );
+
+private:
+ typedef ::std::vector< sal_Int32 > BlockIdVector;
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ typedef ::std::auto_ptr< ::oox::ole::EmbeddedForm > EmbeddedFormPtr;
+ typedef ::std::auto_ptr< ShapeContainer > ShapeContainerPtr;
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+ typedef ::std::map< OUString, OleObjectInfo > OleObjectInfoMap;
+ typedef ::std::map< OUString, ControlInfo > ControlInfoMap;
+
+ ::oox::core::XmlFilterBase& mrFilter; ///< Filter object that imports/exports the VML drawing.
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >
+ mxDrawPage; ///< UNO draw page used to insert the shapes.
+ mutable EmbeddedFormPtr mxCtrlForm; ///< The control form used to process embedded controls.
+ mutable BlockIdVector maBlockIds; ///< Block identifiers used by this drawing.
+ ShapeContainerPtr mxShapes; ///< All shapes and shape templates.
+ OleObjectInfoMap maOleObjects; ///< Info about all embedded OLE objects, mapped by shape id.
+ ControlInfoMap maControls; ///< Info about all embedded form controls, mapped by control name.
+ const DrawingType meType; ///< Application type containing the drawing.
+};
+
+// ============================================================================
+
+} // namespace vml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/vml/vmldrawingfragment.hxx b/include/oox/vml/vmldrawingfragment.hxx
new file mode 100644
index 000000000000..f0947998a092
--- /dev/null
+++ b/include/oox/vml/vmldrawingfragment.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_VML_VMLDRAWINGFRAGMENT_HXX
+#define OOX_VML_VMLDRAWINGFRAGMENT_HXX
+
+#include "oox/core/fragmenthandler2.hxx"
+#include "oox/dllapi.h"
+
+namespace oox {
+namespace vml {
+
+class Drawing;
+
+// ============================================================================
+
+class OOX_DLLPUBLIC DrawingFragment : public ::oox::core::FragmentHandler2
+{
+public:
+ explicit DrawingFragment(
+ ::oox::core::XmlFilterBase& rFilter,
+ const OUString& rFragmentPath,
+ Drawing& rDrawing );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ openFragmentStream() const;
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+
+ virtual void finalizeImport();
+
+private:
+ Drawing& mrDrawing;
+};
+
+// ============================================================================
+
+} // namespace vml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/vml/vmlformatting.hxx b/include/oox/vml/vmlformatting.hxx
new file mode 100644
index 000000000000..79fa38009e4d
--- /dev/null
+++ b/include/oox/vml/vmlformatting.hxx
@@ -0,0 +1,248 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_VML_VMLFORMATTING_HXX
+#define OOX_VML_VMLFORMATTING_HXX
+
+#include "oox/helper/helper.hxx"
+#include "oox/dllapi.h"
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+
+#include <vector>
+
+namespace oox {
+ class GraphicHelper;
+ namespace drawingml { class Color; }
+ namespace drawingml { class ShapePropertyMap; }
+}
+
+namespace oox {
+namespace vml {
+
+// ============================================================================
+
+typedef ::std::pair< sal_Int32, sal_Int32 > Int32Pair;
+typedef ::std::pair< double, double > DoublePair;
+
+// ============================================================================
+
+class OOX_DLLPUBLIC ConversionHelper
+{
+public:
+ /** Returns two values contained in rValue separated by cSep.
+ */
+ static bool separatePair(
+ OUString& orValue1, OUString& orValue2,
+ const OUString& rValue, sal_Unicode cSep );
+
+ /** Returns the boolean value from the passed string of a VML attribute.
+ Supported values: 'f', 't', 'false', 'true'. False for anything else.
+ */
+ static bool decodeBool( const OUString& rValue );
+
+ /** Converts the passed VML percentage measure string to a normalized
+ floating-point value.
+
+ @param rValue The VML percentage value. This is a floating-point value
+ with optional following '%' or 'f' sign. If the sign is missing, the
+ floating point value will be returned unmodified. If the '%' sign
+ is present, the value will be divided by 100. If the 'f' sign is present,
+ the value will be divided by 65536.
+ */
+ static double decodePercent(
+ const OUString& rValue,
+ double fDefValue );
+
+ /** Converts the passed VML measure string to EMU (English Metric Units).
+
+ @param rGraphicHelper The graphic helper needed to perform pixel
+ conversion according to the current output device.
+
+ @param rValue The VML measure value. This is a floating-point value
+ with optional measure string following the value.
+
+ @param nRefValue Reference value needed for percentage measure.
+
+ @param bPixelX Set to true if the value is oriented horizontally (e.g.
+ X coordinates, widths). Set to false if the value is oriented
+ vertically (e.g. Y coordinates, heights). This is needed because
+ output devices may specify different width and height for a pixel.
+
+ @param bDefaultAsPixel Set to true if omitted measure unit means
+ pixel. Set to false if omitted measure unit means EMU.
+ */
+ static sal_Int64 decodeMeasureToEmu(
+ const GraphicHelper& rGraphicHelper,
+ const OUString& rValue,
+ sal_Int32 nRefValue,
+ bool bPixelX,
+ bool bDefaultAsPixel );
+
+ /** Converts the passed VML measure string to 1/100 mm.
+
+ @param rGraphicHelper See above.
+ @param rValue See above.
+ @param nRefValue See above.
+ @param bPixelX See above.
+ @param bDefaultAsPixel See above.
+ */
+ static sal_Int32 decodeMeasureToHmm(
+ const GraphicHelper& rGraphicHelper,
+ const OUString& rValue,
+ sal_Int32 nRefValue,
+ bool bPixelX,
+ bool bDefaultAsPixel );
+
+ /** Converts VML color attributes to a DrawingML color.
+
+ @param roVmlColor The VML string representation of the color. If
+ existing, this can be a 3-digit or 6-digit hexadecimal RGB value
+ with leading '#' character, a predefined color name (e.g. 'black',
+ 'red', etc.), the index into an application defined color palette
+ in brackets with leading color name (e.g. 'red [9]' or
+ 'windowColor [64]'), or a color modifier used in one-color
+ gradients (e.g. 'fill darken(128)' or 'fill lighten(0)').
+
+ @param roVmlOpacity The opacity of the color. If existing, this should
+ be a floating-point value in the range [0.0;1.0].
+
+ @param nDefaultRgb Deafult RGB color used if the parameter roVmlColor
+ is empty.
+
+ @param nPrimaryRgb If set to something else than API_RGB_TRANSPARENT,
+ specifies the color to be used to resolve the color modifiers used
+ in one-color gradients.
+
+ @return The resulting DrawingML color.
+ */
+ static ::oox::drawingml::Color decodeColor(
+ const GraphicHelper& rGraphicHelper,
+ const OptValue< OUString >& roVmlColor,
+ const OptValue< double >& roVmlOpacity,
+ sal_Int32 nDefaultRgb,
+ sal_Int32 nPrimaryRgb = API_RGB_TRANSPARENT );
+
+ /** Converts VML path string into point and flag vectors.
+
+ @param rPoints The point vector to fill with coordinates.
+
+ @param rFlags The flag vector to fill. PolygonFlags_NORMAL indicates
+ a corresponding plain shape coordinate in rPoints and
+ PolygonFlags_CONTROL indicates a bezier curve control point.
+
+ @param rPath The VML path string.
+
+ @param rGraphicHelper See above.
+ */
+ static void decodeVmlPath(
+ ::std::vector< ::std::vector< ::com::sun::star::awt::Point > >& rPoints,
+ ::std::vector< ::std::vector< ::com::sun::star::drawing::PolygonFlags > >& rFlags,
+ const OUString& rPath );
+
+private:
+ ConversionHelper();
+ ~ConversionHelper();
+};
+
+// ============================================================================
+
+/** The stroke arrow model structure contains all properties for an line end arrow. */
+struct StrokeArrowModel
+{
+ OptValue< sal_Int32 > moArrowType;
+ OptValue< sal_Int32 > moArrowWidth;
+ OptValue< sal_Int32 > moArrowLength;
+
+ void assignUsed( const StrokeArrowModel& rSource );
+};
+
+// ============================================================================
+
+/** The stroke model structure contains all shape border properties. */
+struct StrokeModel
+{
+ OptValue< bool > moStroked; ///< Shape border line on/off.
+ StrokeArrowModel maStartArrow; ///< Start line arrow style.
+ StrokeArrowModel maEndArrow; ///< End line arrow style.
+ OptValue< OUString > moColor; ///< Solid line color.
+ OptValue< double > moOpacity; ///< Solid line color opacity.
+ OptValue< OUString > moWeight; ///< Line width.
+ OptValue< OUString > moDashStyle; ///< Line dash (predefined or manually).
+ OptValue< sal_Int32 > moLineStyle; ///< Line style (single, double, ...).
+ OptValue< sal_Int32 > moEndCap; ///< Type of line end cap.
+ OptValue< sal_Int32 > moJoinStyle; ///< Type of line join.
+
+ void assignUsed( const StrokeModel& rSource );
+
+ /** Writes the properties to the passed property map. */
+ void pushToPropMap(
+ ::oox::drawingml::ShapePropertyMap& rPropMap,
+ const GraphicHelper& rGraphicHelper ) const;
+};
+
+// ============================================================================
+
+/** The fill model structure contains all shape fill properties. */
+struct OOX_DLLPUBLIC FillModel
+{
+ OptValue< bool > moFilled; ///< Shape fill on/off.
+ OptValue< OUString > moColor; ///< Solid fill color.
+ OptValue< double > moOpacity; ///< Solid fill color opacity.
+ OptValue< OUString > moColor2; ///< End color of gradient.
+ OptValue< double > moOpacity2; ///< End color opacity of gradient.
+ OptValue< sal_Int32 > moType; ///< Fill type.
+ OptValue< sal_Int32 > moAngle; ///< Gradient rotation angle.
+ OptValue< double > moFocus; ///< Linear gradient focus of second color.
+ OptValue< DoublePair > moFocusPos; ///< Rectangular gradient focus position of second color.
+ OptValue< DoublePair > moFocusSize; ///< Rectangular gradient focus size of second color.
+ OptValue< OUString > moBitmapPath; ///< Path to fill bitmap fragment.
+ OptValue< bool > moRotate; ///< True = rotate gradient/bitmap with shape.
+
+ void assignUsed( const FillModel& rSource );
+
+ /** Writes the properties to the passed property map. */
+ void pushToPropMap(
+ ::oox::drawingml::ShapePropertyMap& rPropMap,
+ const GraphicHelper& rGraphicHelper ) const;
+};
+
+// ============================================================================
+
+/** The shadow model structure contains all shape shadow properties. */
+struct OOX_DLLPUBLIC ShadowModel
+{
+ bool mbHasShadow; ///< Is a v:shadow element seen?
+ OptValue<bool> moShadowOn; ///< Is the element turned on?
+ OptValue<OUString> moColor; ///< Specifies the color of the shadow.
+ OptValue<OUString> moOffset; ///< Specifies the shadow's offset from the shape's location.
+ OptValue<double> moOpacity; ///< Specifies the opacity of the shadow.
+
+ ShadowModel();
+
+ /** Writes the properties to the passed property map. */
+ void pushToPropMap(oox::drawingml::ShapePropertyMap& rPropMap, const GraphicHelper& rGraphicHelper) const;
+};
+
+} // namespace vml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/vml/vmlinputstream.hxx b/include/oox/vml/vmlinputstream.hxx
new file mode 100644
index 000000000000..7c8e13160722
--- /dev/null
+++ b/include/oox/vml/vmlinputstream.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_VML_VMLINPUTSTREAM_HXX
+#define OOX_VML_VMLINPUTSTREAM_HXX
+
+#include <com/sun/star/io/XInputStream.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <rtl/string.hxx>
+
+namespace com { namespace sun { namespace star {
+ namespace io { class XTextInputStream2; }
+ namespace uno { class XComponentContext; }
+} } }
+
+namespace oox {
+namespace vml {
+
+// ============================================================================
+
+typedef ::cppu::WeakImplHelper1< ::com::sun::star::io::XInputStream > InputStream_BASE;
+
+/** An input stream class for VML streams, implementing the UNO interface
+ com.sun.star.io.XInputStream needed by the Expat XML parsers.
+
+ This stream reads the data from the input stream passed to the constructor,
+ and parses all XML elements for features unsupported by the current Expat
+ XML parser:
+
+ 1) All elements that have the form '<![inst]>' where 'inst' is any string
+ not containing the characters '<' and '>' are stripped from the input
+ stream.
+
+ 2) Multiple occurences of the same attribute in an element but the last
+ are removed.
+
+ 3) Line breaks represented by a single <br> element (without matching
+ </br> element) are replaced by a literal LF character.
+ */
+class InputStream : public InputStream_BASE
+{
+public:
+ explicit InputStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm );
+ virtual ~InputStream();
+
+ virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& rData, sal_Int32 nBytesToRead )
+ throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& rData, sal_Int32 nMaxBytesToRead )
+ throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip )
+ throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL available()
+ throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL closeInput()
+ throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ void updateBuffer() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ OString readToElementBegin() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ OString readToElementEnd() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextInputStream2 >
+ mxTextStrm;
+ ::com::sun::star::uno::Sequence< sal_Unicode > maOpeningBracket;
+ ::com::sun::star::uno::Sequence< sal_Unicode > maClosingBracket;
+ const OString maOpeningCData;
+ const OString maClosingCData;
+ OString maBuffer;
+ sal_Int32 mnBufferPos;
+};
+
+// ============================================================================
+
+} // namespace vml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/vml/vmlshape.hxx b/include/oox/vml/vmlshape.hxx
new file mode 100644
index 000000000000..7b6a4a9376c7
--- /dev/null
+++ b/include/oox/vml/vmlshape.hxx
@@ -0,0 +1,439 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_VML_VMLSHAPE_HXX
+#define OOX_VML_VMLSHAPE_HXX
+
+#include <memory>
+#include <vector>
+#include <com/sun/star/awt/Point.hpp>
+#include "oox/vml/vmlformatting.hxx"
+#include "oox/vml/vmltextbox.hxx"
+#include "oox/dllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace awt { struct Rectangle; }
+ namespace drawing { class XShape; }
+ namespace drawing { class XShapes; }
+} } }
+
+namespace oox {
+namespace vml {
+
+class Drawing;
+struct ShapeParentAnchor;
+class ShapeContainer;
+
+// ============================================================================
+
+const sal_Int32 VML_CLIENTDATA_UNCHECKED = 0;
+const sal_Int32 VML_CLIENTDATA_CHECKED = 1;
+const sal_Int32 VML_CLIENTDATA_MIXED = 2;
+
+const sal_Int32 VML_CLIENTDATA_TEXT = 0;
+const sal_Int32 VML_CLIENTDATA_INTEGER = 1;
+const sal_Int32 VML_CLIENTDATA_NUMBER = 2;
+const sal_Int32 VML_CLIENTDATA_REFERENCE = 3;
+const sal_Int32 VML_CLIENTDATA_FORMULA = 4;
+
+// ============================================================================
+
+/** The shape model structure contains all properties shared by all types of shapes. */
+struct OOX_DLLPUBLIC ShapeTypeModel
+{
+ OUString maShapeId; ///< Unique identifier of the shape.
+ OUString maShapeName; ///< Name of the shape, if present.
+ OptValue< sal_Int32 > moShapeType; ///< Builtin shape type identifier.
+
+ OptValue< Int32Pair > moCoordPos; ///< Top-left position of coordinate system for children scaling.
+ OptValue< Int32Pair > moCoordSize; ///< Size of coordinate system for children scaling.
+ OUString maPosition; ///< Position type of the shape.
+ OUString maLeft; ///< X position of the shape bounding box (number with unit).
+ OUString maTop; ///< Y position of the shape bounding box (number with unit).
+ OUString maWidth; ///< Width of the shape bounding box (number with unit).
+ OUString maHeight; ///< Height of the shape bounding box (number with unit).
+ OUString maMarginLeft; ///< X position of the shape bounding box to shape anchor (number with unit).
+ OUString maMarginTop; ///< Y position of the shape bounding box to shape anchor (number with unit).
+ OUString maPositionHorizontalRelative; ///< The X position is relative to this.
+ OUString maPositionVerticalRelative; ///< The Y position is relative to this.
+ OUString maPositionHorizontal; ///< The X position orientation (default: absolute).
+ OUString maPositionVertical; ///< The Y position orientation.
+ OUString maWidthPercent; ///< The width in percents of the WidthRelative
+ OUString maHeightPercent; ///< The height in percents of the HeightRelative
+ OUString maWidthRelative; ///< To what the width is relative
+ OUString maHeightRelative; ///< To what the height is relative
+ OUString maRotation; ///< Rotation of the shape, in degrees.
+ OUString maFlip; ///< Flip type of the shape (can be "x" or "y").
+ sal_Bool mbAutoHeight; ///< If true, the height value is a minimum value (mostly used for textboxes)
+ sal_Bool mbVisible; ///< Visible or Hidden
+ OUString maWrapStyle; ///< Wrapping mode for text.
+ OUString maArcsize; ///< round rectangles arc size
+
+ StrokeModel maStrokeModel; ///< Border line formatting.
+ FillModel maFillModel; ///< Shape fill formatting.
+ ShadowModel maShadowModel; ///< Shape shadow formatting.
+
+ OptValue< OUString > moGraphicPath; ///< Path to a graphic for this shape.
+ OptValue< OUString > moGraphicTitle; ///< Title of the graphic.
+ OptValue< OUString > moWrapAnchorX; ///< The base object from which our horizontal positioning should be calculated.
+ OptValue< OUString > moWrapAnchorY; ///< The base object from which our vertical positioning should be calculated.
+
+ explicit ShapeTypeModel();
+
+ void assignUsed( const ShapeTypeModel& rSource );
+};
+
+// ----------------------------------------------------------------------------
+
+/** A shape template contains all formatting properties of shapes and can serve
+ as templates for several shapes in a drawing. */
+class ShapeType
+{
+public:
+ explicit ShapeType( Drawing& rDrawing );
+ virtual ~ShapeType();
+
+ /** Returns read/write access to the shape template model structure. */
+ inline ShapeTypeModel& getTypeModel() { return maTypeModel; }
+ /** Returns read access to the shape template model structure. */
+ inline const ShapeTypeModel& getTypeModel() const { return maTypeModel; }
+
+ /** Returns the shape identifier (which is unique through the containing drawing). */
+ inline const OUString& getShapeId() const { return maTypeModel.maShapeId; }
+ /** Returns the application defined shape type. */
+ sal_Int32 getShapeType() const;
+ /** Returns the fragment path to the embedded graphic used by this shape. */
+ OUString getGraphicPath() const;
+
+ const Drawing& getDrawing() const { return mrDrawing; }
+
+protected:
+ /** Returns the coordinate system of this shape. */
+ ::com::sun::star::awt::Rectangle getCoordSystem() const;
+ /** Returns the absolute shape rectangle according to the passed anchor. */
+ ::com::sun::star::awt::Rectangle getRectangle( const ShapeParentAnchor* pParentAnchor ) const;
+ /** Returns the absolute shape rectangle. */
+ virtual ::com::sun::star::awt::Rectangle getAbsRectangle() const;
+ /** Returns the rectangle relative to the parent coordinate system. */
+ virtual ::com::sun::star::awt::Rectangle getRelRectangle() const;
+
+protected:
+ Drawing& mrDrawing; ///< The VML drawing page that contains this shape.
+ ShapeTypeModel maTypeModel; ///< The model structure containing shape type data.
+};
+
+// ============================================================================
+
+/** Excel specific shape client data (such as cell anchor). */
+struct ClientData
+{
+ OUString maAnchor; ///< Cell anchor as comma-separated string.
+ OUString maFmlaMacro; ///< Link to macro associated to the control.
+ OUString maFmlaPict; ///< Target cell range of picture links.
+ OUString maFmlaLink; ///< Link to value cell associated to the control.
+ OUString maFmlaRange; ///< Link to cell range used as data source for the control.
+ OUString maFmlaGroup; ///< Link to value cell associated to a group of option buttons.
+ sal_Int32 mnObjType; ///< Type of the shape.
+ sal_Int32 mnTextHAlign; ///< Horizontal text alignment.
+ sal_Int32 mnTextVAlign; ///< Vertical text alignment.
+ sal_Int32 mnCol; ///< Column index for spreadsheet cell note.
+ sal_Int32 mnRow; ///< Row index for spreadsheet cell note.
+ sal_Int32 mnChecked; ///< State for checkboxes and option buttons.
+ sal_Int32 mnDropStyle; ///< Drop down box style (read-only or editable).
+ sal_Int32 mnDropLines; ///< Number of lines in drop down box.
+ sal_Int32 mnVal; ///< Current value of spin buttons and scroll bars.
+ sal_Int32 mnMin; ///< Minimum value of spin buttons and scroll bars.
+ sal_Int32 mnMax; ///< Maximum value of spin buttons and scroll bars.
+ sal_Int32 mnInc; ///< Small increment of spin buttons and scroll bars.
+ sal_Int32 mnPage; ///< Large increment of spin buttons and scroll bars.
+ sal_Int32 mnSelType; ///< Listbox selection type.
+ sal_Int32 mnVTEdit; ///< Data type of the textbox.
+ bool mbPrintObject; ///< True = print the object.
+ bool mbVisible; ///< True = cell note is visible.
+ bool mbDde; ///< True = object is linked through DDE.
+ bool mbNo3D; ///< True = flat style, false = 3D style.
+ bool mbNo3D2; ///< True = flat style, false = 3D style (listboxes and dropdowns).
+ bool mbMultiLine; ///< True = textbox allows line breaks.
+ bool mbVScroll; ///< True = textbox has a vertical scrollbar.
+ bool mbSecretEdit; ///< True = textbox is a password edit field.
+
+ explicit ClientData();
+};
+
+// ----------------------------------------------------------------------------
+
+struct ShapeModel
+{
+ typedef ::std::vector< ::com::sun::star::awt::Point > PointVector;
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ typedef ::std::auto_ptr< TextBox > TextBoxPtr;
+ typedef ::std::auto_ptr< ClientData > ClientDataPtr;
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+
+ OUString maType; ///< Shape template with default properties.
+ PointVector maPoints; ///< Points for the polyline shape.
+ TextBoxPtr mxTextBox; ///< Text contents and properties.
+ ClientDataPtr mxClientData; ///< Excel specific client data.
+ OUString maLegacyDiagramPath;///< Legacy Diagram Fragment Path
+ OUString maFrom; ///< Start point for line shape.
+ OUString maTo; ///< End point for line shape.
+ OUString maControl1; ///< Bezier control point 1
+ OUString maControl2; ///< Bezier control point 2
+ OUString maVmlPath; ///< VML path for this shape
+
+ explicit ShapeModel();
+ ~ShapeModel();
+
+ /** Creates and returns a new shape textbox structure. */
+ TextBox& createTextBox(ShapeTypeModel& rModel);
+ /** Creates and returns a new shape client data structure. */
+ ClientData& createClientData();
+};
+
+// ----------------------------------------------------------------------------
+
+/** A shape object that is part of a drawing. May inherit properties from a
+ shape template. */
+class OOX_DLLPUBLIC ShapeBase : public ShapeType
+{
+public:
+ /** Returns read/write access to the shape model structure. */
+ inline ShapeModel& getShapeModel() { return maShapeModel; }
+ /** Returns read access to the shape model structure. */
+ inline const ShapeModel& getShapeModel() const { return maShapeModel; }
+
+ /** Returns read access to the shape textbox. */
+ inline const TextBox* getTextBox() const { return maShapeModel.mxTextBox.get(); }
+ /** Returns read access to the shape client data structure. */
+ inline const ClientData* getClientData() const { return maShapeModel.mxClientData.get(); }
+
+ /** Final processing after import of the drawing fragment. */
+ virtual void finalizeFragmentImport();
+
+ /** Returns the real shape name if existing, or a generated shape name. */
+ OUString getShapeName() const;
+
+ /** Returns the shape template with the passed identifier from the child shapes. */
+ virtual const ShapeType* getChildTypeById( const OUString& rShapeId ) const;
+ /** Returns the shape with the passed identifier from the child shapes. */
+ virtual const ShapeBase* getChildById( const OUString& rShapeId ) const;
+
+ /** Creates the corresponding XShape and inserts it into the passed container. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ convertAndInsert(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ShapeParentAnchor* pParentAnchor = 0 ) const;
+
+ /** Converts position and formatting into the passed existing XShape. */
+ void convertFormatting(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape,
+ const ShapeParentAnchor* pParentAnchor = 0 ) const;
+
+protected:
+ explicit ShapeBase( Drawing& rDrawing );
+
+ /** Derived classes create the corresponding XShape and insert it into the passed container. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ implConvertAndInsert(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle& rShapeRect ) const = 0;
+
+ /** Calculates the final shape rectangle according to the passed anchor,
+ if present, otherwise according to the own anchor settings. */
+ ::com::sun::star::awt::Rectangle calcShapeRectangle(
+ const ShapeParentAnchor* pParentAnchor ) const;
+
+ /** Converts common shape properties such as formatting attributes. */
+ void convertShapeProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape ) const;
+
+protected:
+ ShapeModel maShapeModel; ///< The model structure containing shape data.
+};
+
+// ============================================================================
+
+/** A simple shape object based on a specific UNO shape service. */
+class SimpleShape : public ShapeBase
+{
+public:
+ explicit SimpleShape( Drawing& rDrawing, const OUString& rService );
+
+ void setService( OUString aService ) { maService = aService; }
+
+protected:
+ /** Creates the corresponding XShape and inserts it into the passed container. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ implConvertAndInsert(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle& rShapeRect ) const;
+ /** Used by both RectangleShape and ComplexShape. */
+ com::sun::star::uno::Reference<com::sun::star::drawing::XShape>createPictureObject(
+ const com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rxShapes,
+ const com::sun::star::awt::Rectangle& rShapeRect, OUString& rGraphicPath ) const;
+
+private:
+ OUString maService; ///< Name of the UNO shape service.
+};
+
+// ============================================================================
+
+/** A rectangular shape object. */
+class RectangleShape : public SimpleShape
+{
+public:
+ explicit RectangleShape( Drawing& rDrawing );
+protected:
+ /** Creates the corresponding XShape and inserts it into the passed container. */
+ virtual com::sun::star::uno::Reference<com::sun::star::drawing::XShape>
+ implConvertAndInsert(
+ const com::sun::star::uno::Reference<com::sun::star::drawing::XShapes>& rxShapes,
+ const com::sun::star::awt::Rectangle& rShapeRect) const;
+};
+
+// ============================================================================
+
+/** An oval shape object. */
+class EllipseShape : public SimpleShape
+{
+public:
+ explicit EllipseShape( Drawing& rDrawing );
+};
+
+// ============================================================================
+
+/** A polygon shape object. */
+class PolyLineShape : public SimpleShape
+{
+public:
+ explicit PolyLineShape( Drawing& rDrawing );
+
+protected:
+ /** Creates the corresponding XShape and inserts it into the passed container. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ implConvertAndInsert(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle& rShapeRect ) const;
+};
+
+/** A Line shape object. */
+class LineShape : public SimpleShape
+{
+public:
+ explicit LineShape( Drawing& rDrawing );
+
+protected:
+ /** Returns the absolute shape rectangle. */
+ virtual ::com::sun::star::awt::Rectangle getAbsRectangle() const SAL_OVERRIDE;
+ /** Returns the rectangle relative to the parent coordinate system. */
+ virtual ::com::sun::star::awt::Rectangle getRelRectangle() const SAL_OVERRIDE;
+};
+
+/** Bezier shape object that supports to, from, control1 and control2
+ attribute or path attribute specification */
+class BezierShape : public SimpleShape
+{
+public:
+ explicit BezierShape( Drawing& rDrawing );
+
+protected:
+ /** Creates the corresponding XShape and inserts it into the passed container. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ implConvertAndInsert(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle& rShapeRect ) const;
+};
+
+// ============================================================================
+
+/** A shape object with custom geometry. */
+class CustomShape : public SimpleShape
+{
+public:
+ explicit CustomShape( Drawing& rDrawing );
+
+protected:
+ /** Creates the corresponding XShape and inserts it into the passed container. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ implConvertAndInsert(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle& rShapeRect ) const;
+};
+
+// ============================================================================
+
+/** A complex shape object. This can be a picture shape, a custom shape, an OLE
+ object, or an ActiveX form control. */
+class ComplexShape : public CustomShape
+{
+public:
+ explicit ComplexShape( Drawing& rDrawing );
+
+protected:
+ /** Creates the corresponding XShape and inserts it into the passed container. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ implConvertAndInsert(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle& rShapeRect ) const;
+};
+
+// ============================================================================
+
+/** A group shape that extends the basic shape by a container of child shapes. */
+class GroupShape : public ShapeBase
+{
+public:
+ explicit GroupShape( Drawing& rDrawing );
+ virtual ~GroupShape();
+
+ /** Returns read/write access to the container of child shapes and templates. */
+ inline ShapeContainer& getChildren() { return *mxChildren; }
+ /** Returns read access to the container of child shapes and templates. */
+ inline const ShapeContainer& getChildren() const { return *mxChildren; }
+
+ /** Final processing after import of the drawing fragment. */
+ virtual void finalizeFragmentImport();
+
+ /** Returns the shape template with the passed identifier from the child shapes. */
+ virtual const ShapeType* getChildTypeById( const OUString& rShapeId ) const;
+ /** Returns the shape with the passed identifier from the child shapes. */
+ virtual const ShapeBase* getChildById( const OUString& rShapeId ) const;
+
+protected:
+ /** Creates the corresponding XShape and inserts it into the passed container. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ implConvertAndInsert(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle& rShapeRect ) const;
+
+private:
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ typedef ::std::auto_ptr< ShapeContainer > ShapeContainerPtr;
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+ ShapeContainerPtr mxChildren; ///< Shapes and templates that are part of this group.
+};
+
+// ============================================================================
+
+} // namespace vml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/vml/vmlshapecontainer.hxx b/include/oox/vml/vmlshapecontainer.hxx
new file mode 100644
index 000000000000..5e6a2c2a9d75
--- /dev/null
+++ b/include/oox/vml/vmlshapecontainer.hxx
@@ -0,0 +1,153 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_VML_VMLSHAPECONTAINER_HXX
+#define OOX_VML_VMLSHAPECONTAINER_HXX
+
+#include <com/sun/star/awt/Rectangle.hpp>
+#include "oox/helper/refmap.hxx"
+#include "oox/helper/refvector.hxx"
+#include <stack>
+
+namespace com { namespace sun { namespace star {
+ namespace drawing { class XShapes; }
+} } }
+
+namespace oox {
+namespace vml {
+
+class Drawing;
+class ShapeType;
+class ShapeBase;
+
+// ============================================================================
+
+struct ShapeParentAnchor
+{
+ ::com::sun::star::awt::Rectangle maShapeRect;
+ ::com::sun::star::awt::Rectangle maCoordSys;
+};
+
+// ============================================================================
+
+/** Container that holds a list of shapes and shape templates. */
+class ShapeContainer
+{
+public:
+ explicit ShapeContainer( Drawing& rDrawing );
+ ~ShapeContainer();
+
+ /** Returns the drawing this shape container is part of. */
+ inline Drawing& getDrawing() { return mrDrawing; }
+
+ /** Creates and returns a new shape template object. */
+ ShapeType& createShapeType();
+ /** Creates and returns a new shape object of the specified type. */
+ template< typename ShapeT >
+ ShapeT& createShape();
+
+ /** Final processing after import of the drawing fragment. */
+ void finalizeFragmentImport();
+
+ /** Returns true, if this container does not contain any shapes. */
+ inline bool empty() const { return maShapes.empty(); }
+
+ /** Returns the shape template with the passed identifier.
+ @param bDeep True = searches in all group shapes too. */
+ const ShapeType* getShapeTypeById( const OUString& rShapeId, bool bDeep ) const;
+ /** Returns the shape with the passed identifier.
+ @param bDeep True = searches in all group shapes too. */
+ const ShapeBase* getShapeById( const OUString& rShapeId, bool bDeep ) const;
+
+ /** Searches for a shape type by using the passed functor that takes a
+ constant reference of a ShapeType object. */
+ template< typename Functor >
+ const ShapeType* findShapeType( const Functor& rFunctor ) const;
+ /** Searches for a shape by using the passed functor that takes a constant
+ reference of a ShapeBase object. */
+ template< typename Functor >
+ const ShapeBase* findShape( const Functor& rFunctor ) const;
+
+ /**
+ (Word only) Returns the last shape in the collection, if it is after the last
+ mark from pushMark(), and removes it.
+ */
+ boost::shared_ptr< ShapeBase > takeLastShape();
+ /**
+ Adds a recursion mark to the stack. It is possible that a shape contains <w:txbxContent>
+ which contains another shape, and writerfilter needs to know which shape is from the inner
+ ooxml context and which from the outer ooxml context, while it is necessary to keep
+ at least shape types across such blocks. Therefore this function marks beginning
+ of each shape xml block, and takeLastShape() returns only shapes from this block.
+ */
+ void pushMark();
+ /**
+ Removes a recursion mark.
+ */
+ void popMark();
+
+ /** Creates and inserts all UNO shapes into the passed container. */
+ void convertAndInsert(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ShapeParentAnchor* pParentAnchor = 0 ) const;
+
+private:
+ typedef RefVector< ShapeType > ShapeTypeVector;
+ typedef RefVector< ShapeBase > ShapeVector;
+ typedef RefMap< OUString, ShapeType > ShapeTypeMap;
+ typedef RefMap< OUString, ShapeBase > ShapeMap;
+
+ Drawing& mrDrawing; ///< The VML drawing page that contains this shape.
+ ShapeTypeVector maTypes; ///< All shape templates.
+ ShapeVector maShapes; ///< All shape definitions.
+ ShapeTypeMap maTypesById; ///< All shape templates mapped by identifier.
+ ShapeMap maShapesById; ///< All shape definitions mapped by identifier.
+ std::stack< size_t > markStack; ///< Recursion marks from pushMark()/popMark().
+};
+
+// ----------------------------------------------------------------------------
+
+template< typename ShapeT >
+ShapeT& ShapeContainer::createShape()
+{
+ ::boost::shared_ptr< ShapeT > xShape( new ShapeT( mrDrawing ) );
+ maShapes.push_back( xShape );
+ return *xShape;
+}
+
+template< typename Functor >
+const ShapeType* ShapeContainer::findShapeType( const Functor& rFunctor ) const
+{
+ return maTypes.findIf( rFunctor ).get();
+}
+
+template< typename Functor >
+const ShapeBase* ShapeContainer::findShape( const Functor& rFunctor ) const
+{
+ return maShapes.findIf( rFunctor ).get();
+}
+
+// ============================================================================
+
+} // namespace vml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/vml/vmlshapecontext.hxx b/include/oox/vml/vmlshapecontext.hxx
new file mode 100644
index 000000000000..803674088e37
--- /dev/null
+++ b/include/oox/vml/vmlshapecontext.hxx
@@ -0,0 +1,188 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_VML_VMLSHAPECONTEXT_HXX
+#define OOX_VML_VMLSHAPECONTEXT_HXX
+
+#include "oox/core/contexthandler2.hxx"
+
+namespace oox {
+namespace vml {
+
+class Drawing;
+
+struct ShapeTypeModel;
+class ShapeType;
+
+struct ClientData;
+struct ShapeModel;
+class ShapeBase;
+class GroupShape;
+class RectangleShape;
+
+class ShapeContainer;
+
+// ============================================================================
+
+class ShapeLayoutContext : public ::oox::core::ContextHandler2
+{
+public:
+ explicit ShapeLayoutContext(
+ ::oox::core::ContextHandler2Helper& rParent,
+ Drawing& rDrawing );
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+
+private:
+ Drawing& mrDrawing;
+};
+
+// ============================================================================
+
+class ClientDataContext : public ::oox::core::ContextHandler2
+{
+public:
+ explicit ClientDataContext(
+ ::oox::core::ContextHandler2Helper& rParent,
+ ClientData& rClientData,
+ const AttributeList& rAttribs );
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onCharacters( const OUString& rChars );
+ virtual void onEndElement();
+
+private:
+ ClientData& mrClientData;
+ OUString maElementText;
+};
+
+// ============================================================================
+
+class ShapeContextBase : public ::oox::core::ContextHandler2
+{
+public:
+ static ::oox::core::ContextHandlerRef
+ createShapeContext(
+ ::oox::core::ContextHandler2Helper& rParent,
+ ShapeContainer& rShapes,
+ sal_Int32 nElement,
+ const AttributeList& rAttribs );
+
+protected:
+ explicit ShapeContextBase( ::oox::core::ContextHandler2Helper& rParent );
+};
+
+// ============================================================================
+
+class ShapeTypeContext : public ShapeContextBase
+{
+public:
+ explicit ShapeTypeContext(
+ ::oox::core::ContextHandler2Helper& rParent,
+ ShapeType& rShapeType,
+ const AttributeList& rAttribs );
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+
+private:
+ /** Processes the 'style' attribute. */
+ void setStyle( const OUString& rStyle );
+
+ /** Resolve a relation identifier to a fragment path. */
+ OptValue< OUString > decodeFragmentPath( const AttributeList& rAttribs, sal_Int32 nToken ) const;
+
+private:
+ ShapeTypeModel& mrTypeModel;
+};
+
+// ============================================================================
+
+class ShapeContext : public ShapeTypeContext
+{
+public:
+ explicit ShapeContext(
+ ::oox::core::ContextHandler2Helper& rParent,
+ ShapeBase& rShape,
+ const AttributeList& rAttribs );
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+
+private:
+ /** Processes the 'points' attribute. */
+ void setPoints( const OUString& rPoints );
+ /** Processes the 'from' attribute. */
+ void setFrom( const OUString& rPoints );
+ /** Processes the 'to' attribute. */
+ void setTo( const OUString& rPoints );
+ /** Processes the 'control1' attribute. */
+ void setControl1( const OUString& rPoints );
+ /** Processes the 'control2' attribute. */
+ void setControl2( const OUString& rPoints );
+ /** Processes the 'path' attribute. */
+ void setVmlPath( const OUString& rPath );
+
+protected:
+ ShapeBase& mrShape;
+
+private:
+ ShapeModel& mrShapeModel;
+};
+
+// ============================================================================
+
+class GroupShapeContext : public ShapeContext
+{
+public:
+ explicit GroupShapeContext(
+ ::oox::core::ContextHandler2Helper& rParent,
+ GroupShape& rShape,
+ const AttributeList& rAttribs );
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+
+private:
+ ShapeContainer& mrShapes;
+};
+
+// ============================================================================
+
+class RectangleShapeContext : public ShapeContext
+{
+public:
+ explicit RectangleShapeContext(
+ ::oox::core::ContextHandler2Helper& rParent,
+ const AttributeList& rAttribs,
+ RectangleShape& rShape );
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+// ============================================================================
+
+} // namespace vml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/vml/vmltextbox.hxx b/include/oox/vml/vmltextbox.hxx
new file mode 100644
index 000000000000..4975e6bb26b6
--- /dev/null
+++ b/include/oox/vml/vmltextbox.hxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_VML_VMLTEXTBOX_HXX
+#define OOX_VML_VMLTEXTBOX_HXX
+
+#include <vector>
+#include <rtl/ustring.hxx>
+#include "oox/helper/helper.hxx"
+#include "oox/dllapi.h"
+#include <com/sun/star/uno/Reference.h>
+
+namespace com { namespace sun { namespace star {
+ namespace drawing { class XShape; }
+} } }
+
+namespace oox {
+namespace vml {
+
+struct ShapeTypeModel;
+
+// ============================================================================
+
+/** Font settings for a text portion in a textbox. */
+struct OOX_DLLPUBLIC TextFontModel
+{
+ OptValue< OUString > moName; ///< Font name.
+ OptValue< OUString > moColor; ///< Font color, HTML encoded, sort of.
+ OptValue< sal_Int32 > monSize; ///< Font size in twips.
+ OptValue< sal_Int32 > monUnderline; ///< Single or double underline.
+ OptValue< sal_Int32 > monEscapement; ///< Subscript or superscript.
+ OptValue< bool > mobBold;
+ OptValue< bool > mobItalic;
+ OptValue< bool > mobStrikeout;
+
+ explicit TextFontModel();
+};
+
+// ============================================================================
+
+/** A text portion in a textbox with the same formatting for all characters. */
+struct TextPortionModel
+{
+ TextFontModel maFont;
+ OUString maText;
+
+ explicit TextPortionModel( const TextFontModel& rFont, const OUString& rText );
+};
+
+// ============================================================================
+
+/** The textbox contains all text contents and properties. */
+class OOX_DLLPUBLIC TextBox
+{
+public:
+ explicit TextBox(ShapeTypeModel& rTypeModel);
+
+ /** Appends a new text portion to the textbox. */
+ void appendPortion( const TextFontModel& rFont, const OUString& rText );
+
+ /** Returns the current number of text portions. */
+ inline size_t getPortionCount() const { return maPortions.size(); }
+ /** Returns the font settings of the first text portion. */
+ const TextFontModel* getFirstFont() const;
+ /** Returns the entire text of all text portions. */
+ OUString getText() const;
+ void convert(com::sun::star::uno::Reference<com::sun::star::drawing::XShape> xShape) const;
+
+ ShapeTypeModel& mrTypeModel;
+ /// Text distance from the border (inset attribute of v:textbox), valid only if set.
+ bool borderDistanceSet;
+ int borderDistanceLeft, borderDistanceTop, borderDistanceRight, borderDistanceBottom;
+ OUString maLayoutFlow;
+
+private:
+ typedef ::std::vector< TextPortionModel > PortionVector;
+
+ PortionVector maPortions;
+};
+
+// ============================================================================
+
+} // namespace vml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/vml/vmltextboxcontext.hxx b/include/oox/vml/vmltextboxcontext.hxx
new file mode 100644
index 000000000000..47d71ac41b41
--- /dev/null
+++ b/include/oox/vml/vmltextboxcontext.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_VML_VMLTEXTBOXCONTEXT_HXX
+#define OOX_VML_VMLTEXTBOXCONTEXT_HXX
+
+#include "oox/core/contexthandler2.hxx"
+#include "oox/vml/vmltextbox.hxx"
+
+namespace oox {
+namespace vml {
+
+// ============================================================================
+
+class TextPortionContext : public ::oox::core::ContextHandler2
+{
+public:
+ explicit TextPortionContext(
+ ::oox::core::ContextHandler2Helper& rParent,
+ TextBox& rTextBox,
+ const TextFontModel& rParentFont,
+ sal_Int32 nElement,
+ const AttributeList& rAttribs );
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onCharacters( const OUString& rChars );
+ virtual void onStartElement(const AttributeList& rAttribs);
+ virtual void onEndElement();
+
+private:
+ TextBox& mrTextBox;
+ TextFontModel maFont;
+ size_t mnInitialPortions;
+};
+
+// ============================================================================
+
+class TextBoxContext : public ::oox::core::ContextHandler2
+{
+public:
+ explicit TextBoxContext(
+ ::oox::core::ContextHandler2Helper& rParent,
+ TextBox& rTextBox,
+ const AttributeList& rAttribs,
+ const GraphicHelper& graphicHelper );
+
+ virtual ::oox::core::ContextHandlerRef
+ onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+
+private:
+ TextBox& mrTextBox;
+};
+
+// ============================================================================
+
+} // namespace vml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/package/Deflater.hxx b/include/package/Deflater.hxx
new file mode 100644
index 000000000000..7531e3a1ac66
--- /dev/null
+++ b/include/package/Deflater.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _DEFLATER_HXX_
+#define _DEFLATER_HXX_
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include "packagedllapi.hxx"
+
+struct z_stream_s;
+
+namespace ZipUtils {
+
+class DLLPUBLIC_PACKAGE Deflater
+{
+ typedef struct z_stream_s z_stream;
+
+protected:
+ com::sun::star::uno::Sequence< sal_Int8 > sInBuffer;
+ sal_Bool bFinish;
+ sal_Bool bFinished;
+ sal_Bool bSetParams;
+ sal_Int32 nLevel, nStrategy;
+ sal_Int64 nOffset, nLength;
+ z_stream* pStream;
+
+ void init (sal_Int32 nLevel, sal_Int32 nStrategy, sal_Bool bNowrap);
+ sal_Int32 doDeflateBytes (com::sun::star::uno::Sequence < sal_Int8 > &rBuffer, sal_Int32 nNewOffset, sal_Int32 nNewLength);
+
+public:
+ ~Deflater();
+ Deflater(sal_Int32 nSetLevel, sal_Bool bNowrap);
+ void SAL_CALL setInputSegment( const ::com::sun::star::uno::Sequence< sal_Int8 >& rBuffer, sal_Int32 nNewOffset, sal_Int32 nNewLength );
+ void SAL_CALL setLevel( sal_Int32 nNewLevel );
+ sal_Bool SAL_CALL needsInput( );
+ void SAL_CALL finish( );
+ sal_Bool SAL_CALL finished( );
+ sal_Int32 SAL_CALL doDeflateSegment( ::com::sun::star::uno::Sequence< sal_Int8 >& rBuffer, sal_Int32 nNewOffset, sal_Int32 nNewLength );
+ sal_Int64 SAL_CALL getTotalIn( );
+ sal_Int64 SAL_CALL getTotalOut( );
+ void SAL_CALL reset( );
+ void SAL_CALL end( );
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/package/Inflater.hxx b/include/package/Inflater.hxx
new file mode 100644
index 000000000000..284451750e43
--- /dev/null
+++ b/include/package/Inflater.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _INFLATER_HXX_
+#define _INFLATER_HXX_
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include "packagedllapi.hxx"
+
+struct z_stream_s;
+
+namespace ZipUtils {
+
+class DLLPUBLIC_PACKAGE Inflater
+{
+ typedef struct z_stream_s z_stream;
+
+protected:
+ sal_Bool bFinish, bFinished, bSetParams, bNeedDict;
+ sal_Int32 nOffset, nLength, nLastInflateError;
+ z_stream* pStream;
+ com::sun::star::uno::Sequence < sal_Int8 > sInBuffer;
+ sal_Int32 doInflateBytes (com::sun::star::uno::Sequence < sal_Int8 > &rBuffer, sal_Int32 nNewOffset, sal_Int32 nNewLength);
+
+public:
+ Inflater(sal_Bool bNoWrap = sal_False);
+ ~Inflater();
+ void SAL_CALL setInput( const ::com::sun::star::uno::Sequence< sal_Int8 >& rBuffer );
+ sal_Bool SAL_CALL needsDictionary( );
+ sal_Bool SAL_CALL finished( );
+ sal_Int32 SAL_CALL doInflateSegment( ::com::sun::star::uno::Sequence< sal_Int8 >& rBuffer, sal_Int32 nNewOffset, sal_Int32 nNewLength );
+ void SAL_CALL end( );
+
+ sal_Int32 getLastInflateError() { return nLastInflateError; }
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/package/packagedllapi.hxx b/include/package/packagedllapi.hxx
new file mode 100644
index 000000000000..72a3dab60f07
--- /dev/null
+++ b/include/package/packagedllapi.hxx
@@ -0,0 +1,22 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef INCLUDED_PACKAGEDLLAPI_H
+#define INCLUDED_PACKAGEDLLAPI_H
+
+#include "sal/types.h"
+
+#if defined(DLLIMPLEMENTATION_PACKAGE)
+#define DLLPUBLIC_PACKAGE SAL_DLLPUBLIC_EXPORT
+#else
+#define DLLPUBLIC_PACKAGE SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif /* INCLUDED_PACKAGEDLLAPI_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/registry/reader.h b/include/registry/reader.h
new file mode 100644
index 000000000000..263215a92722
--- /dev/null
+++ b/include/registry/reader.h
@@ -0,0 +1,603 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_registry_reader_h
+#define INCLUDED_registry_reader_h
+
+#include "registry/regdllapi.h"
+#include "registry/types.h"
+#include "registry/version.h"
+
+#include "rtl/ustring.h"
+#include "sal/types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ Creates a type reader working on a binary blob that represents a UNOIDL type.
+
+ <p>If a non-null handle is returned through <code>result</code>, its
+ reference count will be one. Operations on a non-null handle are not
+ multi-thread&ndash;safe.</p>
+
+ @param buffer the binary blob representing the type; must point to at least
+ <code>length</code> bytes, and need only be byte-aligned
+
+ @param length the size in bytes of the binary blob representing the type
+
+ @param copy if true, the type reader creates an internal copy of the given
+ buffer, and the given buffer is not accessed after this function returns; if
+ false, the type reader works directly on the given buffer, which must remain
+ available unmodified until the type reader is destroyed
+
+ @param maxVersion the maximum binary blob version the client is prepared to
+ handle; must not be negative
+
+ @param result an out-parameter obtaining a handle on the type reader; must
+ not be null; if the given binary blob is malformed, or of a version larger
+ than <code>maxVersion</code>, null is returned
+
+ @return false iff an out-of-memory condition occurred, in which case
+ <code>result</code> is left unchanged, and no type reader is created
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC sal_Bool SAL_CALL typereg_reader_create(
+ void const * buffer, sal_uInt32 length, sal_Bool copy,
+ enum typereg_Version maxVersion, void ** result)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Increments the reference count of a type reader.
+
+ @param handle a handle on a type reader; may be null
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void SAL_CALL typereg_reader_acquire(void * handle) SAL_THROW_EXTERN_C();
+
+/**
+ Decrements the reference count of a type reader.
+
+ <p>If the reference count drops to zero, the type reader is destroyed.</p>
+
+ @param handle a handle on a type reader; may be null
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void SAL_CALL typereg_reader_release(void * handle) SAL_THROW_EXTERN_C();
+
+/**
+ Returns the binary blob version of a type reader.
+
+ @param handle a handle on a type reader; may be null
+
+ @return the version of the binary blob from which the type reader was
+ constructed; if <code>handle</code> is null, <code>TYPEREG_VERSION_0</code>
+ is returned
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC enum typereg_Version SAL_CALL typereg_reader_getVersion(void * handle)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the documentation of a type reader.
+
+ @param handle a handle on a type reader; may be null
+
+ @param result an out-parameter obtaining the documentation string; must not
+ be null; if <code>handle</code> is null, an empty string is returned; if an
+ out-of-memory condition occurs, a pointer to a null pointer is returned
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void SAL_CALL typereg_reader_getDocumentation(
+ void * handle, rtl_uString ** result) SAL_THROW_EXTERN_C();
+
+/**
+ Returns the file name of a type reader.
+
+ @param handle a handle on a type reader; may be null
+
+ @param result an out-parameter obtaining the file name string; must not be
+ null; if <code>handle</code> is null, an empty string is returned; if an
+ out-of-memory condition occurs, a pointer to a null pointer is returned
+
+ @since UDK 3.2.0
+ @deprecated
+ */
+REG_DLLPUBLIC void SAL_CALL typereg_reader_getFileName(void * handle, rtl_uString ** result)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the type class of a type reader.
+
+ <p>This function will always return the type class without the internal
+ <code>RT_TYPE_PUBLISHED</code> flag set. Use
+ <code>typereg_reader_isPublished</code> to determine whether a type reader is
+ published.</p>
+
+ @param handle a handle on a type reader; may be null
+
+ @return the type class of the type reader; if <code>handle</code> is null,
+ <code>RT_TYPE_INVALID</code> is returned
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC enum RTTypeClass SAL_CALL typereg_reader_getTypeClass(void * handle)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns whether a type reader is published.
+
+ @param handle a handle on a type reader; may be null
+
+ @return whether the type reader is published; if <code>handle</code> is null,
+ <code>sal_False</code> is returned
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC sal_Bool SAL_CALL typereg_reader_isPublished(void * handle)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the type name of a type reader.
+
+ @param handle a handle on a type reader; may be null
+
+ @param result an out-parameter obtaining the type name string; must not be
+ null; if <code>handle</code> is null, an empty string is returned; if an
+ out-of-memory condition occurs, a pointer to a null pointer is returned
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void SAL_CALL typereg_reader_getTypeName(void * handle, rtl_uString ** result)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the number of super types of a type reader.
+
+ @param handle a handle on a type reader; may be null
+
+ @return the number of super types of the type reader; if <code>handle</code>
+ is null, zero is returned
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC sal_uInt16 SAL_CALL typereg_reader_getSuperTypeCount(void * handle)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the type name of a super type of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the super type's type name string;
+ must not be null; if an out-of-memory condition occurs, a pointer to a null
+ pointer is returned
+
+ @param index a valid index into the range of super types of the given type
+ reader
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void SAL_CALL typereg_reader_getSuperTypeName(
+ void * handle, rtl_uString ** result, sal_uInt16 index)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the number of fields of a type reader.
+
+ @param handle a handle on a type reader; may be null
+
+ @return the number of fields of the type reader; if <code>handle</code> is
+ null, zero is returned
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC sal_uInt16 SAL_CALL typereg_reader_getFieldCount(void * handle)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the documentation of a field of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the field's documentation string;
+ must not be null; if an out-of-memory condition occurs, a pointer to a null
+ pointer is returned
+
+ @param index a valid index into the range of fields of the given type reader
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void SAL_CALL typereg_reader_getFieldDocumentation(
+ void * handle, rtl_uString ** result, sal_uInt16 index)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the file name of a field of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the field's file name string; must
+ not be null; if an out-of-memory condition occurs, a pointer to a null
+ pointer is returned
+
+ @param index a valid index into the range of fields of the given type reader
+
+ @since UDK 3.2.0
+ @deprecated
+ */
+REG_DLLPUBLIC void SAL_CALL typereg_reader_getFieldFileName(
+ void * handle, rtl_uString ** result, sal_uInt16 index)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the flags of a field of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param index a valid index into the range of fields of the given type reader
+
+ @return the flags of the given field of the type reader
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC RTFieldAccess SAL_CALL typereg_reader_getFieldFlags(
+ void * handle, sal_uInt16 index) SAL_THROW_EXTERN_C();
+
+/**
+ Returns the name of a field of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the field's name string; must not be
+ null; if an out-of-memory condition occurs, a pointer to a null pointer is
+ returned
+
+ @param index a valid index into the range of fields of the given type reader
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void SAL_CALL typereg_reader_getFieldName(
+ void * handle, rtl_uString ** result, sal_uInt16 index)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the type name of a field of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the field's type name string; must
+ not be null; if an out-of-memory condition occurs, a pointer to a null
+ pointer is returned
+
+ @param index a valid index into the range of fields of the given type reader
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void SAL_CALL typereg_reader_getFieldTypeName(
+ void * handle, rtl_uString ** result, sal_uInt16 index)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the value of a field of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param index a valid index into the range of fields of the given type reader
+
+ @param type an out-parameter obtaining the field value's type; must not be
+ null
+
+ @param value an out-parameter obtaining the field value's value; must not be
+ null
+
+ @return false iff an out-of-memory condition occurred, in which case
+ <code>type</code> and <code>value</code> are left unchanged
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC sal_Bool SAL_CALL typereg_reader_getFieldValue(
+ void * handle, sal_uInt16 index, enum RTValueType * type,
+ union RTConstValueUnion * value)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the number of methods of a type reader.
+
+ @param handle a handle on a type reader; may be null
+
+ @return the number of methods of the type reader; if <code>handle</code> is
+ null, zero is returned
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC sal_uInt16 SAL_CALL typereg_reader_getMethodCount(void * handle)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the documentation of a method of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the methods's documentation string;
+ must not be null; if an out-of-memory condition occurs, a pointer to a null
+ pointer is returned
+
+ @param index a valid index into the range of methods of the given type reader
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void SAL_CALL typereg_reader_getMethodDocumentation(
+ void * handle, rtl_uString ** result, sal_uInt16 index)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the flags of a method of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param index a valid index into the range of methods of the given type reader
+
+ @return the flags of the given method of the type reader
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC enum RTMethodMode SAL_CALL typereg_reader_getMethodFlags(
+ void * handle, sal_uInt16 index) SAL_THROW_EXTERN_C();
+
+/**
+ Returns the name of a method of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the methods's name string; must not
+ be null; if an out-of-memory condition occurs, a pointer to a null pointer is
+ returned
+
+ @param index a valid index into the range of methods of the given type reader
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void SAL_CALL typereg_reader_getMethodName(
+ void * handle, rtl_uString ** result, sal_uInt16 index)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the return type name of a method of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the methods's return type name
+ string; must not be null; if an out-of-memory condition occurs, a pointer to
+ a null pointer is returned
+
+ @param index a valid index into the range of methods of the given type reader
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void SAL_CALL typereg_reader_getMethodReturnTypeName(
+ void * handle, rtl_uString ** result, sal_uInt16 index)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the number of parameters of a method of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param index a valid index into the range of methods of the given type reader
+
+ @return the number of parameters of the given method of the type reader
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC sal_uInt16 SAL_CALL typereg_reader_getMethodParameterCount(
+ void * handle, sal_uInt16 index) SAL_THROW_EXTERN_C();
+
+/**
+ Returns the flags of a parameter of a method of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param methodIndex a valid index into the range of methods of the given type
+ reader
+
+ @param parameterIndex a valid index into the range of parameters of the given
+ method
+
+ @return the flags of the given parameter of the given method of the type
+ reader
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC enum RTParamMode SAL_CALL typereg_reader_getMethodParameterFlags(
+ void * handle, sal_uInt16 methodIndex, sal_uInt16 parameterIndex)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the name of a parameter of a method of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the parameter's name string; must
+ not be null; if an out-of-memory condition occurs, a pointer to a null
+ pointer is returned
+
+ @param methodIndex a valid index into the range of methods of the given type
+ reader
+
+ @param parameterIndex a valid index into the range of parameters of the given
+ method
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void SAL_CALL typereg_reader_getMethodParameterName(
+ void * handle, rtl_uString ** result, sal_uInt16 methodIndex,
+ sal_uInt16 parameterIndex)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the type name of a parameter of a method of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the parameter's type name string;
+ must not be null; if an out-of-memory condition occurs, a pointer to a null
+ pointer is returned
+
+ @param methodIndex a valid index into the range of methods of the given type
+ reader
+
+ @param parameterIndex a valid index into the range of parameters of the given
+ method
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void SAL_CALL typereg_reader_getMethodParameterTypeName(
+ void * handle, rtl_uString ** result, sal_uInt16 methodIndex,
+ sal_uInt16 parameterIndex)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the number of exceptions of a method of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param index a valid index into the range of methods of the given type reader
+
+ @return the number of exceptions of the given method of the type reader
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC sal_uInt16 SAL_CALL typereg_reader_getMethodExceptionCount(
+ void * handle, sal_uInt16 index) SAL_THROW_EXTERN_C();
+
+/**
+ Returns the type name of an exception of a method of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the exception's type name string;
+ must not be null; if an out-of-memory condition occurs, a pointer to a null
+ pointer is returned
+
+ @param methodIndex a valid index into the range of methods of the given type
+ reader
+
+ @param exceptionIndex a valid index into the range of exceptions of the given
+ method
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void SAL_CALL typereg_reader_getMethodExceptionTypeName(
+ void * handle, rtl_uString ** result, sal_uInt16 methodIndex,
+ sal_uInt16 exceptionIndex)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the number of references of a type reader.
+
+ @param handle a handle on a type reader; may be null
+
+ @return the number of references of the type reader; if <code>handle</code>
+ is null, zero is returned
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC sal_uInt16 SAL_CALL typereg_reader_getReferenceCount(void * handle)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the documentation of a reference of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the reference's documentation
+ string; must not be null; if an out-of-memory condition occurs, a pointer to
+ a null pointer is returned
+
+ @param index a valid index into the range of references of the given type
+ reader
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void SAL_CALL typereg_reader_getReferenceDocumentation(
+ void * handle, rtl_uString ** result, sal_uInt16 index)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the flags of a reference of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param index a valid index into the range of references of the given type
+ reader
+
+ @return the flags of the given reference of the type reader
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC RTFieldAccess SAL_CALL typereg_reader_getReferenceFlags(
+ void * handle, sal_uInt16 index) SAL_THROW_EXTERN_C();
+
+/**
+ Returns the sort of a reference of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param index a valid index into the range of references of the given type
+ reader
+
+ @return the sort of the given reference of the type reader
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC enum RTReferenceType SAL_CALL typereg_reader_getReferenceSort(
+ void * handle, sal_uInt16 index) SAL_THROW_EXTERN_C();
+
+/**
+ Returns the type name of a reference of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the reference's type name string;
+ must not be null; if an out-of-memory condition occurs, a pointer to a null
+ pointer is returned
+
+ @param index a valid index into the range of references of the given type
+ reader
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void SAL_CALL typereg_reader_getReferenceTypeName(
+ void * handle, rtl_uString ** result, sal_uInt16 index)
+ SAL_THROW_EXTERN_C();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/registry/reader.hxx b/include/registry/reader.hxx
new file mode 100644
index 000000000000..a867f3b1185a
--- /dev/null
+++ b/include/registry/reader.hxx
@@ -0,0 +1,624 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_registry_reader_hxx
+#define INCLUDED_registry_reader_hxx
+
+#include "registry/reader.h"
+#include "registry/refltype.hxx"
+#include "registry/types.h"
+#include "registry/version.h"
+
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+
+#include <algorithm>
+#include <new>
+
+namespace typereg {
+
+/**
+ A type reader working on a binary blob that represents a UNOIDL type.
+
+ <p>Instances of this class are not multi-thread&ndash;safe.</p>
+
+ @since UDK 3.2.0
+ */
+class Reader {
+public:
+ /**
+ Creates an invalid type reader.
+ */
+ Reader(): m_handle(0) {}
+
+ /**
+ Creates a type reader.
+
+ <p>If the given binary blob is malformed, or of a version larger than
+ <code>maxVersion</code>, the created type reader is flagged as
+ invalid.</p>
+
+ @param buffer the binary blob representing the type; must point to at
+ least <code>length</code> bytes, and need only be byte-aligned
+
+ @param length the size in bytes of the binary blob representing the type
+
+ @param copy if true, the type reader creates an internal copy of the
+ given buffer, and the given buffer is not accessed after this constructor
+ returns; if false, the type reader works directly on the given buffer,
+ which must remain available unmodified until the underlying type reader
+ is destroyed (note that the lifetime of the underlying type reader can be
+ different from the lifetime of this <code>Reader</code> instance)
+
+ @param maxVersion the maximum binary blob version the client is prepared
+ to handle; must not be negative
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ Reader(
+ void const * buffer, sal_uInt32 length, bool copy,
+ typereg_Version maxVersion)
+ {
+ if (!typereg_reader_create(buffer, length, copy, maxVersion, &m_handle))
+ {
+ throw std::bad_alloc();
+ }
+ }
+
+ /**
+ Shares a type reader between two <code>Reader</code> instances.
+
+ @param other another <code>Reader</code> instance
+ */
+ Reader(Reader const & other): m_handle(other.m_handle) {
+ typereg_reader_acquire(m_handle);
+ }
+
+ /**
+ Destroys this <code>Reader</code> instance.
+
+ <p>The underlying type reader is only destroyed if this instance was its
+ last user.</p>
+ */
+ ~Reader() {
+ typereg_reader_release(m_handle);
+ }
+
+ /**
+ Replaces the underlying type reader.
+
+ @param other any <code>Reader</code> instance
+
+ @return this <code>Reader</code> instance
+ */
+ Reader & operator =(Reader const & other) {
+ Reader temp(other);
+ std::swap(this->m_handle, temp.m_handle);
+ return *this;
+ }
+
+ /**
+ Returns whether this type reader is valid.
+
+ @return true iff this type reader is valid
+ */
+ bool isValid() const {
+ return m_handle != 0;
+ }
+
+ /**
+ Returns the binary blob version of this type reader.
+
+ @return the version of the binary blob from which this type reader was
+ constructed; if this type reader is invalid,
+ <code>TYPEREG_VERSION_0</code> is returned
+ */
+ typereg_Version getVersion() const {
+ return typereg_reader_getVersion(m_handle);
+ }
+
+ /**
+ Returns the documentation of this type reader.
+
+ @return the documentation of this type reader; if this type reader is
+ invalid, an empty string is returned
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ OUString getDocumentation() const {
+ rtl_uString * s = 0;
+ typereg_reader_getDocumentation(m_handle, &s);
+ if (s == 0) {
+ throw std::bad_alloc();
+ }
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the file name of this type reader.
+
+ @return the file name of this type reader; if this type reader is
+ invalid, an empty string is returned
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ @deprecated
+ */
+ OUString getFileName() const {
+ rtl_uString * s = 0;
+ typereg_reader_getFileName(m_handle, &s);
+ if (s == 0) {
+ throw std::bad_alloc();
+ }
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the type class of this type reader.
+
+ <p>This function will always return the type class without the internal
+ <code>RT_TYPE_PUBLISHED</code> flag set. Use <code>isPublished</code> to
+ determine whether this type reader is published.</p>
+
+ @return the type class of this type reader; if this type reader is
+ invalid, <code>RT_TYPE_INVALID</code> is returned
+ */
+ RTTypeClass getTypeClass() const {
+ return typereg_reader_getTypeClass(m_handle);
+ }
+
+ /**
+ Returns whether this type reader is published.
+
+ @return whether this type reader is published; if this type reader is
+ invalid, <code>false</code> is returned
+ */
+ bool isPublished() const {
+ return typereg_reader_isPublished(m_handle);
+ }
+
+ /**
+ Returns the type name of this type reader.
+
+ @return the type name of this type reader; if this type reader is
+ invalid, an empty string is returned
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ OUString getTypeName() const {
+ rtl_uString * s = 0;
+ typereg_reader_getTypeName(m_handle, &s);
+ if (s == 0) {
+ throw std::bad_alloc();
+ }
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the number of super types of this type reader.
+
+ @return the number of super types of this type reader; if this type
+ reader is invalid, zero is returned
+ */
+ sal_uInt16 getSuperTypeCount() const {
+ return typereg_reader_getSuperTypeCount(m_handle);
+ }
+
+ /**
+ Returns the type name of a super type of this type reader.
+
+ @param index a valid index into the range of super types of this type
+ reader
+
+ @return the type name of the given super type
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ OUString getSuperTypeName(sal_uInt16 index) const {
+ rtl_uString * s = 0;
+ typereg_reader_getSuperTypeName(m_handle, &s, index);
+ if (s == 0) {
+ throw std::bad_alloc();
+ }
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the number of fields of this type reader.
+
+ @return the number of fields of this type reader; if this type reader is
+ invalid, zero is returned
+ */
+ sal_uInt16 getFieldCount() const {
+ return typereg_reader_getFieldCount(m_handle);
+ }
+
+ /**
+ Returns the documentation of a field of this type reader.
+
+ @param index a valid index into the range of fields of this type reader
+
+ @return the documentation of the given field
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ OUString getFieldDocumentation(sal_uInt16 index) const {
+ rtl_uString * s = 0;
+ typereg_reader_getFieldDocumentation(m_handle, &s, index);
+ if (s == 0) {
+ throw std::bad_alloc();
+ }
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the file name of a field of this type reader.
+
+ @param index a valid index into the range of fields of this type reader
+
+ @return the file name of the given field
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ @deprecated
+ */
+ OUString getFieldFileName(sal_uInt16 index) const {
+ rtl_uString * s = 0;
+ typereg_reader_getFieldFileName(m_handle, &s, index);
+ if (s == 0) {
+ throw std::bad_alloc();
+ }
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the flags of a field of this type reader.
+
+ @param index a valid index into the range of fields of this type reader
+
+ @return the flags of the given field
+ */
+ RTFieldAccess getFieldFlags(sal_uInt16 index) const {
+ return typereg_reader_getFieldFlags(m_handle, index);
+ }
+
+ /**
+ Returns the name of a field of this type reader.
+
+ @param index a valid index into the range of fields of this type reader
+
+ @return the name of the given field
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ OUString getFieldName(sal_uInt16 index) const {
+ rtl_uString * s = 0;
+ typereg_reader_getFieldName(m_handle, &s, index);
+ if (s == 0) {
+ throw std::bad_alloc();
+ }
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the type name of a field of this type reader.
+
+ @param index a valid index into the range of fields of this type reader
+
+ @return the type name of the given field
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ OUString getFieldTypeName(sal_uInt16 index) const {
+ rtl_uString * s = 0;
+ typereg_reader_getFieldTypeName(m_handle, &s, index);
+ if (s == 0) {
+ throw std::bad_alloc();
+ }
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the value of a field of this type reader.
+
+ @param index a valid index into the range of fields of this type reader
+
+ @return the value of the given field
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ RTConstValue getFieldValue(sal_uInt16 index) const {
+ RTConstValue v;
+ if (!typereg_reader_getFieldValue(
+ m_handle, index, &v.m_type, &v.m_value))
+ {
+ throw std::bad_alloc();
+ }
+ return v;
+ }
+
+ /**
+ Returns the number of methods of this type reader.
+
+ @return the number of methods of this type reader; if this type reader is
+ invalid, zero is returned
+ */
+ sal_uInt16 getMethodCount() const {
+ return typereg_reader_getMethodCount(m_handle);
+ }
+
+ /**
+ Returns the documentation of a method of this type reader.
+
+ @param index a valid index into the range of methods of this type reader
+
+ @return the documentation of the given method
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ OUString getMethodDocumentation(sal_uInt16 index) const {
+ rtl_uString * s = 0;
+ typereg_reader_getMethodDocumentation(m_handle, &s, index);
+ if (s == 0) {
+ throw std::bad_alloc();
+ }
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the flags of a method of this type reader.
+
+ @param index a valid index into the range of methods of this type reader
+
+ @return the flags of the given method
+ */
+ RTMethodMode getMethodFlags(sal_uInt16 index) const {
+ return typereg_reader_getMethodFlags(m_handle, index);
+ }
+
+ /**
+ Returns the name of a method of this type reader.
+
+ @param index a valid index into the range of methods of this type reader
+
+ @return the name of the given method
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ OUString getMethodName(sal_uInt16 index) const {
+ rtl_uString * s = 0;
+ typereg_reader_getMethodName(m_handle, &s, index);
+ if (s == 0) {
+ throw std::bad_alloc();
+ }
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the return type name of a method of this type reader.
+
+ @param index a valid index into the range of methods of this type reader
+
+ @return the return type name of the given method
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ OUString getMethodReturnTypeName(sal_uInt16 index) const {
+ rtl_uString * s = 0;
+ typereg_reader_getMethodReturnTypeName(m_handle, &s, index);
+ if (s == 0) {
+ throw std::bad_alloc();
+ }
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the number of parameters of a method of this type reader.
+
+ @param index a valid index into the range of methods of this type reader
+
+ @return the number of parameters of the given method
+ */
+ sal_uInt16 getMethodParameterCount(sal_uInt16 index) const {
+ return typereg_reader_getMethodParameterCount(m_handle, index);
+ }
+
+ /**
+ Returns the flags of a parameter of a method of this type reader.
+
+ @param methodIndex a valid index into the range of methods of this type
+ reader
+
+ @param parameterIndex a valid index into the range of parameters of the
+ given method
+
+ @return the flags of the given method parameter
+ */
+ RTParamMode getMethodParameterFlags(
+ sal_uInt16 methodIndex, sal_uInt16 parameterIndex) const
+ {
+ return typereg_reader_getMethodParameterFlags(
+ m_handle, methodIndex, parameterIndex);
+ }
+
+ /**
+ Returns the name of a parameter of a method of this type reader.
+
+ @param methodIndex a valid index into the range of methods of this type
+ reader
+
+ @param parameterIndex a valid index into the range of parameters of the
+ given method
+
+ @return the name of the given method parameter
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ OUString getMethodParameterName(
+ sal_uInt16 methodIndex, sal_uInt16 parameterIndex) const
+ {
+ rtl_uString * s = 0;
+ typereg_reader_getMethodParameterName(
+ m_handle, &s, methodIndex, parameterIndex);
+ if (s == 0) {
+ throw std::bad_alloc();
+ }
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the type name of a parameter of a method of this type reader.
+
+ @param methodIndex a valid index into the range of methods of this type
+ reader
+
+ @param parameterIndex a valid index into the range of parameters of the
+ given method
+
+ @return the type name of the given method parameter
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ OUString getMethodParameterTypeName(
+ sal_uInt16 methodIndex, sal_uInt16 parameterIndex) const
+ {
+ rtl_uString * s = 0;
+ typereg_reader_getMethodParameterTypeName(
+ m_handle, &s, methodIndex, parameterIndex);
+ if (s == 0) {
+ throw std::bad_alloc();
+ }
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the number of exceptions of a method of this type reader.
+
+ @param index a valid index into the range of methods of this type reader
+
+ @return the number of exceptions of the given method
+ */
+ sal_uInt16 getMethodExceptionCount(sal_uInt16 index) const {
+ return typereg_reader_getMethodExceptionCount(m_handle, index);
+ }
+
+ /**
+ Returns the type name of an exception of a method of this type reader.
+
+ @param methodIndex a valid index into the range of methods of this type
+ reader
+
+ @param exceptionIndex a valid index into the range of exceptions of the
+ given method
+
+ @return the type name of the given method exception
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ OUString getMethodExceptionTypeName(
+ sal_uInt16 methodIndex, sal_uInt16 exceptionIndex) const
+ {
+ rtl_uString * s = 0;
+ typereg_reader_getMethodExceptionTypeName(
+ m_handle, &s, methodIndex, exceptionIndex);
+ if (s == 0) {
+ throw std::bad_alloc();
+ }
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the number of references of this type reader.
+
+ @return the number of references of this type reader; if this type reader
+ is invalid, zero is returned
+ */
+ sal_uInt16 getReferenceCount() const {
+ return typereg_reader_getReferenceCount(m_handle);
+ }
+
+ /**
+ Returns the documentation of a reference of this type reader.
+
+ @param index a valid index into the range of references of this type
+ reader
+
+ @return the documentation of the given reference
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ OUString getReferenceDocumentation(sal_uInt16 index) const {
+ rtl_uString * s = 0;
+ typereg_reader_getReferenceDocumentation(m_handle, &s, index);
+ if (s == 0) {
+ throw std::bad_alloc();
+ }
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the flags of a reference of this type reader.
+
+ @param index a valid index into the range of references of this type
+ reader
+
+ @return the flags of the given reference
+ */
+ RTFieldAccess getReferenceFlags(sal_uInt16 index) const {
+ return typereg_reader_getReferenceFlags(m_handle, index);
+ }
+
+ /**
+ Returns the sort of a reference of this type reader.
+
+ @param index a valid index into the range of references of this type
+ reader
+
+ @return the sort of the given reference
+ */
+ RTReferenceType getReferenceSort(sal_uInt16 index) const {
+ return typereg_reader_getReferenceSort(m_handle, index);
+ }
+
+ /**
+ Returns the type name of a reference of this type reader.
+
+ @param index a valid index into the range of references of this type
+ reader
+
+ @return the type name of the given reference
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ OUString getReferenceTypeName(sal_uInt16 index) const {
+ rtl_uString * s = 0;
+ typereg_reader_getReferenceTypeName(m_handle, &s, index);
+ if (s == 0) {
+ throw std::bad_alloc();
+ }
+ return OUString(s, SAL_NO_ACQUIRE);
+ }
+
+private:
+ void * m_handle;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/registry/reflread.hxx b/include/registry/reflread.hxx
new file mode 100644
index 000000000000..541692443127
--- /dev/null
+++ b/include/registry/reflread.hxx
@@ -0,0 +1,513 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _REGISTRY_REFLREAD_HXX_
+#define _REGISTRY_REFLREAD_HXX_
+
+#include <registry/regdllapi.h>
+#include <registry/refltype.hxx>
+#include <registry/regtype.h>
+#include <rtl/ustring.hxx>
+
+/// Implememetation handle
+typedef void* TypeReaderImpl;
+
+/****************************************************************************
+
+ C-Api
+
+*****************************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** specifies a collection of function pointers which represents the complete registry type reader C-API.
+
+ This funtions pointers are used by the C++ wrapper to call the C-API.
+*/
+struct RegistryTypeReader_Api
+{
+ TypeReaderImpl (TYPEREG_CALLTYPE *createEntry) (const sal_uInt8*, sal_uInt32, sal_Bool);
+ void (TYPEREG_CALLTYPE *acquire) (TypeReaderImpl);
+ void (TYPEREG_CALLTYPE *release) (TypeReaderImpl);
+ sal_uInt16 (TYPEREG_CALLTYPE *getMinorVersion) (TypeReaderImpl);
+ sal_uInt16 (TYPEREG_CALLTYPE *getMajorVersion) (TypeReaderImpl);
+ RTTypeClass (TYPEREG_CALLTYPE *getTypeClass) (TypeReaderImpl);
+ void (TYPEREG_CALLTYPE *getUik) (TypeReaderImpl, RTUik*);
+ void (TYPEREG_CALLTYPE *getDoku) (TypeReaderImpl, rtl_uString**);
+ void (TYPEREG_CALLTYPE *getFileName) (TypeReaderImpl, rtl_uString**);
+ void (TYPEREG_CALLTYPE *getTypeName) (TypeReaderImpl, rtl_uString**);
+ void (TYPEREG_CALLTYPE *getSuperTypeName) (TypeReaderImpl, rtl_uString**);
+ sal_uInt32 (TYPEREG_CALLTYPE *getFieldCount) (TypeReaderImpl);
+ void (TYPEREG_CALLTYPE *getFieldName) (TypeReaderImpl, rtl_uString**, sal_uInt16);
+ void (TYPEREG_CALLTYPE *getFieldType) (TypeReaderImpl, rtl_uString**, sal_uInt16);
+ RTFieldAccess (TYPEREG_CALLTYPE *getFieldAccess) (TypeReaderImpl, sal_uInt16);
+ RTValueType (TYPEREG_CALLTYPE *getFieldConstValue) (TypeReaderImpl, sal_uInt16, RTConstValueUnion*);
+ void (TYPEREG_CALLTYPE *getFieldDoku) (TypeReaderImpl, rtl_uString**, sal_uInt16);
+ void (TYPEREG_CALLTYPE *getFieldFileName) (TypeReaderImpl, rtl_uString**, sal_uInt16);
+ sal_uInt32 (TYPEREG_CALLTYPE *getMethodCount) (TypeReaderImpl);
+ void (TYPEREG_CALLTYPE *getMethodName) (TypeReaderImpl, rtl_uString**, sal_uInt16);
+ sal_uInt32 (TYPEREG_CALLTYPE *getMethodParamCount) (TypeReaderImpl, sal_uInt16);
+ void (TYPEREG_CALLTYPE *getMethodParamType) (TypeReaderImpl, rtl_uString**, sal_uInt16, sal_uInt16);
+ void (TYPEREG_CALLTYPE *getMethodParamName) (TypeReaderImpl, rtl_uString**, sal_uInt16, sal_uInt16);
+ RTParamMode (TYPEREG_CALLTYPE *getMethodParamMode) (TypeReaderImpl, sal_uInt16, sal_uInt16);
+ sal_uInt32 (TYPEREG_CALLTYPE *getMethodExcCount) (TypeReaderImpl, sal_uInt16);
+ void (TYPEREG_CALLTYPE *getMethodExcType) (TypeReaderImpl, rtl_uString**, sal_uInt16, sal_uInt16);
+ void (TYPEREG_CALLTYPE *getMethodReturnType) (TypeReaderImpl, rtl_uString**, sal_uInt16);
+ RTMethodMode (TYPEREG_CALLTYPE *getMethodMode) (TypeReaderImpl, sal_uInt16);
+ void (TYPEREG_CALLTYPE *getMethodDoku) (TypeReaderImpl, rtl_uString**, sal_uInt16);
+
+ sal_uInt32 (TYPEREG_CALLTYPE *getReferenceCount) (TypeReaderImpl);
+ void (TYPEREG_CALLTYPE *getReferenceName) (TypeReaderImpl, rtl_uString**, sal_uInt16);
+ RTReferenceType (TYPEREG_CALLTYPE *getReferenceType) (TypeReaderImpl, sal_uInt16);
+ void (TYPEREG_CALLTYPE *getReferenceDoku) (TypeReaderImpl, rtl_uString**, sal_uInt16);
+ RTFieldAccess (TYPEREG_CALLTYPE *getReferenceAccess) (TypeReaderImpl, sal_uInt16);
+};
+
+/** the API initialization function.
+*/
+REG_DLLPUBLIC RegistryTypeReader_Api* TYPEREG_CALLTYPE initRegistryTypeReader_Api(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+/** RegistryTypeReades reads a binary type blob.
+
+ This class provides the necessary functions to read type information
+ for all kinds of types of a type blob.
+ The class is inline and use a C-Api.
+
+ @deprecated
+ use typereg::Reader instead
+*/
+class RegistryTypeReader
+{
+public:
+
+ /** Constructor.
+
+ @param buffer points to the binary data block.
+ @param bufferLen specifies the size of the binary data block.
+ @param copyData specifies if the data block should be copied.
+ The block can be copied to ensure that the data
+ is valid for the lifetime of this instance.
+ */
+ inline RegistryTypeReader(const sal_uInt8* buffer,
+ sal_uInt32 bufferLen,
+ sal_Bool copyData);
+
+ /// Copy constructcor
+ inline RegistryTypeReader(const RegistryTypeReader& toCopy);
+
+ /// Destructor. The Destructor frees the data block if the copyData flag was TRUE.
+ inline ~RegistryTypeReader();
+
+ /// Assign operator
+ inline RegistryTypeReader& operator == (const RegistryTypeReader& toAssign);
+
+ /// checks if the registry type reader points to a valid Api.
+ inline sal_Bool isValid() const;
+
+ /** @deprecated
+ returns the minor version number.
+
+ We currently don't support a versioning concept of IDL interfaces and
+ so this function is currently not used.
+ */
+ inline sal_uInt16 getMinorVersion() const;
+
+ /** @deprecated
+ returns the major version number.
+
+ We currently don't support a versioning concept of IDL interfaces and
+ so this function is currently not used.
+ */
+ inline sal_uInt16 getMajorVersion() const;
+
+ /** returns the typeclass of the type represented by this blob.
+
+ This function will always return the type class without the internal
+ RT_TYPE_PUBLISHED flag set.
+ */
+ inline RTTypeClass getTypeClass() const;
+
+ /** returns the full qualified name of the type.
+ */
+ inline OUString getTypeName() const;
+
+ /** returns the full qualified name of the supertype.
+ */
+ inline OUString getSuperTypeName() const;
+
+ /** @deprecated
+ returns the unique identifier for an interface type as an out parameter.
+
+ An earlier version of UNO used an unique identifier for interfaces. In the
+ current version of UNO this uik was eliminated and this function is
+ not longer used.
+ */
+ inline void getUik(RTUik& uik) const;
+
+ /** returns the documentation string of this type.
+ */
+ inline OUString getDoku() const;
+
+ /** returns the IDL filename where the type is defined.
+ */
+ inline OUString getFileName() const;
+
+ /** returns the number of fields (attributes/properties, enum values or number
+ of constants in a module).
+
+ */
+ inline sal_uInt32 getFieldCount() const;
+
+ /** returns the name of the field specified by index.
+ */
+ inline OUString getFieldName( sal_uInt16 index ) const;
+
+ /** returns the full qualified name of the field specified by index.
+ */
+ inline OUString getFieldType( sal_uInt16 index ) const;
+
+ /** returns the access mode of the field specified by index.
+ */
+ inline RTFieldAccess getFieldAccess( sal_uInt16 index ) const;
+
+ /** returns the value of the field specified by index.
+
+ This function returns the value of an enum value or of a constant.
+ */
+ inline RTConstValue getFieldConstValue( sal_uInt16 index ) const;
+
+ /** returns the documentation string for the field specified by index.
+
+ Each field of a type can have their own documentation.
+ */
+ inline OUString getFieldDoku( sal_uInt16 index ) const;
+
+ /** returns the IDL filename of the field specified by index.
+
+ The IDL filename of a field can differ from the filename of the ype itself
+ because modules and also constants can be defined in different IDL files.
+ */
+ inline OUString getFieldFileName( sal_uInt16 index ) const;
+
+ /** returns the number of methods of an interface type.
+ */
+ inline sal_uInt32 getMethodCount() const;
+
+ /** returns the name of the method specified by index.
+ */
+ inline OUString getMethodName( sal_uInt16 index ) const;
+
+ /** returns number of parameters of the method specified by index.
+ */
+ inline sal_uInt32 getMethodParamCount( sal_uInt16 index ) const;
+
+ /** returns the full qualified parameter typename.
+
+ @param index indicates the method
+ @param paramIndex indeciates the parameter which type will be returned.
+ */
+ inline OUString getMethodParamType( sal_uInt16 index, sal_uInt16 paramIndex ) const;
+
+ /** returns the name of a parameter.
+
+ @param index indicates the method
+ @param paramIndex indiciates the parameter which name will be returned.
+ */
+ inline OUString getMethodParamName( sal_uInt16 index, sal_uInt16 paramIndex ) const;
+
+ /** returns the parameter mode, if it is an in, out or inout parameter.
+
+ @param index indicates the method
+ @param paramIndex indeciates the parameter which mode will be returned.
+ */
+ inline RTParamMode getMethodParamMode( sal_uInt16 index, sal_uInt16 paramIndex ) const;
+
+ /** returns the number of exceptions which are declared for the method specified by index.
+
+ @param index indicates the method
+ */
+ inline sal_uInt32 getMethodExcCount( sal_uInt16 index ) const;
+
+ /** returns the full qualified exception type of the specified exception.
+
+ @param index indicates the method
+ @param excIndex indeciates the exception which typename will be returned.
+ */
+ inline OUString getMethodExcType( sal_uInt16 index, sal_uInt16 excIndex ) const;
+
+ /** returns the full qualified return type of the method specified by index.
+ */
+ inline OUString getMethodReturnType( sal_uInt16 index ) const;
+
+ /** returns the full qualified exception type of the specified exception.
+
+ @param index indicates the method
+ */
+ inline RTMethodMode getMethodMode( sal_uInt16 index ) const;
+
+ /** returns the documentation string of the method specified by index.
+
+ @param index indicates the method.
+ */
+ inline OUString getMethodDoku( sal_uInt16 index ) const;
+
+ /** returns the number of references (supported interfaces, exported services).
+ */
+ inline sal_uInt32 getReferenceCount() const;
+
+ /** returns the full qualified typename of the reference specified by index.
+
+ @param index indicates the reference.
+ */
+ inline OUString getReferenceName( sal_uInt16 index ) const;
+
+ /** returns the type of the reference specified by index.
+
+ @param index indicates the reference.
+ */
+ inline RTReferenceType getReferenceType( sal_uInt16 index ) const;
+
+ /** returns the documentation string of the reference specified by index.
+
+ @param index indicates the reference.
+ */
+ inline OUString getReferenceDoku( sal_uInt16 index ) const;
+
+ /** returns the access mode of the reference specified by index.
+
+ The only valid value is RT_ACCESS_OPTIONAL in the context of
+ references.
+ @param index indicates the reference.
+ */
+ inline RTFieldAccess getReferenceAccess( sal_uInt16 index ) const;
+
+protected:
+
+ /// stores the registry type reader Api.
+ const RegistryTypeReader_Api* m_pApi;
+ /// stores the handle of an implementation class
+ TypeReaderImpl m_hImpl;
+};
+
+
+
+inline RegistryTypeReader::RegistryTypeReader(const sal_uInt8* buffer,
+ sal_uInt32 bufferLen,
+ sal_Bool copyData)
+ : m_pApi(initRegistryTypeReader_Api())
+ , m_hImpl(NULL)
+ {
+ m_hImpl = m_pApi->createEntry(buffer, bufferLen, copyData);
+ }
+
+
+inline RegistryTypeReader::RegistryTypeReader(const RegistryTypeReader& toCopy)
+ : m_pApi(toCopy.m_pApi)
+ , m_hImpl(toCopy.m_hImpl)
+ { m_pApi->acquire(m_hImpl); }
+
+
+inline RegistryTypeReader::~RegistryTypeReader()
+ { m_pApi->release(m_hImpl); }
+
+inline RegistryTypeReader& RegistryTypeReader::operator == (const RegistryTypeReader& toAssign)
+{
+ if (m_hImpl != toAssign.m_hImpl)
+ {
+ m_pApi->release(m_hImpl);
+ m_hImpl = toAssign.m_hImpl;
+ m_pApi->acquire(m_hImpl);
+ }
+
+ return *this;
+}
+
+inline sal_uInt16 RegistryTypeReader::getMinorVersion() const
+ { return m_pApi->getMinorVersion(m_hImpl); }
+
+inline sal_Bool RegistryTypeReader::isValid() const
+ { return (m_hImpl != NULL); }
+
+inline sal_uInt16 RegistryTypeReader::getMajorVersion() const
+ { return m_pApi->getMajorVersion(m_hImpl); }
+
+inline RTTypeClass RegistryTypeReader::getTypeClass() const
+ { return m_pApi->getTypeClass(m_hImpl); }
+
+inline OUString RegistryTypeReader::getTypeName() const
+ {
+ OUString sRet;
+ m_pApi->getTypeName(m_hImpl, &sRet.pData);
+ return sRet;
+ }
+
+inline OUString RegistryTypeReader::getSuperTypeName() const
+ {
+ OUString sRet;
+ m_pApi->getSuperTypeName(m_hImpl, &sRet.pData);
+ return sRet;
+ }
+
+inline void RegistryTypeReader::getUik(RTUik& uik) const
+ { m_pApi->getUik(m_hImpl, &uik); }
+
+inline OUString RegistryTypeReader::getDoku() const
+ {
+ OUString sRet;
+ m_pApi->getDoku(m_hImpl, &sRet.pData);
+ return sRet;
+ }
+
+inline OUString RegistryTypeReader::getFileName() const
+ {
+ OUString sRet;
+ m_pApi->getFileName(m_hImpl, &sRet.pData);
+ return sRet;
+ }
+
+inline sal_uInt32 RegistryTypeReader::getFieldCount() const
+ { return m_pApi->getFieldCount(m_hImpl); }
+
+inline OUString RegistryTypeReader::getFieldName( sal_uInt16 index ) const
+ {
+ OUString sRet;
+ m_pApi->getFieldName(m_hImpl, &sRet.pData, index);
+ return sRet;
+ }
+
+inline OUString RegistryTypeReader::getFieldType( sal_uInt16 index ) const
+ {
+ OUString sRet;
+ m_pApi->getFieldType(m_hImpl, &sRet.pData, index);
+ return sRet;
+ }
+
+inline RTFieldAccess RegistryTypeReader::getFieldAccess( sal_uInt16 index ) const
+ { return m_pApi->getFieldAccess(m_hImpl, index); }
+
+inline RTConstValue RegistryTypeReader::getFieldConstValue( sal_uInt16 index ) const
+ {
+ RTConstValue ret;
+ ret.m_type = m_pApi->getFieldConstValue(m_hImpl, index, &ret.m_value);
+ return ret;
+ }
+
+inline OUString RegistryTypeReader::getFieldDoku( sal_uInt16 index ) const
+ {
+ OUString sRet;
+ m_pApi->getFieldDoku(m_hImpl, &sRet.pData, index);
+ return sRet;
+ }
+
+inline OUString RegistryTypeReader::getFieldFileName( sal_uInt16 index ) const
+ {
+ OUString sRet;
+ m_pApi->getFieldFileName(m_hImpl, &sRet.pData, index);
+ return sRet;
+ }
+
+inline sal_uInt32 RegistryTypeReader::getMethodCount() const
+ { return m_pApi->getMethodCount(m_hImpl); }
+
+inline OUString RegistryTypeReader::getMethodName( sal_uInt16 index ) const
+ {
+ OUString sRet;
+ m_pApi->getMethodName(m_hImpl, &sRet.pData, index);
+ return sRet;
+ }
+
+inline sal_uInt32 RegistryTypeReader::getMethodParamCount( sal_uInt16 index ) const
+ { return m_pApi->getMethodParamCount(m_hImpl, index); }
+
+inline OUString RegistryTypeReader::getMethodParamType( sal_uInt16 index, sal_uInt16 paramIndex ) const
+ {
+ OUString sRet;
+ m_pApi->getMethodParamType(m_hImpl, &sRet.pData, index, paramIndex);
+ return sRet;
+ }
+
+inline OUString RegistryTypeReader::getMethodParamName( sal_uInt16 index, sal_uInt16 paramIndex ) const
+ {
+ OUString sRet;
+ m_pApi->getMethodParamName(m_hImpl, &sRet.pData, index, paramIndex);
+ return sRet;
+ }
+
+inline RTParamMode RegistryTypeReader::getMethodParamMode( sal_uInt16 index, sal_uInt16 paramIndex ) const
+ { return m_pApi->getMethodParamMode(m_hImpl, index, paramIndex); }
+
+inline sal_uInt32 RegistryTypeReader::getMethodExcCount( sal_uInt16 index ) const
+ { return m_pApi->getMethodExcCount(m_hImpl, index); }
+
+inline OUString RegistryTypeReader::getMethodExcType( sal_uInt16 index, sal_uInt16 excIndex ) const
+ {
+ OUString sRet;
+ m_pApi->getMethodExcType(m_hImpl, &sRet.pData, index, excIndex);
+ return sRet;
+ }
+
+inline OUString RegistryTypeReader::getMethodReturnType( sal_uInt16 index ) const
+ {
+ OUString sRet;
+ m_pApi->getMethodReturnType(m_hImpl, &sRet.pData, index);
+ return sRet;
+ }
+
+inline RTMethodMode RegistryTypeReader::getMethodMode( sal_uInt16 index ) const
+ { return m_pApi->getMethodMode(m_hImpl, index); }
+
+inline OUString RegistryTypeReader::getMethodDoku( sal_uInt16 index ) const
+ {
+ OUString sRet;
+ m_pApi->getMethodDoku(m_hImpl, &sRet.pData, index);
+ return sRet;
+ }
+
+inline sal_uInt32 RegistryTypeReader::getReferenceCount() const
+ { return m_pApi->getReferenceCount(m_hImpl); }
+
+inline OUString RegistryTypeReader::getReferenceName( sal_uInt16 index ) const
+ {
+ OUString sRet;
+ m_pApi->getReferenceName(m_hImpl, &sRet.pData, index);
+ return sRet;
+ }
+
+inline RTReferenceType RegistryTypeReader::getReferenceType( sal_uInt16 index ) const
+ { return m_pApi->getReferenceType(m_hImpl, index); }
+
+inline OUString RegistryTypeReader::getReferenceDoku( sal_uInt16 index ) const
+ {
+ OUString sRet;
+ m_pApi->getReferenceDoku(m_hImpl, &sRet.pData, index);
+ return sRet;
+ }
+
+inline RTFieldAccess RegistryTypeReader::getReferenceAccess( sal_uInt16 index ) const
+ { return m_pApi->getReferenceAccess(m_hImpl, index); }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/registry/refltype.hxx b/include/registry/refltype.hxx
new file mode 100644
index 000000000000..0de7716a9ed3
--- /dev/null
+++ b/include/registry/refltype.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _REGISTRY_REFLTYPE_HXX_
+#define _REGISTRY_REFLTYPE_HXX_
+
+#include "registry/types.h"
+#include <sal/types.h>
+
+/** specifies the type source of a binary type blob.
+
+ Currently only RT_UNO_IDL type is used.
+ */
+enum RTTypeSource
+{
+ RT_UNO_IDL,
+ RT_CORBA_IDL,
+ RT_JAVA
+};
+
+/** specifies a helper class for const values.
+
+ This class is used for easy handling of constants or enum values
+ as fields in binary type blob.
+ */
+class RTConstValue
+{
+public:
+ /// stores the type of the constant value.
+ RTValueType m_type;
+ /// stores the value of the constant.
+ RTConstValueUnion m_value;
+
+ /// Default constructor.
+ RTConstValue()
+ : m_type(RT_TYPE_NONE)
+ {
+ m_value.aDouble = 0.0;
+ }
+
+ /// Destructor
+ ~RTConstValue() {}
+};
+
+/** deprecated.
+
+ An earlier version of UNO used an unique identifier for interfaces. In the
+ current version of UNO this uik was eliminated and this type is not longer used.
+ */
+struct RTUik
+{
+ sal_uInt32 m_Data1;
+ sal_uInt16 m_Data2;
+ sal_uInt16 m_Data3;
+ sal_uInt32 m_Data4;
+ sal_uInt32 m_Data5;
+};
+
+/// specifies the calling convention for type reader/writer api
+#define TYPEREG_CALLTYPE SAL_CALL
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/registry/reflwrit.hxx b/include/registry/reflwrit.hxx
new file mode 100644
index 000000000000..8e84aa9b1483
--- /dev/null
+++ b/include/registry/reflwrit.hxx
@@ -0,0 +1,350 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _REGISTRY_REFLWRIT_HXX_
+#define _REGISTRY_REFLWRIT_HXX_
+
+#include <registry/regdllapi.h>
+#include <registry/refltype.hxx>
+#include <registry/regtype.h>
+#include <rtl/ustring.hxx>
+
+/// Implememetation handle
+typedef void* TypeWriterImpl;
+
+/****************************************************************************
+
+ C-Api
+
+*****************************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** specifies a collection of function pointers which represents the complete registry type writer C-API.
+
+ This funtions pointers are used by the C++ wrapper to call the C-API.
+*/
+struct RegistryTypeWriter_Api
+{
+ TypeWriterImpl (TYPEREG_CALLTYPE *createEntry) (RTTypeClass, rtl_uString*, rtl_uString*, sal_uInt16, sal_uInt16, sal_uInt16);
+ void (TYPEREG_CALLTYPE *acquire) (TypeWriterImpl);
+ void (TYPEREG_CALLTYPE *release) (TypeWriterImpl);
+ void (TYPEREG_CALLTYPE *setUik) (TypeWriterImpl, const RTUik*);
+ void (TYPEREG_CALLTYPE *setDoku) (TypeWriterImpl, rtl_uString*);
+ void (TYPEREG_CALLTYPE *setFileName) (TypeWriterImpl, rtl_uString*);
+ void (TYPEREG_CALLTYPE *setFieldData) (TypeWriterImpl, sal_uInt16, rtl_uString*, rtl_uString*, rtl_uString*, rtl_uString*, RTFieldAccess, RTValueType, RTConstValueUnion);
+ void (TYPEREG_CALLTYPE *setMethodData) (TypeWriterImpl, sal_uInt16, rtl_uString*, rtl_uString*, RTMethodMode, sal_uInt16, sal_uInt16, rtl_uString*);
+ void (TYPEREG_CALLTYPE *setParamData) (TypeWriterImpl, sal_uInt16, sal_uInt16, rtl_uString*, rtl_uString*, RTParamMode);
+ void (TYPEREG_CALLTYPE *setExcData) (TypeWriterImpl, sal_uInt16, sal_uInt16, rtl_uString*);
+ const sal_uInt8* (TYPEREG_CALLTYPE *getBlop) (TypeWriterImpl);
+ sal_uInt32 (TYPEREG_CALLTYPE *getBlopSize) (TypeWriterImpl);
+
+ void (TYPEREG_CALLTYPE *setReferenceData) (TypeWriterImpl, sal_uInt16, rtl_uString*, RTReferenceType, rtl_uString*, RTFieldAccess);
+};
+
+/** the API initialization function.
+*/
+REG_DLLPUBLIC RegistryTypeWriter_Api* TYPEREG_CALLTYPE initRegistryTypeWriter_Api(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+/** RegistryTypeWriter writes/creates a binary type blob.
+
+ This class provides the necessary functions to write type information
+ for all kinds of types into a blob.
+ The class is inline and use a C-Api.
+
+ @deprecated
+ use typereg::Writer instead
+*/
+class RegistryTypeWriter
+{
+public:
+
+ /** Constructor.
+
+ @param RTTypeClass specifies the type of the new blob.
+ @param typeName specifies the full qualified type name with '/' as separator.
+ @param superTypeName specifies the full qualified type name of the base type
+ with '/' as separator.
+ @param fieldCount specifies the number of fields (eg. number of attrbutes/properties,
+ enum values or constants).
+ @param methodCount specifies the number of methods.
+ @param referenceCount specifies the number of references (eg. number of supported interfaces,
+ exported services ...)
+ */
+ inline RegistryTypeWriter(RTTypeClass RTTypeClass,
+ const OUString& typeName,
+ const OUString& superTypeName,
+ sal_uInt16 fieldCount,
+ sal_uInt16 methodCount,
+ sal_uInt16 referenceCount);
+
+ /// Copy constructcor
+ inline RegistryTypeWriter(const RegistryTypeWriter& toCopy);
+
+ /** Destructor. The Destructor frees the internal data block.
+
+ The pointer (returned by getBlop) will be set to NULL.
+ */
+ inline ~RegistryTypeWriter();
+
+ /// Assign operator
+ inline RegistryTypeWriter& operator == (const RegistryTypeWriter& toAssign);
+
+ /** @deprecated
+ sets the unique identifier for an interface type.
+
+ An earlier version of UNO used an unique identifier for interfaces. In the
+ current version of UNO this uik was eliminated and this function is
+ not longer used.
+ */
+ inline void setUik(const RTUik& uik);
+
+ /** sets a documentation string for the type.
+
+ This documentation should be the same as the documentation which is provided
+ for this type in IDL.
+ */
+ inline void setDoku(const OUString& doku);
+
+ /** sets the IDL filename where this type is defined.
+ */
+ inline void setFileName(const OUString& fileName);
+
+ /** sets the data for a field member of a type blob.
+
+ @param index indicates the index of the field.
+ @param name specifies the name.
+ @param typeName specifies the full qualified typename.
+ @param doku specifies the documentation string of the field.
+ @param fileName specifies the name of the IDL file where the field is defined.
+ @param access specifies the access mode of the field.
+ @param constValue specifies the value of the field. The value is only interesting
+ for enum values or constants.
+ */
+ inline void setFieldData( sal_uInt16 index,
+ const OUString& name,
+ const OUString& typeName,
+ const OUString& doku,
+ const OUString& fileName,
+ RTFieldAccess access,
+ RTConstValue constValue = RTConstValue());
+
+ /** sets the data for a method.
+
+ @param index indicates the index of the method.
+ @param name specifies the name.
+ @param returnTypeName specifies the full qualified return typename.
+ @param mode specifies the method mode.
+ @param paramCount specifies the number of parameters.
+ @param excCount specifies the number of exceptions.
+ @param doku specifies the documentation string of the field.
+ */
+ inline void setMethodData(sal_uInt16 index,
+ const OUString& name,
+ const OUString& returnTypeName,
+ RTMethodMode mode,
+ sal_uInt16 paramCount,
+ sal_uInt16 excCount,
+ const OUString& doku);
+
+ /** sets the data for the specified parameter of a method.
+
+ @param index indicates the index of the method.
+ @param paramIndex specifies the index of the parameter.
+ @param type specifies the full qualified typename.
+ @param name specifies the name.
+ @param mode specifies the parameter mode.
+ */
+ inline void setParamData(sal_uInt16 index,
+ sal_uInt16 paramIndex,
+ const OUString& type,
+ const OUString& name,
+ RTParamMode mode);
+
+ /** sets the data for the specified exception of a mehtod.
+
+ @param index indicates the index of the method.
+ @param excIndex specifies the index of the exception.
+ @param type specifies the full qualified typename of the exception.
+ */
+ inline void setExcData(sal_uInt16 index,
+ sal_uInt16 excIndex,
+ const OUString& type);
+
+ /** returns a pointer to the new type blob.
+
+ The pointer will be invalid (NULL) if the instance of
+ the RegistryTypeWriter will be destroyed.
+ */
+ inline const sal_uInt8* getBlop();
+
+ /** returns the size of the new type blob in bytes.
+ */
+ inline sal_uInt32 getBlopSize();
+
+ /** sets the data for a reference member.
+
+ @param index indicates the index of the reference.
+ @param name specifies the name.
+ @param refType specifies the full qualified typename of the reference.
+ @param doku specifies the documentation string of the reference.
+ @param access specifies the access mode of the reference.
+ */
+ inline void setReferenceData( sal_uInt16 index,
+ const OUString& name,
+ RTReferenceType refType,
+ const OUString& doku,
+ RTFieldAccess access = RT_ACCESS_INVALID);
+
+protected:
+
+ /// stores the registry type writer Api.
+ const RegistryTypeWriter_Api* m_pApi;
+ /// stores the handle of an implementation class
+ TypeWriterImpl m_hImpl;
+};
+
+
+
+inline RegistryTypeWriter::RegistryTypeWriter(RTTypeClass RTTypeClass,
+ const OUString& typeName,
+ const OUString& superTypeName,
+ sal_uInt16 fieldCount,
+ sal_uInt16 methodCount,
+ sal_uInt16 referenceCount)
+ : m_pApi(initRegistryTypeWriter_Api())
+ , m_hImpl(NULL)
+{
+ m_hImpl = m_pApi->createEntry(RTTypeClass,
+ typeName.pData,
+ superTypeName.pData,
+ fieldCount,
+ methodCount,
+ referenceCount);
+}
+
+
+inline RegistryTypeWriter::RegistryTypeWriter(const RegistryTypeWriter& toCopy)
+ : m_pApi(toCopy.m_pApi)
+ , m_hImpl(toCopy.m_hImpl)
+{
+ m_pApi->acquire(m_hImpl);
+}
+
+inline RegistryTypeWriter::~RegistryTypeWriter()
+{
+ m_pApi->release(m_hImpl);
+}
+
+inline RegistryTypeWriter& RegistryTypeWriter::operator == (const RegistryTypeWriter& toAssign)
+{
+ if (m_hImpl != toAssign.m_hImpl)
+ {
+ m_pApi->release(m_hImpl);
+ m_hImpl = toAssign.m_hImpl;
+ m_pApi->acquire(m_hImpl);
+ }
+
+ return *this;
+}
+
+inline void RegistryTypeWriter::setFieldData( sal_uInt16 index,
+ const OUString& name,
+ const OUString& typeName,
+ const OUString& doku,
+ const OUString& fileName,
+ RTFieldAccess access,
+ RTConstValue constValue)
+{
+ m_pApi->setFieldData(m_hImpl, index, name.pData, typeName.pData, doku.pData, fileName.pData, access, constValue.m_type, constValue.m_value);
+}
+
+
+inline void RegistryTypeWriter::setMethodData(sal_uInt16 index,
+ const OUString& name,
+ const OUString& returnTypeName,
+ RTMethodMode mode,
+ sal_uInt16 paramCount,
+ sal_uInt16 excCount,
+ const OUString& doku)
+{
+ m_pApi->setMethodData(m_hImpl, index, name.pData, returnTypeName.pData, mode, paramCount, excCount, doku.pData);
+}
+
+
+inline void RegistryTypeWriter::setUik(const RTUik& uik)
+{
+ m_pApi->setUik(m_hImpl, &uik);
+}
+
+inline void RegistryTypeWriter::setDoku(const OUString& doku)
+{
+ m_pApi->setDoku(m_hImpl, doku.pData);
+}
+
+inline void RegistryTypeWriter::setFileName(const OUString& doku)
+{
+ m_pApi->setFileName(m_hImpl, doku.pData);
+}
+
+inline void RegistryTypeWriter::setParamData(sal_uInt16 index,
+ sal_uInt16 paramIndex,
+ const OUString& type,
+ const OUString& name,
+ RTParamMode mode)
+{
+ m_pApi->setParamData(m_hImpl, index, paramIndex, type.pData, name.pData, mode);
+}
+
+inline void RegistryTypeWriter::setExcData(sal_uInt16 index,
+ sal_uInt16 excIndex,
+ const OUString& type)
+{
+ m_pApi->setExcData(m_hImpl, index, excIndex, type.pData);
+}
+
+inline const sal_uInt8* RegistryTypeWriter::getBlop()
+{
+ return m_pApi->getBlop(m_hImpl);
+}
+
+inline sal_uInt32 RegistryTypeWriter::getBlopSize()
+{
+ return m_pApi->getBlopSize(m_hImpl);
+}
+
+
+inline void RegistryTypeWriter::setReferenceData( sal_uInt16 index,
+ const OUString& name,
+ RTReferenceType refType,
+ const OUString& doku,
+ RTFieldAccess access)
+{
+ m_pApi->setReferenceData(m_hImpl, index, name.pData, refType, doku.pData, access);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/registry/regdllapi.h b/include/registry/regdllapi.h
new file mode 100644
index 000000000000..5116a7062d24
--- /dev/null
+++ b/include/registry/regdllapi.h
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_REGDLLAPI_H
+#define INCLUDED_REGDLLAPI_H
+
+#include "sal/types.h"
+
+#if defined(REG_DLLIMPLEMENTATION)
+#define REG_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define REG_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif /* INCLUDED_REGDLLAPI_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/registry/registry.h b/include/registry/registry.h
new file mode 100644
index 000000000000..030e1a12a5de
--- /dev/null
+++ b/include/registry/registry.h
@@ -0,0 +1,456 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _REGISTRY_REGISTRY_H_
+#define _REGISTRY_REGISTRY_H_
+
+#include <stddef.h>
+#include <rtl/ustring.h>
+#include <registry/regtype.h>
+#include <registry/regdllapi.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/** This function creates the specified key.
+
+ If the key already exists in the registry, the function opens the key only.
+ @param hKey identifies a currently open key. The key which will be opened or created by this
+ function is a subkey of the key identified by hKey.
+ @param keyName points to a null terminated string specifying the name of a key.
+ @param phNewKey points to a variable that receives the handle of the opened or created key.
+ The memory to store this variable will be allocated and will be freed by the function
+ reg_closeKey. If the function fails, phNewKey is NULL.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_createKey(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegKeyHandle* phNewKey);
+
+
+/** This function opens the specified key.
+
+ @param hKey identifies a currently open key. The key which will be opened by this function
+ is a subkey of the key identified by hKey
+ @param keyName points to a null terminated string specifying the name of a key.
+ @param phOpenKey points to a variable that receives the handle of the opened key.
+ The memory to store this variable will be allocated and will be freed by the function
+ reg_closeKey. If the function fails, phNewKey is NULL.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_openKey(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegKeyHandle* phOpenKey);
+
+
+
+/** This function opens all subkeys of the specified key.
+
+ @param hKey identifies a currently open key. The key that subkeys will be opened by this
+ function is a subkey of the key identified by hKey
+ @param keyName points to a null terminated string specifying the name of a key whose subkeys
+ will be opened.
+ @param pphSubKeys points to a variable that receives an array of all opened subkeys.
+ The memory to store this variable will be allocated and will be freed by the function
+ reg_closeSubKeys. If the function fails, pphSubKeys is NULL.
+ @param pnSubKeys specifies the length of the array (the number of open subkeys).
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_openSubKeys(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegKeyHandle** pphSubKeys,
+ sal_uInt32* pnSubKeys);
+
+
+/** This function closes all subkeys specified in the array.
+
+ @param phSubKeys points to a variable that containss an array of all opened subkeys.
+ The allocated memory of pphSubKeys and all open subkeys will be freed.
+ @param nSubKeys specifies the length of the array (the number of subkeys to closed).
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_closeSubKeys(RegKeyHandle* phSubKeys,
+ sal_uInt32 nSubKeys);
+
+
+/** This function deletes the specified key.
+
+ @param hKey identifies a currently open key. The key deleted by this function
+ is a subkey of the key identified by hKey
+ @param keyName points to a null terminated string specifying the name of a key which will
+ be deleted.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_deleteKey(RegKeyHandle hKey,
+ rtl_uString* keyName);
+
+
+/** This function closes the specified key.
+
+ @param hKey identifies a currently open key which will be closed by this function.
+ The memory of the variable specifying the key will be freed.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_closeKey(RegKeyHandle hKey);
+
+
+/** This function returns the name of a key.
+
+ @param hKey identifies a currently open key which name will be returned.
+ @param pKeyName contains the keyname if succeeds else an empty string.
+*/
+REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_getKeyName(RegKeyHandle hKey, rtl_uString** pKeyName);
+
+
+/** This function sets a value of a key.
+
+ @param hKey identifies a currently open key. The key which value will be set by this
+ function is a subkey of the key identified by hKey.
+ @param keyName points to a null terminated string specifying the name of a key which value
+ will be set. If keyName is NULL, then the value of the key specified by
+ hKey will be set.
+ @param valueType specifies the type of the value.
+ @param pData points to a memory block containing the data of the value.
+ @param valueSize specifies the size of pData in bytes
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_setValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegValueType valueType,
+ RegValue pData,
+ sal_uInt32 valueSize);
+
+
+/** This function sets an long list value of a key.
+
+ @param[in] hKey identifies a currently open key. The key which value will be set by this
+ function is a subkey of the key identified by hKey.
+ @param[in] keyName points to a null terminated string specifying the name of a key which value
+ will be set. If keyName is NULL, then the value of the key specified by
+ hKey will be set.
+ @param[out] pValueList points to an array of longs containing the data of the value.
+ @param[out] len specifies the len of pValueList.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_setLongListValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Int32* pValueList,
+ sal_uInt32 len);
+
+
+/** This function sets an ascii list value of a key.
+
+ @param[in] hKey identifies a currently open key. The key which value will be set by this
+ function is a subkey of the key identified by hKey.
+ @param[in] keyName points to a null terminated string specifying the name of a key which value
+ will be set. If keyName is NULL, then the value of the key specified by
+ hKey will be set.
+ @param[in] pValueList points to an array of sal_Char* containing the data of the value.
+ @param[in] len specifies the len of pValueList.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_setStringListValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Char** pValueList,
+ sal_uInt32 len);
+
+
+/** This function sets an unicode string list value of a key.
+
+ @param[in] hKey identifies a currently open key. The key which value will be set by this
+ function is a subkey of the key identified by hKey.
+ @param[in] keyName points to a null terminated string specifying the name of a key which value
+ will be set. If keyName is NULL, then the value of the key specified by
+ hKey will be set.
+ @param[in] pValueList points to an array of sal_Unicode* containing the data of the value.
+ @param[in] len specifies the len of pValueList.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_setUnicodeListValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Unicode** pValueList,
+ sal_uInt32 len);
+
+
+/** This function gets info about type and size of a key value.
+
+ @param hKey identifies a currently open key. The key which value info will be got by this
+ function is a subkey of the key identified by hKey.
+ @param keyName points to a null terminated string specifying the name of a key which value
+ will be got. If keyName is NULL, then the value info of the key specified by
+ hKey will be got.
+ @param pValueType returns the type of the value.
+ @param pValueSize returns the size of the value in bytes
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_getValueInfo(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegValueType* pValueType,
+ sal_uInt32* pValueSize);
+
+
+/** This function gets the value of a key.
+
+ @param hKey identifies a currently open key. The key which value will be got by this
+ function is a subkey of the key identified by hKey.
+ @param keyName points to a null terminated string specifying the name of a key which value
+ will be got. If keyName is NULL, then the value of the key specified by
+ hKey will be got.
+ @param pData points to an allocated memory block receiving the data of the value.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_getValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegValue pData);
+
+
+/** This function gets the long list value of a key.
+
+ @param[in] hKey identifies a currently open key. The key which value will be got by this
+ function is a subkey of the key identified by hKey.
+ @param[in] keyName points to a null terminated string specifying the name of a key which value
+ will be got. If keyName is NULL, then the value of the key specified by
+ hKey will be got.
+ @param[out] pValueList a Pointer to a long value list which returns the data of the value.
+ @param[out] pLen returns the length of the value list.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_getLongListValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Int32** pValueList,
+ sal_uInt32* pLen);
+
+
+/** This function gets the string list value of a key.
+
+ @param[in] hKey identifies a currently open key. The key whose value will be retrived by this
+ function is a subkey of the key identified by hKey.
+ @param[in] keyName points to a null terminated string specifying the name of a key whose value
+ will be retrived. If keyName is NULL, then the value of the key specified by
+ hKey will be retrived.
+ @param[out] pValueList a Pointer to an ascii value list which returns the data of the value.
+ @param[out] pLen returns the length of the value list.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_getStringListValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Char*** pValueList,
+ sal_uInt32* pLen);
+
+
+/** This function gets the unicode list value of a key.
+
+ @param[in] hKey identifies a currently open key. The key whose value will be retrived by this
+ function is a subkey of the key identified by hKey.
+ @param[in] keyName points to a null terminated string specifying the name of a key whose value
+ will be retrived. If keyName is NULL, then the value of the key specified by
+ hKey will be retrived.
+ @param[out] pValueList a Pointer to an unicode value list which returns the data of the value.
+ @param[out] pLen returns the length of the value list.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_getUnicodeListValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Unicode*** pValueList,
+ sal_uInt32* pLen);
+
+
+/** This function frees the memory of a value list.
+
+ @param valueType specifies the type of the list values.
+ @param pValueList a Pointer to the value list.
+ @param len specifies the length of the value list.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_freeValueList(RegValueType valueType,
+ RegValue pValueList,
+ sal_uInt32 len);
+
+/** This function returns the type of a key.
+
+ The registry differentiates two possible types:
+ - RG_KEYTYPE represents a real key
+ - RG_LINKTYPE used to represent a link (no longer used)
+ @param[in] hKey identifies a currently open key. The key specified by keyName is a subkey
+ of the key identified by hKey.
+ @param[in] keyName points to a null terminated string specifying the name of the key which keytype
+ will be returned.
+ @param[out] pKeyType returns the type of the key.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_getKeyType(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegKeyType* pKeyType);
+
+/** This function resolves a keyname.
+
+ @param[in] hKey identifies a currently open key. The key specified by keyName is a subkey
+ of the key identified by hKey.
+ @param[in] keyName points to a null terminated string specifying the relativ name of a key.
+ The name of hKey together with keyName will be generated.
+ @param[in] firstLinkOnly ignored
+ @param[out] pResolvedName returns the resolved keyName.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_getResolvedKeyName(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Bool firstLinkOnly,
+ rtl_uString** pResolvedName);
+
+/** This function loads registry information from a file and save it under the
+ specified keyName.
+
+ @param hKey identifies a currently open key. The key which should store the registry information
+ is a subkey of this key.
+ @param keyName points to a null terminated string specifying the name of the key which stores the
+ registry information. If keyName is NULL the registry information will be saved under
+ the key specified by hKey.
+ @param regFileName points to a null terminated string specifying the file which conains the
+ registry information.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_loadKey(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ rtl_uString* regFileName);
+
+
+/** This function saves the registry information under a specified key and all of its subkeys and save
+ it in a registry file.
+
+ @param hKey identifies a currently open key. The key which information is saved by this
+ function is a subkey of the key identified by hKey.
+ @param keyName points to a null terminated string specifying the name of the subkey.
+ If keyName is NULL the registry information under the key specified by hKey
+ will be saved in the specified file.
+ @param regFileName points to a null terminated string specifying the file which will contain the
+ registry information.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_saveKey(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ rtl_uString* regFileName);
+
+
+/** This function merges the registry information from a specified source with the information of the
+ currently open registry.
+
+ All existing keys will be extended and existing key values will be overwritten.
+ @param hKey identifies a currently open key. The key which information is merged by this
+ function is a subkey of the key identified by hKey.
+ @param keyName points to a null terminated string specifying the name of the key which will be merged.
+ If keyName is NULL the registry information under the key specified by hKey
+ is merged with the complete information from the specified file.
+ @param regFileName points to a null terminated string specifying the file containing the
+ registry information.
+ @param bWarnings if TRUE the function returns an error if a key already exists.
+ @param bReport if TRUE the function reports warnings on stdout if a key already exists.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_mergeKey(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ rtl_uString* regFileName,
+ sal_Bool bWarnings,
+ sal_Bool bReport);
+
+
+/** This function creates a new registry with the specified name and creates a root key.
+
+ @param registryName points to a null terminated string specifying the name of the new registry.
+ @param phRegistry points to a handle of the new registry if the function succeeds otherwise NULL.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_createRegistry(rtl_uString* registryName,
+ RegHandle* phRegistry);
+
+
+/** This function opens the root key of a registry.
+
+ @param hRegistry identifies a currently open registry whose rootKey will be returned.
+ @param phRootKey points to a handle of the open root key if the function succeeds otherwise NULL.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_openRootKey(RegHandle hRegistry,
+ RegKeyHandle* phRootKey);
+
+
+/** This function returns the name of a registry.
+
+ @param hRegistry identifies a currently open registry whose name will be returned.
+ @param pName returns the name of the registry if the function succeeds otherwise an empty string.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_getName(RegHandle hRegistry, rtl_uString** pName);
+
+
+/** This function returns the access mode of the registry.
+
+ @param hReg identifies a currently open registry.
+ @return TRUE if accessmode is read only else FALSE.
+*/
+REG_DLLPUBLIC sal_Bool REGISTRY_CALLTYPE reg_isReadOnly(RegHandle hReg);
+
+
+/** This function opens a registry with the specified name.
+
+ @param registryName points to a null terminated string specifying the name of the registry.
+ @param phRegistry points to a hanle of the opened registry if the function succeeds otherwise NULL.
+ @param accessMode specifies the accessmode of the registry, REG_READONLY or REG_READWRITE.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_openRegistry(rtl_uString* registryName,
+ RegHandle* phRegistry,
+ RegAccessMode accessMode);
+
+
+/** This function closes a registry.
+
+ @param hRegistry identifies a currently open registry which should be closed.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_closeRegistry(RegHandle hRegistry);
+
+
+/** This function destroys a registry.
+
+ @param hRegistry identifies a currently open registry.
+ @param registryName specifies a registry name of a registry which should be destroyed. If the
+ name is NULL the registry itselfs will be destroyed.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_destroyRegistry(RegHandle hRegistry,
+ rtl_uString* registryName);
+
+
+/** This function reports the complete registry information of a key and all of its subkeys.
+
+ All information which are available (keynames, value types, values, ...)
+ will be printed to stdout for report issues only.
+ @param hKey identifies a currently open key which content will be reported.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_dumpRegistry(RegKeyHandle hKey);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/registry/registry.hxx b/include/registry/registry.hxx
new file mode 100644
index 000000000000..d165c594adff
--- /dev/null
+++ b/include/registry/registry.hxx
@@ -0,0 +1,1257 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _REGISTRY_REGISTRY_HXX_
+#define _REGISTRY_REGISTRY_HXX_
+
+#include <registry/regdllapi.h>
+#include <registry/regtype.h>
+#include <rtl/ustring.hxx>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** specifies a collection of function pointers which represents the complete registry C-API.
+
+ This funtions pointers are used by the C++ wrapper to call the C-API.
+*/
+struct Registry_Api
+{
+ void (REGISTRY_CALLTYPE *acquire) (RegHandle);
+ void (REGISTRY_CALLTYPE *release) (RegHandle);
+ sal_Bool (REGISTRY_CALLTYPE *isReadOnly) (RegHandle);
+ RegError (REGISTRY_CALLTYPE *openRootKey) (RegHandle, RegKeyHandle*);
+ RegError (REGISTRY_CALLTYPE *getName) (RegHandle, rtl_uString**);
+ RegError (REGISTRY_CALLTYPE *createRegistry) (rtl_uString*, RegHandle*);
+ RegError (REGISTRY_CALLTYPE *openRegistry) (rtl_uString*, RegHandle*, RegAccessMode);
+ RegError (REGISTRY_CALLTYPE *closeRegistry) (RegHandle);
+ RegError (REGISTRY_CALLTYPE *destroyRegistry) (RegHandle, rtl_uString*);
+ RegError (REGISTRY_CALLTYPE *loadKey) (RegHandle, RegKeyHandle, rtl_uString*, rtl_uString*);
+ RegError (REGISTRY_CALLTYPE *saveKey) (RegHandle, RegKeyHandle, rtl_uString*, rtl_uString*);
+ RegError (REGISTRY_CALLTYPE *mergeKey) (RegHandle, RegKeyHandle, rtl_uString*, rtl_uString*, sal_Bool, sal_Bool);
+ RegError (REGISTRY_CALLTYPE *dumpRegistry) (RegHandle, RegKeyHandle);
+ void (REGISTRY_CALLTYPE *acquireKey) (RegKeyHandle);
+ void (REGISTRY_CALLTYPE *releaseKey) (RegKeyHandle);
+ sal_Bool (REGISTRY_CALLTYPE *isKeyReadOnly) (RegKeyHandle);
+ RegError (REGISTRY_CALLTYPE *getKeyName) (RegKeyHandle, rtl_uString**);
+ RegError (REGISTRY_CALLTYPE *createKey) (RegKeyHandle, rtl_uString*, RegKeyHandle*);
+ RegError (REGISTRY_CALLTYPE *openKey) (RegKeyHandle, rtl_uString*, RegKeyHandle*);
+ RegError (REGISTRY_CALLTYPE *openSubKeys) (RegKeyHandle, rtl_uString*, RegKeyHandle**, sal_uInt32*);
+ RegError (REGISTRY_CALLTYPE *closeSubKeys) (RegKeyHandle*, sal_uInt32);
+ RegError (REGISTRY_CALLTYPE *deleteKey) (RegKeyHandle, rtl_uString*);
+ RegError (REGISTRY_CALLTYPE *closeKey) (RegKeyHandle);
+ RegError (REGISTRY_CALLTYPE *setValue) (RegKeyHandle, rtl_uString*, RegValueType, RegValue, sal_uInt32);
+ RegError (REGISTRY_CALLTYPE *setLongListValue) (RegKeyHandle, rtl_uString*, sal_Int32*, sal_uInt32);
+ RegError (REGISTRY_CALLTYPE *setStringListValue) (RegKeyHandle, rtl_uString*, sal_Char**, sal_uInt32);
+ RegError (REGISTRY_CALLTYPE *setUnicodeListValue)(RegKeyHandle, rtl_uString*, sal_Unicode**, sal_uInt32);
+ RegError (REGISTRY_CALLTYPE *getValueInfo) (RegKeyHandle, rtl_uString*, RegValueType*, sal_uInt32*);
+ RegError (REGISTRY_CALLTYPE *getValue) (RegKeyHandle, rtl_uString*, RegValue);
+ RegError (REGISTRY_CALLTYPE *getLongListValue) (RegKeyHandle, rtl_uString*, sal_Int32**, sal_uInt32*);
+ RegError (REGISTRY_CALLTYPE *getStringListValue) (RegKeyHandle, rtl_uString*, sal_Char***, sal_uInt32*);
+ RegError (REGISTRY_CALLTYPE *getUnicodeListValue)(RegKeyHandle, rtl_uString*, sal_Unicode***, sal_uInt32*);
+ RegError (REGISTRY_CALLTYPE *freeValueList) (RegValueType, RegValue, sal_uInt32);
+ RegError (REGISTRY_CALLTYPE *createLink) (RegKeyHandle, rtl_uString*, rtl_uString*);
+ RegError (REGISTRY_CALLTYPE *deleteLink) (RegKeyHandle, rtl_uString*);
+ RegError (REGISTRY_CALLTYPE *getKeyType) (RegKeyHandle, rtl_uString*, RegKeyType*);
+ RegError (REGISTRY_CALLTYPE *getLinkTarget) (RegKeyHandle, rtl_uString*, rtl_uString**);
+ RegError (REGISTRY_CALLTYPE *getResolvedKeyName) (RegKeyHandle, rtl_uString*, sal_Bool, rtl_uString**);
+ RegError (REGISTRY_CALLTYPE *getKeyNames) (RegKeyHandle, rtl_uString*, rtl_uString***, sal_uInt32*);
+ RegError (REGISTRY_CALLTYPE *freeKeyNames) (rtl_uString**, sal_uInt32);
+};
+
+/** the API initialization function.
+*/
+REG_DLLPUBLIC Registry_Api* REGISTRY_CALLTYPE initRegistry_Api(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+class RegistryKey;
+
+//-----------------------------------------------------------------------------
+
+/** The Registry provides the functionality to read and write information in a registry file.
+
+ The class is implemented inline and use a C-Api.
+*/
+class Registry
+{
+public:
+ /** Default constructor.
+ */
+ inline Registry();
+
+ /// Copy constructcor
+ inline Registry(const Registry& toCopy);
+
+ /// Destructor. The Destructor close the registry if it is open.
+ inline ~Registry();
+
+ /// Assign operator
+ inline Registry& operator = (const Registry& toAssign);
+
+ /// checks if the registry points to a valid registry data file.
+ inline sal_Bool isValid() const;
+
+ /** returns the access mode of the registry.
+
+ @return TRUE if the access mode is readonly else FALSE.
+ */
+ inline sal_Bool isReadOnly() const;
+
+ /** opens the root key of the registry.
+
+ @param rRootKey reference to a RegistryKey which is filled with the rootkey.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError openRootKey(RegistryKey& rRootKey);
+
+ /// returns the name of the current registry data file.
+ inline OUString getName();
+
+ /** creates a new registry with the specified name and creates a root key.
+
+ @param registryName specifies the name of the new registry.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError create(const OUString& registryName);
+
+ /** opens a registry with the specified name.
+
+ If the registry already points to a valid registry, the old registry will be closed.
+ @param registryName specifies a registry name.
+ @param accessMode specifies the access mode for the registry, REG_READONLY or REG_READWRITE.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError open(const OUString& registryName,
+ RegAccessMode accessMode);
+
+ /// closes explicitly the current registry data file.
+ inline RegError close();
+
+ /** destroys a registry.
+
+ @param registryName specifies a registry name, if the name is an empty string the registry
+ itselfs will be destroyed.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError destroy(const OUString& registryName);
+
+ /** loads registry information from a specified file and save it under the
+ specified keyName.
+
+ @param rKey references a currently open key. The key which should store the registry information
+ is a subkey of this key.
+ @param keyName specifies the name of the key which stores the registry information. If keyName is
+ is an empty string the registry information will be saved under the key specified
+ by rKey.
+ @param regFileName specifies the file containing the registry information.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError loadKey(RegistryKey& rKey,
+ const OUString& keyName,
+ const OUString& regFileName);
+
+ /** saves the registry information of the specified key and all subkeys and save
+ it in the specified file.
+
+ @param rKey references a currently open key. The key which information is saved by this
+ function is a subkey of this key.
+ @param keyName specifies the name of the key which information should be stored.
+ If keyName is an empty string the registry information under the key specified
+ by rKey is saved in the specified file.
+ @param regFileName specifies the file containing the registry information.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError saveKey(RegistryKey& rKey,
+ const OUString& keyName,
+ const OUString& regFileName);
+
+ /** merges the registry information of the specified key with the registry
+ information of the specified file.
+
+ All existing keys will be extended and existing key values will be overwritten.
+ @param rKey references a currently open key. The key which information is merged by this
+ function is a subkey of this key
+ @param keyName specifies the name of the key which will be merged.
+ If keyName is an empty string the registry information under the key specified
+ by rKey is merged with the information from the specified file.
+ @param regFileName specifies the file containing the registry information.
+ @param bWarnings if TRUE the function returns an error if a key already exists.
+ @param bReport if TRUE the function reports warnings on stdout if a key already exists.
+ @return REG_NO_ERROR if succeeds else an error code. If it returns an error the registry will
+ restore the state before merging.
+ */
+ inline RegError mergeKey(RegistryKey& rKey,
+ const OUString& keyName,
+ const OUString& regFileName,
+ sal_Bool bWarnings = sal_False,
+ sal_Bool bReport = sal_False);
+
+ /** This function reports the complete registry information of a key and all of its subkeys.
+
+ All information which are available (keynames, value types, values, ...)
+ will be printed to stdout for report issues only.
+ @param rKey references a currently open key which content will be reported.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError dumpRegistry(RegistryKey& rKey);
+
+ friend class RegistryKey;
+ friend class RegistryKeyArray;
+ friend class RegistryKeyNames;
+
+ /// returns the used registry Api.
+ const Registry_Api* getApi() { return m_pApi; }
+protected:
+
+ /// stores the used and initialized registry Api.
+ const Registry_Api* m_pApi;
+ /// stores the handle of the underlying registry file on which most of the functions work.
+ RegHandle m_hImpl;
+};
+
+
+//-----------------------------------------------------------------------------
+
+/** RegistryKeyArray represents an array of open keys.
+
+ RegistryKeyArray is a helper class to work with an array of keys.
+*/
+class RegistryKeyArray
+{
+public:
+ /// Default constructor
+ inline RegistryKeyArray();
+
+ /// Destructor, all subkeys will be closed.
+ inline ~RegistryKeyArray();
+
+ /// returns the open key specified by index.
+ inline RegistryKey getElement(sal_uInt32 index);
+
+ /// returns the length of the array.
+ inline sal_uInt32 getLength();
+
+ friend class RegistryKey;
+protected:
+ /** sets the data of the key array.
+
+ @param registry specifies the registry files where the keys are located.
+ @param phKeys points to an array of open keys.
+ @param length specifies the length of the array specified by phKeys.
+ */
+ inline void setKeyHandles(Registry& registry, RegKeyHandle* phKeys, sal_uInt32 length);
+ /// close all subkeys
+ inline RegError closeKeyHandles();
+
+ /// stores the number of open subkeys, the number of elements.
+ sal_uInt32 m_length;
+ /// stores an array of open subkeys.
+ RegKeyHandle* m_phKeys;
+ /// stores the handle to the registry file where the appropriate keys are located.
+ Registry m_registry;
+};
+
+
+/** RegistryKeyNames represents an array of key names.
+
+ RegistryKeyNames is a helper class to work with an array of key names.
+*/
+class RegistryKeyNames
+{
+public:
+ /// Default constructor
+ inline RegistryKeyNames();
+
+ /// Destructor, the internal array with key names will be deleted.
+ inline ~RegistryKeyNames();
+
+ /// returns the name of the key sepecified by index.
+ inline OUString getElement(sal_uInt32 index);
+
+ /// returns the length of the array.
+ inline sal_uInt32 getLength();
+
+ friend class RegistryKey;
+protected:
+ /** sets the data of the array.
+
+ @param registry specifies the registry files where the keys are located.
+ @param pKeyNames points to an array of key names.
+ @param length specifies the length of the array specified by pKeyNames.
+ */
+ inline void setKeyNames(Registry& registry, rtl_uString** pKeyNames, sal_uInt32 length);
+ /// delete the array of key names.
+ inline RegError freeKeyNames();
+
+ /// stores the number of key names, the number of elements.
+ sal_uInt32 m_length;
+ /// stores an array of key names.
+ rtl_uString** m_pKeyNames;
+ /// stores the handle to the registry file where the appropriate keys are located.
+ Registry m_registry;
+};
+
+//-----------------------------------------------------------------------------
+
+/** RegistryValueList represents a value list of the specified type.
+
+ RegistryValueList is a helper class to work with a list value.
+*/
+template<class ValueType>
+class RegistryValueList
+{
+public:
+ /// Default constructor
+ RegistryValueList()
+ : m_length(0)
+ , m_pValueList(NULL)
+ , m_valueType(RG_VALUETYPE_NOT_DEFINED)
+ {}
+
+ /// Destructor, the internal value list will be freed.
+ ~RegistryValueList()
+ {
+ if (m_pValueList)
+ {
+ m_registry.getApi()->freeValueList(m_valueType, m_pValueList, m_length);
+ }
+ }
+
+ /// returns the value of the list specified by index.
+ ValueType getElement(sal_uInt32 index)
+ {
+ if (m_registry.isValid() && index < m_length)
+ {
+ return m_pValueList[index];
+ } else
+ {
+ return 0;
+ }
+ }
+
+ /// returns the length of the list.
+ sal_uInt32 getLength()
+ {
+ return m_length;
+ }
+
+ friend class RegistryKey;
+protected:
+ /** sets the data of the value list.
+
+ @param registry specifies the registry files where the appropriate key is located.
+ @param valueType specifies the type of the list values.
+ @param pValueList points to a value list.
+ @param length specifies the length of the list.
+ */
+ void setValueList(Registry& registry, RegValueType valueType,
+ ValueType* pValueList, sal_uInt32 length)
+ {
+ m_length = length;
+ m_pValueList = pValueList;
+ m_valueType = valueType;
+ m_registry = registry;
+ }
+
+ /// stores the length of the list, the number of elements.
+ sal_uInt32 m_length;
+ /// stores the value list.
+ ValueType* m_pValueList;
+ /// stores the type of the list elements
+ RegValueType m_valueType;
+ /** stores the handle to the registry file where the appropriate key to this
+ value is located.
+ */
+ Registry m_registry;
+};
+
+//-----------------------------------------------------------------------------
+
+/** RegistryKey reads or writes information of the underlying key in a registry.
+
+ Class is inline and use a load on call C-Api.
+*/
+class RegistryKey
+{
+public:
+ /// Default constructor
+ inline RegistryKey();
+
+ /// Copy constructor
+ inline RegistryKey(const RegistryKey& toCopy);
+
+ /// Destructor, close the key if it references an open one.
+ inline ~RegistryKey();
+
+ /// Assign operator
+ inline RegistryKey& operator = (const RegistryKey& toAssign);
+
+ /// checks if the key points to a valid registry key.
+ inline sal_Bool isValid() const;
+
+ /** returns the access mode of the key.
+
+ @return TRUE if access mode is read only else FALSE.
+ */
+ inline sal_Bool isReadOnly() const;
+
+ /// returns the full qualified name of the key beginning with the rootkey.
+ inline OUString getName();
+
+ /** creates a new key or opens a key if the specified key already exists.
+
+ The specified keyname is relativ to this key.
+ @param keyName specifies the name of the key which will be opened or created.
+ @param rNewKey references a RegistryKey which will be filled with the new or open key.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError createKey(const OUString& keyName,
+ RegistryKey& rNewKey);
+
+ /** opens the specified key.
+
+ The specified keyname is relativ to this key.
+ @param keyName specifies the name of the key which will be opened.
+ @param rOpenKey references a RegistryKey which will be filled with the open key.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError openKey(const OUString& keyName,
+ RegistryKey& rOpenKey);
+
+ /** opens all subkeys of the specified key.
+
+ The specified keyname is relativ to this key.
+ @param keyName specifies the name of the key which subkeys will be opened.
+ @param rSubKeys reference a RegistryKeyArray which will be filled with the open subkeys.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError openSubKeys(const OUString& keyName,
+ RegistryKeyArray& rSubKeys);
+
+ /** returns an array with the names of all subkeys of the specified key.
+
+ The specified keyname is relativ to this key.
+ @param keyName specifies the name of the key which subkey names will be returned.
+ @param rSubKeyNames reference a RegistryKeyNames array which will be filled with the subkey names.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError getKeyNames(const OUString& keyName,
+ RegistryKeyNames& rSubKeyNames);
+
+ /** closes all keys specified in the array.
+
+ @param rSubKeys reference a RegistryKeyArray which contains the open keys.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError closeSubKeys(RegistryKeyArray& rSubKeys);
+
+ /** deletes the specified key.
+
+ @param keyName specifies the name of the key which will be deleted.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError deleteKey(const OUString& keyName);
+
+ /// closes explicitly the current key
+ inline RegError closeKey();
+
+ /// releases the current key
+ inline void releaseKey();
+
+ /** sets a value of a key.
+
+ @param keyName specifies the name of the key which value will be set.
+ If keyName is an empty string, the value will be set for the key
+ specified by hKey.
+ @param valueType specifies the type of the value.
+ @param pValue points to a memory block containing the data for the value.
+ @param valueSize specifies the size of pData in bytes
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError setValue(const OUString& keyName,
+ RegValueType valueType,
+ RegValue pValue,
+ sal_uInt32 valueSize);
+
+ /** sets a long list value of a key.
+
+ @param keyName specifies the name of the key which value will be set.
+ If keyName is an empty string, the value will be set for the key
+ specified by hKey.
+ @param pValueList points to an array of longs containing the data for the value.
+ @param len specifies the length of the list (the array referenced by pValueList).
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError setLongListValue(const OUString& keyName,
+ sal_Int32* pValueList,
+ sal_uInt32 len);
+
+ /** sets an ascii list value of a key.
+
+ @param keyName specifies the name of the key which value will be set.
+ If keyName is an empty string, the value will be set for the key
+ specified by hKey.
+ @param pValueList points to an array of sal_Char* containing the data for the value.
+ @param len specifies the length of the list (the array referenced by pValueList).
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError setStringListValue(const OUString& keyName,
+ sal_Char** pValueList,
+ sal_uInt32 len);
+
+ /** sets an unicode string list value of a key.
+
+ @param keyName specifies the name of the key which value will be set.
+ If keyName is an empty string, the value will be set for the key
+ specified by hKey.
+ @param pValueList points to an array of sal_Unicode* containing the data for the value.
+ @param len specifies the length of the list (the array referenced by pValueList).
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError setUnicodeListValue(const OUString& keyName,
+ sal_Unicode** pValueList,
+ sal_uInt32 len);
+
+ /** gets info about type and size of a value.
+
+ @param keyName specifies the name of the key which value info will be returned.
+ If keyName is an empty string, the value info of the key
+ specified by hKey will be returned.
+ @param pValueType returns the type of the value.
+ @param pValueSize returns the size of the value in bytes or the length of a list value.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError getValueInfo(const OUString& keyName,
+ RegValueType* pValueType,
+ sal_uInt32* pValueSize);
+
+ /** gets the value of a key.
+
+ @param keyName specifies the name of the key which value will be returned.
+ If keyName is an empty string, the value is get from the key
+ specified by hKey.
+ @param pValue points to an allocated memory block receiving the data of the value.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError getValue(const OUString& keyName,
+ RegValue pValue);
+
+ /** gets a long list value of a key.
+
+ @param keyName specifies the name of the key which value will be returned.
+ If keyName is an empty string, the value is get from the key
+ specified by hKey.
+ @param rValueList references a RegistryValueList which will be filled with the long values.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError getLongListValue(const OUString& keyName,
+ RegistryValueList<sal_Int32>& rValueList);
+
+ /** gets an ascii list value of a key.
+
+ @param keyName specifies the name of the key which value will be returned.
+ If keyName is an empty string, the value is get from the key
+ specified by hKey.
+ @param rValueList references a RegistryValueList which will be filled with the ascii values.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError getStringListValue(const OUString& keyName,
+ RegistryValueList<sal_Char*>& rValueList);
+
+ /** gets a unicode value of a key.
+
+ @param keyName specifies the name of the key which value will be returned.
+ If keyName is an empty string, the value is get from the key
+ specified by hKey.
+ @param rValueList reference a RegistryValueList which will be filled with the unicode values.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError getUnicodeListValue(const OUString& keyName,
+ RegistryValueList<sal_Unicode*>& rValueList);
+
+ /** used to create a link.
+
+ @deprecated Links are no longer supported.
+
+ @return REG_INVALID_LINK
+ */
+ inline RegError createLink(const OUString& linkName,
+ const OUString& linkTarget);
+
+ /** used to delete a link.
+
+ @deprecated Links are no longer supported.
+
+ @return REG_INVALID_LINK
+ */
+ inline RegError deleteLink(const OUString& linkName);
+
+ /** returns the type of the specified key.
+
+ @param name specifies the name of the key or link.
+ @param pKeyType returns the type of the key (always RG_KEYTYPE).
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError getKeyType(const OUString& name,
+ RegKeyType* pKeyType) const;
+
+ /** used to return the target of a link.
+
+ @deprecated Links are no longer supported.
+
+ @return REG_INVALID_LINK
+ */
+ inline RegError getLinkTarget(const OUString& linkName,
+ OUString& rLinkTarget) const;
+
+ /** resolves a keyname.
+
+ @param[in] keyName specifies the name of the key which will be resolved relative to this key.
+ The resolved name will be prefixed with the name of this key.
+ @param[in] firstLinkOnly ignored
+ @param[out] rResolvedName the resolved name.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError getResolvedKeyName(const OUString& keyName,
+ sal_Bool firstLinkOnly,
+ OUString& rResolvedName) const;
+
+ /// returns the name of the registry in which the key is defined.
+ inline OUString getRegistryName();
+
+ /// returns the registry in which the key is defined.
+ Registry getRegistry() const { return m_registry; }
+
+ friend class Registry;
+public:
+ /// @cond INTERNAL
+
+ /** Constructor, which initialize a RegistryKey with registry and an valid key handle.
+
+ This constructor is internal only.
+ */
+ inline RegistryKey(Registry& registry,
+ RegKeyHandle hKey);
+
+ /** returns the internal key handle.
+ */
+ RegKeyHandle getKeyHandle() const { return m_hImpl; }
+
+protected:
+ /** sets the internal registry on which this key should work.
+ */
+ inline void setRegistry(Registry& registry);
+
+ /// @endcond
+
+ /// stores the registry on which this key works
+ Registry m_registry;
+ /// stores the current key handle of this key
+ RegKeyHandle m_hImpl;
+};
+
+
+//-----------------------------------------------------------------------------
+
+inline RegistryKeyArray::RegistryKeyArray()
+ : m_length(0)
+ , m_phKeys(NULL)
+{
+}
+
+inline RegistryKeyArray::~RegistryKeyArray()
+{
+ if (m_phKeys)
+ m_registry.m_pApi->closeSubKeys(m_phKeys, m_length);
+}
+
+inline RegistryKey RegistryKeyArray::getElement(sal_uInt32 index)
+{
+ if (m_registry.isValid() && index < m_length)
+ return RegistryKey(m_registry, m_phKeys[index]);
+ else
+ return RegistryKey();
+}
+
+inline sal_uInt32 RegistryKeyArray::getLength()
+{
+ return m_length;
+}
+
+inline void RegistryKeyArray::setKeyHandles(Registry& registry,
+ RegKeyHandle* phKeys,
+ sal_uInt32 length)
+{
+ m_phKeys = phKeys;
+ m_length = length;
+ m_registry = registry;
+}
+
+inline RegError RegistryKeyArray::closeKeyHandles()
+{
+ if (m_registry.isValid() && m_phKeys)
+ {
+ RegError ret;
+ ret = m_registry.m_pApi->closeSubKeys(m_phKeys, m_length);
+ m_registry = Registry();
+ m_length = 0;
+ m_phKeys = NULL;
+ return ret;
+ } else
+ return(REG_INVALID_KEY);
+}
+
+//-----------------------------------------------------------------------------
+
+inline RegistryKeyNames::RegistryKeyNames()
+ : m_length(0)
+ , m_pKeyNames(NULL)
+{
+}
+
+inline RegistryKeyNames::~RegistryKeyNames()
+{
+ if (m_pKeyNames)
+ m_registry.m_pApi->freeKeyNames(m_pKeyNames, m_length);
+}
+
+inline OUString RegistryKeyNames::getElement(sal_uInt32 index)
+{
+
+ if (m_pKeyNames && index < m_length)
+ return m_pKeyNames[index];
+ else
+ return OUString();
+}
+
+inline sal_uInt32 RegistryKeyNames::getLength()
+{
+ return m_length;
+}
+
+inline void RegistryKeyNames::setKeyNames(Registry& registry,
+ rtl_uString** pKeyNames,
+ sal_uInt32 length)
+{
+ m_pKeyNames = pKeyNames;
+ m_length = length;
+ m_registry = registry;
+}
+
+inline RegError RegistryKeyNames::freeKeyNames()
+{
+ if (m_registry.isValid() && m_pKeyNames)
+ {
+ RegError ret = REG_NO_ERROR;
+ ret = m_registry.m_pApi->freeKeyNames(m_pKeyNames, m_length);
+ m_registry = Registry();
+ m_length = 0;
+ m_pKeyNames = NULL;
+ return ret;
+ } else
+ return REG_INVALID_KEY;
+}
+
+//-----------------------------------------------------------------------------
+
+inline RegistryKey::RegistryKey()
+ : m_hImpl(NULL)
+ { }
+
+/// @cond INTERNAL
+inline RegistryKey::RegistryKey(Registry& registry, RegKeyHandle hKey)
+ : m_registry(registry)
+ , m_hImpl(hKey)
+ {
+ if (m_hImpl)
+ m_registry.m_pApi->acquireKey(m_hImpl);
+ }
+/// @endcond
+
+inline RegistryKey::RegistryKey(const RegistryKey& toCopy)
+ : m_registry(toCopy.m_registry)
+ , m_hImpl(toCopy.m_hImpl)
+ {
+ if (m_hImpl)
+ m_registry.m_pApi->acquireKey(m_hImpl);
+ }
+
+/// @cond INTERNAL
+inline void RegistryKey::setRegistry(Registry& registry)
+ {
+ m_registry = registry;
+ }
+/// @endcond
+
+inline RegistryKey::~RegistryKey()
+ {
+ if (m_hImpl)
+ m_registry.m_pApi->releaseKey(m_hImpl);
+ }
+
+inline RegistryKey& RegistryKey::operator = (const RegistryKey& toAssign)
+{
+ m_registry = toAssign.m_registry;
+
+ if (toAssign.m_hImpl)
+ m_registry.m_pApi->acquireKey(toAssign.m_hImpl);
+ if (m_hImpl)
+ m_registry.m_pApi->releaseKey(m_hImpl);
+ m_hImpl = toAssign.m_hImpl;
+
+ return *this;
+}
+
+inline sal_Bool RegistryKey::isValid() const
+ { return (m_hImpl != NULL); }
+
+inline sal_Bool RegistryKey::isReadOnly() const
+ {
+ if (m_registry.isValid())
+ return (m_registry.m_pApi)->isKeyReadOnly(m_hImpl);
+ else
+ return sal_False;
+ }
+
+inline OUString RegistryKey::getName()
+ {
+ OUString sRet;
+ if (m_registry.isValid())
+ m_registry.m_pApi->getKeyName(m_hImpl, &sRet.pData);
+ return sRet;
+ }
+
+inline RegError RegistryKey::createKey(const OUString& keyName,
+ RegistryKey& rNewKey)
+ {
+ if (rNewKey.isValid()) rNewKey.closeKey();
+ if (m_registry.isValid())
+ {
+ RegError ret = m_registry.m_pApi->createKey(m_hImpl, keyName.pData, &rNewKey.m_hImpl);
+ if (!ret) rNewKey.setRegistry(m_registry);
+ return ret;
+ } else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::openKey(const OUString& keyName,
+ RegistryKey& rOpenKey)
+ {
+ if (rOpenKey.isValid()) rOpenKey.closeKey();
+ if (m_registry.isValid())
+ {
+ RegError ret = m_registry.m_pApi->openKey(m_hImpl, keyName.pData,
+ &rOpenKey.m_hImpl);
+ if (!ret) rOpenKey.setRegistry(m_registry);
+ return ret;
+ } else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::openSubKeys(const OUString& keyName,
+ RegistryKeyArray& rSubKeys)
+ {
+ if (m_registry.isValid())
+ {
+ RegError ret = REG_NO_ERROR;
+ RegKeyHandle* pSubKeys;
+ sal_uInt32 nSubKeys;
+ ret = m_registry.m_pApi->openSubKeys(m_hImpl, keyName.pData,
+ &pSubKeys, &nSubKeys);
+ if ( ret )
+ {
+ return ret;
+ } else
+ {
+ rSubKeys.setKeyHandles(m_registry, pSubKeys, nSubKeys);
+ return ret;
+ }
+ } else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::getKeyNames(const OUString& keyName,
+ RegistryKeyNames& rSubKeyNames)
+ {
+ if (m_registry.isValid())
+ {
+ RegError ret = REG_NO_ERROR;
+ rtl_uString** pSubKeyNames;
+ sal_uInt32 nSubKeys;
+ ret = m_registry.m_pApi->getKeyNames(m_hImpl, keyName.pData,
+ &pSubKeyNames, &nSubKeys);
+ if ( ret )
+ {
+ return ret;
+ } else
+ {
+ rSubKeyNames.setKeyNames(m_registry, pSubKeyNames, nSubKeys);
+ return ret;
+ }
+ } else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::closeSubKeys(RegistryKeyArray& rSubKeys)
+ {
+ if (m_registry.isValid())
+ return rSubKeys.closeKeyHandles();
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::deleteKey(const OUString& keyName)
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->deleteKey(m_hImpl, keyName.pData);
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::closeKey()
+ {
+ if (m_registry.isValid())
+ {
+ RegError ret = m_registry.m_pApi->closeKey(m_hImpl);
+ if (!ret)
+ {
+ m_hImpl = NULL;
+ m_registry = Registry();
+ }
+ return ret;
+ } else
+ return REG_INVALID_KEY;
+ }
+
+inline void RegistryKey::releaseKey()
+{
+ if (m_registry.isValid() && (m_hImpl != 0))
+ {
+ m_registry.m_pApi->releaseKey(m_hImpl), m_hImpl = 0;
+ }
+}
+
+inline RegError RegistryKey::setValue(const OUString& keyName,
+ RegValueType valueType,
+ RegValue pValue,
+ sal_uInt32 valueSize)
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->setValue(m_hImpl, keyName.pData, valueType,
+ pValue, valueSize);
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::setLongListValue(const OUString& keyName,
+ sal_Int32* pValueList,
+ sal_uInt32 len)
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->setLongListValue(m_hImpl, keyName.pData,
+ pValueList, len);
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::setStringListValue(const OUString& keyName,
+ sal_Char** pValueList,
+ sal_uInt32 len)
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->setStringListValue(m_hImpl, keyName.pData,
+ pValueList, len);
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::setUnicodeListValue(const OUString& keyName,
+ sal_Unicode** pValueList,
+ sal_uInt32 len)
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->setUnicodeListValue(m_hImpl, keyName.pData,
+ pValueList, len);
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::getValueInfo(const OUString& keyName,
+ RegValueType* pValueType,
+ sal_uInt32* pValueSize)
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->getValueInfo(m_hImpl, keyName.pData, pValueType, pValueSize);
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::getValue(const OUString& keyName,
+ RegValue pValue)
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->getValue(m_hImpl, keyName.pData, pValue);
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::getLongListValue(const OUString& keyName,
+ RegistryValueList<sal_Int32>& rValueList)
+ {
+ if (m_registry.isValid())
+ {
+ RegError ret = REG_NO_ERROR;
+ sal_Int32* pValueList;
+ sal_uInt32 length;
+ ret = m_registry.m_pApi->getLongListValue(m_hImpl, keyName.pData,
+ &pValueList, &length);
+ if ( ret )
+ {
+ return ret;
+ } else
+ {
+ rValueList.setValueList(m_registry, RG_VALUETYPE_LONGLIST,
+ pValueList, length);
+ return ret;
+ }
+ } else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::getStringListValue(const OUString& keyName,
+ RegistryValueList<sal_Char*>& rValueList)
+ {
+ if (m_registry.isValid())
+ {
+ RegError ret = REG_NO_ERROR;
+ sal_Char** pValueList;
+ sal_uInt32 length;
+ ret = m_registry.m_pApi->getStringListValue(m_hImpl, keyName.pData,
+ &pValueList, &length);
+ if ( ret )
+ {
+ return ret;
+ } else
+ {
+ rValueList.setValueList(m_registry, RG_VALUETYPE_STRINGLIST,
+ pValueList, length);
+ return ret;
+ }
+ } else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::getUnicodeListValue(const OUString& keyName,
+ RegistryValueList<sal_Unicode*>& rValueList)
+ {
+ if (m_registry.isValid())
+ {
+ RegError ret = REG_NO_ERROR;
+ sal_Unicode** pValueList;
+ sal_uInt32 length;
+ ret = m_registry.m_pApi->getUnicodeListValue(m_hImpl, keyName.pData,
+ &pValueList, &length);
+ if ( ret )
+ {
+ return ret;
+ } else
+ {
+ rValueList.setValueList(m_registry, RG_VALUETYPE_UNICODELIST,
+ pValueList, length);
+ return ret;
+ }
+ } else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::createLink(const OUString& linkName,
+ const OUString& linkTarget)
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->createLink(m_hImpl, linkName.pData, linkTarget.pData);
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::deleteLink(const OUString& linkName)
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->deleteLink(m_hImpl, linkName.pData);
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::getKeyType(const OUString& keyName,
+ RegKeyType* pKeyType) const
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->getKeyType(m_hImpl, keyName.pData, pKeyType);
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::getLinkTarget(const OUString& linkName,
+ OUString& rLinkTarget) const
+ {
+ if (m_registry.isValid())
+ {
+ return m_registry.m_pApi->getLinkTarget(m_hImpl,
+ linkName.pData,
+ &rLinkTarget.pData);
+ } else
+ return REG_INVALID_KEY;
+ }
+
+
+inline RegError RegistryKey::getResolvedKeyName(const OUString& keyName,
+ sal_Bool firstLinkOnly,
+ OUString& rResolvedName) const
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->getResolvedKeyName(m_hImpl,
+ keyName.pData,
+ firstLinkOnly,
+ &rResolvedName.pData);
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline OUString RegistryKey::getRegistryName()
+ {
+ if (m_registry.isValid())
+ {
+ return m_registry.getName();
+ } else
+ return OUString();
+ }
+
+//-----------------------------------------------------------------------------
+
+inline Registry::Registry()
+ : m_pApi(initRegistry_Api())
+ , m_hImpl(NULL)
+ { }
+
+inline Registry::Registry(const Registry& toCopy)
+ : m_pApi(toCopy.m_pApi)
+ , m_hImpl(toCopy.m_hImpl)
+ {
+ if (m_hImpl)
+ m_pApi->acquire(m_hImpl);
+ }
+
+
+inline Registry::~Registry()
+ {
+ if (m_hImpl)
+ m_pApi->release(m_hImpl);
+ }
+
+inline Registry& Registry::operator = (const Registry& toAssign)
+{
+ if (toAssign.m_hImpl)
+ toAssign.m_pApi->acquire(toAssign.m_hImpl);
+ if (m_hImpl)
+ m_pApi->release(m_hImpl);
+
+ m_pApi = toAssign.m_pApi;
+ m_hImpl = toAssign.m_hImpl;
+
+ return *this;
+}
+
+inline sal_Bool Registry::isValid() const
+ { return ( m_hImpl != NULL ); }
+
+inline sal_Bool Registry::isReadOnly() const
+ { return m_pApi->isReadOnly(m_hImpl); }
+
+inline RegError Registry::openRootKey(RegistryKey& rRootKey)
+ {
+ rRootKey.setRegistry(*this);
+ return m_pApi->openRootKey(m_hImpl, &rRootKey.m_hImpl);
+ }
+
+inline OUString Registry::getName()
+ {
+ OUString sRet;
+ m_pApi->getName(m_hImpl, &sRet.pData);
+ return sRet;
+ }
+
+inline RegError Registry::create(const OUString& registryName)
+ {
+ if (m_hImpl)
+ m_pApi->release(m_hImpl);
+ return m_pApi->createRegistry(registryName.pData, &m_hImpl);
+ }
+
+inline RegError Registry::open(const OUString& registryName,
+ RegAccessMode accessMode)
+ {
+ if (m_hImpl)
+ m_pApi->release(m_hImpl);
+ return m_pApi->openRegistry(registryName.pData, &m_hImpl, accessMode);
+ }
+
+inline RegError Registry::close()
+ {
+ RegError ret = m_pApi->closeRegistry(m_hImpl);
+ if (!ret)
+ m_hImpl = NULL;
+ return ret;
+ }
+
+inline RegError Registry::destroy(const OUString& registryName)
+ {
+ RegError ret = m_pApi->destroyRegistry(m_hImpl, registryName.pData);
+ if ( !ret && registryName.isEmpty() )
+ m_hImpl = NULL;
+ return ret;
+ }
+
+inline RegError Registry::loadKey(RegistryKey& rKey,
+ const OUString& keyName,
+ const OUString& regFileName)
+ { return m_pApi->loadKey(m_hImpl, rKey.m_hImpl, keyName.pData, regFileName.pData); }
+
+inline RegError Registry::saveKey(RegistryKey& rKey,
+ const OUString& keyName,
+ const OUString& regFileName)
+ { return m_pApi->saveKey(m_hImpl, rKey.m_hImpl, keyName.pData, regFileName.pData); }
+
+inline RegError Registry::mergeKey(RegistryKey& rKey,
+ const OUString& keyName,
+ const OUString& regFileName,
+ sal_Bool bWarnings,
+ sal_Bool bReport)
+ { return m_pApi->mergeKey(m_hImpl, rKey.m_hImpl, keyName.pData, regFileName.pData, bWarnings, bReport); }
+
+inline RegError Registry::dumpRegistry(RegistryKey& rKey)
+ { return m_pApi->dumpRegistry(m_hImpl, rKey.m_hImpl); }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/registry/regtype.h b/include/registry/regtype.h
new file mode 100644
index 000000000000..86ddb299fb37
--- /dev/null
+++ b/include/registry/regtype.h
@@ -0,0 +1,168 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _REGISTRY_REGTYPE_H_
+#define _REGISTRY_REGTYPE_H_
+
+#include <sal/types.h>
+
+/// defines the type of a registry handle used in the C API.
+typedef void* RegHandle;
+
+/// defines the type of a registry key handle used in the C API.
+typedef void* RegKeyHandle;
+
+/// defines the type of a registry key value handle used in the C API.
+typedef void* RegValue;
+
+/** defines the open/access mode of the registry.
+
+ Two modes are valid:
+ -REG_READONLY allows readonly access
+ -REG_READWRITE allows read and write access
+ */
+typedef sal_uInt16 RegAccessMode;
+
+/// Flag to specify the open mode of a registry. This mode allows readonly access.
+#define REG_READONLY 0x0001
+/// Flag to specify the open mode of a registry. This mode allows read and write access.
+#define REG_READWRITE 0x0002
+
+/** defines the type of a registry key.
+
+ The registry differs between normal keys which can contain subkeys or
+ a value and link keys which navigate over the linktarget to an existing
+ other key (which are no longer supported).
+*/
+enum RegKeyType
+{
+ /// represents a real key
+ RG_KEYTYPE,
+ /// represents a link (which is no longer supported)
+ RG_LINKTYPE
+};
+
+/** defines the type of a key value.
+
+ A registry key can contain a value which has one of seven different types.
+ Three simple types (long, ascii and unicode string) and a list type of
+ these simple types. Furthermore a binary type which provides the possibilty
+ to define own data structures and store these types in the registry. The UNO
+ core reflection data is stored as a binary blob in the type registry.
+ */
+enum RegValueType
+{
+ /// The key has no value or the value type is unknown.
+ RG_VALUETYPE_NOT_DEFINED,
+ /// The key has a value of type long
+ RG_VALUETYPE_LONG,
+ /// The key has a value of type ascii string
+ RG_VALUETYPE_STRING,
+ /// The key has a value of type unicode string
+ RG_VALUETYPE_UNICODE,
+ /// The key has a value of type binary
+ RG_VALUETYPE_BINARY,
+ /// The key has a value of type long list
+ RG_VALUETYPE_LONGLIST,
+ /// The key has a value of type ascii string list
+ RG_VALUETYPE_STRINGLIST,
+ /// The key has a value of type unicode string list
+ RG_VALUETYPE_UNICODELIST
+};
+
+/// specifies the possible error codes which can occur using the registry API.
+enum RegError
+{
+ /// no error.
+ REG_NO_ERROR,
+ /// internal registry error.
+ REG_INTERNAL_ERROR,
+
+ /// registry is not open.
+ REG_REGISTRY_NOT_OPEN,
+ /// registry does not exists.
+ REG_REGISTRY_NOT_EXISTS,
+ /// registry is open with readonly access rights.
+ REG_REGISTRY_READONLY,
+ /// destroy a registry failed. There are may be any open keys.
+ REG_DESTROY_REGISTRY_FAILED,
+ /** registry cannot be opened with readwrite access because the registry is already
+ open with readwrite access anywhere.
+ */
+ REG_CANNOT_OPEN_FOR_READWRITE,
+ /** registry is in an invalid state or the registry does not point to
+ a valid registry data file.
+ */
+ REG_INVALID_REGISTRY,
+
+ /// the key or key handle points to an invalid key or closed key.
+ REG_KEY_NOT_OPEN,
+ /// the specified keyname points to a nonexisting key.
+ REG_KEY_NOT_EXISTS,
+ /// the key with the specified keyname cannot be created.
+ REG_CREATE_KEY_FAILED,
+ /// the specified key cannot be deleted. Maybe an open key handle exists to this key.
+ REG_DELETE_KEY_FAILED,
+ /** the keyname is invalid. This error will return if the keyname
+ is NULL but should not be NULL in the context of a called function.
+ */
+ REG_INVALID_KEYNAME,
+ /// the key is not in a valid state.
+ REG_INVALID_KEY,
+
+ /// the key has no value
+ REG_VALUE_NOT_EXISTS,
+ /// setting the specified value of a key failed.
+ REG_SET_VALUE_FAILED,
+ /// deleting of the key value failed.
+ REG_DELETE_VALUE_FAILED,
+ /// the key has a invalid value or the value type is unknown.
+ REG_INVALID_VALUE,
+
+ /// merging a key, the value and all subkeys failed.
+ REG_MERGE_ERROR,
+ /** conflicts exists during the merge process of a key. This could happen if
+ the value of a key already exists and the merge process will replace it.
+ */
+ REG_MERGE_CONFLICT,
+
+ /** a recursion was detected resolving different link targets (no longer
+ used).
+ */
+ REG_DETECT_RECURSION,
+ /** the link is invalid and can not be resolved (now used by all
+ link-related operations, as links are no longer supported).
+ */
+ REG_INVALID_LINK,
+ /// the specified linkname is not valid (no longer used).
+ REG_INVALID_LINKNAME,
+ /// the linknane is not valid (no longer used).
+ REG_INVALID_LINKTARGET,
+ /// the link target points to a nonexisting key (no longer used).
+ REG_LINKTARGET_NOT_EXIST,
+ /// the reserved buffer for the resolved keyname is to small.
+ REG_BUFFERSIZE_TOSMALL
+};
+
+/// specify the calling convention for the registry API
+#define REGISTRY_CALLTYPE SAL_CALL
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/registry/types.h b/include/registry/types.h
new file mode 100644
index 000000000000..0ad7977486f4
--- /dev/null
+++ b/include/registry/types.h
@@ -0,0 +1,334 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_registry_types_h
+#define INCLUDED_registry_types_h
+
+#include "sal/types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** specifies the typeclass of a binary type blob.
+
+ The general structure of a binary type blob is always the same. It depends
+ on the typeclass which parts of the blob are filled with data or not.
+ */
+enum RTTypeClass {
+ /** specifies that the structure of the given blob is unknown and can't be
+ read.
+ */
+ RT_TYPE_INVALID,
+
+ /** specifies that the blob represents an interface type. An interface blob
+ can contain a base interface, attributes and methods.
+ */
+ RT_TYPE_INTERFACE,
+
+ /** specifies that the blob represents a module type. A module blob can
+ contain a base module and constant members (fields).
+ */
+ RT_TYPE_MODULE,
+
+ /** specifies that the blob represents a struct type. A struct blob can
+ contain a base struct and members (fields).
+ */
+ RT_TYPE_STRUCT,
+
+ /** specifies that the blob represents an enum type. An enum blob can
+ contain enum values which are accessible as fields.
+ */
+ RT_TYPE_ENUM,
+
+ /** specifies that the blob represents an exception type. An exception blob
+ can contain a base exception and members (fields).
+ */
+ RT_TYPE_EXCEPTION,
+
+ /** specifies that the blob represents a typedef type. A typedef blob can
+ contain a base type.
+ */
+ RT_TYPE_TYPEDEF,
+
+ /** specifies that the blob represents a service type. A service blob can
+ contain a base service, properties (fields), references to services or
+ interfaces.
+ */
+ RT_TYPE_SERVICE,
+
+ /** specifies that the blob represents a singleton type (a named object)
+ which refers exactly one existing service.
+ */
+ RT_TYPE_SINGLETON,
+
+ /// deprecated, not used.
+ RT_TYPE_OBJECT,
+
+ /** specifies that the blob represents a constants type. A constants blob
+ can contain constant types as fields.
+ */
+ RT_TYPE_CONSTANTS,
+
+ /** @deprecated
+ a union type was evaluated but currently not supported.
+ */
+ RT_TYPE_UNION,
+
+ /// @cond INTERNAL
+ /**
+ Flag for published entities.
+
+ Used in combination with RT_TYPE_INTERFACE, RT_TYPE_STRUCT, RT_TYPE_ENUM,
+ RT_TYPE_EXCEPTION, RT_TYPE_TYPEDEF, RT_TYPE_SERVICE, RT_TYPE_SINGLETON,
+ or RT_TYPE_CONSTANTS to mark an entity as published.
+
+ (The value of this enumerator is chosen so that it is unlikely that its
+ addition changes the underlying type of this enumeration for any C/C++
+ compiler.)
+
+ @since UDK 3.2.0
+ */
+ RT_TYPE_PUBLISHED = 0x4000
+ /// @endcond
+};
+
+/** specifies the type for the field access.
+
+ Fields in a type blob are used for different types. Among others they were
+ used for properties of services and these poperties can have several flags.
+
+ @see RT_ACCESS_INVALID
+ @see RT_ACCESS_READONLY
+ @see RT_ACCESS_OPTIONAL
+ @see RT_ACCESS_MAYBEVOID
+ @see RT_ACCESS_BOUND
+ @see RT_ACCESS_CONSTRAINED
+ @see RT_ACCESS_TRANSIENT
+ @see RT_ACCESS_MAYBEAMBIGUOUS
+ @see RT_ACCESS_MAYBEDEFAULT
+ @see RT_ACCESS_REMOVEABLE
+ @see RT_ACCESS_ATTRIBUTE
+ @see RT_ACCESS_PROPERTY
+ @see RT_ACCESS_CONST
+ @see RT_ACCESS_READWRITE
+ @see RT_ACCESS_DEFAULT
+ @see RT_ACCESS_PARAMETERIZED_TYPE
+ @see RT_ACCESS_PUBLISHED
+ */
+typedef sal_uInt16 RTFieldAccess;
+
+/// specifies a unknown flag
+#define RT_ACCESS_INVALID 0x0000
+/// specifies a readonly property/attribute
+#define RT_ACCESS_READONLY 0x0001
+/// specifies a property as optional that means that it must not be implemented.
+#define RT_ACCESS_OPTIONAL 0x0002
+/// @see com::sun::star::beans::PropertyAttribute
+#define RT_ACCESS_MAYBEVOID 0x0004
+/// @see com::sun::star::beans::PropertyAttribute
+#define RT_ACCESS_BOUND 0x0008
+/// @see com::sun::star::beans::PropertyAttribute
+#define RT_ACCESS_CONSTRAINED 0x0010
+/// @see com::sun::star::beans::PropertyAttribute
+#define RT_ACCESS_TRANSIENT 0x0020
+/// @see com::sun::star::beans::PropertyAttribute
+#define RT_ACCESS_MAYBEAMBIGUOUS 0x0040
+/// @see com::sun::star::beans::PropertyAttribute
+#define RT_ACCESS_MAYBEDEFAULT 0x0080
+/// @see com::sun::star::beans::PropertyAttribute
+#define RT_ACCESS_REMOVEABLE 0x0100
+/// @see com::sun::star::beans::PropertyAttribute
+#define RT_ACCESS_ATTRIBUTE 0x0200
+/// specifies that the field is a property
+#define RT_ACCESS_PROPERTY 0x0400
+/// specifies that the field is a constant or enum value
+#define RT_ACCESS_CONST 0x0800
+/// specifies that the property/attribute has read/write access
+#define RT_ACCESS_READWRITE 0x1000
+/// only to describe a union default label
+#define RT_ACCESS_DEFAULT 0x2000
+
+/**
+ Indicates that a member of a polymorphic struct type template is of a
+ parameterized type.
+
+ Only valid for fields that represent members of polymorphic struct type
+ templates.
+
+ @since UDK 3.2.0
+ */
+#define RT_ACCESS_PARAMETERIZED_TYPE 0x4000
+
+/**
+ Flag for published individual constants.
+
+ Used in combination with RT_ACCESS_CONST for individual constants (which are
+ not members of constant groups).
+
+ @since UDK 3.2.0
+ */
+#define RT_ACCESS_PUBLISHED 0x8000
+
+/** specifies the type of a field value.
+
+ A field can have a value if it repsresents a constant or an enum value.
+ */
+enum RTValueType {
+ RT_TYPE_NONE,
+ RT_TYPE_BOOL,
+ RT_TYPE_BYTE,
+ RT_TYPE_INT16,
+ RT_TYPE_UINT16,
+ RT_TYPE_INT32,
+ RT_TYPE_UINT32,
+ RT_TYPE_INT64,
+ RT_TYPE_UINT64,
+ RT_TYPE_FLOAT,
+ RT_TYPE_DOUBLE,
+ RT_TYPE_STRING
+};
+
+/** specifies a variable container for field values.
+ */
+union RTConstValueUnion {
+ sal_Bool aBool;
+ sal_Int8 aByte;
+ sal_Int16 aShort;
+ sal_uInt16 aUShort;
+ sal_Int32 aLong;
+ sal_uInt32 aULong;
+ sal_Int64 aHyper;
+ sal_uInt64 aUHyper;
+ float aFloat;
+ double aDouble;
+ sal_Unicode const * aString;
+};
+
+/** specifies the mode of a method.
+
+ A method can be synchron or asynchron (oneway). The const attribute for
+ methods was removed so that the const values are deprecated.
+ */
+enum RTMethodMode {
+ /// indicates an invalid mode
+ RT_MODE_INVALID,
+
+ /// indicates the asynchronous mode of a method
+ RT_MODE_ONEWAY,
+
+ /// @deprecated
+ RT_MODE_ONEWAY_CONST,
+
+ /// indicated the synchronous mode of a method
+ RT_MODE_TWOWAY,
+
+ /// @deprecated
+ RT_MODE_TWOWAY_CONST,
+
+ /**
+ Indicates an extended attribute getter (that has a 'raises' clause) of an
+ interface type.
+
+ @since UDK 3.2.0
+ */
+ RT_MODE_ATTRIBUTE_GET,
+
+ /**
+ Indicates an extended attribute setter (that has a 'raises' clause) of an
+ interface type.
+
+ @since UDK 3.2.0
+ */
+ RT_MODE_ATTRIBUTE_SET
+};
+
+/** specifies the mode of a parameter.
+
+ There are three paramter modes which have impact of the handling of the
+ paramter in the UNO bridges and the UNO code generation.
+ */
+enum RTParamMode {
+ /// indicates an invalid parameter mode
+ RT_PARAM_INVALID = 0,
+
+ /// indicates a pure in parameter which is used by value
+ RT_PARAM_IN = 1,
+
+ /// indicates a pure out parameter which is used by reference
+ RT_PARAM_OUT = 2,
+
+ /// indicates a in and out parameter which is used also by reference
+ RT_PARAM_INOUT = 3,
+
+ /**
+ Indicates a rest parameter (currently only valid for service
+ constructors).
+
+ This value can be combined with any of RT_PARAM_IN, RT_PARAM_OUT, and
+ RT_PARAM_INOUT (however, service constructors currently only allow
+ RT_PARAM_IN, anyway).
+
+ @since UDK 3.2.0
+ */
+ RT_PARAM_REST = 4
+};
+
+/** specifies the type of a reference used in a service description.
+ */
+enum RTReferenceType {
+ /// the reference type is unknown
+ RT_REF_INVALID,
+
+ /** the service support the interface that means a implementation of this
+ service must implement this interface.
+ */
+ RT_REF_SUPPORTS,
+
+ /** @deprecated
+ the service observes the interface.
+ */
+ RT_REF_OBSERVES,
+
+ /** the service exports the specified service that means this service
+ provides also the specified service.
+ */
+ RT_REF_EXPORTS,
+
+ /** @deprecated
+ the service needs the specified service that means in the context of
+ this service the specified service will be used or must be available.
+ */
+ RT_REF_NEEDS,
+
+ /**
+ Indicates a type parameter of a polymorphic struct type template.
+
+ @since UDK 3.2.0
+ */
+ RT_REF_TYPE_PARAMETER
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/registry/version.h b/include/registry/version.h
new file mode 100644
index 000000000000..01f0f8033323
--- /dev/null
+++ b/include/registry/version.h
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_registry_version_h
+#define INCLUDED_registry_version_h
+
+#include "sal/types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ The version of a binary blob that represents a UNOIDL type.
+
+ <p>All values between <code>TYPEREG_VERSION_0</code> and
+ <code>TYPEREG_MAX_VERSION</code> are valid, where currently unallocated
+ values represent future versions. Negative values are not valid.</p>
+
+ @see typereg::Reader
+ @see typereg::Writer
+
+ @since UDK 3.2.0
+ */
+enum typereg_Version {
+ /**
+ Denotes the original version of UNOIDL type blobs.
+ */
+ TYPEREG_VERSION_0,
+
+ /**
+ Denotes the updated version of UNOIDL type blobs.
+
+ <p>This version added support for multiple-inheritance interface types,
+ extended interface type attributes, single-interface&ndash;based
+ services, interface-based singletons, polymorphic struct types, and
+ published entities.</p>
+ */
+ TYPEREG_VERSION_1,
+
+ /**
+ Denotes the maximum future version of UNOIDL type blobs.
+ */
+ TYPEREG_MAX_VERSION = SAL_MAX_INT32
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/registry/writer.h b/include/registry/writer.h
new file mode 100644
index 000000000000..f1b39a583e22
--- /dev/null
+++ b/include/registry/writer.h
@@ -0,0 +1,262 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_registry_writer_h
+#define INCLUDED_registry_writer_h
+
+#include "registry/regdllapi.h"
+#include "registry/types.h"
+#include "registry/version.h"
+
+#include "rtl/ustring.h"
+#include "sal/types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ Creates a type writer working on a binary blob that represents a UNOIDL type.
+
+ <p>Operations on a returned handle are not multi-thread&ndash;safe.</p>
+
+ @param version the version of the created type writer; must not be negative
+
+ @param documentation the documentation; must not be null
+
+ @param fileName the file name; must not be null (deprecated, use an empty string)
+
+ @param typeClass the type class of the created type writer
+
+ @param published whether the created type writer is published; for a type
+ class that cannot be published, this should be false
+
+ @param typeName the type name of the created type writer; must not be null
+
+ @param superTypeCount the number of super types of the created type writer
+
+ @param fieldCount the number of fields of the created type writer
+
+ @param methodCount the number of methods of the created type writer
+
+ @param referenceCount the number of references of the created type writer
+
+ @return a handle on the type writer; if an out-of-memory condition occurs,
+ null is returned, and no type writer is created
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void * SAL_CALL typereg_writer_create(
+ typereg_Version version, rtl_uString const * documentation,
+ rtl_uString const * fileName, RTTypeClass typeClass, sal_Bool published,
+ rtl_uString const * typeName, sal_uInt16 superTypeCount,
+ sal_uInt16 fieldCount, sal_uInt16 methodCount, sal_uInt16 referenceCount)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Destroys a type writer.
+
+ @param handle a handle on a type writer obtained from a call to
+ <code>typereg_writer_create</code>; must not be null
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC void SAL_CALL typereg_writer_destroy(void * handle) SAL_THROW_EXTERN_C();
+
+/**
+ Sets the type name of a super type of a type writer.
+
+ @param handle a handle on a type writer; must not be null
+
+ @param index a valid index into the range of super types of the given type
+ writer
+
+ @param typeName the super type name; must not be null
+
+ @return false iff an out-of-memory condition ocurred, in which case the type
+ writer is not modified
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC sal_Bool SAL_CALL typereg_writer_setSuperTypeName(
+ void * handle, sal_uInt16 index, rtl_uString const * typeName)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Sets the data of a field of a type writer.
+
+ @param handle a handle on a type writer; must not be null
+
+ @param index a valid index into the range of fields of the given type writer
+
+ @param documentation the documentation of the field; must not be null
+
+ @param fileName the file name of the field; must not be null (deprecated, use an empty string)
+
+ @param flags the flags of the field
+
+ @param name the name of the field; must not be null
+
+ @param typeName the type name of the field; must not be null
+
+ @param valueType the type of the value of the field
+
+ @param valueValue the value of the value of the field
+
+ @return false iff an out-of-memory condition ocurred, in which case the type
+ writer is not modified
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC sal_Bool SAL_CALL typereg_writer_setFieldData(
+ void * handle, sal_uInt16 index, rtl_uString const * documentation,
+ rtl_uString const * fileName, RTFieldAccess flags, rtl_uString const * name,
+ rtl_uString const * typeName, RTValueType valueType,
+ RTConstValueUnion valueValue)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Sets the data of a method of a type writer.
+
+ @param handle a handle on a type writer; must not be null
+
+ @param index a valid index into the range of methods of the given type writer
+
+ @param documentation the documentation of the method; must not be null
+
+ @param flags the flags of the method
+
+ @param name the name of the method; must not be null
+
+ @param returnTypeName the return type name of the method; must not be null
+
+ @param parameterCount the number of parameters of the method
+
+ @param exceptionCount the number of exceptions of the method
+
+ @return false iff an out-of-memory condition ocurred, in which case the type
+ writer is not modified
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC sal_Bool SAL_CALL typereg_writer_setMethodData(
+ void * handle, sal_uInt16 index, rtl_uString const * documentation,
+ RTMethodMode flags, rtl_uString const * name,
+ rtl_uString const * returnTypeName, sal_uInt16 parameterCount,
+ sal_uInt16 exceptionCount)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Sets the data of a parameter of a method of a type writer.
+
+ @param handle a handle on a type writer; must not be null
+
+ @param methodIndex a valid index into the range of methods of the given type
+ writer
+
+ @param parameterIndex a valid index into the range of parameters of the given
+ method
+
+ @param flags the flags of the parameter
+
+ @param name the name of the parameter; must not be null
+
+ @param typeName the type name of the parameter; must not be null
+
+ @return false iff an out-of-memory condition ocurred, in which case the type
+ writer is not modified
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC sal_Bool SAL_CALL typereg_writer_setMethodParameterData(
+ void * handle, sal_uInt16 methodIndex, sal_uInt16 parameterIndex,
+ RTParamMode flags, rtl_uString const * name, rtl_uString const * typeName)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Sets an exception type name of a method of a type writer.
+
+ @param handle a handle on a type writer; must not be null
+
+ @param methodIndex a valid index into the range of methods of the given type
+ writer
+
+ @param exceptionIndex a valid index into the range of exceptions of the given
+ method
+
+ @param typeName the exception type name; must not be null
+
+ @return false iff an out-of-memory condition ocurred, in which case the type
+ writer is not modified
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC sal_Bool SAL_CALL typereg_writer_setMethodExceptionTypeName(
+ void * handle, sal_uInt16 methodIndex, sal_uInt16 exceptionIndex,
+ rtl_uString const * typeName)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Sets the data of a reference of a type writer.
+
+ @param handle a handle on a type writer; must not be null
+
+ @param index a valid index into the range of references of the given type
+ writer
+
+ @param documentation the documentation of the reference; must not be null
+
+ @param sort the sort of the reference
+
+ @param flags the flags of the reference
+
+ @param typeName the type name of the reference; must not be null
+
+ @return false iff an out-of-memory condition ocurred, in which case the type
+ writer is not modified
+
+ @since UDK 3.2.0
+ */
+REG_DLLPUBLIC sal_Bool SAL_CALL typereg_writer_setReferenceData(
+ void * handle, sal_uInt16 index, rtl_uString const * documentation,
+ RTReferenceType sort, RTFieldAccess flags, rtl_uString const * typeName)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the blob of a type writer.
+
+ @param handle a handle on a type writer; must not be null
+
+ @param size an out-parameter obtaining the size of the blob; must not be null
+
+ @return a (byte-aligned) pointer to the blob; the returned pointer and the
+ returned <code>size</code> remain valid until the next function is called on
+ the given type writer; if an out-of-memory condition occurs, null is returned
+ and <code>size</code> is not modified
+ */
+REG_DLLPUBLIC void const * SAL_CALL typereg_writer_getBlob(void * handle, sal_uInt32 * size)
+ SAL_THROW_EXTERN_C();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/registry/writer.hxx b/include/registry/writer.hxx
new file mode 100644
index 000000000000..cfdf479853df
--- /dev/null
+++ b/include/registry/writer.hxx
@@ -0,0 +1,291 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_registry_writer_hxx
+#define INCLUDED_registry_writer_hxx
+
+#include "registry/writer.h"
+#include "registry/refltype.hxx"
+#include "registry/types.h"
+#include "registry/version.h"
+
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+
+#include <new>
+
+namespace typereg {
+
+/**
+ A type writer working on a binary blob that represents a UNOIDL type.
+
+ <p>Instances of this class are not multi-thread&ndash;safe.</p>
+
+ @since UDK 3.2.0
+ */
+class Writer {
+public:
+ /**
+ Creates a type writer.
+
+ @param version the version of the created type writer; must not be
+ negative
+
+ @param documentation the documentation
+
+ @param fileName the file name (deprecated, use an empty string)
+
+ @param typeClass the type class of the created type writer
+
+ @param published whether the created type writer is published; for a type
+ class that cannot be published, this should be false
+
+ @param typeName the type name of the created type writer
+
+ @param superTypeCount the number of super types of the created type
+ writer
+
+ @param fieldCount the number of fields of the created type writer
+
+ @param methodCount the number of methods of the created type writer
+
+ @param referenceCount the number of references of the created type writer
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ Writer(
+ typereg_Version version, OUString const & documentation,
+ OUString const & fileName, RTTypeClass typeClass, bool published,
+ OUString const & typeName, sal_uInt16 superTypeCount,
+ sal_uInt16 fieldCount, sal_uInt16 methodCount,
+ sal_uInt16 referenceCount):
+ m_handle(
+ typereg_writer_create(
+ version, documentation.pData, fileName.pData, typeClass,
+ published, typeName.pData, superTypeCount, fieldCount,
+ methodCount, referenceCount))
+ {
+ if (m_handle == 0) {
+ throw std::bad_alloc();
+ }
+ }
+
+ /**
+ Destroys this <code>Writer</code> instance.
+ */
+ ~Writer() {
+ typereg_writer_destroy(m_handle);
+ }
+
+ /**
+ Sets the type name of a super type of this type writer.
+
+ @param index a valid index into the range of super types of this type
+ writer
+
+ @param typeName the super type name
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ void setSuperTypeName(sal_uInt16 index, OUString const & typeName) {
+ if (!typereg_writer_setSuperTypeName(m_handle, index, typeName.pData)) {
+ throw std::bad_alloc();
+ }
+ }
+
+ /**
+ Sets the data of a field of this type writer.
+
+ @param index a valid index into the range of fields of this type writer
+
+ @param documentation the documentation of the field
+
+ @param fileName the file name of the field (deprecated, use an empty string)
+
+ @param flags the flags of the field
+
+ @param name the name of the field
+
+ @param typeName the type name of the field
+
+ @param value the value of the field
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ void setFieldData(
+ sal_uInt16 index, OUString const & documentation,
+ OUString const & fileName, RTFieldAccess flags, OUString const & name,
+ OUString const & typeName, RTConstValue const & value)
+ {
+ if (!typereg_writer_setFieldData(
+ m_handle, index, documentation.pData, fileName.pData, flags,
+ name.pData, typeName.pData, value.m_type, value.m_value))
+ {
+ throw std::bad_alloc();
+ }
+ }
+
+ /**
+ Sets the data of a method of this type writer.
+
+ @param index a valid index into the range of methods of this type writer
+
+ @param documentation the documentation of the method
+
+ @param flags the flags of the method
+
+ @param name the name of the method
+
+ @param returnTypeName the return type name of the method
+
+ @param parameterCount the number of parameters of the method
+
+ @param exceptionCount the number of exceptions of the method
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ void setMethodData(
+ sal_uInt16 index, OUString const & documentation,
+ RTMethodMode flags, OUString const & name,
+ OUString const & returnTypeName, sal_uInt16 parameterCount,
+ sal_uInt16 exceptionCount)
+ {
+ if (!typereg_writer_setMethodData(
+ m_handle, index, documentation.pData, flags, name.pData,
+ returnTypeName.pData, parameterCount, exceptionCount))
+ {
+ throw std::bad_alloc();
+ }
+ }
+
+ /**
+ Sets the data of a parameter of a method of this type writer.
+
+ @param methodIndex a valid index into the range of methods of this type
+ writer
+
+ @param parameterIndex a valid index into the range of parameters of the
+ given method
+
+ @param flags the flags of the parameter
+
+ @param name the name of the parameter
+
+ @param typeName the type name of the parameter
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ void setMethodParameterData(
+ sal_uInt16 methodIndex, sal_uInt16 parameterIndex,
+ RTParamMode flags, OUString const & name,
+ OUString const & typeName)
+ {
+ if (!typereg_writer_setMethodParameterData(
+ m_handle, methodIndex, parameterIndex, flags, name.pData,
+ typeName.pData))
+ {
+ throw std::bad_alloc();
+ }
+ }
+
+ /**
+ Sets an exception type name of a method of this type writer.
+
+ @param methodIndex a valid index into the range of methods of this type
+ writer
+
+ @param exceptionIndex a valid index into the range of exceptions of the
+ given method
+
+ @param typeName the exception type name
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ void setMethodExceptionTypeName(
+ sal_uInt16 methodIndex, sal_uInt16 exceptionIndex,
+ OUString const & typeName)
+ {
+ if (!typereg_writer_setMethodExceptionTypeName(
+ m_handle, methodIndex, exceptionIndex, typeName.pData))
+ {
+ throw std::bad_alloc();
+ }
+ }
+
+ /**
+ Sets the data of a reference of this type writer.
+
+ @param index a valid index into the range of references of this type
+ writer
+
+ @param documentation the documentation of the reference
+
+ @param sort the sort of the reference
+
+ @param flags the flags of the reference
+
+ @param typeName the type name of the reference
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ void setReferenceData(
+ sal_uInt16 index, OUString const & documentation,
+ RTReferenceType sort, RTFieldAccess flags,
+ OUString const & typeName)
+ {
+ if (!typereg_writer_setReferenceData(
+ m_handle, index, documentation.pData, sort, flags,
+ typeName.pData))
+ {
+ throw std::bad_alloc();
+ }
+ }
+
+ /**
+ Returns the blob of this type writer.
+
+ @param size an out-parameter obtaining the size of the blob
+
+ @return a (byte-aligned) pointer to the blob; the returned pointer and
+ the returned <code>size</code> remain valid until the next function is
+ called on this type writer
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ (in which case <code>siez</code> is not modified
+ */
+ void const * getBlob(sal_uInt32 * size) {
+ void const * p = typereg_writer_getBlob(m_handle, size);
+ if (p == 0) {
+ throw std::bad_alloc();
+ }
+ return p;
+ }
+
+private:
+ Writer(Writer &); // not implemented
+ void operator =(Writer); // not implemented
+
+ void * m_handle;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rsc/rsc-vcl-shared-types.hxx b/include/rsc/rsc-vcl-shared-types.hxx
new file mode 100644
index 000000000000..4e8ca10090c7
--- /dev/null
+++ b/include/rsc/rsc-vcl-shared-types.hxx
@@ -0,0 +1,133 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _RSC_RSC_VCL_SHARED_TYPES_HXX
+#define _RSC_RSC_VCL_SHARED_TYPES_HXX
+
+enum TimeFieldFormat {TIMEF_NONE, TIMEF_SEC, TIMEF_100TH_SEC, TIMEF_SEC_CS, TimeFieldFormat_FORCE_EQUAL_SIZE=SAL_MAX_ENUM };
+
+enum KeyFuncType { KEYFUNC_DONTKNOW, KEYFUNC_NEW, KEYFUNC_OPEN, KEYFUNC_SAVE,
+ KEYFUNC_SAVEAS, KEYFUNC_PRINT, KEYFUNC_CLOSE, KEYFUNC_QUIT,
+ KEYFUNC_CUT, KEYFUNC_COPY, KEYFUNC_PASTE, KEYFUNC_UNDO,
+ KEYFUNC_REDO, KEYFUNC_DELETE, KEYFUNC_REPEAT, KEYFUNC_FIND,
+ KEYFUNC_FINDBACKWARD, KEYFUNC_PROPERTIES, KEYFUNC_FRONT,
+ KeyFuncType_FORCE_EQUAL_SIZE=SAL_MAX_ENUM };
+
+enum MenuItemType { MENUITEM_DONTKNOW, MENUITEM_STRING, MENUITEM_IMAGE,
+ MENUITEM_STRINGIMAGE, MENUITEM_SEPARATOR };
+
+typedef sal_uInt16 MenuItemBits;
+
+#define MIB_CHECKABLE ((MenuItemBits)0x0001)
+#define MIB_RADIOCHECK ((MenuItemBits)0x0002)
+#define MIB_AUTOCHECK ((MenuItemBits)0x0004)
+#define MIB_ABOUT ((MenuItemBits)0x0008)
+#define MIB_HELP ((MenuItemBits)0x0010)
+#define MIB_POPUPSELECT ((MenuItemBits)0x0020)
+
+// These have been said to be a prelimitary (sic) solution since 2007
+#define MIB_NOSELECT ((MenuItemBits)0x0040)
+#define MIB_ICON ((MenuItemBits)0x0080)
+#define MIB_TEXT ((MenuItemBits)0x0100)
+
+typedef sal_uInt16 ToolBoxItemBits;
+
+#define TIB_CHECKABLE ((ToolBoxItemBits)0x0001)
+#define TIB_RADIOCHECK ((ToolBoxItemBits)0x0002)
+#define TIB_AUTOCHECK ((ToolBoxItemBits)0x0004)
+#define TIB_LEFT ((ToolBoxItemBits)0x0008)
+#define TIB_AUTOSIZE ((ToolBoxItemBits)0x0010)
+#define TIB_DROPDOWN ((ToolBoxItemBits)0x0020)
+#define TIB_REPEAT ((ToolBoxItemBits)0x0040)
+#define TIB_DROPDOWNONLY ((ToolBoxItemBits)0x0080 | TIB_DROPDOWN)
+#define TIB_TEXT_ONLY ((ToolBoxItemBits)0x0100)
+#define TIB_ICON_ONLY ((ToolBoxItemBits)0x0200)
+#define TIB_TEXTICON ((ToolBoxItemBits) TIB_TEXT_ONLY | TIB_ICON_ONLY )
+
+enum ToolBoxItemType { TOOLBOXITEM_DONTKNOW, TOOLBOXITEM_BUTTON,
+ TOOLBOXITEM_SPACE, TOOLBOXITEM_SEPARATOR,
+ TOOLBOXITEM_BREAK };
+
+enum ButtonType { BUTTON_SYMBOL, BUTTON_TEXT, BUTTON_SYMBOLTEXT };
+
+typedef sal_uInt16 SymbolType;
+
+#define SYMBOL_DONTKNOW ((SymbolType)0)
+#define SYMBOL_IMAGE ((SymbolType)1)
+#define SYMBOL_ARROW_UP ((SymbolType)2)
+#define SYMBOL_ARROW_DOWN ((SymbolType)3)
+#define SYMBOL_ARROW_LEFT ((SymbolType)4)
+#define SYMBOL_ARROW_RIGHT ((SymbolType)5)
+#define SYMBOL_SPIN_UP ((SymbolType)6)
+#define SYMBOL_SPIN_DOWN ((SymbolType)7)
+#define SYMBOL_SPIN_LEFT ((SymbolType)8)
+#define SYMBOL_SPIN_RIGHT ((SymbolType)9)
+#define SYMBOL_FIRST ((SymbolType)10)
+#define SYMBOL_LAST ((SymbolType)11)
+#define SYMBOL_PREV ((SymbolType)12)
+#define SYMBOL_NEXT ((SymbolType)13)
+#define SYMBOL_PAGEUP ((SymbolType)14)
+#define SYMBOL_PAGEDOWN ((SymbolType)15)
+#define SYMBOL_PLAY ((SymbolType)16)
+#define SYMBOL_REVERSEPLAY ((SymbolType)17)
+#define SYMBOL_RECORD ((SymbolType)18)
+#define SYMBOL_STOP ((SymbolType)19)
+#define SYMBOL_PAUSE ((SymbolType)20)
+#define SYMBOL_WINDSTART ((SymbolType)21)
+#define SYMBOL_WINDEND ((SymbolType)22)
+#define SYMBOL_WINDBACKWARD ((SymbolType)23)
+#define SYMBOL_WINDFORWARD ((SymbolType)24)
+#define SYMBOL_CLOSE ((SymbolType)25)
+#define SYMBOL_ROLLUP ((SymbolType)26)
+#define SYMBOL_ROLLDOWN ((SymbolType)27)
+#define SYMBOL_CHECKMARK ((SymbolType)28)
+#define SYMBOL_RADIOCHECKMARK ((SymbolType)29)
+#define SYMBOL_SPIN_UPDOWN ((SymbolType)30)
+#define SYMBOL_FLOAT ((SymbolType)31)
+#define SYMBOL_DOCK ((SymbolType)32)
+#define SYMBOL_HIDE ((SymbolType)33)
+#define SYMBOL_HELP ((SymbolType)34)
+#define SYMBOL_PLUS ((SymbolType)35)
+#define SYMBOL_MENU SYMBOL_SPIN_DOWN
+
+#define SYMBOL_NOSYMBOL (SYMBOL_DONTKNOW)
+
+// Border-Styles fuer SetBorder()
+typedef sal_uInt16 WindowBorderStyle;
+
+#define WINDOW_BORDER_NORMAL ((WindowBorderStyle)0x0001)
+#define WINDOW_BORDER_MONO ((WindowBorderStyle)0x0002)
+#define WINDOW_BORDER_MENU ((WindowBorderStyle)0x0010)
+#define WINDOW_BORDER_NWF ((WindowBorderStyle)0x0020)
+#define WINDOW_BORDER_NOBORDER ((WindowBorderStyle)0x1000)
+#define WINDOW_BORDER_REMOVEBORDER ((WindowBorderStyle)0x2000)
+
+#define KEY_CODE ((sal_uInt16)0x0FFF)
+
+// Modifier-Tasten
+#define KEY_SHIFT ((sal_uInt16)0x1000)
+#define KEY_MOD1 ((sal_uInt16)0x2000)
+#define KEY_MOD2 ((sal_uInt16)0x4000)
+#define KEY_MOD3 ((sal_uInt16)0x8000)
+#define KEY_MODTYPE ((sal_uInt16)0xF000)
+#define KEY_ALLMODTYPE ((sal_uInt16)0xF000)
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/rsc/rscsfx.hxx b/include/rsc/rscsfx.hxx
new file mode 100644
index 000000000000..8dc9687031d5
--- /dev/null
+++ b/include/rsc/rscsfx.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _RSCSFX_HXX
+#define _RSCSFX_HXX
+
+// StarView (RSC_NOTYPE) bis (RSC_NOTYPE + 0x190)
+// Sfx (RSC_NOTYPE + 0x200) bis (RSC_NOTYPE + 0x20F)
+#define RSC_SFX_STYLE_FAMILIES (0x100 + 0x201)
+#define RSC_SFX_STYLE_FAMILY_ITEM (0x100 + 0x202)
+#define RSC_SFX_SLOT_INFO (0x100 + 0x203)
+// StarMoney (RSC_NOTYPE + 0x210) bis (RSC_NOTYPE + 0x22F)
+// Public (RSC_NOTYPE + 0x300) bis (RSC_NOTYPE + 0x3FF)
+
+//========== S F X =======================================
+enum SfxStyleFamily { SFX_STYLE_FAMILY_CHAR = 1,
+ SFX_STYLE_FAMILY_PARA = 2,
+ SFX_STYLE_FAMILY_FRAME = 4,
+ SFX_STYLE_FAMILY_PAGE = 8,
+ SFX_STYLE_FAMILY_PSEUDO = 16,
+ SFX_STYLE_FAMILY_ALL = 0x7fff
+ };
+
+
+// SfxTemplateDialog
+#define RSC_SFX_STYLE_ITEM_LIST 0x1
+#define RSC_SFX_STYLE_ITEM_BITMAP 0x2
+#define RSC_SFX_STYLE_ITEM_TEXT 0x4
+#define RSC_SFX_STYLE_ITEM_HELPTEXT 0x8
+#define RSC_SFX_STYLE_ITEM_STYLEFAMILY 0x10
+#define RSC_SFX_STYLE_ITEM_IMAGE 0x20
+
+
+// SfxSlotInfo
+#define RSC_SFX_SLOT_INFO_SLOTNAME 0x1
+#define RSC_SFX_SLOT_INFO_HELPTEXT 0x2
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
new file mode 100644
index 000000000000..f31be4b142f6
--- /dev/null
+++ b/include/sax/fastattribs.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SAX_FASTATTRIBS_HXX_
+#define _SAX_FASTATTRIBS_HXX_
+
+#include <com/sun/star/xml/sax/XFastAttributeList.hpp>
+#include <com/sun/star/xml/sax/XFastTokenHandler.hpp>
+#include <com/sun/star/xml/Attribute.hpp>
+#include <com/sun/star/xml/FastAttribute.hpp>
+
+#include <cppuhelper/implbase1.hxx>
+#include "sax/saxdllapi.h"
+
+#include <map>
+#include <vector>
+
+namespace sax_fastparser
+{
+
+struct UnknownAttribute
+{
+ OUString maNamespaceURL;
+ OString maName;
+ OString maValue;
+
+ UnknownAttribute( const OUString& rNamespaceURL, const OString& rName, const OString& rValue );
+
+ UnknownAttribute( const OString& rName, const OString& rValue );
+
+ void FillAttribute( ::com::sun::star::xml::Attribute* pAttrib ) const;
+};
+
+typedef std::map< sal_Int32, OString > FastAttributeMap;
+typedef std::vector< UnknownAttribute > UnknownAttributeList;
+
+class SAX_DLLPUBLIC FastAttributeList : public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XFastAttributeList >
+{
+public:
+ FastAttributeList( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastTokenHandler >& xTokenHandler );
+ virtual ~FastAttributeList();
+
+ void clear();
+ void add( sal_Int32 nToken, const OString& rValue );
+ void addUnknown( const OUString& rNamespaceURL, const OString& rName, const OString& rValue );
+ void addUnknown( const OString& rName, const OString& rValue );
+
+ // XFastAttributeList
+ virtual ::sal_Bool SAL_CALL hasAttribute( ::sal_Int32 Token ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getValueToken( ::sal_Int32 Token ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getOptionalValueToken( ::sal_Int32 Token, ::sal_Int32 Default ) throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getValue( ::sal_Int32 Token ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getOptionalValue( ::sal_Int32 Token ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::xml::Attribute > SAL_CALL getUnknownAttributes( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::xml::FastAttribute > SAL_CALL getFastAttributes() throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ FastAttributeMap maAttributes;
+ UnknownAttributeList maUnknownAttributes;
+ FastAttributeMap::iterator maLastIter;
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastTokenHandler > mxTokenHandler;
+
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sax/fshelper.hxx b/include/sax/fshelper.hxx
new file mode 100644
index 000000000000..e0945fc07ddf
--- /dev/null
+++ b/include/sax/fshelper.hxx
@@ -0,0 +1,199 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SAX_FS_HELPER_HXX_
+#define _SAX_FS_HELPER_HXX_
+
+#include <com/sun/star/uno/XReference.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/xml/sax/XFastTokenHandler.hpp>
+#include <stdarg.h>
+#include <boost/shared_ptr.hpp>
+#include <sax/fastattribs.hxx>
+
+#define FSNS(namespc, element) ((namespc << 16) | element)
+// Backwards compatibility for code that used FSEND to terminate the vararg.
+// As soon as no supported LO version has the varargs code, this can be removed entirely
+// (otherwise backports might break silently if people didn't add FSEND).
+// Ctor is there to get an error when trying to pass it to a vararg by accident.
+struct FSEND_t { FSEND_t() {}; };
+static const FSEND_t FSEND = FSEND_t();
+const sal_Int32 FSEND_internal = -1; // same as XML_TOKEN_INVALID
+
+#define SAX_ARGS_ARG( arg1, arg2, convert, num ) arg1##num, arg2##num convert
+#define SAX_ARGS_ARG1( arg1, arg2, convert ) SAX_ARGS_ARG( arg1, arg2, convert, 1 )
+#define SAX_ARGS_ARG2( arg1, arg2, convert ) SAX_ARGS_ARG1( arg1, arg2, convert ), SAX_ARGS_ARG( arg1, arg2, convert, 2 )
+#define SAX_ARGS_ARG3( arg1, arg2, convert ) SAX_ARGS_ARG2( arg1, arg2, convert ), SAX_ARGS_ARG( arg1, arg2, convert, 3 )
+#define SAX_ARGS_ARG4( arg1, arg2, convert ) SAX_ARGS_ARG3( arg1, arg2, convert ), SAX_ARGS_ARG( arg1, arg2, convert, 4 )
+#define SAX_ARGS_ARG5( arg1, arg2, convert ) SAX_ARGS_ARG4( arg1, arg2, convert ), SAX_ARGS_ARG( arg1, arg2, convert, 5 )
+#define SAX_ARGS_ARG6( arg1, arg2, convert ) SAX_ARGS_ARG5( arg1, arg2, convert ), SAX_ARGS_ARG( arg1, arg2, convert, 6 )
+#define SAX_ARGS_ARG7( arg1, arg2, convert ) SAX_ARGS_ARG6( arg1, arg2, convert ), SAX_ARGS_ARG( arg1, arg2, convert, 7 )
+#define SAX_ARGS_ARG8( arg1, arg2, convert ) SAX_ARGS_ARG7( arg1, arg2, convert ), SAX_ARGS_ARG( arg1, arg2, convert, 8 )
+#define SAX_ARGS_ARG9( arg1, arg2, convert ) SAX_ARGS_ARG8( arg1, arg2, convert ), SAX_ARGS_ARG( arg1, arg2, convert, 9 )
+#define SAX_ARGS_ARG10( arg1, arg2, convert ) SAX_ARGS_ARG9( arg1, arg2, convert ), SAX_ARGS_ARG( arg1, arg2, convert, 10 )
+#define SAX_ARGS_ARG11( arg1, arg2, convert ) SAX_ARGS_ARG10( arg1, arg2, convert ), SAX_ARGS_ARG( arg1, arg2, convert, 11 )
+#define SAX_ARGS_ARG12( arg1, arg2, convert ) SAX_ARGS_ARG11( arg1, arg2, convert ), SAX_ARGS_ARG( arg1, arg2, convert, 12 )
+#define SAX_ARGS_ARG13( arg1, arg2, convert ) SAX_ARGS_ARG12( arg1, arg2, convert ), SAX_ARGS_ARG( arg1, arg2, convert, 13 )
+#define SAX_ARGS_ARG14( arg1, arg2, convert ) SAX_ARGS_ARG13( arg1, arg2, convert ), SAX_ARGS_ARG( arg1, arg2, convert, 14 )
+#define SAX_ARGS_ARG15( arg1, arg2, convert ) SAX_ARGS_ARG14( arg1, arg2, convert ), SAX_ARGS_ARG( arg1, arg2, convert, 15 )
+#define SAX_ARGS_ARG16( arg1, arg2, convert ) SAX_ARGS_ARG15( arg1, arg2, convert ), SAX_ARGS_ARG( arg1, arg2, convert, 16 )
+#define SAX_ARGS_ARG17( arg1, arg2, convert ) SAX_ARGS_ARG16( arg1, arg2, convert ), SAX_ARGS_ARG( arg1, arg2, convert, 17 )
+#define SAX_ARGS_ARG18( arg1, arg2, convert ) SAX_ARGS_ARG17( arg1, arg2, convert ), SAX_ARGS_ARG( arg1, arg2, convert, 18 )
+#define SAX_ARGS_ARG19( arg1, arg2, convert ) SAX_ARGS_ARG18( arg1, arg2, convert ), SAX_ARGS_ARG( arg1, arg2, convert, 19 )
+#define SAX_ARGS_ARG20( arg1, arg2, convert ) SAX_ARGS_ARG19( arg1, arg2, convert ), SAX_ARGS_ARG( arg1, arg2, convert, 20 )
+#define SAX_ARGS_ARG21( arg1, arg2, convert ) SAX_ARGS_ARG20( arg1, arg2, convert ), SAX_ARGS_ARG( arg1, arg2, convert, 21 )
+#define SAX_ARGS_ARG22( arg1, arg2, convert ) SAX_ARGS_ARG21( arg1, arg2, convert ), SAX_ARGS_ARG( arg1, arg2, convert, 22 )
+
+namespace sax_fastparser {
+
+enum MergeMarksEnum { MERGE_MARKS_APPEND = 0, MERGE_MARKS_PREPEND = 1, MERGE_MARKS_POSTPONE = 2 };
+
+typedef ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList > XFastAttributeListRef;
+
+class FastSaxSerializer;
+
+class SAX_DLLPUBLIC FastSerializerHelper
+{
+public:
+
+ FastSerializerHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutputStream, bool bWriteHeader = true );
+
+ ~FastSerializerHelper();
+
+ /// Start an element. After the first argument there can be a number of (attribute, value) pairs.
+ void startElement(sal_Int32 elementTokenId, FSEND_t)
+ { startElementInternal( elementTokenId, FSEND_internal ); }
+ /// overload
+ void startElement(sal_Int32 elementTokenId, sal_Int32 attribute, const char* value, FSEND_t)
+ { startElementInternal( elementTokenId, attribute, value, FSEND_internal ); }
+ /// overload
+ void startElement(sal_Int32 elementTokenId, sal_Int32 attribute, const OString& value, FSEND_t)
+ { startElementInternal( elementTokenId, attribute, value.getStr(), FSEND_internal ); }
+ /// Create a single element. After the first argument there can be a number of (attribute, value) pairs.
+ void singleElement(sal_Int32 elementTokenId, FSEND_t)
+ { singleElementInternal( elementTokenId, FSEND_internal ); }
+ /// overload
+ void singleElement(sal_Int32 elementTokenId, sal_Int32 attribute, const char* value, FSEND_t)
+ { singleElementInternal( elementTokenId, attribute, value, FSEND_internal ); }
+ /// overload
+ void singleElement(sal_Int32 elementTokenId, sal_Int32 attribute, const OString& value, FSEND_t)
+ { singleElementInternal( elementTokenId, attribute, value.getStr(), FSEND_internal ); }
+ /// Start an element. After the first two arguments there can be a number of (attribute, value) pairs.
+ void startElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, FSEND_t)
+ { startElementInternal( FSNS( namespaceTokenId, elementTokenId), FSEND_internal ); }
+ /// overload
+ void startElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, sal_Int32 attribute, const char* value, FSEND_t)
+ { startElementInternal( FSNS( namespaceTokenId, elementTokenId), attribute, value, FSEND_internal ); }
+ /// overload
+ void startElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, sal_Int32 attribute, const OString& value, FSEND_t)
+ { startElementInternal( FSNS( namespaceTokenId, elementTokenId), attribute, value.getStr(), FSEND_internal ); }
+ /// Create a single element. After the first two arguments there can be a number of (attribute, value) pairs.
+ void singleElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, FSEND_t)
+ { singleElementInternal( FSNS( namespaceTokenId, elementTokenId), FSEND_internal ); }
+ /// overload
+ void singleElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, sal_Int32 attribute, const char* value, FSEND_t)
+ { singleElementInternal( FSNS( namespaceTokenId, elementTokenId), attribute, value, FSEND_internal ); }
+ /// overload
+ void singleElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, sal_Int32 attribute, const OString& value, FSEND_t)
+ { singleElementInternal( FSNS( namespaceTokenId, elementTokenId), attribute, value.getStr(), FSEND_internal ); }
+ void endElement(sal_Int32 elementTokenId);
+ inline void endElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId)
+ { endElement( FSNS( namespaceTokenId, elementTokenId ) ); }
+
+ void singleElement(sal_Int32 elementTokenId, XFastAttributeListRef xAttrList);
+ inline void singleElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, XFastAttributeListRef xAttrList)
+ { singleElement(FSNS( namespaceTokenId, elementTokenId), xAttrList); }
+
+ void startElement(sal_Int32 elementTokenId, XFastAttributeListRef xAttrList);
+ inline void startElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, XFastAttributeListRef xAttrList)
+ { startElement( FSNS( namespaceTokenId, elementTokenId ), xAttrList ); }
+
+ FastSerializerHelper* write(const char* value);
+ FastSerializerHelper* write(const OUString& value);
+ FastSerializerHelper* write(sal_Int32 value);
+ FastSerializerHelper* write(sal_Int64 value);
+ FastSerializerHelper* write(double value);
+
+ FastSerializerHelper* writeEscaped(const char* value);
+ FastSerializerHelper* writeEscaped(const OUString& value);
+
+ FastSerializerHelper* writeId(sal_Int32 tokenId);
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > getOutputStream();
+
+ FastAttributeList *createAttrList();
+
+ void mark( ::com::sun::star::uno::Sequence< sal_Int32 > aOrder =
+ ::com::sun::star::uno::Sequence< sal_Int32 >() );
+ void mergeTopMarks( MergeMarksEnum eMergeType = MERGE_MARKS_APPEND );
+ void copyTopMarkPush();
+ void copyTopMarkPop();
+
+ /*
+ Now create all the overloads in a typesafe way (i.e. without varargs) by creating a number of overloads
+ up to a certain reasonable limit (feel free to raise it). This would be a lot easier with C++11 vararg templates.
+ */
+ // now overloads for 2 and more pairs
+ #define SAX_ARGS_FUNC_DECL( argsdecl, argsuse ) \
+ void startElement(sal_Int32 elementTokenId, argsdecl, FSEND_t) \
+ { startElementInternal( elementTokenId, argsuse, FSEND_internal ); } \
+ void singleElement(sal_Int32 elementTokenId, argsdecl, FSEND_t) \
+ { singleElementInternal( elementTokenId, argsuse, FSEND_internal ); } \
+ void startElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, argsdecl, FSEND_t) \
+ { startElementInternal( FSNS( namespaceTokenId, elementTokenId), argsuse, FSEND_internal ); } \
+ void singleElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, argsdecl, FSEND_t) \
+ { singleElementInternal( FSNS( namespaceTokenId, elementTokenId), argsuse, FSEND_internal ); }
+ #define SAX_ARGS_FUNC_NUM( decl1, decl2, use1, use2, convert, num ) \
+ SAX_ARGS_FUNC_DECL( SAX_ARGS_ARG##num( decl1, decl2, ), SAX_ARGS_ARG##num( use1, use2, convert ))
+ #define SAX_ARGS_FUNC_SUBST( type, convert, num ) \
+ SAX_ARGS_FUNC_NUM( sal_Int32 attribute, type value, attribute, value, convert, num )
+ #define SAX_ARGS_FUNC( arg, convert ) SAX_ARGS_FUNC_SUBST( arg, convert, 2 ) \
+ SAX_ARGS_FUNC_SUBST( arg, convert, 3 ) SAX_ARGS_FUNC_SUBST( arg, convert, 4 ) \
+ SAX_ARGS_FUNC_SUBST( arg, convert, 5 ) SAX_ARGS_FUNC_SUBST( arg, convert, 6 ) \
+ SAX_ARGS_FUNC_SUBST( arg, convert, 7 ) SAX_ARGS_FUNC_SUBST( arg, convert, 8 ) \
+ SAX_ARGS_FUNC_SUBST( arg, convert, 9 ) SAX_ARGS_FUNC_SUBST( arg, convert, 10 ) \
+ SAX_ARGS_FUNC_SUBST( arg, convert, 11 ) SAX_ARGS_FUNC_SUBST( arg, convert, 12 ) \
+ SAX_ARGS_FUNC_SUBST( arg, convert, 13 ) SAX_ARGS_FUNC_SUBST( arg, convert, 14 ) \
+ SAX_ARGS_FUNC_SUBST( arg, convert, 15 ) SAX_ARGS_FUNC_SUBST( arg, convert, 16 ) \
+ SAX_ARGS_FUNC_SUBST( arg, convert, 17 ) SAX_ARGS_FUNC_SUBST( arg, convert, 18 ) \
+ SAX_ARGS_FUNC_SUBST( arg, convert, 19 ) SAX_ARGS_FUNC_SUBST( arg, convert, 20 ) \
+ SAX_ARGS_FUNC_SUBST( arg, convert, 21 ) SAX_ARGS_FUNC_SUBST( arg, convert, 22 )
+ SAX_ARGS_FUNC( const char*, )
+ SAX_ARGS_FUNC( const OString&, .getStr() )
+ #undef SAX_ARGS_FUNC_DECL
+ #undef SAX_ARGS_FUNC_NUM
+ #undef SAX_ARGS_FUNC_SUBST
+ #undef SAX_ARGS_FUNC
+
+private:
+ void startElementInternal(sal_Int32 elementTokenId, ...);
+ void singleElementInternal(sal_Int32 elementTokenId, ...);
+
+ FastSaxSerializer* mpSerializer;
+ com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastTokenHandler> mxTokenHandler;
+
+};
+
+typedef boost::shared_ptr< FastSerializerHelper > FSHelperPtr;
+
+}
+
+#endif // _SAX_FS_HELPER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sax/saxdllapi.h b/include/sax/saxdllapi.h
new file mode 100644
index 000000000000..e4716975bec7
--- /dev/null
+++ b/include/sax/saxdllapi.h
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SAX_DLLAPI_H
+#define INCLUDED_SAX_DLLAPI_H
+
+#include <sal/types.h>
+
+#if defined SAX_DLLIMPLEMENTATION
+#define SAX_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define SAX_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sax/tools/converter.hxx b/include/sax/tools/converter.hxx
new file mode 100644
index 000000000000..615308c9e418
--- /dev/null
+++ b/include/sax/tools/converter.hxx
@@ -0,0 +1,206 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SAX_CONVERTER_HXX
+#define _SAX_CONVERTER_HXX
+
+#include "sax/saxdllapi.h"
+
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/util/MeasureUnit.hpp>
+
+
+namespace com { namespace sun { namespace star {
+ namespace uno {
+ class Any;
+ }
+ namespace util {
+ struct Date;
+ struct DateTime;
+ struct Duration;
+ }
+} } }
+
+namespace sax {
+
+/** the Converter converts values of various types from
+ their internal represantation to the textual form used in xml
+ and back.
+
+ All unit types are expressed as com::sun::star::util::MeasureUnit
+*/
+
+
+class SAX_DLLPUBLIC Converter
+{
+public:
+ /** convert string to measure using optional min and max values*/
+ static bool convertMeasure( sal_Int32& rValue,
+ const OUString& rString,
+ sal_Int16 nTargetUnit = ::com::sun::star::util::MeasureUnit::MM_100TH,
+ sal_Int32 nMin = SAL_MIN_INT32,
+ sal_Int32 nMax = SAL_MAX_INT32 );
+
+ /** convert measure to string */
+ static void convertMeasure( OUStringBuffer& rBuffer,
+ sal_Int32 nMeasure,
+ sal_Int16 SourceUnit = ::com::sun::star::util::MeasureUnit::MM_100TH,
+ sal_Int16 nTargetUnit = ::com::sun::star::util::MeasureUnit::INCH );
+
+ /** convert string to boolean */
+ static bool convertBool( bool& rBool,
+ const OUString& rString );
+
+ /** convert boolean to string */
+ static void convertBool( OUStringBuffer& rBuffer,
+ bool bValue );
+
+ /** convert string to percent */
+ static bool convertPercent( sal_Int32& rValue,
+ const OUString& rString );
+
+ /** convert percent to string */
+ static void convertPercent( OUStringBuffer& rBuffer,
+ sal_Int32 nValue );
+
+ /** convert string to pixel measure unite */
+ static bool convertMeasurePx( sal_Int32& rValue,
+ const OUString& rString );
+
+ /** convert pixel measure unit to string */
+ static void convertMeasurePx( OUStringBuffer& rBuffer,
+ sal_Int32 nValue );
+
+ /** convert string to rgb color */
+ static bool convertColor( sal_Int32& rColor,
+ const OUString&rValue );
+
+ /** convert color to string */
+ static void convertColor( OUStringBuffer &rBuffer,
+ sal_Int32 nColor );
+
+ /** convert number to string */
+ static void convertNumber( OUStringBuffer& rBuffer,
+ sal_Int32 nNumber );
+
+ /** convert string to number with optional min and max values */
+ static bool convertNumber( sal_Int32& rValue,
+ const OUString& rString,
+ sal_Int32 nMin = SAL_MIN_INT32,
+ sal_Int32 nMax = SAL_MAX_INT32 );
+
+ /** convert string to number with optional min and max values */
+ static bool convertNumber64(sal_Int64& rValue,
+ const OUString& rString,
+ sal_Int64 nMin = SAL_MIN_INT64,
+ sal_Int64 nMax = SAL_MAX_INT64);
+
+ /** convert double number to string (using ::rtl::math) and
+ DO convert from source unit to target unit */
+ static void convertDouble( OUStringBuffer& rBuffer,
+ double fNumber,
+ bool bWriteUnits,
+ sal_Int16 nSourceUnit,
+ sal_Int16 nTargetUnit );
+
+ /** convert double number to string (using ::rtl::math) without unit conversion */
+ static void convertDouble( OUStringBuffer& rBuffer, double fNumber);
+
+ /** convert string to double number (using ::rtl::math) and DO convert from
+ source unit to target unit. */
+ static bool convertDouble( double& rValue,
+ const OUString& rString,
+ sal_Int16 nSourceUnit,
+ sal_Int16 nTargetUnit );
+
+ /** convert string to double number (using ::rtl::math) without unit conversion */
+ static bool convertDouble(double& rValue, const OUString& rString);
+
+ /** convert double to ISO "duration" string; negative durations allowed */
+ static void convertDuration(OUStringBuffer& rBuffer,
+ const double fTime);
+
+ /** convert util::Duration to ISO "duration" string */
+ static void convertDuration(OUStringBuffer& rBuffer,
+ const ::com::sun::star::util::Duration& rDuration);
+
+ /** convert ISO "duration" string to double; negative durations allowed */
+ static bool convertDuration(double & rfTime,
+ const OUString& rString);
+
+ /** convert ISO "duration" string to util::Duration */
+ static bool convertDuration(::com::sun::star::util::Duration& rDuration,
+ const OUString& rString);
+
+ /** convert util::Date to ISO "date" string */
+ static void convertDate( OUStringBuffer& rBuffer,
+ const com::sun::star::util::Date& rDate );
+
+ /** convert util::DateTime to ISO "date" or "dateTime" string */
+ static void convertDateTime( OUStringBuffer& rBuffer,
+ const com::sun::star::util::DateTime& rDateTime,
+ bool bAddTimeIf0AM = false );
+
+ /** convert ISO "date" or "dateTime" string to util::DateTime */
+ static bool convertDateTime( com::sun::star::util::DateTime& rDateTime,
+ const OUString& rString );
+
+ /** convert ISO "date" or "dateTime" string to util::DateTime or
+ util::Date */
+ static bool convertDateOrDateTime(
+ com::sun::star::util::Date & rDate,
+ com::sun::star::util::DateTime & rDateTime,
+ bool & rbDateTime,
+ const OUString & rString );
+
+ /** gets the position of the first comma after npos in the string
+ rStr. Commas inside '"' pairs are not matched */
+ static sal_Int32 indexOfComma( const OUString& rStr,
+ sal_Int32 nPos );
+
+ /** encodes the given byte sequence into Base64 */
+ static void encodeBase64(OUStringBuffer& aStrBuffer, const com::sun::star::uno::Sequence<sal_Int8>& aPass);
+
+ // Decode a base 64 encoded string into a sequence of bytes. The first
+ // version can be used for attribute values only, bacause it does not
+ // return any chars left from conversion.
+ // For text submitted throgh the SAX characters call, the later method
+ // must be used!
+ static void decodeBase64(com::sun::star::uno::Sequence<sal_Int8>& aPass, const OUString& sBuffer);
+
+ static sal_Int32 decodeBase64SomeChars(com::sun::star::uno::Sequence<sal_Int8>& aPass, const OUString& sBuffer);
+
+ static double GetConversionFactor(OUStringBuffer& rUnit, sal_Int16 nSourceUnit, sal_Int16 nTargetUnit);
+ static sal_Int16 GetUnitFromString(const OUString& rString, sal_Int16 nDefaultUnit);
+
+ /** convert an Any to string (typesafe) */
+ static bool convertAny(OUStringBuffer& rsValue,
+ OUStringBuffer& rsType ,
+ const ::com::sun::star::uno::Any& rValue);
+
+};
+
+}
+
+#endif // _SAX_CONVERTER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sax/tools/documenthandleradapter.hxx b/include/sax/tools/documenthandleradapter.hxx
new file mode 100644
index 000000000000..5867bbbb9cac
--- /dev/null
+++ b/include/sax/tools/documenthandleradapter.hxx
@@ -0,0 +1,254 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ * [ Peter Jentsch <pjotr@guineapics.de> ]
+ *
+ * Portions created by the Initial Developer are Copyright (C) 2010 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Peter Jentsch <pjotr@guineapics.de>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#ifndef _DOCUMENTHANDLERADAPTER_H_
+#define _DOCUMENTHANDLERADAPTER_H_
+
+#include <com/sun/star/xml/sax/SAXException.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
+
+namespace sax
+{
+ /**
+ * DocumentHandlerAdapter provides a base class for simple decorators to XDocumentHandlers.
+ * It forwards all method calls to a delegate. An inheriting class only needs to override the
+ * methods it actually wants to modify.
+ *
+ * See filters/source/odfflatxml/FlatXml.cxx for an example.
+ */
+ class DocumentHandlerAdapter : public ::com::sun::star::xml::sax::XDocumentHandler
+ {
+ public:
+ // XDocumentHandler
+ virtual void SAL_CALL
+ startDocument(void) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
+ {
+ m_handler->startDocument();
+ }
+
+ virtual void SAL_CALL
+ endDocument(void) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
+ {
+ m_handler->endDocument();
+ }
+
+ virtual void SAL_CALL
+ startElement(const OUString& aName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttribs)
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
+ {
+ m_handler->startElement(aName, xAttribs);
+ }
+
+ virtual void SAL_CALL
+ endElement(const OUString& aName) throw (::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ m_handler->endElement(aName);
+ }
+
+ virtual void SAL_CALL
+ characters(const OUString& aChars) throw (::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ m_handler->characters(aChars);
+ }
+
+ virtual void SAL_CALL
+ ignorableWhitespace(const OUString& aWhitespaces) throw (::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ m_handler->ignorableWhitespace(aWhitespaces);
+ }
+ virtual void SAL_CALL
+ processingInstruction(const OUString& aTarget, const OUString& aData)
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
+ {
+ m_handler->processingInstruction(aTarget, aData);
+ }
+ virtual void SAL_CALL
+ setDocumentLocator(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > & xLocator)
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
+ {
+ m_handler->setDocumentLocator(xLocator);
+ }
+ DocumentHandlerAdapter(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler >& delegate);
+ DocumentHandlerAdapter() :
+ m_handler(::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > (0, ::com::sun::star::uno::UNO_QUERY))
+ {
+ }
+ ;
+
+ protected:
+ virtual void SAL_CALL
+ setDelegate(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler >& delegate)
+ {
+ m_handler = delegate;
+ }
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > SAL_CALL
+ getDelegate()
+ {
+ return m_handler;
+ }
+ virtual
+ ~DocumentHandlerAdapter()
+ {
+
+ }
+
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > m_handler;
+
+ };
+
+ /**
+ * ExtendedDocumentHandlerAdapter provides a base class for simple decorators to XExtendedDocumentHandlers.
+ * It forwards all method calls to a delegate. An inheriting class only needs to override the
+ * methods it actually wants to modify.
+ */
+ class ExtendedDocumentHandlerAdapter : public ::com::sun::star::xml::sax::XExtendedDocumentHandler
+
+ {
+
+ public:
+ // XDocumentHandler
+ virtual void SAL_CALL
+ startDocument(void) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
+ {
+ m_handler->startDocument();
+ }
+
+ virtual void SAL_CALL
+ endDocument(void) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
+ {
+ m_handler->endDocument();
+ }
+
+ virtual void SAL_CALL
+ startElement(const OUString& aName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttribs)
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
+ {
+ m_handler->startElement(aName, xAttribs);
+ }
+
+ virtual void SAL_CALL
+ endElement(const OUString& aName) throw (::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ m_handler->endElement(aName);
+ }
+
+ virtual void SAL_CALL
+ characters(const OUString& aChars) throw (::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ m_handler->characters(aChars);
+ }
+
+ virtual void SAL_CALL
+ ignorableWhitespace(const OUString& aWhitespaces) throw (::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ m_handler->ignorableWhitespace(aWhitespaces);
+ }
+ virtual void SAL_CALL
+ processingInstruction(const OUString& aTarget, const OUString& aData)
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
+ {
+ m_handler->processingInstruction(aTarget, aData);
+ }
+ virtual void SAL_CALL
+ setDocumentLocator(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > & xLocator)
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
+ {
+ m_handler->setDocumentLocator(xLocator);
+ }
+ // XExtendedDocumentHandler
+ virtual void SAL_CALL
+ startCDATA(void) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
+ {
+ m_handler->startCDATA();
+ }
+ virtual void SAL_CALL
+ endCDATA(void) throw (::com::sun::star::uno::RuntimeException)
+ {
+ m_handler->endCDATA();
+ }
+ virtual void SAL_CALL
+ comment(const OUString& sComment) throw (::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ m_handler->comment(sComment);
+ }
+ virtual void SAL_CALL
+ unknown(const OUString& sString) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
+ {
+ m_handler->unknown(sString);
+ }
+ virtual void SAL_CALL
+ allowLineBreak(void) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
+ {
+ m_handler->allowLineBreak();
+ }
+ protected:
+ ExtendedDocumentHandlerAdapter() :
+ m_handler(::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XExtendedDocumentHandler > (0, ::com::sun::star::uno::UNO_QUERY))
+ {
+ }
+ ExtendedDocumentHandlerAdapter(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XExtendedDocumentHandler > delegate) :
+ m_handler(delegate)
+ {
+ }
+
+ virtual void SAL_CALL
+ setDelegate(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XExtendedDocumentHandler >& delegate)
+ {
+ m_handler = delegate;
+ }
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XExtendedDocumentHandler > SAL_CALL
+ getDelegate()
+ {
+ return m_handler;
+ }
+ virtual
+ ~ExtendedDocumentHandlerAdapter()
+ {
+
+ }
+
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XExtendedDocumentHandler > m_handler;
+ };
+}
+#endif /* _DOCUMENTHANDLERADAPTER_H_ */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/DocumentMetadataAccess.hxx b/include/sfx2/DocumentMetadataAccess.hxx
new file mode 100644
index 000000000000..d81401266ac3
--- /dev/null
+++ b/include/sfx2/DocumentMetadataAccess.hxx
@@ -0,0 +1,208 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SFX_DOCUMENTMETADATAACCESS_HXX_
+#define _SFX_DOCUMENTMETADATAACCESS_HXX_
+
+#include <sal/config.h>
+
+#include <sfx2/dllapi.h>
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/rdf/XDocumentMetadataAccess.hpp>
+#include <com/sun/star/rdf/XRepositorySupplier.hpp>
+
+#include <cppuhelper/implbase1.hxx>
+
+#include <boost/utility.hpp>
+
+#include <memory>
+
+
+/** Implementation of the interface com.sun.star.rdf.XDocumentMetadataAccess
+
+ This is not a service only because it needs some kind of XML ID registry
+ from the document, and i do not like defining an API for that.
+ Also, the implementation does _no_ locking, so make sure access is
+ protected externally.
+
+ @author mst
+ */
+
+namespace com { namespace sun { namespace star { namespace embed {
+ class XStorage;
+} } } }
+
+namespace sfx2 {
+
+
+/** create a base URI for loading metadata from an ODF (sub)document.
+
+ @param i_xContext component context
+ @param i_xStorage storage for the document; FileSystemStorage is allowed
+ @param i_rPkgURI the URI for the package
+ @param i_rSubDocument (optional) path of the subdocument in package
+
+ @return a base URI suitable for XDocumentMetadataAccess::loadFromStorage
+ */
+::com::sun::star::uno::Reference< ::com::sun::star::rdf::XURI> SFX2_DLLPUBLIC
+createBaseURI(
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>
+ const & i_xContext,
+ ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage>
+ const & i_xStorage,
+ OUString const & i_rPkgURI,
+ OUString const & i_rSubDocument = OUString());
+
+
+class IXmlIdRegistrySupplier;
+struct DocumentMetadataAccess_Impl;
+
+
+class SFX2_DLLPUBLIC DocumentMetadataAccess :
+ private boost::noncopyable,
+ public ::cppu::WeakImplHelper1<
+ ::com::sun::star::rdf::XDocumentMetadataAccess>
+{
+public:
+ explicit DocumentMetadataAccess(::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & i_xContext,
+ IXmlIdRegistrySupplier const & i_rRegistrySupplier,
+ OUString const & i_rBaseURI);
+ // N.B.: in contrast to previous, this constructor does _not_ initialize!
+ // caller must immediately call loadFromStorage/Medium!
+ explicit DocumentMetadataAccess(::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & i_xContext,
+ IXmlIdRegistrySupplier const & i_rRegistrySupplier);
+ virtual ~DocumentMetadataAccess();
+
+ // ::com::sun::star::rdf::XNode:
+ virtual OUString SAL_CALL getStringValue()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::rdf::XURI:
+ virtual OUString SAL_CALL getNamespace()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getLocalName()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::rdf::XRepositorySupplier:
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XRepository > SAL_CALL getRDFRepository()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::rdf::XDocumentMetadataAccess:
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XMetadatable > SAL_CALL
+ getElementByMetadataReference(
+ const ::com::sun::star::beans::StringPair & i_rReference)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XMetadatable > SAL_CALL
+ getElementByURI(const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XURI > & i_xURI)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XURI > > SAL_CALL getMetadataGraphsWithType(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XURI > & i_xType)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XURI> SAL_CALL
+ addMetadataFile(const OUString & i_rFileName,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XURI >
+ > & i_rTypes)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::ElementExistException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XURI> SAL_CALL
+ importMetadataFile(::sal_Int16 i_Format,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XInputStream > & i_xInStream,
+ const OUString & i_rFileName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XURI > & i_xBaseURI,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XURI >
+ > & i_rTypes)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::datatransfer::UnsupportedFlavorException,
+ ::com::sun::star::container::ElementExistException,
+ ::com::sun::star::rdf::ParseException,
+ ::com::sun::star::io::IOException);
+ virtual void SAL_CALL removeMetadataFile(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XURI > & i_xGraphName)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException);
+ virtual void SAL_CALL addContentOrStylesFile(
+ const OUString & i_rFileName)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::ElementExistException);
+ virtual void SAL_CALL removeContentOrStylesFile(
+ const OUString & i_rFileName)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException);
+
+ virtual void SAL_CALL loadMetadataFromStorage(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::embed::XStorage > & i_xStorage,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XURI > & i_xBaseURI,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::task::XInteractionHandler> & i_xHandler)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException);
+ virtual void SAL_CALL storeMetadataToStorage(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::embed::XStorage > & i_xStorage)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException);
+ virtual void SAL_CALL loadMetadataFromMedium(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue > & i_rMedium)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException);
+ virtual void SAL_CALL storeMetadataToMedium(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue > & i_rMedium)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException);
+
+private:
+ std::auto_ptr<DocumentMetadataAccess_Impl> m_pImpl;
+};
+
+} // namespace sfx2
+
+#endif // _SFX_DOCUMENTMETADATAACCESS_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/Metadatable.hxx b/include/sfx2/Metadatable.hxx
new file mode 100644
index 000000000000..70737da920ce
--- /dev/null
+++ b/include/sfx2/Metadatable.hxx
@@ -0,0 +1,181 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef METADATABLE_HXX
+#define METADATABLE_HXX
+
+#include <sal/config.h>
+
+#include <sfx2/dllapi.h>
+
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/rdf/XMetadatable.hpp>
+
+#include <boost/utility.hpp>
+#include <boost/shared_ptr.hpp>
+
+
+namespace com { namespace sun { namespace star {
+ namespace frame { class XModel; }
+} } }
+
+namespace sfx2 {
+ class IXmlIdRegistry;
+}
+
+namespace sfx2 {
+
+class XmlIdRegistry;
+class MetadatableUndo;
+
+
+// XML ID handling ---------------------------------------------------
+
+
+/// create a sfx2::XmlIdRegistryDocument or a sfx2::XmlIdRegistryClipboard
+SFX2_DLLPUBLIC ::sfx2::IXmlIdRegistry *
+createXmlIdRegistry(const bool i_DocIsClipboard);
+
+
+/** base class for core objects that may have xml:id.
+
+ <p>The interface of this class consists of 3 parts:
+ <ul><li>implementations that are used by the <type>MetadatableMixin</type>
+ below</li>
+ <li>hooks to be called by the sw core whenever actions that are
+ relevant to the uniqueness of xml:ids are taken (copying,
+ splitting, merging, deletion, undo, etc.)</li>
+ <li>abstract methods that are called by the implementation of the
+ previous hooks</li></ul>
+ </p>
+ */
+class SFX2_DLLPUBLIC Metadatable : private boost::noncopyable
+{
+
+public:
+ Metadatable() : m_pReg(0) {}
+
+ // destructor calls RemoveMetadataReference
+ virtual ~Metadatable();
+
+ // for MetadatableMixin ----------------------------------------------
+
+ ::com::sun::star::beans::StringPair GetMetadataReference() const;
+ void SetMetadataReference(
+ const ::com::sun::star::beans::StringPair & i_rReference);
+ void EnsureMetadataReference();
+
+ // hooks -------------------------------------------------------------
+
+ // called from dtor!
+ void RemoveMetadataReference();
+
+ /** register this as a copy of i_rSource */
+ void RegisterAsCopyOf(Metadatable const & i_rSource,
+ const bool i_bCopyPrecedesSource = false);
+
+ /** create an Undo Metadatable, which remembers this' reference */
+ ::boost::shared_ptr<MetadatableUndo> CreateUndo() const;
+ ::boost::shared_ptr<MetadatableUndo> CreateUndoForDelete();
+
+ /** restore this from Undo Metadatable */
+ void RestoreMetadata(::boost::shared_ptr<MetadatableUndo> const& i_pUndo);
+
+ /** merge this and i_rOther into this */
+ void JoinMetadatable(Metadatable const & i_rOther,
+ const bool i_isMergedEmpty, const bool i_isOtherEmpty);
+
+ // abstract methods --------------------------------------------------
+
+ /** get the registry from the SwDoc */
+ virtual ::sfx2::IXmlIdRegistry& GetRegistry() = 0;
+
+ /** is this in a clipboard document? */
+ virtual bool IsInClipboard() const = 0;
+
+ /** is this in undo array? */
+ virtual bool IsInUndo() const = 0;
+
+ /** which stream is this in? true: content.xml; false: styles.xml */
+ virtual bool IsInContent() const = 0;
+
+ /** create XMetadatable from this.
+ note: if IsInUndo or IsInClipboard return true,
+ MakeUnoObject <em>must not</em> be called!
+ */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XMetadatable > MakeUnoObject() = 0;
+
+private:
+ friend class MetadatableClipboard;
+ friend class MetadatableUndo;
+
+ // note that Reg may be a XmlIdRegistryDocument or a XmlIdRegistryClipboard
+ XmlIdRegistry* m_pReg; // null => no XmlId
+};
+
+
+/** base class for UNO objects that implement <type>XMetadatable</type>.
+
+ <p>An instance of this base class is associated with an instance of
+ <type>Metadatable</type>.</p>
+ */
+class SFX2_DLLPUBLIC MetadatableMixin :
+ public ::cppu::WeakImplHelper1<
+ ::com::sun::star::rdf::XMetadatable>
+{
+
+public:
+ MetadatableMixin() {};
+
+ virtual ~MetadatableMixin() {}
+
+ // ::com::sun::star::rdf::XNode:
+ virtual OUString SAL_CALL getStringValue()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::rdf::XURI:
+ virtual OUString SAL_CALL getLocalName()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getNamespace()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::rdf::XMetadatable:
+ virtual ::com::sun::star::beans::StringPair SAL_CALL getMetadataReference()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMetadataReference(
+ const ::com::sun::star::beans::StringPair & i_rReference)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IllegalArgumentException);
+ virtual void SAL_CALL ensureMetadataReference()
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ /// get the core object corresponding to this UNO object.
+ virtual Metadatable * GetCoreObject() = 0;
+ /// get the <type>XModel</type> for the document
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
+ GetModel() = 0;
+
+};
+
+} // namespace sfx2
+
+#endif // METADATABLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/QuerySaveDocument.hxx b/include/sfx2/QuerySaveDocument.hxx
new file mode 100644
index 000000000000..e442b482ff53
--- /dev/null
+++ b/include/sfx2/QuerySaveDocument.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef SFX_QUERYSAVEDOCUMENT_HXX
+#define SFX_QUERYSAVEDOCUMENT_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+
+class Window;
+class String;
+/** Opens the general query save document dialog.
+ @param _pParent
+ The parent window.
+ @_rTitle
+ The title of the document.
+*/
+SFX2_DLLPUBLIC short ExecuteQuerySaveDocument(
+ Window* _pParent,const String& _rTitle);
+
+#endif //SFX_QUERYSAVEDOCUMENT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/XmlIdRegistry.hxx b/include/sfx2/XmlIdRegistry.hxx
new file mode 100644
index 000000000000..a7540dc469b0
--- /dev/null
+++ b/include/sfx2/XmlIdRegistry.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SFX_XMLIDREGISTRY_HXX_
+#define _SFX_XMLIDREGISTRY_HXX_
+
+#include <sal/config.h>
+
+#include <sfx2/dllapi.h>
+
+#include <com/sun/star/beans/StringPair.hpp>
+
+
+namespace com { namespace sun { namespace star { namespace rdf {
+ class XMetadatable;
+} } } }
+
+namespace sfx2 {
+
+// XML ID utilities --------------------------------------------------
+
+/** is i_rIdref a valid NCName ? */
+bool SFX2_DLLPUBLIC isValidNCName(OUString const & i_rIdref);
+
+bool SFX2_DLLPUBLIC isValidXmlId(OUString const & i_rStreamName,
+ OUString const & i_rIdref);
+
+// XML ID handling ---------------------------------------------------
+
+/** interface for getElementByMetadataReference;
+ for use by sfx2::DocumentMetadataAccess
+ */
+class SFX2_DLLPUBLIC IXmlIdRegistry
+{
+
+public:
+ virtual ~IXmlIdRegistry() { }
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rdf::XMetadatable > SAL_CALL
+ GetElementByMetadataReference(
+ const ::com::sun::star::beans::StringPair & i_rXmlId) const = 0;
+
+};
+
+/** supplier interface for the registry.
+
+ This indirection is unfortunately necessary, because the SwDocShell
+ is not always connected to a SwDoc, so we cannot guarantee that a
+ registry given to a SfxBaseModel/DocumentMetadataAccess remains valid;
+ it has to be retrieved from this supplier interface on access.
+ */
+class SFX2_DLLPUBLIC IXmlIdRegistrySupplier
+{
+
+public:
+ virtual ~IXmlIdRegistrySupplier() { }
+
+ /** override this if you have a XmlIdRegistry. */
+ virtual const IXmlIdRegistry* GetXmlIdRegistry() const { return 0; }
+
+};
+
+} // namespace sfx2
+
+#endif // _SFX_XMLIDREGISTRY_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/app.hxx b/include/sfx2/app.hxx
new file mode 100644
index 000000000000..858140d2b8be
--- /dev/null
+++ b/include/sfx2/app.hxx
@@ -0,0 +1,278 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXAPP_HXX
+#define _SFXAPP_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include "sal/types.h"
+#include <tools/solar.h>
+#include <tools/errcode.hxx>
+#include <svl/smplhint.hxx>
+#include <svl/poolitem.hxx>
+#include <vcl/image.hxx>
+#include <tools/ref.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/script/XLibraryContainer.hpp>
+#include <com/sun/star/task/XStatusIndicator.hpp>
+
+// too many files including sfx2/app.hxx use VCL Application class but don't include the
+// header file because in former times SfxApplication was derived from it
+#include <vcl/svapp.hxx>
+
+#include <sfx2/shell.hxx>
+#include <vector>
+
+class Timer;
+class ApplicationEvent;
+class WorkWindow;
+class ISfxTemplateCommon;
+class BasicManager;
+class DdeService;
+class GenLink;
+class PrinterDialog;
+class Point;
+class Rectangle;
+class AppSettings;
+struct SfxChildWinContextFactory;
+class SfxAppData_Impl;
+class SfxBindings;
+class SfxChildWinFactArr_Impl;
+class SfxChildWindow;
+class SfxDispatcher;
+class SfxEventConfiguration;
+class SfxEventHint;
+class SfxItemSet;
+class SfxMedium;
+class SfxMenuCtrlFactArr_Impl;
+class SfxNewFileDialog;
+class SfxObjectShell;
+class SfxObjectShellArr_Impl;
+class SfxProgress;
+class SfxSlotPool;
+class SfxStbCtrlFactArr_Impl;
+class SfxTbxCtrlFactArr_Impl;
+class SfxTemplateDialog;
+class SfxViewFrame;
+class SfxViewFrameArr_Impl;
+class SfxViewShell;
+class SfxViewShellArr_Impl;
+class StarBASIC;
+class SfxWorkWindow;
+class SfxFilterMatcher;
+class SfxModule;
+class SfxModule;
+typedef ::std::vector<SfxModule*> SfxModuleArr_Impl;
+class Window;
+class INetURLObject;
+struct SfxChildWinFactory;
+struct SfxMenuCtrlFactory;
+struct SfxStbCtrlFactory;
+struct SfxTbxCtrlFactory;
+class SimpleResMgr;
+class ModalDialog;
+class SbxArray;
+class SbxValue;
+
+typedef ::std::vector< SfxMedium* > SfxMediumList;
+
+namespace sfx2
+{
+ class SvLinkSource;
+}
+
+//====================================================================
+
+class SfxLinkItem : public SfxPoolItem
+{
+ Link aLink;
+public:
+ virtual SfxPoolItem* Clone( SfxItemPool* = 0 ) const
+ { return new SfxLinkItem( *this ); }
+ virtual int operator==( const SfxPoolItem& rL) const
+ { return ((SfxLinkItem&)rL).aLink == aLink; }
+ SfxLinkItem( sal_uInt16 nWhichId, const Link& rValue ) : SfxPoolItem( nWhichId )
+ { aLink = rValue; }
+ const Link& GetValue() const { return aLink; }
+};
+
+//TODO/CLEANUP
+//is apparently used only in SfxPickList/SfxFrameLoader
+DECL_OBJHINT( SfxStringHint, String );
+
+#ifndef SFX_DECL_OBJECTSHELL_DEFINED
+#define SFX_DECL_OBJECTSHELL_DEFINED
+SV_DECL_REF(SfxObjectShell)
+#endif
+
+class SfxObjectShellLock;
+
+class SFX2_DLLPUBLIC SfxApplication: public SfxShell
+{
+ SAL_DLLPRIVATE static SfxApplication* pApp;
+
+ SfxAppData_Impl* pAppData_Impl;
+
+ DECL_DLLPRIVATE_LINK( GlobalBasicErrorHdl_Impl, StarBASIC* );
+
+ static SfxApplication* Create();
+ void Init();
+ void Exit();
+ void SettingsChange( sal_uInt16, const AppSettings & );
+ void Quit();
+ void Deinitialize();
+
+public:
+ TYPEINFO();
+ SFX_DECL_INTERFACE(SFX_INTERFACE_SFXAPP)
+
+ SfxApplication();
+ ~SfxApplication();
+ static SfxApplication* GetOrCreate();
+
+ // Resource Manager
+ ResMgr* GetSfxResManager();
+ static ResMgr* CreateResManager( const char *pPrefix );
+
+ // DDE
+#if defined( WNT )
+ long DdeExecute( const String& rCmd );
+#endif
+ sal_Bool InitializeDde();
+ const DdeService* GetDdeService() const;
+ DdeService* GetDdeService();
+#if defined( WNT )
+ void AddDdeTopic( SfxObjectShell* );
+#endif
+ void RemoveDdeTopic( SfxObjectShell* );
+
+ // "static" methods
+ /**
+ * @param pArgs Takes ownership
+ */
+ sal_uIntPtr LoadTemplate( SfxObjectShellLock& xDoc, const String& rFileName, sal_Bool bCopy=sal_True, SfxItemSet* pArgs = 0 );
+ SfxTemplateDialog* GetTemplateDialog();
+ Window* GetTopWindow() const;
+
+ // TODO/CLEANUP: make currently selected family a view property and so we don't need to query the status from the "TemplateCommon"
+ ISfxTemplateCommon* GetCurrentTemplateCommon( SfxBindings& );
+
+ // members
+ SfxFilterMatcher& GetFilterMatcher();
+ SfxProgress* GetProgress() const;
+ const String& GetLastSaveDirectory() const;
+ sal_uInt16 GetFreeIndex();
+ void ReleaseIndex(sal_uInt16 i);
+
+ // Basic/Scripting
+ static sal_Bool IsXScriptURL( const String& rScriptURL );
+ static OUString ChooseScript();
+ static void MacroOrganizer( sal_Int16 nTabId );
+ static ErrCode CallBasic( const String&, BasicManager*, SbxArray *pArgs, SbxValue *pRet );
+ static ErrCode CallAppBasic( const String& i_macroName, SbxArray* i_args = NULL, SbxValue* i_ret = NULL )
+ { return CallBasic( i_macroName, SfxApplication::GetOrCreate()->GetBasicManager(), i_args, i_ret ); }
+ BasicManager* GetBasicManager();
+ com::sun::star::uno::Reference< com::sun::star::script::XLibraryContainer >
+ GetDialogContainer();
+ com::sun::star::uno::Reference< com::sun::star::script::XLibraryContainer >
+ GetBasicContainer();
+ StarBASIC* GetBasic();
+ sal_uInt16 SaveBasicAndDialogContainer() const;
+
+ // misc.
+ sal_Bool GetOptions(SfxItemSet &);
+ void SetOptions(const SfxItemSet &);
+ virtual void Invalidate(sal_uInt16 nId = 0);
+ void NotifyEvent(const SfxEventHint& rEvent, bool bSynchron = true );
+ sal_Bool IsDowning() const;
+ sal_Bool IsSecureURL( const INetURLObject &rURL, const String *pReferer ) const;
+ void ResetLastDir();
+
+ SAL_DLLPRIVATE static SfxApplication* Get() { return pApp;}
+ SAL_DLLPRIVATE SfxDispatcher* GetAppDispatcher_Impl();
+ SAL_DLLPRIVATE SfxDispatcher* GetDispatcher_Impl();
+
+ SAL_DLLPRIVATE sal_Bool QueryExit_Impl();
+ SAL_DLLPRIVATE void SetOptions_Impl(const SfxItemSet &);
+ SAL_DLLPRIVATE bool Initialize_Impl();
+
+ SAL_DLLPRIVATE SfxAppData_Impl* Get_Impl() const { return pAppData_Impl; }
+
+ // Object-Factories/global arrays
+ SAL_DLLPRIVATE void RegisterChildWindow_Impl(SfxModule*, SfxChildWinFactory*);
+ SAL_DLLPRIVATE void RegisterChildWindowContext_Impl(SfxModule*, sal_uInt16, SfxChildWinContextFactory*);
+ SAL_DLLPRIVATE void RegisterStatusBarControl_Impl(SfxModule*, SfxStbCtrlFactory*);
+ SAL_DLLPRIVATE void RegisterMenuControl_Impl(SfxModule*, SfxMenuCtrlFactory*);
+ SAL_DLLPRIVATE void RegisterToolBoxControl_Impl( SfxModule*, SfxTbxCtrlFactory*);
+ SAL_DLLPRIVATE SfxTbxCtrlFactArr_Impl& GetTbxCtrlFactories_Impl() const;
+ SAL_DLLPRIVATE SfxStbCtrlFactArr_Impl& GetStbCtrlFactories_Impl() const;
+ SAL_DLLPRIVATE SfxMenuCtrlFactArr_Impl& GetMenuCtrlFactories_Impl() const;
+ SAL_DLLPRIVATE SfxChildWinFactArr_Impl& GetChildWinFactories_Impl() const;
+ SAL_DLLPRIVATE SfxViewFrameArr_Impl& GetViewFrames_Impl() const;
+ SAL_DLLPRIVATE SfxViewShellArr_Impl& GetViewShells_Impl() const;
+ SAL_DLLPRIVATE SfxObjectShellArr_Impl& GetObjectShells_Impl() const;
+ SAL_DLLPRIVATE void SetViewFrame_Impl(SfxViewFrame *pViewFrame);
+
+ // Slot Methods
+ // TODO/CLEANUP: still needed?
+ SAL_DLLPRIVATE void NewDocDirectExec_Impl(SfxRequest &);
+ SAL_DLLPRIVATE void NewDocExec_Impl(SfxRequest &);
+ SAL_DLLPRIVATE void OpenDocExec_Impl(SfxRequest &);
+ SAL_DLLPRIVATE void MiscExec_Impl(SfxRequest &);
+ SAL_DLLPRIVATE void MiscState_Impl(SfxItemSet &);
+ SAL_DLLPRIVATE void PropExec_Impl(SfxRequest &);
+ SAL_DLLPRIVATE void PropState_Impl(SfxItemSet &);
+ SAL_DLLPRIVATE void INetExecute_Impl(SfxRequest &);
+ SAL_DLLPRIVATE void INetState_Impl(SfxItemSet &);
+ SAL_DLLPRIVATE void OfaExec_Impl(SfxRequest &);
+ SAL_DLLPRIVATE void OfaState_Impl(SfxItemSet &);
+
+ SAL_DLLPRIVATE void SetProgress_Impl(SfxProgress *);
+ SAL_DLLPRIVATE const String& GetLastDir_Impl() const;
+ SAL_DLLPRIVATE void SetLastDir_Impl( const String & );
+
+ SAL_DLLPRIVATE void Registrations_Impl();
+ SAL_DLLPRIVATE SfxWorkWindow* GetWorkWindow_Impl(const SfxViewFrame *pFrame=0) const;
+
+ // TODO/CLEANUP: still needed? -- unclear whether this comment
+ // refers to the GetDisabledSlotList_Impl() method which was
+ // already removed, or the below methods?
+ SAL_DLLPRIVATE SfxSlotPool& GetAppSlotPool_Impl() const;
+ SAL_DLLPRIVATE SfxModule* GetModule_Impl();
+ SAL_DLLPRIVATE ResMgr* GetOffResManager_Impl();
+
+ static bool loadBrandSvg(const char *pName, BitmapEx &rBitmap, int nWidth);
+
+ /** loads the application logo as used in the impress slideshow pause screen */
+ static BitmapEx GetApplicationLogo(long nWidth);
+};
+
+#define SFX_APP() SfxGetpApp()
+
+//--------------------------------------------------------------------
+
+inline SfxApplication* SfxGetpApp()
+{
+ return SfxApplication::GetOrCreate();
+}
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/appuno.hxx b/include/sfx2/appuno.hxx
new file mode 100644
index 000000000000..90bf2d5edf58
--- /dev/null
+++ b/include/sfx2/appuno.hxx
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX_APPUNO_HXX
+#define _SFX_APPUNO_HXX
+
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/registry/XSimpleRegistry.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/util/URL.hpp>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XSynchronousDispatch.hpp>
+#include <com/sun/star/frame/XNotifyingDispatch.hpp>
+#include <com/sun/star/frame/XDispatchResultListener.hpp>
+#include <com/sun/star/frame/DispatchDescriptor.hpp>
+#include <com/sun/star/frame/XDispatchInformationProvider.hpp>
+
+#include <com/sun/star/uno/Any.h>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase4.hxx>
+
+#include <tools/errcode.hxx>
+#include <sfx2/sfxuno.hxx>
+
+class SfxObjectShell;
+class SfxMacroLoader : public ::com::sun::star::frame::XDispatchProvider,
+ public ::com::sun::star::frame::XNotifyingDispatch,
+ public ::com::sun::star::frame::XSynchronousDispatch,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::com::sun::star::lang::XServiceInfo,
+ public ::com::sun::star::lang::XInitialization,
+ public ::cppu::OWeakObject
+{
+ ::com::sun::star::uno::WeakReference < ::com::sun::star::frame::XFrame > m_xFrame;
+
+ SfxObjectShell* GetObjectShell_Impl();
+
+public:
+ // XInterface, XTypeProvider, XServiceInfo
+ SFX_DECL_XINTERFACE_XTYPEPROVIDER_XSERVICEINFO
+
+ SfxMacroLoader( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& )
+ {}
+
+ static ErrCode loadMacro( const OUString& aURL, ::com::sun::star::uno::Any& rRetval, SfxObjectShell* pDoc=NULL ) throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > SAL_CALL
+ queryDispatch( const ::com::sun::star::util::URL& aURL, const OUString& sTargetFrameName,
+ FrameSearchFlags eSearchFlags ) throw( ::com::sun::star::uno::RuntimeException ) ;
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > > SAL_CALL
+ queryDispatches( const ::com::sun::star::uno::Sequence < ::com::sun::star::frame::DispatchDescriptor >& seqDescriptor )
+ throw( ::com::sun::star::uno::RuntimeException ) ;
+ virtual void SAL_CALL dispatchWithNotification( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArgs, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchResultListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArgs ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL dispatchWithReturnValue( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArgs ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw (::com::sun::star::uno::RuntimeException);
+ 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);
+};
+
+class SfxAppDispatchProvider : public ::cppu::WeakImplHelper4< ::com::sun::star::frame::XDispatchProvider,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::lang::XInitialization,
+ ::com::sun::star::frame::XDispatchInformationProvider >
+{
+ ::com::sun::star::uno::WeakReference < ::com::sun::star::frame::XFrame > m_xFrame;
+public:
+ SfxAppDispatchProvider( const com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& )
+ {}
+
+ SFX_DECL_XSERVICEINFO
+ virtual ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > SAL_CALL
+ queryDispatch( const ::com::sun::star::util::URL& aURL, const OUString& sTargetFrameName,
+ FrameSearchFlags eSearchFlags ) throw( ::com::sun::star::uno::RuntimeException ) ;
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > > SAL_CALL
+ queryDispatches( const ::com::sun::star::uno::Sequence < ::com::sun::star::frame::DispatchDescriptor >& seqDescriptor )
+ throw( ::com::sun::star::uno::RuntimeException ) ;
+ 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);
+ virtual ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL getSupportedCommandGroups() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchInformation > SAL_CALL getConfigurableDispatchInformation( sal_Int16 ) throw (::com::sun::star::uno::RuntimeException);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/basedlgs.hxx b/include/sfx2/basedlgs.hxx
new file mode 100644
index 000000000000..95278e89e605
--- /dev/null
+++ b/include/sfx2/basedlgs.hxx
@@ -0,0 +1,238 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _BASEDLGS_HXX
+#define _BASEDLGS_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include "sal/types.h"
+#include <vcl/builder.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/floatwin.hxx>
+#include <vcl/timer.hxx>
+
+class TabPage;
+class SfxTabPage;
+class SfxBindings;
+class SfxChildWindow;
+struct SfxChildWinInfo;
+class SfxItemSet;
+class SfxItemPool;
+class OKButton;
+class CancelButton;
+class HelpButton;
+class Button;
+class FixedLine;
+
+//There is a hack which hides the HelpId for a Dialog in SfxModelessDialog
+//and SfxDockingWindow, where it is changed into a UniqueId and cleared
+//This reverses the clear of the HelpId
+
+SFX2_DLLPUBLIC inline void reverseUniqueHelpIdHack(Window &rWindow)
+{
+ if (rWindow.GetHelpId().isEmpty())
+ rWindow.SetHelpId(rWindow.GetUniqueId());
+}
+
+// class SfxModalDialog --------------------------------------------------
+
+class SFX2_DLLPUBLIC SfxModalDialog: public ModalDialog
+{
+ sal_uInt32 nUniqId;
+ String aExtraData;
+ const SfxItemSet* pInputSet;
+ SfxItemSet* pOutputSet;
+
+private:
+ SAL_DLLPRIVATE SfxModalDialog(SfxModalDialog &); // not defined
+ SAL_DLLPRIVATE void operator =(SfxModalDialog &); // not defined
+
+ SAL_DLLPRIVATE void SetDialogData_Impl();
+ SAL_DLLPRIVATE void GetDialogData_Impl();
+ SAL_DLLPRIVATE void init();
+
+protected:
+ SfxModalDialog(Window *pParent, const ResId& );
+ SfxModalDialog(Window *pParent, const OString& rID, const OUString& rUIXMLDescription);
+ SfxModalDialog(Window* pParent, sal_uInt32 nUniqueId, WinBits nWinStyle = WB_STDMODAL );
+
+ String& GetExtraData() { return aExtraData; }
+ sal_uInt32 GetUniqId() const { return nUniqId; }
+ void SetUniqId(sal_uInt32 nSettingsId) { nUniqId = nSettingsId; }
+ SfxItemSet* GetItemSet() { return pOutputSet; }
+ void CreateOutputItemSet( SfxItemPool& rPool );
+ void CreateOutputItemSet( const SfxItemSet& rInput );
+ void SetInputSet( const SfxItemSet* pInSet ) { pInputSet = pInSet; }
+ SfxItemSet* GetOutputSetImpl() { return pOutputSet; }
+
+public:
+ ~SfxModalDialog();
+ const SfxItemSet* GetOutputItemSet() const { return pOutputSet; }
+ const SfxItemSet* GetInputItemSet() const { return pInputSet; }
+};
+
+// class SfxModelessDialog --------------------------------------------------
+class SfxModelessDialog_Impl;
+class SFX2_DLLPUBLIC SfxModelessDialog: public ModelessDialog
+{
+ SfxBindings* pBindings;
+ Size aSize;
+ SfxModelessDialog_Impl* pImp;
+
+ SAL_DLLPRIVATE SfxModelessDialog(SfxModelessDialog &); // not defined
+ SAL_DLLPRIVATE void operator =(SfxModelessDialog &); // not defined
+
+ void Init(SfxBindings *pBindinx, SfxChildWindow *pCW);
+
+protected:
+ SfxModelessDialog( SfxBindings*, SfxChildWindow*,
+ Window*, const ResId& );
+ SfxModelessDialog( SfxBindings*, SfxChildWindow*,
+ Window*, const OString& rID, const OUString& rUIXMLDescription );
+ ~SfxModelessDialog();
+ virtual sal_Bool Close();
+ virtual void Resize();
+ virtual void Move();
+ virtual void StateChanged( StateChangedType nStateChange );
+
+public:
+ virtual void FillInfo(SfxChildWinInfo&) const;
+ void Initialize (SfxChildWinInfo* pInfo);
+ virtual long Notify( NotifyEvent& rNEvt );
+ SfxBindings& GetBindings()
+ { return *pBindings; }
+
+ DECL_LINK(TimerHdl, void *);
+
+};
+
+// class SfxFloatingWindow --------------------------------------------------
+class SfxFloatingWindow_Impl;
+class SFX2_DLLPUBLIC SfxFloatingWindow: public FloatingWindow
+{
+ SfxBindings* pBindings;
+ Size aSize;
+ SfxFloatingWindow_Impl* pImp;
+
+ SAL_DLLPRIVATE SfxFloatingWindow(SfxFloatingWindow &); // not defined
+ SAL_DLLPRIVATE void operator =(SfxFloatingWindow &); // not defined
+
+protected:
+ SfxFloatingWindow( SfxBindings *pBindings,
+ SfxChildWindow *pCW,
+ Window* pParent,
+ WinBits nWinBits=WB_STDMODELESS);
+ SfxFloatingWindow( SfxBindings *pBindings,
+ SfxChildWindow *pCW,
+ Window* pParent,
+ const ResId& rResId);
+ ~SfxFloatingWindow();
+
+ virtual void StateChanged( StateChangedType nStateChange );
+ virtual sal_Bool Close();
+ virtual void Resize();
+ virtual void Move();
+ virtual long Notify( NotifyEvent& rNEvt );
+ SfxBindings& GetBindings()
+ { return *pBindings; }
+
+public:
+ virtual void FillInfo(SfxChildWinInfo&) const;
+ void Initialize (SfxChildWinInfo* pInfo);
+
+ DECL_LINK(TimerHdl, void *);
+
+};
+
+// class SfxNoLayoutSingleTabDialog --------------------------------------------------
+
+struct SingleTabDlgImpl
+{
+ SfxTabPage* m_pSfxPage;
+ FixedLine* m_pLine;
+ String m_sInfoURL;
+ Link m_aInfoLink;
+
+ SingleTabDlgImpl()
+ : m_pSfxPage(NULL)
+ , m_pLine(NULL)
+ {
+ }
+};
+
+typedef sal_uInt16* (*GetTabPageRanges)(); // liefert internationale Which-Werte
+
+class SFX2_DLLPUBLIC SfxSingleTabDialogBase : public SfxModalDialog
+{
+public:
+ //layout ctor
+ SfxSingleTabDialogBase(Window* pParent, const SfxItemSet& rOptionsSet);
+
+ //non-layout ctors
+ SfxSingleTabDialogBase( Window* pParent, const SfxItemSet& rOptionsSet, sal_uInt16 nUniqueId );
+ SfxSingleTabDialogBase( Window* pParent, sal_uInt16 nUniqueId, const SfxItemSet* pInSet = 0 );
+
+ virtual ~SfxSingleTabDialogBase();
+
+ SfxTabPage* GetTabPage() const { return pImpl->m_pSfxPage; }
+
+ OKButton* GetOKButton() const { return pOKBtn; }
+ CancelButton* GetCancelButton() const { return pCancelBtn; }
+
+protected:
+ GetTabPageRanges fnGetRanges;
+
+ OKButton* pOKBtn;
+ CancelButton* pCancelBtn;
+ HelpButton* pHelpBtn;
+
+ SingleTabDlgImpl* pImpl;
+
+ DECL_DLLPRIVATE_LINK(OKHdl_Impl, void *);
+};
+
+class SFX2_DLLPUBLIC SfxSingleTabDialog : public SfxSingleTabDialogBase
+{
+public:
+ SfxSingleTabDialog(Window* pParent, const SfxItemSet& rOptionsSet)
+ : SfxSingleTabDialogBase(pParent, rOptionsSet)
+ {
+ }
+ void setTabPage(SfxTabPage* pTabPage, GetTabPageRanges pRangesFunc = 0, sal_uInt32 nSettingsId = 0);
+};
+
+//Old school deprecated non-layout aware version
+class SFX2_DLLPUBLIC SfxNoLayoutSingleTabDialog : public SfxSingleTabDialogBase
+{
+public:
+ SfxNoLayoutSingleTabDialog(Window* pParent, const SfxItemSet& rOptionsSet, sal_uInt16 nUniqueId)
+ : SfxSingleTabDialogBase(pParent, rOptionsSet, nUniqueId)
+ {
+ }
+ SfxNoLayoutSingleTabDialog(Window* pParent, sal_uInt16 nUniqueId, const SfxItemSet* pInSet = 0)
+ : SfxSingleTabDialogBase(pParent, nUniqueId, pInSet)
+ {
+ }
+ ~SfxNoLayoutSingleTabDialog();
+ void SetTabPage(SfxTabPage* pTabPage, GetTabPageRanges pRangesFunc = 0);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/bindings.hxx b/include/sfx2/bindings.hxx
new file mode 100644
index 000000000000..664673cf66d5
--- /dev/null
+++ b/include/sfx2/bindings.hxx
@@ -0,0 +1,248 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX_BINDINGS_HXX
+#define _SFX_BINDINGS_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include "sal/types.h"
+#include "rtl/strbuf.hxx"
+#include <tools/link.hxx>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/frame/XDispatchRecorderSupplier.hpp>
+#include <vector>
+
+//________________________________________________________________________________________________________________
+// some other includes
+//________________________________________________________________________________________________________________
+
+#include <sfx2/viewfrm.hxx>
+
+//________________________________________________________________________________________________________________
+// forwards, typedefs, declarations
+//________________________________________________________________________________________________________________
+
+class SystemWindow;
+class SfxSlot;
+class SfxSlotServer;
+class SfxControllerItem;
+class SfxStateCache;
+class SfxItemSet;
+class SfxDispatcher;
+class SfxBindings;
+class SfxBindings_Impl;
+class Timer;
+struct SfxFoundCache_Impl;
+class SfxFoundCacheArr_Impl;
+class SfxWorkWindow;
+class SfxUnoControllerItem;
+
+typedef std::vector<SfxUnoControllerItem*> SfxUnoControllerArr_Impl;
+
+#define SFX_CALLMODE_SLOT 0x00 // sync/async from Slot
+#define SFX_CALLMODE_SYNCHRON 0x01 // synchronously in the same Stackframe
+#define SFX_CALLMODE_ASYNCHRON 0x02 // asynchronously via AppEvent
+#define SFX_CALLMODE_RECORD 0x04 // take into accont while recording
+#define SFX_CALLMODE_API 0x08 // API call (silent)
+#define SFX_CALLMODE_MODAL 0x10 // despite ModalMode
+
+#define SFX_CALLMODE_STANDARD SFX_CALLMODE_RECORD
+typedef sal_uInt16 SfxCallMode;
+
+enum SfxPopupAction
+{
+ SFX_POPUP_DELETE,
+ SFX_POPUP_HIDE,
+ SFX_POPUP_SHOW
+};
+
+//====================================================================
+class SFX2_DLLPUBLIC SfxBindings: public SfxBroadcaster
+
+/* [Description]
+
+ In each SFx application one instance of the SfxBindings-Class will
+ exists from <SfxApplication::Init()> until <SfxApplication::Exit()>.
+ This instance is automatically created and destroyed by SfxApplication.
+ However these instances will be handled by the Macro <SFX_BINDINGS>
+ or the associated <SfxViewFrame>.
+
+ The SfxBindings manages all of its Slot-Ids bound by the registerd
+ controllers and keeps a cache of the <Slot-Server> respectively.
+ (it is what we call the combination of SfxShell instance and SfxSlot).
+ In the SfxBindings it is stored, if and in this case which controllers
+ that are dirty and which Slot-Server-Caches are dirty respectively.
+ It summarizes status queries (calls to the status methods specified
+ in the IDL) that are served by the same state methods, and handles
+ the simulation of <Pseudo-Slots>.
+*/
+
+{
+friend class SfxApplication;
+friend class SfxShell;
+friend class SfxBindings_Impl;
+
+ SfxBindings_Impl*pImp; // Data of the Bindings instance
+ SfxDispatcher* pDispatcher; // Dispatcher, to be used
+ sal_uInt16 nRegLevel; // Lock-Level while Reconfig
+
+private:
+ SAL_DLLPRIVATE const SfxPoolItem* Execute_Impl( sal_uInt16 nSlot, const SfxPoolItem **pArgs, sal_uInt16 nModi,
+ SfxCallMode nCall, const SfxPoolItem **pInternalArgs, sal_Bool bGlobalOnly=sal_False);
+ SAL_DLLPRIVATE void SetSubBindings_Impl( SfxBindings* );
+ SAL_DLLPRIVATE void UpdateSlotServer_Impl(); // Update SlotServer
+ SAL_DLLPRIVATE SfxItemSet* CreateSet_Impl( SfxStateCache* &pCache,
+ const SfxSlot* &pRealSlot,
+ const SfxSlotServer**,
+ SfxFoundCacheArr_Impl& );
+ SAL_DLLPRIVATE sal_uInt16 GetSlotPos( sal_uInt16 nId, sal_uInt16 nStartSearchAt = 0 );
+ SAL_DLLPRIVATE void Update_Impl( SfxStateCache* pCache );
+ SAL_DLLPRIVATE void UpdateControllers_Impl(
+ const SfxInterface* pIF,
+ const SfxFoundCache_Impl* pFound,
+ const SfxPoolItem *pItem,
+ SfxItemState eItemState );
+ SAL_DLLPRIVATE SfxStateCache* GetStateCache( sal_uInt16 nId, sal_uInt16 *pPos);
+ DECL_DLLPRIVATE_LINK( NextJob_Impl, Timer * );
+
+public:
+ SfxBindings();
+ ~SfxBindings();
+
+ void HidePopups( bool bHide = true );
+ SAL_DLLPRIVATE void HidePopupCtrls_Impl( bool bHide = true );
+
+ void SetDispatcher(SfxDispatcher *pDisp);
+
+ void Update( sal_uInt16 nId ); // For example, from Menu::Activate
+ void Update();
+ SAL_DLLPRIVATE void StartUpdate_Impl(sal_Bool bComplete=sal_False);
+ void Invalidate( sal_uInt16 nId );
+ void Invalidate( const sal_uInt16* pIds );
+ void InvalidateShell( const SfxShell &rSh, sal_Bool bDeep = sal_False );
+ void InvalidateAll( sal_Bool bWithMsg );
+ void SetState( const SfxItemSet &rSet );
+ void SetState( const SfxPoolItem &rItem );
+ void Invalidate( sal_uInt16 nId, sal_Bool bWithItem, sal_Bool bWithMsg=sal_False);
+ void Invalidate( sal_uInt16 nId, sal_Bool bWithMsg);
+ sal_Bool IsInUpdate() const;
+ void SetVisibleState( sal_uInt16 nId, sal_Bool bShow );
+
+ sal_Bool IsBound( sal_uInt16 nMsgId, sal_uInt16 nStartSearchAt = 0 );
+
+ const SfxSlot* GetSlot( sal_uInt16 nMsgId );
+ SfxStateCache* GetStateCache( sal_uInt16 nId);
+ SAL_DLLPRIVATE SfxStateCache* GetAnyStateCache_Impl( sal_uInt16 nId );
+ /**
+ * @param rpState the caller has to delete the pointer
+ */
+ SfxItemState QueryState( sal_uInt16 nSID, SfxPoolItem* &rpState );
+
+ const SfxPoolItem* ExecuteSynchron( sal_uInt16 nSlot,
+ const SfxPoolItem **pArgs = 0,
+ sal_uInt16 nModi = 0,
+ const SfxPoolItem **pInternalArgs = 0);
+ sal_Bool Execute( sal_uInt16 nSlot,
+ const SfxPoolItem **pArgs = 0,
+ sal_uInt16 nModi = 0,
+ SfxCallMode nCall = SFX_CALLMODE_SLOT,
+ const SfxPoolItem **pInternalArgs = 0);
+
+ SAL_DLLPRIVATE void SetDispatchProvider_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > & rFrame );
+ SAL_DLLPRIVATE const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > & GetDispatchProvider_Impl() const;
+ void SetActiveFrame( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > & rFrame );
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > GetActiveFrame() const;
+ // Reconfig
+ int IsInRegistrations() const;
+ sal_uInt16 EnterRegistrations(const char *pFile = 0, int nLine = 0);
+ void LeaveRegistrations( sal_uInt16 nLevel = USHRT_MAX, const char *pFile = 0, int nLine = 0 );
+ void Register( SfxControllerItem& rBinding );
+ void Release( SfxControllerItem& rBinding );
+ SystemWindow* GetSystemWindow() const;
+ SfxDispatcher* GetDispatcher() const
+ { return pDispatcher; }
+ com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > GetRecorder() const;
+ com::sun::star::uno::Reference < com::sun::star::frame::XDispatch >
+ GetDispatch( const SfxSlot*, const com::sun::star::util::URL& aURL, sal_Bool bMasterCommand );
+ SAL_DLLPRIVATE void ContextChanged_Impl();
+ SAL_DLLPRIVATE void Execute_Impl( SfxRequest& rReq, const SfxSlot* pSlot, SfxShell* pShell );
+ SAL_DLLPRIVATE void DeleteControllers_Impl();
+ SAL_DLLPRIVATE SfxDispatcher* GetDispatcher_Impl() { return pDispatcher; }
+ SAL_DLLPRIVATE void ClearCache_Impl( sal_uInt16 nSlotId );
+ SAL_DLLPRIVATE sal_Bool IsInUpdate_Impl() const{ return IsInUpdate(); }
+ SAL_DLLPRIVATE void RegisterInternal_Impl( SfxControllerItem& rBinding );
+ SAL_DLLPRIVATE void Register_Impl( SfxControllerItem& rBinding, sal_Bool );
+ SAL_DLLPRIVATE SfxWorkWindow* GetWorkWindow_Impl() const;
+ SAL_DLLPRIVATE void SetWorkWindow_Impl( SfxWorkWindow* );
+ SAL_DLLPRIVATE SfxBindings* GetSubBindings_Impl( sal_Bool bTop = sal_False ) const;
+ SAL_DLLPRIVATE void InvalidateUnoControllers_Impl();
+ SAL_DLLPRIVATE void RegisterUnoController_Impl( SfxUnoControllerItem* );
+ SAL_DLLPRIVATE void ReleaseUnoController_Impl( SfxUnoControllerItem* );
+ SAL_DLLPRIVATE sal_Bool ExecuteCommand_Impl( const String& rCommand );
+ SAL_DLLPRIVATE void SetRecorder_Impl( com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder >& );
+ SAL_DLLPRIVATE void InvalidateSlotsInMap_Impl();
+ SAL_DLLPRIVATE void AddSlotToInvalidateSlotsMap_Impl( sal_uInt16 nId );
+};
+
+#ifdef DBG_UTIL
+#define ENTERREGISTRATIONS() EnterRegistrations(__FILE__, __LINE__)
+#define LEAVEREGISTRATIONS() LeaveRegistrations(USHRT_MAX, __FILE__, __LINE__)
+#define DENTERREGISTRATIONS() \
+ EnterRegistrations( OStringBuffer(__FILE__).append('(').append(reinterpret_cast<sal_Int64>(this)).append(')').getStr(), __LINE__ )
+#define DLEAVEREGISTRATIONS( ) \
+ LeaveRegistrations( USHRT_MAX, OStringBuffer(__FILE__).append('(').append(reinterpret_cast<sal_Int64>(this)).append(')').getStr(), __LINE__ )
+#else
+#define ENTERREGISTRATIONS() EnterRegistrations()
+#define LEAVEREGISTRATIONS() LeaveRegistrations()
+#define DENTERREGISTRATIONS() EnterRegistrations()
+#define DLEAVEREGISTRATIONS() LeaveRegistrations()
+#endif
+
+//--------------------------------------------------------------------
+
+inline int SfxBindings::IsInRegistrations() const
+
+/* [Description]
+
+ Determines whether the <SfxContollerItems> SfxBindings instance is
+ registerd or unregisted, i.e. <SfxBindings::EnterRegistrations()>
+ calls that have not been closed by <SfxBindings::LeaveRegistrations()>.
+
+ [Return value]
+
+ int sal_True
+ The SfxBindings instance is currently in
+ Registration-Mode. No status updates .
+
+ int sal_False
+ The SfxBindings instance is the normal mode.
+ Status updates can be done.
+*/
+
+{
+ return 0 != nRegLevel;
+}
+
+//--------------------------------------------------------------------
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/brokenpackageint.hxx b/include/sfx2/brokenpackageint.hxx
new file mode 100644
index 000000000000..85cd33402f3c
--- /dev/null
+++ b/include/sfx2/brokenpackageint.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include <com/sun/star/document/BrokenPackageRequest.hpp>
+#include <com/sun/star/task/XInteractionApprove.hpp>
+#include <com/sun/star/task/XInteractionDisapprove.hpp>
+
+class RequestPackageReparation_Impl;
+class SFX2_DLLPUBLIC RequestPackageReparation
+{
+ RequestPackageReparation_Impl* pImp;
+public:
+ RequestPackageReparation( OUString aName );
+ ~RequestPackageReparation();
+ sal_Bool isApproved();
+ com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest > GetRequest();
+};
+
+class NotifyBrokenPackage_Impl;
+class SFX2_DLLPUBLIC NotifyBrokenPackage
+{
+ NotifyBrokenPackage_Impl* pImp;
+public:
+ NotifyBrokenPackage( OUString aName );
+ ~NotifyBrokenPackage();
+ sal_Bool isAborted();
+ com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest > GetRequest();
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/chalign.hxx b/include/sfx2/chalign.hxx
new file mode 100644
index 000000000000..f8bf451e2b22
--- /dev/null
+++ b/include/sfx2/chalign.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX_CHILDALIGN_HXX
+#define _SFX_CHILDALIGN_HXX
+
+#include <tools/solar.h>
+
+// New order: first, navigation bar, then vertically docked child windows
+// (Explorer!), then horizontally docked child windows (Browser!),
+// then the format bar, status bar, and at the end of the toolbar.
+
+enum SfxChildAlignment
+{
+ SFX_ALIGN_HIGHESTTOP, // for example Navigation bar
+ SFX_ALIGN_LOWESTBOTTOM,
+ SFX_ALIGN_FIRSTLEFT,
+ SFX_ALIGN_LASTRIGHT,
+ SFX_ALIGN_LEFT, // for example SplitWindow
+ SFX_ALIGN_RIGHT,
+ SFX_ALIGN_LASTLEFT,
+ SFX_ALIGN_FIRSTRIGHT,
+ SFX_ALIGN_TOP, // for example Hyperlink-Builder, SplitWindow
+ SFX_ALIGN_BOTTOM, // for example SplitWindow
+ SFX_ALIGN_TOOLBOXTOP, // for example Objekt bar
+ SFX_ALIGN_TOOLBOXBOTTOM,
+ SFX_ALIGN_LOWESTTOP, // for example Calc bar
+ SFX_ALIGN_HIGHESTBOTTOM, // for example Status bar
+ SFX_ALIGN_TOOLBOXLEFT, // for example Tool bar
+ SFX_ALIGN_TOOLBOXRIGHT,
+ SFX_ALIGN_NOALIGNMENT // all FloatingWindows
+};
+
+// Verifies that a valid alignment is used
+inline sal_Bool SfxChildAlignValid( SfxChildAlignment eAlign )
+{
+ return ( eAlign >= SFX_ALIGN_HIGHESTTOP && eAlign <= SFX_ALIGN_NOALIGNMENT );
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/checkin.hxx b/include/sfx2/checkin.hxx
new file mode 100644
index 000000000000..9a9c20f485d7
--- /dev/null
+++ b/include/sfx2/checkin.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef _SFX_CHECKIN_HXX
+#define _SFX_CHECKIN_HXX
+
+#include <vcl/button.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/edit.hxx>
+
+class SfxCheckinDialog : public ModalDialog
+{
+ private:
+ Edit* m_pCommentED;
+ CheckBox* m_pMajorCB;
+
+ OKButton* m_pOKBtn;
+
+ DECL_DLLPRIVATE_LINK(OKHdl, void *);
+
+ public:
+ SfxCheckinDialog( Window* pParent );
+
+ OUString GetComment( );
+ bool IsMajor( );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/childwin.hxx b/include/sfx2/childwin.hxx
new file mode 100644
index 000000000000..d0c5e50fce1f
--- /dev/null
+++ b/include/sfx2/childwin.hxx
@@ -0,0 +1,370 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX_CHILDWIN_HXX
+#define _SFX_CHILDWIN_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include "sal/types.h"
+#include <vcl/window.hxx>
+#include <com/sun/star/frame/XFrame.hpp>
+
+#include <sfx2/shell.hxx>
+#include <sfx2/chalign.hxx>
+#include <boost/ptr_container/ptr_vector.hpp>
+
+class SfxWorkWindow;
+class SfxModule;
+class SfxBindings;
+class SfxShell;
+class SfxChildWindow;
+class SfxChildWindowContext;
+
+#define SFX_CHILDWIN_ZOOMIN 0x01 // Fully retracted Float
+#define SFX_CHILDWIN_SMALL 0x02 // Half retracted Float
+#define SFX_CHILDWIN_FORCEDOCK 0x04 // Float forbidden
+#define SFX_CHILDWIN_AUTOHIDE 0x08 // DockingWindow in AutoHide mode
+#define SFX_CHILDWIN_TASK 0x10 // ChildWindow inside the Task
+#define SFX_CHILDWIN_CANTGETFOCUS 0x20 // ChildWindow can not get focus
+#define SFX_CHILDWIN_ALWAYSAVAILABLE 0x40 // ChildWindow is never disabled
+#define SFX_CHILDWIN_NEVERHIDE 0x80 // ChildWindow is can always made
+ // visible/is visible
+#define CHILDWIN_NOPOS USHRT_MAX
+
+// ChildWindow Configuration
+struct SfxChildWinInfo
+{
+ sal_Bool bVisible;
+ Point aPos;
+ Size aSize;
+ sal_uInt16 nFlags;
+ String aExtraString;
+ OString aWinState;
+
+ SfxChildWinInfo()
+ {
+ bVisible = sal_False;
+ nFlags = 0;
+ }
+ sal_Bool GetExtraData_Impl( SfxChildAlignment *pAlign,
+ SfxChildAlignment *pLastAlign = 0,
+ Size *pSize = 0,
+ sal_uInt16 *pLine = 0,
+ sal_uInt16 *pPos = 0 ) const;
+};
+
+// ChildWindow factory methods
+typedef SfxChildWindow* (*SfxChildWinCtor)( ::Window *pParentWindow,
+ sal_uInt16 nId,
+ SfxBindings *pBindings,
+ SfxChildWinInfo *pInfo);
+
+// ChildWindowsContexts factory methods
+typedef SfxChildWindowContext* (*SfxChildWinContextCtor)( ::Window *pParentWindow,
+ SfxBindings *pBindings,
+ SfxChildWinInfo *pInfo);
+struct SfxChildWinContextFactory
+{
+ SfxChildWinContextCtor pCtor; // Factory method
+ sal_uInt16 nContextId; // Idenifier for SfxInterface
+ SfxChildWinInfo aInfo; // Configuration
+
+ SfxChildWinContextFactory( SfxChildWinContextCtor pTheCtor, sal_uInt16 nID )
+ : pCtor(pTheCtor)
+ , nContextId(nID)
+ {}
+};
+
+typedef boost::ptr_vector<SfxChildWinContextFactory> SfxChildWinContextArr_Impl;
+
+struct SfxChildWinFactory
+{
+ SfxChildWinCtor pCtor; // Factory method
+ sal_uInt16 nId; // ChildWindow-Id ( SlotId )
+ SfxChildWinInfo aInfo; // Configuration
+ sal_uInt16 nPos; // Position in UI
+ SfxChildWinContextArr_Impl *pArr; // Array for Contexts
+
+ SfxChildWinFactory( SfxChildWinCtor pTheCtor, sal_uInt16 nID,
+ sal_uInt16 n )
+ : pCtor(pTheCtor)
+ , nId( nID )
+ , nPos(n)
+ , pArr( NULL )
+ {}
+
+ ~SfxChildWinFactory()
+ {
+ delete pArr;
+ }
+
+};
+
+class FloatingWindow;
+struct SfxChildWindow_Impl;
+class SFX2_DLLPUBLIC SfxChildWindowContext
+{
+friend class SfxChildWindow;
+ ::Window* pWindow;
+ sal_uInt16 nContextId;
+
+protected:
+ SfxChildWindowContext( sal_uInt16 nId );
+
+public:
+ virtual ~SfxChildWindowContext();
+
+ void SetWindow( ::Window* pWin )
+ { pWindow=pWin; }
+ ::Window* GetWindow() const
+ { return pWindow; }
+ sal_uInt16 GetContextId() const
+ { return nContextId; }
+
+ FloatingWindow* GetFloatingWindow() const;
+
+ virtual void Resizing( Size& rSize );
+ virtual sal_Bool Close();
+ static void RegisterChildWindowContext(SfxModule*, sal_uInt16, SfxChildWinContextFactory*);
+};
+
+class SFX2_DLLPUBLIC SfxChildWindow
+{
+ ::Window* pParent; // parent window ( Topwindow )
+ sal_uInt16 nType; // ChildWindow-Id
+
+protected:
+ SfxChildAlignment eChildAlignment; // Current ::com::sun::star::drawing::Alignment
+ ::Window* pWindow; // actual contents
+ SfxChildWindow_Impl* pImp; // Implementation data
+
+private:
+ SfxChildWindowContext* pContext; // With context-sensitive ChildWindows:
+ // Annother window in pWindow
+ SAL_DLLPRIVATE SfxChildWindowContext*
+ GetContext() const
+ { return pContext; }
+
+protected:
+ SfxChildWindow(::Window *pParentWindow, sal_uInt16 nId);
+
+public:
+ virtual ~SfxChildWindow();
+ void Destroy();
+ ::Window* GetWindow() const
+ { return pWindow; }
+ ::Window* GetParent() const
+ { return pParent; }
+ SfxChildAlignment GetAlignment() const
+ { return eChildAlignment; }
+ void SetAlignment(SfxChildAlignment eAlign);
+ Size GetSizePixel() const
+ { return pWindow->GetSizePixel(); }
+ void SetPosSizePixel(const Point& rPoint, const Size& rSize)
+ { pWindow->SetPosSizePixel(rPoint, rSize); }
+ Point GetPosPixel()
+ { return pWindow->GetPosPixel(); }
+ virtual void Hide();
+ virtual void Show( sal_uInt16 nFlags );
+ sal_uInt16 GetFlags() const
+ { return GetInfo().nFlags; }
+ sal_Bool CanGetFocus() const;
+ sal_uInt16 GetPosition();
+ sal_uInt16 GetType()
+ { return nType; }
+
+ void CreateContext( sal_uInt16 nContextId, SfxBindings& );
+ sal_uInt16 GetContextId() const
+ { return pContext ? pContext->GetContextId(): 0; }
+
+ ::Window* GetContextWindow() const
+ { return pContext ? pContext->GetWindow(): 0; }
+
+ ::Window* GetContextWindow( SfxModule *pModule ) const;
+
+ virtual SfxChildWinInfo GetInfo() const;
+ void SaveStatus(const SfxChildWinInfo& rInfo);
+
+ static void RegisterChildWindow(SfxModule*, SfxChildWinFactory*);
+
+ static SfxChildWindow* CreateChildWindow( sal_uInt16, ::Window*, SfxBindings*, SfxChildWinInfo&);
+ void SetHideNotDelete( sal_Bool bOn );
+ sal_Bool IsHideNotDelete() const;
+ sal_Bool IsHideAtToggle() const;
+ sal_Bool IsVisible() const;
+ void SetWantsFocus( sal_Bool );
+ sal_Bool WantsFocus() const;
+
+ virtual sal_Bool QueryClose();
+ virtual com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > GetFrame();
+ void SetFrame( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > & );
+
+ SAL_DLLPRIVATE static void InitializeChildWinFactory_Impl(sal_uInt16, SfxChildWinInfo&);
+ SAL_DLLPRIVATE void SetVisible_Impl( sal_Bool bVis );
+ SAL_DLLPRIVATE void SetWorkWindow_Impl( SfxWorkWindow* );
+ SAL_DLLPRIVATE void Activate_Impl();
+ SAL_DLLPRIVATE void Deactivate_Impl();
+
+ SAL_DLLPRIVATE SfxChildWindowContext*
+ GetContext_Impl() const
+ { return pContext; }
+ SAL_DLLPRIVATE void SetFactory_Impl( SfxChildWinFactory* );
+};
+
+//------------------------------------------------------------------
+//! soon obsolete !
+#define SFX_DECL_CHILDWINDOW_CONTEXT(Class) \
+ static SfxChildWindowContext* CreateImpl(::Window *pParent, \
+ SfxBindings *pBindings, SfxChildWinInfo* pInfo ); \
+ static void RegisterChildWindowContext(SfxModule *pMod=0); \
+
+//! The Macro of the future ...
+#define SFX_DECL_CHILDWINDOWCONTEXT(Class) \
+ static SfxChildWindowContext* CreateImpl(::Window *pParent, \
+ SfxBindings *pBindings, SfxChildWinInfo* pInfo ); \
+ static void RegisterChildWindowContext(sal_uInt16, SfxModule *pMod=0); \
+
+//! soon obsolete !
+#define SFX_IMPL_CHILDWINDOW_CONTEXT(Class, MyID, ShellClass) \
+ SfxChildWindowContext* Class::CreateImpl( ::Window *pParent, \
+ SfxBindings *pBindings, SfxChildWinInfo* pInfo ) \
+ { \
+ SfxChildWindowContext *pContext = new Class(pParent, \
+ /* cast is safe here! */static_cast< sal_uInt16 >(ShellClass::GetInterfaceId()), \
+ pBindings,pInfo); \
+ return pContext; \
+ } \
+ void Class::RegisterChildWindowContext(SfxModule* pMod) \
+ { \
+ SfxChildWinContextFactory *pFact = new SfxChildWinContextFactory( \
+ Class::CreateImpl, \
+ /* cast is safe here! */static_cast< sal_uInt16 >(ShellClass::GetInterfaceId()) ); \
+ SfxChildWindowContext::RegisterChildWindowContext(pMod, MyID, pFact); \
+ }
+
+//! The Macro of the future ...
+// As a parameter and because of ContextId, CreateImpl must be handed the
+// factory. As long as Id is set to 0 and patched in
+// SfxChildWindow::CreateContext
+#define SFX_IMPL_CHILDWINDOWCONTEXT(Class, MyID) \
+ SfxChildWindowContext* Class::CreateImpl( ::Window *pParent, \
+ SfxBindings *pBindings, SfxChildWinInfo* pInfo ) \
+ { \
+ SfxChildWindowContext *pContext = new Class(pParent,0,pBindings,pInfo);\
+ return pContext; \
+ } \
+ void Class::RegisterChildWindowContext(sal_uInt16 nId, SfxModule* pMod) \
+ { \
+ SfxChildWinContextFactory *pFact = new SfxChildWinContextFactory( \
+ Class::CreateImpl, nId ); \
+ SfxChildWindowContext::RegisterChildWindowContext(pMod, MyID, pFact); \
+ }
+
+#define SFX_DECL_CHILDWINDOW(Class) \
+ public : \
+ static SfxChildWindow* CreateImpl(::Window *pParent, sal_uInt16 nId, \
+ SfxBindings *pBindings, SfxChildWinInfo* pInfo ); \
+ static void RegisterChildWindow (sal_Bool bVisible=sal_False, SfxModule *pMod=NULL, sal_uInt16 nFlags=0); \
+ virtual SfxChildWinInfo GetInfo() const
+
+#define SFX_DECL_CHILDWINDOW_WITHID(Class) \
+ SFX_DECL_CHILDWINDOW(Class); \
+ static sal_uInt16 GetChildWindowId ()\
+
+#define SFX_IMPL_CHILDWINDOW(Class, MyID) \
+ SFX_IMPL_POS_CHILDWINDOW(Class, MyID, CHILDWIN_NOPOS)
+
+#define SFX_IMPL_CHILDWINDOW_WITHID(Class, MyID) \
+ SFX_IMPL_POS_CHILDWINDOW_WITHID(Class, MyID, CHILDWIN_NOPOS)
+
+#define SFX_IMPL_POS_CHILDWINDOW(Class, MyID, Pos) \
+ SfxChildWindow* Class::CreateImpl( ::Window *pParent, \
+ sal_uInt16 nId, SfxBindings *pBindings, SfxChildWinInfo* pInfo ) \
+ { \
+ SfxChildWindow *pWin = new Class(pParent, nId, pBindings, pInfo);\
+ return pWin; \
+ } \
+ void Class::RegisterChildWindow (sal_Bool bVis, SfxModule *pMod, sal_uInt16 nFlags) \
+ { \
+ SfxChildWinFactory *pFact = new SfxChildWinFactory( \
+ Class::CreateImpl, MyID, Pos ); \
+ pFact->aInfo.nFlags |= nFlags; \
+ pFact->aInfo.bVisible = bVis; \
+ SfxChildWindow::RegisterChildWindow(pMod, pFact); \
+ }
+
+#define SFX_IMPL_POS_CHILDWINDOW_WITHID(Class, MyID, Pos) \
+ SFX_IMPL_POS_CHILDWINDOW(Class, MyID, Pos) \
+ sal_uInt16 Class::GetChildWindowId () \
+ { return MyID; } \
+
+#define SFX_IMPL_FLOATINGWINDOW(Class, MyID) \
+ SFX_IMPL_CHILDWINDOW(Class, MyID) \
+ SfxChildWinInfo Class::GetInfo() const \
+ { \
+ SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \
+ ((SfxFloatingWindow*)GetWindow())->FillInfo( aInfo ); \
+ return aInfo; }
+
+#define SFX_IMPL_FLOATINGWINDOW_WITHID(Class, MyID) \
+ SFX_IMPL_CHILDWINDOW_WITHID(Class, MyID) \
+ SfxChildWinInfo Class::GetInfo() const \
+ { \
+ SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \
+ ((SfxFloatingWindow*)GetWindow())->FillInfo( aInfo ); \
+ return aInfo; }
+
+#define SFX_IMPL_MODELESSDIALOG_WITHID(Class, MyID) \
+ SFX_IMPL_CHILDWINDOW_WITHID(Class, MyID) \
+ SfxChildWinInfo Class::GetInfo() const \
+ { \
+ SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \
+ ((SfxModelessDialog*)GetWindow())->FillInfo( aInfo ); \
+ return aInfo; }
+
+
+#define SFX_IMPL_DOCKINGWINDOW(Class, MyID) \
+ SFX_IMPL_CHILDWINDOW(Class, MyID) \
+ SfxChildWinInfo Class::GetInfo() const \
+ { \
+ SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \
+ ((SfxDockingWindow*)GetWindow())->FillInfo( aInfo ); \
+ return aInfo; }
+
+#define SFX_IMPL_DOCKINGWINDOW_WITHID(Class, MyID) \
+ SFX_IMPL_CHILDWINDOW_WITHID(Class, MyID) \
+ SfxChildWinInfo Class::GetInfo() const \
+ { \
+ SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \
+ ((SfxDockingWindow*)GetWindow())->FillInfo( aInfo ); \
+ return aInfo; }
+
+#define SFX_IMPL_TOOLBOX(Class, MyID) \
+ SFX_IMPL_CHILDWINDOW(Class, MyID) \
+ SfxChildWinInfo Class::GetInfo() const \
+ { \
+ SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \
+ ((SfxToolbox*)GetWindow())->FillInfo( aInfo ); \
+ return aInfo; }
+
+//------------------------------------------------------------------
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/cntids.hrc b/include/sfx2/cntids.hrc
new file mode 100644
index 000000000000..db4c5877afd6
--- /dev/null
+++ b/include/sfx2/cntids.hrc
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CNTIDS_HRC
+#define _CNTIDS_HRC
+
+#include <svl/cntwids.hrc>
+#include <svl/solar.hrc>
+
+// Slot-ID's -----------------------------------------------------------------
+
+#ifndef SID_SFX_START
+// HACK() - SID's may not change its numerical value just like that,
+// sfxsids.hrc may not be included!!! Solution: sfxsids.hrc
+// include it on a lower level - for example svtools???
+#define SID_SFX_START 5000
+#endif
+#define SID_TITLE (SID_SFX_START + 307)
+#define SID_DELETE (SID_SFX_START + 713)
+#define SID_INTERNET_ONLINE (SID_SFX_START + 1370)
+
+// Don't let SID_CHAOS_END grow. Internal docking windows use the range between
+// SID_CHAOS_END and SID_LIB_START!! Look into sfxsids.hrc for more information!
+#define SID_CHAOS_START 9000
+#define SID_CHAOS_END 9799
+
+#define SID_DISTRIBUTION (SID_CHAOS_START + 26)
+#define SID_INSERT (SID_CHAOS_START + 90)
+#define SID_VIEW_FLD_PIC (SID_CHAOS_START + 185)
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/controlwrapper.hxx b/include/sfx2/controlwrapper.hxx
new file mode 100644
index 000000000000..0a429b906638
--- /dev/null
+++ b/include/sfx2/controlwrapper.hxx
@@ -0,0 +1,644 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SFX_CONTROLWRAPPER_HXX
+#define SFX_CONTROLWRAPPER_HXX
+
+#include <tools/debug.hxx>
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+
+#include <memory>
+
+#include <vcl/button.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/field.hxx>
+#include <vcl/lstbox.hxx>
+#include <svtools/valueset.hxx>
+#include <svtools/ctrlbox.hxx>
+
+// ============================================================================
+
+namespace sfx {
+
+// ============================================================================
+
+/** List position type of VCL ListBox. */
+typedef sal_uInt16 ListBoxPosType;
+/** List position type of SVTOOLS ValueSet. */
+typedef sal_uInt16 ValueSetPosType;
+
+// ============================================================================
+// Helpers
+// ============================================================================
+
+/** A helper class for mapping list positions from/to represented values.
+
+ Deriving from this helper class adds the two functions GetValueFromPos()
+ and GetPosFromValue(). The constructor receives an array of MapEntryType
+ structures that represents the table of positions and values. It is
+ possible to pass a null pointer, this results in a direct mapping between
+ list positions and values. If the map exists, it MUST be terminated with an
+ entry containing the special "not found" list position passed to the
+ constructor. The value contained in this last entry is used as default
+ value in case of an error.
+ */
+template< typename PosT, typename ValueT >
+class PosValueMapper
+{
+public:
+ typedef PosT PosType;
+ typedef ValueT ValueType;
+ typedef PosValueMapper< PosT, ValueT > MapperType;
+
+ /** A helper struct that contains a list position - value pair. */
+ struct MapEntryType
+ {
+ PosT mnPos; /// Position in the list.
+ ValueT mnValue; /// Corresponding value.
+ };
+
+ /** Constructs the map helper with the passed map.
+ @param nNFPos This list position is used to represent the
+ "not found" or "not existing" state.
+ @param pMap The map of list positions/values. If 0, a direct mapping
+ is used (simply casting between list position and values). If the map
+ exists, it *MUST* be terminated by an entry containing the special
+ "not found" list position. */
+ inline explicit PosValueMapper( PosT nNFPos, const MapEntryType* pMap = 0 ) :
+ mpMap( pMap ), mnNFPos( nNFPos ) {}
+
+ /** Returns the value at the specified list position.
+ @return The found value, or the value of the last map entry on error. */
+ ValueT GetValueFromPos( PosT nPos ) const;
+ /** Returns the list position of the specified value.
+ @return The position, or the special "not found" position on error. */
+ PosT GetPosFromValue( ValueT nValue ) const;
+
+ /** Returns the special "not found" list position. */
+ inline PosT GetNotFoundPos() const { return mnNFPos; }
+
+private:
+ const MapEntryType* mpMap; /// The list position/value map.
+ PosT mnNFPos; /// Special "not found" list position.
+};
+
+// ============================================================================
+// Base control wrapper classes
+// ============================================================================
+
+/** Base class for all control wrappers.
+
+ Control wrappers are used to have an equal interface for various functions
+ used in connections for different types of controls.
+
+ The current tree of base classes/templates and standard control wrappers:
+
+ ControlWrapperBase
+ |
+ +- SingleControlWrapper< ControlT, ValueT >
+ | |
+ | +- DummyWindowWrapper [1]
+ | +- CheckBoxWrapper [1]
+ | +- EditWrapper [1]
+ | +- ColorListBoxWrapper [1]
+ | |
+ | +- NumericFieldWrapper< ValueT > [1]
+ | | |
+ | | +- [ValueType]NumericFieldWrapper [1] [2]
+ | |
+ | +- MetricFieldWrapper< ValueT > [1]
+ | | |
+ | | +- [ValueType]MetricFieldWrapper [1] [2]
+ | |
+ | +- ListBoxWrapper< ValueT > [1]
+ | | |
+ | | +- [ValueType]ListBoxWrapper [1] [2]
+ | |
+ | +- ValueSetWrapper< ValueT > [1]
+ | |
+ | +- [ValueType]ValueSetWrapper [1] [2]
+ |
+ +- MultiControlWrapperHelper
+ |
+ +- MultiControlWrapper< ValueT >
+
+ Notes:
+ [1] Standard wrappers ready to use.
+ [2] [ValueType] is one of Int16, UInt16, Int32, UInt32, UShort, ULong.
+
+ See documentation of class ItemConnectionBase (itemconnect.hxx) for more
+ details.
+ */
+class SFX2_DLLPUBLIC ControlWrapperBase
+{
+public:
+ inline explicit ControlWrapperBase() {}
+ virtual ~ControlWrapperBase();
+
+ /** Derived classes enable, disable, show, or hide control(s).
+ @descr Will do nothing, if the corresponding parameter is STATE_DONTKNOW. */
+ virtual void ModifyControl( TriState eEnable, TriState eShow ) = 0;
+
+ /** Derived classes return true if the control is in "don't know" state. */
+ virtual bool IsControlDontKnow() const = 0;
+ /** Derived classes set the control to "don't know" state. */
+ virtual void SetControlDontKnow( bool bSet ) = 0;
+
+private:
+ /* Disable copy c'tor and assignment. */
+ ControlWrapperBase( const ControlWrapperBase& );
+ ControlWrapperBase& operator=( const ControlWrapperBase& );
+};
+
+// ============================================================================
+// Single control wrappers
+// ============================================================================
+
+/** Base class template for control wrappers containing one single control.
+
+ Classes created from this template store the reference to a single control
+ object. It is not required that the control is derived from VCL's Window
+ class. Derived classes have to implement the abstract functions
+ ShowControl(), EnableControl(), IsControlDontKnow(), SetControlDontKnow(),
+ GetControlValue(), and SetControlValue().
+
+ As already stated, it is not required for ControlT to be a VCL Window.
+ Anyway, ControlT must support the following functions:
+ - void ControlT::Enable( bool )
+ - void ControlT::Show( bool )
+ */
+template< typename ControlT, typename ValueT >
+class SingleControlWrapper : public ControlWrapperBase
+{
+public:
+ typedef ControlT ControlType;
+ typedef ValueT ControlValueType;
+ typedef SingleControlWrapper< ControlT, ValueT > SingleControlWrapperType;
+
+ inline explicit SingleControlWrapper( ControlT& rControl ) : mrControl( rControl ) {}
+
+ /** Returns a reference to the control this connection works on. */
+ inline const ControlT& GetControl() const { return mrControl; }
+ /** Returns a reference to the control this connection works on. */
+ inline ControlT& GetControl() { return mrControl; }
+
+ /** Enables, disables, shows, or hides the control.
+ @descr Does nothing, if the corresponding parameter is STATE_DONTKNOW. */
+ virtual void ModifyControl( TriState eEnable, TriState eShow );
+
+ /** Derived classes return the value the control contains. */
+ virtual ValueT GetControlValue() const = 0;
+ /** Derived classes set the contents of the control to the passed value. */
+ virtual void SetControlValue( ValueT aValue ) = 0;
+
+private:
+ ControlT& mrControl; /// The control of this wrapper.
+};
+
+// ============================================================================
+
+/** A dummy wrapper for a VCL Window that does nothing special.
+
+ This wrapper is used to implement the DummyItemConnection. It does not
+ connect an item to a control, but handles the special flags to disable or
+ hide a control, if an item is unknown.
+ */
+class SFX2_DLLPUBLIC DummyWindowWrapper:
+ public SingleControlWrapper< Window, void* >
+{
+public:
+ explicit DummyWindowWrapper( Window& rWindow );
+
+ virtual bool IsControlDontKnow() const;
+ virtual void SetControlDontKnow( bool );
+
+ virtual void* GetControlValue() const;
+ virtual void SetControlValue( void* );
+};
+
+// ----------------------------------------------------------------------------
+
+/** A wrapper for the VCL CheckBox. */
+class SFX2_DLLPUBLIC CheckBoxWrapper:
+ public SingleControlWrapper< CheckBox, sal_Bool >
+{
+public:
+ explicit CheckBoxWrapper( CheckBox& rCheckBox );
+
+ virtual bool IsControlDontKnow() const;
+ virtual void SetControlDontKnow( bool bSet );
+
+ virtual sal_Bool GetControlValue() const;
+ virtual void SetControlValue( sal_Bool bValue );
+};
+
+// ----------------------------------------------------------------------------
+
+/** A wrapper for the SVTOOLS ColorListBox. */
+class SFX2_DLLPUBLIC ColorListBoxWrapper:
+ public SingleControlWrapper< ColorListBox, Color >
+{
+ /* Note: cannot use 'const Color&' as template argument, because the
+ SVTOOLS ColorListBox returns the color by value and not by reference,
+ therefore GetControlValue() must return a temporary object too. */
+public:
+ explicit ColorListBoxWrapper(ColorListBox & rListBox);
+
+ virtual ~ColorListBoxWrapper();
+
+ virtual bool IsControlDontKnow() const;
+ virtual void SetControlDontKnow( bool bSet );
+
+ virtual Color GetControlValue() const;
+ virtual void SetControlValue( Color aColor );
+};
+
+// ============================================================================
+
+/** A wrapper for the VCL NumericField. */
+template< typename ValueT >
+class NumericFieldWrapper : public SingleControlWrapper< NumericField, ValueT >
+{
+public:
+ inline explicit NumericFieldWrapper( NumericField& rField ) :
+ SingleControlWrapper< NumericField, ValueT >( rField ) {}
+
+ virtual bool IsControlDontKnow() const;
+ virtual void SetControlDontKnow( bool bSet );
+
+ virtual ValueT GetControlValue() const;
+ virtual void SetControlValue( ValueT nValue );
+};
+
+// ----------------------------------------------------------------------------
+
+typedef NumericFieldWrapper< sal_Int16 > Int16NumericFieldWrapper;
+typedef NumericFieldWrapper< sal_uInt16 > UInt16NumericFieldWrapper;
+typedef NumericFieldWrapper< sal_Int32 > Int32NumericFieldWrapper;
+typedef NumericFieldWrapper< sal_uInt32 > UInt32NumericFieldWrapper;
+
+typedef NumericFieldWrapper< sal_uInt16 > UShortNumericFieldWrapper;
+typedef NumericFieldWrapper< sal_uIntPtr > ULongNumericFieldWrapper;
+
+// ============================================================================
+
+/** A wrapper for the VCL MetricField.
+
+ Adds support for field units during accessing the control value. The
+ wrapper respects the field unit set at the control itself and converts it
+ from/to the field unit passed to the constructor.
+ */
+template< typename ValueT >
+class MetricFieldWrapper : public SingleControlWrapper< MetricField, ValueT >
+{
+public:
+ inline explicit MetricFieldWrapper( MetricField& rField, FieldUnit eUnit = FUNIT_NONE ) :
+ SingleControlWrapper< MetricField, ValueT >( rField ), meUnit( eUnit ) {}
+
+ virtual bool IsControlDontKnow() const;
+ virtual void SetControlDontKnow( bool bSet );
+
+ virtual ValueT GetControlValue() const;
+ virtual void SetControlValue( ValueT nValue );
+
+private:
+ FieldUnit meUnit;
+};
+
+// ----------------------------------------------------------------------------
+
+typedef MetricFieldWrapper< sal_Int16 > Int16MetricFieldWrapper;
+typedef MetricFieldWrapper< sal_uInt16 > UInt16MetricFieldWrapper;
+typedef MetricFieldWrapper< sal_Int32 > Int32MetricFieldWrapper;
+typedef MetricFieldWrapper< sal_uInt32 > UInt32MetricFieldWrapper;
+
+typedef MetricFieldWrapper< sal_uInt16 > UShortMetricFieldWrapper;
+typedef MetricFieldWrapper< sal_uIntPtr > ULongMetricFieldWrapper;
+
+// ============================================================================
+
+/** A wrapper for the VCL ListBox.
+
+ If a position<->value map is passed to the constructor, it MUST be
+ terminated with an entry containing LISTBOX_ENTRY_NOTFOUND as list
+ position. See documentation of the PosValueMapper template for details.
+ */
+template< typename ValueT >
+class ListBoxWrapper :
+ public SingleControlWrapper< ListBox, ValueT >,
+ public PosValueMapper< ListBoxPosType, ValueT >
+{
+ typedef PosValueMapper< ListBoxPosType, ValueT > MapperType;
+
+public:
+ typedef typename MapperType::MapEntryType MapEntryType;
+
+ /** @param pMap Optional list position <-> value map.
+ See PosValueMapper documentation for details. */
+ inline explicit ListBoxWrapper( ListBox& rListBox, const MapEntryType* pMap = 0 ) :
+ SingleControlWrapper< ListBox, ValueT >( rListBox ), MapperType( LISTBOX_ENTRY_NOTFOUND, pMap ) {}
+
+ virtual bool IsControlDontKnow() const
+ { return this->GetControl().GetSelectEntryCount() == 0; }
+ virtual void SetControlDontKnow( bool bSet )
+ { if( bSet ) this->GetControl().SetNoSelection(); }
+
+ virtual ValueT GetControlValue() const;
+ virtual void SetControlValue( ValueT nValue );
+};
+
+// ----------------------------------------------------------------------------
+
+typedef ListBoxWrapper< sal_Int16 > Int16ListBoxWrapper;
+typedef ListBoxWrapper< sal_uInt16 > UInt16ListBoxWrapper;
+typedef ListBoxWrapper< sal_Int32 > Int32ListBoxWrapper;
+typedef ListBoxWrapper< sal_uInt32 > UInt32ListBoxWrapper;
+
+typedef ListBoxWrapper< sal_uInt16 > UShortListBoxWrapper;
+typedef ListBoxWrapper< sal_uIntPtr > ULongListBoxWrapper;
+
+// ============================================================================
+
+/** A wrapper for the SVTOOLS ValueSet.
+
+ If a position<->value map is passed to the constructor, it MUST be
+ terminated with an entry containing VALUESET_ITEM_NOTFOUND as list
+ position. See documentation of the PosValueMapper template for details.
+ */
+template< typename ValueT >
+class ValueSetWrapper :
+ public SingleControlWrapper< ValueSet, ValueT >,
+ public PosValueMapper< ValueSetPosType, ValueT >
+{
+ typedef PosValueMapper< ValueSetPosType, ValueT > MapperType;
+
+public:
+ typedef typename MapperType::MapEntryType MapEntryType;
+
+ /** @param pMap Optional position <-> value map.
+ See PosValueMapper documentation for details. */
+ inline explicit ValueSetWrapper( ValueSet& rValueSet, const MapEntryType* pMap = 0 ) :
+ SingleControlWrapper< ValueSet, ValueT >( rValueSet ), MapperType( VALUESET_ITEM_NOTFOUND, pMap ) {}
+
+ virtual bool IsControlDontKnow() const
+ { return this->GetControl().IsNoSelection(); }
+ virtual void SetControlDontKnow( bool bSet )
+ { if( bSet ) this->GetControl().SetNoSelection(); }
+
+ virtual ValueT GetControlValue() const;
+ virtual void SetControlValue( ValueT nValue );
+};
+
+// ----------------------------------------------------------------------------
+
+typedef ValueSetWrapper< sal_Int16 > Int16ValueSetWrapper;
+typedef ValueSetWrapper< sal_uInt16 > UInt16ValueSetWrapper;
+typedef ValueSetWrapper< sal_Int32 > Int32ValueSetWrapper;
+typedef ValueSetWrapper< sal_uInt32 > UInt32ValueSetWrapper;
+
+typedef ValueSetWrapper< sal_uInt16 > UShortValueSetWrapper;
+typedef ValueSetWrapper< sal_uIntPtr > ULongValueSetWrapper;
+
+// ============================================================================
+// Multi control wrappers
+// ============================================================================
+
+struct MultiControlWrapperHelper_Impl;
+
+/** A container of control wrappers.
+
+ Derived classes should define control wrapper members and register them in
+ their constructor, using the function RegisterControlWrapper().
+
+ This wrapper implements the abstract functions of the ControlWrapperBase
+ base class by calling the functions of all registered wrappers.
+ */
+class SFX2_DLLPUBLIC MultiControlWrapperHelper : public ControlWrapperBase
+{
+public:
+ explicit MultiControlWrapperHelper();
+ virtual ~MultiControlWrapperHelper();
+
+ /** Registers a control wrapper (should be a member of a derived class). */
+ void RegisterControlWrapper( ControlWrapperBase& rWrapper );
+
+ /** Enables, disables, shows, or hides the registered controls. */
+ virtual void ModifyControl( TriState eEnable, TriState eShow );
+
+ /** Returns true if all registered controls are in "don't know" state. */
+ virtual bool IsControlDontKnow() const;
+ /** Sets all registered controls to "don't know" state. */
+ virtual void SetControlDontKnow( bool bSet );
+
+private:
+ std::auto_ptr< MultiControlWrapperHelper_Impl > mxImpl;
+};
+
+// ----------------------------------------------------------------------------
+
+/** A multi control wrapper with extended interface.
+
+ This template class extends the MultiControlWrapperHelper class by the
+ functions GetControlValue() and SetControlValue(), known from the
+ SingleControlWrapper template. This makes it possible to use this template
+ in item connections expecting a single control wrapper. The type ValueT
+ should be able to contain the values of all controls handled in this
+ wrapper. In most cases, the easiest way to achieve this is to use the
+ related item type directly, using the IdentItemWrapper template
+ (itemwrapper.hxx).
+ */
+template< typename ValueT >
+class MultiControlWrapper : public MultiControlWrapperHelper
+{
+public:
+ typedef MultiControlWrapperHelper ControlType;
+ typedef ValueT ControlValueType;
+ typedef MultiControlWrapper< ValueT > MultiControlWrapperType;
+
+ MultiControlWrapper() : maDefValue( 0 ){}
+
+ /** Returns the default value that can be used in GetControlValue(). */
+ inline const ValueT& GetDefaultValue() const { return maDefValue; }
+ /** Sets a default value that can be used in GetControlValue(). */
+ inline void SetDefaultValue( const ValueT& rDefValue ) { maDefValue = rDefValue; }
+
+ /** Derived classes return the value the control contains. */
+ virtual ValueT GetControlValue() const = 0;
+ /** Derived classes set the contents of the control to the passed value. */
+ virtual void SetControlValue( ValueT aValue ) = 0;
+
+private:
+ ValueT maDefValue;
+};
+
+// ============================================================================
+
+
+// ============================================================================
+// *** Implementation of template functions ***
+// ============================================================================
+
+// ============================================================================
+// Helpers
+// ============================================================================
+
+template< typename PosT, typename ValueT >
+ValueT PosValueMapper< PosT, ValueT >::GetValueFromPos( PosT nPos ) const
+{
+ ValueT nValue;
+ if( mpMap )
+ {
+ const MapEntryType* pEntry = mpMap;
+ while( (pEntry->mnPos != nPos) && (pEntry->mnPos != mnNFPos) )
+ ++pEntry;
+ nValue = pEntry->mnValue;
+ }
+ else /* if( nPos != mnNFPos ) */
+ {
+ DBG_ASSERT( nPos != mnNFPos, "sfx2::PosValueMapper< PosT, ValueT >::GetValueFromPos(), previously uninitialized value found!" );
+ nValue = static_cast< ValueT >( nPos );
+ }
+
+ return nValue;
+}
+
+template< typename PosT, typename ValueT >
+PosT PosValueMapper< PosT, ValueT >::GetPosFromValue( ValueT nValue ) const
+{
+ PosT nPos = mnNFPos;
+ if( mpMap )
+ {
+ const MapEntryType* pEntry = mpMap;
+ while( (pEntry->mnValue != nValue) && (pEntry->mnPos != mnNFPos) )
+ ++pEntry;
+ nPos = pEntry->mnPos;
+ }
+ else if( nValue >= 0 )
+ nPos = static_cast< PosT >( nValue );
+ return nPos;
+}
+
+// ============================================================================
+// Single control wrappers
+// ============================================================================
+
+template< typename ControlT, typename ValueT >
+inline void SingleControlWrapper< ControlT, ValueT >::ModifyControl( TriState eEnable, TriState eShow )
+{
+ if( eEnable != STATE_DONTKNOW )
+ mrControl.Enable( eEnable == STATE_CHECK );
+ if( eShow != STATE_DONTKNOW )
+ mrControl.Show( eShow == STATE_CHECK );
+}
+
+// ============================================================================
+
+template< typename ValueT >
+bool NumericFieldWrapper< ValueT >::IsControlDontKnow() const
+{
+ return this->GetControl().GetText().Len() == 0;
+}
+
+template< typename ValueT >
+void NumericFieldWrapper< ValueT >::SetControlDontKnow( bool bSet )
+{
+ if( bSet )
+ this->GetControl().SetText( String() );
+}
+
+template< typename ValueT >
+ValueT NumericFieldWrapper< ValueT >::GetControlValue() const
+{
+ return static_cast< ValueT >( this->GetControl().Denormalize( this->GetControl().GetValue() ) );
+}
+
+template< typename ValueT >
+void NumericFieldWrapper< ValueT >::SetControlValue( ValueT nValue )
+{
+ this->GetControl().SetValue( this->GetControl().Normalize( static_cast< sal_Int64 >( nValue ) ) );
+}
+
+// ============================================================================
+
+template< typename ValueT >
+bool MetricFieldWrapper< ValueT >::IsControlDontKnow() const
+{
+ return this->GetControl().GetText().isEmpty();
+}
+
+template< typename ValueT >
+void MetricFieldWrapper< ValueT >::SetControlDontKnow( bool bSet )
+{
+ if( bSet )
+ this->GetControl().SetText( String() );
+}
+
+template< typename ValueT >
+ValueT MetricFieldWrapper< ValueT >::GetControlValue() const
+{
+ return static_cast< ValueT >( this->GetControl().Denormalize( this->GetControl().GetValue( meUnit ) ) );
+}
+
+template< typename ValueT >
+void MetricFieldWrapper< ValueT >::SetControlValue( ValueT nValue )
+{
+ this->GetControl().SetValue( this->GetControl().Normalize( static_cast< sal_Int64 >( nValue ) ), meUnit );
+}
+
+// ============================================================================
+
+template< typename ValueT >
+ValueT ListBoxWrapper< ValueT >::GetControlValue() const
+{
+ return this->GetValueFromPos( this->GetControl().GetSelectEntryPos() );
+}
+
+template< typename ValueT >
+void ListBoxWrapper< ValueT >::SetControlValue( ValueT nValue )
+{
+ sal_uInt16 nPos = this->GetPosFromValue( nValue );
+ if( nPos != this->GetNotFoundPos() )
+ this->GetControl().SelectEntryPos( nPos );
+}
+
+// ----------------------------------------------------------------------------
+
+template< typename ValueT >
+ValueT ValueSetWrapper< ValueT >::GetControlValue() const
+{
+ return this->GetValueFromPos( this->GetControl().GetSelectItemId() );
+}
+
+template< typename ValueT >
+void ValueSetWrapper< ValueT >::SetControlValue( ValueT nValue )
+{
+ sal_uInt16 nPos = this->GetPosFromValue( nValue );
+ if( nPos != this->GetNotFoundPos() )
+ this->GetControl().SelectItem( nPos );
+}
+
+// ============================================================================
+
+
+} // namespace sfx
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/ctrlitem.hxx b/include/sfx2/ctrlitem.hxx
new file mode 100644
index 000000000000..af6288e772e9
--- /dev/null
+++ b/include/sfx2/ctrlitem.hxx
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXCTRLITEM_HXX
+#define _SFXCTRLITEM_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include "sal/types.h"
+#include <svl/poolitem.hxx>
+
+class SfxPoolItem;
+class SfxBindings;
+class SvStream;
+
+class SFX2_DLLPUBLIC SfxControllerItem
+{
+private:
+ sal_uInt16 nId;
+ SfxControllerItem* pNext; // to notify next ControllerItem
+ SfxBindings* pBindings;
+
+protected:
+#if defined( DBG_UTIL )
+ SAL_DLLPRIVATE void CheckConfigure_Impl( sal_uIntPtr nType );
+#endif
+
+public:
+ SfxBindings & GetBindings() {
+ DBG_ASSERT(pBindings, "no Bindings");
+ return *pBindings;
+ }
+ const SfxBindings & GetBindings() const {
+ DBG_ASSERT(pBindings, "no Bindings");
+ return *pBindings;
+ }
+
+ SfxControllerItem(); // for arrays
+ SfxControllerItem( sal_uInt16 nId, SfxBindings & );
+ virtual ~SfxControllerItem();
+
+ void Bind( sal_uInt16 nNewId, SfxBindings * = 0); // Register in SfxBindings
+ void UnBind();
+ void ReBind();
+ sal_Bool IsBound() const;
+ void ClearCache();
+ void SetBindings(SfxBindings &rBindings) { pBindings = &rBindings; }
+
+ SfxControllerItem* GetItemLink();
+ SfxControllerItem* ChangeItemLink( SfxControllerItem* pNewLink );
+
+ void SetId( sal_uInt16 nItemId );
+ sal_uInt16 GetId() const { return nId; }
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+ virtual void DeleteFloatingWindow();
+
+ SfxMapUnit GetCoreMetric() const;
+
+ static SfxItemState GetItemState( const SfxPoolItem* pState );
+
+ SAL_DLLPRIVATE sal_Bool IsBindable_Impl() const
+ { return pBindings != NULL; }
+ SAL_DLLPRIVATE void BindInternal_Impl( sal_uInt16 nNewId, SfxBindings* );
+};
+
+//====================================================================
+
+class SFX2_DLLPUBLIC SfxStatusForwarder: public SfxControllerItem
+{
+ SfxControllerItem* pMaster;
+
+protected:
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+
+public:
+ SfxStatusForwarder( sal_uInt16 nSlotId,
+ SfxControllerItem&rMaster );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/dialogs.hrc b/include/sfx2/dialogs.hrc
new file mode 100644
index 000000000000..debf4e64c21c
--- /dev/null
+++ b/include/sfx2/dialogs.hrc
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX2_DIALOGS_HRC
+#define _SFX2_DIALOGS_HRC
+
+#include <sfx2/sfxsids.hrc>
+#include <sfx2/tabpage.hrc>
+
+#define RID_OFA_AUTOCORR_DLG (RID_OFA_START + 101)
+#define RID_SVXDLG_CUSTOMIZE (RID_SVX_START + 291)
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx
new file mode 100644
index 000000000000..c0758b56bc00
--- /dev/null
+++ b/include/sfx2/dinfdlg.hxx
@@ -0,0 +1,501 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX_DINFDLG_HXX
+#define _SFX_DINFDLG_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/util/Duration.hpp>
+
+#include <svl/stritem.hxx>
+#include <svl/zforlist.hxx>
+
+#include <svtools/headbar.hxx>
+#include <svtools/stdctrl.hxx>
+#include <svtools/svmedit.hxx>
+
+#include <unotools/syslocale.hxx>
+
+#include <vcl/edit.hxx>
+#include <vcl/field.hxx>
+#include <vcl/layout.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/scrbar.hxx>
+
+#include "tabdlg.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace document {
+ class XDocumentProperties;
+ }
+} } }
+
+struct CustomProperty;
+
+
+// class SfxDocumentInfoItem ---------------------------------------------
+
+class SFX2_DLLPUBLIC SfxDocumentInfoItem : public SfxStringItem
+{
+private:
+ sal_Int32 m_AutoloadDelay;
+ OUString m_AutoloadURL;
+ sal_Bool m_isAutoloadEnabled;
+ OUString m_DefaultTarget;
+ OUString m_TemplateName;
+ OUString m_Author;
+ ::com::sun::star::util::DateTime m_CreationDate;
+ OUString m_ModifiedBy;
+ ::com::sun::star::util::DateTime m_ModificationDate;
+ OUString m_PrintedBy;
+ ::com::sun::star::util::DateTime m_PrintDate;
+ sal_Int16 m_EditingCycles;
+ sal_Int32 m_EditingDuration;
+ OUString m_Description;
+ OUString m_Keywords;
+ OUString m_Subject;
+ OUString m_Title;
+ sal_Bool m_bHasTemplate;
+ sal_Bool m_bDeleteUserData;
+ sal_Bool m_bUseUserData;
+ std::vector< CustomProperty* > m_aCustomProperties;
+
+public:
+ TYPEINFO();
+ SfxDocumentInfoItem();
+ SfxDocumentInfoItem( const String &rFileName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XDocumentProperties> & i_xDocProps,
+ sal_Bool bUseUserData );
+ SfxDocumentInfoItem( const SfxDocumentInfoItem& );
+ virtual ~SfxDocumentInfoItem();
+
+ /// update i_xDocProps with the data in this object
+ void UpdateDocumentInfo(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XDocumentProperties> & i_xDocProps,
+ bool i_bDoNotUpdateUserDefined = false)
+ const;
+
+ sal_Bool isAutoloadEnabled() const { return m_isAutoloadEnabled; }
+ void setAutoloadEnabled(sal_Bool i_val) { m_isAutoloadEnabled = i_val; }
+ sal_Int32 getAutoloadDelay() const { return m_AutoloadDelay; }
+ void setAutoloadDelay(sal_Int32 i_val) { m_AutoloadDelay = i_val; }
+ OUString getAutoloadURL() const { return m_AutoloadURL; }
+ void setAutoloadURL(OUString i_val) { m_AutoloadURL = i_val; }
+ OUString getDefaultTarget() const { return m_DefaultTarget; }
+ void setDefaultTarget(OUString i_val) { m_DefaultTarget = i_val; }
+ OUString getTemplateName() const { return m_TemplateName; }
+ void setTemplateName(OUString i_val) { m_TemplateName = i_val; }
+ OUString getAuthor() const { return m_Author; }
+ void setAuthor(OUString i_val) { m_Author = i_val; }
+
+ ::com::sun::star::util::DateTime
+ getCreationDate() const { return m_CreationDate; }
+ void setCreationDate(::com::sun::star::util::DateTime i_val) {
+ m_CreationDate = i_val;
+ }
+ OUString getModifiedBy() const { return m_ModifiedBy; }
+ void setModifiedBy(OUString i_val) { m_ModifiedBy = i_val; }
+
+ ::com::sun::star::util::DateTime
+ getModificationDate() const { return m_ModificationDate; }
+ void setModificationDate(::com::sun::star::util::DateTime i_val) {
+ m_ModificationDate = i_val;
+ }
+ OUString getPrintedBy() const { return m_PrintedBy; }
+ void setPrintedBy(OUString i_val) { m_PrintedBy = i_val; }
+ ::com::sun::star::util::DateTime
+ getPrintDate() const { return m_PrintDate; }
+ void setPrintDate(::com::sun::star::util::DateTime i_val) {
+ m_PrintDate = i_val;
+ }
+ sal_Int16 getEditingCycles() const { return m_EditingCycles; }
+ void setEditingCycles(sal_Int16 i_val) { m_EditingCycles = i_val; }
+ sal_Int32 getEditingDuration() const { return m_EditingDuration; }
+ void setEditingDuration(sal_Int32 i_val) { m_EditingDuration = i_val; }
+ OUString getDescription() const { return m_Description; }
+ void setDescription(OUString i_val) { m_Description = i_val; }
+ OUString getKeywords() const { return m_Keywords; }
+ void setKeywords(OUString i_val) { m_Keywords = i_val; }
+ OUString getSubject() const { return m_Subject; }
+ void setSubject(OUString i_val) { m_Subject = i_val; }
+ OUString getTitle() const { return m_Title; }
+ void setTitle(OUString i_val) { m_Title = i_val; }
+
+ /// reset user-specific data (author, modified-by, ...)
+ void resetUserData(const OUString & i_rAuthor);
+
+ void SetTemplate( sal_Bool b ) { m_bHasTemplate = b; }
+ sal_Bool HasTemplate() const { return m_bHasTemplate; }
+ void SetDeleteUserData( sal_Bool bSet );
+ void SetUseUserData( sal_Bool bSet );
+ sal_Bool IsDeleteUserData() const;
+ sal_Bool IsUseUserData() const;
+
+ std::vector< CustomProperty* > GetCustomProperties() const;
+ void ClearCustomProperties();
+ void AddCustomProperty( const OUString& sName,
+ const com::sun::star::uno::Any& rValue );
+
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = NULL ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+};
+
+// class SfxDocumentPage -------------------------------------------------
+
+class SfxDocumentPage : public SfxTabPage
+{
+private:
+ FixedImage* m_pBmp;
+ Edit* m_pNameED;
+ PushButton* m_pChangePassBtn;
+
+ SelectableFixedText* m_pShowTypeFT;
+ CheckBox* m_pReadOnlyCB;
+ SelectableFixedText* m_pFileValFt;
+ SelectableFixedText* m_pShowSizeFT;
+
+ SelectableFixedText* m_pCreateValFt;
+ SelectableFixedText* m_pChangeValFt;
+ SelectableFixedText* m_pSignedValFt;
+ PushButton* m_pSignatureBtn;
+ SelectableFixedText* m_pPrintValFt;
+ SelectableFixedText* m_pTimeLogValFt;
+ SelectableFixedText* m_pDocNoValFt;
+
+ CheckBox* m_pUseUserDataCB;
+ PushButton* m_pDeleteBtn;
+
+ FixedText* m_pTemplFt;
+ SelectableFixedText* m_pTemplValFt;
+
+ OUString m_aUnknownSize;
+ OUString m_aMultiSignedStr;
+
+ sal_Bool bEnableUseUserData : 1,
+ bHandleDelete : 1;
+
+ DECL_LINK(DeleteHdl, void *);
+ DECL_LINK(SignatureHdl, void *);
+ DECL_LINK(ChangePassHdl, void *);
+ void ImplUpdateSignatures();
+ void ImplCheckPasswordState();
+
+protected:
+ SfxDocumentPage( Window* pParent, const SfxItemSet& );
+
+ virtual sal_Bool FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet& );
+
+public:
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& );
+
+ void EnableUseUserData();
+};
+
+// class SfxDocumentDescPage ---------------------------------------------
+
+class SfxDocumentDescPage : public SfxTabPage
+{
+private:
+ Edit* m_pTitleEd;
+ Edit* m_pThemaEd;
+ Edit* m_pKeywordsEd;
+ VclMultiLineEdit* m_pCommentEd;
+ SfxDocumentInfoItem* m_pInfoItem;
+
+protected:
+ SfxDocumentDescPage( Window* pParent, const SfxItemSet& );
+
+ virtual sal_Bool FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet& );
+
+public:
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& );
+};
+
+// class SfxDocumentInfoDialog -------------------------------------------
+
+class SFX2_DLLPUBLIC SfxDocumentInfoDialog : public SfxTabDialog
+{
+private:
+ sal_uInt16 m_nDocInfoId;
+protected:
+ virtual void PageCreated( sal_uInt16 nId, SfxTabPage& rPage );
+
+public:
+ SfxDocumentInfoDialog( Window* pParent, const SfxItemSet& );
+ void AddFontTabPage();
+};
+
+// class CustomPropertiesRemoveButton ------------------------------------
+
+struct CustomPropertyLine;
+
+class CustomPropertiesEdit : public Edit
+{
+private:
+ CustomPropertyLine* m_pLine;
+
+public:
+ inline CustomPropertiesEdit(
+ Window* pParent, const ResId& rResId, CustomPropertyLine* pLine ) :
+ Edit( pParent, rResId ), m_pLine( pLine ) {}
+
+ inline CustomPropertyLine* GetLine() const { return m_pLine; }
+};
+
+class CustomPropertiesTypeBox : public ListBox
+{
+private:
+ CustomPropertyLine* m_pLine;
+
+public:
+ inline CustomPropertiesTypeBox(
+ Window* pParent, const ResId& rResId, CustomPropertyLine* pLine ) :
+ ListBox( pParent, rResId ), m_pLine( pLine ) {}
+
+ inline CustomPropertyLine* GetLine() const { return m_pLine; }
+};
+
+class CustomPropertiesDateField : public DateField
+{
+private:
+ CustomPropertyLine* m_pLine;
+
+public:
+ inline CustomPropertiesDateField(
+ Window* pParent, const ResId& rResId, CustomPropertyLine* pLine ) :
+ DateField( pParent, rResId ), m_pLine( pLine ) {}
+
+ inline CustomPropertyLine* GetLine() const { return m_pLine; }
+};
+class CustomPropertiesTimeField : public TimeField
+{
+private:
+ CustomPropertyLine* m_pLine;
+
+public:
+ inline CustomPropertiesTimeField(
+ Window* pParent, const ResId& rResId, CustomPropertyLine* pLine ) :
+ TimeField( pParent, rResId ), m_pLine( pLine ) {}
+
+ inline CustomPropertyLine* GetLine() const { return m_pLine; }
+};
+class CustomPropertiesDurationField : public Edit
+{
+ CustomPropertyLine* m_pLine;
+ com::sun::star::util::Duration m_aDuration;
+protected:
+ virtual void RequestHelp(const HelpEvent& rEvt);
+public:
+ CustomPropertiesDurationField( Window* pParent, const ResId& rResId, CustomPropertyLine* pLine );
+ ~CustomPropertiesDurationField();
+
+ void SetDuration( const com::sun::star::util::Duration& rDuration );
+ const com::sun::star::util::Duration& GetDuration() const { return m_aDuration; }
+};
+
+class CustomPropertiesEditButton : public PushButton
+{
+ CustomPropertyLine* m_pLine;
+
+public:
+ CustomPropertiesEditButton( Window* pParent, const ResId& rResId, CustomPropertyLine* pLine );
+ ~CustomPropertiesEditButton();
+
+ DECL_LINK(ClickHdl, void *);
+};
+
+class CustomPropertiesRemoveButton : public ImageButton
+{
+private:
+ CustomPropertyLine* m_pLine;
+
+public:
+ inline CustomPropertiesRemoveButton(
+ Window* pParent, const ResId& rResId, CustomPropertyLine* pLine ) :
+ ImageButton( pParent, rResId ), m_pLine( pLine ) {}
+
+ inline CustomPropertyLine* GetLine() const { return m_pLine; }
+};
+
+class CustomPropertiesYesNoButton : public Control
+{
+private:
+ RadioButton m_aYesButton;
+ RadioButton m_aNoButton;
+
+public:
+ CustomPropertiesYesNoButton( Window* pParent, const ResId& rResId );
+
+ virtual void Resize();
+
+ inline void CheckYes() { m_aYesButton.Check(); }
+ inline void CheckNo() { m_aNoButton.Check(); }
+ inline bool IsYesChecked() const { return m_aYesButton.IsChecked() != sal_False; }
+};
+
+// struct CustomPropertyLine ---------------------------------------------
+
+struct CustomPropertyLine
+{
+ ComboBox m_aNameBox;
+ CustomPropertiesTypeBox m_aTypeBox;
+ CustomPropertiesEdit m_aValueEdit;
+ CustomPropertiesDateField m_aDateField;
+ CustomPropertiesTimeField m_aTimeField;
+ const String m_sDurationFormat;
+ CustomPropertiesDurationField m_aDurationField;
+ CustomPropertiesEditButton m_aEditButton;
+ CustomPropertiesYesNoButton m_aYesNoButton;
+ CustomPropertiesRemoveButton m_aRemoveButton;
+
+ Point m_aDatePos;
+ Point m_aTimePos;
+ Size m_aDateTimeSize;
+
+ bool m_bIsRemoved;
+ bool m_bTypeLostFocus;
+
+ CustomPropertyLine( Window* pParent );
+
+ void SetRemoved();
+};
+
+// class CustomPropertiesWindow ------------------------------------------
+
+class CustomPropertiesWindow : public Window
+{
+private:
+ ComboBox m_aNameBox;
+ ListBox m_aTypeBox;
+ Edit m_aValueEdit;
+ DateField m_aDateField;
+ TimeField m_aTimeField;
+ Edit m_aDurationField;
+ PushButton m_aEditButton;
+ CustomPropertiesYesNoButton m_aYesNoButton;
+ ImageButton m_aRemoveButton;
+
+ sal_Int32 m_nLineHeight;
+ sal_Int32 m_nScrollPos;
+ SvtSysLocale m_aSysLocale;
+ std::vector< CustomPropertyLine* > m_aCustomPropertiesLines;
+ CustomPropertyLine* m_pCurrentLine;
+ SvNumberFormatter m_aNumberFormatter;
+ Timer m_aEditLoseFocusTimer;
+ Timer m_aBoxLoseFocusTimer;
+ Link m_aRemovedHdl;
+
+ DECL_LINK( TypeHdl, CustomPropertiesTypeBox* );
+ DECL_LINK( RemoveHdl, CustomPropertiesRemoveButton* );
+ DECL_LINK( EditLoseFocusHdl, CustomPropertiesEdit* );
+ DECL_LINK( BoxLoseFocusHdl, CustomPropertiesTypeBox* );
+ //add lose focus handlers of Date/TimeField?
+
+ DECL_LINK(EditTimeoutHdl, void *);
+ DECL_LINK(BoxTimeoutHdl, void *);
+
+ bool IsLineValid( CustomPropertyLine* pLine ) const;
+ void ValidateLine( CustomPropertyLine* pLine, bool bIsFromTypeBox );
+
+public:
+ CustomPropertiesWindow(Window* pParent,
+ const OUString &rHeaderAccName,
+ const OUString &rHeaderAccType,
+ const OUString &rHeaderAccValue);
+ ~CustomPropertiesWindow();
+
+ void InitControls( HeaderBar* pHeaderBar, const ScrollBar* pScrollBar );
+ sal_uInt16 GetVisibleLineCount() const;
+ inline sal_Int32 GetLineHeight() const { return m_nLineHeight; }
+ void AddLine( const OUString& sName, com::sun::star::uno::Any& rAny );
+ bool AreAllLinesValid() const;
+ void ClearAllLines();
+ void DoScroll( sal_Int32 nNewPos );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
+ GetCustomProperties() const;
+ void SetRemovedHdl( const Link& rLink ) { m_aRemovedHdl = rLink; }
+
+ void InitRemoveButton(const ScrollBar &rScrollBar);
+ void updateLineWidth();
+};
+
+// class CustomPropertiesControl -----------------------------------------
+
+class CustomPropertiesControl : public VclVBox
+{
+private:
+ HeaderBar* m_pHeaderBar;
+ VclHBox* m_pBody;
+ CustomPropertiesWindow* m_pPropertiesWin;
+ ScrollBar* m_pVertScroll;
+
+ sal_Int32 m_nThumbPos;
+
+ DECL_LINK( ScrollHdl, ScrollBar* );
+ DECL_LINK( RemovedHdl, void* );
+
+public:
+ CustomPropertiesControl(Window* pParent);
+ ~CustomPropertiesControl();
+
+ void AddLine( const OUString& sName, com::sun::star::uno::Any& rAny, bool bInteractive );
+
+ inline bool AreAllLinesValid() const { return m_pPropertiesWin->AreAllLinesValid(); }
+ inline void ClearAllLines() { m_pPropertiesWin->ClearAllLines(); }
+ inline ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
+ GetCustomProperties() const
+ { return m_pPropertiesWin->GetCustomProperties(); }
+ void Init(VclBuilderContainer& rParent);
+ virtual void setAllocation(const Size &rAllocation);
+};
+
+// class SfxCustomPropertiesPage -----------------------------------------
+
+class SfxCustomPropertiesPage : public SfxTabPage
+{
+private:
+ CustomPropertiesControl* m_pPropertiesCtrl;
+
+ DECL_LINK(AddHdl, void *);
+
+ using TabPage::DeactivatePage;
+
+protected:
+ SfxCustomPropertiesPage( Window* pParent, const SfxItemSet& );
+
+ virtual sal_Bool FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet& );
+ virtual int DeactivatePage( SfxItemSet* pSet = NULL );
+
+public:
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& );
+};
+
+#endif // #ifndef _SFX_DINFDLG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/dinfedt.hxx b/include/sfx2/dinfedt.hxx
new file mode 100644
index 000000000000..b24908a7d081
--- /dev/null
+++ b/include/sfx2/dinfedt.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX_DINFEDT_HXX
+#define _SFX_DINFEDT_HXX
+
+#include <vcl/button.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/fixed.hxx>
+
+// class InfoEdit_Impl ---------------------------------------------------
+
+class InfoEdit_Impl : public Edit
+{
+public:
+ InfoEdit_Impl( Window* pParent, const ResId& rResId ) :
+ Edit( pParent, rResId ) {}
+
+ virtual void KeyInput( const KeyEvent& rKEvent );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/dispatch.hxx b/include/sfx2/dispatch.hxx
new file mode 100644
index 000000000000..2b02a5e620c6
--- /dev/null
+++ b/include/sfx2/dispatch.hxx
@@ -0,0 +1,308 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXDISPATCH_HXX
+#define _SFXDISPATCH_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include "sal/types.h"
+
+#include <stdarg.h>
+
+#include <sfx2/bindings.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <map>
+#include <vector>
+
+class SfxSlotServer;
+class SfxShell;
+class SfxRequest;
+class SfxHintPoster;
+class SfxViewFrame;
+class SfxBindings;
+class SfxItemSet;
+class SfxPopupMenuManager;
+class SfxModule;
+struct SfxDispatcher_Impl;
+
+typedef std::vector<SfxShell*> SfxShellStack_Impl;
+
+namespace com
+{
+ namespace sun
+ {
+ namespace star
+ {
+ namespace frame
+ {
+ class XDispatch;
+ }
+ }
+ }
+}
+
+//=========================================================================
+
+#define SFX_SHELL_POP_UNTIL 4
+#define SFX_SHELL_POP_DELETE 2
+#define SFX_SHELL_PUSH 1
+
+//=========================================================================
+
+// Maps the Which() field to a pointer to a SfxPoolItem
+class SfxItemPtrMap : public std::map<sal_uInt16, SfxPoolItem*>
+{
+public:
+ ~SfxItemPtrMap()
+ {
+ for(iterator it = begin(); it != end(); ++it)
+ delete it->second;
+ }
+};
+
+class SFX2_DLLPUBLIC SfxDispatcher
+{
+ SfxDispatcher_Impl* pImp;
+ sal_Bool bFlushed;
+
+private:
+ // Search for temporary evaluated Todos
+ SAL_DLLPRIVATE sal_Bool CheckVirtualStack( const SfxShell& rShell, sal_Bool bDeep );
+
+#ifndef _SFX_HXX
+
+friend class SfxApplication;
+friend class SfxViewFrame;
+
+ DECL_DLLPRIVATE_LINK( EventHdl_Impl, void * );
+ DECL_DLLPRIVATE_LINK( PostMsgHandler, SfxRequest * );
+
+ SAL_DLLPRIVATE int Call_Impl( SfxShell& rShell, const SfxSlot &rSlot, SfxRequest &rReq, sal_Bool bRecord );
+ SAL_DLLPRIVATE void _Update_Impl( sal_Bool,sal_Bool,sal_Bool,SfxWorkWindow*);
+ SAL_DLLPRIVATE void CollectTools_Impl(SfxWorkWindow*);
+
+protected:
+friend class SfxBindings;
+friend class SfxStateCache;
+friend class SfxPopupMenuManager;
+friend class SfxHelp;
+ // For bindings: Finding the Message;
+ // level for re-access
+ SAL_DLLPRIVATE sal_Bool _TryIntercept_Impl( sal_uInt16 nId, SfxSlotServer &rServer, sal_Bool bModal );
+ sal_Bool _FindServer( sal_uInt16 nId, SfxSlotServer &rServer, sal_Bool bModal );
+ sal_Bool _FillState( const SfxSlotServer &rServer,
+ SfxItemSet &rState, const SfxSlot *pRealSlot );
+ void _Execute( SfxShell &rShell, const SfxSlot &rSlot,
+ SfxRequest &rReq,
+ SfxCallMode eCall = SFX_CALLMODE_STANDARD);
+#endif
+protected:
+ void FlushImpl();
+
+public:
+ SfxDispatcher( SfxDispatcher* pParent );
+ SfxDispatcher( SfxViewFrame *pFrame = 0 );
+
+ SAL_DLLPRIVATE void Construct_Impl( SfxDispatcher* pParent );
+
+ virtual ~SfxDispatcher();
+
+ const SfxPoolItem* Execute( sal_uInt16 nSlot,
+ SfxCallMode nCall = SFX_CALLMODE_SLOT,
+ const SfxPoolItem **pArgs = 0,
+ sal_uInt16 nModi = 0,
+ const SfxPoolItem **pInternalArgs = 0);
+
+ const SfxPoolItem* Execute( sal_uInt16 nSlot,
+ SfxCallMode nCall,
+ SfxItemSet* pArgs,
+ SfxItemSet* pInternalArgs,
+ sal_uInt16 nModi = 0);
+
+ const SfxPoolItem* Execute( sal_uInt16 nSlot,
+ SfxCallMode nCall,
+ const SfxPoolItem *pArg1, ... );
+
+ const SfxPoolItem* Execute( sal_uInt16 nSlot,
+ SfxCallMode nCall,
+ const SfxItemSet &rArgs );
+
+ const SfxPoolItem* Execute( sal_uInt16 nSlot,
+ SfxCallMode nCall,
+ sal_uInt16 nModi,
+ const SfxItemSet &rArgs );
+
+ const SfxSlot* GetSlot( const String& rCommand );
+
+ sal_Bool IsActive( const SfxShell& rShell );
+ sal_Bool IsOnTop( const SfxShell& rShell );
+ sal_uInt16 GetShellLevel( const SfxShell &rShell );
+ SfxBindings* GetBindings() const;
+
+ void Push( SfxShell& rShell );
+ void Pop( SfxShell& rShell, sal_uInt16 nMode = 0 );
+
+ SfxShell* GetShell(sal_uInt16 nIdx) const;
+ SfxViewFrame* GetFrame() const;
+ SfxModule* GetModule() const;
+ // caller has to clean up the Manager on his own
+ static SfxPopupMenuManager* Popup( sal_uInt16 nConfigId,Window *pWin, const Point *pPos );
+
+ void ExecutePopup( const ResId &rId,
+ Window *pWin = 0, const Point *pPosPixel = 0 );
+ static void ExecutePopup( sal_uInt16 nConfigId = 0,
+ Window *pWin = 0, const Point *pPosPixel = 0 );
+
+ sal_Bool IsAppDispatcher() const;
+ sal_Bool IsFlushed() const;
+ void Flush();
+ void Lock( sal_Bool bLock );
+ sal_Bool IsLocked( sal_uInt16 nSID = 0 ) const;
+ void SetSlotFilter( sal_Bool bEnable = sal_False,
+ sal_uInt16 nCount = 0, const sal_uInt16 *pSIDs = 0 );
+
+ void HideUI( sal_Bool bHide = sal_True );
+ void ShowObjectBar(sal_uInt16 nId, SfxShell *pShell=0) const;
+ sal_uInt32 GetObjectBarId( sal_uInt16 nPos ) const;
+
+ SfxItemState QueryState( sal_uInt16 nSID, const SfxPoolItem* &rpState );
+ SfxItemState QueryState( sal_uInt16 nSID, ::com::sun::star::uno::Any& rAny );
+
+ ::com::sun::star::frame::XDispatch* GetDispatchInterface( const String& );
+ void SetDisableFlags( sal_uInt32 nFlags );
+ sal_uInt32 GetDisableFlags() const;
+
+ SAL_DLLPRIVATE void SetMenu_Impl();
+ SAL_DLLPRIVATE void Update_Impl( sal_Bool bForce = sal_False ); // ObjectBars etc.
+ SAL_DLLPRIVATE sal_Bool IsUpdated_Impl() const;
+ SAL_DLLPRIVATE int GetShellAndSlot_Impl( sal_uInt16 nSlot, SfxShell **ppShell, const SfxSlot **ppSlot,
+ sal_Bool bOwnShellsOnly, sal_Bool bModal, sal_Bool bRealSlot=sal_True );
+ SAL_DLLPRIVATE void SetReadOnly_Impl( sal_Bool bOn );
+ SAL_DLLPRIVATE sal_Bool GetReadOnly_Impl() const;
+ SAL_DLLPRIVATE sal_Bool IsSlotEnabledByFilter_Impl( sal_uInt16 nSID ) const;
+ SAL_DLLPRIVATE void SetQuietMode_Impl( sal_Bool bOn );
+ SAL_DLLPRIVATE sal_Bool IsReadOnlyShell_Impl( sal_uInt16 nShell ) const;
+ SAL_DLLPRIVATE void RemoveShell_Impl( SfxShell& rShell );
+ SAL_DLLPRIVATE void DoParentActivate_Impl();
+ SAL_DLLPRIVATE void DoParentDeactivate_Impl();
+ SAL_DLLPRIVATE void DoActivate_Impl( sal_Bool bMDI, SfxViewFrame* pOld );
+ SAL_DLLPRIVATE void DoDeactivate_Impl( sal_Bool bMDI, SfxViewFrame* pNew );
+ SAL_DLLPRIVATE void InvalidateBindings_Impl(sal_Bool);
+ SAL_DLLPRIVATE sal_uInt16 GetNextToolBox_Impl( sal_uInt16 nPos, sal_uInt16 nType, String *pStr );
+};
+
+//--------------------------------------------------------------------
+
+inline sal_Bool SfxDispatcher::IsFlushed() const
+
+/* [Description]
+
+ This method checks if the stack of the SfxDispatchers is flushed, or if
+ push- or pop- commands are pending.
+*/
+
+{
+ return bFlushed;
+}
+
+//--------------------------------------------------------------------
+
+inline void SfxDispatcher::Flush()
+
+/* [Description]
+
+ This method performs outstanding push- and pop- commands. For <SfxShell>s,
+ which are new on the stack, the <SfxShell::Activate(sal_Bool)> is invoked with
+ bMDI == sal_True, for SfxShells that are removed from the stack, the
+ <SfxShell::Deactivate(sal_Bool)> is invoked with bMDI == sal_True
+*/
+
+{
+ if ( !bFlushed ) FlushImpl();
+}
+
+//--------------------------------------------------------------------
+
+inline void SfxDispatcher::Push( SfxShell& rShell )
+
+/* [Description]
+
+ With this method, a <SfxShell> pushed on to the SfxDispatcher.
+ The SfxShell is first marked for push and a timer is set up.
+ First when the timer has couted down to zero the push
+ ( <SfxDispatcher::Flush()> ) is actually performed and the
+ <SfxBindings> is invalidated. While the timer is counting down
+ the opposing push and pop commands on the same SfxShell are
+ leveled out.
+*/
+
+{
+ Pop( rShell, SFX_SHELL_PUSH );
+}
+
+//--------------------------------------------------------------------
+
+inline sal_Bool SfxDispatcher::IsActive( const SfxShell& rShell )
+
+/* [Description]
+
+ This method checks whether a particular <SfxShell> instance is
+ on the SfxDispatcher.
+
+ [Return value]
+
+ sal_Bool sal_True
+ The SfxShell instance is on the SfxDispatcher.
+
+ sal_False
+ The SfxShell instance is not on the SfxDispatcher.
+*/
+
+{
+ return CheckVirtualStack( rShell, sal_True );
+}
+//--------------------------------------------------------------------
+
+inline sal_Bool SfxDispatcher::IsOnTop( const SfxShell& rShell )
+
+/* [Description]
+
+ This method checks whether a particular <SfxShell> instance is on
+ top of the SfxDispatcher.
+
+ [Return value]
+
+ sal_Bool sal_True
+ The SfxShell instance is on the top of
+ the SfxDispatcher.
+
+ sal_False
+ The SfxShell instance is not on the top of
+ the SfxDispatcher.
+*/
+
+{
+ return CheckVirtualStack( rShell, sal_False );
+}
+
+//--------------------------------------------------------------------
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/dllapi.h b/include/sfx2/dllapi.h
new file mode 100644
index 000000000000..95ba80bff9e5
--- /dev/null
+++ b/include/sfx2/dllapi.h
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SFX2_DLLAPI_H
+#define INCLUDED_SFX2_DLLAPI_H
+
+#include "sal/config.h"
+#include "sal/types.h"
+
+#if defined SFX2_DLLIMPLEMENTATION
+#define SFX2_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define SFX2_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#define SFX2_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/docfac.hxx b/include/sfx2/docfac.hxx
new file mode 100644
index 000000000000..e8d15a8366cd
--- /dev/null
+++ b/include/sfx2/docfac.hxx
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX_OBJFAC_HXX
+#define _SFX_OBJFAC_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include <sal/types.h>
+#include <tools/solar.h>
+#include <tools/rtti.hxx>
+
+// SFX_IMPL_MODULE_LIB
+#include <osl/module.hxx>
+#include <rtl/ustring.hxx>
+
+#include <sfx2/objsh.hxx>
+#include <sfx2/sfxdefs.hxx>
+
+class SfxMedium;
+class SfxFilter;
+class SfxViewFactory;
+struct SfxObjectFactory_Impl;
+class SfxFilterContainer;
+class SfxBindings;
+
+//====================================================================
+
+typedef void (*SfxVoidFunc)();
+
+#define SDT_SDT_DOCFACTPRIO 10 // Explorer
+#define SDT_SW_DOCFACTPRIO 20 // Text Document
+#define SDT_SWW_DOCFACTPRIO 21 // Web Document
+#define SDT_SC_DOCFACTPRIO 30 // Table Document
+#define SDT_SI_DOCFACTPRIO 40 // Impress Document
+#define SDT_SD_DOCFACTPRIO 41 // Draw Document
+#define SDT_SCH_DOCFACTPRIO 50 // Chart Document
+#define SDT_SMA_DOCFACTPRIO 60 // Math Document
+#define SDT_SIM_DOCFACTPRIO 70 // Image Document
+#define SDT_FRM_DOCFACTPRIO 100 // Frame Document
+#define SDT_MSG_DOCFACTPRIO 110 // Message Document
+#define SDT_SDB_DOCFACTPRIO 200 // Database Document
+
+//====================================================================
+
+class SFX2_DLLPUBLIC SfxObjectFactory
+{
+private:
+ const char* pShortName;
+ SfxObjectFactory_Impl* pImpl; // Additional Data
+ SfxObjectShellFlags nFlags;
+ SAL_DLLPRIVATE void Construct();
+
+public:
+ SfxObjectFactory( const SvGlobalName &rName, SfxObjectShellFlags nFlags, const char* pShortName );
+ ~SfxObjectFactory();
+
+ const SvGlobalName& GetClassId() const;
+ SfxObjectShellFlags GetFlags() { return nFlags; }
+ const char* GetShortName() const { return pShortName; }
+ String GetFactoryURL() const; // shortcut for "private:factory/GetShortName()"
+ String GetFactoryName() const { return OUString::createFromAscii(pShortName); }
+ String GetModuleName() const;
+ SfxFilterContainer *GetFilterContainer( sal_Bool bForceLoad = sal_True) const;
+
+ // Views
+ void RegisterViewFactory(SfxViewFactory &rFactory);
+ sal_uInt16 GetViewFactoryCount() const;
+ SfxViewFactory& GetViewFactory(sal_uInt16 i = 0) const;
+
+ /// returns the view factory whose GetAPIViewName or GetLegacyViewName delivers the requested logical name
+ SfxViewFactory* GetViewFactoryByViewName( const String& i_rViewName ) const;
+
+ // Filter
+ const SfxFilter* GetTemplateFilter() const;
+ static String GetStandardTemplate( const String& rServiceName );
+ static void SetStandardTemplate( const String& rServiceName, const String& rTemplateName );
+ static void SetSystemTemplate( const String& rServiceName, const String& rTemplateName );
+
+ void SetDocumentServiceName( const OUString& rServiceName );
+ const OUString& GetDocumentServiceName() const;
+
+ SfxModule* GetModule() const;
+
+ SAL_DLLPRIVATE void SetModule_Impl( SfxModule* );
+ SAL_DLLPRIVATE static void UpdateFilterContainers_Impl();
+ SAL_DLLPRIVATE sal_uInt16 GetViewNo_Impl( const sal_uInt16 i_nViewId, const sal_uInt16 i_nFallback ) const;
+
+private:
+ // Kopieren verboten
+ SAL_DLLPRIVATE SfxObjectFactory(const SfxObjectFactory&);
+ SAL_DLLPRIVATE const SfxObjectFactory& operator=(const SfxObjectFactory &);
+};
+
+//=========================================================================
+
+#define SFX_DECL_OBJECTFACTORY() \
+public: \
+ static SfxObjectFactory& Factory(); \
+ virtual SfxObjectFactory& GetFactory() const { return Factory(); }
+
+#define SFX_IMPL_OBJECTFACTORY(ClassName,GlobName,Flags,ShortName) \
+ SfxObjectFactory& ClassName::Factory() \
+ { \
+ static SfxObjectFactory aObjectFactory(GlobName, Flags, ShortName); \
+ return aObjectFactory; \
+ }
+#endif // #ifndef _SFX_OBJFAC_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/docfile.hxx b/include/sfx2/docfile.hxx
new file mode 100644
index 000000000000..fcf7351f9c9f
--- /dev/null
+++ b/include/sfx2/docfile.hxx
@@ -0,0 +1,286 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SFXDOCFILE_HXX
+#define _SFXDOCFILE_HXX
+
+#include <com/sun/star/io/XSeekable.hpp>
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include "sal/types.h"
+#include <com/sun/star/util/RevisionTag.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/ucb/XContent.hpp>
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+#include <com/sun/star/task/XInteractionHandler.hpp>
+#include <com/sun/star/embed/XStorage.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <tools/link.hxx>
+#include <tools/stream.hxx>
+#include <tools/string.hxx>
+#include <svl/lstner.hxx>
+
+#include <cppuhelper/weak.hxx>
+#include <ucbhelper/content.hxx>
+
+#include <vector>
+
+class SvKeyValueIterator;
+class SfxObjectFactory;
+class SfxFilter;
+class SfxMedium_Impl;
+class INetURLObject;
+class SfxObjectShell;
+class SfxFrame;
+class Timer;
+class SfxItemSet;
+class DateTime;
+
+class SFX2_DLLPUBLIC SfxMedium : public SvRefBase
+{
+ SfxMedium_Impl* pImp;
+
+ SAL_DLLPRIVATE void SetIsRemote_Impl();
+ SAL_DLLPRIVATE void CloseInStream_Impl();
+ SAL_DLLPRIVATE sal_Bool CloseOutStream_Impl();
+ SAL_DLLPRIVATE void CloseStreams_Impl();
+ DECL_DLLPRIVATE_STATIC_LINK( SfxMedium, UCBHdl_Impl, sal_uInt32 * );
+
+ SAL_DLLPRIVATE void SetEncryptionDataToStorage_Impl();
+
+public:
+
+ SfxMedium();
+ /**
+ * @param pSet Takes ownership
+ */
+ SfxMedium( const String &rName,
+ StreamMode nOpenMode,
+ const SfxFilter *pFilter = 0,
+ SfxItemSet *pSet = 0 );
+ //TODO: the next, non-defined overload is only there to
+ // detect uses of the above (String, StreamMode, etc.)
+ // overload from when it still had an additional third
+ // parameter sal_Bool bDirect, where now a leftover
+ // "false" or "sal_False" could be mistaken for a null
+ // pointer argument for the pFilter parameter; it can be
+ // removed once we are confident all old uses of the
+ // original overload have been adapted (in platform
+ // specific code etc.):
+ SfxMedium(String const &, StreamMode, void *)
+ SAL_DELETED_FUNCTION;
+
+ /**
+ * @param pSet does NOT take ownership
+ */
+ SfxMedium( const css::uno::Reference< css::embed::XStorage >& xStorage,
+ const String& rBaseURL,
+ const SfxItemSet* pSet=0 );
+ /**
+ * @param pSet does NOT take ownership
+ */
+ SfxMedium( const css::uno::Reference< css::embed::XStorage >& xStorage,
+ const String& rBaseURL,
+ const String& rTypeName,
+ const SfxItemSet* pSet=0 );
+ SfxMedium( const css::uno::Sequence< css::beans::PropertyValue >& aArgs );
+
+ ~SfxMedium();
+
+ void UseInteractionHandler( sal_Bool );
+ css::uno::Reference< css::task::XInteractionHandler >
+ GetInteractionHandler();
+
+ void setStreamToLoadFrom(
+ const css::uno::Reference<css::io::XInputStream>& xInputStream,
+ sal_Bool bIsReadOnly);
+
+ void SetLoadTargetFrame(SfxFrame* pFrame );
+ SfxFrame* GetLoadTargetFrame() const;
+
+ void SetFilter(const SfxFilter *pFlt, sal_Bool bResetOrig = sal_False);
+ const SfxFilter* GetFilter() const;
+ const SfxFilter * GetOrigFilter( sal_Bool bNotCurrent = sal_False ) const;
+ const OUString& GetOrigURL() const;
+
+ SfxItemSet * GetItemSet() const;
+ void Close();
+ void CloseAndRelease();
+ void ReOpen();
+ void CompleteReOpen();
+ const OUString& GetName() const;
+ const INetURLObject& GetURLObject() const;
+
+ void CheckFileDate( const css::util::DateTime& aInitDate );
+ sal_Bool DocNeedsFileDateCheck();
+ css::util::DateTime GetInitFileDate( sal_Bool bIgnoreOldValue );
+
+ css::uno::Reference< css::ucb::XContent > GetContent() const;
+ const OUString& GetPhysicalName() const;
+ sal_Bool IsRemote();
+ sal_Bool IsOpen() const; // { return aStorage.Is() || pInStream; }
+ void DownLoad( const Link& aLink = Link());
+ void SetDoneLink( const Link& rLink );
+
+ sal_uInt32 GetErrorCode() const;
+ sal_uInt32 GetError() const
+ { return ERRCODE_TOERROR(GetErrorCode()); }
+ sal_uInt32 GetLastStorageCreationState();
+
+ void SetError( sal_uInt32 nError, const OUString& aLogMessage );
+
+ void AddLog( const OUString& aMessage );
+
+ void CloseInStream();
+ sal_Bool CloseOutStream();
+
+ void CloseStorage();
+
+ StreamMode GetOpenMode() const;
+ void SetOpenMode( StreamMode nStorOpen, sal_Bool bDontClose = sal_False );
+
+ SvStream* GetInStream();
+ SvStream* GetOutStream();
+
+ sal_Bool Commit();
+ sal_Bool IsStorage();
+
+ sal_Int8 ShowLockedDocumentDialog( const css::uno::Sequence< OUString >& aData, sal_Bool bIsLoading, sal_Bool bOwnLock );
+ bool LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI );
+ void UnlockFile( sal_Bool bReleaseLockStream );
+
+ css::uno::Reference< css::embed::XStorage > GetStorage( sal_Bool bCreateTempIfNo = sal_True );
+ css::uno::Reference< css::embed::XStorage > GetOutputStorage();
+ void ResetError();
+ sal_Bool UsesCache() const;
+ void SetUsesCache( sal_Bool );
+ sal_Bool IsExpired() const;
+ void SetName( const String& rName, sal_Bool bSetOrigURL = sal_False );
+ sal_Bool IsAllowedForExternalBrowser() const;
+ long GetFileVersion() const;
+
+ const css::uno::Sequence < css::util::RevisionTag >&
+ GetVersionList( bool _bNoReload = false );
+ sal_Bool IsReadOnly();
+
+ // Whether the medium had originally been opened r/o, independent of later
+ // changes via SetOpenMode; used to keep track of the "true" state of the
+ // medium across toggles via SID_EDITDOC (which do change SetOpenMode):
+ bool IsOriginallyReadOnly() const;
+
+ css::uno::Reference< css::io::XInputStream > GetInputStream();
+
+ void CreateTempFile( sal_Bool bReplace = sal_True );
+ void CreateTempFileNoCopy();
+ OUString SwitchDocumentToTempFile();
+ sal_Bool SwitchDocumentToFile( const OUString& aURL );
+
+ OUString GetBaseURL( bool bForSaving=false );
+ void SetInCheckIn( bool bInCheckIn );
+ bool IsInCheckIn( );
+
+ SAL_DLLPRIVATE sal_Bool HasStorage_Impl() const;
+
+ SAL_DLLPRIVATE void StorageBackup_Impl();
+ SAL_DLLPRIVATE OUString GetBackup_Impl();
+
+ SAL_DLLPRIVATE css::uno::Reference< css::embed::XStorage > GetZipStorageToSign_Impl( sal_Bool bReadOnly = sal_True );
+ SAL_DLLPRIVATE void CloseZipStorage_Impl();
+
+ // the storage that will be returned by the medium on GetStorage request
+ SAL_DLLPRIVATE void SetStorage_Impl( const css::uno::Reference< css::embed::XStorage >& xNewStorage );
+
+ SAL_DLLPRIVATE css::uno::Reference< css::io::XInputStream > GetInputStream_Impl();
+ SAL_DLLPRIVATE void CloseAndReleaseStreams_Impl();
+ SAL_DLLPRIVATE sal_uInt16 AddVersion_Impl( css::util::RevisionTag& rVersion );
+ SAL_DLLPRIVATE sal_Bool TransferVersionList_Impl( SfxMedium& rMedium );
+ SAL_DLLPRIVATE sal_Bool SaveVersionList_Impl( sal_Bool bUseXML );
+ SAL_DLLPRIVATE sal_Bool RemoveVersion_Impl( const OUString& rVersion );
+
+ SAL_DLLPRIVATE void SetExpired_Impl( const DateTime& rDateTime );
+ SAL_DLLPRIVATE SvKeyValueIterator* GetHeaderAttributes_Impl();
+
+ // Diese Protokolle liefern MIME Typen
+ SAL_DLLPRIVATE sal_Bool SupportsMIME_Impl() const;
+
+ SAL_DLLPRIVATE void Init_Impl();
+ SAL_DLLPRIVATE void ForceSynchronStream_Impl( sal_Bool bSynchron );
+
+ SAL_DLLPRIVATE void GetLockingStream_Impl();
+ SAL_DLLPRIVATE void GetMedium_Impl();
+ SAL_DLLPRIVATE sal_Bool TryDirectTransfer( const OUString& aURL, SfxItemSet& aTargetSet );
+ SAL_DLLPRIVATE void Transfer_Impl();
+ SAL_DLLPRIVATE void CreateFileStream();
+ SAL_DLLPRIVATE void SetUpdatePickList(sal_Bool);
+ SAL_DLLPRIVATE sal_Bool IsUpdatePickList() const;
+
+ SAL_DLLPRIVATE void SetLongName(const OUString &rName);
+ SAL_DLLPRIVATE const OUString & GetLongName() const;
+ SAL_DLLPRIVATE ErrCode CheckOpenMode_Impl( sal_Bool bSilent, sal_Bool bAllowRO = sal_True );
+ SAL_DLLPRIVATE sal_Bool IsPreview_Impl();
+ SAL_DLLPRIVATE void ClearBackup_Impl();
+ SAL_DLLPRIVATE void Done_Impl( ErrCode );
+ SAL_DLLPRIVATE void SetPhysicalName_Impl(const OUString& rName);
+ SAL_DLLPRIVATE void CanDisposeStorage_Impl( sal_Bool bDisposeStorage );
+ SAL_DLLPRIVATE sal_Bool WillDisposeStorageOnClose_Impl();
+
+ SAL_DLLPRIVATE void DoBackup_Impl();
+ SAL_DLLPRIVATE void DoInternalBackup_Impl( const ::ucbhelper::Content& aOriginalContent );
+ SAL_DLLPRIVATE void DoInternalBackup_Impl( const ::ucbhelper::Content& aOriginalContent,
+ const String& aPrefix,
+ const String& aExtension,
+ const String& aDestDir );
+
+ SAL_DLLPRIVATE sal_Bool UseBackupToRestore_Impl( ::ucbhelper::Content& aOriginalContent,
+ const css::uno::Reference< css::ucb::XCommandEnvironment >& xComEnv );
+
+ SAL_DLLPRIVATE sal_Bool StorageCommit_Impl();
+
+ SAL_DLLPRIVATE sal_Bool TransactedTransferForFS_Impl( const INetURLObject& aSource,
+ const INetURLObject& aDest,
+ const css::uno::Reference< css::ucb::XCommandEnvironment >& xComEnv );
+
+ SAL_DLLPRIVATE sal_Bool SignContents_Impl( sal_Bool bScriptingContent, const OUString& aODFVersion, sal_Bool bHasValidDocumentSignature );
+
+ // the following two methods must be used and make sence only during saving currently
+ // TODO/LATER: in future the signature state should be controlled by the medium not by the document
+ // in this case the methods will be used generally, and might need to be renamed
+ SAL_DLLPRIVATE sal_uInt16 GetCachedSignatureState_Impl();
+ SAL_DLLPRIVATE void SetCachedSignatureState_Impl( sal_uInt16 nState );
+
+ static css::uno::Sequence < css::util::RevisionTag > GetVersionList(
+ const css::uno::Reference< css::embed::XStorage >& xStorage );
+ static OUString CreateTempCopyWithExt( const OUString& aURL );
+ static sal_Bool CallApproveHandler( const css::uno::Reference< css::task::XInteractionHandler >& xHandler, css::uno::Any aRequest, sal_Bool bAllowAbort );
+
+ static sal_Bool SetWritableForUserOnly( const OUString& aURL );
+ static sal_uInt32 CreatePasswordToModifyHash( const OUString& aPasswd, sal_Bool bWriter );
+};
+
+SV_DECL_IMPL_REF( SfxMedium )
+
+typedef ::std::vector< SfxMedium* > SfxMediumList;
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/docfilt.hxx b/include/sfx2/docfilt.hxx
new file mode 100644
index 000000000000..cc6f6b8c1971
--- /dev/null
+++ b/include/sfx2/docfilt.hxx
@@ -0,0 +1,126 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX_DOCFILT_HACK_HXX
+#define _SFX_DOCFILT_HACK_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include "sal/types.h"
+#include <com/sun/star/plugin/PluginDescription.hpp>
+#include <com/sun/star/embed/XStorage.hpp>
+#include <com/sun/star/beans/UnknownPropertyException.hpp>
+#include <com/sun/star/lang/WrappedTargetException.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <tools/wldcrd.hxx>
+
+#include <comphelper/documentconstants.hxx>
+#define SFX_FILTER_STARTPRESENTATION 0x20000000L
+
+#include <sfx2/sfxdefs.hxx>
+
+class SfxFilterContainer;
+class SotStorage;
+
+class SFX2_DLLPUBLIC SfxFilter
+{
+ friend class SfxFilterContainer;
+
+ WildCard aWildCard;
+
+ OUString aTypeName;
+ OUString aUserData;
+ OUString aServiceName;
+ OUString aMimeType;
+ OUString maFilterName;
+ OUString aPattern;
+ OUString aUIName;
+ OUString aDefaultTemplate;
+
+ /**
+ * Custom provider name in case the filter is provided via external
+ * libraries. Empty for conventional filter types.
+ */
+ OUString maProvider;
+
+ SfxFilterFlags nFormatType;
+ sal_uIntPtr nVersion;
+ sal_uIntPtr lFormat;
+ sal_uInt16 nDocIcon;
+
+public:
+ SfxFilter( const OUString& rProvider, const OUString& rFilterName );
+
+ SfxFilter( const OUString &rName,
+ const OUString &rWildCard,
+ SfxFilterFlags nFormatType,
+ sal_uInt32 lFormat,
+ const OUString &rTypeName,
+ sal_uInt16 nDocIcon,
+ const OUString &rMimeType,
+ const OUString &rUserData,
+ const OUString& rServiceName );
+ ~SfxFilter();
+
+ bool IsAllowedAsTemplate() const { return nFormatType & SFX_FILTER_TEMPLATE; }
+ bool IsOwnFormat() const { return nFormatType & SFX_FILTER_OWN; }
+ bool IsOwnTemplateFormat() const { return nFormatType & SFX_FILTER_TEMPLATEPATH; }
+ bool IsAlienFormat() const { return nFormatType & SFX_FILTER_ALIEN; }
+ bool CanImport() const { return nFormatType & SFX_FILTER_IMPORT; }
+ bool CanExport() const { return nFormatType & SFX_FILTER_EXPORT; }
+ bool IsInternal() const { return nFormatType & SFX_FILTER_INTERNAL; }
+ SfxFilterFlags GetFilterFlags() const { return nFormatType; }
+ const OUString& GetFilterName() const { return maFilterName; }
+ const OUString& GetMimeType() const { return aMimeType; }
+ const OUString& GetName() const { return maFilterName; }
+ const WildCard& GetWildcard() const { return aWildCard; }
+ const OUString& GetRealTypeName() const { return aTypeName; }
+ sal_uIntPtr GetFormat() const { return lFormat; }
+ const OUString& GetTypeName() const { return aTypeName; }
+ const OUString& GetUIName() const { return aUIName; }
+ sal_uInt16 GetDocIconId() const { return nDocIcon; }
+ const OUString& GetUserData() const { return aUserData; }
+ const OUString& GetDefaultTemplate() const { return aDefaultTemplate; }
+ void SetDefaultTemplate( const String& rStr ) { aDefaultTemplate = rStr; }
+ bool UsesStorage() const { return GetFormat() != 0; }
+ void SetURLPattern( const OUString& rStr );
+ OUString GetURLPattern() const { return aPattern; }
+ void SetUIName( const String& rName ) { aUIName = rName; }
+ void SetVersion( sal_uIntPtr nVersionP ) { nVersion = nVersionP; }
+ sal_uIntPtr GetVersion() const { return nVersion; }
+ OUString GetSuffixes() const;
+ OUString GetDefaultExtension() const;
+ const OUString& GetServiceName() const { return aServiceName; }
+ const OUString& GetProviderName() const;
+
+ static const SfxFilter* GetDefaultFilter( const String& rName );
+ static const SfxFilter* GetFilterByName( const String& rName );
+ static const SfxFilter* GetDefaultFilterFromFactory( const String& rServiceName );
+
+ static OUString GetTypeFromStorage( const SotStorage& rStg );
+ static OUString GetTypeFromStorage(
+ const com::sun::star::uno::Reference<com::sun::star::embed::XStorage>& xStorage,
+ bool bTemplate = false, OUString* pName = NULL )
+ throw ( com::sun::star::beans::UnknownPropertyException,
+ com::sun::star::lang::WrappedTargetException,
+ com::sun::star::uno::RuntimeException );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/docinf.hxx b/include/sfx2/docinf.hxx
new file mode 100644
index 000000000000..8ab57ffe2ae4
--- /dev/null
+++ b/include/sfx2/docinf.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXDOCINF_HXX
+#define _SFXDOCINF_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include "sal/types.h"
+#include <com/sun/star/uno/Reference.hxx>
+
+
+class GDIMetaFile;
+class SotStorage;
+
+namespace com { namespace sun { namespace star {
+ namespace document {
+ class XDocumentProperties;
+ }
+} } }
+
+
+namespace sfx2 {
+
+/** load document meta-data from OLE stream
+
+ @param i_xDocProps Document meta-data
+ @param i_pStorage OLE Storage
+ */
+sal_uInt32 SFX2_DLLPUBLIC LoadOlePropertySet(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XDocumentProperties> i_xDocProps,
+ SotStorage* i_pStorage );
+
+/** save document meta-data to OLE stream
+
+ @param i_xDocProps Document meta-data
+ @param i_pStorage OLE Storage
+ @param i_pThumb Thumbnail: preview bitmap
+ @param i_pGuid Blob: Guid blob ("_PID_GUID")
+ @param i_pHyperlinks Blob: Hyperlink blob ("_PID_HLINKS")
+ */
+bool SFX2_DLLPUBLIC SaveOlePropertySet(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XDocumentProperties> i_xDocProps,
+ SotStorage* i_pStorage,
+ const ::com::sun::star::uno::Sequence<sal_uInt8> * i_pThumb = 0,
+ const ::com::sun::star::uno::Sequence<sal_uInt8> * i_pGuid = 0,
+ const ::com::sun::star::uno::Sequence<sal_uInt8> * i_pHyperlinks = 0);
+
+
+::com::sun::star::uno::Sequence<sal_uInt8> SFX2_DLLPUBLIC convertMetaFile(
+ GDIMetaFile* i_pThumb);
+
+} // namespace sfx2
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/docinsert.hxx b/include/sfx2/docinsert.hxx
new file mode 100644
index 000000000000..cefcf034f48e
--- /dev/null
+++ b/include/sfx2/docinsert.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SFX_DOCINSERT_HXX
+#define _SFX_DOCINSERT_HXX
+
+#include <tools/errcode.hxx>
+#include <tools/link.hxx>
+#include <tools/string.hxx>
+#include <vector>
+
+#include "sfx2/dllapi.h"
+
+namespace sfx2 { class FileDialogHelper; }
+class SfxMedium;
+class SfxItemSet;
+
+typedef ::std::vector< SfxMedium* > SfxMediumList;
+
+namespace sfx2 {
+
+class SFX2_DLLPUBLIC DocumentInserter
+{
+private:
+ String m_sDocFactory;
+ String m_sFilter;
+ Link m_aDialogClosedLink;
+
+ sal_Int64 const m_nDlgFlags;
+ ErrCode m_nError;
+
+ sfx2::FileDialogHelper* m_pFileDlg;
+ SfxItemSet* m_pItemSet;
+ std::vector<OUString> m_pURLList;
+
+ DECL_LINK(DialogClosedHdl, void *);
+
+public:
+ DocumentInserter(const String& rFactory,
+ bool const bEnableMultiSelection = false);
+ ~DocumentInserter();
+
+ void StartExecuteModal( const Link& _rDialogClosedLink );
+ SfxMedium* CreateMedium();
+ SfxMediumList* CreateMediumList();
+
+ inline ErrCode GetError() const { return m_nError; }
+ inline String GetFilter() const { return m_sFilter; }
+};
+
+} // namespace sfx2
+
+#endif // _SFX_DOCINSERT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/dockwin.hxx b/include/sfx2/dockwin.hxx
new file mode 100644
index 000000000000..d64b6ed7a6f7
--- /dev/null
+++ b/include/sfx2/dockwin.hxx
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXDOCKWIN_HXX
+#define _SFXDOCKWIN_HXX
+
+#include "sal/config.h"
+#include "sal/types.h"
+#include <vcl/dockwin.hxx>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+
+#include "sfx2/dllapi.h"
+#include <sfx2/childwin.hxx>
+
+class SfxSplitWindow;
+class SfxDockingWindow_Impl;
+
+void SFX2_DLLPUBLIC SAL_CALL SfxDockingWindowFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const OUString& rDockingWindowName );
+bool SFX2_DLLPUBLIC SAL_CALL IsDockingWindowVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const OUString& rDockingWindowName );
+
+class SFX2_DLLPUBLIC SfxDockingWindow : public DockingWindow
+{
+private:
+ Rectangle aInnerRect;
+ Rectangle aOuterRect;
+ SfxBindings* pBindings;
+ Size aFloatSize;
+ SfxChildWindow* pMgr;
+ SfxDockingWindow_Impl* pImp;
+
+ SAL_DLLPRIVATE SfxDockingWindow(SfxDockingWindow &); // not defined
+ SAL_DLLPRIVATE void operator =(SfxDockingWindow &); // not defined
+
+protected:
+ SfxChildAlignment CalcAlignment(const Point& rPos, Rectangle& rRect );
+ void CalcSplitPosition(const Point rPos, Rectangle& rRect,
+ SfxChildAlignment eAlign);
+ virtual Size CalcDockingSize(SfxChildAlignment);
+ virtual SfxChildAlignment
+ CheckAlignment(SfxChildAlignment,SfxChildAlignment);
+
+ virtual void Resize();
+ virtual sal_Bool PrepareToggleFloatingMode();
+ virtual void ToggleFloatingMode();
+ virtual void StartDocking();
+ virtual sal_Bool Docking( const Point& rPos, Rectangle& rRect );
+ virtual void EndDocking( const Rectangle& rRect, sal_Bool bFloatMode );
+ virtual void Resizing( Size& rSize );
+ virtual void Paint( const Rectangle& rRect );
+ virtual sal_Bool Close();
+ virtual void Move();
+
+ SAL_DLLPRIVATE SfxChildWindow* GetChildWindow_Impl() { return pMgr; }
+
+public:
+ SfxDockingWindow( SfxBindings *pBindings,
+ SfxChildWindow *pCW,
+ Window* pParent,
+ WinBits nWinBits=0);
+ SfxDockingWindow( SfxBindings *pBindings,
+ SfxChildWindow *pCW,
+ Window* pParent,
+ const ResId& rResId);
+ ~SfxDockingWindow();
+
+ void Initialize (SfxChildWinInfo* pInfo);
+ virtual void FillInfo(SfxChildWinInfo&) const;
+ virtual void StateChanged( StateChangedType nStateChange );
+
+ void SetDockingRects(const Rectangle& rOuter, const Rectangle& rInner)
+ { aInnerRect = rInner; aOuterRect = rOuter; }
+ const Rectangle& GetInnerRect() const { return aInnerRect; }
+ const Rectangle& GetOuterRect() const { return aOuterRect; }
+ SfxBindings& GetBindings() const { return *pBindings; }
+ sal_uInt16 GetType() const { return pMgr->GetType(); }
+ SfxChildAlignment GetAlignment() const { return pMgr->GetAlignment(); }
+ void SetAlignment(SfxChildAlignment eAlign) { pMgr->SetAlignment(eAlign); }
+ Size GetFloatingSize() const { return aFloatSize; }
+ void SetFloatingSize(const Size& rSize) { aFloatSize=rSize; }
+
+ void SetMinOutputSizePixel( const Size& rSize );
+ Size GetMinOutputSizePixel() const;
+ virtual long Notify( NotifyEvent& rNEvt );
+ virtual void FadeIn( sal_Bool );
+ void AutoShow( sal_Bool bShow = sal_True );
+ DECL_LINK(TimerHdl, void *);
+
+ SAL_DLLPRIVATE void Initialize_Impl();
+ SAL_DLLPRIVATE sal_uInt16 GetWinBits_Impl() const;
+ SAL_DLLPRIVATE void SetItemSize_Impl( const Size& rSize );
+ SAL_DLLPRIVATE void Disappear_Impl();
+ SAL_DLLPRIVATE void Reappear_Impl();
+ SAL_DLLPRIVATE sal_Bool IsAutoHide_Impl() const;
+ SAL_DLLPRIVATE void AutoShow_Impl( sal_Bool bShow = sal_True );
+ SAL_DLLPRIVATE void Pin_Impl( sal_Bool bPinned );
+ SAL_DLLPRIVATE void ReleaseChildWindow_Impl();
+};
+
+class SfxDockingWrapper : public SfxChildWindow
+{
+ public:
+ SfxDockingWrapper( Window* pParent ,
+ sal_uInt16 nId ,
+ SfxBindings* pBindings ,
+ SfxChildWinInfo* pInfo );
+
+ SFX_DECL_CHILDWINDOW(SfxDockingWrapper);
+};
+
+#endif // #ifndef _SFXDOCKWIN_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/docmacromode.hxx b/include/sfx2/docmacromode.hxx
new file mode 100644
index 000000000000..4e089d7e3d55
--- /dev/null
+++ b/include/sfx2/docmacromode.hxx
@@ -0,0 +1,328 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SFX2_DOCMACROMODE_HXX
+#define SFX2_DOCMACROMODE_HXX
+
+#include "sfx2/dllapi.h"
+
+#include <com/sun/star/task/XInteractionHandler.hpp>
+#include <com/sun/star/embed/XStorage.hpp>
+#include <com/sun/star/script/XLibraryContainer.hpp>
+#include <com/sun/star/document/XEmbeddedScripts.hpp>
+
+#include <boost/shared_ptr.hpp>
+
+//........................................................................
+namespace sfx2
+{
+//........................................................................
+
+ //====================================================================
+ //= IMacroDocumentAccess
+ //====================================================================
+ /** provides access to several settings of a document, which are needed by ->DocumentMacroMode
+ to properly determine the current macro execution mode of this document
+ */
+ class SAL_NO_VTABLE IMacroDocumentAccess
+ {
+ public:
+ /** retrieves the current MacroExecutionMode.
+
+ Usually, this is initialized from the media descriptor used to load the document,
+ respectively the one passed into the document's XModel::attachResource call.
+
+ If no such mode was passed there, document implementations should return
+ MacroExecMode::NEVER_EXECUTE.
+
+ @see ::com::sun::star::document::MediaDescriptor::MacroExecutionMode
+ @see ::com::sun::star::frame::XComponentLoader::loadComponentFromURL
+ @see ::com::sun::star::frame::XModel::attachResource
+
+ @see setCurrentMacroExecMode
+
+ @todo
+ Effectively, this is the MacroExecutionMode of the MediaDescriptor of
+ the document. Thus, this setting could be obtained from the XModel
+ directly. We should introduce a getDocumentModel method here, which
+ can be used for this and other purposes.
+ */
+ virtual sal_Int16
+ getCurrentMacroExecMode() const = 0;
+
+ /** sets the MacroExecutionMode of the document, as calculated by the DocumentMacroMode
+ class.
+
+ Effectively, the existence of this method means that the responsibility
+ to store the current macro execution mode is not with the DocumentMacroMode
+ instance, but with the document instance itself.
+
+ Usually, a document implementation will simply put the macro execution mode
+ into its media descriptor, as returned by XModel::getArgs.
+
+ @see ::com::sun::star::document::MediaDescriptor::MacroExecutionMode
+ @see ::com::sun::star::frame::XComponentLoader::loadComponentFromURL
+ @see ::com::sun::star::frame::XModel::attachResource
+
+ see getCurrentMacroExecMode
+ */
+ virtual sal_Bool
+ setCurrentMacroExecMode( sal_uInt16 ) = 0;
+
+ /** returns the origin of the document
+
+ This usually is the document's location, or, if the document has been
+ newly created from a template, then the location of the template. Location
+ here means the complete path of the document, including the file name.
+
+ @todo
+ This probably can also be obtained from the XModel, by calling getURL
+ or getLocation. If both are empty, then we need an UNO way to obtain
+ the URL of the underlying template document - if any. If we have this,
+ we could replace this method with a newly introduced method
+ getDocumentModel and some internal code.
+ */
+ virtual OUString
+ getDocumentLocation() const = 0;
+
+ /** returns a zip-storage based on the last commited version of the document,
+ for readonly access
+
+ The storage is intended to be used for signing. An implementation is
+ allowed to return <NULL/> here if and only if the document
+ does not support signing the script storages.
+
+ @todo
+ UNOize this, too. Once we have a getDocumentModel, we should be able to
+ obtain the "last commit" storage via UNO API, provided it's an
+ XStorageBasedDocument.
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
+ getZipStorageToSign() = 0;
+
+ /** checks whether the document's storage contains sub storages with macros or scripts
+
+ A default implementation of this method will simply cann DocumentMacroMode::storageHasMacros
+ with the document's root storage. However, there might be document types where this
+ isn't sufficient (e.g. database documents which contain sub documents which can also
+ contain macro/script storages).
+ */
+ virtual sal_Bool
+ documentStorageHasMacros() const = 0;
+
+ /** provides access to the XEmbeddedScripts interface of the document
+
+ Implementations are allowed to return <NULL/> here if and only if they
+ do not (yet) support embedding scripts.
+
+ @todo
+ can also be replaced with a call to the (to be introduced) getDocumentModel
+ method, and a queryInterface.
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::document::XEmbeddedScripts >
+ getEmbeddedDocumentScripts() const = 0;
+
+ /** returns the state of the signatures for the scripts embedded in the document
+
+ Note: On the medium run, the signature handling of a document should be outsourced
+ into a dedicated class, instead of being hard-wired into the SfxObjectShell. This
+ class could then be used outside the SfxObjectShell (e.g. in Base documents), too.
+ When this happens, this method here becomes should be replaced by a method at this
+ new class.
+
+ @seealso <sfx2/signaturestate.hxx>
+ */
+ virtual sal_Int16
+ getScriptingSignatureState() = 0;
+
+ /** allows to detect whether there is a trusted scripting signature
+
+ Note: On the medium run, the signature handling of a document should be outsourced
+ into a dedicated class, instead of being hard-wired into the SfxObjectShell. This
+ class could then be used outside the SfxObjectShell (e.g. in Base documents), too.
+ When this happens, this method here should be replaced by a method at this
+ new class.
+
+ @seealso <sfx2/signaturestate.hxx>
+ */
+ virtual sal_Bool
+ hasTrustedScriptingSignature( sal_Bool bAllowUIToAddAuthor ) = 0;
+
+ /** shows a warning that the document's signature is broken
+
+ Here, a similar note applies as to getScriptingSignatureState: This method doesn't
+ really belong here. It's just there because SfxObjectShell_Impl::bSignatureErrorIsShown
+ is not accessible where the method is called.
+ So, once the signature handling has been oursourced from SfxObjectShell/_Impl, so it
+ is re-usable in non-SFX contexts as well, this method here is also unneeded, probably.
+
+ @param _rxInteraction
+ the interaction handler to use for showing the warning. It is exactly the same
+ as passed to DocumentMacroMode::adjustMacroMode, so it is <NULL/> if and
+ only if the instance passed to that method was <NULL/>.
+ */
+ virtual void
+ showBrokenSignatureWarning(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxInteraction
+ ) const = 0;
+
+ protected:
+ ~IMacroDocumentAccess() {}
+ };
+
+ //====================================================================
+ //= DocumentMacroMode
+ //====================================================================
+ struct DocumentMacroMode_Data;
+
+ /** encapsulates handling the macro mode of a document
+
+ @see com::sun::star::document::MacroExecMode
+ */
+ class SFX2_DLLPUBLIC DocumentMacroMode
+ {
+ public:
+ /** creates an instance
+
+ @param _rDocumentAccess
+ access to the document which this instance works for. Must live as long as the
+ DocumentMacroMode instance lives, at least
+ */
+ DocumentMacroMode( IMacroDocumentAccess& _rDocumentAccess );
+ ~DocumentMacroMode();
+
+ /** allows macro execution in the document
+
+ Effectively, the macro mode is set to MacroExecMode::ALWAYS_EXECUTE_NO_WARN.
+
+ @return
+ <TRUE/>, always
+ */
+ sal_Bool allowMacroExecution();
+
+ /** disallows macro execution in the document
+
+ Effectively, the macro mode is set to MacroExecMode::NEVER_EXECUTE.
+
+ @return
+ <TRUE/>, always
+ */
+ sal_Bool disallowMacroExecution();
+
+ /** checks whether the document allows executing contained macros.
+
+ The method transforms the current macro execution mode into either
+ ALWAYS_EXECUTE_NO_WARN or NEVER_EXECUTE, depending on the current value,
+ possible configuration settings, and possible user interaction.
+
+ @param _rxInteraction
+ A handler for interactions which might become necessary.
+ This includes
+ <ul><li>Asking the user for confirmation for macro execution.</li>
+ <li>Telling the user that macro execution is disabled.</li>
+ </ul>
+
+ If the user needs to be asked for macro execution confirmation, and if
+ this parameter is <NULL/>, the most defensive assumptions will be made,
+ effectively disabling macro execution.
+
+ @return
+ <TRUE/> if and only if macro execution in this document is allowed.
+ */
+ sal_Bool adjustMacroMode(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxInteraction
+ );
+
+ /** determines whether macro execution is disallowed
+
+ There's a number of reasons why macro execution could be disallowed:
+ <ul><li>Somebody called ->disallowMacroExecution</li>
+ <li>Macro execution is disabled globally, via the security options</li>
+ <li>Macro execution mode was not defined initially, and the user denied
+ executing macros for this particular document.</li>
+ </ul>
+
+ Note that if this method returns <FALSE/>, then subsequent calls of
+ ->adjustMacroMode can still return <FALSE/>.
+ That is, if the current macro execution mode for the document is not yet known
+ (and inparticular <em>not</em> MacroExecMode::NEVER_EXECUTE), then ->isMacroExecutionDisallowed
+ will return <FALSE/>.
+ However, a subsequent call to ->adjustMacroMode can result in the user
+ denying macro execution, in which ->adjustMacroMode will return <FALSE/>,
+ and the next call to isMacroExecutionDisallowed will return <TRUE/>.
+ */
+ sal_Bool isMacroExecutionDisallowed() const;
+
+ /** determines whether the document actually has a macros library
+
+ Effectively, this method checks the Basic library container (as returned by
+ IMacroDocumentAccess::getEmbeddedDocumentScripts().getBasicLibraries) for
+ content.
+ */
+ sal_Bool hasMacroLibrary() const;
+
+ /** determines whether the given document storage has sub storages containing scripts
+ or macros.
+
+ Effectively, the method checks for the presence of a sub-storage name "Scripts" (where
+ BeanShell-/JavaScript-/Python-Scripts are stored, and a sub storage named "Basic" (where
+ Basic scripts are stored).
+ */
+ static sal_Bool
+ storageHasMacros( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _rxStorage );
+
+ static sal_Bool containerHasBasicMacros( const ::com::sun::star::uno::Reference< ::com::sun::star::script::XLibraryContainer >& xContainter );
+ /** checks the macro execution mode while loading the document.
+
+ This must be called when the loading is effectively finished, but before any macro action
+ happened.
+
+ The method will disallow macro execution for this document if it is disabled
+ globally (SvtSecurityOptions::IsMacroDisabled). Otherwise, it will check whether
+ the document contains a macro storage or macro libraries. If so, it will
+ properly calculate the MacroExecutionMode by calling adjustMacroMode.
+
+ If the document doesn't contain macros, yet, then the macro execution for this
+ document will be allowed (again: unless disabled globally), since in this case
+ macros which later are newly created by the user should be allowed, of course.
+
+ @return
+ <TRUE/> if and only if macro execution is allowed in the document
+
+ @see isMacroExecutionDisallowed
+ @see IMacroDocumentAccess::documentStorageHasMacros
+ @see hasMacroLibrary
+ @see IMacroDocumentAccess::checkForBrokenScriptingSignatures
+ */
+ sal_Bool
+ checkMacrosOnLoading(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxInteraction
+ );
+
+ private:
+ ::boost::shared_ptr< DocumentMacroMode_Data > m_pData;
+ };
+
+//........................................................................
+} // namespace sfx2
+//........................................................................
+
+#endif // SFX2_DOCMACROMODE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/docstoragemodifylistener.hxx b/include/sfx2/docstoragemodifylistener.hxx
new file mode 100644
index 000000000000..c361b8768260
--- /dev/null
+++ b/include/sfx2/docstoragemodifylistener.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SFX2_DOCSTORAGEMODIFYLISTENER_HXX
+#define SFX2_DOCSTORAGEMODIFYLISTENER_HXX
+
+#include "sfx2/dllapi.h"
+
+#include <com/sun/star/util/XModifyListener.hpp>
+
+#include <cppuhelper/implbase1.hxx>
+
+
+//........................................................................
+namespace sfx2
+{
+//........................................................................
+
+ //====================================================================
+ //= IModifiableDocument
+ //====================================================================
+ /** callback for the DocumentStorageModifyListener class
+ */
+ class SAL_NO_VTABLE IModifiableDocument
+ {
+ public:
+ /// indicates the root or a sub storage of the document has been modified
+ virtual void storageIsModified() = 0;
+
+ protected:
+ ~IModifiableDocument() {}
+ };
+
+ //====================================================================
+ //= DocumentStorageModifyListener
+ //====================================================================
+ typedef ::cppu::WeakImplHelper1 < ::com::sun::star::util::XModifyListener > DocumentStorageModifyListener_Base;
+
+ class SFX2_DLLPUBLIC DocumentStorageModifyListener : public DocumentStorageModifyListener_Base
+ {
+ IModifiableDocument* m_pDocument;
+ ::osl::SolarMutex& m_rMutex;
+
+ public:
+ DocumentStorageModifyListener( IModifiableDocument& _rDocument, ::osl::SolarMutex& _rMutex );
+
+ void dispose();
+
+ // XModifyListener
+ virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+
+ protected:
+ virtual ~DocumentStorageModifyListener();
+
+ private:
+ DocumentStorageModifyListener(); // never implemented
+ DocumentStorageModifyListener( const DocumentStorageModifyListener& ); // never implemented
+ DocumentStorageModifyListener& operator=( const DocumentStorageModifyListener& ); // never implemented
+ };
+
+//........................................................................
+} // namespace sfx2
+//........................................................................
+
+#endif // SFX2_DOCSTORAGEMODIFYLISTENER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/doctempl.hxx b/include/sfx2/doctempl.hxx
new file mode 100644
index 000000000000..a5b24cf81993
--- /dev/null
+++ b/include/sfx2/doctempl.hxx
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXDOCTEMPL_HXX
+#define _SFXDOCTEMPL_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include "sal/types.h"
+#include <tools/ref.hxx>
+#include <tools/string.hxx>
+
+// CLASS -----------------------------------------------------------------
+
+class SfxObjectShell;
+
+#ifndef SFX_DECL_OBJECTSHELL_DEFINED
+#define SFX_DECL_OBJECTSHELL_DEFINED
+SV_DECL_REF(SfxObjectShell)
+#endif
+
+class SfxDocTemplate_Impl;
+
+#ifndef SFX_DECL_DOCTEMPLATES_DEFINED
+#define SFX_DECL_DOCTEMPLATES_DEFINED
+SV_DECL_REF(SfxDocTemplate_Impl)
+#endif
+
+// class SfxDocumentTemplates --------------------------------------------
+
+class SFX2_DLLPUBLIC SfxDocumentTemplates
+{
+private:
+ SfxDocTemplate_ImplRef pImp;
+
+ SAL_DLLPRIVATE sal_Bool CopyOrMove( sal_uInt16 nTargetRegion, sal_uInt16 nTargetIdx,
+ sal_uInt16 nSourceRegion, sal_uInt16 nSourceIdx, sal_Bool bMove );
+public:
+ SfxDocumentTemplates();
+ SfxDocumentTemplates(const SfxDocumentTemplates &);
+ ~SfxDocumentTemplates();
+
+ sal_Bool IsConstructed() { return pImp != NULL; }
+ void Construct();
+
+ const SfxDocumentTemplates &operator=(const SfxDocumentTemplates &);
+
+ void ReInitFromComponent();
+
+ sal_uInt16 GetRegionCount() const;
+ const String& GetRegionName(sal_uInt16 nIdx) const; //dv!
+ String GetFullRegionName(sal_uInt16 nIdx) const;
+
+ sal_uInt16 GetCount(sal_uInt16 nRegion) const;
+ const String& GetName(sal_uInt16 nRegion, sal_uInt16 nIdx) const; //dv!
+ String GetPath(sal_uInt16 nRegion, sal_uInt16 nIdx) const;
+
+ // Allows to retrieve the target template URL from the UCB
+ OUString GetTemplateTargetURLFromComponent( const OUString& aGroupName,
+ const OUString& aTitle );
+
+ // Convert a resource string - a template name - to its localised pair
+ // if it exists in templatelocnames.src
+ static OUString ConvertResourceString(int nSourceResIds,
+ int nDestResIds,
+ int nCount,
+ const OUString& rString);
+
+ sal_Bool Copy(sal_uInt16 nTargetRegion,
+ sal_uInt16 nTargetIdx,
+ sal_uInt16 nSourceRegion,
+ sal_uInt16 nSourceIdx);
+ sal_Bool Move(sal_uInt16 nTargetRegion,
+ sal_uInt16 nTargetIdx,
+ sal_uInt16 nSourceRegion,
+ sal_uInt16 nSourceIdx);
+ sal_Bool Delete(sal_uInt16 nRegion, sal_uInt16 nIdx);
+ sal_Bool InsertDir(const String &rText, sal_uInt16 nRegion);
+
+ sal_Bool InsertTemplate (sal_uInt16 nSourceRegion, sal_uInt16 nIdx, const OUString &rName, const OUString &rPath);
+
+ /** Change the name of an entry or a directory
+
+ \param rName
+ The new name to set
+ \param nRegion
+ The id of the region to rename or containing the template to rename
+ \param nIdx
+ The id of the template to rename or USHRT_MAX to rename the region.
+
+ \return
+ sal_True if the action could be performed, sal_False otherwise
+
+ */
+ sal_Bool SetName(const OUString &rName, sal_uInt16 nRegion, sal_uInt16 nIdx);
+
+ sal_Bool CopyTo(sal_uInt16 nRegion, sal_uInt16 nIdx, const String &rName) const;
+ sal_Bool CopyFrom(sal_uInt16 nRegion, sal_uInt16 nIdx, String &rName);
+
+ sal_Bool GetFull( const String& rRegion, const String& rName, String& rPath );
+ sal_Bool GetLogicNames( const String& rPath, String& rRegion, String& rName ) const;
+
+ /** updates the configuration where the document templates structure is stored.
+
+ <p>The info about the document templates (which files, which groups etc.) is stored in the
+ configuration. This means that just by copying files into OOo's template directories, this
+ change is not reflected in the SfxDocumentTemplates - 'cause the configuration is not synchronous with
+ the file system. This can be enforced with this method.</p>
+
+ @param _bSmart
+ The update of the configuration is rather expensive - nothing you want to do regulary if you don't really
+ need it. So you have the possibility to do a smart update - it first checks if the update if necessary.
+ In case the update is needed, the additional check made it somewhat more expensive. In case it's not
+ necessary (which should be the usual case), the check alone is (much) less expensive than the real update.
+ <br/>
+ So set <arg>_bSmart</arg> to <TRUE/> to do a check for necessity first.
+ */
+ void Update( sal_Bool _bSmart = sal_True );
+};
+
+#endif // #ifndef _SFXDOCTEMPL_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/event.hxx b/include/sfx2/event.hxx
new file mode 100644
index 000000000000..bcdc88ec2edb
--- /dev/null
+++ b/include/sfx2/event.hxx
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXEVENT_HXX
+#define _SFXEVENT_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include <tools/string.hxx>
+#include <svl/hint.hxx>
+#include <unotools/eventcfg.hxx>
+#include <rtl/ustring.hxx>
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/frame/XController2.hpp>
+
+class SfxObjectShell;
+
+//-------------------------------------------------------------------
+
+class SFX2_DLLPUBLIC SfxEventHint : public SfxHint
+{
+ SfxObjectShell* pObjShell;
+ OUString aEventName;
+ sal_uInt16 nEventId;
+
+public:
+ TYPEINFO();
+ SfxEventHint( sal_uInt16 nId, const OUString& aName, SfxObjectShell *pObj = 0 )
+ : pObjShell(pObj),
+ aEventName(aName),
+ nEventId(nId)
+ {}
+
+ sal_uInt16 GetEventId() const
+ { return nEventId; }
+
+ OUString GetEventName() const
+ { return aEventName; }
+
+ SfxObjectShell* GetObjShell() const
+ { return pObjShell; }
+};
+
+//-------------------------------------------------------------------
+
+class SFX2_DLLPUBLIC SfxViewEventHint : public SfxEventHint
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController2 > xViewController;
+
+public:
+ TYPEINFO();
+
+ SfxViewEventHint( sal_uInt16 nId, const OUString& aName, SfxObjectShell *pObj, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& xController )
+ : SfxEventHint( nId, aName, pObj )
+ , xViewController( xController, ::com::sun::star::uno::UNO_QUERY )
+ {}
+
+ SfxViewEventHint( sal_uInt16 nId, const OUString& aName, SfxObjectShell *pObj, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController2 >& xController )
+ : SfxEventHint( nId, aName, pObj )
+ , xViewController( xController )
+ {}
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController2 > GetController() const
+ { return xViewController; }
+};
+
+//-------------------------------------------------------------------
+
+class SfxNamedHint : public SfxHint
+{
+ String _aEventName;
+ SfxObjectShell* _pObjShell;
+ String _aArgs;
+
+public:
+ TYPEINFO();
+
+ SfxNamedHint( const String& rName,
+ const String& rArgs,
+ SfxObjectShell *pObj = 0 )
+ : _aEventName( rName ),
+ _pObjShell( pObj),
+ _aArgs( rArgs )
+ {}
+
+ SfxNamedHint( const String& rName,
+ SfxObjectShell *pObj = 0 )
+ : _aEventName( rName ),
+ _pObjShell( pObj )
+ {}
+
+ const String& GetArgs() const { return _aArgs;}
+ const String& GetName() const { return _aEventName; }
+ SfxObjectShell* GetObjShell() const { return _pObjShell; }
+};
+
+class Printer;
+class SfxPrintingHint : public SfxHint
+{
+ sal_Int32 nWhich;
+ com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > aOpts;
+public:
+ TYPEINFO();
+ SfxPrintingHint( sal_Int32 nEvent, const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& rOpts )
+ : nWhich( nEvent )
+ , aOpts( rOpts )
+ {}
+
+ SfxPrintingHint( sal_Int32 nEvent )
+ : nWhich( nEvent )
+ {}
+
+ sal_Int32 GetWhich() const { return nWhich; }
+ const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& GetOptions() { return aOpts; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/evntconf.hxx b/include/sfx2/evntconf.hxx
new file mode 100644
index 000000000000..2f181ad820b1
--- /dev/null
+++ b/include/sfx2/evntconf.hxx
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX_EVENTCONF_HXX
+#define _SFX_EVENTCONF_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include "sal/types.h"
+#include <tools/rtti.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+
+#include <sfx2/event.hxx>
+
+#include <sfx2/sfxsids.hrc>
+#ifdef ITEMID_MACRO
+#undef ITEMID_MACRO
+#endif
+#define ITEMID_MACRO SID_ATTR_MACROITEM
+#include <svl/macitem.hxx>
+#include <vector>
+
+class SfxObjectShell;
+class SvxMacroTableDtor;
+
+struct SFX2_DLLPUBLIC SfxEventName
+{
+ sal_uInt16 mnId;
+ String maEventName;
+ String maUIName;
+
+ SfxEventName( sal_uInt16 nId,
+ const String& rEventName,
+ const String& rUIName )
+ : mnId( nId )
+ , maEventName( rEventName )
+ , maUIName( rUIName ) {}
+};
+
+typedef ::std::vector< SfxEventName* > _SfxEventNamesList;
+
+class SFX2_DLLPUBLIC SfxEventNamesList
+{
+private:
+ _SfxEventNamesList aEventNamesList;
+ void DelDtor();
+
+public:
+ SfxEventNamesList() {}
+ SfxEventNamesList( const SfxEventNamesList &rCpy ) { *this = rCpy; }
+ ~SfxEventNamesList() { DelDtor(); }
+ SfxEventNamesList& operator=( const SfxEventNamesList &rCpy );
+
+ size_t size() const { return aEventNamesList.size(); };
+
+ SfxEventName* at( size_t Index ) const
+ { return Index < aEventNamesList.size() ? aEventNamesList[ Index ] : NULL; }
+
+ void push_back( SfxEventName* Item ) { aEventNamesList.push_back( Item ); }
+};
+
+class SFX2_DLLPUBLIC SfxEventNamesItem : public SfxPoolItem
+{
+ SfxEventNamesList aEventsList;
+
+public:
+ TYPEINFO();
+
+ SfxEventNamesItem ( const sal_uInt16 nId ) : SfxPoolItem( nId ) {}
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper * = 0 ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const;
+
+ const SfxEventNamesList& GetEvents() const { return aEventsList;}
+ void SetEvents( const SfxEventNamesList& rList ) { aEventsList = rList; }
+ void AddEvent( const String&, const String&, sal_uInt16 );
+};
+
+// -----------------------------------------------------------------------
+
+#define PROP_EVENT_TYPE "EventType"
+#define PROP_LIBRARY "Library"
+#define PROP_SCRIPT "Script"
+#define PROP_MACRO_NAME "MacroName"
+#define STAR_BASIC "StarBasic"
+
+class SFX2_DLLPUBLIC SfxEventConfiguration
+{
+public:
+ static void ConfigureEvent( OUString aName, const SvxMacro&, SfxObjectShell* pObjSh);
+ static SvxMacro* ConvertToMacro( const com::sun::star::uno::Any& rElement, SfxObjectShell* pDoc, sal_Bool bBlowUp );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/fcontnr.hxx b/include/sfx2/fcontnr.hxx
new file mode 100644
index 000000000000..de7d9a961de4
--- /dev/null
+++ b/include/sfx2/fcontnr.hxx
@@ -0,0 +1,153 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX_FCONTNR_HXX
+#define _SFX_FCONTNR_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include "sal/types.h"
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <svl/poolitem.hxx>
+#include <vcl/window.hxx>
+
+#include <sfx2/docfilt.hxx>
+#include <sfx2/sfxdefs.hxx>
+
+#include <tools/ref.hxx>
+
+#include <boost/utility.hpp>
+
+class Window;
+class SfxFilter;
+class SfxObjectFactory;
+class SfxMedium;
+class SfxFilterContainer_Impl;
+class SfxFrame;
+
+//#define SFX_FILTER_CONTAINER_FACTORY 1
+typedef sal_uInt16 SfxFilterContainerFlags;
+
+class SfxRefItem : public SfxPoolItem
+{
+ SvRefBaseRef aRef;
+public:
+ virtual SfxPoolItem* Clone( SfxItemPool* = 0 ) const
+ { return new SfxRefItem( *this ); }
+ virtual int operator==( const SfxPoolItem& rL) const
+ { return ((SfxRefItem&)rL).aRef == aRef; }
+ SfxRefItem( sal_uInt16 nWhichId, const SvRefBaseRef& rValue ) : SfxPoolItem( nWhichId )
+ { aRef = rValue; }
+ const SvRefBaseRef& GetValue() const { return aRef; }
+
+};
+
+class SfxFrameWindow
+{
+ Window* pWindow;
+public:
+ SfxFrameWindow( Window *pWin )
+ : pWindow( pWin )
+ {}
+
+ virtual ~SfxFrameWindow()
+ { delete pWindow; }
+ Window* GetWindow() const
+ { return pWindow; }
+ void SetWindow( Window *pWin )
+ { pWindow = pWin; }
+};
+
+typedef sal_uIntPtr (*SfxDetectFilter)( SfxMedium& rMedium, const SfxFilter **, SfxFilterFlags nMust, SfxFilterFlags nDont );
+
+class SFX2_DLLPUBLIC SfxFilterContainer
+{
+ SfxFilterContainer_Impl *pImpl;
+
+public:
+ SfxFilterContainer( const String& rName );
+ ~SfxFilterContainer();
+
+
+ const String GetName() const;
+
+ const SfxFilter* GetAnyFilter( SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
+ const SfxFilter* GetFilter4EA( const String& rEA, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
+ const SfxFilter* GetFilter4Extension( const String& rExt, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
+ const SfxFilter* GetFilter4FilterName( const String& rName, SfxFilterFlags nMust = 0, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
+
+ SAL_DLLPRIVATE static void ReadFilters_Impl( sal_Bool bUpdate=sal_False );
+ SAL_DLLPRIVATE static void ReadSingleFilter_Impl( const OUString& rName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& xTypeCFG,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& xFilterCFG,
+ sal_Bool bUpdate );
+ SAL_DLLPRIVATE static const SfxFilter* GetDefaultFilter_Impl( const String& );
+};
+
+class SfxFilterMatcher_Impl;
+
+class SFX2_DLLPUBLIC SfxFilterMatcher : private boost::noncopyable
+{
+ friend class SfxFilterMatcherIter;
+ SfxFilterMatcher_Impl &m_rImpl;
+public:
+ SfxFilterMatcher( const OUString& rFact );
+ SfxFilterMatcher();
+ ~SfxFilterMatcher();
+
+ SAL_DLLPRIVATE static sal_Bool IsFilterInstalled_Impl( const SfxFilter* pFilter );
+ DECL_DLLPRIVATE_STATIC_LINK( SfxFilterMatcher, MaybeFileHdl_Impl, String* );
+
+ sal_uInt32 GuessFilterIgnoringContent( SfxMedium& rMedium, const SfxFilter **, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
+ sal_uInt32 GuessFilter( SfxMedium& rMedium, const SfxFilter **, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
+ sal_uInt32 GuessFilterControlDefaultUI( SfxMedium& rMedium, const SfxFilter **, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED, sal_Bool bDefUI = sal_True ) const;
+ sal_uInt32 DetectFilter( SfxMedium& rMedium, const SfxFilter **, sal_Bool bPlugIn, sal_Bool bAPI = sal_False ) const;
+
+ const SfxFilter* GetFilter4Mime( const OUString& rMime, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED) const;
+ const SfxFilter* GetFilter4ClipBoardId( sal_uInt32 nId, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
+ const SfxFilter* GetFilter4EA( const String& rEA, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
+ const SfxFilter* GetFilter4Extension( const String& rExt, SfxFilterFlags nMust = SFX_FILTER_IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
+ const SfxFilter* GetFilter4FilterName( const String& rName, SfxFilterFlags nMust = 0, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
+ const SfxFilter* GetFilter4UIName( const String& rName, SfxFilterFlags nMust = 0, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
+ const SfxFilter* GetFilterForProps( const com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue >& aSeq, SfxFilterFlags nMust = 0, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
+ const SfxFilter* GetAnyFilter( SfxFilterFlags nMust=0, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED ) const;
+};
+
+class SfxFilterContainer_Impl;
+class SFX2_DLLPUBLIC SfxFilterMatcherIter : private boost::noncopyable
+
+{
+ SfxFilterFlags nOrMask;
+ SfxFilterFlags nAndMask;
+ sal_uInt16 nCurrent;
+ const SfxFilterMatcher_Impl &m_rMatch;
+
+ SAL_DLLPRIVATE const SfxFilter* Find_Impl();
+
+public:
+ SfxFilterMatcherIter( const SfxFilterMatcher& rMatcher, SfxFilterFlags nMask = 0, SfxFilterFlags nNotMask = SFX_FILTER_NOTINSTALLED );
+ const SfxFilter* First();
+ const SfxFilter* Next();
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/filedlghelper.hxx b/include/sfx2/filedlghelper.hxx
new file mode 100644
index 000000000000..304fd5cdff58
--- /dev/null
+++ b/include/sfx2/filedlghelper.hxx
@@ -0,0 +1,262 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _FILEDLGHELPER_HXX
+#define _FILEDLGHELPER_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include "sal/types.h"
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/solar.h>
+#include <tools/string.hxx>
+#include <tools/errcode.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/button.hxx>
+#include <vcl/graph.hxx>
+#include <sfx2/sfxdefs.hxx>
+#include <sfx2/sfxuno.hxx>
+#include <sfx2/docfilt.hxx>
+
+//-----------------------------------------------------------------------------
+
+namespace com
+{
+ namespace sun
+ {
+ namespace star
+ {
+ namespace ui
+ {
+ namespace dialogs
+ {
+ class XFilePicker;
+ class XFilePickerListener;
+ struct FilePickerEvent;
+ struct DialogClosedEvent;
+ }
+ }
+ }
+ }
+}
+
+class SfxItemSet;
+class Window;
+
+// the SFXWB constants are for the nFlags parameter of the constructor
+#define SFXWB_INSERT 0x04000000L // turn Open into Insert dialog
+#define SFXWB_EXPORT 0x40000000L // turn Save into Export dialog
+#define SFXWB_SAVEACOPY 0x00400000L // turn Save into Save a Copy dialog
+#define SFXWB_MULTISELECTION 0x20000000L
+#define SFXWB_GRAPHIC 0x00800000L // register graphic formats
+
+#define FILEDIALOG_FILTER_ALL "*.*"
+
+#define FILE_OPEN_SERVICE_NAME_OOO "com.sun.star.ui.dialogs.OfficeFilePicker"
+
+namespace sfx2 {
+
+class FileDialogHelper_Impl;
+
+class SFX2_DLLPUBLIC FileDialogHelper
+{
+public:
+ enum Context // context where the FileDialogHelper is used
+ {
+ UNKNOWN_CONTEXT, // unknown context
+ SW_INSERT_GRAPHIC, // insert graphic in writer
+ SW_INSERT_SOUND, // insert sound in writer
+ SW_INSERT_VIDEO, // insert video in writer
+ SC_INSERT_GRAPHIC, // insert graphic in calc
+ SC_INSERT_SOUND, // insert sound in calc
+ SC_INSERT_VIDEO, // insert video in calc
+ SD_INSERT_GRAPHIC, // insert graphic in draw
+ SD_INSERT_SOUND, // insert sound in draw
+ SD_INSERT_VIDEO, // insert video in draw
+ SD_EXPORT, // export in draw
+ SI_EXPORT, // export in impress
+ SW_EXPORT // export in writer
+ };
+
+private:
+ Link m_aDialogClosedLink;
+ ErrCode m_nError;
+
+ ::com::sun::star::uno::Reference < ::com::sun::star::ui::dialogs::XFilePickerListener > mxImp;
+ FileDialogHelper_Impl *mpImp;
+
+
+public:
+ FileDialogHelper( sal_Int16 nDialogType,
+ sal_Int64 nFlags,
+ Window* _pPreferredParent = NULL );
+
+ FileDialogHelper( sal_Int16 nDialogType,
+ sal_Int64 nFlags,
+ const String& rFactory,
+ SfxFilterFlags nMust = 0,
+ SfxFilterFlags nDont = 0 );
+
+ FileDialogHelper( sal_Int16 nDialogType,
+ sal_Int64 nFlags,
+ const String& rFactory,
+ sal_Int16 nDialog,
+ SfxFilterFlags nMust,
+ SfxFilterFlags nDont,
+ const String& rStandardDir,
+ const ::com::sun::star::uno::Sequence< OUString >& rBlackList);
+
+ FileDialogHelper( sal_Int16 nDialogType,
+ sal_Int64 nFlags,
+ const OUString& aFilterUIName,
+ const OUString& aExtName,
+ const OUString& rStandardDir,
+ const ::com::sun::star::uno::Sequence< OUString >& rBlackList,
+ Window* _pPreferredParent = NULL );
+
+
+ virtual ~FileDialogHelper();
+
+ ErrCode Execute();
+ void StartExecuteModal( const Link& rEndDialogHdl );
+ inline ErrCode GetError() const { return m_nError; }
+ sal_Int16 GetDialogType() const;
+ sal_Bool IsPasswordEnabled() const;
+ String GetRealFilter() const;
+
+ void SetTitle( const String& rNewTitle );
+ String GetPath() const;
+
+ /** @deprected: Don't use this method to retrieve the selected files
+ There are file picker which can provide multiple selected file which belong
+ to different folders. As this method always provides the root folder for all selected
+ files this cannot work.
+ */
+ ::com::sun::star::uno::Sequence< OUString > GetMPath() const;
+
+ /** Provides the selected files with full path information */
+ ::com::sun::star::uno::Sequence< OUString > GetSelectedFiles() const;
+
+ void AddFilter( const String& rFilterName, const String& rExtension );
+ void SetCurrentFilter( const String& rFilter );
+
+ /** sets an initial display directory/file name
+
+ @deprecated
+ don't use this method. It contains a lot of magic in determining whether the
+ last segment of the given path/URL denotes a file name or a folder, and by
+ definition, it cannot succeed with this magic *all* the time - there will
+ always be scenarios where it fails.
+
+ Use SetDisplayFolder and SetFileName.
+ */
+ void SetDisplayDirectory( const String& rPath );
+
+ /** sets a new folder whose content is to be displayed in the file picker
+
+ @param _rURL
+ specifies the URL of the folder whose content is to be displayed.<br/>
+ If the URL doesn't denote a valid (existent and accessible) folder, the
+ request is silently dropped.
+ @throws ::com::sun::star::uno::RuntimeException
+ if the invocation of any of the file picker or UCB methods throws a RuntimeException.
+ */
+ void SetDisplayFolder( const String& _rURL );
+
+ /** sets an initial file name to display
+
+ This method is usually used in "save-as" contexts, where the application should
+ suggest an initial name for the file to save.
+
+ Calling this method is nearly equivalent to calling <code>GetFilePicker().setDefaultName( _rFileName )</code>,
+ with the following differences:
+ <ul><li>The FileDialogHelper remembers the given file name, and upon execution,
+ strips its extension if the dialog is set up for "automatic file name extension".</li>
+ <li>Exceptions thrown from the <code>XFilePicker</code> are caught and silenced.</li>
+ </ul>
+ */
+ void SetFileName( const String& _rFileName );
+
+ String GetCurrentFilter() const;
+ String GetDisplayDirectory() const;
+ ErrCode GetGraphic( Graphic& rGraphic ) const;
+
+ ::com::sun::star::uno::Reference < ::com::sun::star::ui::dialogs::XFilePicker > GetFilePicker() const;
+
+ // XFilePickerListener methods
+ virtual void SAL_CALL FileSelectionChanged( const ::com::sun::star::ui::dialogs::FilePickerEvent& aEvent );
+ virtual void SAL_CALL DirectoryChanged( const ::com::sun::star::ui::dialogs::FilePickerEvent& aEvent );
+ virtual void SAL_CALL ControlStateChanged( const ::com::sun::star::ui::dialogs::FilePickerEvent& aEvent );
+ virtual void SAL_CALL DialogSizeChanged();
+ virtual OUString SAL_CALL HelpRequested( const ::com::sun::star::ui::dialogs::FilePickerEvent& aEvent );
+
+ // XDialogClosedListener methods
+ virtual void SAL_CALL DialogClosed( const ::com::sun::star::ui::dialogs::DialogClosedEvent& _rEvent );
+
+ /** sets help ids for the controls in the dialog
+ @param _pControlId
+ Pointer to a 0-terminated array of control ids. They must be recruited from the
+ CommonFilePickerElementIds and ExtendedFilePickerElementIds values.
+ @param _pHelpId
+ Pointer to an array of help ids. For each element in _pControlId, there must be
+ a corresponding element herein.
+ */
+ void SetControlHelpIds( const sal_Int16* _pControlId, const char** _pHelpId );
+ void CreateMatcher( const String& rName );
+
+ /** sets the context of the dialog and trigger necessary actions e.g. loading config, setting help id
+ @param _eNewContext
+ New context for the dialog.
+ */
+ void SetContext( Context _eNewContext );
+
+ DECL_LINK( ExecuteSystemFilePicker, void* );
+
+ ErrCode Execute( std::vector<OUString>& rpURLList,
+ SfxItemSet *& rpSet,
+ String& rFilter,
+ const String& rDirPath );
+ ErrCode Execute( SfxItemSet *& rpSet,
+ String& rFilter );
+};
+
+#define SFX2_IMPL_DIALOG_CONFIG 0
+#define SFX2_IMPL_DIALOG_SYSTEM 1
+#define SFX2_IMPL_DIALOG_OOO 2
+
+ErrCode FileOpenDialog_Impl( sal_Int16 nDialogType,
+ sal_Int64 nFlags,
+ const String& rFact,
+ std::vector<OUString>& rpURLList,
+ String& rFilter,
+ SfxItemSet *& rpSet,
+ const String* pPath = NULL,
+ sal_Int16 nDialog = SFX2_IMPL_DIALOG_CONFIG,
+ const String& rStandardDir = OUString(),
+ const ::com::sun::star::uno::Sequence< OUString >& rBlackList = ::com::sun::star::uno::Sequence< OUString >());
+
+
+ErrCode RequestPassword(const SfxFilter* pCurrentFilter, OUString& aURL, SfxItemSet* pSet);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/frame.hxx b/include/sfx2/frame.hxx
new file mode 100644
index 000000000000..63220cae1325
--- /dev/null
+++ b/include/sfx2/frame.hxx
@@ -0,0 +1,290 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXFRAME_HXX
+#define _SFXFRAME_HXX
+
+#ifndef TF_NEWDESKTOP
+#define TF_NEWDESKTOP 1
+#endif
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include "sal/types.h"
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+namespace com
+{
+ namespace sun
+ {
+ namespace star
+ {
+ namespace awt
+ {
+ class XWindow;
+ }
+ namespace frame
+ {
+ class XFrame;
+ class XFrameLoader;
+ class XController;
+ class XDispatchProviderInterceptor;
+ }
+ namespace beans
+ {
+ struct PropertyValue;
+ }
+ }
+ }
+}
+#include <tools/ref.hxx>
+#include <tools/string.hxx>
+#include <svl/brdcst.hxx>
+#include <svl/poolitem.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+#include <vector>
+
+class SvBorder;
+class SfxWorkWindow;
+class Window;
+class SfxFrame;
+class SfxFrame_Impl;
+class SfxObjectShell;
+class SfxObjectFactory;
+class SfxViewFrame;
+class SfxFrameDescriptor;
+class SfxFrameSetDescriptor;
+class SfxDispatcher;
+class Rectangle;
+class SfxRequest;
+class SfxUnoControllerItem;
+class SvCompatWeakHdl;
+class SystemWindow;
+
+class SfxFrame;
+typedef ::std::vector<SfxFrame*> SfxFrameArr_Impl;
+
+typedef ::std::vector< String* > TargetList;
+
+#define SFXFRAME_HASTITLE 0x0001
+
+//==========================================================================
+// SfxFrame is a management class for windows and their content.
+// A SfxApplication represent a hierarchy of SfxFrames, with which the actual
+// content in the derived classes is defined. The base class SfxFrame
+// implements two aspects of frames: naming and control of its lifespan.
+// Inside a frame hierarchy the parent frame always controls the lifespan of
+// its child frames, even though they usually are not even produced by the
+// parent. By calling DoCloser() on any frame in the hierarchy,
+// a part of the "framework" can be removed, where frames unsubscribe
+// from their parent frames.
+//==========================================================================
+
+class SFX2_DLLPUBLIC SfxFrame
+{
+ friend class SfxFrameIterator;
+ friend class SfxFrameWindow_Impl;
+
+private:
+ SfxFrame* pParentFrame;
+ SfxFrameArr_Impl* pChildArr;
+ SfxFrame_Impl* pImp;
+ Window* pWindow;
+
+protected:
+ sal_Bool Close();
+ virtual ~SfxFrame();
+
+ SAL_DLLPRIVATE void RemoveChildFrame_Impl( SfxFrame* );
+
+ SfxFrame( ); // not implemented
+ SAL_DLLPRIVATE SfxFrame( Window& i_rContainerWindow, bool bHidden );
+
+public:
+ TYPEINFO();
+
+ static SfxFrame* Create( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame );
+ static ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
+ CreateBlankFrame();
+ static SfxFrame* Create( SfxObjectShell& rDoc, Window& rWindow, sal_uInt16 nViewId, bool bHidden );
+
+ SvCompatWeakHdl* GetHdl();
+ Window& GetWindow() const;
+ void CancelTransfers( sal_Bool bCancelLoadEnv = sal_True );
+ sal_Bool DoClose();
+ sal_uInt16 GetChildFrameCount() const;
+ SfxFrame* GetChildFrame( sal_uInt16 nPos ) const;
+ SfxFrame* GetParentFrame() const
+ { return pParentFrame; }
+
+ void SetPresentationMode( sal_Bool bSet );
+ SystemWindow* GetSystemWindow() const;
+
+ static SfxFrame* GetFirst();
+ static SfxFrame* GetNext( SfxFrame& );
+
+ static const SfxPoolItem*
+ OpenDocumentSynchron( SfxItemSet& aSet, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rTargetFrame );
+
+ SfxObjectShell* GetCurrentDocument() const;
+ SfxViewFrame* GetCurrentViewFrame() const;
+ SfxFrame& GetTopFrame() const;
+ sal_Bool IsParent( SfxFrame* ) const;
+
+ sal_uInt32 GetFrameType() const;
+ void GetTargetList( TargetList& ) const;
+ SAL_DLLPRIVATE SfxFrame* GetContainingDocFrame_Impl( SfxFrame* pSelf );
+ void UpdateDescriptor( SfxObjectShell *pDoc );
+ void Resize();
+ sal_Bool HasComponent() const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >
+ GetComponent() const;
+ void ReleaseComponent();
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
+ GetFrameInterface() const;
+ void Appear();
+ void AppearWithUpdate();
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >
+ GetController() const;
+
+ sal_Bool IsInPlace() const;
+
+ SAL_DLLPRIVATE sal_Bool DoClose_Impl();
+ SAL_DLLPRIVATE void SetFrameInterface_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
+ SAL_DLLPRIVATE void ReleasingComponent_Impl( sal_Bool bSet );
+ SAL_DLLPRIVATE void GetViewData_Impl();
+ SAL_DLLPRIVATE void SetFrameType_Impl( sal_uInt32 );
+ SAL_DLLPRIVATE sal_uInt16 PrepareClose_Impl( sal_Bool bUI, sal_Bool bForBrowsing=sal_False );
+ SAL_DLLPRIVATE sal_Bool DocIsModified_Impl();
+ SAL_DLLPRIVATE void SetCurrentViewFrame_Impl( SfxViewFrame* );
+ SAL_DLLPRIVATE sal_Bool IsClosing_Impl() const;
+ SAL_DLLPRIVATE void SetIsClosing_Impl();
+
+ // Methods for accessing the current set
+ SAL_DLLPRIVATE SfxFrameDescriptor* GetDescriptor() const;
+
+ SAL_DLLPRIVATE void Lock_Impl( sal_Bool bLock );
+ SAL_DLLPRIVATE SfxDispatcher* GetDispatcher_Impl() const;
+ SAL_DLLPRIVATE sal_Bool IsAutoLoadLocked_Impl() const;
+
+ SAL_DLLPRIVATE static void InsertTopFrame_Impl( SfxFrame* pFrame );
+ SAL_DLLPRIVATE static void RemoveTopFrame_Impl( SfxFrame* pFrame );
+ SAL_DLLPRIVATE void SetOwnsBindings_Impl( sal_Bool bSet );
+ SAL_DLLPRIVATE sal_Bool OwnsBindings_Impl() const;
+ SAL_DLLPRIVATE void InvalidateUnoControllers_Impl();
+ SAL_DLLPRIVATE void RegisterUnoController_Impl( SfxUnoControllerItem* );
+ SAL_DLLPRIVATE void ReleaseUnoController_Impl( SfxUnoControllerItem* );
+ SAL_DLLPRIVATE SfxWorkWindow* GetWorkWindow_Impl() const;
+ SAL_DLLPRIVATE void SetToolSpaceBorderPixel_Impl( const SvBorder& );
+ SAL_DLLPRIVATE Rectangle GetTopOuterRectPixel_Impl() const;
+ SAL_DLLPRIVATE void CreateWorkWindow_Impl();
+ SAL_DLLPRIVATE void GrabFocusOnComponent_Impl();
+ SAL_DLLPRIVATE void SetInPlace_Impl( sal_Bool );
+
+ SAL_DLLPRIVATE void PrepareForDoc_Impl( SfxObjectShell& i_rDoc );
+ SAL_DLLPRIVATE void LockResize_Impl( sal_Bool bLock );
+ SAL_DLLPRIVATE void SetMenuBarOn_Impl( sal_Bool bOn );
+ SAL_DLLPRIVATE sal_Bool IsMenuBarOn_Impl() const;
+ SAL_DLLPRIVATE SystemWindow* GetTopWindow_Impl() const;
+ SAL_DLLPRIVATE bool IsMarkedHidden_Impl() const;
+private:
+ SAL_DLLPRIVATE void Construct_Impl();
+};
+
+SV_DECL_COMPAT_WEAK( SfxFrame )
+
+class SfxFrameIterator
+{
+ const SfxFrame* pFrame;
+ sal_Bool bRecursive;
+
+ SfxFrame* NextSibling_Impl( SfxFrame& rPrev );
+
+public:
+ SfxFrameIterator( const SfxFrame& rFrame, sal_Bool bRecursive=sal_True );
+ SfxFrame* FirstFrame();
+ SfxFrame* NextFrame( SfxFrame& rPrev );
+};
+
+//--------------------------------------------------------------------
+
+class SFX2_DLLPUBLIC SfxFrameItem: public SfxPoolItem
+{
+ SfxFrame* pFrame;
+ SfxFrameWeak wFrame;
+ SAL_DLLPRIVATE void SetFramePtr_Impl( SfxFrame* /*pFrameP*/ ) { pFrame = wFrame; }
+
+public:
+ TYPEINFO();
+
+ SfxFrameItem( sal_uInt16 nWhich, SfxViewFrame *p );
+ SfxFrameItem( SfxFrame *p=0 );
+ SfxFrameItem( sal_uInt16 nWhich, SfxFrame *p );
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual String GetValueText() const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ sal_Bool FrameKilled() const { return &wFrame != pFrame; }
+
+ SfxFrame* GetFrame() const
+ { return wFrame; }
+};
+
+class SFX2_DLLPUBLIC SfxUsrAnyItem : public SfxPoolItem
+{
+ ::com::sun::star::uno::Any aValue;
+public:
+ TYPEINFO();
+ SfxUsrAnyItem( sal_uInt16 nWhich, const ::com::sun::star::uno::Any& rAny );
+ ::com::sun::star::uno::Any GetValue() const
+ { return aValue; }
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+};
+
+class SFX2_DLLPUBLIC SfxUnoFrameItem : public SfxPoolItem
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
+ m_xFrame;
+
+public:
+ TYPEINFO();
+ SfxUnoFrameItem();
+ SfxUnoFrameItem( sal_uInt16 nWhich, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame );
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >&
+ GetFrame() const
+ { return m_xFrame; }
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+};
+
+typedef SfxUsrAnyItem SfxUnoAnyItem;
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/frmdescr.hxx b/include/sfx2/frmdescr.hxx
new file mode 100644
index 000000000000..2c0c178a3795
--- /dev/null
+++ b/include/sfx2/frmdescr.hxx
@@ -0,0 +1,259 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX_FRMDESCRHXX
+#define _SFX_FRMDESCRHXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+
+#include <sfx2/sfxsids.hrc>
+#include <svl/poolitem.hxx>
+#include <tools/urlobj.hxx>
+#include <tools/string.hxx>
+#include <tools/gen.hxx>
+
+class SvStream;
+struct SfxFrameDescriptor_Impl;
+class SfxFrameDescriptor;
+class Wallpaper;
+
+//===========================================================================
+// The SfxFrame descriptors build a recursive structure, that covers all the
+// required data in-order to display the frame document.
+// Through a SfxFrameSetDescriptor access is given to the whole underlying
+// structure. Due to the nature of the SfxFrames document, the
+// SfxFramesSetDescriptor is not only the content of this document, but also
+// describes the view on it. The FrameSet is made up of lines, which in turn,
+// contains the actual window . A line can be horizontally or vertically
+// aligned, from which also the alignment of the FrameSet is given.
+//===========================================================================
+
+enum ScrollingMode
+{
+ ScrollingYes,
+ ScrollingNo,
+ ScrollingAuto
+};
+
+enum SizeSelector
+{
+ SIZE_ABS,
+ SIZE_PERCENT,
+ SIZE_REL
+};
+
+#define BORDER_SET 2
+#define BORDER_YES 1
+#define BORDER_NO 0
+#define SPACING_NOT_SET -1L
+#define SIZE_NOT_SET -1L
+
+class SfxItemSet;
+struct SfxFrameProperties;
+
+class SFX2_DLLPUBLIC SfxFrameDescriptor
+{
+ INetURLObject aURL;
+ INetURLObject aActualURL;
+ String aName;
+ Size aMargin;
+ long nWidth;
+ ScrollingMode eScroll;
+ SizeSelector eSizeSelector;
+ sal_uInt16 nHasBorder;
+ sal_uInt16 nItemId;
+ sal_Bool bResizeHorizontal;
+ sal_Bool bResizeVertical;
+ sal_Bool bHasUI;
+ sal_Bool bReadOnly;
+ SfxFrameDescriptor_Impl* pImp;
+
+public:
+ SfxFrameDescriptor();
+ ~SfxFrameDescriptor();
+
+ // FileName/URL
+ SfxItemSet* GetArgs();
+ const INetURLObject& GetURL() const
+ { return aURL; }
+ void SetURL( const String& rURL );
+ const INetURLObject& GetActualURL() const
+ { return aActualURL; }
+ void SetActualURL( const INetURLObject& rURL );
+ void SetActualURL( const String& rURL );
+ void SetReadOnly( sal_Bool bSet ) { bReadOnly = bSet;}
+ sal_Bool IsReadOnly( ) const { return bReadOnly;}
+ void SetEditable( sal_Bool bSet );
+ sal_Bool IsEditable() const;
+
+ // Size
+ void SetWidth( long n )
+ { nWidth = n; }
+ void SetWidthPercent( long n )
+ { nWidth = n; eSizeSelector = SIZE_PERCENT; }
+ void SetWidthRel( long n )
+ { nWidth = n; eSizeSelector = SIZE_REL; }
+ void SetWidthAbs( long n )
+ { nWidth = n; eSizeSelector = SIZE_ABS; }
+ long GetWidth() const
+ { return nWidth; }
+ SizeSelector GetSizeSelector() const
+ { return eSizeSelector; }
+ sal_Bool IsResizable() const
+ { return bResizeHorizontal && bResizeVertical; }
+ void SetResizable( sal_Bool bRes )
+ { bResizeHorizontal = bResizeVertical = bRes; }
+
+ // FrameName
+ const String& GetName() const
+ { return aName; }
+ void SetName( const String& rName )
+ { aName = rName; }
+
+ // Margin, Scrolling
+ const Size& GetMargin() const
+ { return aMargin; }
+ void SetMargin( const Size& rMargin )
+ { aMargin = rMargin; }
+ ScrollingMode GetScrollingMode() const
+ { return eScroll; }
+ void SetScrollingMode( ScrollingMode eMode )
+ { eScroll = eMode; }
+
+ // FrameBorder
+ void SetWallpaper( const Wallpaper& rWallpaper );
+ sal_Bool HasFrameBorder() const;
+
+ sal_Bool IsFrameBorderOn() const
+ { return ( nHasBorder & BORDER_YES ) != 0; }
+
+ void SetFrameBorder( sal_Bool bBorder )
+ {
+ nHasBorder = bBorder ?
+ BORDER_YES | BORDER_SET :
+ BORDER_NO | BORDER_SET;
+ }
+ sal_Bool IsFrameBorderSet() const
+ { return (nHasBorder & BORDER_SET) != 0; }
+ void ResetBorder()
+ { nHasBorder = 0; }
+
+ sal_Bool HasUI() const
+ { return bHasUI; }
+ void SetHasUI( sal_Bool bOn )
+ { bHasUI = bOn; }
+
+ // Attribute for Splitwindow
+ sal_uInt16 GetItemId() const
+ { return nItemId; }
+ void SetItemId( sal_uInt16 nId )
+ { nItemId = nId; }
+
+ // Copy for example for Views
+ SfxFrameDescriptor* Clone( sal_Bool bWithIds = sal_True ) const;
+};
+
+// No block to implement a =operator
+struct SfxFrameProperties
+{
+ String aURL;
+ String aName;
+ long lMarginWidth;
+ long lMarginHeight;
+ long lSize;
+ long lSetSize;
+ long lFrameSpacing;
+ long lInheritedFrameSpacing;
+ ScrollingMode eScroll;
+ SizeSelector eSizeSelector;
+ SizeSelector eSetSizeSelector;
+ sal_Bool bHasBorder;
+ sal_Bool bBorderSet;
+ sal_Bool bResizable;
+ sal_Bool bSetResizable;
+ sal_Bool bIsRootSet;
+ sal_Bool bIsInColSet;
+ sal_Bool bHasBorderInherited;
+ SfxFrameDescriptor* pFrame;
+
+private:
+ SfxFrameProperties( SfxFrameProperties& ) {}
+public:
+ SfxFrameProperties()
+ : lMarginWidth( SIZE_NOT_SET ),
+ lMarginHeight( SIZE_NOT_SET ),
+ lSize( 1L ),
+ lSetSize( 1L ),
+ lFrameSpacing( SPACING_NOT_SET ),
+ lInheritedFrameSpacing( SPACING_NOT_SET ),
+ eScroll( ScrollingAuto ),
+ eSizeSelector( SIZE_REL ),
+ eSetSizeSelector( SIZE_REL ),
+ bHasBorder( sal_True ),
+ bBorderSet( sal_True ),
+ bResizable( sal_True ),
+ bSetResizable( sal_True ),
+ bIsRootSet( sal_False ),
+ bIsInColSet( sal_False ),
+ bHasBorderInherited( sal_True ),
+ pFrame( 0 ) {}
+
+ ~SfxFrameProperties() { delete pFrame; }
+
+ int operator ==( const SfxFrameProperties& ) const;
+ SfxFrameProperties& operator =( const SfxFrameProperties &rProp );
+};
+
+class SfxFrameDescriptorItem : public SfxPoolItem
+{
+ SfxFrameProperties aProperties;
+public:
+ TYPEINFO();
+
+ SfxFrameDescriptorItem ( const sal_uInt16 nId = SID_FRAMEDESCRIPTOR )
+ : SfxPoolItem( nId )
+ {}
+
+ SfxFrameDescriptorItem( const SfxFrameDescriptorItem& rCpy )
+ : SfxPoolItem( rCpy )
+ {
+ aProperties = rCpy.aProperties;
+ }
+
+ virtual ~SfxFrameDescriptorItem();
+
+ virtual int operator ==( const SfxPoolItem& ) const;
+ SfxFrameDescriptorItem& operator =( const SfxFrameDescriptorItem & );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+
+ const SfxFrameProperties& GetProperties() const
+ { return aProperties; }
+ void SetProperties( const SfxFrameProperties& rProp )
+ { aProperties = rProp; }
+};
+
+#endif // #ifndef _SFX_FRMDESCRHXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/frmhtml.hxx b/include/sfx2/frmhtml.hxx
new file mode 100644
index 000000000000..d1eb1c4054c0
--- /dev/null
+++ b/include/sfx2/frmhtml.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _FRMHTML_HXX
+#define _FRMHTML_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+
+#include <sfx2/frmdescr.hxx>
+#include <sfx2/sfxhtml.hxx>
+
+class SfxFrameHTMLParser;
+class SfxMedium;
+namespace svtools { class AsynchronLink; }
+
+class SFX2_DLLPUBLIC SfxFrameHTMLParser : public SfxHTMLParser
+{
+protected:
+ SfxFrameHTMLParser( SvStream& rStream, sal_Bool bIsNewDoc=sal_True, SfxMedium *pMediumPtr=0 ):
+ SfxHTMLParser( rStream, bIsNewDoc, pMediumPtr ) {};
+
+public:
+ // These methods can also be used by other parsers.
+ static void ParseFrameOptions(SfxFrameDescriptor*, const HTMLOptions&, const String& );
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/frmhtmlw.hxx b/include/sfx2/frmhtmlw.hxx
new file mode 100644
index 000000000000..3abdfbee3107
--- /dev/null
+++ b/include/sfx2/frmhtmlw.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _FRMHTMLW_HXX
+#define _FRMHTMLW_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include "sal/types.h"
+
+#include <sfx2/frmdescr.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <tools/stream.hxx>
+#include <svtools/parhtml.hxx>
+#include <svtools/htmlout.hxx>
+#include <svtools/htmlkywd.hxx>
+
+class SfxFrame;
+
+namespace com { namespace sun { namespace star {
+ namespace document {
+ class XDocumentProperties;
+ }
+} } }
+
+class SFX2_DLLPUBLIC SfxFrameHTMLWriter
+{
+ SAL_DLLPRIVATE static const sal_Char sNewLine[];
+ SAL_DLLPRIVATE static void OutMeta( SvStream& rStrm,
+ const sal_Char *pIndent, const String& rName,
+ const String& rContent, sal_Bool bHTTPEquiv,
+ rtl_TextEncoding eDestEnc,
+ String *pNonConvertableChars = 0 );
+ SAL_DLLPRIVATE inline static void OutMeta( SvStream& rStrm,
+ const sal_Char *pIndent, const sal_Char *pName,
+ const String& rContent, sal_Bool bHTTPEquiv,
+ rtl_TextEncoding eDestEnc,
+ String *pNonConvertableChars = 0 );
+
+public:
+ static void Out_DocInfo( SvStream& rStrm, const String& rBaseURL,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XDocumentProperties>&,
+ const sal_Char *pIndent,
+ rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
+ String *pNonConvertableChars = 0 );
+
+ static void Out_FrameDescriptor(
+ SvStream&, const String& rBaseURL, const com::sun::star::uno::Reference < com::sun::star::beans::XPropertySet >& xSet,
+ rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
+ String *pNonConvertableChars = 0 );
+};
+
+inline void SfxFrameHTMLWriter::OutMeta( SvStream& rStrm,
+ const sal_Char *pIndent, const sal_Char *pName,
+ const String& rContent, sal_Bool bHTTPEquiv,
+ rtl_TextEncoding eDestEnc,
+ String *pNonConvertableChars )
+{
+ String sTmp = OUString::createFromAscii(pName);
+ OutMeta( rStrm, pIndent, sTmp, rContent, bHTTPEquiv, eDestEnc, pNonConvertableChars );
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/genlink.hxx b/include/sfx2/genlink.hxx
new file mode 100644
index 000000000000..045047d9d0c7
--- /dev/null
+++ b/include/sfx2/genlink.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXGENLINK_HXX
+#define _SFXGENLINK_HXX
+
+
+#include <tools/link.hxx>
+typedef long (*CFuncPtr)(void*);
+
+class GenLink
+{
+ Link aLink;
+ CFuncPtr pFunc;
+
+public:
+ GenLink(): pFunc(0) {}
+ GenLink( CFuncPtr pCFunc ): pFunc(pCFunc) {}
+ GenLink( const Link& rLink ): aLink(rLink), pFunc(0) {}
+ GenLink( const GenLink& rOrig ):
+ aLink(rOrig.aLink), pFunc(rOrig.pFunc) {}
+
+ GenLink& operator = ( const GenLink& rOrig )
+ { pFunc = rOrig.pFunc; aLink = rOrig.aLink; return *this; }
+
+ sal_Bool operator!() const { return !aLink && !pFunc; }
+ sal_Bool IsSet() const { return aLink.IsSet() || pFunc; }
+
+ long Call( void* pCaller )
+ { return pFunc ? (*pFunc)(pCaller) : aLink.Call(pCaller); }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/hintpost.hxx b/include/sfx2/hintpost.hxx
new file mode 100644
index 000000000000..25adb3ea3d58
--- /dev/null
+++ b/include/sfx2/hintpost.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXHINTPOST_HXX
+#define _SFXHINTPOST_HXX
+
+#include <sfx2/genlink.hxx>
+#include <tools/ref.hxx>
+
+//===================================================================
+
+class SfxHint;
+
+//-------------------------------------------------------------------
+
+class SfxHintPoster: public SvRefBase
+
+/* [Description]
+
+ With instances of this class unique events per PostUserEvent can be sent
+ using the StarView-application. If the User-Event is triggered often,
+ the handler <Event()> is called, the base implementation with the
+ <SetEventHdl()> line is making these link calls.
+
+ The instance are held via Ref-Count at least as long as a possible sent
+ event has not arrived yet. Should be killed before the goal, before the
+ connection is SetEventHdl (GenLink ()) .
+*/
+
+{
+ GenLink aLink;
+
+private:
+ DECL_LINK( DoEvent_Impl, SfxHint * );
+
+protected:
+ virtual ~SfxHintPoster();
+ virtual void Event( SfxHint* pPostedHint );
+
+public:
+ SfxHintPoster( const GenLink& rLink );
+
+ void Post( SfxHint* pHint = 0 );
+ void SetEventHdl( const GenLink& rLink );
+};
+
+//-------------------------------------------------------------------
+
+SV_DECL_IMPL_REF(SfxHintPoster);
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/htmlmode.hxx b/include/sfx2/htmlmode.hxx
new file mode 100644
index 000000000000..0ce8e430869e
--- /dev/null
+++ b/include/sfx2/htmlmode.hxx
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX_HTMLMODE_HXX_
+#define _SFX_HTMLMODE_HXX_
+
+#define HTMLMODE_ON 0x0001
+#define HTMLMODE_PARA_DISTANCE 0x0004
+#define HTMLMODE_SOME_STYLES 0x0020 /* mind. MS IE */
+#define HTMLMODE_FULL_STYLES 0x0040 /* == SW */
+#define HTMLMODE_PARA_BLOCK 0x0100
+#define HTMLMODE_RESERVED1 0x4000
+#define HTMLMODE_RESERVED0 0x8000
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/imagemgr.hxx b/include/sfx2/imagemgr.hxx
new file mode 100644
index 000000000000..92df8e70c573
--- /dev/null
+++ b/include/sfx2/imagemgr.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/frame/XFrame.hpp>
+
+#include <rtl/ustring.hxx>
+#include <vcl/image.hxx>
+
+SFX2_DLLPUBLIC Image SAL_CALL GetImage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ const OUString& aURL,
+ bool bBig
+);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/imgmgr.hxx b/include/sfx2/imgmgr.hxx
new file mode 100644
index 000000000000..7ef278023336
--- /dev/null
+++ b/include/sfx2/imgmgr.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SFXIMGMGR_HXX
+#define _SFXIMGMGR_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+
+#include <sal/types.h>
+#include <vcl/image.hxx>
+
+class ToolBox;
+class SfxModule;
+class SfxImageManager_Impl;
+class SFX2_DLLPUBLIC SfxImageManager
+{
+ SfxImageManager_Impl* pImp;
+
+public:
+ static SfxImageManager* GetImageManager( SfxModule* );
+
+ SfxImageManager( SfxModule* pModule = 0 );
+ ~SfxImageManager();
+
+ void RegisterToolBox( ToolBox *pBox, sal_uInt16 nFlags=0xFFFF);
+ void ReleaseToolBox( ToolBox *pBox );
+
+ Image GetImage( sal_uInt16 nId, bool bLarge ) const;
+ Image GetImage( sal_uInt16 nId) const;
+ Image SeekImage( sal_uInt16 nId, bool bLarge ) const;
+ Image SeekImage( sal_uInt16 nId ) const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/infobar.hxx b/include/sfx2/infobar.hxx
new file mode 100644
index 000000000000..b91d01ad4927
--- /dev/null
+++ b/include/sfx2/infobar.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef _SFX2_MESSAGEBAR_HXX_
+#define _SFX2_MESSAGEBAR_HXX_
+
+#include <vector>
+
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+
+#include <sfx2/dllapi.h>
+#include <sfx2/childwin.hxx>
+
+/** SfxChildWindow for positioning the InfoBar in the view.
+ */
+class SFX2_DLLPUBLIC SfxInfoBarContainerChild : public SfxChildWindow
+{
+ private:
+ SfxBindings* m_pBindings;
+
+ public:
+ SfxInfoBarContainerChild( Window* pParent,
+ sal_uInt16 nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo );
+ virtual ~SfxInfoBarContainerChild();
+
+ SFX_DECL_CHILDWINDOW_WITHID( SfxInfoBarContainerChild );
+
+ void Update( );
+};
+
+/** Class representing a single InfoBar to be added in a SfxInfoBarContainerWindow.
+ */
+class SfxInfoBarWindow : public Window
+{
+ private:
+ OUString m_sId;
+ FixedText* m_pMessage;
+ Button* m_pCloseBtn;
+ std::vector< PushButton* > m_aActionBtns;
+
+ public:
+ SfxInfoBarWindow( Window* parent, const OUString& sId,
+ const OUString& sMessage,
+ std::vector< PushButton* > aButtons );
+ ~SfxInfoBarWindow( );
+
+ virtual const OUString& getId() const { return m_sId; }
+ virtual void Paint( const Rectangle& );
+ virtual void Resize( );
+
+ private:
+ DECL_LINK( CloseHandler, void* );
+};
+
+class SfxInfoBarContainerWindow : public Window
+{
+ private:
+ SfxInfoBarContainerChild* m_pChildWin;
+ std::vector< SfxInfoBarWindow* > m_pInfoBars;
+
+ public:
+ SfxInfoBarContainerWindow( SfxInfoBarContainerChild* pChildWin );
+ ~SfxInfoBarContainerWindow( );
+
+ void appendInfoBar( const OUString& sId, const OUString& sMessage, std::vector< PushButton* > aButtons );
+ SfxInfoBarWindow* getInfoBar( const OUString& sId );
+ void removeInfoBar( SfxInfoBarWindow* pInfoBar );
+
+ virtual void Resize( );
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/ipclient.hxx b/include/sfx2/ipclient.hxx
new file mode 100644
index 000000000000..e97b628d4b1a
--- /dev/null
+++ b/include/sfx2/ipclient.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX_IPCLIENT_HXX
+#define _SFX_IPCLIENT_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include "sal/types.h"
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/embed/Aspects.hpp>
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+
+#include <tools/gen.hxx>
+
+#include <sfx2/objsh.hxx>
+
+class SfxInPlaceClient_Impl;
+class SfxViewShell;
+class SfxObjectShell;
+class Window;
+class Fraction;
+
+//=========================================================================
+
+class SFX2_DLLPUBLIC SfxInPlaceClient
+{
+friend class SfxInPlaceClient_Impl;
+
+ SfxInPlaceClient_Impl* m_pImp;
+ SfxViewShell* m_pViewSh;
+ Window* m_pEditWin;
+
+ // called after the requested new object area was negotiated
+ SAL_DLLPRIVATE virtual void ObjectAreaChanged();
+
+ // an active object was resized by the user and now asks for the new space
+ SAL_DLLPRIVATE virtual void RequestNewObjectArea( Rectangle& );
+
+ // notify the client that an active object has changed its VisualAreaSize
+ SAL_DLLPRIVATE virtual void ViewChanged();
+
+ // an object wants to become visible
+ SAL_DLLPRIVATE virtual void MakeVisible();
+
+public:
+ SfxInPlaceClient( SfxViewShell* pViewShell, Window* pDraw, sal_Int64 nAspect = com::sun::star::embed::Aspects::MSOLE_CONTENT );
+ virtual ~SfxInPlaceClient();
+
+ SfxViewShell* GetViewShell() const { return m_pViewSh; }
+ Window* GetEditWin() const { return m_pEditWin; }
+ com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetObject() const;
+ void SetObject( const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject >& rObject );
+ void SetObjectState( sal_Int32 );
+ Size GetObjectVisAreaSize() const;
+ sal_Bool IsObjectUIActive() const;
+ sal_Bool IsObjectInPlaceActive() const;
+ void DeactivateObject();
+ sal_Bool SetObjArea( const Rectangle & );
+ Rectangle GetObjArea() const;
+ Rectangle GetScaledObjArea() const;
+ void SetSizeScale( const Fraction & rScaleWidth, const Fraction & rScaleHeight );
+ sal_Bool SetObjAreaAndScale( const Rectangle&, const Fraction&, const Fraction& );
+ const Fraction& GetScaleWidth() const;
+ const Fraction& GetScaleHeight() const;
+ void Invalidate();
+ static SfxInPlaceClient* GetClient( SfxObjectShell* pDoc, const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject >& xObject );
+ sal_Int64 GetAspect() const;
+ sal_Int64 GetObjectMiscStatus() const;
+ ErrCode DoVerb( long nVerb );
+ void VisAreaChanged();
+ void ResetObject();
+ sal_Bool IsUIActive();
+
+ virtual void FormatChanged(); // object format was changed (used for StarMath formulas aligning)
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/itemconnect.hxx b/include/sfx2/itemconnect.hxx
new file mode 100644
index 000000000000..95a545e3dad4
--- /dev/null
+++ b/include/sfx2/itemconnect.hxx
@@ -0,0 +1,578 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SFX_ITEMCONNECT_HXX
+#define SFX_ITEMCONNECT_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+
+#include <memory>
+#include <sfx2/itemwrapper.hxx>
+#include <sfx2/controlwrapper.hxx>
+
+// ============================================================================
+
+namespace sfx {
+
+// ============================================================================
+
+typedef int ItemConnFlags;
+
+/** No special state for the connection. */
+const ItemConnFlags ITEMCONN_NONE = 0x0000;
+
+/** Connection is inactive - virtual functions will not be called. */
+const ItemConnFlags ITEMCONN_INACTIVE = 0x0001;
+
+/** Enable control(s), if the item is known. */
+const ItemConnFlags ITEMCONN_ENABLE_KNOWN = 0x0010;
+/** Disable control(s), if the item is unknown. */
+const ItemConnFlags ITEMCONN_DISABLE_UNKNOWN = 0x0020;
+/** Show control(s), if the item is known. */
+const ItemConnFlags ITEMCONN_SHOW_KNOWN = 0x0040;
+/** Hide control(s), if the item is unknown. */
+const ItemConnFlags ITEMCONN_HIDE_UNKNOWN = 0x0080;
+
+/** Default value for constructors. */
+const ItemConnFlags ITEMCONN_DEFAULT = ITEMCONN_NONE;
+
+// ============================================================================
+// Base connection classes
+// ============================================================================
+
+/** A helper for SfxTabPages to connect controls to items.
+
+ This is the base class of all control connection classes. Their purpose is
+ to connect one or more controls from an SfxTabPage with an item from an
+ item set. The goal is to omit any additional code in the virtual functions
+ Reset() and FillItemSet() in classes derived from SfxTabPage.
+
+ Examples of connections:
+ - A check box with an SfxBoolItem,
+ - A metric (spin) field with an SfxInt32Item.
+ - A group of radio buttons with an SfxEnumItem.
+
+ Each SfxTabPage will contain a list of connection objects (derived from
+ this class). The connection objects remember the item and control(s) they
+ have to work on. The SfxTabPage will call the DoApplyFlags(), DoReset(),
+ and DoFillItemSet() functions of all connection objects it knows. The code
+ to initialize control(s) from the item value and fill the item from
+ control(s) has to be written only once for each control type.
+
+ Additional flags passed in the constructor allow to control the behaviour
+ of the control(s) if the item is supported/unsupported in the currently
+ used item set. For example, it is possible to specify that a control will
+ be disabled or hidden if the item is not supported. This is done before
+ each call of Reset().
+
+ The special flag ITEMCONN_CLONE_ITEM controls how to create new items in
+ the DoFillItemSet() function. The standard (and faster) method is to create
+ a temporary item on the stack and put it into the item set. But this does
+ not work if the item set expects a special item type derived from a common
+ item class, i.e. a Boolean item derived from SfxBoolItem providing special
+ item representation text. As this code does not know the item type, the
+ item cannot be created on the stack. For this case the flag specifies to
+ use the virtual Clone() method of the pool default item. This will create
+ an item of the correct type but can still be used in conjunction with i.e.
+ the standard BoolItemWrapper.
+
+ How to use the item connection feature:
+
+ A) Single item <-> single control connection
+
+ Example: An SfxBoolItem and a check box.
+
+ A1) Create a new item wrapper class derived from the SingleItemWrapper
+ template, or use the template directly, or use one of the
+ predefined item wrappers. See documentation of the
+ SingleItemWrapper template for details (itemwrapper.hxx).
+ A2) Create a new control wrapper class derived from the
+ SingleControlWrapper template and implement the abstract functions,
+ or use one of the predefined control wrappers. See documentation of
+ the SingleControlWrapper template for details (controlwrapper.hxx).
+ A3) Create a new connection class derived from one of the following
+ base classes, and implement the abstract functions, or use the
+ ItemControlConnection template directly, or use one of the
+ predefined connections.
+ A4) Create connection objects in the constructor of the tab page, and
+ insert them into the tab page with SfxTabPage::AddItemConnection().
+ A5) Remove old code from the tab page's Reset() and FillItemSet()
+ functions, if necessary.
+
+ B) Single item <-> multiple controls connections
+
+ B1) See step A1. If the item contains multiple values (and not a
+ structure that contains all the values for the different controls),
+ the best way is to use the IdentItemWrapper template, that works
+ with the item itself. This way it is possible to provide a 'data
+ type' that contains the values for all controls.
+ B2) Create a new control wrapper class derived from the
+ MultiControlWrapper template. Add single control wrapper members
+ for all controls to this class and register them in the
+ constructor, using the RegisterControlWrapper() function. Implement
+ the abstract functions GetControlValue() and SetControlValue().
+ These functions should call the respective functions of the own
+ single control wrappers and either fill a new data object (the item
+ itself in most cases, see step B1) with all the values from the
+ controls, or fill all the controls from the data object.
+ B3) Create a new connection class derived from ItemControlConnection,
+ or use the ItemControlConnection template directly. The multiple
+ control wrapper from step B2 acts like a single control, therefore
+ it is possible to use the ItemControlConnection.
+ B4) See steps A4 and A5.
+
+ C) Multiple items <-> single control connections
+
+ todo
+
+ D) Multiple items <-> multiple controls connections
+
+ todo
+
+ The current tree of base classes/templates and standard connections:
+
+ ItemConnectionBase
+ |
+ +- DummyItemConnection [1]
+ |
+ +- ItemControlConnection< ItemWrpT, ControlWrpT >
+ | |
+ | +- CheckBoxConnection [1]
+ | |
+ | +- NumericConnection< ItemWrpT > [1]
+ | | |
+ | | +- [ValueType]NumericConnection [1] [2]
+ | |
+ | +- MetricConnection< ItemWrpT > [1]
+ | | |
+ | | +- [ValueType]MetricConnection [1] [2]
+ | |
+ | +- ListBoxConnection< ItemWrpT > [1]
+ | | |
+ | | +- [ValueType]ListBoxConnection [1] [2]
+ | |
+ | +- ValueSetConnection< ItemWrpT > [1]
+ | |
+ | +- [ValueType]ValueSetConnection [1] [2]
+ |
+ +- ItemConnectionArray [1]
+
+ Notes:
+ [1] Standard connections ready to use.
+ [2] [ValueType] is one of Int16, UInt16, Int32, UInt32.
+ */
+class SFX2_DLLPUBLIC ItemConnectionBase
+{
+public:
+ virtual ~ItemConnectionBase();
+
+ /** Returns the flags passed in the constructor. */
+ inline ItemConnFlags GetFlags() const { return mnFlags; }
+
+ /** Returns true if this connection is active. */
+ bool IsActive() const;
+
+ /** Calls the virtual ApplyFlags() function, if connection is active. */
+ void DoApplyFlags( const SfxItemSet& rItemSet );
+ /** Calls the virtual Reset() function, if connection is active. */
+ void DoReset( const SfxItemSet& rItemSet );
+ /** Calls the virtual FillItemSet() function, if connection is active. */
+ bool DoFillItemSet( SfxItemSet& rDestSet, const SfxItemSet& rOldSet );
+
+protected:
+ explicit ItemConnectionBase( ItemConnFlags nFlags = ITEMCONN_DEFAULT );
+
+ /** Derived classes implement actions according to current flags here. */
+ virtual void ApplyFlags( const SfxItemSet& rItemSet ) = 0;
+ /** Derived classes implement initializing controls from item sets here. */
+ virtual void Reset( const SfxItemSet& rItemSet ) = 0;
+ /** Derived classes implement filling item sets from controls here. */
+ virtual bool FillItemSet( SfxItemSet& rDestSet, const SfxItemSet& rOldSet ) = 0;
+
+ /** Returns whether to enable a control, according to current flags. */
+ TriState GetEnableState( bool bKnown ) const;
+ /** Returns whether to show a control, according to current flags. */
+ TriState GetShowState( bool bKnown ) const;
+
+private:
+ /* Disable copy c'tor and assignment. */
+ ItemConnectionBase( const ItemConnectionBase& );
+ ItemConnectionBase& operator=( const ItemConnectionBase& );
+
+ ItemConnFlags mnFlags; /// Flags for additional options.
+};
+
+// ----------------------------------------------------------------------------
+
+/** Base class template for single item <-> single control connection objects.
+
+ This template uses functions provided by the SingleItemWrapper and the
+ SingleControlWrapper template classes. The virtual functions ApplyFlags(),
+ Reset(), and FillItemSet() are implemented here in a generic way using the
+ virtual functions of the wrapper classes. Derived classes only have to
+ create or otherwise provide appropriate wrappers.
+ */
+template< typename ItemWrpT, typename ControlWrpT >
+class ItemControlConnection : public ItemConnectionBase
+{
+public:
+ typedef ItemWrpT ItemWrapperType;
+ typedef ControlWrpT ControlWrapperType;
+ typedef ItemControlConnection< ItemWrpT, ControlWrpT > ItemControlConnectionType;
+ typedef typename ItemWrpT::ItemType ItemType;
+ typedef typename ItemWrpT::ItemValueType ItemValueType;
+ typedef typename ControlWrpT::ControlType ControlType;
+ typedef typename ControlWrpT::ControlValueType ControlValueType;
+
+ typedef std::auto_ptr< ItemWrpT > ItemWrapperRef;
+ typedef std::auto_ptr< ControlWrpT > ControlWrapperRef;
+
+ /** Receives pointer to a newly created control wrapper.
+ @descr Takes ownership of the control wrapper. */
+ explicit ItemControlConnection( sal_uInt16 nSlot, ControlWrpT* pNewCtrlWrp,
+ ItemConnFlags nFlags = ITEMCONN_DEFAULT );
+
+ /** Convenience constructor. Receives reference to a control directly.
+ @descr May only be used, if ControlWrpT::ControlWrpT( ControlType& )
+ constructor exists. */
+ explicit ItemControlConnection( sal_uInt16 nSlot, ControlType& rControl,
+ ItemConnFlags nFlags = ITEMCONN_DEFAULT );
+
+ virtual ~ItemControlConnection();
+
+protected:
+ /** Actions according to current flags for the control. */
+ virtual void ApplyFlags( const SfxItemSet& rItemSet );
+ /** Resets the control according to the item contents. */
+ virtual void Reset( const SfxItemSet& rItemSet );
+ /** Fills the item set according to the control's state. */
+ virtual bool FillItemSet( SfxItemSet& rDestSet, const SfxItemSet& rOldSet );
+
+ ItemWrapperType maItemWrp;
+ ControlWrapperRef mxCtrlWrp;
+};
+
+// ============================================================================
+// Standard connections
+// ============================================================================
+
+/** This is a helper class to enable/disable/show/hide a control only.
+
+ This class does nothing special in the Reset() and FillItemSet() functions.
+ It can be used to control the visibility of i.e. fixed lines or fixed texts
+ related to the availability of an item by passing the appropriate flags to
+ the constructor of this connection.
+ */
+class SFX2_DLLPUBLIC DummyItemConnection:
+ public ItemConnectionBase, public DummyWindowWrapper
+{
+public:
+ explicit DummyItemConnection( sal_uInt16 nSlot, Window& rWindow,
+ ItemConnFlags nFlags = ITEMCONN_DEFAULT );
+
+protected:
+ virtual void ApplyFlags( const SfxItemSet& rItemSet );
+ virtual void Reset( const SfxItemSet& rItemSet );
+ virtual bool FillItemSet( SfxItemSet& rDestSet, const SfxItemSet& rOldSet );
+
+private:
+ sal_uInt16 mnSlot;
+};
+
+// ----------------------------------------------------------------------------
+
+/** Connection between an SfxBoolItem and a VCL CheckBox. */
+typedef ItemControlConnection< BoolItemWrapper, CheckBoxWrapper > CheckBoxConnection;
+
+// ============================================================================
+
+/** Connection between an item and the VCL NumericField. */
+template< typename ItemWrpT >
+class NumericConnection : public ItemControlConnection< ItemWrpT,
+ NumericFieldWrapper< typename ItemWrpT::ItemValueType > >
+{
+ typedef ItemControlConnection< ItemWrpT,
+ NumericFieldWrapper< typename ItemWrpT::ItemValueType > >
+ ItemControlConnectionType;
+
+public:
+ typedef typename ItemControlConnectionType::ControlWrapperType NumericFieldWrapperType;
+
+ explicit NumericConnection( sal_uInt16 nSlot, NumericField& rField,
+ ItemConnFlags nFlags = ITEMCONN_DEFAULT );
+};
+
+// ----------------------------------------------------------------------------
+
+typedef NumericConnection< Int16ItemWrapper > Int16NumericConnection;
+typedef NumericConnection< UInt16ItemWrapper > UInt16NumericConnection;
+typedef NumericConnection< Int32ItemWrapper > Int32NumericConnection;
+typedef NumericConnection< UInt32ItemWrapper > UInt32NumericConnection;
+
+// ============================================================================
+
+/** Connection between an item and the VCL MetricField.
+
+ Adds support of different field units during control value <-> item value
+ conversion. The field unit passed to the constructor applies for the item
+ values, while the field unit used in the control has to be set at the
+ control itself.
+ */
+template< typename ItemWrpT >
+class MetricConnection : public ItemControlConnection< ItemWrpT,
+ MetricFieldWrapper< typename ItemWrpT::ItemValueType > >
+{
+ typedef ItemControlConnection< ItemWrpT,
+ MetricFieldWrapper< typename ItemWrpT::ItemValueType > >
+ ItemControlConnectionType;
+
+public:
+ typedef typename ItemControlConnectionType::ControlWrapperType MetricFieldWrapperType;
+
+ explicit MetricConnection( sal_uInt16 nSlot, MetricField& rField,
+ FieldUnit eItemUnit = FUNIT_NONE, ItemConnFlags nFlags = ITEMCONN_DEFAULT );
+};
+
+// ----------------------------------------------------------------------------
+
+typedef MetricConnection< Int16ItemWrapper > Int16MetricConnection;
+typedef MetricConnection< UInt16ItemWrapper > UInt16MetricConnection;
+typedef MetricConnection< Int32ItemWrapper > Int32MetricConnection;
+typedef MetricConnection< UInt32ItemWrapper > UInt32MetricConnection;
+
+// ============================================================================
+
+/** Connection between an item and a VCL ListBox.
+
+ Optionally a map can be passed that maps list box positions to item values.
+ This map MUST be terminated with an entry containing LISTBOX_ENTRY_NOTFOUND
+ as list box position. The item value contained in this last entry is used
+ as default item value in case of an error.
+ */
+template< typename ItemWrpT >
+class ListBoxConnection : public ItemControlConnection< ItemWrpT,
+ ListBoxWrapper< typename ItemWrpT::ItemValueType > >
+{
+ typedef ItemControlConnection< ItemWrpT,
+ ListBoxWrapper< typename ItemWrpT::ItemValueType > >
+ ItemControlConnectionType;
+
+public:
+ typedef typename ItemControlConnectionType::ControlWrapperType ListBoxWrapperType;
+ typedef typename ListBoxWrapperType::MapEntryType MapEntryType;
+
+ explicit ListBoxConnection( sal_uInt16 nSlot, ListBox& rListBox,
+ const MapEntryType* pMap = 0, ItemConnFlags nFlags = ITEMCONN_DEFAULT );
+};
+
+// ----------------------------------------------------------------------------
+
+typedef ListBoxConnection< Int16ItemWrapper > Int16ListBoxConnection;
+typedef ListBoxConnection< UInt16ItemWrapper > UInt16ListBoxConnection;
+typedef ListBoxConnection< Int32ItemWrapper > Int32ListBoxConnection;
+typedef ListBoxConnection< UInt32ItemWrapper > UInt32ListBoxConnection;
+
+// ============================================================================
+
+/** Connection between an item and an SVTOOLS ValueSet.
+
+ Optionally a map can be passed that maps value set identifiers to item
+ values. This map MUST be terminated with an entry containing
+ VALUESET_ITEM_NOTFOUND as value set identifier. The item value contained in
+ this last entry is used as default item value in case of an error.
+ */
+template< typename ItemWrpT >
+class ValueSetConnection : public ItemControlConnection< ItemWrpT,
+ ValueSetWrapper< typename ItemWrpT::ItemValueType > >
+{
+ typedef ItemControlConnection< ItemWrpT,
+ ValueSetWrapper< typename ItemWrpT::ItemValueType > >
+ ItemControlConnectionType;
+
+public:
+ typedef typename ItemControlConnectionType::ControlWrapperType ValueSetWrapperType;
+ typedef typename ValueSetWrapperType::MapEntryType MapEntryType;
+
+ explicit ValueSetConnection( sal_uInt16 nSlot, ValueSet& rValueSet,
+ const MapEntryType* pMap = 0, ItemConnFlags nFlags = ITEMCONN_DEFAULT );
+};
+
+// ----------------------------------------------------------------------------
+
+typedef ValueSetConnection< Int16ItemWrapper > Int16ValueSetConnection;
+typedef ValueSetConnection< UInt16ItemWrapper > UInt16ValueSetConnection;
+typedef ValueSetConnection< Int32ItemWrapper > Int32ValueSetConnection;
+typedef ValueSetConnection< UInt32ItemWrapper > UInt32ValueSetConnection;
+
+// ============================================================================
+// Array of connections
+// ============================================================================
+
+class ItemConnectionArrayImpl;
+
+/** A container of connection objects.
+
+ This is a connection with the only purpose to contain other connection
+ objects. This way it is possible to create a tree structure of connections
+ for a convenient connection management. This class is used by the class
+ SfxTabPage to store all connections.
+ */
+class ItemConnectionArray : public ItemConnectionBase
+{
+public:
+ explicit ItemConnectionArray();
+ virtual ~ItemConnectionArray();
+
+ /** Adds a new connection to the list.
+ @descr Takes ownership of the connection! */
+ void AddConnection( ItemConnectionBase* pConnection );
+
+protected:
+ virtual void ApplyFlags( const SfxItemSet& rItemSet );
+ virtual void Reset( const SfxItemSet& rItemSet );
+ virtual bool FillItemSet( SfxItemSet& rDestSet, const SfxItemSet& rOldSet );
+
+private:
+ std::auto_ptr< ItemConnectionArrayImpl > mxImpl;
+};
+
+// ============================================================================
+
+// ============================================================================
+// *** Implementation of template functions ***
+// ============================================================================
+
+// ============================================================================
+// Base connection classes
+// ============================================================================
+
+template< typename ItemWrpT, typename ControlWrpT >
+ItemControlConnection< ItemWrpT, ControlWrpT >::ItemControlConnection(
+ sal_uInt16 nSlot, ControlWrpT* pNewCtrlWrp, ItemConnFlags nFlags ) :
+ ItemConnectionBase( nFlags ),
+ maItemWrp( nSlot ),
+ mxCtrlWrp( pNewCtrlWrp )
+{
+}
+
+template< typename ItemWrpT, typename ControlWrpT >
+ItemControlConnection< ItemWrpT, ControlWrpT >::ItemControlConnection(
+ sal_uInt16 nSlot, ControlType& rControl, ItemConnFlags nFlags ) :
+ ItemConnectionBase( nFlags ),
+ maItemWrp( nSlot ),
+ mxCtrlWrp( new ControlWrpT( rControl ) )
+{
+}
+
+template< typename ItemWrpT, typename ControlWrpT >
+ItemControlConnection< ItemWrpT, ControlWrpT >::~ItemControlConnection()
+{
+}
+
+template< typename ItemWrpT, typename ControlWrpT >
+void ItemControlConnection< ItemWrpT, ControlWrpT >::ApplyFlags( const SfxItemSet& rItemSet )
+{
+ bool bKnown = ItemWrapperHelper::IsKnownItem( rItemSet, maItemWrp.GetSlotId() );
+ mxCtrlWrp->ModifyControl( GetEnableState( bKnown ), GetShowState( bKnown ) );
+}
+
+template< typename ItemWrpT, typename ControlWrpT >
+void ItemControlConnection< ItemWrpT, ControlWrpT >::Reset( const SfxItemSet& rItemSet )
+{
+ const ItemType* pItem = maItemWrp.GetUniqueItem( rItemSet );
+ mxCtrlWrp->SetControlDontKnow( pItem == 0 );
+ if( pItem )
+ mxCtrlWrp->SetControlValue( maItemWrp.GetItemValue( *pItem ) );
+}
+
+template< typename ItemWrpT, typename ControlWrpT >
+bool ItemControlConnection< ItemWrpT, ControlWrpT >::FillItemSet(
+ SfxItemSet& rDestSet, const SfxItemSet& rOldSet )
+{
+ const ItemType* pOldItem = maItemWrp.GetUniqueItem( rOldSet );
+ bool bChanged = false;
+ if( !mxCtrlWrp->IsControlDontKnow() )
+ {
+ // first store the control value in a local variable
+ ControlValueType aCtrlValue( mxCtrlWrp->GetControlValue() );
+ // convert to item value type -> possible to convert i.e. from 'T' to 'const T&'
+ ItemValueType aNewValue( aCtrlValue );
+ // do not rely on existence of ItemValueType::operator!=
+ if( !pOldItem || !(maItemWrp.GetItemValue( *pOldItem ) == aNewValue) )
+ {
+ sal_uInt16 nWhich = ItemWrapperHelper::GetWhichId( rDestSet, maItemWrp.GetSlotId() );
+ std::auto_ptr< ItemType > xItem(
+ static_cast< ItemType* >( maItemWrp.GetDefaultItem( rDestSet ).Clone() ) );
+ xItem->SetWhich( nWhich );
+ maItemWrp.SetItemValue( *xItem, aNewValue );
+ rDestSet.Put( *xItem );
+ bChanged = true;
+ }
+ }
+ if( !bChanged )
+ ItemWrapperHelper::RemoveDefaultItem( rDestSet, rOldSet, maItemWrp.GetSlotId() );
+ return bChanged;
+}
+
+// ============================================================================
+// Standard connections
+// ============================================================================
+
+template< typename ItemWrpT >
+NumericConnection< ItemWrpT >::NumericConnection(
+ sal_uInt16 nSlot, NumericField& rField, ItemConnFlags nFlags ) :
+ ItemControlConnectionType( nSlot, rField, nFlags )
+{
+}
+
+// ============================================================================
+
+template< typename ItemWrpT >
+MetricConnection< ItemWrpT >::MetricConnection(
+ sal_uInt16 nSlot, MetricField& rField, FieldUnit eItemUnit, ItemConnFlags nFlags ) :
+ ItemControlConnectionType( nSlot, new MetricFieldWrapperType( rField, eItemUnit ), nFlags )
+{
+}
+
+// ============================================================================
+
+template< typename ItemWrpT >
+ListBoxConnection< ItemWrpT >::ListBoxConnection(
+ sal_uInt16 nSlot, ListBox& rListBox, const MapEntryType* pMap, ItemConnFlags nFlags ) :
+ ItemControlConnectionType( nSlot, new ListBoxWrapperType( rListBox, pMap ), nFlags )
+{
+}
+
+// ============================================================================
+
+template< typename ItemWrpT >
+ValueSetConnection< ItemWrpT >::ValueSetConnection(
+ sal_uInt16 nSlot, ValueSet& rValueSet, const MapEntryType* pMap, ItemConnFlags nFlags ) :
+ ItemControlConnectionType( nSlot, new ValueSetWrapperType( rValueSet, pMap ), nFlags )
+{
+}
+
+// ============================================================================
+
+} // namespace sfx
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/itemwrapper.hxx b/include/sfx2/itemwrapper.hxx
new file mode 100644
index 000000000000..7143fadf092f
--- /dev/null
+++ b/include/sfx2/itemwrapper.hxx
@@ -0,0 +1,206 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SFX_ITEMWRAPPER_HXX
+#define SFX_ITEMWRAPPER_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include <svl/eitem.hxx>
+#include <svl/stritem.hxx>
+#include <svl/intitem.hxx>
+#include <svl/itemset.hxx>
+
+// ============================================================================
+
+namespace sfx {
+
+// ============================================================================
+// Helpers
+// ============================================================================
+
+class SFX2_DLLPUBLIC ItemWrapperHelper
+{
+public:
+ /** Returns the WID of the passed SID in the item set. */
+ static sal_uInt16 GetWhichId( const SfxItemSet& rItemSet, sal_uInt16 nSlot );
+
+ /** Returns true, if the passed item set supports the SID. */
+ static bool IsKnownItem( const SfxItemSet& rItemSet, sal_uInt16 nSlot );
+
+ /** Returns an item from an item set, if it is not in "don't know" state.
+ @return Pointer to item, or 0 if it has "don't know" state. */
+ static const SfxPoolItem* GetUniqueItem( const SfxItemSet& rItemSet, sal_uInt16 nSlot );
+
+ /** Returns the default item from the pool of the passed item set. */
+ static const SfxPoolItem& GetDefaultItem( const SfxItemSet& rItemSet, sal_uInt16 nSlot );
+
+ /** Removes an item from rDestSet, if it is default in rOldSet. */
+ static void RemoveDefaultItem( SfxItemSet& rDestSet, const SfxItemSet& rOldSet, sal_uInt16 nSlot );
+};
+
+// ============================================================================
+// Item wrappers
+// ============================================================================
+
+/** Base class wrapping a single item.
+
+ Objects of this class store the SID of an item. Exchanging data with the
+ item is done with the virtual functions GetItemValue() and SetItemValue().
+ Derived classes implement these functions according to the item type they
+ work on.
+
+ The current tree of base classes/templates and standard item wrappers:
+
+ SingleItemWrapper< ItemT, ValueT >
+ |
+ +- ValueItemWrapper< ItemT, ValueT > [1]
+ | |
+ | +- BoolItemWrapper [1]
+ | +- Int16ItemWrapper [1]
+ | +- UInt16ItemWrapper [1]
+ | +- Int32ItemWrapper [1]
+ | +- UInt32ItemWrapper [1]
+ | +- StringItemWrapper [1]
+ |
+ +- IdentItemWrapper< ItemT > [1]
+
+ Notes:
+ [1] Standard wrappers ready to use.
+
+ See documentation of class ItemConnectionBase for more details.
+ */
+template< typename ItemT, typename ValueT >
+class SingleItemWrapper
+{
+public:
+ typedef ItemT ItemType;
+ typedef ValueT ItemValueType;
+ typedef SingleItemWrapper< ItemT, ValueT > SingleItemWrapperType;
+
+ inline explicit SingleItemWrapper( sal_uInt16 nSlot ) : mnSlot( nSlot ) {}
+
+ virtual ~SingleItemWrapper() {}
+
+ /** Returns the SID this wrapper works on. */
+ inline sal_uInt16 GetSlotId() const { return mnSlot; }
+
+ /** Returns the item from an item set, if it is not in "don't know" state.
+ @descr Similar to ItemWrapperHelper::GetUniqueItem(), but works always
+ with the own SID and returns the correct item type.
+ @return Pointer to item, or 0 if it has "don't know" state. */
+ const ItemT* GetUniqueItem( const SfxItemSet& rItemSet ) const;
+ /** Returns the default item from the pool of the passed item set.
+ @descr Similar to ItemWrapperHelper::GetDefaultItem(), but works
+ always with the own SID and returns the correct item type. */
+ const ItemT& GetDefaultItem( const SfxItemSet& rItemSet ) const;
+
+ /** Derived classes return the value of the passed item. */
+ virtual ValueT GetItemValue( const ItemT& rItem ) const = 0;
+ /** Derived classes set the value at the passed item. */
+ virtual void SetItemValue( ItemT& rItem, ValueT aValue ) const = 0;
+
+private:
+ sal_uInt16 mnSlot; /// The SID of this item wrapper.
+};
+
+// ============================================================================
+
+/** An item wrapper usable for most types of items.
+
+ The item type must support the following functions:
+ - ValueT ItemT::GetValue() const
+ - void ItemT::SetValue( ValueT )
+
+ The template parameter InternalValueT can be used to specify the internal
+ value type of the item, if it differs from ValueT. This parameter has to be
+ used to prevent compiler warnings.
+ */
+template< typename ItemT, typename ValueT, typename InternalValueT = ValueT >
+class ValueItemWrapper : public SingleItemWrapper< ItemT, ValueT >
+{
+public:
+ inline explicit ValueItemWrapper( sal_uInt16 nSlot ) :
+ SingleItemWrapper< ItemT, ValueT >( nSlot ) {}
+
+ virtual ~ValueItemWrapper() {}
+
+ virtual ValueT GetItemValue( const ItemT& rItem ) const
+ { return static_cast< ValueT >( rItem.GetValue() ); }
+ virtual void SetItemValue( ItemT& rItem, ValueT aValue ) const
+ { rItem.SetValue( static_cast< InternalValueT >( aValue ) ); }
+};
+
+// ----------------------------------------------------------------------------
+
+typedef ValueItemWrapper< SfxBoolItem, sal_Bool > BoolItemWrapper;
+typedef ValueItemWrapper< SfxInt16Item, sal_Int16 > Int16ItemWrapper;
+typedef ValueItemWrapper< SfxUInt16Item, sal_uInt16 > UInt16ItemWrapper;
+typedef ValueItemWrapper< SfxInt32Item, sal_Int32 > Int32ItemWrapper;
+typedef ValueItemWrapper< SfxUInt32Item, sal_uInt32 > UInt32ItemWrapper;
+typedef ValueItemWrapper< SfxStringItem, const String& > StringItemWrapper;
+
+// ============================================================================
+
+/** An item wrapper that uses the item itself as value. */
+template< typename ItemT >
+class IdentItemWrapper : public SingleItemWrapper< ItemT, const ItemT& >
+{
+public:
+ inline explicit IdentItemWrapper( sal_uInt16 nSlot ) :
+ SingleItemWrapper< ItemT, const ItemT& >( nSlot ) {}
+
+ virtual ~IdentItemWrapper() {}
+
+ virtual const ItemT& GetItemValue( const ItemT& rItem ) const
+ { return rItem; }
+ virtual void SetItemValue( ItemT& rItem, const ItemT& rValue ) const
+ { rItem = rValue; }
+};
+
+// ============================================================================
+
+
+// ============================================================================
+// *** Implementation of template functions ***
+// ============================================================================
+
+// ============================================================================
+// Item wrappers
+// ============================================================================
+
+template< typename ItemT, typename ValueT >
+const ItemT* SingleItemWrapper< ItemT, ValueT >::GetUniqueItem( const SfxItemSet& rItemSet ) const
+{
+ return static_cast< const ItemT* >( ItemWrapperHelper::GetUniqueItem( rItemSet, mnSlot ) );
+}
+
+template< typename ItemT, typename ValueT >
+const ItemT& SingleItemWrapper< ItemT, ValueT >::GetDefaultItem( const SfxItemSet& rItemSet ) const
+{
+ return static_cast< const ItemT& >( ItemWrapperHelper::GetDefaultItem( rItemSet, mnSlot ) );
+}
+
+// ============================================================================
+
+} // namespace sfx
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/linkmgr.hxx b/include/sfx2/linkmgr.hxx
new file mode 100644
index 000000000000..24a5f6315edb
--- /dev/null
+++ b/include/sfx2/linkmgr.hxx
@@ -0,0 +1,195 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _LINKMGR_HXX
+#define _LINKMGR_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include <sfx2/linksrc.hxx>
+#include <tools/string.hxx>
+
+#include <vector>
+#include <set>
+
+class SfxObjectShell;
+class Graphic;
+class Size;
+
+namespace com { namespace sun { namespace star {
+ namespace lang {
+ class XComponent;
+ }
+}}}
+
+namespace sfx2
+{
+ // For the link to receive information about the status of graphics that
+ // will be loaded the FileObject sends a SvData, which contains the
+ // FormatID "RegisterStatusInfoId" and a string as the data container.
+ // This contains the following enum.
+
+class SvBaseLink;
+class SvBaseLinkRef;
+
+typedef std::vector<SvBaseLinkRef*> SvBaseLinks;
+
+typedef std::set<SvLinkSource*> SvLinkSources;
+
+class SFX2_DLLPUBLIC LinkManager
+{
+ typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > >
+ CompVector;
+ CompVector maCachedComps;
+
+ SvBaseLinks aLinkTbl;
+ SvLinkSources aServerTbl;
+
+ SfxObjectShell *pPersist; // LinkMgr must be release before SfxObjectShell
+protected:
+ sal_Bool InsertLink( SvBaseLink* pLink, sal_uInt16 nObjType, sal_uInt16 nUpdateType,
+ const String* pName = 0 );
+public:
+
+ enum LinkState
+ {
+ STATE_LOAD_OK,
+ STATE_LOAD_ERROR,
+ STATE_LOAD_ABORT
+ };
+
+ LinkManager( SfxObjectShell * pCacheCont );
+ ~LinkManager();
+
+ /**
+ * Insert a component loaded during link update, which needs to be closed
+ * when the update is complete.
+ *
+ * @param xComp component loaded during link update.
+ */
+ void InsertCachedComp(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xComp);
+
+ void CloseCachedComps();
+
+ SfxObjectShell* GetPersist() const { return pPersist; }
+ void SetPersist( SfxObjectShell * p ) { pPersist = p; }
+
+ void Remove( SvBaseLink *pLink );
+ void Remove( sal_uInt16 nPos, sal_uInt16 nCnt = 1 );
+ sal_Bool Insert( SvBaseLink* pLink );
+
+ // the links connect to a SvLinkSource and adds to the list
+ sal_Bool InsertDDELink( SvBaseLink*,
+ const String& rServer,
+ const String& rTopic,
+ const String& rItem );
+
+ // if everything is already set at the link!
+ sal_Bool InsertDDELink( SvBaseLink* );
+
+ // Connect the links to a pseudo-object and add to the list
+ bool InsertFileLink( sfx2::SvBaseLink&,
+ sal_uInt16 nFileType,
+ const String& rFileNm,
+ const String* pFilterNm = 0,
+ const String* pRange = 0 );
+
+ bool InsertFileLink(
+ sfx2::SvBaseLink& rLink, sal_uInt16 nFileType, const OUString& rFileNm,
+ const OUString* pFilterNm = NULL, const OUString* pRange = NULL);
+
+ void ReconnectDdeLink(SfxObjectShell& rServer);
+
+ /**
+ * Reconnect the server document shell to a DDE link object.
+ *
+ * @param rPath path to the server document
+ * @param rServer server document shell instance
+ * @param rLink link object of the client document
+ */
+ void LinkServerShell(const OUString& rPath, SfxObjectShell& rServer, ::sfx2::SvBaseLink& rLink) const;
+
+ // Obtain the string for the dialog
+ bool GetDisplayNames( const SvBaseLink *,
+ String* pType,
+ String* pFile = 0,
+ String* pLink = 0,
+ String* pFilter = 0 ) const;
+
+ bool GetDisplayNames(
+ const SvBaseLink* pLink, OUString* pType, OUString* pFile = NULL,
+ OUString* pLinkStr = NULL, OUString* pFilter = NULL) const;
+
+ SvLinkSourceRef CreateObj( SvBaseLink* );
+
+ void UpdateAllLinks( bool bAskUpdate = true,
+ bool bCallErrHdl = true,
+ bool bUpdateGrfLinks = false,
+ Window* pParentWin = 0 );
+
+ // Call for list of links (eg for link-dialog)
+ const SvBaseLinks& GetLinks() const { return aLinkTbl; }
+
+ // ----------------- Server-side management --------------------
+
+ // Call with list of links to server
+ const SvLinkSources& GetServers() const { return aServerTbl; }
+ // Link register/delete
+ sal_Bool InsertServer( SvLinkSource* rObj );
+ void RemoveServer( SvLinkSource* rObj );
+
+ // A transfer is aborted, so cancel all download media
+ // (for the time beeing this is only of interest for the FileLinks!)
+ void CancelTransfers();
+
+ // To send status information from the FileObject to the Baselink,
+ // for this there exist a separate ClipBoardId. The SvData-object has
+ // got the appropriate information as a string.
+ // Is now required for FileObject in conjunction with JavaScript
+ // this needs information about Load/Abort/Error
+ static sal_uIntPtr RegisterStatusInfoId();
+
+ // if the mimetype says graphic/bitmap/gdimetafile then get the
+ // graphic from the Any. Return says no errors
+ static sal_Bool GetGraphicFromAny( const String& rMimeType,
+ const ::com::sun::star::uno::Any & rValue,
+ Graphic& rGrf );
+
+private:
+ LinkManager( const LinkManager& );
+ LinkManager& operator=( const LinkManager& );
+};
+
+// Separator in the link name for the DDE-/File-/Graphics- links
+// (only those who need to construct a SvLinkName)
+const sal_Unicode cTokenSeperator = 0xFFFF;
+
+// create a string for the SvLinkName. For:
+// - DDE the first 3 Strings, (Server, Topic, Item)
+// - File-/Graphics-LinkNames the last 3 Strings (FileName, Region, Filter)
+SFX2_DLLPUBLIC void MakeLnkName( String& rName,
+ const String* pType, // Can also be null!!
+ const String& rFile,
+ const String& rLink,
+ const String* pFilter = 0 );
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/linksrc.hxx b/include/sfx2/linksrc.hxx
new file mode 100644
index 000000000000..4ff77b6afa54
--- /dev/null
+++ b/include/sfx2/linksrc.hxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _LINKSRC_HXX
+#define _LINKSRC_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+
+#include <tools/link.hxx>
+#include <tools/ref.hxx>
+#include <tools/rtti.hxx>
+#include <com/sun/star/io/XInputStream.hpp>
+
+#include <sal/config.h>
+
+namespace com { namespace sun { namespace star { namespace uno
+{
+ class Any;
+}}}}
+class Window;
+class String;
+
+#ifndef ADVISEMODE_NODATA
+// Must be the same value as Ole2 ADVF_*
+#define ADVISEMODE_NODATA 0x01
+#define ADVISEMODE_PRIMEFIRST 0x02
+#define ADVISEMODE_ONLYONCE 0x04
+#define ADVISEMODE_DATAONSTOP 0x40
+#endif
+
+namespace sfx2
+{
+
+class SvBaseLink;
+struct SvLinkSource_Impl;
+
+class SFX2_DLLPUBLIC SvLinkSource : public SvRefBase
+{
+private:
+ SvLinkSource_Impl* pImpl; // compatible area
+
+public:
+ TYPEINFO();
+
+ SvLinkSource();
+ virtual ~SvLinkSource();
+
+ sal_Bool HasDataLinks( const SvBaseLink* = 0 ) const;
+
+ void Closed();
+
+ sal_uIntPtr GetUpdateTimeout() const;
+ void SetUpdateTimeout( sal_uIntPtr nTime );
+ // notify the sink, the mime type is not
+ // a selection criterion
+ void DataChanged( const String & rMimeType,
+ const ::com::sun::star::uno::Any & rVal );
+ void SendDataChanged();
+ void NotifyDataChanged();
+
+ virtual sal_Bool Connect( SvBaseLink* );
+ virtual sal_Bool GetData( ::com::sun::star::uno::Any & rData /*out param*/,
+ const String & rMimeType,
+ sal_Bool bSynchron = sal_False );
+
+ // sal_True => waitinmg for data
+ virtual sal_Bool IsPending() const;
+ // sal_True => data complete loaded
+ virtual sal_Bool IsDataComplete() const;
+
+ // Link impl: DECL_LINK( MyEndEditHdl, sfx2::FileDialogHelper* ); <= param is the dialog
+ virtual void Edit( Window *, SvBaseLink *, const Link& rEndEditHdl );
+
+
+ void AddDataAdvise( SvBaseLink *, const String & rMimeType,
+ sal_uInt16 nAdviceMode );
+ void RemoveAllDataAdvise( SvBaseLink * );
+
+ void AddConnectAdvise( SvBaseLink * );
+ void RemoveConnectAdvise( SvBaseLink * );
+
+ struct StreamToLoadFrom{
+ StreamToLoadFrom(
+ const com::sun::star::uno::Reference<com::sun::star::io::XInputStream>& xInputStream,sal_Bool bIsReadOnly )
+ :m_xInputStreamToLoadFrom(xInputStream),
+ m_bIsReadOnly(bIsReadOnly)
+ {
+ }
+
+ com::sun::star::uno::Reference<com::sun::star::io::XInputStream>
+ m_xInputStreamToLoadFrom;
+ sal_Bool m_bIsReadOnly;
+ };
+
+ StreamToLoadFrom getStreamToLoadFrom();
+ void setStreamToLoadFrom(const com::sun::star::uno::Reference<com::sun::star::io::XInputStream>& xInputStream,sal_Bool bIsReadOnly );
+ void clearStreamToLoadFrom();
+};
+
+SV_DECL_IMPL_REF(SvLinkSource);
+
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/lnkbase.hxx b/include/sfx2/lnkbase.hxx
new file mode 100644
index 000000000000..ebd76db400d0
--- /dev/null
+++ b/include/sfx2/lnkbase.hxx
@@ -0,0 +1,176 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _LNKBASE_HXX
+#define _LNKBASE_HXX
+
+#include <com/sun/star/io/XInputStream.hpp>
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include <sot/exchange.hxx>
+#include <tools/ref.hxx>
+#include <sfx2/linksrc.hxx>
+
+namespace com { namespace sun { namespace star { namespace uno
+{
+ class Any;
+}}}}
+
+namespace sfx2
+{
+
+struct ImplBaseLinkData;
+class LinkManager;
+class SvLinkSource;
+class FileDialogHelper;
+
+#ifndef OBJECT_DDE_EXTERN
+#define OBJECT_INTERN 0x00
+//#define OBJECT_SO_EXTERN 0x01
+#define OBJECT_DDE_EXTERN 0x02
+#endif
+
+#define OBJECT_CLIENT_SO 0x80 // a Link
+#define OBJECT_CLIENT_DDE 0x81
+//#define OBJECT_CLIENT_OLE 0x82 // a Ole-Link
+//#define OBJECT_CLIENT_OLE_CACHE 0x83 // a Ole-Link with SvEmbeddedObject
+#define OBJECT_CLIENT_FILE 0x90
+#define OBJECT_CLIENT_GRF 0x91
+#define OBJECT_CLIENT_OLE 0x92 // embedded link
+
+enum sfxlink {
+ // Ole2 compatibel and persistent
+ LINKUPDATE_ALWAYS = 1,
+ LINKUPDATE_ONCALL = 3,
+
+ LINKUPDATE_END // dummy!
+};
+
+struct BaseLink_Impl;
+
+class SFX2_DLLPUBLIC SvBaseLink : public SvRefBase
+{
+private:
+ friend class LinkManager;
+ friend class SvLinkSource;
+
+ SvLinkSourceRef xObj;
+ String aLinkName;
+ BaseLink_Impl* pImpl;
+ sal_uInt16 nObjType;
+ sal_Bool bVisible : 1;
+ sal_Bool bSynchron : 1;
+ sal_Bool bUseCache : 1; // for Graphics Links!
+ sal_Bool bWasLastEditOK : 1;
+
+ DECL_LINK( EndEditHdl, String* );
+
+ bool ExecuteEdit( const String& _rNewName );
+
+protected:
+ void SetObjType( sal_uInt16 );
+
+ // Set LinkSourceName without action
+ void SetName( const String & rLn );
+
+ ImplBaseLinkData* pImplData;
+
+ sal_Bool m_bIsReadOnly;
+ com::sun::star::uno::Reference<com::sun::star::io::XInputStream>
+ m_xInputStreamToLoadFrom;
+
+ SvBaseLink();
+ SvBaseLink( sal_uInt16 nLinkType, sal_uIntPtr nContentType = FORMAT_STRING );
+ virtual ~SvBaseLink();
+
+ void _GetRealObject( sal_Bool bConnect = sal_True );
+
+ SvLinkSource* GetRealObject()
+ {
+ if( !xObj.Is() )
+ _GetRealObject();
+ return xObj;
+ }
+
+public:
+ TYPEINFO();
+
+ virtual void Closed();
+ SvBaseLink( const String& rNm, sal_uInt16 nObjectType,
+ SvLinkSource* );
+
+ sal_uInt16 GetObjType() const { return nObjType; }
+
+ void SetObj( SvLinkSource * pObj );
+ SvLinkSource* GetObj() const { return xObj; }
+
+ void SetLinkSourceName( const String & rName );
+ String GetLinkSourceName() const;
+
+ enum UpdateResult {
+ SUCCESS = 0,
+ ERROR_GENERAL = 1
+ };
+
+ virtual UpdateResult DataChanged(
+ const String & rMimeType, const ::com::sun::star::uno::Any & rValue );
+
+ void SetUpdateMode( sal_uInt16 );
+ sal_uInt16 GetUpdateMode() const;
+ sal_uIntPtr GetContentType() const;
+ sal_Bool SetContentType( sal_uIntPtr nType );
+
+ LinkManager* GetLinkManager();
+ const LinkManager* GetLinkManager() const;
+ void SetLinkManager( LinkManager* _pMgr );
+
+ sal_Bool Update();
+ void Disconnect();
+
+ // Link impl: DECL_LINK( MyEndDialogHdl, SvBaseLink* ); <= param is this
+ virtual void Edit( Window*, const Link& rEndEditHdl );
+
+ // should the link appear in the dialog? (to the left in the link in the...)
+ sal_Bool IsVisible() const { return bVisible; }
+ void SetVisible( sal_Bool bFlag ) { bVisible = bFlag; }
+ // should the Link be loaded synchronous or asynchronous?
+ sal_Bool IsSynchron() const { return bSynchron; }
+ void SetSynchron( sal_Bool bFlag ) { bSynchron = bFlag; }
+
+ sal_Bool IsUseCache() const { return bUseCache; }
+ void SetUseCache( sal_Bool bFlag ) { bUseCache = bFlag; }
+
+ void setStreamToLoadFrom(
+ const com::sun::star::uno::Reference<com::sun::star::io::XInputStream>& xInputStream,
+ sal_Bool bIsReadOnly )
+ { m_xInputStreamToLoadFrom = xInputStream;
+ m_bIsReadOnly = bIsReadOnly; }
+ // #i88291#
+ void clearStreamToLoadFrom();
+
+ inline sal_Bool WasLastEditOK() const { return bWasLastEditOK; }
+ FileDialogHelper & GetInsertFileDialog(const String& rFactory) const;
+};
+
+SV_DECL_IMPL_REF(SvBaseLink);
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/macropg.hxx b/include/sfx2/macropg.hxx
new file mode 100644
index 000000000000..1a6c87198f41
--- /dev/null
+++ b/include/sfx2/macropg.hxx
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _MACROPG_HXX
+#define _MACROPG_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+
+#include <sfx2/basedlgs.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <svl/macitem.hxx>
+#include <vcl/lstbox.hxx>
+#include <com/sun/star/frame/XFrame.hpp>
+
+class _SfxMacroTabPage;
+class SvTabListBox;
+class Edit;
+class String;
+class SfxObjectShell;
+
+class SfxConfigFunctionListBox_Impl;
+
+class _HeaderTabListBox;
+class _SfxMacroTabPage_Impl;
+
+class SFX2_DLLPUBLIC _SfxMacroTabPage : public SfxTabPage
+{
+ SvxMacroTableDtor aTbl;
+
+ DECL_DLLPRIVATE_STATIC_LINK( _SfxMacroTabPage, SelectEvent_Impl, SvTabListBox * );
+ DECL_DLLPRIVATE_STATIC_LINK( _SfxMacroTabPage, SelectGroup_Impl, ListBox * );
+ DECL_DLLPRIVATE_STATIC_LINK( _SfxMacroTabPage, SelectMacro_Impl, ListBox * );
+
+ DECL_DLLPRIVATE_STATIC_LINK( _SfxMacroTabPage, DoubleClickHdl_Impl, Control* );
+ DECL_DLLPRIVATE_STATIC_LINK( _SfxMacroTabPage, AssignDeleteHdl_Impl, PushButton * );
+
+ DECL_DLLPRIVATE_STATIC_LINK( _SfxMacroTabPage, ChangeScriptHdl_Impl, RadioButton * );
+ DECL_DLLPRIVATE_STATIC_LINK( _SfxMacroTabPage, GetFocus_Impl, Edit* );
+ DECL_DLLPRIVATE_STATIC_LINK( _SfxMacroTabPage, TimeOut_Impl, Timer* );
+
+protected:
+ _SfxMacroTabPage_Impl* mpImpl;
+
+ _SfxMacroTabPage( Window* pParent, const ResId& rId, const SfxItemSet& rItemSet );
+
+ void InitAndSetHandler();
+ void FillEvents();
+ void FillMacroList();
+ void EnableButtons( const String& rLanguage );
+
+public:
+
+ virtual ~_SfxMacroTabPage();
+
+ void AddEvent( const String & rEventName, sal_uInt16 nEventId );
+
+ const SvxMacroTableDtor& GetMacroTbl() const;
+ void SetMacroTbl( const SvxMacroTableDtor& rTbl );
+ void ClearMacroTbl();
+
+ virtual void ScriptChanged( const String& rLanguage );
+
+ // zum setzen / abfragen der Links
+ void SetGetMacrosOfRangeLink( FNGetMacrosOfRangeHdl pFn );
+ FNGetMacrosOfRangeHdl GetGetMacrosOfRangeLink() const;
+
+ // --------- Erben aus der Basis -------------
+ virtual sal_Bool FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+ void SetReadOnly( sal_Bool bSet );
+ sal_Bool IsReadOnly() const;
+ void SelectEvent( const String& rEventName, sal_uInt16 nEventId );
+};
+
+inline const SvxMacroTableDtor& _SfxMacroTabPage::GetMacroTbl() const
+{
+ return aTbl;
+}
+
+inline void _SfxMacroTabPage::SetMacroTbl( const SvxMacroTableDtor& rTbl )
+{
+ aTbl = rTbl;
+}
+
+inline void _SfxMacroTabPage::ClearMacroTbl()
+{
+ aTbl.DelDtor();
+}
+
+class SFX2_DLLPUBLIC SfxMacroTabPage : public _SfxMacroTabPage
+{
+public:
+ SfxMacroTabPage(
+ Window* pParent,
+ const ResId& rId,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxDocumentFrame,
+ const SfxItemSet& rSet
+ );
+
+ // --------- Erben aus der Basis -------------
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+};
+
+class SFX2_DLLPUBLIC SfxMacroAssignDlg : public SfxNoLayoutSingleTabDialog
+{
+public:
+ SfxMacroAssignDlg(
+ Window* pParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxDocumentFrame,
+ SfxItemSet& rSet );
+ SfxMacroAssignDlg(
+ Window* pParent,
+ const SfxObjectShell* _pShell,
+ SfxItemSet& rSet );
+ virtual ~SfxMacroAssignDlg();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/mailmodelapi.hxx b/include/sfx2/mailmodelapi.hxx
new file mode 100644
index 000000000000..042a364e2b5a
--- /dev/null
+++ b/include/sfx2/mailmodelapi.hxx
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SFX_MAILMODEL_HXX
+#define INCLUDED_SFX_MAILMODEL_HXX
+
+#include <vector>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include "tools/link.hxx"
+#include <tools/string.hxx>
+#include "sfx2/dllapi.h"
+
+// class AddressList_Impl ------------------------------------------------
+typedef String* AddressItemPtr_Impl;
+typedef ::std::vector< AddressItemPtr_Impl > AddressList_Impl;
+
+// class SfxMailModel_Impl -----------------------------------------------
+
+class SFX2_DLLPUBLIC SfxMailModel
+{
+public:
+ enum MailPriority
+ {
+ PRIO_HIGHEST,
+ PRIO_HIGH,
+ PRIO_NORMAL,
+ PRIO_LOW,
+ PRIO_LOWEST
+ };
+
+ enum AddressRole
+ {
+ ROLE_TO,
+ ROLE_CC,
+ ROLE_BCC
+ };
+
+ enum MailDocType
+ {
+ TYPE_SELF,
+ TYPE_ASPDF
+ };
+
+protected:
+ enum SaveResult
+ {
+ SAVE_SUCCESSFULL,
+ SAVE_CANCELLED,
+ SAVE_ERROR
+ };
+ ::std::vector< OUString > maAttachedDocuments;
+ SaveResult SaveDocumentAsFormat( const OUString& aSaveFileName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xFrameOrModel,
+ const OUString& rType,
+ OUString& rFileNamePath );
+
+private:
+ AddressList_Impl* mpToList;
+ AddressList_Impl* mpCcList;
+ AddressList_Impl* mpBccList;
+ String maFromAddress;
+ String maSubject;
+ MailPriority mePriority;
+
+ sal_Bool mbLoadDone;
+
+ void ClearList( AddressList_Impl* pList );
+ SaveResult ShowFilterOptionsDialog( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMGR,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel,
+ const OUString& rFilterName,
+ const OUString& rType,
+ bool bModified,
+ sal_Int32& rNumArgs,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs );
+
+ DECL_LINK( DoneHdl, void* );
+
+public:
+ enum SendMailResult
+ {
+ SEND_MAIL_OK,
+ SEND_MAIL_CANCELLED,
+ SEND_MAIL_ERROR
+ };
+
+ SfxMailModel();
+ ~SfxMailModel();
+
+ void AddAddress( const String& rAddress, AddressRole eRole );
+ void SetFromAddress( const String& rAddress ) { maFromAddress = rAddress; }
+ void SetSubject( const String& rSubject ) { maSubject = rSubject; }
+ void SetPriority( MailPriority ePrio ) { mePriority = ePrio; }
+
+ /** attaches a document to the current attachment list, can be called more than once.
+ * at the moment there will be a dialog for export executed for every model which is going to be attached.
+ *
+ * \param sDocumentType
+ The doc type to export. PDF will be at the moment only a direct export (no dialog).
+ * \param xModel
+ The current model to attach
+ * \param sAttachmentTitle
+ The title which will be used as attachment title
+ * \return @see error code
+ */
+ SendMailResult AttachDocument( const OUString& sDocumentType,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xFrameOrModel,
+ const OUString& sAttachmentTitle );
+
+ SendMailResult SaveAndSend( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame,
+ const OUString& rType );
+ SendMailResult Send( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame );
+
+ sal_Bool IsEmpty() const;
+};
+
+sal_Bool CreateFromAddress_Impl( String& rFrom );
+
+#endif // INCLUDED_SFX_MAILMODEL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/mgetempl.hxx b/include/sfx2/mgetempl.hxx
new file mode 100644
index 000000000000..553c5bd745f3
--- /dev/null
+++ b/include/sfx2/mgetempl.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX_MGETEMPL_HXX
+#define _SFX_MGETEMPL_HXX
+
+#include <vcl/edit.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/vclmedit.hxx>
+#include <sfx2/tabdlg.hxx>
+
+/* expected:
+ SID_TEMPLATE_NAME : In: StringItem, Name of Template
+ SID_TEMPLATE_FAMILY : In: Family of Template
+*/
+
+class SfxStyleFamilies;
+class SfxStyleFamilyItem;
+class SfxStyleSheetBase;
+
+class SfxManageStyleSheetPage : public SfxTabPage
+{
+ VclMultiLineEdit* m_pNameRo;
+ Edit* m_pNameRw;
+
+ CheckBox* m_pAutoCB;
+
+ FixedText* m_pFollowFt;
+ ListBox* m_pFollowLb;
+
+ FixedText* m_pBaseFt;
+ ListBox* m_pBaseLb;
+
+ FixedText* m_pFilterFt;
+ ListBox* m_pFilterLb;
+
+ FixedText *m_pDescFt;
+
+ SfxStyleSheetBase *pStyle;
+ SfxStyleFamilies *pFamilies;
+ const SfxStyleFamilyItem *pItem;
+ String aBuf;
+ sal_Bool bModified;
+
+ // initial data for the style
+ String aName;
+ String aFollow;
+ String aParent;
+ sal_uInt16 nFlags;
+
+private:
+friend class SfxStyleDialog;
+
+ DECL_LINK( GetFocusHdl, Edit * );
+ DECL_LINK( LoseFocusHdl, Edit * );
+
+ void UpdateName_Impl(ListBox *, const String &rNew);
+ void SetDescriptionText_Impl();
+
+ SfxManageStyleSheetPage(Window *pParent, const SfxItemSet &rAttrSet );
+ ~SfxManageStyleSheetPage();
+
+ static SfxTabPage* Create(Window *pParent, const SfxItemSet &rAttrSet );
+
+protected:
+ virtual sal_Bool FillItemSet(SfxItemSet &);
+ virtual void Reset(const SfxItemSet &);
+
+ using TabPage::ActivatePage;
+ virtual void ActivatePage(const SfxItemSet &);
+ using TabPage::DeactivatePage;
+ virtual int DeactivatePage(SfxItemSet * = 0);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/mieclip.hxx b/include/sfx2/mieclip.hxx
new file mode 100644
index 000000000000..6b616607b38f
--- /dev/null
+++ b/include/sfx2/mieclip.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _MIECLIP_HXX
+#define _MIECLIP_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include "sal/types.h"
+#include <tools/solar.h>
+#include <tools/string.hxx>
+
+class SvStream;
+class SotDataObject;
+class SvData;
+
+class SFX2_DLLPUBLIC MSE40HTMLClipFormatObj
+{
+ SvStream* pStrm;
+ String sBaseURL;
+
+public:
+ MSE40HTMLClipFormatObj() : pStrm(0) {}
+ ~MSE40HTMLClipFormatObj();
+
+//JP 31.01.2001: old interfaces
+ SAL_DLLPRIVATE sal_Bool GetData( SotDataObject& );
+ SAL_DLLPRIVATE sal_Bool GetData( SvData& );
+//JP 31.01.2001: the new one
+ SvStream* IsValid( SvStream& );
+
+ const SvStream* GetStream() const { return pStrm; }
+ SvStream* GetStream() { return pStrm; }
+ const String& GetBaseURL() const { return sBaseURL; }
+};
+
+
+#endif //_MIECLIP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/minfitem.hxx b/include/sfx2/minfitem.hxx
new file mode 100644
index 000000000000..fb06ffc1e979
--- /dev/null
+++ b/include/sfx2/minfitem.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX_MINFITEM_HXX
+#define _SFX_MINFITEM_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include <tools/string.hxx>
+#include <svl/poolitem.hxx>
+class BasicManager;
+
+class SFX2_DLLPUBLIC SfxMacroInfoItem: public SfxPoolItem
+{
+ const BasicManager* pBasicManager;
+ String aLibName;
+ String aModuleName;
+ String aMethodName;
+ String aCommentText;
+
+public:
+ TYPEINFO();
+ SfxMacroInfoItem( sal_uInt16 nWhich,
+ const BasicManager* pMgr,
+ const String &rLibName,
+ const String &rModuleName,
+ const String &rMethodName,
+ const String &rComment);
+
+ SfxMacroInfoItem( const SfxMacroInfoItem& );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+ String GetComment() const
+ { return aCommentText; }
+ void SetComment( const String& r )
+ { aCommentText = r; }
+ String GetMethod() const
+ { return aMethodName; }
+ void SetMethod( const String& r )
+ { aMethodName = r; }
+ String GetModule() const
+ { return aModuleName; }
+ void SetModule( const String& r )
+ { aModuleName = r; }
+ String GetLib() const
+ { return aLibName; }
+ void SetLib( const String& r )
+ { aLibName = r; }
+ const BasicManager* GetBasicManager() const
+ { return pBasicManager; }
+ String GetQualifiedName() const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/mnuitem.hxx b/include/sfx2/mnuitem.hxx
new file mode 100644
index 000000000000..e65220be2a13
--- /dev/null
+++ b/include/sfx2/mnuitem.hxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXMNUITEM_HXX
+#define _SFXMNUITEM_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+
+class SfxVirtualMenu;
+class SfxBindings;
+class SfxModule;
+class Menu;
+class PopupMenu;
+class SfxUnoMenuControl;
+class SfxUnoControllerItem;
+struct SfxMenuCtrlFactory;
+#include <tools/string.hxx>
+#include <sfx2/ctrlitem.hxx>
+
+class SFX2_DLLPUBLIC SfxMenuControl: public SfxControllerItem
+{
+ String aTitle;
+ SfxVirtualMenu* pOwnMenu;
+ SfxVirtualMenu* pSubMenu;
+ sal_Bool b_ShowStrings;
+
+public:
+ SfxMenuControl();
+ SfxMenuControl( sal_Bool bShowStrings );
+ SfxMenuControl( sal_uInt16, SfxBindings&);
+
+ static SfxMenuControl* CreateImpl( sal_uInt16 nId, Menu &rMenu, SfxBindings &rBindings );
+ static void RegisterControl( sal_uInt16 nSlotId = 0, SfxModule *pMod=NULL );
+
+ ~SfxMenuControl();
+
+ using SfxControllerItem::Bind;
+ void Bind( SfxVirtualMenu* pOwnMenu, sal_uInt16 nId,
+ const String& rTitle, SfxBindings& rBindings );
+ void Bind( SfxVirtualMenu* pOwnMenu, sal_uInt16 nId,
+ SfxVirtualMenu& rSubMenu,
+ const String& rTitle, SfxBindings& rBindings );
+
+ String GetTitle() const;
+ SfxVirtualMenu* GetPopupMenu() const;
+ virtual PopupMenu* GetPopup() const;
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+
+ static SfxMenuControl* CreateControl( sal_uInt16 nId, Menu &, SfxBindings & );
+ static SfxUnoMenuControl* CreateControl( const String&, sal_uInt16, Menu&, const String& sItemText, SfxBindings&, SfxVirtualMenu* );
+ static void RegisterMenuControl(SfxModule*, SfxMenuCtrlFactory*);
+
+};
+
+class SfxUnoMenuControl : public SfxMenuControl
+{
+ SfxUnoControllerItem* pUnoCtrl;
+public:
+ SfxUnoMenuControl( const String&, sal_uInt16 nId, Menu&,
+ const String&,
+ SfxBindings&, SfxVirtualMenu* );
+ ~SfxUnoMenuControl();
+};
+
+typedef SfxMenuControl* (*SfxMenuControlCtor)( sal_uInt16 nId, Menu &, SfxBindings & );
+
+struct SfxMenuCtrlFactory
+{
+ SfxMenuControlCtor pCtor;
+ TypeId nTypeId;
+ sal_uInt16 nSlotId;
+
+ SfxMenuCtrlFactory( SfxMenuControlCtor pTheCtor,
+ TypeId nTheTypeId, sal_uInt16 nTheSlotId ):
+ pCtor(pTheCtor),
+ nTypeId(nTheTypeId),
+ nSlotId(nTheSlotId)
+ {}
+};
+
+inline String SfxMenuControl::GetTitle() const
+{
+ return aTitle;
+}
+
+inline SfxVirtualMenu* SfxMenuControl::GetPopupMenu() const
+{
+ return pSubMenu;
+}
+
+#define SFX_DECL_MENU_CONTROL() \
+ static SfxMenuControl* CreateImpl( sal_uInt16 nId, Menu &rMenu, SfxBindings &rBindings ); \
+ static void RegisterControl(sal_uInt16 nSlotId = 0, SfxModule *pMod=NULL)
+
+#define SFX_IMPL_MENU_CONTROL(Class, nItemClass) \
+ SfxMenuControl* Class::CreateImpl( sal_uInt16 nId, Menu &rMenu, SfxBindings &rBindings ) \
+ { return new Class(nId, rMenu, rBindings); } \
+ void Class::RegisterControl(sal_uInt16 nSlotId, SfxModule *pMod) \
+ { SfxMenuControl::RegisterMenuControl( pMod, new SfxMenuCtrlFactory( \
+ Class::CreateImpl, TYPE(nItemClass), nSlotId ) ); }
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/mnumgr.hxx b/include/sfx2/mnumgr.hxx
new file mode 100644
index 000000000000..4624026a059e
--- /dev/null
+++ b/include/sfx2/mnumgr.hxx
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXMNUMGR_HXX
+#define _SFXMNUMGR_HXX
+
+#include <vcl/menu.hxx>
+#include <tools/wintypes.hxx>
+#include <tools/link.hxx>
+#include <com/sun/star/embed/VerbDescriptor.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <tools/stream.hxx>
+#include <tools/resid.hxx>
+#include <sfx2/sfx.hrc>
+
+class SfxVirtualMenu;
+class SfxPoolItem;
+class SfxBindings;
+class ResMgr;
+class Menu;
+class PopupMenu;
+class SfxBindings;
+class ResId;
+class Point;
+class SfxObjectShell;
+class SfxModule;
+class SfxViewFrame;
+
+class SfxMenuManager
+{
+friend class SfxPopupMenuManager;
+
+ SfxVirtualMenu* pMenu; // the actual Menu
+ SfxVirtualMenu* pOldMenu; // only while reconfiguring
+ sal_Bool bMenuBar; // Popup or MenuBar
+ SfxBindings* pBindings;
+ ResMgr* pResMgr;
+ sal_uInt32 nType;
+ sal_Bool bAddClipboardFuncs : 1;
+
+ void Construct( SfxVirtualMenu& rMenu );
+
+protected:
+ SfxMenuManager( Menu*, SfxBindings& );
+ ~SfxMenuManager();
+ sal_uInt16 GetItemPos( sal_uInt16 nId );
+ sal_uInt32 GetType() { return nType; }
+public:
+
+ DECL_LINK( Select, Menu* );
+
+ SfxVirtualMenu* GetMenu() const
+ { return pMenu; }
+
+ SfxBindings& GetBindings() { return *pBindings; }
+ const SfxBindings& GetBindings() const { return *pBindings; }
+ void SetResMgr(ResMgr* pMgr) {pResMgr = pMgr; }
+ ResMgr* GetResMgr() const { return pResMgr; }
+ void SetPopupMenu( sal_uInt16 nId, PopupMenu *pMenu );
+};
+
+//--------------------------------------------------------------------
+
+class SAL_DLLPUBLIC_EXPORT SfxPopupMenuManager : public SfxMenuManager
+{
+private:
+ Menu* pSVMenu;
+
+ // when #i107205 gets fixed this one should be superfluous.
+ // But right now we want to avoid the memory leak that would otherwise occur,
+ // if we don't delete the pointer that got created in SfxPopupMenuManager::Popup
+ static PopupMenu * pStaticThesSubMenu;
+
+ // only declared, but not defined: don't allow copying
+ SfxPopupMenuManager( const SfxPopupMenuManager& );
+ SfxPopupMenuManager& operator=( const SfxPopupMenuManager& );
+
+public:
+ SfxPopupMenuManager( PopupMenu*, SfxBindings& );
+ ~SfxPopupMenuManager();
+ static void ExecutePopup( const ResId&, SfxViewFrame* pViewFrame, const Point& rPoint, Window* pWindow );
+ // @deprecated!!
+ // Don't use this method any longer. The whole class will be removed in the future.
+ // Changing code which relies on Popup would need much more effort.
+ static SfxPopupMenuManager* Popup( const ResId& rResId, SfxViewFrame* pFrame,const Point& rPoint, Window* pWindow );
+
+ sal_uInt16 Execute( const Point& rPos, Window *pWindow );
+
+ void RemoveDisabledEntries();
+ Menu* GetSVMenu();
+};
+
+#endif // #ifndef _SFXMNUMGR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/module.hxx b/include/sfx2/module.hxx
new file mode 100644
index 000000000000..3b285faf6593
--- /dev/null
+++ b/include/sfx2/module.hxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXMODULE_HXX
+#define _SFXMODULE_HXX // internal
+#define _SFXMOD_HXX // external
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include <sfx2/shell.hxx>
+#include <svtools/imgdef.hxx>
+#include <sal/types.h>
+#include <tools/fldunit.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <vector>
+
+class ImageList;
+
+class SfxBindings;
+class SfxObjectFactory;
+class ModalDialog;
+class SfxObjectFactory;
+class SfxModule;
+typedef ::std::vector<SfxModule*> SfxModuleArr_Impl;
+class SfxModule_Impl;
+class SfxSlotPool;
+struct SfxChildWinContextFactory;
+struct SfxChildWinFactory;
+struct SfxMenuCtrlFactory;
+struct SfxStbCtrlFactory;
+struct SfxTbxCtrlFactory;
+class SfxTbxCtrlFactArr_Impl;
+class SfxChildWinFactArr_Impl;
+class SfxMenuCtrlFactArr_Impl;
+class SfxStbCtrlFactArr_Impl;
+class SfxTabPage;
+class Window;
+
+namespace com { namespace sun { namespace star { namespace frame {
+ class XFrame;
+} } } }
+//====================================================================
+
+class SFX2_DLLPUBLIC SfxModule : public SfxShell
+{
+private:
+ ResMgr* pResMgr;
+ sal_Bool bDummy : 1;
+ SfxModule_Impl* pImpl;
+
+ SAL_DLLPRIVATE void Construct_Impl();
+
+public:
+ TYPEINFO();
+ SFX_DECL_INTERFACE(SFX_INTERFACE_SFXMODULE)
+
+ SfxModule( ResMgr* pMgrP, sal_Bool bDummy,
+ SfxObjectFactory* pFactoryP, ... );
+ ~SfxModule();
+
+ ResMgr* GetResMgr() const { return SfxShell::GetResMgr(); }
+ virtual ResMgr* GetResMgr();
+ SfxSlotPool* GetSlotPool() const;
+
+ void RegisterToolBoxControl(SfxTbxCtrlFactory*);
+ void RegisterChildWindow(SfxChildWinFactory*);
+ void RegisterStatusBarControl(SfxStbCtrlFactory*);
+ void RegisterMenuControl(SfxMenuCtrlFactory*);
+
+ virtual SfxTabPage* CreateTabPage( sal_uInt16 nId,
+ Window* pParent,
+ const SfxItemSet& rSet );
+ virtual void Invalidate(sal_uInt16 nId = 0);
+
+ /*virtual*/ bool IsChildWindowAvailable( const sal_uInt16 i_nId, const SfxViewFrame* i_pViewFrame ) const;
+
+ static SfxModule* GetActiveModule( SfxViewFrame* pFrame=NULL );
+ static FieldUnit GetCurrentFieldUnit();
+ /** retrieves the field unit of the module belonging to the document displayed in the given frame
+
+ Effectively, this method looks up the SfxViewFrame belonging to the given XFrame, then the SfxModule belonging to
+ the document in this frame, then this module's field unit.
+
+ Failures in any of those steps are reported as assertion in non-product builds, and then FUNIT_100TH_MM is returned.
+ */
+ static FieldUnit GetModuleFieldUnit( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > const & i_frame );
+ FieldUnit GetFieldUnit() const;
+
+ SAL_DLLPRIVATE static SfxModuleArr_Impl& GetModules_Impl();
+ SAL_DLLPRIVATE static void DestroyModules_Impl();
+ SAL_DLLPRIVATE SfxTbxCtrlFactArr_Impl* GetTbxCtrlFactories_Impl() const;
+ SAL_DLLPRIVATE SfxStbCtrlFactArr_Impl* GetStbCtrlFactories_Impl() const;
+ SAL_DLLPRIVATE SfxMenuCtrlFactArr_Impl* GetMenuCtrlFactories_Impl() const;
+ SAL_DLLPRIVATE SfxChildWinFactArr_Impl* GetChildWinFactories_Impl() const;
+ SAL_DLLPRIVATE ImageList* GetImageList_Impl( sal_Bool bBig );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/msg.hxx b/include/sfx2/msg.hxx
new file mode 100644
index 000000000000..eca6618cc118
--- /dev/null
+++ b/include/sfx2/msg.hxx
@@ -0,0 +1,333 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXMSG_HXX
+#define _SFXMSG_HXX
+
+#include <tools/rtti.hxx>
+#include <sfx2/shell.hxx>
+#include <rtl/string.hxx>
+#include <rtl/ustring.hxx>
+#include <sfx2/dllapi.h>
+
+//--------------------------------------------------------------------
+
+#define SFX_SLOT_CACHABLE 0x0001L // exclusiv to VOLATILE, default
+#define SFX_SLOT_VOLATILE 0x0002L // per Timer every 2s get new,
+ // exclusiv to CACHABLE
+#define SFX_SLOT_TOGGLE 0x0004L // inverted for Execute old value
+#define SFX_SLOT_AUTOUPDATE 0x0008L // invalidated the status automatically
+ // after execute
+
+#define SFX_SLOT_SYNCHRON 0x0010L // exclusiv to ASYNCHRON, default
+#define SFX_SLOT_ASYNCHRON 0x0020L // via Post-Message, exclusiv
+ // to SYNCHRON
+
+#define SFX_SLOT_HASCOREID 0x0040L // Slot-ID/Which-ID execute mapping
+#define SFX_SLOT_HASDIALOG 0x0080L // Coordinates for dialogue after recofig
+
+#define SFX_SLOT_NORECORD 0x0100L // no recording
+#define SFX_SLOT_RECORDPERITEM 0x0200L // each item, one statement
+#define SFX_SLOT_RECORDPERSET 0x0400L // The whole Set is a Statement, default
+#define SFX_SLOT_RECORDMANUAL 0x0800L // Recording by the application
+ // developer is default
+
+#define SFX_SLOT_RECORDABSOLUTE 0x1000000L // Recording with absolute Target
+#define SFX_SLOT_STANDARD ( SFX_SLOT_CACHABLE | \
+ SFX_SLOT_SYNCHRON | \
+ SFX_SLOT_RECORDPERSET )
+
+#define SFX_SLOT_PROPGET 0x1000L // get property
+#define SFX_SLOT_PROPSET 0x2000L // set property, exclusiv to
+ // SFX_SLOT_METHOD
+#define SFX_SLOT_METHOD 0x4000L // Method, exclusiv to SFX_SLOT_PROPSET
+
+#define SFX_SLOT_FASTCALL 0x8000L // No test if disabled before Execute
+
+#define SFX_SLOT_STATUSBARCONFIG 0x10000L // configurable status row
+#define SFX_SLOT_MENUCONFIG 0x20000L // configurable Menu
+#define SFX_SLOT_TOOLBOXCONFIG 0x40000L // configurable Toolboxen
+#define SFX_SLOT_ACCELCONFIG 0x80000L // configurable keys
+
+#define SFX_SLOT_CONTAINER 0x100000L // Operated by the container at
+ // InPlace
+#define SFX_SLOT_READONLYDOC 0x200000L // also available for
+ // read-only Documents
+#define SFX_SLOT_IMAGEROTATION 0x400000L // Rotate image on Vertical/
+ // Bi-directional writing
+#define SFX_SLOT_IMAGEREFLECTION 0x800000L // Mirror image on Vertical/
+ // Bi-directional writing
+
+//--------------------------------------------------------------------
+
+class SfxRequest;
+class SfxItemSet;
+
+#define SFX_EXEC_STUB( aShellClass, aExecMethod) \
+ void SfxStub##aShellClass##aExecMethod( \
+ SfxShell *pShell, SfxRequest& rReq) \
+ { \
+ (( aShellClass* ) pShell )->aExecMethod( rReq ); \
+ }
+
+#define SFX_STATE_STUB( aShellClass, aStateMethod) \
+ void SfxStub##aShellClass##aStateMethod( \
+ SfxShell *pShell, SfxItemSet& rSet) \
+ { \
+ (( aShellClass* ) pShell )->aStateMethod( rSet ); \
+ }
+
+#define SFX_STUB_PTR( aShellClass, aMethod ) \
+ &SfxStub##aShellClass##aMethod
+
+#define SFX_STUB_PTR_EXEC_NONE &SfxShell::EmptyExecStub
+
+#define SFX_STUB_PTR_STATE_NONE &SfxShell::EmptyStateStub
+
+//--------------------------------------------------------------------
+
+enum SfxSlotKind
+{
+ SFX_KIND_STANDARD,
+ SFX_KIND_ENUM,
+ SFX_KIND_ATTR
+};
+
+//=========================================================================
+
+struct SfxTypeAttrib
+{
+ sal_uInt16 nAID;
+ const char* pName;
+};
+
+struct SfxType
+{
+ TypeId aTypeId;
+ sal_uInt16 nAttribs;
+ SfxTypeAttrib aAttrib[16];
+
+ const TypeId& Type() const
+ { return aTypeId; }
+ SfxPoolItem* CreateItem() const
+ { return (SfxPoolItem*) aTypeId(); }
+};
+
+struct SfxType0
+{
+ TypeId aTypeId;
+ sal_uInt16 nAttribs;
+
+ const TypeId& Type() const
+ { return aTypeId; }
+ SfxPoolItem* CreateItem() const
+ { return (SfxPoolItem*) aTypeId(); }
+};
+
+#define SFX_DECL_TYPE(n) struct SfxType##n \
+ { \
+ TypeId aTypeId; \
+ sal_uInt16 nAttribs; \
+ SfxTypeAttrib aAttrib[n]; \
+ }
+
+#define SFX_TYPE(Class) &a##Class##_Impl
+
+SFX_DECL_TYPE(1);
+SFX_DECL_TYPE(2);
+SFX_DECL_TYPE(3);
+SFX_DECL_TYPE(4);
+SFX_DECL_TYPE(5);
+SFX_DECL_TYPE(6);
+SFX_DECL_TYPE(7);
+SFX_DECL_TYPE(8);
+SFX_DECL_TYPE(10); // for SfxDocInfoItem
+SFX_DECL_TYPE(11);
+
+SFX_DECL_TYPE(13); // for SwAddPrinterItem, Sd...
+SFX_DECL_TYPE(14);
+SFX_DECL_TYPE(16); // for SwDocDisplayItem
+SFX_DECL_TYPE(17); // for SvxAddressItem
+SFX_DECL_TYPE(18); // for SvxSearchItem
+
+// all SfxTypes must be in this header
+#undef SFX_DECL_TYPE
+
+#define SFX_SLOT_ARG( aShellClass, id, GroupId, ExecMethodPtr, StateMethodPtr, Flags, ItemClass, nArg0, nArgs, Name, Prop ) \
+ { id, GroupId, id, Flags | Prop, \
+ USHRT_MAX, 0, \
+ ExecMethodPtr, \
+ StateMethodPtr, \
+ (const SfxType*) &a##ItemClass##_Impl, \
+ Name, Name, 0, 0, \
+ &a##aShellClass##Args_Impl[nArg0], nArgs, 0, Name \
+ }
+
+#define SFX_SLOT( aShellClass, id, GroupId, ExecMethodPtr, StateMethodPtr, Flags, ItemClass ) \
+ { id, GroupId, id, Flags, \
+ 0, 0, \
+ ExecMethodPtr, \
+ StateMethodPtr, \
+ (const SfxType*) &a##ItemClass##_Impl, \
+ 0, 0, 0, 0, 0, 0, 0 \
+ }
+
+#define SFX_NEW_SLOT_ARG( aShellClass, id, hid, GroupId, pLinked, pNext, ExecMethodPtr, StateMethodPtr, Flags, DisableFlags, ItemClass, nArg0, nArgs, Name, Prop, UnoName ) \
+ { id, GroupId, hid, Flags | Prop, \
+ USHRT_MAX, 0, \
+ ExecMethodPtr, \
+ StateMethodPtr, \
+ (const SfxType*) &a##ItemClass##_Impl, \
+ Name, Name, \
+ pLinked, pNext, \
+ &a##aShellClass##Args_Impl[nArg0], nArgs, DisableFlags, UnoName \
+ }
+
+#define SFX_NEW_SLOT_ENUM( SlaveId, hid, GroupId, pMaster, pNext, MasterId, Value, Flags, DisableFlags, UnoName ) \
+ { SlaveId, GroupId, hid, Flags, \
+ MasterId, Value, \
+ 0, \
+ 0, \
+ (const SfxType*) &aSfxBoolItem_Impl, \
+ 0, 0, \
+ pMaster, \
+ pNext, \
+ 0, 0, DisableFlags, UnoName \
+ }
+
+#define SFX_ARGUMENT( ArgSlotId, ArgName, ArgTypeId ) \
+ { (const SfxType*) &a##ArgTypeId##_Impl, ArgName, ArgSlotId }
+
+//--------------------------------------------------------------------
+
+class SfxPoolItem;
+
+struct SfxFormalArgument
+{
+ const SfxType* pType; // Type of the parameter (SfxPoolItem subclass)
+ const char* pName; // Name of the sParameters
+ sal_uInt16 nSlotId; // Slot-Id for identification of the Parameters
+
+ const TypeId& Type() const
+ { return pType->aTypeId; }
+ SfxPoolItem* CreateItem() const
+ { return (SfxPoolItem*) pType->aTypeId(); }
+};
+
+//--------------------------------------------------------------------
+
+class SfxSlot
+{
+public:
+ sal_uInt16 nSlotId; // Unique slot-ID in Shell
+ sal_uInt16 nGroupId; // for configuration region
+ sal_uIntPtr nHelpId; // Usually == nSlotId
+ sal_uIntPtr nFlags; // artihmetic ordered Flags
+
+ sal_uInt16 nMasterSlotId; // Enum-Slot for example Which-Id
+ sal_uInt16 nValue; // Value, in case of Enum-Slot
+
+ SfxExecFunc fnExec; // Function to be excecuted
+ SfxStateFunc fnState; // Function for Status
+
+ const SfxType* pType; // SfxPoolItem-Type (Status)
+ const char* pName; // Name of the Slots
+ const char* pMethodName; // Name of the Method if different
+
+ const SfxSlot* pLinkedSlot; // Master-Slot for Enum value
+ const SfxSlot* pNextSlot; // with the same Status-Method
+
+ const SfxFormalArgument* pFirstArgDef; // first formal Argument-Definition
+ sal_uInt16 nArgDefCount; // Number of formal Argumentents
+ long nDisableFlags; // DisableFlags that need to be
+ // present, so that the Slot
+ // can be enabled
+ const char* pUnoName; // UnoName for the Slots
+
+public:
+
+ SfxSlotKind GetKind() const;
+ sal_uInt16 GetSlotId() const;
+ sal_uIntPtr GetHelpId() const;
+ sal_uIntPtr GetMode() const;
+ sal_Bool IsMode( sal_uIntPtr nMode ) const;
+ sal_uInt16 GetGroupId() const;
+ sal_uInt16 GetMasterSlotId() const { return nMasterSlotId; }
+ sal_uInt16 GetWhich( const SfxItemPool &rPool ) const;
+ sal_uInt16 GetValue() const { return nValue; }
+ const SfxType* GetType() const { return pType; }
+ const char* GetUnoName() const { return pUnoName; }
+ SFX2_DLLPUBLIC OString GetCommand() const;
+ SFX2_DLLPUBLIC OUString GetCommandString() const;
+
+ sal_uInt16 GetFormalArgumentCount() const { return nArgDefCount; }
+ const SfxFormalArgument& GetFormalArgument( sal_uInt16 nNo ) const
+ { return pFirstArgDef[nNo]; }
+
+ SfxExecFunc GetExecFnc() const { return fnExec; }
+ SfxStateFunc GetStateFnc() const { return fnState; }
+
+ const SfxSlot* GetLinkedSlot() const { return pLinkedSlot; }
+ const SfxSlot* GetNextSlot() const { return pNextSlot; }
+};
+
+//=========================================================================
+
+// returns the id of the function
+
+inline sal_uInt16 SfxSlot::GetSlotId() const
+{
+ return nSlotId;
+}
+//--------------------------------------------------------------------
+// returns the help-id of the slot
+
+inline sal_uIntPtr SfxSlot::GetHelpId() const
+{
+ return nHelpId;
+}
+
+//--------------------------------------------------------------------
+
+// returns a bitfield with flags
+
+inline sal_uIntPtr SfxSlot::GetMode() const
+{
+ return nFlags;
+}
+//--------------------------------------------------------------------
+
+// determines if the specified mode is assigned
+
+inline sal_Bool SfxSlot::IsMode( sal_uIntPtr nMode ) const
+{
+ return (nFlags & nMode) != 0;
+}
+//--------------------------------------------------------------------
+
+// returns the id of the associated group
+
+inline sal_uInt16 SfxSlot::GetGroupId() const
+{
+ return nGroupId;
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/msgpool.hxx b/include/sfx2/msgpool.hxx
new file mode 100644
index 000000000000..500912ff3f5b
--- /dev/null
+++ b/include/sfx2/msgpool.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXMSGPOOL_HXX
+#define _SFXMSGPOOL_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include "sal/types.h"
+
+#include <sfx2/msg.hxx>
+#include <tools/string.hxx>
+
+#include <string>
+#include <vector>
+
+class SfxInterface;
+class SfxSlot;
+
+typedef std::basic_string< sal_uInt16 > SfxSlotGroupArr_Impl;
+typedef std::vector<SfxInterface*> SfxInterfaceArr_Impl;
+
+class SFX2_DLLPUBLIC SfxSlotPool
+{
+ SfxSlotGroupArr_Impl* _pGroups;
+ SfxSlotPool* _pParentPool;
+ ResMgr* _pResMgr;
+ SfxInterfaceArr_Impl* _pInterfaces;
+ sal_uInt16 _nCurGroup;
+ sal_uInt16 _nCurInterface;
+ sal_uInt16 _nCurMsg;
+
+private:
+ const SfxSlot* SeekSlot( sal_uInt16 nObject );
+
+public:
+ SfxSlotPool( SfxSlotPool* pParent=0, ResMgr* pMgr=0);
+ ~SfxSlotPool();
+
+ void RegisterInterface( SfxInterface& rFace );
+ void ReleaseInterface( SfxInterface& rFace );
+ SfxInterface* FirstInterface();
+
+ static SfxSlotPool& GetSlotPool( SfxViewFrame *pFrame=NULL );
+
+ sal_uInt16 GetGroupCount();
+ String SeekGroup( sal_uInt16 nNo );
+ const SfxSlot* FirstSlot();
+ const SfxSlot* NextSlot();
+ const SfxSlot* GetSlot( sal_uInt16 nId );
+ const SfxSlot* GetUnoSlot( sal_uInt16 nId );
+ const SfxSlot* GetUnoSlot( const String& rUnoName );
+ TypeId GetSlotType( sal_uInt16 nSlotId ) const;
+};
+
+//--------------------------------------------------------------------
+
+// seeks to the first func in the current group
+
+inline const SfxSlot* SfxSlotPool::FirstSlot()
+{
+ return SeekSlot(0);
+}
+
+#define SFX_SLOTPOOL() SfxSlotPool::GetSlotPool()
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/navigat.hxx b/include/sfx2/navigat.hxx
new file mode 100644
index 000000000000..b1cada954d2b
--- /dev/null
+++ b/include/sfx2/navigat.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SFXNAVI_HXX
+#define _SFXNAVI_HXX
+
+#include <sfx2/childwin.hxx>
+#include <sfx2/dockwin.hxx>
+
+class SfxNavigatorWrapper : public SfxChildWindow
+{
+
+public:
+ SfxNavigatorWrapper( Window* pParent ,
+ sal_uInt16 nId ,
+ SfxBindings* pBindings ,
+ SfxChildWinInfo* pInfo );
+
+ SFX_DECL_CHILDWINDOW(SfxNavigatorWrapper);
+};
+
+class SfxNavigator : public SfxDockingWindow
+{
+ SfxChildWindow* pWrapper;
+
+public:
+ SfxNavigator( SfxBindings* pBindings ,
+ SfxChildWindow* pChildWin ,
+ Window* pParent ,
+ WinBits nBits );
+
+ virtual void Resize();
+ virtual void Resizing( Size& rSize );
+ virtual sal_Bool Close();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/new.hxx b/include/sfx2/new.hxx
new file mode 100644
index 000000000000..a7534580f1cd
--- /dev/null
+++ b/include/sfx2/new.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXNEW_HXX
+#define _SFXNEW_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+
+#include <vcl/button.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/fixed.hxx>
+#include <sfx2/basedlgs.hxx>
+
+//=========================================================================
+
+class SfxObjectShellLock;
+class SfxObjectShell;
+class MoreButton;
+
+//=========================================================================
+
+#define SFXWB_PREVIEW 0x0003
+#define SFXWB_LOAD_TEMPLATE 0x0004
+
+#define SFX_LOAD_TEXT_STYLES 0x0001
+#define SFX_LOAD_FRAME_STYLES 0x0002
+#define SFX_LOAD_PAGE_STYLES 0x0004
+#define SFX_LOAD_NUM_STYLES 0x0008
+#define SFX_MERGE_STYLES 0x0010
+
+#define RET_TEMPLATE_LOAD 100
+
+class SfxNewFileDialog_Impl;
+class SFX2_DLLPUBLIC SfxNewFileDialog : public SfxModalDialog
+{
+ friend class SfxNewFileDialog_Impl;
+
+private:
+ SfxNewFileDialog_Impl* pImpl;
+
+public:
+
+ SfxNewFileDialog(Window *pParent, sal_uInt16 nFlags = 0);
+ ~SfxNewFileDialog();
+
+ // Returns sal_False, when '- No -' is set as Template
+ // Template names can only be obtained when IsTemplate() returns sal_True.
+ sal_Bool IsTemplate() const;
+ String GetTemplateFileName() const;
+
+ // load template methods
+ sal_uInt16 GetTemplateFlags()const;
+ void SetTemplateFlags(sal_uInt16 nSet);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/newstyle.hxx b/include/sfx2/newstyle.hxx
new file mode 100644
index 000000000000..2c7999f9923c
--- /dev/null
+++ b/include/sfx2/newstyle.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _NEWSTYLE_HXX
+#define _NEWSTYLE_HXX
+
+#include <comphelper/string.hxx>
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <vcl/button.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/combobox.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/fixed.hxx>
+
+class SfxStyleSheetBasePool;
+
+class SFX2_DLLPUBLIC SfxNewStyleDlg : public ModalDialog
+{
+private:
+ FixedLine aColFL;
+ ComboBox aColBox;
+ OKButton aOKBtn;
+ CancelButton aCancelBtn;
+
+ QueryBox aQueryOverwriteBox;
+ SfxStyleSheetBasePool& rPool;
+
+ DECL_DLLPRIVATE_LINK( OKHdl, Control * );
+ DECL_DLLPRIVATE_LINK( ModifyHdl, ComboBox * );
+
+public:
+ SfxNewStyleDlg( Window* pParent, SfxStyleSheetBasePool& );
+ ~SfxNewStyleDlg();
+
+ String GetName() const { return comphelper::string::stripStart(aColBox.GetText(), ' '); }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/objface.hxx b/include/sfx2/objface.hxx
new file mode 100644
index 000000000000..8e1f772e3791
--- /dev/null
+++ b/include/sfx2/objface.hxx
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXOBJFACE_HXX
+#define _SFXOBJFACE_HXX
+
+#include "sal/config.h"
+
+#include "rtl/ustring.hxx"
+#include "sfx2/dllapi.h"
+#include "sal/types.h"
+#include <tools/string.hxx>
+#include <tools/resid.hxx>
+
+#include <sfx2/msg.hxx>
+
+struct SfxFormalArgument;
+struct SfxInterface_Impl;
+class SfxConfigItem;
+class SfxModule;
+class SvStream;
+
+class SFX2_DLLPUBLIC SfxInterface
+{
+friend class SfxSlotPool;
+
+ const char* pName; // Sfx-internal name of interface
+ const SfxInterface* pGenoType; // base interface
+ SfxSlot* pSlots; // SlotMap
+ sal_uInt16 nCount; // number of slots in SlotMap
+ SfxInterfaceId nClassId; // Id of interface
+ ResId aNameResId; // ResId of external interface name
+ SfxInterface_Impl* pImpData;
+
+ SfxSlot* operator[]( sal_uInt16 nPos ) const;
+
+public:
+ SfxInterface( const char *pClass,
+ const ResId& rResId,
+ SfxInterfaceId nClassId,
+ const SfxInterface* pGeno,
+ SfxSlot &rMessages, sal_uInt16 nMsgCount );
+ virtual ~SfxInterface();
+
+ void SetSlotMap( SfxSlot& rMessages, sal_uInt16 nMsgCount );
+ inline sal_uInt16 Count() const;
+
+ const SfxSlot* GetRealSlot( const SfxSlot * ) const;
+ const SfxSlot* GetRealSlot( sal_uInt16 nSlotId ) const;
+ virtual const SfxSlot* GetSlot( sal_uInt16 nSlotId ) const;
+ const SfxSlot* GetSlot( const String& rCommand ) const;
+
+ const char* GetClassName() const { return pName; }
+ bool HasName() const { return 0 != aNameResId.GetId(); }
+ OUString GetName() const
+ { return HasName() ? aNameResId.toString() : OUString(); }
+ ResMgr* GetResMgr() const
+ { return aNameResId.GetResMgr(); }
+
+ const SfxInterface* GetGenoType() const { return pGenoType; }
+ const SfxInterface* GetRealInterfaceForSlot( const SfxSlot* ) const;
+
+ void RegisterObjectBar( sal_uInt16, const ResId&, const String* pST=0 );
+ void RegisterObjectBar( sal_uInt16, const ResId&, sal_uInt32 nFeature, const String* pST=0 );
+ void RegisterChildWindow( sal_uInt16, sal_Bool bContext, const String* pST=0 );
+ void RegisterChildWindow( sal_uInt16, sal_Bool bContext, sal_uInt32 nFeature, const String* pST=0 );
+ void RegisterStatusBar( const ResId& );
+ const ResId& GetObjectBarResId( sal_uInt16 nNo ) const;
+ sal_uInt16 GetObjectBarPos( sal_uInt16 nNo ) const;
+ sal_uInt32 GetObjectBarFeature( sal_uInt16 nNo ) const;
+ sal_uInt16 GetObjectBarCount() const;
+ void SetObjectBarPos( sal_uInt16 nPos, sal_uInt16 nId );
+ const String* GetObjectBarName( sal_uInt16 nNo ) const;
+ sal_Bool IsObjectBarVisible( sal_uInt16 nNo) const;
+ sal_uInt32 GetChildWindowFeature( sal_uInt16 nNo ) const;
+ sal_uInt32 GetChildWindowId( sal_uInt16 nNo ) const;
+ sal_uInt16 GetChildWindowCount() const;
+ void RegisterPopupMenu( const ResId& );
+ const ResId& GetPopupMenuResId() const;
+ const ResId& GetStatusBarResId() const;
+
+ void Register( SfxModule* );
+
+ SAL_DLLPRIVATE int ContainsSlot_Impl( const SfxSlot *pSlot ) const
+ { return pSlot >= pSlots && pSlot < pSlots + Count(); }
+ SAL_DLLPRIVATE ResMgr* GetResManager_Impl() const
+ { return aNameResId.GetResMgr(); }
+};
+
+//--------------------------------------------------------------------
+
+// returns the number of functions in this cluster
+
+inline sal_uInt16 SfxInterface::Count() const
+{
+ return nCount;
+}
+
+//--------------------------------------------------------------------
+
+// returns a function by position in the array
+
+inline SfxSlot* SfxInterface::operator[]( sal_uInt16 nPos ) const
+{
+ return nPos < nCount? pSlots+nPos: 0;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/objitem.hxx b/include/sfx2/objitem.hxx
new file mode 100644
index 000000000000..8e607c9f0ce5
--- /dev/null
+++ b/include/sfx2/objitem.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX_OBJITEM_HXX
+#define _SFX_OBJITEM_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include <svl/poolitem.hxx>
+
+#include <sfx2/shell.hxx>
+
+//------------------------------------------------------------------------
+
+class SFX2_DLLPUBLIC SfxObjectItem: public SfxPoolItem
+{
+ SfxShell* _pSh;
+
+public:
+ TYPEINFO();
+ SfxObjectItem( sal_uInt16 nWhich=0, SfxShell *pSh=0 );
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+
+ SfxShell* GetShell() const
+ { return _pSh; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx
new file mode 100644
index 000000000000..4c366a56710f
--- /dev/null
+++ b/include/sfx2/objsh.hxx
@@ -0,0 +1,824 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX_OBJSH_HXX
+#define _SFX_OBJSH_HXX
+
+#include <config_features.h>
+
+#include "sal/config.h"
+
+#include "tools/solar.h"
+#include "sfx2/dllapi.h"
+#include "sal/types.h"
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/script/XLibraryContainer.hpp>
+#include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
+#include <com/sun/star/embed/XStorage.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/security/DocumentSignatureInformation.hpp>
+#include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
+#include <com/sun/star/task/XInteractionHandler.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <boost/shared_ptr.hpp>
+
+//________________________________________________________________________________________________________________
+// include something else
+//________________________________________________________________________________________________________________
+
+#include <vcl/timer.hxx>
+#include <svl/poolitem.hxx>
+#include <vcl/bitmap.hxx>
+#include <sot/storage.hxx>
+#include <rsc/rscsfx.hxx>
+
+#include <sfx2/XmlIdRegistry.hxx>
+#include <sfx2/shell.hxx>
+#include <comphelper/embeddedobjectcontainer.hxx>
+#include <com/sun/star/frame/XModel.hpp>
+
+class SbxValue;
+class SvxMacro;
+class SbxArray;
+class BasicManager;
+class SfxMedium;
+class SfxObjectFactory;
+class SfxDocumentInfoDialog;
+class SfxStyleSheetBasePool;
+class INote;
+class SfxStyleSheetPool;
+class SfxFrame;
+class SbMethod;
+class StarBASIC;
+class Printer;
+class SvKeyValueIterator;
+class SfxBaseModel;
+class SfxModule;
+class SvData;
+class SfxProgress;
+class GDIMetaFile;
+class Bitmap;
+class INetURLObject;
+class IndexBitSet;
+class JobSetup;
+class Size;
+class Point;
+
+// From embobj.hxx
+#define ASPECT_CONTENT 1
+#define ASPECT_THUMBNAIL 2 /* 120 * 120, 6 Colors DIB in MetaFile */
+#define ASPECT_ICON 4
+#define ASPECT_DOCPRINT 8
+#define ASPECT_ALL (ASPECT_CONTENT | ASPECT_THUMBNAIL | ASPECT_ICON | ASPECT_DOCPRINT)
+
+// from pseudo.hxx; must be the same as in OLE2
+#define SVOBJ_MISCSTATUS_SERVERRESIZE 1
+#define SVOBJ_MISCSTATUS_NOTREPLACE 4
+#define SVOBJ_MISCSTATUS_CANTLINKINSIDE 16
+#define SVOBJ_MISCSTATUS_LINK 64
+#define SVOBJ_MISCSTATUS_INSIDEOUT 128
+#define SVOBJ_MISCSTATUS_ACTIVATEWHENVISIBLE 256
+#define SVOBJ_MISCSTATUS_NOTRESIZEABLE 512
+#define SVOBJ_MISCSTATUS_ALWAYSACTIVATE 1024
+#define SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE 2048
+#define SVOBJ_MISCSTATUS_SPECIALOBJECT 4096
+
+
+namespace sfx2
+{
+ class SvLinkSource;
+}
+
+namespace com { namespace sun { namespace star { namespace datatransfer { class XTransferable; } } } }
+
+namespace com { namespace sun { namespace star {
+ namespace document {
+ class XDocumentProperties;
+ }
+ namespace lang {
+ class XComponent;
+ }
+} } }
+
+typedef sal_uInt32 SfxObjectShellFlags;
+#define SFXOBJECTSHELL_HASOPENDOC 0x01L
+#define SFXOBJECTSHELL_DONTREPLACE 0x02L
+#define SFXOBJECTSHELL_HASMENU 0x04L
+#define SFXOBJECTSHELL_DONTLOADFILTERS 0x08L
+#define SFXOBJECTSHELL_DONTCLOSE 0x10L
+#define SFXOBJECTSHELL_NODOCINFO 0x20L
+#define SFXOBJECTSHELL_STD_NORMAL ( SFXOBJECTSHELL_HASOPENDOC )
+#define SFXOBJECTSHELL_STD_SPECIAL ( SFXOBJECTSHELL_DONTLOADFILTERS )
+#define SFXOBJECTSHELL_UNDEFINED 0xf000000
+
+//--------------------------------------------------------------------
+
+#define SFX_TITLE_TITLE 0
+#define SFX_TITLE_FILENAME 1
+#define SFX_TITLE_FULLNAME 2
+#define SFX_TITLE_APINAME 3
+#define SFX_TITLE_DETECT 4
+#define SFX_TITLE_CAPTION 5
+#define SFX_TITLE_PICKLIST 6
+#define SFX_TITLE_HISTORY 7
+#define SFX_TITLE_MAXLEN 10 // this gives the limits on length
+
+#define SFX_LOADED_MAINDOCUMENT 1
+#define SFX_LOADED_IMAGES 2
+#define SFX_LOADED_ALL 3
+
+//--------------------------------------------------------------------
+
+#define HIDDENINFORMATION_RECORDEDCHANGES 0x0001
+#define HIDDENINFORMATION_NOTES 0x0002
+#define HIDDENINFORMATION_DOCUMENTVERSIONS 0x0004
+
+enum HiddenWarningFact
+{
+ WhenSaving = 0,
+ WhenPrinting,
+ WhenSigning,
+ WhenCreatingPDF
+};
+
+//--------------------------------------------------------------------
+
+enum SfxObjectCreateMode
+{
+ SFX_CREATE_MODE_EMBEDDED,
+ SFX_CREATE_MODE_STANDARD,
+ SFX_CREATE_MODE_PREVIEW,
+ SFX_CREATE_MODE_ORGANIZER,
+ SFX_CREATE_MODE_PLUGIN,
+ SFX_CREATE_MODE_INTERNAL
+};
+
+/*====================================================================
+
+The class SfxObjectShell is the base class for SFx-objects, ie documents
+and parts of documents that can be integrated as separate objects
+into foreign objects.
+
+----------------------------------------------------------------------*/
+
+class SfxToolBoxConfig;
+struct TransferableObjectDescriptor;
+
+class SFX2_DLLPUBLIC SfxObjectShell :
+ public SfxShell, virtual public SotObject,
+ public ::comphelper::IEmbeddedHelper, public ::sfx2::IXmlIdRegistrySupplier
+{
+friend struct ModifyBlocker_Impl;
+friend class SfxObjectShellLock;
+
+private:
+ struct SfxObjectShell_Impl* pImp; // internal data
+
+ SfxMedium * pMedium; // Description of the file for example
+ // storage that contains the object
+ SfxStyleSheetBasePool* pStyleSheetPool; // StyleSheets
+ SfxObjectCreateMode eCreateMode; // Purpose of the object
+ sal_Bool bHasName :1, // sal_True := existing object,
+ // sal_False := new object
+ bIsTmp :1; // temporary Storage
+
+private:
+ SAL_DLLPRIVATE void UpdateTime_Impl(const ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XDocumentProperties> & i_xDocProps);
+
+ SAL_DLLPRIVATE sal_Bool SaveTo_Impl(SfxMedium &rMedium, const SfxItemSet* pSet );
+
+protected:
+ SfxObjectShell(SfxObjectCreateMode);
+ SfxObjectShell( const sal_uInt64 i_nCreationFlags ); // see sfxmodelfactory.hxx
+ virtual ~SfxObjectShell();
+
+ virtual void ModifyChanged();
+ virtual sal_Bool Close();
+
+ /** declares the document to have capabilities to contain basic/dialog libraries
+ */
+ void SetHasNoBasic();
+
+ /// template method, called by FlushDocInfo; this implementation is empty
+ virtual void DoFlushDocInfo();
+
+ // helper method
+ void AddToRecentlyUsedList();
+
+public:
+ TYPEINFO();
+ SFX_DECL_INTERFACE(SFX_INTERFACE_SFXDOCSH)
+
+ static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId();
+ /* Stampit disable/enable cancel button for print jobs
+ default = true = enable! */
+ void Stamp_SetPrintCancelState(sal_Bool bState);
+ sal_Bool Stamp_GetPrintCancelState() const;
+
+ using SotObject::GetInterface;
+
+ // Document-Shell Iterator
+ static SfxObjectShell* GetFirst( const TypeId* pType = 0,
+ sal_Bool bOnlyVisible = sal_True );
+ static SfxObjectShell* GetNext( const SfxObjectShell& rPrev,
+ const TypeId* pType = 0,
+ sal_Bool bOnlyVisible = sal_True );
+ static SfxObjectShell* Current();
+ static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+ GetCurrentComponent();
+ static void SetCurrentComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent );
+
+ virtual void Invalidate(sal_uInt16 nId = 0);
+
+ SfxObjectShellFlags GetFlags( ) const ;
+
+ SfxModule* GetModule() const;
+
+ virtual SfxObjectFactory& GetFactory() const=0;
+ SfxMedium * GetMedium() const { return pMedium; }
+ void ForgetMedium() { pMedium = 0; }
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XDocumentProperties > getDocProperties();
+ void UpdateDocInfoForSave( );
+ void FlushDocInfo();
+ sal_Bool HasName() const { return bHasName; }
+ virtual String GetAPIName() const;
+ void SetReadOnly();
+ sal_Bool IsReadOnly() const;
+ sal_Bool IsReadOnlyMedium() const;
+ bool IsOriginallyReadOnlyMedium() const;
+ void SetReadOnlyUI( sal_Bool bReadOnly = sal_True );
+ sal_Bool IsReadOnlyUI() const;
+ void SetNoName();
+ sal_Bool IsInModalMode() const;
+ sal_Bool IsInPrepareClose() const;
+ virtual sal_Bool AcceptStateUpdate() const;
+ sal_Bool IsHelpDocument() const;
+
+#if HAVE_FEATURE_MULTIUSER_ENVIRONMENT
+ sal_Bool IsDocShared() const;
+ OUString GetSharedFileURL() const;
+ sal_Bool SwitchToShared( sal_Bool bShared, sal_Bool bSave );
+ SAL_DLLPRIVATE void FreeSharedFile();
+ SAL_DLLPRIVATE void FreeSharedFile( const OUString& aTempFileURL );
+ SAL_DLLPRIVATE void DoNotCleanShareControlFile();
+ void SetSharedXMLFlag( sal_Bool bFlag ) const;
+ sal_Bool HasSharedXMLFlagSet() const;
+#else
+ sal_Bool IsDocShared() const
+ { return sal_False; };
+ OUString GetSharedFileURL() const
+ { return OUString(); };
+#endif
+
+ SAL_DLLPRIVATE void SetModalMode_Impl(sal_Bool bModal=sal_True);
+ SAL_DLLPRIVATE void SetMacroMode_Impl(sal_Bool bModal=sal_True);
+
+ void ResetError();
+ sal_uInt32 GetError() const;
+ sal_uInt32 GetErrorCode() const;
+ void SetError( sal_uInt32 rErr, const OUString& aLogMessage );
+
+ void AddLog( const OUString& aMessage );
+ void StoreLog();
+
+ /**
+ * Initialize bare minimum just enough for unit test runs.
+ *
+ * @return true if the initialization is successful, false otherwise.
+ */
+ bool DoInitUnitTest();
+ sal_Bool DoInitNew( SfxMedium* pMedium=0 );
+ sal_Bool DoLoad( SfxMedium* pMedium );
+ bool DoLoadExternal( SfxMedium* pMed );
+ sal_Bool DoSave();
+ sal_Bool DoSaveAs( SfxMedium &rNewStor );
+ sal_Bool DoSaveObjectAs( SfxMedium &rNewStor, sal_Bool bCommit );
+
+ // TODO/LATER: currently only overloaded in Calc, should be made non-virtual
+ virtual sal_Bool DoSaveCompleted( SfxMedium* pNewStor=0 );
+
+ virtual sal_Bool LoadOwnFormat( SfxMedium& pMedium );
+ virtual sal_Bool SaveAsOwnFormat( SfxMedium& pMedium );
+ virtual sal_Bool ConvertFrom( SfxMedium &rMedium );
+ virtual sal_Bool ConvertTo( SfxMedium &rMedium );
+ virtual sal_Bool InitNew( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
+ virtual sal_Bool Load( SfxMedium &rMedium );
+ virtual sal_Bool LoadFrom( SfxMedium& rMedium );
+ virtual sal_Bool Save();
+ virtual sal_Bool SaveAs( SfxMedium &rMedium );
+ virtual sal_Bool SaveCompleted( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
+ virtual sal_Bool SwitchPersistance(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
+ virtual void UpdateLinks();
+ virtual bool LoadExternal( SfxMedium& rMedium );
+ /**
+ * Called when the Options dialog is dismissed with the OK button, to
+ * handle potentially conflicting option settings.
+ */
+ virtual void CheckConfigOptions();
+ sal_Bool IsConfigOptionsChecked() const;
+ void SetConfigOptionsChecked( sal_Bool bChecked );
+
+ // called for a few slots like SID_SAVE[AS]DOC, SID_PRINTDOC[DIRECT], derived classes may abort the action
+ virtual sal_Bool QuerySlotExecutable( sal_uInt16 nSlotId );
+
+ sal_Bool SaveChildren(sal_Bool bObjectsOnly=sal_False);
+ sal_Bool SaveAsChildren( SfxMedium &rMedium );
+ sal_Bool SwitchChildrenPersistance(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
+ sal_Bool bForceNonModified = sal_False );
+ sal_Bool SaveCompletedChildren( sal_Bool bSuccess );
+
+ virtual sal_Bool ImportFrom( SfxMedium &rMedium, bool bInsert );
+ sal_Bool ExportTo( SfxMedium &rMedium );
+
+ // xmlsec05, check with SFX team
+ sal_uInt16 GetDocumentSignatureState();
+ void SignDocumentContent();
+ sal_uInt16 GetScriptingSignatureState();
+ void SignScriptingContent();
+
+ virtual SfxDocumentInfoDialog* CreateDocumentInfoDialog(
+ Window *pParent, const SfxItemSet& );
+
+ ErrCode CallBasic( const String& rMacro, const String& rBasicName,
+ SbxArray* pArgs = 0, SbxValue* pRet = 0 );
+
+ ErrCode CallXScript(
+ const String& rScriptURL,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams,
+ ::com::sun::star::uno::Any& aRet,
+ ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam,
+ bool bRaiseError = true,
+ const ::com::sun::star::uno::Any* aCaller = 0 );
+
+ static ErrCode CallXScript(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxScriptContext,
+ const OUString& rScriptURL,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams,
+ ::com::sun::star::uno::Any& aRet,
+ ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam,
+ bool bRaiseError = true,
+ const ::com::sun::star::uno::Any* aCaller = 0
+ );
+
+ /** adjusts the internal macro mode, according to the current security settings
+
+ Finally, the macro mode is either NEVER_EXECUTE or ALWAYS_EXECUTE_NO_WARN.
+
+ @return
+ whether macros from this document should be executed
+ */
+ bool AdjustMacroMode( const String& rScriptType, bool _bSuppressUI = false );
+
+ SvKeyValueIterator* GetHeaderAttributes();
+ void ClearHeaderAttributesForSourceViewHack();
+ void SetHeaderAttributesForSourceViewHack();
+
+ sal_Bool IsTemplate() const;
+
+ sal_Bool IsQueryLoadTemplate() const;
+ sal_Bool IsUseUserData() const;
+ sal_Bool IsLoadReadonly() const;
+ sal_Bool IsSaveVersionOnClose() const;
+ void SetQueryLoadTemplate( sal_Bool b );
+ void SetUseUserData( sal_Bool bNew );
+ void SetLoadReadonly( sal_Bool _bReadonly );
+ void SetSaveVersionOnClose( sal_Bool bSet );
+ void ResetFromTemplate( const String& rTemplateName, const String& rFileName );
+
+ // TODO/LATER: the following two methods should be replaced by Get/SetModifPasswordInfo in future
+ sal_uInt32 GetModifyPasswordHash() const;
+ sal_Bool SetModifyPasswordHash( sal_uInt32 nHash );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > GetModifyPasswordInfo() const;
+ sal_Bool SetModifyPasswordInfo( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aInfo );
+
+ static sal_uInt32 HandleFilter( SfxMedium* pMedium, SfxObjectShell* pDoc );
+
+ virtual void ViewAssigned();
+ virtual sal_uInt16 PrepareClose( sal_Bool bUI = sal_True, sal_Bool bForBrowsing = sal_False );
+ virtual sal_Bool IsInformationLost();
+ virtual sal_uInt16 GetHiddenInformationState( sal_uInt16 nStates );
+ sal_Int16 QueryHiddenInformation( HiddenWarningFact eFact, Window* pParent );
+ virtual sal_Bool HasSecurityOptOpenReadOnly() const;
+ sal_Bool IsSecurityOptOpenReadOnly() const;
+ void SetSecurityOptOpenReadOnly( sal_Bool bOpenReadOnly = sal_True );
+
+ virtual Size GetFirstPageSize();
+ virtual sal_Bool DoClose();
+ virtual void PrepareReload();
+ virtual ::boost::shared_ptr<GDIMetaFile> GetPreviewMetaFile( sal_Bool bFullContent = sal_False ) const;
+ virtual void CancelTransfers();
+
+ sal_Bool GenerateAndStoreThumbnail(
+ sal_Bool bEncrypted,
+ sal_Bool bSigned,
+ sal_Bool bIsTemplate,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStor );
+
+ sal_Bool WriteThumbnail(
+ sal_Bool bEncrypted,
+ sal_Bool bSigned,
+ sal_Bool bIsTemplate,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xStream );
+
+ // Transfer IFace
+ void AbortImport();
+ sal_Bool IsAbortingImport() const;
+ sal_Bool IsReloading() const;
+ void FinishedLoading( sal_uInt16 nWhich = SFX_LOADED_ALL );
+ void TemplateDisconnectionAfterLoad();
+ sal_Bool IsLoading() const;
+ sal_Bool IsLoadingFinished() const;
+ void SetAutoLoad( const INetURLObject&, sal_uInt32 nTime, sal_Bool bReload = sal_True );
+ sal_Bool IsAutoLoadLocked() const;
+ void NotifyReloadAvailable();
+
+ // Misc
+ sal_Bool IsPreview() const;
+ SfxObjectCreateMode GetCreateMode() const { return eCreateMode; }
+ SfxProgress* GetProgress() const;
+ void SetWaitCursor( sal_Bool bSet ) const;
+
+ // Naming Interface
+ void SetTitle( const String& rTitle );
+ String GetTitle( sal_uInt16 nMaxLen = 0 ) const;
+ void InvalidateName(); // Re-set to unnamed
+
+ // DDE-Interface
+ virtual long DdeExecute( const String& rCmd );
+ virtual long DdeGetData( const String& rItem,
+ const String& rMimeType,
+ ::com::sun::star::uno::Any & rValue );
+ virtual long DdeSetData( const String& rItem,
+ const String& rMimeType,
+ const ::com::sun::star::uno::Any & rValue );
+ virtual ::sfx2::SvLinkSource* DdeCreateLinkSource( const String& rItem );
+ virtual void ReconnectDdeLink(SfxObjectShell& rServer);
+
+ static void ReconnectDdeLinks(SfxObjectShell& rServer);
+
+ // Contents
+ virtual SfxStyleSheetBasePool* GetStyleSheetPool();
+ void SetStyleSheetPool(SfxStyleSheetBasePool *pBasePool ) {
+ pStyleSheetPool = pBasePool; }
+
+ // Determine the position of the "Automatic" filter in the stylist
+ void SetAutoStyleFilterIndex(sal_uInt16 nSet);
+ sal_uInt16 GetAutoStyleFilterIndex();
+ virtual sal_Bool HasBasic() const;
+ BasicManager* GetBasicManager() const;
+ com::sun::star::uno::Reference< com::sun::star::script::XLibraryContainer >
+ GetBasicContainer();
+ com::sun::star::uno::Reference< com::sun::star::script::XLibraryContainer >
+ GetDialogContainer();
+ StarBASIC* GetBasic() const;
+
+ // Interface Document content, Organizer
+#define INDEX_IGNORE USHRT_MAX
+
+#define CONTENT_STYLE 0
+#define CONTENT_CONFIG 1
+#define CONTENT_MACRO 2
+#define DEF_CONTENT_COUNT 1
+
+
+ virtual void SetOrganizerSearchMask(
+ SfxStyleSheetBasePool* ) const;
+
+ virtual sal_Bool CanHaveChildren(
+ sal_uInt16 nIdx1,
+ sal_uInt16 nIdx2 = INDEX_IGNORE
+ );
+
+ virtual void GetContent( String &,
+ Bitmap &rClosedBitmap,
+ Bitmap &rOpenedBitmap,
+ sal_Bool &bCanDelete,
+ sal_uInt16 nPos,
+ sal_uInt16 nIdx1
+ );
+
+ virtual Bitmap GetStyleFamilyBitmap(SfxStyleFamily eFamily);
+
+ virtual sal_Bool Insert( SfxObjectShell &rSource,
+ sal_uInt16 nSourceIdx1,
+ sal_uInt16 nSourceIdx2,
+ sal_uInt16 nSourceIdx3,
+ sal_uInt16 &nIdx1,
+ sal_uInt16 &nIdx2,
+ sal_uInt16 &nIdx3,
+ sal_uInt16 &rIdxDeleted);
+
+ virtual sal_Bool Remove( sal_uInt16 nIdx1,
+ sal_uInt16 nIdx2 = INDEX_IGNORE,
+ sal_uInt16 nIdx3 = INDEX_IGNORE);
+
+ virtual void LoadStyles( SfxObjectShell &rSource );
+ void ReadNote( INote * );
+ void UpdateNote( INote * );
+
+ // Documents, for which to format the view size
+
+ virtual SfxObjectShell* GetObjectShell();
+
+ virtual SfxFrame* GetSmartSelf( SfxFrame* pSelf, SfxMedium& rMedium );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
+ GetModel() const;
+ // Only temporarily for the applications!
+ void SetBaseModel( SfxBaseModel* pModel );
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > GetBaseModel() const;
+ // Only temporarily for the applications!
+
+ virtual ::com::sun::star::uno::Sequence< OUString > GetEventNames();
+
+ Window* GetDialogParent( SfxMedium* pMedium=0 );
+ static SfxObjectShell* CreateObject( const String& rServiceName, SfxObjectCreateMode = SFX_CREATE_MODE_STANDARD );
+ static SfxObjectShell* CreateObjectByFactoryName( const String& rURL, SfxObjectCreateMode = SFX_CREATE_MODE_STANDARD );
+ static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
+ CreateAndLoadComponent( const SfxItemSet& rSet, SfxFrame* pFrame = NULL );
+ static SfxObjectShell* GetShellFromComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xComp );
+ static String GetServiceNameFromFactory( const String& rFact );
+ sal_Bool IsInPlaceActive();
+ sal_Bool IsUIActive();
+ virtual void InPlaceActivate( sal_Bool );
+ virtual void UIActivate( sal_Bool );
+
+ static sal_Bool CopyStoragesOfUnknownMediaType(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xSource,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xTarget );
+
+ // ==== The functions from SvPersist
+ void EnableSetModified( sal_Bool bEnable = sal_True );
+ sal_Bool IsEnableSetModified() const;
+ virtual void SetModified( sal_Bool bModified = sal_True );
+ sal_Bool IsModified();
+
+ /**
+ * @param bChart true if the file is a chart doc and FillClass should not be called
+ */
+ void SetupStorage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
+ sal_Int32 nVersion, sal_Bool bTemplate, bool bChart = false ) const;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetStorage();
+
+ SvGlobalName GetClassName() const;
+
+ // comphelper::IEmbeddedHelper
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > getInteractionHandler() const;
+ virtual com::sun::star::uno::Reference < com::sun::star::embed::XStorage > getStorage() const
+ {
+ return const_cast<SfxObjectShell*>(this)->GetStorage();
+ }
+ virtual comphelper::EmbeddedObjectContainer& getEmbeddedObjectContainer() const
+ {
+ return GetEmbeddedObjectContainer();
+ }
+ bool isEnableSetModified() const
+ {
+ return IsEnableSetModified();
+ }
+ comphelper::EmbeddedObjectContainer& GetEmbeddedObjectContainer() const;
+ void ClearEmbeddedObjects();
+
+ // ==== The functions from SvEmbeddedObject
+ virtual Printer * GetDocumentPrinter();
+ virtual OutputDevice* GetDocumentRefDev();
+ virtual void OnDocumentPrinterChanged( Printer * pNewPrinter );
+ virtual Rectangle GetVisArea( sal_uInt16 nAspect ) const;
+ virtual void SetVisArea( const Rectangle & rVisArea );
+ const Rectangle & GetVisArea() const;
+ void SetVisAreaSize( const Size & rVisSize );
+ virtual sal_uIntPtr GetMiscStatus() const;
+
+ MapUnit GetMapUnit() const;
+ void SetMapUnit( MapUnit nMUnit );
+
+ void FillTransferableObjectDescriptor( TransferableObjectDescriptor& rDesc ) const;
+ void DoDraw( OutputDevice *, const Point & rObjPos,
+ const Size & rSize,
+ const JobSetup & rSetup,
+ sal_uInt16 nAspect = ASPECT_CONTENT );
+ virtual void Draw( OutputDevice *, const JobSetup & rSetup,
+ sal_uInt16 nAspect = ASPECT_CONTENT ) = 0;
+
+
+ virtual void FillClass( SvGlobalName * pClassName,
+ sal_uInt32 * pFormat,
+ OUString * pAppName,
+ OUString * pFullTypeName,
+ OUString * pShortTypeName,
+ sal_Int32 nVersion,
+ sal_Bool bTemplate = sal_False) const = 0;
+
+ // change recording and respective passwword protection for Writer and Calc
+ // slots available for Writer: FN_REDLINE_ON, FN_REDLINE_ON
+ // slots used for Calc: FID_CHG_RECORD, SID_CHG_PROTECT
+ virtual bool IsChangeRecording() const;
+ virtual bool HasChangeRecordProtection() const;
+ virtual void SetChangeRecording( bool bActivate );
+ virtual bool SetProtectionPassword( const String &rPassword );
+ virtual bool GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence< sal_Int8 > &rPasswordHash );
+
+ // =================================
+
+ SAL_DLLPRIVATE ::boost::shared_ptr<GDIMetaFile> CreatePreviewMetaFile_Impl( sal_Bool bFullContent ) const;
+
+ SAL_DLLPRIVATE sal_Bool IsOwnStorageFormat_Impl(const SfxMedium &) const;
+
+ SAL_DLLPRIVATE sal_Bool IsPackageStorageFormat_Impl(const SfxMedium &) const;
+
+ SAL_DLLPRIVATE sal_Bool ConnectTmpStorage_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, SfxMedium* pMedium );
+ SAL_DLLPRIVATE sal_Bool DisconnectStorage_Impl( SfxMedium& rSrcMedium, SfxMedium& rTargetMedium );
+
+ SAL_DLLPRIVATE sal_Bool PutURLContentsToVersionStream_Impl(
+ OUString aURL,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xDocStorage,
+ OUString aStreamName );
+
+ SAL_DLLPRIVATE OUString CreateTempCopyOfStorage_Impl(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
+
+ SAL_DLLPRIVATE void InitOwnModel_Impl();
+ SAL_DLLPRIVATE void BreakMacroSign_Impl( sal_Bool bBreakMacroSing );
+ SAL_DLLPRIVATE void CheckSecurityOnLoading_Impl();
+ SAL_DLLPRIVATE void CheckForBrokenDocSignatures_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler );
+ SAL_DLLPRIVATE sal_uInt16 ImplCheckSignaturesInformation(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::security::DocumentSignatureInformation >& aInfos );
+ SAL_DLLPRIVATE void CheckEncryption_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler );
+ SAL_DLLPRIVATE void SetModifyPasswordEntered( sal_Bool bEntered = sal_True );
+ SAL_DLLPRIVATE sal_Bool IsModifyPasswordEntered();
+
+ SAL_DLLPRIVATE void InitBasicManager_Impl();
+ SAL_DLLPRIVATE SfxObjectShell_Impl* Get_Impl() { return pImp; }
+
+ SAL_DLLPRIVATE static sal_Bool UseInteractionToHandleError(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler,
+ sal_uInt32 nError );
+ SAL_DLLPRIVATE const SfxObjectShell_Impl* Get_Impl() const { return pImp; }
+
+ SAL_DLLPRIVATE void SetCreateMode_Impl( SfxObjectCreateMode nMode );
+
+ SAL_DLLPRIVATE void DoDraw_Impl( OutputDevice* pDev,
+ const Point & rViewPos,
+ const Fraction & rScaleX,
+ const Fraction & rScaleY,
+ const JobSetup & rSetup,
+ sal_uInt16 nAspect );
+
+ // Shell Interface
+ SAL_DLLPRIVATE void ExecFile_Impl(SfxRequest &);
+ SAL_DLLPRIVATE void GetState_Impl(SfxItemSet&);
+ SAL_DLLPRIVATE void PrintExec_Impl(SfxRequest &);
+ SAL_DLLPRIVATE void PrintState_Impl(SfxItemSet&);
+ SAL_DLLPRIVATE void ExecProps_Impl(SfxRequest &);
+ SAL_DLLPRIVATE void StateProps_Impl(SfxItemSet &);
+ SAL_DLLPRIVATE void ExecView_Impl(SfxRequest &);
+ SAL_DLLPRIVATE void StateView_Impl(SfxItemSet &);
+
+ // Load/Save public internals
+ SAL_DLLPRIVATE sal_Bool ImportFromGeneratedStream_Impl(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xStream,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescr );
+ SAL_DLLPRIVATE void PositionView_Impl();
+ SAL_DLLPRIVATE void UpdateFromTemplate_Impl();
+ SAL_DLLPRIVATE sal_Bool CanReload_Impl();
+ SAL_DLLPRIVATE void SetNamedVisibility_Impl();
+ SAL_DLLPRIVATE sal_Bool DoSave_Impl( const SfxItemSet* pSet=0 );
+ SAL_DLLPRIVATE sal_Bool Save_Impl( const SfxItemSet* pSet=0 );
+ SAL_DLLPRIVATE sal_Bool PreDoSaveAs_Impl(const String &rFileName, const String &rFiltName, SfxItemSet *);
+ SAL_DLLPRIVATE sal_Bool APISaveAs_Impl ( const String& aFileName, SfxItemSet* aParams );
+ SAL_DLLPRIVATE sal_Bool CommonSaveAs_Impl ( const INetURLObject& aURL, const String& aFilterName, SfxItemSet* aParams );
+ SAL_DLLPRIVATE sal_Bool GeneralInit_Impl(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
+ sal_Bool bTypeMustBeSetAlready );
+ SAL_DLLPRIVATE void PrepareSecondTryLoad_Impl();
+ SAL_DLLPRIVATE void SetInitialized_Impl( const bool i_fromInitNew );
+
+ // public-internals
+ SAL_DLLPRIVATE IndexBitSet& GetNoSet_Impl();
+ SAL_DLLPRIVATE void SetProgress_Impl( SfxProgress *pProgress );
+ SAL_DLLPRIVATE void PostActivateEvent_Impl( SfxViewFrame* );
+ SAL_DLLPRIVATE void SetActivateEvent_Impl(sal_uInt16 );
+ SAL_DLLPRIVATE SfxObjectShell* GetParentShellByModel_Impl();
+
+ // configuration items
+ SAL_DLLPRIVATE SfxToolBoxConfig* GetToolBoxConfig_Impl();
+ SAL_DLLPRIVATE sal_uInt16 ImplGetSignatureState( sal_Bool bScriptingContent = sal_False );
+
+ SAL_DLLPRIVATE ::com::sun::star::uno::Sequence< ::com::sun::star::security::DocumentSignatureInformation >
+ ImplAnalyzeSignature(
+ sal_Bool bScriptingContent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::security::XDocumentDigitalSignatures >& xSigner
+ = ::com::sun::star::uno::Reference< ::com::sun::star::security::XDocumentDigitalSignatures >() );
+
+ SAL_DLLPRIVATE void ImplSign( sal_Bool bScriptingContent = sal_False );
+ SAL_DLLPRIVATE sal_Bool QuerySaveSizeExceededModules_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler );
+
+ SAL_DLLPRIVATE void CheckOut( );
+ SAL_DLLPRIVATE void CancelCheckOut( );
+ SAL_DLLPRIVATE void CheckIn( );
+};
+
+#define SFX_GLOBAL_CLASSID \
+ 0x9eaba5c3, 0xb232, 0x4309, \
+ 0x84, 0x5f, 0x5f, 0x15, 0xea, 0x50, 0xd0, 0x74
+
+ struct ModifyBlocker_Impl
+ {
+ SfxObjectShell* pPersist;
+ sal_Bool bWasEnabled;
+ ModifyBlocker_Impl( SfxObjectShell* pPersistP ) : pPersist( pPersistP )
+ {
+ bWasEnabled = pPersistP->IsEnableSetModified();
+ if ( bWasEnabled )
+ pPersistP->EnableSetModified( sal_False );
+ }
+ ~ModifyBlocker_Impl()
+ {
+ if ( bWasEnabled )
+ pPersist->EnableSetModified( bWasEnabled );
+ }
+ };
+
+
+//--------------------------------------------------------------------
+#ifndef SFX_DECL_OBJECTSHELL_DEFINED
+#define SFX_DECL_OBJECTSHELL_DEFINED
+SV_DECL_REF(SfxObjectShell)
+#endif
+SV_DECL_LOCK(SfxObjectShell)
+SV_IMPL_LOCK(SfxObjectShell)
+SV_IMPL_REF(SfxObjectShell)
+
+//--------------------------------------------------------------------
+class AutoReloadTimer_Impl : public Timer
+{
+ String aUrl;
+ SfxObjectShell* pObjSh;
+
+public:
+ AutoReloadTimer_Impl( const String& rURL, sal_uInt32 nTime,
+ SfxObjectShell* pSh );
+ virtual void Timeout();
+};
+
+//-------------------------------------------------------------------------
+
+class SFX2_DLLPUBLIC SfxObjectShellItem: public SfxPoolItem
+{
+ SfxObjectShell* pObjSh;
+
+public:
+ TYPEINFO();
+ SfxObjectShellItem() :
+ SfxPoolItem( 0 ),
+ pObjSh( 0 )
+ {}
+ SfxObjectShellItem( SfxObjectShell *pObjShell ):
+ SfxPoolItem( 0 ),
+ pObjSh( pObjShell )
+ {}
+ SfxObjectShellItem( sal_uInt16 nWhichId,
+ SfxObjectShell *pObjShell ):
+ SfxPoolItem( nWhichId ),
+ pObjSh( pObjShell )
+ {}
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual String GetValueText() const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+ SfxObjectShell* GetObjectShell() const
+ { return pObjSh; }
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/opengrf.hxx b/include/sfx2/opengrf.hxx
new file mode 100644
index 000000000000..70dce688e9a8
--- /dev/null
+++ b/include/sfx2/opengrf.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX2_OPENGRF_HXX
+#define _SFX2_OPENGRF_HXX
+
+#include <memory> // auto_ptr
+#include <vcl/graphicfilter.hxx>
+#include <sfx2/dllapi.h>
+
+struct SvxOpenGrf_Impl;
+
+class SFX2_DLLPUBLIC SvxOpenGraphicDialog
+{
+public:
+ SvxOpenGraphicDialog ( const String& rTitle );
+ ~SvxOpenGraphicDialog ();
+
+ short Execute();
+
+ void SetPath( const String& rPath );
+ void SetPath( const String& rPath, sal_Bool bLinkState );
+ String GetPath() const;
+
+ int GetGraphic(Graphic&) const;
+
+ void EnableLink(sal_Bool);
+ void AsLink(sal_Bool);
+ sal_Bool IsAsLink() const;
+
+ String GetCurrentFilter() const;
+ void SetCurrentFilter(const String&);
+private:
+ // disable copy and assignment
+ SFX2_DLLPRIVATE SvxOpenGraphicDialog (const SvxOpenGraphicDialog&);
+ SFX2_DLLPRIVATE SvxOpenGraphicDialog& operator = ( const SvxOpenGraphicDialog & );
+
+ const std::auto_ptr< SvxOpenGrf_Impl > mpImpl;
+};
+
+#endif // _SVX_OPENGRF_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/passwd.hxx b/include/sfx2/passwd.hxx
new file mode 100644
index 000000000000..1f10c7416b98
--- /dev/null
+++ b/include/sfx2/passwd.hxx
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX_PASSWD_HXX
+#define _SFX_PASSWD_HXX
+
+#include "sal/config.h"
+#include <sfx2/dllapi.h>
+#include <vcl/button.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/layout.hxx>
+#include <sfx2/app.hxx>
+
+// defines ---------------------------------------------------------------
+
+#define SHOWEXTRAS_NONE ((sal_uInt16)0x0000)
+#define SHOWEXTRAS_USER ((sal_uInt16)0x0001)
+#define SHOWEXTRAS_CONFIRM ((sal_uInt16)0x0002)
+#define SHOWEXTRAS_PASSWORD2 ((sal_uInt16)0x0004)
+#define SHOWEXTRAS_CONFIRM2 ((sal_uInt16)0x0008)
+#define SHOWEXTRAS_ALL ((sal_uInt16)(SHOWEXTRAS_USER | SHOWEXTRAS_CONFIRM))
+
+// class SfxPasswordDialog -----------------------------------------------
+
+class SFX2_DLLPUBLIC SfxPasswordDialog : public ModalDialog
+{
+private:
+ VclFrame* mpPassword1Box;
+ FixedText* mpUserFT;
+ Edit* mpUserED;
+ FixedText* mpPassword1FT;
+ Edit* mpPassword1ED;
+ FixedText* mpConfirm1FT;
+ Edit* mpConfirm1ED;
+
+ VclFrame* mpPassword2Box;
+ FixedText* mpPassword2FT;
+ Edit* mpPassword2ED;
+ FixedText* mpConfirm2FT;
+ Edit* mpConfirm2ED;
+
+ FixedText* mpMinLengthFT;
+
+ OKButton* mpOKBtn;
+
+ String maMinLenPwdStr;
+ String maEmptyPwdStr;
+ String maMainPwdStr;
+ sal_uInt16 mnMinLen;
+ sal_uInt16 mnExtras;
+
+ bool mbAsciiOnly;
+ DECL_DLLPRIVATE_LINK(EditModifyHdl, Edit*);
+ DECL_DLLPRIVATE_LINK(OKHdl, void *);
+
+ void SetPasswdText();
+
+public:
+ SfxPasswordDialog(Window* pParent, const String* pGroupText = NULL);
+
+ String GetUser() const
+ {
+ return mpUserED->GetText();
+ }
+ String GetPassword() const
+ {
+ return mpPassword1ED->GetText();
+ }
+ String GetConfirm() const
+ {
+ return mpConfirm1ED->GetText();
+ }
+ String GetPassword2() const
+ {
+ return mpPassword2ED->GetText();
+ }
+ String GetConfirm2() const
+ {
+ return mpConfirm2ED->GetText();
+ }
+ void SetGroup2Text(const String& i_rText)
+ {
+ mpPassword2Box->set_label(i_rText);
+ }
+ void SetMinLen(sal_uInt16 Len);
+ void SetEditHelpId(const OString& rId)
+ {
+ mpPassword1ED->SetHelpId( rId );
+ }
+ void ShowExtras(sal_uInt16 nExtras)
+ {
+ mnExtras = nExtras;
+ }
+ void AllowAsciiOnly(bool i_bAsciiOnly = true)
+ {
+ mbAsciiOnly = i_bAsciiOnly;
+ }
+
+ void ShowMinLengthText(bool bShow);
+
+ virtual short Execute();
+};
+
+#endif // #ifndef _SFX_PASSWD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/printer.hxx b/include/sfx2/printer.hxx
new file mode 100644
index 000000000000..aac11a3bf4dc
--- /dev/null
+++ b/include/sfx2/printer.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX_PRINTER_HXX
+#define _SFX_PRINTER_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include "sal/types.h"
+#include <vcl/print.hxx>
+
+class SfxTabPage;
+class SfxItemSet;
+
+struct SfxPrinter_Impl;
+
+// class SfxPrinter ------------------------------------------------------
+
+class SFX2_DLLPUBLIC SfxPrinter : public Printer
+{
+private:
+ JobSetup aOrigJobSetup;
+ SfxItemSet* pOptions;
+ SfxPrinter_Impl* pImpl;
+ sal_Bool bKnown;
+
+ SAL_DLLPRIVATE void operator =(SfxPrinter &); // not defined
+
+ SAL_DLLPRIVATE void UpdateFonts_Impl();
+
+public:
+ SfxPrinter( SfxItemSet *pTheOptions );
+ SfxPrinter( SfxItemSet *pTheOptions,
+ const String &rPrinterName );
+ SfxPrinter( SfxItemSet *pTheOptions,
+ const JobSetup &rTheOrigJobSetup );
+ SfxPrinter( SfxItemSet *pTheOptions,
+ const String &rPrinterName,
+ const JobSetup &rTheOrigJobSetup );
+ SfxPrinter( const SfxPrinter &rPrinter );
+ ~SfxPrinter();
+
+ SfxPrinter* Clone() const;
+
+ static SfxPrinter* Create( SvStream &rStream, SfxItemSet *pOptions );
+ SvStream& Store( SvStream &rStream ) const;
+
+ const JobSetup& GetOrigJobSetup() const { return aOrigJobSetup; }
+ void SetOrigJobSetup( const JobSetup &rNewJobSetup );
+
+ const SfxItemSet& GetOptions() const { return *pOptions; }
+ void SetOptions( const SfxItemSet &rNewOptions );
+
+ sal_Bool IsKnown() const { return bKnown; }
+ sal_Bool IsOriginal() const { return bKnown; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/printopt.hxx b/include/sfx2/printopt.hxx
new file mode 100644
index 000000000000..44d37d0a4558
--- /dev/null
+++ b/include/sfx2/printopt.hxx
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SFX_PRINTOPT_HXX
+#define _SFX_PRINTOPT_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include "sal/types.h"
+#include <vcl/button.hxx>
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/print.hxx>
+
+#include <sfx2/tabdlg.hxx>
+
+// --------------------------------
+// - SfxCommonPrintOptionsTabPage -
+// --------------------------------
+
+class SvtBasePrintOptions;
+
+class SFX2_DLLPUBLIC SfxCommonPrintOptionsTabPage : public SfxTabPage
+{
+private:
+
+ RadioButton* m_pPrinterOutputRB;
+ RadioButton* m_pPrintFileOutputRB;
+
+ CheckBox* m_pReduceTransparencyCB;
+ RadioButton* m_pReduceTransparencyAutoRB;
+ RadioButton* m_pReduceTransparencyNoneRB;
+
+ CheckBox* m_pReduceGradientsCB;
+ RadioButton* m_pReduceGradientsStripesRB;
+ RadioButton* m_pReduceGradientsColorRB;
+ NumericField* m_pReduceGradientsStepCountNF;
+
+ CheckBox* m_pReduceBitmapsCB;
+ RadioButton* m_pReduceBitmapsOptimalRB;
+ RadioButton* m_pReduceBitmapsNormalRB;
+ RadioButton* m_pReduceBitmapsResolutionRB;
+ ListBox* m_pReduceBitmapsResolutionLB;
+ CheckBox* m_pReduceBitmapsTransparencyCB;
+
+ CheckBox* m_pConvertToGreyscalesCB;
+
+ CheckBox* m_pPDFCB;
+
+ CheckBox* m_pPaperSizeCB;
+ CheckBox* m_pPaperOrientationCB;
+ CheckBox* m_pTransparencyCB;
+
+private:
+
+ PrinterOptions maPrinterOptions;
+ PrinterOptions maPrintFileOptions;
+
+ DECL_DLLPRIVATE_LINK( ToggleOutputPrinterRBHdl, RadioButton* pButton );
+ DECL_DLLPRIVATE_LINK( ToggleOutputPrintFileRBHdl, RadioButton* pButton );
+
+ DECL_DLLPRIVATE_LINK( ClickReduceTransparencyCBHdl, CheckBox* pBox );
+ DECL_DLLPRIVATE_LINK( ClickReduceGradientsCBHdl, CheckBox* pBox );
+ DECL_DLLPRIVATE_LINK( ClickReduceBitmapsCBHdl, CheckBox* pBox );
+
+ DECL_DLLPRIVATE_LINK( ToggleReduceGradientsStripesRBHdl, RadioButton* pButton );
+ DECL_DLLPRIVATE_LINK( ToggleReduceBitmapsResolutionRBHdl, RadioButton* pButton );
+
+ SAL_DLLPRIVATE void ImplUpdateControls( const PrinterOptions* pCurrentOptions );
+ SAL_DLLPRIVATE void ImplSaveControls( PrinterOptions* pCurrentOptions );
+
+protected:
+
+ using TabPage::DeactivatePage;
+ virtual int DeactivatePage( SfxItemSet* pSet = NULL );
+
+public:
+
+ SfxCommonPrintOptionsTabPage( Window* pParent, const SfxItemSet& rSet );
+ ~SfxCommonPrintOptionsTabPage();
+
+ virtual sal_Bool FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+ virtual Window* GetParentLabeledBy( const Window* pLabel ) const;
+ virtual Window* GetParentLabelFor( const Window* pLabel ) const;
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+};
+
+#endif // #ifndef _SFX_PRINTOPT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/prnmon.hxx b/include/sfx2/prnmon.hxx
new file mode 100644
index 000000000000..0d14c616a7bc
--- /dev/null
+++ b/include/sfx2/prnmon.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX_PRNMON_HXX
+#define _SFX_PRNMON_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+
+#include <vcl/button.hxx>
+#include <vcl/dialog.hxx>
+#include <sfx2/printer.hxx>
+
+
+class SfxViewShell;
+
+// ------------------------------------------------------------------------
+
+struct SfxPrintOptDlg_Impl;
+class SfxPrintOptionsDialog : public ModalDialog
+{
+private:
+ SfxPrintOptDlg_Impl* pDlgImpl;
+ SfxViewShell* pViewSh;
+ SfxItemSet* pOptions;
+ SfxTabPage* pPage;
+
+public:
+ SfxPrintOptionsDialog( Window *pParent,
+ SfxViewShell *pViewShell,
+ const SfxItemSet *rOptions );
+ virtual ~SfxPrintOptionsDialog();
+
+ sal_Bool Construct();
+ virtual short Execute();
+ virtual long Notify( NotifyEvent& rNEvt );
+
+ SfxTabPage* GetTabPage() const { return pPage; }
+ const SfxItemSet& GetOptions() const { return *pOptions; }
+ void DisableHelp();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/progress.hxx b/include/sfx2/progress.hxx
new file mode 100644
index 000000000000..285360272d30
--- /dev/null
+++ b/include/sfx2/progress.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX_PROGRESS_HXX
+#define _SFX_PROGRESS_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include "sal/types.h"
+#include <tools/solar.h>
+#include <tools/link.hxx>
+#include <rtl/ustring.hxx>
+
+class String;
+class SfxObjectShell;
+struct SfxProgress_Impl;
+struct PlugInLoadStatus;
+struct SvProgressArg;
+
+//=======================================================================
+
+class SFX2_DLLPUBLIC SfxProgress
+{
+ SfxProgress_Impl* pImp;
+ sal_uIntPtr nVal;
+ sal_Bool bSuspended;
+
+public:
+ SfxProgress( SfxObjectShell* pObjSh,
+ const String& rText,
+ sal_uIntPtr nRange, sal_Bool bAllDocs = sal_False,
+ sal_Bool bWait = sal_True );
+ virtual ~SfxProgress();
+
+ virtual void SetText( const OUString& rText );
+ sal_Bool SetStateText( sal_uIntPtr nVal, const String &rVal, sal_uIntPtr nNewRange = 0 );
+ virtual sal_Bool SetState( sal_uIntPtr nVal, sal_uIntPtr nNewRange = 0 );
+ sal_uIntPtr GetState() const { return nVal; }
+
+ void Resume();
+ void Suspend();
+ sal_Bool IsSuspended() const { return bSuspended; }
+
+ void UnLock();
+ void Reschedule();
+
+ void Stop();
+
+ static SfxProgress* GetActiveProgress( SfxObjectShell *pDocSh = 0 );
+ static void EnterLock();
+ static void LeaveLock();
+
+ DECL_DLLPRIVATE_STATIC_LINK( SfxProgress, SetStateHdl, PlugInLoadStatus* );
+ DECL_DLLPRIVATE_STATIC_LINK( SfxProgress, DefaultBindingProgress, SvProgressArg* );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/querystatus.hxx b/include/sfx2/querystatus.hxx
new file mode 100644
index 000000000000..475d3cd00765
--- /dev/null
+++ b/include/sfx2/querystatus.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SFXQUERYSTATUS_HXX
+#define _SFXQUERYSTATUS_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include <svl/poolitem.hxx>
+#include <cppuhelper/weak.hxx>
+#include <osl/conditn.hxx>
+#include <com/sun/star/frame/FeatureStateEvent.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/XStatusListener.hpp>
+
+#include <sfx2/sfxuno.hxx>
+
+class SfxQueryStatus_Impl;
+class SFX2_DLLPUBLIC SfxQueryStatus
+{
+ public:
+ SfxQueryStatus( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& rDispatchProvider, sal_uInt16 nSlotId, const OUString& aCommand );
+ ~SfxQueryStatus();
+
+ // Query method
+ SfxItemState QueryState( SfxPoolItem*& pPoolItem );
+
+ private:
+ SfxQueryStatus( const SfxQueryStatus& );
+ SfxQueryStatus();
+ SfxQueryStatus& operator=( const SfxQueryStatus& );
+
+ com::sun::star::uno::Reference< com::sun::star::frame::XStatusListener > m_xStatusListener;
+ SfxQueryStatus_Impl* m_pSfxQueryStatusImpl;
+};
+
+#endif // _SFXQUERYSTATUS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/request.hxx b/include/sfx2/request.hxx
new file mode 100644
index 000000000000..590fd7bffeaf
--- /dev/null
+++ b/include/sfx2/request.hxx
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXREQUEST_HXX
+#define _SFXREQUEST_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include "sal/types.h"
+#include <svl/itemset.hxx>
+#include <svl/hint.hxx>
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/frame/XDispatchRecorder.hpp>
+
+class SfxPoolItem;
+class SfxAllItemSet;
+class SfxItemSet;
+class SfxItemPool;
+class SfxShell;
+class SfxSlot;
+class String;
+class SfxViewFrame;
+struct SfxRequest_Impl;
+
+//==================================================================
+
+class SFX2_DLLPUBLIC SfxRequest: public SfxHint
+{
+friend struct SfxRequest_Impl;
+
+ sal_uInt16 nSlot;
+ SfxAllItemSet* pArgs;
+ SfxRequest_Impl* pImp;
+
+ //---------------------------------------------------------------------
+public:
+ SAL_DLLPRIVATE void Record_Impl( SfxShell &rSh, const SfxSlot &rSlot,
+ com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > xRecorder,
+ SfxViewFrame* );
+private:
+ SAL_DLLPRIVATE void Done_Impl( const SfxItemSet *pSet );
+
+ //---------------------------------------------------------------------
+
+public:
+ SfxRequest( SfxViewFrame*, sal_uInt16 nSlotId );
+ SfxRequest( sal_uInt16 nSlot, sal_uInt16 nCallMode, SfxItemPool &rPool );
+ SfxRequest( const SfxSlot* pSlot, const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& rArgs,
+ sal_uInt16 nCallMode, SfxItemPool &rPool );
+ SfxRequest( sal_uInt16 nSlot, sal_uInt16 nCallMode, const SfxAllItemSet& rSfxArgs );
+ SfxRequest( const SfxRequest& rOrig );
+ ~SfxRequest();
+
+ sal_uInt16 GetSlot() const { return nSlot; }
+ void SetSlot(sal_uInt16 nNewSlot) { nSlot = nNewSlot; }
+
+ sal_uInt16 GetModifier() const;
+ void SetModifier( sal_uInt16 nModi );
+ SAL_DLLPRIVATE void SetInternalArgs_Impl( const SfxAllItemSet& rArgs );
+ SAL_DLLPRIVATE const SfxItemSet* GetInternalArgs_Impl() const;
+ const SfxItemSet* GetArgs() const { return pArgs; }
+ void SetArgs( const SfxAllItemSet& rArgs );
+ void AppendItem(const SfxPoolItem &);
+ void RemoveItem( sal_uInt16 nSlotId );
+
+ static const SfxPoolItem* GetItem( const SfxItemSet*, sal_uInt16 nSlotId,
+ bool bDeep = false,
+ TypeId aType = 0 );
+ const SfxPoolItem* GetArg( sal_uInt16 nSlotId, bool bDeep = false, TypeId aType = 0 ) const;
+ void ReleaseArgs();
+ void SetReturnValue(const SfxPoolItem &);
+ const SfxPoolItem* GetReturnValue() const;
+
+ static com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > GetMacroRecorder( SfxViewFrame* pFrame=NULL );
+ static sal_Bool HasMacroRecorder( SfxViewFrame* pFrame=NULL );
+ sal_uInt16 GetCallMode() const;
+ void AllowRecording( sal_Bool );
+ sal_Bool AllowsRecording() const;
+ sal_Bool IsAPI() const;
+ sal_Bool IsSynchronCall() const;
+ void SetSynchronCall( sal_Bool bSynchron );
+
+ sal_Bool IsDone() const;
+ void Done( sal_Bool bRemove = sal_False );
+
+ void Ignore();
+ void Cancel();
+ sal_Bool IsCancelled() const;
+ void Done(const SfxItemSet &, bool bKeep = true );
+
+ void ForgetAllArgs();
+
+private:
+ const SfxRequest& operator=(const SfxRequest &); // n.i.!!
+};
+
+//------------------------------------------------------------------------
+
+#define SFX_REQUEST_ARG(rReq, pItem, ItemType, nSlotId, bDeep) \
+ const ItemType *pItem = (const ItemType*) \
+ rReq.GetArg( nSlotId, bDeep, TYPE(ItemType) )
+#define SFX_ITEMSET_ARG(pArgs, pItem, ItemType, nSlotId, bDeep) \
+ const ItemType *pItem = (const ItemType*) \
+ SfxRequest::GetItem( pArgs, nSlotId, bDeep, TYPE(ItemType) )
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/securitypage.hxx b/include/sfx2/securitypage.hxx
new file mode 100644
index 000000000000..994fd0befa41
--- /dev/null
+++ b/include/sfx2/securitypage.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SECURITYPAGE_HXX_
+#define _SECURITYPAGE_HXX_
+
+#include "sfx2/tabdlg.hxx"
+#include "sfx2/htmlmode.hxx"
+
+#include <memory>
+
+
+
+struct SfxSecurityPage_Impl;
+
+class SfxSecurityPage : public SfxTabPage
+{
+ std::auto_ptr< SfxSecurityPage_Impl > m_pImpl;
+
+protected:
+ SfxSecurityPage( Window* pParent, const SfxItemSet& );
+ virtual ~SfxSecurityPage();
+
+ virtual sal_Bool FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet& );
+
+public:
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& );
+};
+
+
+#endif // #ifndef _SECURITYPAGE_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sfx.hrc b/include/sfx2/sfx.hrc
new file mode 100644
index 000000000000..245daa2f062a
--- /dev/null
+++ b/include/sfx2/sfx.hrc
@@ -0,0 +1,289 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SFX_HRC
+#define _SFX_HRC
+
+#include <svl/solar.hrc>
+#include <svl/memberid.hrc>
+
+#define RID_GROUPS_OFFSET 32000
+#define RID_GROUPS_SFXOFFSET 32700
+#define RID_GROUPS_END 32767
+
+//--------------------------------------------------------------------
+
+#define EVENT_SFX_START 5000
+// EVENT_SFX_END 9999
+
+// EVENT_LIB_START 10000
+// EVENT_LIB_END 19999
+
+#define EVENT_APP_START 20000
+// EVENT_APP_END 29999
+
+#define EVENT_OBJ_START 30000
+
+#define EVENT_SVX_START (EVENT_OBJ_START+0x0400)
+
+// Warning: the following are simultaneously SID_ON_ ...
+#define SFX_EVENT_CLOSEAPP (EVENT_SFX_START + 1)
+#define SFX_EVENT_CREATEDOC (EVENT_SFX_START + 2)
+#define SFX_EVENT_OPENDOC (EVENT_SFX_START + 3)
+#define SFX_EVENT_CLOSEDOC (EVENT_SFX_START + 4)
+#define SFX_EVENT_SAVEDOC (EVENT_SFX_START + 5)
+#define SFX_EVENT_SAVEASDOC (EVENT_SFX_START + 6)
+#define SFX_EVENT_ACTIVATEDOC (EVENT_SFX_START + 7)
+#define SFX_EVENT_DEACTIVATEDOC (EVENT_SFX_START + 8)
+#define SFX_EVENT_PRINTDOC (EVENT_SFX_START + 9)
+#define SFX_EVENT_SAVEACOPY (EVENT_SFX_START + 10)
+
+#define SFX_EVENT_LOADFINISHED (EVENT_SFX_START + 11)
+
+#define SFX_EVENT_MODIFYCHANGED (EVENT_SFX_START + 13)
+#define SFX_EVENT_PREPARECLOSEDOC (EVENT_SFX_START + 14)
+#define SFX_EVENT_TOGGLEFULLSCREENMODE (EVENT_SFX_START + 16)
+#define SFX_EVENT_SAVEDOCDONE (EVENT_SFX_START + 17)
+#define SFX_EVENT_SAVEASDOCDONE (EVENT_SFX_START + 18)
+
+#define SFX_EVENT_SAVETODOC (EVENT_SFX_START + 19)
+#define SFX_EVENT_SAVETODOCDONE (EVENT_SFX_START + 20)
+
+#define SFX_EVENT_VIEWCREATED (EVENT_SFX_START + 21)
+#define SFX_EVENT_PREPARECLOSEVIEW (EVENT_SFX_START + 22)
+#define SFX_EVENT_CLOSEVIEW (EVENT_SFX_START + 23)
+
+#define SFX_EVENT_STORAGECHANGED (EVENT_SFX_START + 24)
+#define SFX_EVENT_VISAREACHANGED (EVENT_SFX_START + 25)
+
+#define SFX_EVENT_DOCCREATED (EVENT_SFX_START + 26)
+
+#define SFX_EVENT_SAVEASDOCFAILED (EVENT_SFX_START + 27)
+#define SFX_EVENT_SAVEDOCFAILED (EVENT_SFX_START + 28)
+#define SFX_EVENT_SAVETODOCFAILED (EVENT_SFX_START + 29)
+
+
+// Events for Controls etc.
+#define SFX_EVENT_MOUSEOVER_OBJECT ( EVENT_SFX_START + 100 )
+#define SFX_EVENT_MOUSECLICK_OBJECT ( EVENT_SFX_START + 101 )
+#define SFX_EVENT_MOUSEOUT_OBJECT ( EVENT_SFX_START + 102 )
+
+//--------------------------------------------------------------------
+
+#define RID_SFX_APP_START (RID_SFX_START + 256)
+#define RID_SFX_MENU_START (RID_SFX_START + 768)
+// RID_SFX_CONFIG_START (RID_SFX_START + 1536)
+#define RID_SFX_DOC_START (RID_SFX_START + 1792)
+#define RID_SFX_DIALOG_START (RID_SFX_START + 2048)
+#define RID_SFX_BASTYP_START (RID_SFX_START + 2304)
+#define RID_SFX_EXPLORER_START (RID_SFX_START + 2816)
+
+// RID_CNT_START (RID_SFX_START + 3072)
+
+#define RID_SFX_SFXLOCAL_START (RID_SFX_START + 3082)
+#define RID_SFX_VIEW_START (RID_SFX_START + 4096)
+// RID_CNT_START2 (RID_SFX_START + 4500)
+// RID_SFX_CHAOSDOC_START (RID_SFX_START + 5120)
+// RID_SFX_TPLCOMPONENT_START (RID_SFX_START + 6800)
+// RID_SFX_HELPCOMPONENT_START (RID_SFX_START + 7000)
+
+//--------------------------------------------------------------------
+
+#define SFX_OBJECTBAR_APPLICATION 0
+#define SFX_OBJECTBAR_OBJECT 1
+#define SFX_OBJECTBAR_TOOLS 2
+#define SFX_OBJECTBAR_MACRO 3
+#define SFX_OBJECTBAR_FULLSCREEN 4
+#define SFX_OBJECTBAR_RECORDING 5
+#define SFX_OBJECTBAR_COMMONTASK 6
+#define SFX_OBJECTBAR_OPTIONS 7
+#define SFX_OBJECTBAR_NAVIGATION 12
+#define SFX_OBJECTBAR_MAX 13
+
+// temporary due to compatibility
+
+
+#define MSG_QUERY_LASTVERSION RID_SFX_START
+
+#define RID_APPLICATION RID_SFX_START
+#define RID_DEFAULTIMAGELIST_SC (RID_SFX_START+15)
+#define RID_DEFAULTIMAGELIST_LC (RID_SFX_START+17)
+
+#define RID_STYLECATALOG (RID_SFX_START+1201)
+
+#define RID_DEFAULTABOUT (RID_SFX_START+0)
+
+#define RID_APPTITLE (RID_SFX_START+4)
+
+#define DLG_DOCINFO_EDT (RID_SFX_START+6)
+
+#define DLG_STYLE_DESIGNER (RID_SFX_START+8)
+
+#define RID_SFX_INCORRECT_PASSWORD (RID_SFX_START+216)
+
+#define STR_STYLE_FILTER_AUTO (RID_SFX_START+9)
+#define STR_STYLE_FILTER_USED (RID_SFX_START+10)
+#define STR_STYLE_FILTER_USERDEF (RID_SFX_START+11)
+#define STR_STYLE_FILTER_ALL (RID_SFX_START+12)
+// +13 already used!
+#define STR_STYLE_FILTER_HIERARCHICAL (RID_SFX_START+1200)
+
+#define STR_NONAME (RID_SFX_START+100)
+#define STR_NONE (RID_SFX_START+101)
+#define STR_CLOSE (RID_SFX_START+103)
+#define STR_STANDARD (RID_SFX_START+104)
+#define STR_READONLY (RID_SFX_START+105)
+
+#define STR_SFX_FILTERNAME_ALL (RID_SFX_START+106)
+#define STR_EDIT (RID_SFX_START+108)
+#define STR_QUERY_SAVE_DOCUMENT (RID_SFX_START+110)
+#define STR_BYTES (RID_SFX_START+111)
+#define STR_KB (RID_SFX_START+112)
+#define STR_MB (RID_SFX_START+113)
+#define STR_GB (RID_SFX_START+114)
+#define STR_QUERY_SAVE_DOCUMENT_TITLE (RID_SFX_START+115)
+
+#define STR_STANDARD_SHORTCUT (RID_SFX_START+117)
+#define STR_REPAIREDDOCUMENT (RID_SFX_START+118)
+#define STR_ERRUNOEVENTBINDUNG (RID_SFX_START+119)
+#define STR_SHARED (RID_SFX_START+120)
+#define RID_XMLSEC_DOCUMENTSIGNED (RID_SFX_START+121)
+#define STR_PASSWD (RID_SFX_START+122)
+#define STR_PASSWD_EMPTY (RID_SFX_START+123)
+#define STR_PASSWD_MIN_LEN (RID_SFX_START+124)
+#define STR_NONCHECKEDOUT_DOCUMENT (RID_SFX_START+125)
+#define BT_CHECKOUT (RID_SFX_START+126)
+#define STR_ACCTITLE_PRODUCTIVITYTOOLS (RID_SFX_START+157)
+
+#define SFX_THUMBNAIL_TEXT (RID_SFX_START+158)
+#define SFX_THUMBNAIL_SHEET (RID_SFX_START+159)
+#define SFX_THUMBNAIL_PRESENTATION (RID_SFX_START+160)
+#define SFX_THUMBNAIL_DRAWING (RID_SFX_START+161)
+
+//=========================================================================
+
+// group ids
+//=========================================================================
+// !! If you add a new group, please change sfxbasecontroller.cxx and
+// !! com.sun.star.frame.CommandGroup accordingly!
+//=========================================================================
+
+#define GID_INTERN (RID_GROUPS_SFXOFFSET+ 0)
+#define GID_APPLICATION (RID_GROUPS_SFXOFFSET+ 1)
+#define GID_DOCUMENT (RID_GROUPS_SFXOFFSET+ 2)
+#define GID_VIEW (RID_GROUPS_SFXOFFSET+ 3)
+#define GID_EDIT (RID_GROUPS_SFXOFFSET+ 4)
+#define GID_MACRO (RID_GROUPS_SFXOFFSET+ 5)
+#define GID_OPTIONS (RID_GROUPS_SFXOFFSET+ 6)
+#define GID_MATH (RID_GROUPS_SFXOFFSET+ 7)
+#define GID_NAVIGATOR (RID_GROUPS_SFXOFFSET+ 8)
+#define GID_INSERT (RID_GROUPS_SFXOFFSET+ 9)
+#define GID_FORMAT (RID_GROUPS_SFXOFFSET+10)
+#define GID_TEMPLATE (RID_GROUPS_SFXOFFSET+11)
+#define GID_TEXT (RID_GROUPS_SFXOFFSET+12)
+#define GID_FRAME (RID_GROUPS_SFXOFFSET+13)
+#define GID_GRAPHIC (RID_GROUPS_SFXOFFSET+14)
+#define GID_TABLE (RID_GROUPS_SFXOFFSET+15)
+#define GID_ENUMERATION (RID_GROUPS_SFXOFFSET+16)
+#define GID_DATA (RID_GROUPS_SFXOFFSET+17)
+#define GID_SPECIAL (RID_GROUPS_SFXOFFSET+18)
+#define GID_IMAGE (RID_GROUPS_SFXOFFSET+19)
+#define GID_CHART (RID_GROUPS_SFXOFFSET+20)
+#define GID_EXPLORER (RID_GROUPS_SFXOFFSET+21)
+#define GID_CONNECTOR (RID_GROUPS_SFXOFFSET+22)
+#define GID_MODIFY (RID_GROUPS_SFXOFFSET+23)
+#define GID_DRAWING (RID_GROUPS_SFXOFFSET+24)
+#define GID_CONTROLS (RID_GROUPS_SFXOFFSET+25)
+#define GID_NAVIGATION (RID_GROUPS_SFXOFFSET+26)
+
+// =========================================================================
+
+#define RID_OPTIONS_START (SID_LIB_START + 2000)
+// RID_OPTIONS_END (RID_OPTIONS_START + 100)
+
+// ResId's ------------------------------------------------------------------
+
+#define RID_SFXPAGE_SAVE (RID_OPTIONS_START + 0)
+#define RID_SFXPAGE_GENERAL (RID_OPTIONS_START + 1)
+#define RID_SFXDLG_NEWDICT (RID_OPTIONS_START + 3)
+#define RID_SFXDLG_EDITDICT (RID_OPTIONS_START + 4)
+#define RID_SFXQB_DELDICT (RID_OPTIONS_START + 5)
+#define RID_SFXPAGE_PATH (RID_OPTIONS_START + 6)
+#define RID_SFXPAGE_LINGU (RID_OPTIONS_START + 7)
+#define RID_SFXQB_SET_LANGUAGE (RID_OPTIONS_START + 10)
+#define RID_SFXPAGE_PRINTOPTIONS (RID_OPTIONS_START + 12)
+
+#define RID_STR_NEW_TASK (RID_SFX_DOC_START+ 76)
+
+// Member-Ids ------------------------------------------------------------
+
+#define MID_DOCINFO_DESCRIPTION 0x13
+#define MID_DOCINFO_KEYWORDS 0x17
+#define MID_DOCINFO_SUBJECT 0x1b
+#define MID_DOCINFO_TITLE 0x1d
+#define MID_DOCINFO_AUTOLOADENABLED 0x2d
+#define MID_DOCINFO_AUTOLOADURL 0x2e
+#define MID_DOCINFO_AUTOLOADSECS 0x2f
+#define MID_DOCINFO_DEFAULTTARGET 0x30
+#define MID_DOCINFO_USEUSERDATA 0x31
+#define MID_DOCINFO_DELETEUSERDATA 0x32
+
+// only for FastPropertySet
+#define MID_DOCINFO_REVISION 0x15
+#define MID_DOCINFO_EDITTIME 0x16
+#define MID_DOCINFO_MODIFICATIONAUTHOR 0x18
+#define MID_DOCINFO_TEMPLATE 0x1c
+#define MID_DOCINFO_PRINTDATE 0x28
+#define MID_DOCINFO_PRINTEDBY 0x2a
+#define MID_DOCINFO_TEMPLATEDATE 0x2b
+#define MID_DOCINFO_STATISTIC 0x33
+#define MID_DOCINFO_CHARLOCALE 0x34
+#define MID_CATEGORY 0x35
+#define MID_COMPANY 0x36
+#define MID_MANAGER 0x37
+#define MID_TYPE 0x38
+#define MID_VALUE 0x39
+#define MID_VALUESET 0x40
+
+// Config-Ids -----------------------------------------------------------
+
+#define SFX_ITEMTYPE_SW_BEGIN 20000
+// SFX_ITEMTYPE_SW_END 22999
+
+#define SFX_ITEMTYPE_SD_BEGIN 23000
+// SFX_ITEMTYPE_SD_END 25999
+
+#define SFX_ITEMTYPE_SC_BEGIN 26000
+// SFX_ITEMTYPE_SC_END 27999
+
+// free: 28000-32767
+
+// Slot-Ids -------------------------------------------------------------
+
+#include <sfx2/sfxsids.hrc>
+
+#define HID_INTERFACE_SFXHELP_VIEWSH 24
+
+#define RET_NEWTASK 200
+
+#endif // #ifndef _SFX_HRC
+
+// ******************************************************************* EOF
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sfxbasecontroller.hxx b/include/sfx2/sfxbasecontroller.hxx
new file mode 100644
index 000000000000..df2635f711ed
--- /dev/null
+++ b/include/sfx2/sfxbasecontroller.hxx
@@ -0,0 +1,386 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SFX_SFXBASECONTROLLER_HXX_
+#define _SFX_SFXBASECONTROLLER_HXX_
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include "sal/types.h"
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/DispatchDescriptor.hpp>
+#include <com/sun/star/frame/XDispatchInformationProvider.hpp>
+#include <com/sun/star/frame/XController2.hpp>
+#include <com/sun/star/frame/XControllerBorder.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XTitle.hpp>
+#include <com/sun/star/frame/XTitleChangeBroadcaster.hpp>
+#include <com/sun/star/util/URL.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <cppuhelper/implbase9.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <osl/mutex.hxx>
+#include <com/sun/star/task/XStatusIndicatorSupplier.hpp>
+#include <com/sun/star/ui/XContextMenuInterception.hpp>
+#include <com/sun/star/ui/XContextMenuInterceptor.hpp>
+#include <com/sun/star/awt/XMouseClickHandler.hpp>
+#include <com/sun/star/awt/XKeyHandler.hpp>
+#include <com/sun/star/awt/XUserInputInterception.hpp>
+#include <tools/link.hxx>
+#include <vcl/button.hxx>
+
+#include <sfx2/viewsh.hxx>
+#include <sfx2/sfxuno.hxx>
+
+struct IMPL_SfxBaseController_DataContainer ; // impl. struct to hold member of class SfxBaseController
+
+class SfxViewFrame;
+
+sal_Int16 MapGroupIDToCommandGroup( sal_Int16 nGroupID );
+
+//________________________________________________________________________________________________________
+// class declarations
+//________________________________________________________________________________________________________
+
+typedef ::cppu::WeakImplHelper9 < css::frame::XController2
+ , css::frame::XControllerBorder
+ , css::frame::XDispatchProvider
+ , css::task::XStatusIndicatorSupplier
+ , css::ui::XContextMenuInterception
+ , css::awt::XUserInputInterception
+ , css::frame::XDispatchInformationProvider
+ , css::frame::XTitle
+ , css::frame::XTitleChangeBroadcaster
+ > SfxBaseController_Base;
+
+class SFX2_DLLPUBLIC SfxBaseController :public SfxBaseController_Base
+ ,public ::cppu::BaseMutex
+{
+//________________________________________________________________________________________________________
+// public methods
+//________________________________________________________________________________________________________
+
+public:
+
+ //____________________________________________________________________________________________________
+ // constructor/destructor
+ //____________________________________________________________________________________________________
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ SfxBaseController( SfxViewShell* pView ) ;
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ ~SfxBaseController() ;
+
+ SAL_DLLPRIVATE void ReleaseShell_Impl();
+ SAL_DLLPRIVATE void BorderWidthsChanged_Impl();
+
+ css::uno::Reference< css::task::XStatusIndicator > SAL_CALL getStatusIndicator( ) throw (css::uno::RuntimeException);
+
+ //____________________________________________________________________________________________________
+ // XController2
+ //____________________________________________________________________________________________________
+ virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getComponentWindow() throw (css::uno::RuntimeException);
+ virtual OUString SAL_CALL getViewControllerName() throw (css::uno::RuntimeException);
+ virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCreationArguments() throw (css::uno::RuntimeException);
+
+ //____________________________________________________________________________________________________
+ // XController
+ //____________________________________________________________________________________________________
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL attachFrame( const css::uno::Reference< css::frame::XFrame >& xFrame ) throw( css::uno::RuntimeException ) ;
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual sal_Bool SAL_CALL attachModel( const css::uno::Reference< css::frame::XModel >& xModel ) throw( css::uno::RuntimeException ) ;
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual sal_Bool SAL_CALL suspend( sal_Bool bSuspend ) throw( css::uno::RuntimeException ) ;
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ css::uno::Any SAL_CALL getViewData() throw( css::uno::RuntimeException ) ;
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ void SAL_CALL restoreViewData( const css::uno::Any& aValue ) throw( css::uno::RuntimeException ) ;
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ css::uno::Reference< css::frame::XFrame > SAL_CALL getFrame() throw( css::uno::RuntimeException ) ;
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ css::uno::Reference< css::frame::XModel > SAL_CALL getModel() throw( css::uno::RuntimeException ) ;
+
+ //____________________________________________________________________________________________________
+ // XDispatchProvider
+ //____________________________________________________________________________________________________
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch( const css::util::URL & aURL ,
+ const OUString & sTargetFrameName,
+ FrameSearchFlags eSearchFlags ) throw( css::uno::RuntimeException ) ;
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& seqDescriptor ) throw( css::uno::RuntimeException ) ;
+
+ //____________________________________________________________________________________________________
+ // XControllerBorder
+ //____________________________________________________________________________________________________
+
+ virtual css::frame::BorderWidths SAL_CALL getBorder() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL addBorderResizeListener( const css::uno::Reference< css::frame::XBorderResizeListener >& xListener ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL removeBorderResizeListener( const css::uno::Reference< css::frame::XBorderResizeListener >& xListener ) throw (css::uno::RuntimeException);
+ virtual css::awt::Rectangle SAL_CALL queryBorderedArea( const css::awt::Rectangle& aPreliminaryRectangle ) throw (css::uno::RuntimeException);
+
+ //____________________________________________________________________________________________________
+ // XComponent
+ //____________________________________________________________________________________________________
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL dispose() throw( css::uno::RuntimeException ) ;
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) throw( css::uno::RuntimeException ) ;
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) throw( css::uno::RuntimeException ) ;
+ virtual void SAL_CALL registerContextMenuInterceptor( const css::uno::Reference< css::ui::XContextMenuInterceptor >& xInterceptor ) throw( css::uno::RuntimeException );
+ virtual void SAL_CALL releaseContextMenuInterceptor( const css::uno::Reference< css::ui::XContextMenuInterceptor >& xInterceptor ) throw( css::uno::RuntimeException );
+
+ virtual void SAL_CALL addKeyHandler( const css::uno::Reference< css::awt::XKeyHandler >& xHandler ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL removeKeyHandler( const css::uno::Reference< css::awt::XKeyHandler >& xHandler ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL addMouseClickHandler( const css::uno::Reference< css::awt::XMouseClickHandler >& xHandler ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL removeMouseClickHandler( const css::uno::Reference< css::awt::XMouseClickHandler >& xHandler ) throw (css::uno::RuntimeException);
+
+ //____________________________________________________________________________________________________
+ // XDispatchInformationProvider
+ //____________________________________________________________________________________________________
+ virtual css::uno::Sequence< sal_Int16 > SAL_CALL getSupportedCommandGroups() throw (css::uno::RuntimeException);
+ virtual css::uno::Sequence< css::frame::DispatchInformation > SAL_CALL getConfigurableDispatchInformation( sal_Int16 nCommandGroup ) throw (css::uno::RuntimeException);
+
+ // css::frame::XTitle
+ virtual OUString SAL_CALL getTitle( ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setTitle( const OUString& sTitle ) throw (css::uno::RuntimeException);
+
+ // css::frame::XTitleChangeBroadcaster
+ virtual void SAL_CALL addTitleChangeListener( const css::uno::Reference< css::frame::XTitleChangeListener >& xListener ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL removeTitleChangeListener( const css::uno::Reference< css::frame::XTitleChangeListener >& xListener ) throw (css::uno::RuntimeException);
+
+ // FIXME: TL needs this in sw/source/ui/uno/unotxdoc.cxx now;
+ // either the _Impl name should vanish or there should be an "official" API
+ SfxViewShell* GetViewShell_Impl() const;
+ SAL_DLLPRIVATE sal_Bool HandleEvent_Impl( NotifyEvent& rEvent );
+ SAL_DLLPRIVATE sal_Bool HasKeyListeners_Impl();
+ SAL_DLLPRIVATE sal_Bool HasMouseClickListeners_Impl();
+ SAL_DLLPRIVATE void SetCreationArguments_Impl( const css::uno::Sequence< css::beans::PropertyValue >& i_rCreationArgs );
+ SAL_DLLPRIVATE css::uno::Reference< css::frame::XTitle > impl_getTitleHelper ();
+private:
+ enum ConnectSfxFrame
+ {
+ E_CONNECT,
+ E_DISCONNECT,
+ E_RECONNECT
+ };
+ SAL_DLLPRIVATE void ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect );
+ SAL_DLLPRIVATE SfxViewFrame& GetViewFrame_Impl() const;
+ SAL_DLLPRIVATE void ShowInfoBars( );
+
+ DECL_LINK( CheckOutHandler, void * );
+
+//________________________________________________________________________________________________________
+// private variables
+//________________________________________________________________________________________________________
+
+private:
+
+ IMPL_SfxBaseController_DataContainer* m_pData ;
+
+} ; // class SfxBaseController
+
+#endif // _SFX_SFXBASECONTROLLER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sfxbasemodel.hxx b/include/sfx2/sfxbasemodel.hxx
new file mode 100644
index 000000000000..524c86b0b99d
--- /dev/null
+++ b/include/sfx2/sfxbasemodel.hxx
@@ -0,0 +1,1554 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SFX_SFXBASEMODEL_HXX_
+#define _SFX_SFXBASEMODEL_HXX_
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include "sal/types.h"
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/frame/XModule.hpp>
+#include <com/sun/star/frame/XTitle.hpp>
+#include <com/sun/star/frame/XTitleChangeBroadcaster.hpp>
+#include <com/sun/star/frame/XUntitledNumbers.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/container/XNameReplace.hpp>
+#include <com/sun/star/frame/XController2.hpp>
+#include <com/sun/star/document/XCmisDocument.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <com/sun/star/document/XDocumentRecovery.hpp>
+#include <com/sun/star/document/XUndoManagerSupplier.hpp>
+#include <com/sun/star/rdf/XDocumentMetadataAccess.hpp>
+#include <com/sun/star/document/XEventBroadcaster.hpp>
+#include <com/sun/star/document/XDocumentEventBroadcaster.hpp>
+#include <com/sun/star/document/XEventListener.hpp>
+#include <com/sun/star/document/XEventsSupplier.hpp>
+#include <com/sun/star/document/XEmbeddedScripts.hpp>
+#include <com/sun/star/document/EventObject.hpp>
+#include <com/sun/star/document/XDocumentSubStorageSupplier.hpp>
+#include <com/sun/star/document/XStorageBasedDocument.hpp>
+#include <com/sun/star/document/XScriptInvocationContext.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/lang/NotInitializedException.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/frame/XModel2.hpp>
+#include <com/sun/star/frame/DoubleInitializationException.hpp>
+#include <com/sun/star/util/XModifiable2.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+#include <com/sun/star/util/XCloseable.hpp>
+#include <com/sun/star/util/XCloseBroadcaster.hpp>
+#include <com/sun/star/util/XCloseListener.hpp>
+#include <com/sun/star/util/CloseVetoException.hpp>
+#include <com/sun/star/view/XPrintable.hpp>
+#include <com/sun/star/view/XPrintJobBroadcaster.hpp>
+#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/frame/XStorable2.hpp>
+#include <com/sun/star/frame/XLoadable.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/lang/EventObject.hpp>
+#include <com/sun/star/datatransfer/XTransferable.hpp>
+#include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
+#include <com/sun/star/ui/XUIConfigurationManager2.hpp>
+#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
+#include <com/sun/star/embed/XVisualObject.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <com/sun/star/script/XStarBasicAccess.hpp>
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+#include <com/sun/star/document/XViewDataSupplier.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/task/XInteractionHandler.hpp>
+
+#ifndef INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_32
+#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_32
+#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 32
+#include <comphelper/implbase_var.hxx>
+#endif
+
+#include <svl/lstner.hxx>
+
+class SfxMedium;
+class SfxPrinter;
+class SfxViewShell;
+class SfxObjectShell ;
+class SfxEventHint;
+class SfxViewFrame;
+struct IMPL_SfxBaseModel_DataContainer ; // impl. struct to hold member of class SfxBaseModel
+
+namespace sfx { namespace intern {
+ class ViewCreationGuard;
+} }
+//________________________________________________________________________________________________________
+// class declarations
+//________________________________________________________________________________________________________
+
+/**_______________________________________________________________________________________________________
+ @short -
+
+ @descr -
+
+ @implements XChild
+ XComponent
+ document::XDocumentPropertiesSupplier
+ rdf::XDocumentMetadataAccess
+ XEventListener
+ XModel
+ XModifiable2
+ XPrintable
+ XStorable2
+ document::XEventBroadcaster
+ document::XEventsSupplier
+ document::XEmbeddedScripts
+ document::XScriptInvocationContext
+ XCloseable
+ XCloseBroadcaster
+
+ @base cppu::BaseMutex
+ SfxListener
+*/
+
+typedef ::comphelper::WeakImplHelper32 < css::container::XChild
+ , css::document::XDocumentPropertiesSupplier
+ , css::document::XCmisDocument
+ , css::rdf::XDocumentMetadataAccess
+ , css::document::XDocumentRecovery
+ , css::document::XUndoManagerSupplier
+ , css::document::XEventBroadcaster
+ , css::document::XDocumentEventBroadcaster
+ , css::lang::XEventListener
+ , css::document::XEventsSupplier
+ , css::document::XEmbeddedScripts
+ , css::document::XScriptInvocationContext
+ , css::frame::XModel2
+ , css::util::XModifiable2
+ , css::view::XPrintable
+ , css::view::XPrintJobBroadcaster
+ , css::frame::XStorable2
+ , css::frame::XLoadable
+ , css::script::XStarBasicAccess
+ , css::document::XViewDataSupplier
+ , css::util::XCloseable // => css::util::XCloseBroadcaster
+ , css::datatransfer::XTransferable
+ , css::document::XDocumentSubStorageSupplier
+ , css::document::XStorageBasedDocument
+ , css::script::provider::XScriptProviderSupplier
+ , css::ui::XUIConfigurationManagerSupplier
+ , css::embed::XVisualObject
+ , css::lang::XUnoTunnel
+ , css::frame::XModule
+ , css::frame::XTitle
+ , css::frame::XTitleChangeBroadcaster
+ , css::frame::XUntitledNumbers
+ > SfxBaseModel_Base;
+
+class SFX2_DLLPUBLIC SfxBaseModel : protected ::cppu::BaseMutex
+ , public SfxBaseModel_Base
+ , public SfxListener
+{
+
+//________________________________________________________________________________________________________
+// public methods
+//________________________________________________________________________________________________________
+
+public:
+
+ //____________________________________________________________________________________________________
+ // constructor/destructor
+ //____________________________________________________________________________________________________
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ SfxBaseModel( SfxObjectShell *pObjektShell = NULL ) ;
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual ~SfxBaseModel() ;
+
+ //____________________________________________________________________________________________________
+ // XInterface
+ //____________________________________________________________________________________________________
+
+ /**___________________________________________________________________________________________________
+ @short give answer, if interface is supported
+ @descr The interfaces are searched by type.
+
+ @seealso XInterface
+
+ @param "rType" is the type of searched interface.
+
+ @return Any information about found interface
+
+ @onerror A RuntimeException is thrown.
+ */
+
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& rType ) throw( css::uno::RuntimeException ) ;
+
+ /**___________________________________________________________________________________________________
+ @short increment refcount
+ @descr -
+
+ @seealso XInterface
+ @seealso release()
+
+ @param -
+
+ @return -
+
+ @onerror A RuntimeException is thrown.
+ */
+
+ virtual void SAL_CALL acquire() throw() ;
+
+ /**___________________________________________________________________________________________________
+ @short decrement refcount
+ @descr -
+
+ @seealso XInterface
+ @seealso acquire()
+
+ @param -
+
+ @return -
+
+ @onerror A RuntimeException is thrown.
+ */
+
+ virtual void SAL_CALL release() throw() ;
+
+ //____________________________________________________________________________________________________
+ // XTypeProvider
+ //____________________________________________________________________________________________________
+
+ /**___________________________________________________________________________________________________
+ @short get information about supported interfaces
+ @descr -
+
+ @seealso XTypeProvider
+
+ @param -
+
+ @return Sequence of types of all supported interfaces
+
+ @onerror A RuntimeException is thrown.
+ */
+
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw( css::uno::RuntimeException ) ;
+
+ /**___________________________________________________________________________________________________
+ @short get implementation id
+ @descr This ID is neccessary for UNO-caching. If there no ID, cache is disabled.
+ Another way, cache is enabled.
+
+ @seealso XTypeProvider
+
+ @param -
+
+ @return ID as Sequence of byte
+
+ @onerror A RuntimeException is thrown.
+ */
+
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw( css::uno::RuntimeException ) ;
+
+
+ //____________________________________________________________________________________________________
+ // XStarBasicAccess
+ //____________________________________________________________________________________________________
+
+ /**___________________________________________________________________________________________________
+ @seealso XStarBasicAccess
+ */
+ virtual css::uno::Reference< css::container::XNameContainer > SAL_CALL getLibraryContainer() throw( css::uno::RuntimeException );
+
+ /**___________________________________________________________________________________________________
+ @seealso XStarBasicAccess
+ */
+ virtual void SAL_CALL createLibrary( const OUString& LibName, const OUString& Password,
+ const OUString& ExternalSourceURL, const OUString& LinkTargetURL )
+ throw(css::container::ElementExistException, css::uno::RuntimeException);
+
+ /**___________________________________________________________________________________________________
+ @seealso XStarBasicAccess
+ */
+ virtual void SAL_CALL addModule( const OUString& LibraryName, const OUString& ModuleName,
+ const OUString& Language, const OUString& Source )
+ throw( css::container::NoSuchElementException, css::uno::RuntimeException);
+
+ /**___________________________________________________________________________________________________
+ @seealso XStarBasicAccess
+ */
+ virtual void SAL_CALL addDialog( const OUString& LibraryName, const OUString& DialogName,
+ const css::uno::Sequence< sal_Int8 >& Data )
+ throw(css::container::NoSuchElementException, css::uno::RuntimeException);
+
+
+ //____________________________________________________________________________________________________
+ // XChild
+ //____________________________________________________________________________________________________
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent() throw( css::uno::RuntimeException ) ;
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& xParent ) throw(css::lang::NoSupportException,
+ css::uno::RuntimeException);
+
+ //____________________________________________________________________________________________________
+ // XComponent
+ //____________________________________________________________________________________________________
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL dispose() throw (css::uno::RuntimeException);
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener >& aListener) throw (css::uno::RuntimeException);
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener >& aListener ) throw (css::uno::RuntimeException);
+
+ // XDocumentPropertiesSupplier
+ virtual css::uno::Reference< css::document::XDocumentProperties >
+ SAL_CALL getDocumentProperties()
+ throw (css::uno::RuntimeException);
+
+ //____________________________________________________________________________________________________
+ // XEventListener
+ //____________________________________________________________________________________________________
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw (css::uno::RuntimeException);
+
+ //____________________________________________________________________________________________________
+ // XModel
+ //____________________________________________________________________________________________________
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual sal_Bool SAL_CALL attachResource(const OUString& sURL,
+ const css::uno::Sequence< css::beans::PropertyValue >& aArgs)
+ throw (css::uno::RuntimeException);
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual OUString SAL_CALL getURL() throw (css::uno::RuntimeException);
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getArgs() throw (css::uno::RuntimeException);
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL connectController( const css::uno::Reference< css::frame::XController >& xController ) throw (css::uno::RuntimeException);
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL disconnectController( const css::uno::Reference< css::frame::XController >& xController ) throw (css::uno::RuntimeException);
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL lockControllers() throw (css::uno::RuntimeException);
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL unlockControllers() throw (css::uno::RuntimeException);
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual sal_Bool SAL_CALL hasControllersLocked() throw (css::uno::RuntimeException);
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual css::uno::Reference< css::frame::XController > SAL_CALL getCurrentController() throw (css::uno::RuntimeException);
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL setCurrentController( const css::uno::Reference< css::frame::XController >& xController )
+ throw (css::container::NoSuchElementException, css::uno::RuntimeException);
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getCurrentSelection() throw (css::uno::RuntimeException);
+
+ //____________________________________________________________________________________________________
+ // XModel2
+ //____________________________________________________________________________________________________
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL getControllers()
+ throw (css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< OUString > SAL_CALL getAvailableViewControllerNames()
+ throw (css::uno::RuntimeException);
+
+ virtual css::uno::Reference< css::frame::XController2 > SAL_CALL createDefaultViewController(const css::uno::Reference< css::frame::XFrame >& Frame )
+ throw (css::uno::RuntimeException ,
+ css::lang::IllegalArgumentException,
+ css::uno::Exception );
+
+ virtual css::uno::Reference< css::frame::XController2 > SAL_CALL createViewController(const OUString& ViewName ,
+ const css::uno::Sequence< css::beans::PropertyValue >& Arguments ,
+ const css::uno::Reference< css::frame::XFrame >& Frame )
+ throw (css::uno::RuntimeException ,
+ css::lang::IllegalArgumentException,
+ css::uno::Exception );
+
+ //____________________________________________________________________________________________________
+ // XModifiable2
+ //____________________________________________________________________________________________________
+
+ virtual ::sal_Bool SAL_CALL disableSetModified( ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL enableSetModified( ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isSetModifiedEnabled( ) throw (css::uno::RuntimeException);
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual sal_Bool SAL_CALL isModified() throw (css::uno::RuntimeException);
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL setModified( sal_Bool bModified )
+ throw (css::beans::PropertyVetoException, css::uno::RuntimeException);
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL addModifyListener( const css::uno::Reference< css::util::XModifyListener >& xListener ) throw( css::uno::RuntimeException ) ;
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL removeModifyListener(const css::uno::Reference< css::util::XModifyListener > & xListener) throw( css::uno::RuntimeException ) ;
+
+ //____________________________________________________________________________________________________
+ // XCloseable
+ //____________________________________________________________________________________________________
+
+ virtual void SAL_CALL close( sal_Bool bDeliverOwnership ) throw (css::util::CloseVetoException, css::uno::RuntimeException);
+
+ //____________________________________________________________________________________________________
+ // XCloseBroadcaster
+ //____________________________________________________________________________________________________
+
+ virtual void SAL_CALL addCloseListener( const css::uno::Reference< css::util::XCloseListener >& xListener ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL removeCloseListener( const css::uno::Reference< css::util::XCloseListener >& xListener ) throw (css::uno::RuntimeException);
+
+ //____________________________________________________________________________________________________
+ // XPrintJobBroadcaster
+ //____________________________________________________________________________________________________
+
+ virtual void SAL_CALL addPrintJobListener( const css::uno::Reference< css::view::XPrintJobListener >& xListener ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL removePrintJobListener( const css::uno::Reference< css::view::XPrintJobListener >& xListener ) throw (css::uno::RuntimeException);
+
+ //____________________________________________________________________________________________________
+ // XPrintable
+ //____________________________________________________________________________________________________
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getPrinter() throw (css::uno::RuntimeException);
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL setPrinter( const css::uno::Sequence< css::beans::PropertyValue >& seqPrinter )
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException);
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL print( const css::uno::Sequence< css::beans::PropertyValue >& seqOptions )
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException);
+
+ //____________________________________________________________________________________________________
+ // XStorable2
+ //____________________________________________________________________________________________________
+
+ virtual void SAL_CALL storeSelf( const css::uno::Sequence< css::beans::PropertyValue >& seqArguments )
+ throw (css::lang::IllegalArgumentException, css::io::IOException, css::uno::RuntimeException);
+
+ //____________________________________________________________________________________________________
+ // XStorable
+ //____________________________________________________________________________________________________
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual sal_Bool SAL_CALL hasLocation() throw (css::uno::RuntimeException);
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual OUString SAL_CALL getLocation() throw (css::uno::RuntimeException);
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual sal_Bool SAL_CALL isReadonly() throw (css::uno::RuntimeException);
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL store() throw (css::io::IOException, css::uno::RuntimeException);
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL storeAsURL( const OUString& sURL,
+ const css::uno::Sequence< css::beans::PropertyValue >& seqArguments )
+ throw (css::io::IOException, css::uno::RuntimeException) ;
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL storeToURL( const OUString& sURL,
+ const css::uno::Sequence< css::beans::PropertyValue >& seqArguments )
+ throw (css::io::IOException, css::uno::RuntimeException);
+
+
+
+ //____________________________________________________________________________________________________
+ // XLoadable
+ //____________________________________________________________________________________________________
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL initNew()
+ throw (css::frame::DoubleInitializationException,
+ css::io::IOException,
+ css::uno::RuntimeException,
+ css::uno::Exception);
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL load( const css::uno::Sequence< css::beans::PropertyValue >& seqArguments )
+ throw (css::frame::DoubleInitializationException,
+ css::io::IOException,
+ css::uno::RuntimeException,
+ css::uno::Exception);
+
+ //____________________________________________________________________________________________________
+ // XDocumentSubStorageSupplier
+ //____________________________________________________________________________________________________
+
+ virtual css::uno::Reference< css::embed::XStorage > SAL_CALL getDocumentSubStorage( const OUString& aStorageName, sal_Int32 nMode )
+ throw ( css::uno::RuntimeException );
+
+ virtual css::uno::Sequence< OUString > SAL_CALL getDocumentSubStoragesNames()
+ throw ( css::io::IOException, css::uno::RuntimeException );
+
+ //____________________________________________________________________________________________________
+ // XStorageBasedDocument
+ //____________________________________________________________________________________________________
+
+ virtual void SAL_CALL loadFromStorage( const css::uno::Reference< css::embed::XStorage >& xStorage,
+ const css::uno::Sequence< css::beans::PropertyValue >& aMediaDescriptor )
+ throw ( css::lang::IllegalArgumentException,
+ com::sun::star::frame::DoubleInitializationException,
+ css::io::IOException,
+ css::uno::Exception,
+ css::uno::RuntimeException );
+
+ virtual void SAL_CALL storeToStorage( const css::uno::Reference< css::embed::XStorage >& xStorage,
+ const css::uno::Sequence< css::beans::PropertyValue >& aMediaDescriptor )
+ throw ( css::lang::IllegalArgumentException,
+ css::io::IOException,
+ css::uno::Exception,
+ css::uno::RuntimeException );
+
+ virtual void SAL_CALL switchToStorage( const css::uno::Reference< css::embed::XStorage >& xStorage )
+ throw ( css::lang::IllegalArgumentException,
+ css::io::IOException,
+ css::uno::Exception,
+ css::uno::RuntimeException );
+
+ virtual css::uno::Reference< css::embed::XStorage > SAL_CALL getDocumentStorage()
+ throw ( css::io::IOException,
+ css::uno::Exception,
+ css::uno::RuntimeException );
+
+ virtual void SAL_CALL addStorageChangeListener(
+ const css::uno::Reference< css::document::XStorageChangeListener >& xListener )
+ throw ( css::uno::RuntimeException );
+
+ virtual void SAL_CALL removeStorageChangeListener(
+ const css::uno::Reference< css::document::XStorageChangeListener >& xListener )
+ throw ( css::uno::RuntimeException );
+
+ //____________________________________________________________________________________________________
+ // XVisualObject
+ //____________________________________________________________________________________________________
+
+ virtual void SAL_CALL setVisualAreaSize( sal_Int64 nAspect, const css::awt::Size& aSize )
+ throw ( css::lang::IllegalArgumentException,
+ css::embed::WrongStateException,
+ css::uno::Exception,
+ css::uno::RuntimeException );
+
+ virtual css::awt::Size SAL_CALL getVisualAreaSize( sal_Int64 nAspect )
+ throw ( css::lang::IllegalArgumentException,
+ css::embed::WrongStateException,
+ css::uno::Exception,
+ css::uno::RuntimeException );
+
+ virtual css::embed::VisualRepresentation SAL_CALL getPreferredVisualRepresentation( ::sal_Int64 nAspect )
+ throw ( css::lang::IllegalArgumentException,
+ css::embed::WrongStateException,
+ css::uno::Exception,
+ css::uno::RuntimeException );
+
+ virtual sal_Int32 SAL_CALL getMapUnit( sal_Int64 nAspect )
+ throw ( css::uno::Exception,
+ css::uno::RuntimeException );
+
+ //____________________________________________________________________________________________________
+ // XScriptProviderSupplier
+ //____________________________________________________________________________________________________
+
+ virtual css::uno::Reference< css::script::provider::XScriptProvider > SAL_CALL getScriptProvider() throw ( css::uno::RuntimeException );
+
+ //____________________________________________________________________________________________________
+ // XUIConfigurationManagerSupplier
+ //____________________________________________________________________________________________________
+ virtual css::uno::Reference< css::ui::XUIConfigurationManager > SAL_CALL getUIConfigurationManager() throw ( css::uno::RuntimeException );
+
+ //____________________________________________________________________________________________________
+ // XTransferable
+ //____________________________________________________________________________________________________
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual css::uno::Any SAL_CALL getTransferData( const css::datatransfer::DataFlavor& aFlavor )
+ throw (css::datatransfer::UnsupportedFlavorException,
+ css::io::IOException,
+ css::uno::RuntimeException);
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+
+ virtual css::uno::Sequence< css::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors()
+ throw (css::uno::RuntimeException);
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual sal_Bool SAL_CALL isDataFlavorSupported( const css::datatransfer::DataFlavor& aFlavor )
+ throw (css::uno::RuntimeException);
+
+
+ //____________________________________________________________________________________________________
+ // XEventsSupplier
+ //____________________________________________________________________________________________________
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr - offers a list of event handlers which are be bound to events of
+ this object.
+ @seealso -
+
+ @param -
+
+ @return - an <type>Events</type> object.
+
+ @onerror -
+ */
+
+ virtual css::uno::Reference< css::container::XNameReplace > SAL_CALL getEvents() throw( css::uno::RuntimeException );
+
+
+ //____________________________________________________________________________________________________
+ // XEmbeddedScripts
+ //____________________________________________________________________________________________________
+
+ virtual css::uno::Reference< css::script::XStorageBasedLibraryContainer > SAL_CALL getBasicLibraries() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< css::script::XStorageBasedLibraryContainer > SAL_CALL getDialogLibraries() throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getAllowMacroExecution() throw (css::uno::RuntimeException);
+
+ //____________________________________________________________________________________________________
+ // XScriptInvocationContext
+ //____________________________________________________________________________________________________
+
+ virtual css::uno::Reference< css::document::XEmbeddedScripts > SAL_CALL getScriptContainer() throw (css::uno::RuntimeException);
+
+ //____________________________________________________________________________________________________
+ // XEventBroadcaster
+ //____________________________________________________________________________________________________
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr - registers the given <type>XEventListener</type>.
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL addEventListener( const css::uno::Reference< css::document::XEventListener >& xListener ) throw( css::uno::RuntimeException );
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr - unregisters the given <type>XEventListener</type>.
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::document::XEventListener >& xListener ) throw( css::uno::RuntimeException );
+
+ //____________________________________________________________________________________________________
+ // XDocumentEventBroadcaster
+ //____________________________________________________________________________________________________
+
+ virtual void SAL_CALL addDocumentEventListener( const css::uno::Reference< css::document::XDocumentEventListener >& _Listener ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL removeDocumentEventListener( const css::uno::Reference< css::document::XDocumentEventListener >& _Listener ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL notifyDocumentEvent( const OUString& _EventName, const css::uno::Reference< css::frame::XController2 >& _ViewController, const css::uno::Any& _Supplement ) throw (css::lang::IllegalArgumentException, css::lang::NoSupportException, css::uno::RuntimeException);
+
+ //____________________________________________________________________________________________________
+ // XUnoTunnel
+ //____________________________________________________________________________________________________
+
+ virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) throw(css::uno::RuntimeException);
+
+ // css.frame.XModule
+ virtual void SAL_CALL setIdentifier(const OUString& sIdentifier)
+ throw (css::uno::RuntimeException);
+
+ // css.frame.XModule
+ virtual OUString SAL_CALL getIdentifier()
+ throw (css::uno::RuntimeException);
+
+ // css.frame.XTitle
+ virtual OUString SAL_CALL getTitle()
+ throw (css::uno::RuntimeException);
+
+ // css.frame.XTitle
+ virtual void SAL_CALL setTitle( const OUString& sTitle )
+ throw (css::uno::RuntimeException);
+
+ // css.frame.XTitleChangeBroadcaster
+ virtual void SAL_CALL addTitleChangeListener( const css::uno::Reference< css::frame::XTitleChangeListener >& xListener )
+ throw (css::uno::RuntimeException);
+
+ // css.frame.XTitleChangeBroadcaster
+ virtual void SAL_CALL removeTitleChangeListener( const css::uno::Reference< css::frame::XTitleChangeListener >& xListener )
+ throw (css::uno::RuntimeException);
+
+ // css.frame.XUntitledNumbers
+ virtual ::sal_Int32 SAL_CALL leaseNumber( const css::uno::Reference< css::uno::XInterface >& xComponent )
+ throw (css::lang::IllegalArgumentException,
+ css::uno::RuntimeException );
+
+ // css.frame.XUntitledNumbers
+ virtual void SAL_CALL releaseNumber( ::sal_Int32 nNumber )
+ throw (css::lang::IllegalArgumentException,
+ css::uno::RuntimeException );
+
+ // css.frame.XUntitledNumbers
+ virtual void SAL_CALL releaseNumberForComponent( const css::uno::Reference< css::uno::XInterface >& xComponent )
+ throw (css::lang::IllegalArgumentException,
+ css::uno::RuntimeException );
+
+ // css.frame.XUntitledNumbers
+ virtual OUString SAL_CALL getUntitledPrefix()
+ throw (css::uno::RuntimeException);
+
+ // css.document.XDocumentRecovery
+ virtual ::sal_Bool SAL_CALL wasModifiedSinceLastSave()
+ throw ( css::uno::RuntimeException );
+ virtual void SAL_CALL storeToRecoveryFile( const OUString& i_TargetLocation, const css::uno::Sequence< css::beans::PropertyValue >& i_MediaDescriptor )
+ throw ( css::uno::RuntimeException,
+ css::io::IOException,
+ css::lang::WrappedTargetException );
+ virtual void SAL_CALL recoverFromFile( const OUString& i_SourceLocation, const OUString& i_SalvagedFile, const css::uno::Sequence< css::beans::PropertyValue >& i_MediaDescriptor )
+ throw ( css::uno::RuntimeException,
+ css::io::IOException,
+ css::lang::WrappedTargetException );
+
+ // css.document.XUndoManagerSupplier
+ virtual css::uno::Reference< css::document::XUndoManager > SAL_CALL getUndoManager( ) throw (css::uno::RuntimeException);
+
+ //____________________________________________________________________________________________________
+
+ // css::rdf::XNode:
+ virtual OUString SAL_CALL getStringValue()
+ throw (css::uno::RuntimeException);
+
+ // css::rdf::XURI:
+ virtual OUString SAL_CALL getNamespace()
+ throw (css::uno::RuntimeException);
+ virtual OUString SAL_CALL getLocalName()
+ throw (css::uno::RuntimeException);
+
+ // css::rdf::XRepositorySupplier:
+ virtual css::uno::Reference<
+ css::rdf::XRepository > SAL_CALL getRDFRepository()
+ throw (css::uno::RuntimeException);
+
+ // css::rdf::XDocumentMetadataAccess:
+ virtual css::uno::Reference<
+ css::rdf::XMetadatable > SAL_CALL
+ getElementByMetadataReference(
+ const css::beans::StringPair & i_rReference)
+ throw (css::uno::RuntimeException);
+ virtual css::uno::Reference<
+ css::rdf::XMetadatable > SAL_CALL
+ getElementByURI(const css::uno::Reference<
+ css::rdf::XURI > & i_xURI)
+ throw (css::uno::RuntimeException,
+ css::lang::IllegalArgumentException);
+ virtual css::uno::Sequence< css::uno::Reference<
+ css::rdf::XURI > > SAL_CALL getMetadataGraphsWithType(
+ const css::uno::Reference<
+ css::rdf::XURI > & i_xType)
+ throw (css::uno::RuntimeException,
+ css::lang::IllegalArgumentException);
+ virtual css::uno::Reference<
+ css::rdf::XURI> SAL_CALL
+ addMetadataFile(const OUString & i_rFileName,
+ const css::uno::Sequence<
+ css::uno::Reference< css::rdf::XURI >
+ > & i_rTypes)
+ throw (css::uno::RuntimeException,
+ css::lang::IllegalArgumentException,
+ css::container::ElementExistException);
+ virtual css::uno::Reference<
+ css::rdf::XURI> SAL_CALL
+ importMetadataFile(::sal_Int16 i_Format,
+ const css::uno::Reference<
+ css::io::XInputStream > & i_xInStream,
+ const OUString & i_rFileName,
+ const css::uno::Reference<
+ css::rdf::XURI > & i_xBaseURI,
+ const css::uno::Sequence<
+ css::uno::Reference< css::rdf::XURI >
+ > & i_rTypes)
+ throw (css::uno::RuntimeException,
+ css::lang::IllegalArgumentException,
+ css::datatransfer::UnsupportedFlavorException,
+ css::container::ElementExistException,
+ css::rdf::ParseException,
+ css::io::IOException);
+ virtual void SAL_CALL removeMetadataFile(
+ const css::uno::Reference<
+ css::rdf::XURI > & i_xGraphName)
+ throw (css::uno::RuntimeException,
+ css::lang::IllegalArgumentException,
+ css::container::NoSuchElementException);
+ virtual void SAL_CALL addContentOrStylesFile(
+ const OUString & i_rFileName)
+ throw (css::uno::RuntimeException,
+ css::lang::IllegalArgumentException,
+ css::container::ElementExistException);
+ virtual void SAL_CALL removeContentOrStylesFile(
+ const OUString & i_rFileName)
+ throw (css::uno::RuntimeException,
+ css::lang::IllegalArgumentException,
+ css::container::NoSuchElementException);
+
+ virtual void SAL_CALL loadMetadataFromStorage(
+ const css::uno::Reference<
+ css::embed::XStorage > & i_xStorage,
+ const css::uno::Reference<
+ css::rdf::XURI > & i_xBaseURI,
+ const css::uno::Reference<
+ css::task::XInteractionHandler> & i_xHandler)
+ throw (css::uno::RuntimeException,
+ css::lang::IllegalArgumentException,
+ css::lang::WrappedTargetException);
+ virtual void SAL_CALL storeMetadataToStorage(
+ const css::uno::Reference<
+ css::embed::XStorage > & i_xStorage)
+ throw (css::uno::RuntimeException,
+ css::lang::IllegalArgumentException,
+ css::lang::WrappedTargetException);
+ virtual void SAL_CALL loadMetadataFromMedium(
+ const css::uno::Sequence<
+ css::beans::PropertyValue > & i_rMedium)
+ throw (css::uno::RuntimeException,
+ css::lang::IllegalArgumentException,
+ css::lang::WrappedTargetException);
+ virtual void SAL_CALL storeMetadataToMedium(
+ const css::uno::Sequence<
+ css::beans::PropertyValue > & i_rMedium)
+ throw (css::uno::RuntimeException,
+ css::lang::IllegalArgumentException,
+ css::lang::WrappedTargetException);
+
+ // XCmisDocument
+
+ virtual css::uno::Sequence< css::beans::PropertyValue >
+ SAL_CALL getCmisPropertiesValues()
+ throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setCmisPropertiesValues(
+ const css::uno::Sequence<
+ css::beans::PropertyValue >& _cmispropertiesvalues )
+ throw (css::uno::RuntimeException);
+ virtual css::uno::Sequence< css::beans::PropertyValue >
+ SAL_CALL getCmisPropertiesDisplayNames()
+ throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setCmisPropertiesDisplayNames(
+ const css::uno::Sequence<
+ css::beans::PropertyValue >& _cmispropertiesdisplaynames )
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL checkOut( ) throw ( css::uno::RuntimeException );
+ virtual void SAL_CALL cancelCheckOut( ) throw ( css::uno::RuntimeException );
+ virtual void SAL_CALL checkIn( sal_Bool bIsMajor, const OUString & rMessage )
+ throw ( css::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL isVersionable( ) throw ( css::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL canCheckOut( ) throw ( css::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL canCancelCheckOut( ) throw ( css::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL canCheckIn( ) throw ( css::uno::RuntimeException );
+
+ sal_Bool getBoolPropertyValue( const OUString& rName ) throw ( css::uno::RuntimeException );
+
+ //____________________________________________________________________________________________________
+ // SfxListener
+ //____________________________________________________________________________________________________
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ void Notify( SfxBroadcaster& aBC ,
+ const SfxHint& aHint ) ;
+
+ //____________________________________________________________________________________________________
+ // public IMPL?
+ //____________________________________________________________________________________________________
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ void changing() ;
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ SfxObjectShell* GetObjectShell() const ;
+
+ SAL_DLLPRIVATE sal_Bool impl_isDisposed() const ;
+ sal_Bool IsInitialized() const;
+ sal_Bool IsDisposed() const { return impl_isDisposed(); }
+ void MethodEntryCheck( const bool i_mustBeInitialized ) const;
+ ::osl::Mutex& getMutex() const { return m_aMutex; }
+
+ css::uno::Reference < css::container::XIndexAccess > SAL_CALL getViewData() throw (css::uno::RuntimeException);
+ void SAL_CALL setViewData( const css::uno::Reference < css::container::XIndexAccess >& aData ) throw (css::uno::RuntimeException);
+
+ /** calls all XEventListeners */
+ void notifyEvent( const css::document::EventObject& aEvent ) const;
+
+ /** returns true if someone added a XEventListener to this XEventBroadcaster */
+ sal_Bool hasEventListeners() const;
+
+protected:
+
+ /* returns a unique id for the model that is valid as long as the document
+ is loaded. The id is not saved across document close/reload. */
+ OUString getRuntimeUID() const;
+
+ /* returns true if the document signatures are valid, otherwise false */
+ sal_Bool hasValidSignatures() const;
+
+//________________________________________________________________________________________________________
+// private methods
+//________________________________________________________________________________________________________
+
+private:
+
+ /**___________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ css::uno::Reference< css::ui::XUIConfigurationManager2 > getUIConfigurationManager2() throw ( css::uno::RuntimeException );
+ bool impl_getPrintHelper();
+ SAL_DLLPRIVATE void ListenForStorage_Impl( const css::uno::Reference< css::embed::XStorage >& xStorage );
+ SAL_DLLPRIVATE OUString GetMediumFilterName_Impl();
+
+ SAL_DLLPRIVATE void impl_store( const OUString& sURL,
+ const css::uno::Sequence< css::beans::PropertyValue >& seqArguments ,
+ sal_Bool bSaveTo ) ;
+
+ SAL_DLLPRIVATE void postEvent_Impl( const OUString& aName, const css::uno::Reference< css::frame::XController2 >& xController = css::uno::Reference< css::frame::XController2 >() );
+
+ SAL_DLLPRIVATE String getEventName_Impl( long nID );
+ SAL_DLLPRIVATE bool QuerySaveSizeExceededModules( const com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler >& xHandler );
+
+ SAL_DLLPRIVATE css::uno::Reference< css::frame::XTitle > impl_getTitleHelper ();
+ SAL_DLLPRIVATE css::uno::Reference< css::frame::XUntitledNumbers > impl_getUntitledHelper ();
+
+ SAL_DLLPRIVATE SfxViewFrame* FindOrCreateViewFrame_Impl(
+ const css::uno::Reference< css::frame::XFrame >& i_rFrame,
+ ::sfx::intern::ViewCreationGuard& i_rGuard
+ ) const;
+
+ SAL_DLLPRIVATE void NotifyModifyListeners_Impl() const;
+
+ SAL_DLLPRIVATE void loadCmisProperties();
+
+ SAL_DLLPRIVATE void handleLoadError( sal_uInt32 nError, SfxMedium* pMedium );
+
+//________________________________________________________________________________________________________
+// private variables and methods
+//________________________________________________________________________________________________________
+
+private:
+
+ IMPL_SfxBaseModel_DataContainer* m_pData ;
+ // cannot be held in m_pData, since it needs to be accessed in non-threadsafe context
+ const bool m_bSupportEmbeddedScripts;
+ const bool m_bSupportDocRecovery;
+
+} ; // class SfxBaseModel
+
+/** base class for sub components of an SfxBaseModel, which share their ref count and lifetime with the SfxBaseModel
+*/
+class SFX2_DLLPUBLIC SfxModelSubComponent
+{
+public:
+ /** checks whether the instance is alive, i.e. properly initialized, and not yet disposed
+ */
+ void MethodEntryCheck()
+ {
+ m_rModel.MethodEntryCheck( true );
+ }
+
+ // called when the SfxBaseModel which the component is superordinate of is being disposed
+ virtual void disposing();
+
+protected:
+ SfxModelSubComponent( SfxBaseModel& i_model )
+ :m_rModel( i_model )
+ {
+ }
+ virtual ~SfxModelSubComponent();
+
+ // helpers for implementing XInterface - delegates ref counting to the SfxBaseModel
+ void acquire() { m_rModel.acquire(); }
+ void release() { m_rModel.release(); }
+
+ bool isDisposed() const { return m_rModel.IsDisposed(); }
+
+protected:
+ const SfxBaseModel& getBaseModel() const { return m_rModel; }
+ SfxBaseModel& getBaseModel() { return m_rModel; }
+
+ ::osl::Mutex& getMutex() { return m_rModel.getMutex(); }
+
+private:
+ SfxBaseModel& m_rModel;
+};
+
+class SFX2_DLLPUBLIC SfxModelGuard
+{
+public:
+ enum AllowedModelState
+ {
+ // not yet initialized
+ E_INITIALIZING,
+ // fully alive, i.e. initialized, and not yet disposed
+ E_FULLY_ALIVE
+ };
+
+ SfxModelGuard( SfxBaseModel& i_rModel, const AllowedModelState i_eState = E_FULLY_ALIVE )
+ : m_aGuard()
+ {
+ i_rModel.MethodEntryCheck( i_eState != E_INITIALIZING );
+ }
+ SfxModelGuard( SfxModelSubComponent& i_rSubComponent )
+ :m_aGuard()
+ {
+ i_rSubComponent.MethodEntryCheck();
+ }
+ ~SfxModelGuard()
+ {
+ }
+
+ void reset()
+ {
+ m_aGuard.reset();
+ }
+
+ void clear()
+ {
+ m_aGuard.clear();
+ }
+
+private:
+ SolarMutexResettableGuard m_aGuard;
+};
+
+#endif // _SFX_SFXBASEMODEL_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sfxcommands.h b/include/sfx2/sfxcommands.h
new file mode 100644
index 000000000000..3f4df5cb5220
--- /dev/null
+++ b/include/sfx2/sfxcommands.h
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef SFX2_SFXCOMMANDS_HRC
+#define SFX2_SFXCOMMANDS_HRC
+
+#define CMD_SID_ABOUT ".uno:About"
+#define CMD_SID_NEWDOC ".uno:NewDoc"
+#define CMD_SID_BROWSE_BACKWARD ".uno:BrowseBackward"
+#define CMD_SID_BROWSE_FORWARD ".uno:BrowseForward"
+#define CMD_SID_CLOSEWIN ".uno:CloseWin"
+#define CMD_SID_COPY ".uno:Copy"
+#define CMD_SID_CUT ".uno:Cut"
+#define CMD_SID_DELETE ".uno:Delete"
+#define CMD_SID_BASICIDE_DELETECURRENT ".uno:DeleteCurrent"
+#define CMD_SID_STYLE_DESIGNER ".uno:DesignerDialog"
+#define CMD_SID_EDITDOC ".uno:EditDoc"
+#define CMD_SID_STYLE_EDIT ".uno:EditStyle"
+#define CMD_SID_WIN_FULLSCREEN ".uno:FullScreen"
+#define CMD_SID_BASICIDE_HIDECURPAGE ".uno:HideCurPage"
+#define CMD_SID_HYPERLINK_DIALOG ".uno:HyperlinkDialog"
+#define CMD_SID_BASICIDE_MODULEDLG ".uno:ModuleDialog"
+#define CMD_SID_NAVIGATOR ".uno:Navigator"
+#define CMD_SID_BASICIDE_NEWDIALOG ".uno:NewDialog"
+#define CMD_SID_BASICIDE_NEWMODULE ".uno:NewModule"
+#define CMD_SID_OBJECT ".uno:ObjectMenue"
+#define CMD_SID_OPENDOC ".uno:Open"
+#define CMD_SID_WEBHTML ".uno:WebHtml"
+#define CMD_SID_OPENHYPERLINK ".uno:OpenHyperlink"
+#define CMD_SID_DOCINFO_TITLE ".uno:DocInfoTitle"
+#define CMD_SID_OPENTEMPLATE ".uno:OpenTemplate"
+#define CMD_SID_CHECKOUT ".uno:CheckOut"
+#define CMD_SID_CANCELCHECKOUT ".uno:CancelCheckOut"
+#define CMD_SID_CHECKIN ".uno:CheckIn"
+#define CMD_SID_OPENURL ".uno:OpenUrl"
+#define CMD_SID_OPTIONS ".uno:Options"
+#define CMD_SID_ORGANIZER ".uno:Organizer"
+#define CMD_SID_PASTE ".uno:Paste"
+#define CMD_SID_PASTE_SPECIAL ".uno:PasteSpecial"
+#define CMD_SID_PASTE_ONLY ".uno:PasteOnly"
+#define CMD_SID_PASTE_ONLY_VALUE ".uno:PasteOnlyValue"
+#define CMD_SID_PASTE_ONLY_TEXT ".uno:PasteOnlyText"
+#define CMD_SID_PASTE_ONLY_FORMULA ".uno:PasteOnlyFormula"
+#define CMD_SID_PRINTPREVIEW ".uno:PrintPreview"
+#define CMD_SID_RELOAD ".uno:Reload"
+#define CMD_SID_BASICIDE_RENAMECURRENT ".uno:RenameCurrent"
+#define CMD_SID_DOCTEMPLATE ".uno:SaveAsTemplate"
+#define CMD_SID_SEARCH_DLG ".uno:SearchDialog"
+#define CMD_SID_SHOW_BROWSER ".uno:ShowBrowser"
+#define CMD_SID_STYLE_NEW_BY_EXAMPLE ".uno:StyleNewByExample"
+#define CMD_SID_INET_DLG ".uno:InternetDialog"
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sfxdefs.hxx b/include/sfx2/sfxdefs.hxx
new file mode 100644
index 000000000000..cca545f7e2f7
--- /dev/null
+++ b/include/sfx2/sfxdefs.hxx
@@ -0,0 +1,27 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SFXDEFS_HXX
+#define _SFXDEFS_HXX
+
+#define SfxFilterFlags sal_uLong
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sfxdlg.hxx b/include/sfx2/sfxdlg.hxx
new file mode 100644
index 000000000000..a994c7dfa77a
--- /dev/null
+++ b/include/sfx2/sfxdlg.hxx
@@ -0,0 +1,158 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX2_DIALOG_HXX
+#define _SFX2_DIALOG_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+
+#include <vcl/abstdlg.hxx>
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include <com/sun/star/embed/XStorage.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+
+#include <sot/exchange.hxx>
+#include <sfx2/lnkbase.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.h>
+
+class SfxTabPage;
+class SfxViewFrame;
+class SfxBindings;
+class SfxItemSet;
+class ResId;
+class Window;
+class String;
+class SfxItemPool;
+class SvObjectServerList;
+class TransferableDataHelper;
+struct TransferableObjectDescriptor;
+
+#include <sfx2/tabdlg.hxx>
+
+namespace sfx2
+{
+ class LinkManager;
+}
+
+namespace com { namespace sun { namespace star { namespace frame {
+ class XModel;
+} } } }
+
+class SfxAbstractDialog : virtual public VclAbstractDialog
+{
+public:
+ virtual const SfxItemSet* GetOutputItemSet() const = 0;
+ virtual void SetText( const OUString& rStr ) = 0;
+ virtual OUString GetText() const = 0;
+};
+
+class SfxAbstractTabDialog : virtual public SfxAbstractDialog
+{
+public:
+ virtual void SetCurPageId( sal_uInt16 nId ) = 0;
+ virtual void SetCurPageId( const OString &rName ) = 0;
+ virtual const sal_uInt16* GetInputRanges( const SfxItemPool& ) = 0;
+ virtual void SetInputSet( const SfxItemSet* pInSet ) = 0;
+};
+
+class SfxAbstractApplyTabDialog : virtual public SfxAbstractTabDialog
+{
+public:
+ virtual void SetApplyHdl( const Link& rLink ) = 0;
+};
+
+class SfxAbstractInsertObjectDialog : virtual public VclAbstractDialog
+{
+public:
+ virtual com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetObject()=0;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetIconIfIconified( OUString* pGraphicMediaType )=0;
+ virtual sal_Bool IsCreateNew()=0;
+};
+
+class SfxAbstractPasteDialog : virtual public VclAbstractDialog
+{
+public:
+ virtual void Insert( SotFormatStringId nFormat, const String & rFormatName ) = 0;
+ virtual void SetObjName( const SvGlobalName & rClass, const String & rObjName ) = 0;
+ virtual sal_uIntPtr GetFormat( const TransferableDataHelper& aHelper,
+ const DataFlavorExVector* pFormats=0,
+ const TransferableObjectDescriptor* pDesc=0 ) = 0;
+};
+
+class SfxAbstractLinksDialog : virtual public VclAbstractDialog
+{
+};
+
+class AbstractScriptSelectorDialog : virtual public VclAbstractDialog
+{
+public:
+ virtual String GetScriptURL() const = 0;
+ virtual void SetRunLabel() = 0;
+};
+
+namespace com { namespace sun { namespace star { namespace frame { class XFrame; } } } }
+
+class SFX2_DLLPUBLIC SfxAbstractDialogFactory : virtual public VclAbstractDialogFactory
+{
+public:
+ virtual ~SfxAbstractDialogFactory(); // needed for export of vtable
+ static SfxAbstractDialogFactory* Create();
+ virtual VclAbstractDialog* CreateSfxDialog( Window* pParent, const SfxBindings& rBindings, sal_uInt32 nResId ) = 0;
+ virtual VclAbstractDialog* CreateFrameDialog( Window* pParent, const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, sal_uInt32 nResId, const String& rParameter ) = 0;
+ virtual SfxAbstractTabDialog* CreateTabDialog( sal_uInt32 nResId,
+ Window* pParent,
+ const SfxItemSet* pAttrSet,
+ SfxViewFrame* pViewFrame,
+ bool bEditFmt=false,
+ const String *pUserButtonText=0 ) = 0;
+ virtual SfxAbstractTabDialog* CreateTabDialog( sal_uInt32 nResId,
+ Window* pParent,
+ const SfxItemSet* pAttrSet,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xViewFrame,
+ bool bEditFmt=false,
+ const String *pUserButtonText=0 ) = 0;
+ virtual CreateTabPage GetTabPageCreatorFunc( sal_uInt16 nId ) = 0;
+ virtual GetTabPageRanges GetTabPageRangesFunc( sal_uInt16 nId ) = 0;
+ virtual SfxAbstractInsertObjectDialog* CreateInsertObjectDialog( Window* pParent, const OUString& rCommand,
+ const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStor,
+ const SvObjectServerList* pList = 0 )=0;
+ virtual VclAbstractDialog* CreateEditObjectDialog( Window* pParent, const OUString& rCommand,
+ const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject >& xObj )=0;
+ virtual SfxAbstractPasteDialog* CreatePasteDialog( Window* pParent )=0;
+ virtual SfxAbstractLinksDialog* CreateLinksDialog( Window* pParent, sfx2::LinkManager* pMgr, sal_Bool bHTML=sal_False, sfx2::SvBaseLink* p=0 )=0;
+ virtual VclAbstractDialog * CreateSvxScriptOrgDialog( Window* pParent, const String& rLanguage ) = 0;
+
+ virtual AbstractScriptSelectorDialog*
+ CreateScriptSelectorDialog(
+ Window* pParent,
+ sal_Bool bShowSlots,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame
+ ) = 0;
+
+ virtual VclAbstractDialog* CreateScriptErrorDialog(
+ Window* pParent, com::sun::star::uno::Any aException ) = 0;
+
+ virtual VclAbstractDialog* CreateOptionsDialog(
+ Window* pParent, const OUString& rExtensionId, const OUString& rApplicationContext ) = 0;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sfxhelp.hxx b/include/sfx2/sfxhelp.hxx
new file mode 100644
index 000000000000..9de00f008736
--- /dev/null
+++ b/include/sfx2/sfxhelp.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX_HELP_HXX
+#define _SFX_HELP_HXX
+
+#include <rtl/ustring.hxx>
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include "sal/types.h"
+#include <vcl/help.hxx>
+
+class SfxHelp_Impl;
+class SfxFrame;
+class SFX2_DLLPUBLIC SfxHelp : public Help
+{
+ OUString aTicket; // for Plugins
+ OUString aUser;
+ OUString aLanguageStr;
+ OUString aCountryStr;
+ sal_Bool bIsDebug;
+ SfxHelp_Impl* pImp;
+
+private:
+ SAL_DLLPRIVATE sal_Bool Start_Impl( const OUString& rURL, const Window* pWindow, const OUString& rKeyword );
+ SAL_DLLPRIVATE virtual sal_Bool SearchKeyword( const OUString& rKeyWord );
+ SAL_DLLPRIVATE virtual sal_Bool Start( const OUString& rURL, const Window* pWindow );
+ SAL_DLLPRIVATE virtual void OpenHelpAgent( const OString& sHelpId );
+ SAL_DLLPRIVATE OUString GetHelpModuleName_Impl();
+ SAL_DLLPRIVATE OUString CreateHelpURL_Impl( const OUString& aCommandURL, const OUString& rModuleName );
+
+public:
+ SfxHelp();
+ ~SfxHelp();
+
+ inline void SetTicket( const OUString& rTicket ) { aTicket = rTicket; }
+ inline void SetUser( const OUString& rUser ) { aUser = rUser; }
+
+ virtual OUString GetHelpText( const OUString&, const Window* pWindow );
+
+ static OUString CreateHelpURL( const OUString& aCommandURL, const OUString& rModuleName );
+ using Help::OpenHelpAgent;
+ static void OpenHelpAgent( SfxFrame* pFrame, const OString& sHelpId );
+ static OUString GetDefaultHelpModule();
+ static OUString GetCurrentModuleIdentifier();
+};
+
+#endif // #ifndef _SFX_HELP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sfxhtml.hxx b/include/sfx2/sfxhtml.hxx
new file mode 100644
index 000000000000..7569afe483c2
--- /dev/null
+++ b/include/sfx2/sfxhtml.hxx
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SFXHTML_HXX
+#define _SFXHTML_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include "sal/types.h"
+#include <i18nlangtag/lang.h>
+#include <svtools/parhtml.hxx>
+#include <svl/macitem.hxx>
+
+
+class ImageMap;
+class SfxMedium;
+class SfxObjectShell;
+
+class SFX2_DLLPUBLIC SfxHTMLParser : public HTMLParser
+{
+ String aScriptType;
+
+ SfxMedium* pMedium;
+ SfxMedium *pDLMedium; // Medium for Download Files
+
+ ScriptType eScriptType;
+
+ SAL_DLLPRIVATE void GetScriptType_Impl( SvKeyValueIterator* );
+
+protected:
+
+ SfxHTMLParser( SvStream& rStream, sal_Bool bNewDoc=sal_True, SfxMedium *pMedium=0 );
+
+ virtual ~SfxHTMLParser();
+
+public:
+ // Read the options of an image map
+ // <MAP>: sal_True = Image-Map has a name
+ // <AREA>: sal_True = Image-Map has now one Region more
+ static bool ParseMapOptions(ImageMap* pImageMap, const HTMLOptions& rOptions);
+ bool ParseMapOptions(ImageMap * pImageMap)
+ { return ParseMapOptions(pImageMap, GetOptions()); }
+ static bool ParseAreaOptions(ImageMap * pImageMap, const String& rBaseURL,
+ const HTMLOptions& rOptions,
+ sal_uInt16 nEventMouseOver = 0,
+ sal_uInt16 nEventMouseOut = 0 );
+ inline sal_Bool ParseAreaOptions(ImageMap * pImageMap, const String& rBaseURL,
+ sal_uInt16 nEventMouseOver = 0,
+ sal_uInt16 nEventMouseOut = 0);
+
+ // <TD SDVAL="..." SDNUM="...">
+ static double GetTableDataOptionsValNum( sal_uInt32& nNumForm,
+ LanguageType& eNumLang, const String& aValStr,
+ const String& aNumStr, SvNumberFormatter& rFormatter );
+
+protected:
+ // Start a file download. This is done asynchronously or synchronously.
+ // In the synchronous case, the parser is in the working state after
+ // it has been called. The read file can then be picked up directly with
+ // FinishFileDownload. In the asynchronous case, the parser is in the
+ // pending state after it hs been called. The parser then has to leave
+ // over the Continue (without Reschedule!). If the file is loaded,
+ // a Continue is called with passed on token. The file can then be picked
+ // up by FinishFileDownload. To cancel the download should a shell be
+ // left. It can only exist a single download at the same time, For every
+ // started download FinshFileDownload must be called.
+ void StartFileDownload(const OUString& rURL);
+
+ // End of an asynchronous file download. Returns TRUE if the download
+ // was successful. The read file is then passed into String.
+ sal_Bool FinishFileDownload( String& rStr );
+
+ // Returns TRUE if a file was downloaded and if FileDownloadFinished
+ // has not yet been called
+ sal_Bool ShouldFinishFileDownload() const { return pDLMedium != 0; }
+
+ SfxMedium *GetMedium() { return pMedium; }
+ const SfxMedium *GetMedium() const { return pMedium; }
+
+ // Default (without iterator) is JavaScript
+ ScriptType GetScriptType( SvKeyValueIterator* ) const;
+ const String& GetScriptTypeString( SvKeyValueIterator* ) const;
+};
+
+inline sal_Bool SfxHTMLParser::ParseAreaOptions(ImageMap * pImageMap, const String& rBaseURL,
+ sal_uInt16 nEventMouseOver,
+ sal_uInt16 nEventMouseOut)
+{
+ return ParseAreaOptions( pImageMap, rBaseURL, GetOptions(),
+ nEventMouseOver, nEventMouseOut );
+}
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sfxmodelfactory.hxx b/include/sfx2/sfxmodelfactory.hxx
new file mode 100644
index 000000000000..612aea61d07e
--- /dev/null
+++ b/include/sfx2/sfxmodelfactory.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SFX2_SFXMODELFACTORY_HXX
+#define SFX2_SFXMODELFACTORY_HXX
+
+#include "sfx2/dllapi.h"
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+
+//........................................................................
+namespace sfx2
+{
+//........................................................................
+
+ #define SFXMODEL_STANDARD (sal_uInt64)(0x0000)
+ #define SFXMODEL_EMBEDDED_OBJECT (sal_uInt64)(0x0001)
+ #define SFXMODEL_DISABLE_EMBEDDED_SCRIPTS (sal_uInt64)(0x0002)
+ #define SFXMODEL_DISABLE_DOCUMENT_RECOVERY (sal_uInt64)(0x0004)
+
+ typedef ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > ( SAL_CALL * SfxModelFactoryFunc ) (
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory,
+ const sal_uInt64 _nCreationFlags
+ );
+
+ //====================================================================
+ //= createSfxModelFactory
+ //====================================================================
+ /** creates a XSingleServiceFactory which can be used to created instances
+ of classes derived from SfxBaseModel
+
+ In opposite to the default implementations from module cppuhelper, this
+ factory evaluates certain creation arguments (passed to createInstanceWithArguments)
+ and passes them to the factory function of the derived class.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory >
+ SFX2_DLLPUBLIC createSfxModelFactory(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxServiceFactory,
+ const OUString& _rImplementationName,
+ const SfxModelFactoryFunc _pComponentFactoryFunc,
+ const ::com::sun::star::uno::Sequence< OUString >& _rServiceNames
+ );
+
+//........................................................................
+} // namespace sfx2
+//........................................................................
+
+#endif // SFX2_SFXMODELFACTORY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sfxresid.hxx b/include/sfx2/sfxresid.hxx
new file mode 100644
index 000000000000..f90221847579
--- /dev/null
+++ b/include/sfx2/sfxresid.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX_SFXRESID_HXX
+#define _SFX_SFXRESID_HXX
+
+#include "sfx2/dllapi.h"
+#include <tools/resid.hxx>
+
+class SFX2_DLLPUBLIC SfxResId: public ResId
+{
+public:
+ SfxResId( sal_uInt16 nId );
+ static ResMgr* GetResMgr();
+ static void DeleteResMgr();
+};
+
+#define SFX2_RESSTR(x) SfxResId(x).toString()
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc
new file mode 100644
index 000000000000..00923ffdc6a8
--- /dev/null
+++ b/include/sfx2/sfxsids.hrc
@@ -0,0 +1,753 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXSIDS_HRC
+#define _SFXSIDS_HRC
+
+#include <svl/solar.hrc>
+#include <sfx2/cntids.hrc>
+#include <svl/memberid.hrc>
+
+// Please be careful:
+// Changing just one part here doesn't add new
+// docking windows automatically!
+//
+
+#define SID_DOCKWIN_0 SID_DOCKWIN_START
+#define SID_DOCKWIN_1 SID_DOCKWIN_START+1
+#define SID_DOCKWIN_2 SID_DOCKWIN_START+2
+#define SID_DOCKWIN_3 SID_DOCKWIN_START+3
+#define SID_DOCKWIN_4 SID_DOCKWIN_START+4
+#define SID_DOCKWIN_5 SID_DOCKWIN_START+5
+#define SID_DOCKWIN_6 SID_DOCKWIN_START+6
+#define SID_DOCKWIN_7 SID_DOCKWIN_START+7
+#define SID_DOCKWIN_8 SID_DOCKWIN_START+8
+#define SID_DOCKWIN_9 SID_DOCKWIN_START+9
+
+//=========================================================================
+
+#define SID_UNKNOWN SID_SFX_START
+
+//-------------------------------------------------------------------------
+
+// default-ids for application
+#define SID_QUITAPP (SID_SFX_START + 300)
+#define SID_ABOUT (SID_SFX_START + 301)
+#define SID_SETUPPRINTER (SID_SFX_START + 302)
+#define SID_EXITANDRETURN (SID_SFX_START + 303)
+
+#define SID_CONTEXT (SID_SFX_START + 310)
+
+#define SID_PASTE_SPECIAL (SID_SFX_START + 311)
+#define SID_CLIPBOARD_FORMAT_ITEMS (SID_SFX_START + 312)
+
+#define SID_VERSION_VISIBLE (SID_SFX_START + 313)
+#define SID_PASTE_UNFORMATTED (SID_SFX_START + 314)
+#define SID_PRINTER_NOTFOUND_WARN (SID_SFX_START + 320)
+#define SID_PRINTER_NAME (SID_SFX_START + 322)
+#define SID_PRINTER_CHANGESTODOC (SID_SFX_START + 324)
+#define SID_PRINTPREVIEW (SID_SFX_START + 325)
+
+#define SID_MAIL_SUBJECT (SID_SFX_START + 328)
+#define SID_MAIL_NOTIFY (SID_SFX_START + 330)
+#define SID_MAIL_SENDDOC (SID_SFX_START + 331)
+#define SID_MAIL_SENDDOCASPDF (SID_SFX_START + 1672)
+
+#define SID_MAIL_RECIPIENT (SID_SFX_START + 334)
+#define SID_MAIL_TEXT (SID_SFX_START + 335)
+#define SID_MAIL_ATTACH (SID_SFX_START + 336)
+#define SID_MAIL_PRIORITY (SID_SFX_START + 337)
+
+#define SID_MAIL_ATTACH_FILE (SID_SFX_START + 375)
+#define SID_MAIL_PREPAREEXPORT (SID_SFX_START + 385)
+
+#define SID_MAIL_EXPORT_FINISHED (SID_SFX_START + 388)
+#define SID_WEBHTML (SID_SFX_START + 393)
+#define SID_MAIL_SCROLLBODY_PAGEDOWN (SID_SFX_START + 1588)
+
+#define SID_PROGRESS_STATUSBAR_CONTROL (SID_SFX_START + 1597)
+
+#define SID_APPLICATION (SID_SFX_START + 340)
+#define SID_PROGNAME (SID_SFX_START + 341)
+#define SID_PROGFILENAME (SID_SFX_START + 342)
+#define SID_SELECTION (SID_SFX_START + 346)
+
+// 360-400 see SID_MAIL_...
+
+// default-ids for help
+#define SID_HELPONHELP (SID_SFX_START + 400)
+#define SID_HELPINDEX (SID_SFX_START + 401)
+#define SID_EXTENDEDHELP (SID_SFX_START + 402)
+#define SID_HELPBALLOONS (SID_SFX_START + 403)
+#define SID_HELPTIPS (SID_SFX_START + 404)
+#define SID_HELPMENU (SID_SFX_START + 410)
+#define SID_HELP_INDEX (SID_SFX_START + 411)
+#define SID_HELP_SEARCH (SID_SFX_START + 412)
+#define SID_HELP_ANNOTATE (SID_SFX_START + 413)
+#define SID_HELP_BOOKMARK (SID_SFX_START + 414)
+#define SID_HELP_DOWNLOAD (SID_SFX_START + 415)
+#define SID_HELP_ZOOMIN (SID_SFX_START + 417)
+#define SID_HELP_ZOOMOUT (SID_SFX_START + 418)
+#define SID_HELP_HELPFILEBOX (SID_SFX_START + 419)
+#define SID_SEND_FEEDBACK (SID_SFX_START + 421)
+#define SID_SHOW_LICENSE (SID_SFX_START + 1683)
+#define SID_SHOW_CREDITS (SID_SFX_START + 1711)
+#define SID_HELP_TUTORIALS (SID_SFX_START + 1695)
+
+// default-ids for document
+#define SID_NEWDOC (SID_SFX_START + 500)
+#define SID_OPENDOC (SID_SFX_START + 501)
+#define SID_OPENURL (SID_SFX_START + 596)
+#define SID_SAVEASURL (SID_SFX_START + 643)
+#define SID_JUMPTOMARK (SID_SFX_START + 598)
+#define SID_OPENTEMPLATE (SID_SFX_START + 594)
+#define SID_SAVEASDOC (SID_SFX_START + 502)
+#define SID_SAVEACOPY (SID_SFX_START + 999)
+#define SID_CLOSING (SID_SFX_START +1539)
+#define SID_CLOSEDOC (SID_SFX_START + 503)
+#define SID_CLOSEDOCS (SID_SFX_START + 595)
+#define SID_CLOSEDOC_SAVE (SID_SFX_START + 1)
+#define SID_CLOSEDOC_FILENAME (SID_SFX_START + 2)
+#define SID_PRINTDOC (SID_SFX_START + 504)
+#define SID_PRINT_FIRST_PAGE (SID_SFX_START + 1)
+#define SID_PRINT_LAST_PAGE (SID_SFX_START + 2)
+#define SID_PRINT_COPIES (SID_SFX_START + 3)
+#define SID_PRINT_PAGES (SID_SFX_START +1589)
+#define SID_PRINT_COLLATE (SID_SFX_START +1590)
+#define SID_PRINT_SORT (SID_SFX_START +1591)
+#define SID_SAVEDOC (SID_SFX_START + 505)
+#define SID_UPDATEDOC (SID_SFX_START + 506)
+#define SID_FILE_NAME (SID_SFX_START + 507)
+#define SID_DOCINFO_TITLE (SID_SFX_START + 557)
+#define SID_FILE_FILTEROPTIONS (SID_SFX_START + 527)
+#define SID_RELOAD (SID_SFX_START + 508)
+#define SID_PRINTDOCDIRECT (SID_SFX_START + 509)
+#define SID_PICKLIST (SID_SFX_START + 510)
+#define SID_DOC_SERVICE (SID_SFX_START + 511)
+#define SID_ATTR_XWINDOW (SID_SFX_START + 777)
+#define SID_PLUGIN_MODE (SID_SFX_START + 827)
+#define SID_EXPORTDOC (SID_SFX_START + 829)
+#define SID_EXPORTDOCASPDF (SID_SFX_START + 1673)
+#define SID_DIRECTEXPORTDOCASPDF (SID_SFX_START + 1674)
+#define SID_UPDATEDOCMODE (SID_SFX_START + 1668)
+#define SID_CHECKOUT (SID_SFX_START + 512)
+#define SID_CANCELCHECKOUT (SID_SFX_START + 513)
+#define SID_CHECKIN (SID_SFX_START + 514)
+#define SID_FILTER_PROVIDER (SID_SFX_START + 515)
+
+#define SID_FORCERELOAD (SID_SFX_START + 1502)
+#define SID_FILE_DIALOG (SID_SFX_START + 304)
+#define SID_PATH (SID_SFX_START + 308)
+#define SID_SAVEDOCS (SID_SFX_START + 309)
+#define SID_STANDARD_DIR (SID_SFX_START + 450)
+#define SID_BLACK_LIST (SID_SFX_START + 451)
+
+// browse-ids
+#define SID_BROWSE_FORWARD (SID_SFX_START + 1300)
+#define SID_BROWSE_BACKWARD (SID_SFX_START + 1301)
+#define SID_CREATELINK (SID_SFX_START + 1309)
+#define SID_BOOKMARK_TITLE (SID_SFX_START + 1310)
+#define SID_BOOKMARK_URL (SID_SFX_START + 1311)
+#define SID_EDITDOC (SID_SFX_START + 1312)
+#define SID_BROWSER_MODE (SID_SFX_START + 1313)
+#define SID_PLUGINS_ACTIVE (SID_SFX_START + 1314)
+#define SID_BROWSER (SID_SFX_START + 1318)
+#define SID_MACROEXECMODE (SID_SFX_START + 1319)
+
+#define SID_FILTER_DATA (SID_SFX_START + 1375)
+
+#define SID_EXPLORER_FILEPROPS_START (SID_SFX_START + 1390)
+// SID_EXPLORER_FILEPROPS_END (SID_SFX_START + 1399)
+
+#define ID_FILETP_START SID_EXPLORER_FILEPROPS_START
+#define ID_FILETP_READONLY (ID_FILETP_START + 0)
+#define ID_FILETP_TITLE (ID_FILETP_START + 1)
+
+#define SID_ATTR_ZOOM (SID_SVX_START + 0)
+
+#define SID_EXPLORER_PROPS_START (SID_SFX_START + 1410)
+// SID_EXPLORER_PROPS_END (SID_SFX_START + 1499)
+
+#define SID_AUTOLOAD (SID_SFX_START + 1509)
+#define SID_FILLFRAME (SID_SFX_START + 1516)
+#define SID_BASEURL (SID_SFX_START + 1518)
+#define SID_TEMPLATE (SID_SFX_START + 1519)
+
+#define SID_CONTENTTYPE (SID_SFX_START + 1541)
+
+#define SID_SAVETO (SID_SFX_START + 1546)
+
+#define SID_CREATE_BASICOBJECT (SID_SFX_START + 1555)
+#define SID_DELETE_BASICOBJECT (SID_SFX_START + 1556)
+
+#define SID_UPDATE_VERSION (SID_SFX_START + 1568)
+#define SID_BUILD_VERSION (SID_SFX_START + 1569)
+
+#define SID_VERSION (SID_SFX_START + 1583)
+
+#define SID_DOCUMENT_COMPARE (SID_SFX_START + 1586)
+#define SID_DOCUMENT_MERGE (SID_SFX_START + 1587)
+
+#define SID_OFFICE_CUSTOMERNUMBER (SID_SFX_START + 1608)
+#define SID_OFFICE_CHECK_PLZ (SID_SFX_START + 1610)
+#define SID_CURRENT_URL (SID_SFX_START + 1613)
+
+#define SID_TIPWINDOW (SID_SFX_START + 1632)
+#define SID_CHARSET (SID_SFX_START + 1633)
+#define SID_OVERWRITE (SID_SFX_START + 1634)
+#define SID_RENAME (SID_SFX_START + 1653)
+#define SID_PARTWIN (SID_SFX_START + 1640)
+#define SID_CRASH (SID_SFX_START + 1645)
+#define SID_FAIL_ON_WARNING (SID_SFX_START + 1646)
+#define SID_INPUTSTREAM (SID_SFX_START + 1648)
+#define SID_LOGOUT (SID_SFX_START + 1652)
+#define SID_JUMPMARK (SID_SFX_START + 1654)
+#define SID_BROWSE (SID_SFX_START + 1658)
+ // FREE (was: SID_BACKTOWEBTOP)
+#define SID_SEGMENTSIZE (SID_SFX_START + 1659)
+#define SID_VIEW_DATA_SOURCE_BROWSER (SID_SFX_START + 1660)
+#define SID_TOGGLE_MENUBAR (SID_SFX_START + 1661)
+#define SID_UNPACK (SID_SFX_START + 1662)
+// (SID_SFX_START + 1663) used further down
+#define SID_MACRO_WARNING (SID_SFX_START + 1664)
+#define SID_MACRO_CONFIRMATION (SID_SFX_START + 1665)
+#define SID_OUTPUTSTREAM (SID_SFX_START + 1666)
+#define SID_IMAGE_ORIENTATION (SID_SFX_START + 1667)
+
+#define SID_SAVE_VERSION_ON_CLOSE (SID_SFX_START + 1670)
+#define SID_STOP_RECORDING (SID_SFX_START + 1671)
+#define SID_INTERACTIONHANDLER (SID_SFX_START + 1675)
+#define SID_OPENHYPERLINK (SID_SFX_START + 1676)
+#define SID_ADDONLIST (SID_SFX_START + 1677)
+#define SID_ADDONS (SID_SFX_START + 1678)
+#define SID_CONTENT (SID_SFX_START + 1679)
+#define SID_SHOW_IME_STATUS_WINDOW (SID_SFX_START + 1680)
+#define SID_UPDATE_CONFIG (SID_SFX_START + 1681)
+#define SID_VIEWONLY (SID_SFX_START + 1682)
+#define SID_REPAIRPACKAGE (SID_SFX_START + 1683)
+#define SID_ADDONHELP (SID_SFX_START + 1684)
+#define SID_MINIMIZED (SID_SFX_START + 1687)
+#define SID_COMPONENTDATA (SID_SFX_START + 1688)
+#define SID_COMPONENTCONTEXT (SID_SFX_START + 1689)
+#define SID_SCRIPTORGANIZER (SID_SFX_START + 1690)
+#define SID_MACROORGANIZER (SID_SFX_START + 1691)
+#define SID_RUNMACRO (SID_SFX_START + 1692)
+#define SID_AVMEDIA_TOOLBOX (SID_SFX_START + 1693)
+#define SID_AVMEDIA_PLAYER (SID_SFX_START + 1694)
+#define SID_INSERT_AVMEDIA (SID_SFX_START + 1696)
+#define SID_RECENTFILELIST (SID_SFX_START + 1697)
+#define SID_AVAILABLE_TOOLBARS (SID_SFX_START + 1698)
+#define SID_STREAM (SID_SFX_START + 1699)
+#define SID_DOC_BASEURL (SID_SFX_START + 1700)
+#define SID_DOC_HIERARCHICALNAME (SID_SFX_START + 1701)
+#define SID_TERMINATE_INPLACEACTIVATION (SID_SFX_START + 1702)
+#define SID_APPLY_STYLE (SID_SFX_START + 1703)
+#define SID_MACRO_SIGNATURE (SID_SFX_START + 1704)
+#define SID_ATTR_WARNALIENFORMAT (SID_SFX_START + 1705)
+#define SID_COPY_STREAM_IF_POSSIBLE (SID_SFX_START + 1706)
+#define SID_MAIL_SENDDOCASFORMAT (SID_SFX_START + 1707)
+#define SID_MAIL_SENDDOCASMS (SID_SFX_START + 1708)
+#define SID_MAIL_SENDDOCASOOO (SID_SFX_START + 1709)
+#define SID_NOAUTOSAVE (SID_SFX_START + 1711)
+#define SID_PRINT_SELECTEDSHEET (SID_SFX_START + 1712)
+#define SID_OPTIONS_PAGEURL (SID_SFX_START + 1713)
+#define SID_MORE_DICTIONARIES (SID_SFX_START + 1714)
+#define SID_ACTIVATE_STYLE_APPLY (SID_SFX_START + 1715)
+#define SID_FONT_NAME (SID_SFX_START + 1716)
+#define SID_DEFAULTFILENAME (SID_SFX_START + 1717)
+#define SID_MODIFYPASSWORDINFO (SID_SFX_START + 1718)
+#define SID_RECOMMENDREADONLY (SID_SFX_START + 1719)
+#define SID_SUGGESTEDSAVEASDIR (SID_SFX_START + 1720)
+#define SID_SUGGESTEDSAVEASNAME (SID_SFX_START + 1721)
+#define SID_ENCRYPTIONDATA (SID_SFX_START + 1722)
+#define SID_PASSWORDINTERACTION (SID_SFX_START + 1723)
+#define SID_GOTOLINE (SID_SFX_START + 1724)
+#define SID_SHOWLINES (SID_SFX_START + 1725)
+#define SID_BLUETOOTH_SENDDOC (SID_SFX_START + 1726)
+#define SID_TEMPLATE_MANAGER (SID_SFX_START + 1727)
+
+// SID_SFX_free_START (SID_SFX_START + 1728)
+// SID_SFX_free_END (SID_SFX_START + 3999)
+
+#define SID_OPEN_NEW_VIEW (SID_SFX_START + 520)
+ // FREE, was SID_VIEW_ZOOM_MODE
+ // FREE, was SID_VIEW_POS_SIZE
+#define SID_VIEW_ID (SID_SFX_START + 523)
+ // FREE, was SID_USER_DATA
+#define SID_VIEW_DATA (SID_SFX_START + 1582)
+#define SID_SILENT (SID_SFX_START + 528)
+#define SID_HIDDEN (SID_SFX_START + 534)
+#define SID_PREVIEW (SID_SFX_START + 1404)
+
+#define SID_FOCUSURLBOX (SID_SFX_START + 1406)
+
+#define SID_ACTIVATE (SID_SFX_START + 525)
+#define SID_PRINTOUT (SID_SFX_START + 526)
+
+#define SID_FILE_LONGNAME (SID_SFX_START + 529)
+#define SID_FILTER_NAME (SID_SFX_START + 530)
+#define SID_DOC_SALVAGE (SID_SFX_START + 531)
+#define SID_INSERTDOC (SID_SFX_START + 532)
+#define SID_TYPE_NAME (SID_SFX_START + 533)
+
+#define SID_DOC_READONLY (SID_SFX_START + 590)
+#define SID_DOC_MODIFIED (SID_SFX_START + 584)
+#define SID_DOC_LOADING (SID_SFX_START + 585)
+#define SID_IMG_LOADING (SID_SFX_START + 586)
+#define SID_DOC_SAVED (SID_SFX_START + 599)
+#define SID_DOCINFO (SID_SFX_START + 535)
+#define SID_DOCINFO_KEYWORDS (SID_SFX_START + 591)
+#define SID_DOCINFO_COMMENTS (SID_SFX_START + 592)
+#define SID_DOCINFO_AUTHOR (SID_SFX_START + 593)
+#define SID_DOCINFO_MAJOR (SID_SFX_START + 594)
+#define SID_NEWDOCDIRECT (SID_SFX_START + 537)
+#define SID_DOCFRAME (SID_SFX_START + 598)
+#define SID_TARGETNAME (SID_SFX_START + 560)
+#define SID_ORIGURL (SID_SFX_START + 644)
+#define SID_POSTDATA (SID_SFX_START + 1536)
+#define SID_DONELINK (SID_SFX_START + 646)
+#define SID_REFERER (SID_SFX_START + 654)
+#define SID_MODIFIER (SID_SFX_START + 669)
+#define SID_SETOPTIONS (SID_SFX_START + 670)
+#define SID_SOURCEVIEW (SID_SFX_START + 675)
+#define SID_DOC_STARTPRESENTATION (SID_SFX_START + 695)
+#define SID_DDE_RECONNECT_ONLOAD (SID_SFX_START + 696)
+
+#define SID_NEWWINDOWFOREDIT (SID_SFX_START + 667)
+
+#define SID_DOCTEMPLATE (SID_SFX_START + 538)
+#define SID_AUTOPILOTMENU (SID_SFX_START + 1381)
+
+// Floating Window Template
+#define SID_STYLE_DESIGNER (SID_SFX_START + 539)
+
+#define SID_TEMPLATE_ADDRESSBOKSOURCE (SID_SFX_START + 1655)
+
+// Ruby dialog
+#define SID_RUBY_DIALOG (SID_SFX_START + 1656)
+
+#define SID_STYLE_FAMILY_START (SID_SFX_START + 541)
+#define SID_STYLE_FAMILY1 (SID_STYLE_FAMILY_START)
+#define SID_STYLE_FAMILY2 (SID_STYLE_FAMILY_START + 1)
+#define SID_STYLE_FAMILY3 (SID_STYLE_FAMILY_START + 2)
+#define SID_STYLE_FAMILY4 (SID_STYLE_FAMILY_START + 3)
+#define SID_STYLE_FAMILY5 (SID_STYLE_FAMILY_START + 4)
+
+#define SID_STYLE_NEW (SID_SFX_START + 549)
+#define SID_STYLE_EDIT (SID_SFX_START + 550)
+#define SID_STYLE_DELETE (SID_SFX_START + 551)
+#define SID_STYLE_APPLY (SID_SFX_START + 552)
+#define SID_STYLE_FAMILY (SID_SFX_START + 553)
+#define SID_STYLE_FAMILYNAME (SID_SFX_START + 566)
+#define SID_STYLE_WATERCAN (SID_SFX_START + 554)
+#define SID_STYLE_NEW_BY_EXAMPLE (SID_SFX_START + 555)
+#define SID_STYLE_UPDATE_BY_EXAMPLE (SID_SFX_START + 556)
+#define SID_STYLE_DRAGHIERARCHIE (SID_SFX_START + 565)
+#define SID_STYLE_MASK (SID_SFX_START + 562)
+#define SID_STYLE_HIDE (SID_SFX_START + 1603)
+#define SID_STYLE_SHOW (SID_SFX_START + 1604)
+#define SID_STYLE_UPD_BY_EX_NAME (SID_SFX_START + 1585)
+#define SID_STYLE_REFERENCE (SID_SFX_START + 1602)
+
+#define SID_TEMPLATE_NAME (SID_SFX_START + 660)
+#define SID_TEMPLATE_REGION (SID_SFX_START + 661)
+#define SID_TEMPLATE_REGIONNAME (SID_SFX_START + 662)
+#define SID_TEMPLATE_LOAD (SID_SFX_START + 663)
+
+#define SID_INSERT_OBJECT (SID_SFX_START + 561)
+#define SID_INSERT_FLOATINGFRAME (SID_SFX_START + 563)
+#define SID_INSERT_PLUGIN (SID_SFX_START + 672)
+#define SID_INSERT_SOUND (SID_SFX_START + 676)
+#define SID_INSERT_VIDEO (SID_SFX_START + 677)
+
+#define SID_HYPERLINK_DIALOG (SID_SFX_START + 678)
+
+#define SID_ACTIVEDOCUMENT (SID_SFX_START + 570)
+#define SID_DEFAULTFILEPATH (SID_SFX_START + 571)
+#define SID_OBJECT (SID_SFX_START + 575)
+
+// Doc-Properties
+#define SID_DOCFULLNAME (SID_SFX_START + 581)
+#define SID_DOCPATH (SID_SFX_START + 582)
+#define SID_DOCTITLE (SID_SFX_START + 583)
+
+#define SID_DOCUMENT (SID_SFX_START + 588)
+
+// default-ids for windows
+
+#define SID_CLOSEWINS (SID_SFX_START + 605)
+#define SID_MDIWINDOWLIST (SID_SFX_START + 610)
+#define SID_NEWWINDOW (SID_SFX_START + 620)
+#define SID_CLOSEWIN (SID_SFX_START + 621)
+#define SID_VIEWSHELL (SID_SFX_START + 623)
+#define SID_WIN_FULLSCREEN (SID_SFX_START + 627)
+ // FREE, was SID_WIN_POSSIZE
+#define SID_WIN_VISIBLE (SID_SFX_START + 629)
+
+#define SID_VIEWSHELL0 (SID_SFX_START + 630)
+#define SID_VIEWSHELL1 (SID_SFX_START + 631)
+#define SID_VIEWSHELL2 (SID_SFX_START + 632)
+#define SID_VIEWSHELL3 (SID_SFX_START + 633)
+#define SID_VIEWSHELL4 (SID_SFX_START + 634)
+
+#define SID_CAPTION (SID_SFX_START + 641)
+
+// id for thesaurs entry in context menu
+#define SID_THES (SID_SFX_START + 698)
+
+// default-ids for editing, cursor travellung and selection
+#define SID_REDO (SID_SFX_START + 700)
+#define SID_UNDO (SID_SFX_START + 701)
+#define SID_REPEAT (SID_SFX_START + 702)
+#define SID_CLEARHISTORY (SID_SFX_START + 703)
+#define SID_CUT (SID_SFX_START + 710)
+#define SID_COPY (SID_SFX_START + 711)
+#define SID_PASTE (SID_SFX_START + 712)
+
+#define SID_BACKSPACE (SID_SFX_START + 714)
+#define SID_FORMATPAINTBRUSH (SID_SFX_START + 715)
+#define SID_SELECT (SID_SFX_START + 720)
+#define SID_SELECTALL (SID_SFX_START + 723)
+#define SID_CURSORDOWN (SID_SFX_START + 731)
+#define SID_CURSORUP (SID_SFX_START + 732)
+#define SID_CURSORLEFT (SID_SFX_START + 733)
+#define SID_CURSORRIGHT (SID_SFX_START + 734)
+#define SID_CURSORPAGEDOWN (SID_SFX_START + 735)
+#define SID_CURSORPAGEUP (SID_SFX_START + 736)
+#define SID_CURSORPAGERIGHT (SID_SFX_START + 737)
+#define SID_CURSORPAGELEFT (SID_SFX_START + 738)
+#define SID_CURSORENDOFFILE (SID_SFX_START + 741)
+#define SID_CURSORTOPOFFILE (SID_SFX_START + 742)
+#define SID_CURSORENDOFSCREEN (SID_SFX_START + 743)
+#define SID_CURSORTOPOFSCREEN (SID_SFX_START + 744)
+#define SID_CURSORHOME (SID_SFX_START + 745)
+#define SID_CURSOREND (SID_SFX_START + 746)
+#define SID_FORMATMENU (SID_SFX_START + 780)
+#define SID_OBJECTMENU0 SID_FORMATMENU
+#define SID_OBJECTMENU3 (SID_SFX_START + 783)
+#define SID_OBJECTMENU_LAST SID_OBJECTMENU3
+#define SID_FORMATMENUSTATE (SID_SFX_START + 791)
+
+// default-ids for macros
+#define SID_RECORDING_FLOATWINDOW (SID_SFX_START + 800)
+#define SID_RECORDMACRO (SID_SFX_START + 1669)
+#define SID_PASTE_ONLY (SID_SFX_START + 801)
+#define SID_PASTE_ONLY_TEXT (SID_SFX_START + 802)
+#define SID_PASTE_ONLY_FORMULA (SID_SFX_START + 803)
+#define SID_PASTE_ONLY_VALUE (SID_SFX_START + 804)
+ // FREE: SID_SFX_START + 805
+ // FREE: SID_SFX_START + 806
+ // FREE: SID_SFX_START + 807
+ // FREE: SID_SFX_START + 808
+ // FREE: SID_SFX_START + 809
+ // FREE: SID_SFX_START + 810
+#define SID_ASYNCHRON (SID_SFX_START + 811)
+
+// default-ids for configuration
+#define SID_CONFIG (SID_SFX_START + 904)
+#define SID_TOGGLECOMMONTASKBAR (SID_SFX_START + 928)
+#define SID_TOOLBOXOPTIONS (SID_SFX_START + 907)
+#define SID_TOGGLEFUNCTIONBAR (SID_SFX_START + 910)
+#define SID_CONFIGITEMID (SID_SFX_START + 919)
+#define SID_MACROINFO (SID_SFX_START + 919)
+#define SID_TOGGLESTATUSBAR (SID_SFX_START + 920)
+#define SID_CONFIGSTATUSBAR (SID_SFX_START + 921)
+#define SID_CONFIGMENU (SID_SFX_START + 924)
+#define SID_CONFIGACCEL (SID_SFX_START + 925)
+#define SID_CONFIGEVENT (SID_SFX_START + 926)
+#define SID_CFGFILE (SID_SFX_START + 927)
+#define SID_SHOWPOPUPS (SID_SFX_START + 929)
+#define SID_TASKBAR (SID_SFX_START + 931)
+#define SID_AUTOHIDE (SID_SFX_START + 932)
+
+// Item-Id for the assinged event Tabpage
+#define SID_ATTR_MACROITEM (SID_SFX_START + 934)
+
+#define SID_SAVECONFIG (SID_SFX_START + 930)
+#define SID_LOADCONFIG (SID_SFX_START + 933)
+#define SID_OPTIONS (SID_SFX_START + 940)
+#define SID_BASICLOAD (SID_SFX_START + 951)
+#define SID_BASICSAVEAS (SID_SFX_START + 953)
+#define SID_BASICCOMPILE (SID_SFX_START + 954)
+#define SID_BASICRUN (SID_SFX_START + 955)
+#define SID_BASICSTEPINTO (SID_SFX_START + 956)
+#define SID_BASICSTEPOVER (SID_SFX_START + 957)
+#define SID_BASICSTEPOUT (SID_SFX_START + 963)
+#define SID_BASICSTOP (SID_SFX_START + 958)
+#define SID_BASICCHOOSER (SID_SFX_START + 959)
+#define SID_GALLERY (SID_SFX_START + 960)
+#define SID_SEARCH_DLG (SID_SFX_START + 961)
+#define SID_SEARCH_QUIET (SID_SFX_START + 1684)
+#define SID_HELP_PI (SID_SFX_START + 962)
+#define SID_BASIC_ENABLED (SID_SFX_START + 964)
+#define SID_EXPORT_DIALOG (SID_SFX_START + 965)
+#define SID_IMPORT_DIALOG (SID_SFX_START + 966)
+
+#define SID_BASICBREAK (SID_SFX_START +1521)
+
+#define SID_OBJECTRESIZE (SID_SFX_START + 1000)
+
+#define SID_EVENTCONFIG (SID_SFX_START + 1101)
+#define SID_VERB_START (SID_SFX_START + 1100)
+#define SID_VERB_END (SID_SFX_START + 1121)
+
+#define SID_SIGNATURE (SID_SFX_START + 1643)
+
+#define SID_FRAMEDESCRIPTOR (SID_SFX_START + 1229)
+
+// SaveTabPage
+#define SID_ATTR_DOCINFO (SID_OPTIONS_START + 0)
+#define SID_ATTR_BACKUP (SID_OPTIONS_START + 1)
+#define SID_ATTR_AUTOSAVE (SID_OPTIONS_START + 2)
+#define SID_ATTR_AUTOSAVEPROMPT (SID_OPTIONS_START + 3)
+#define SID_ATTR_USERAUTOSAVE (SID_OPTIONS_START + 4)
+#define SID_ATTR_AUTOSAVEMINUTE (SID_OPTIONS_START + 5)
+#define SID_ATTR_WORKINGSET (SID_OPTIONS_START + 13)
+#define SID_ATTR_UNDO_COUNT (SID_OPTIONS_START + 16)
+ // unused
+#define SID_ATTR_SAVEDOCVIEW (SID_OPTIONS_START + 18)
+
+// GeneralTabPage
+
+#define SID_ATTR_METRIC (SID_OPTIONS_START + 8)
+#define SID_ATTR_DEFTABSTOP (SID_OPTIONS_START + 14)
+#define SID_ATTR_BUTTON_OUTSTYLE3D (SID_OPTIONS_START + 62)
+#define SID_ATTR_BUTTON_BIGSIZE (SID_OPTIONS_START + 63)
+#define SID_ATTR_AUTOHELPAGENT (SID_OPTIONS_START + 67)
+#define SID_HELPAGENT_TIMEOUT (SID_OPTIONS_START + 93)
+#define SID_ATTR_WELCOMESCREEN (SID_OPTIONS_START + 81)
+#define SID_WELCOMESCREEN_RESET (SID_OPTIONS_START + 82)
+#define SID_ATTR_QUICKLAUNCHER (SID_OPTIONS_START + 74)
+#define SID_ATTR_YEAR2000 (SID_OPTIONS_START + 87)
+#define SID_ATTR_APPLYCHARUNIT (SID_OPTIONS_START + 88)
+
+
+// PathTabPage
+#define SID_ATTR_PATHGROUP (SID_OPTIONS_START + 10)
+#define SID_ATTR_PATHNAME (SID_OPTIONS_START + 11)
+
+// LinguTabPage
+#define SID_ATTR_LANGUAGE (SID_OPTIONS_START + 7)
+#define SID_ATTR_SPELL (SID_OPTIONS_START + 9)
+#define SID_ATTR_HYPHENREGION (SID_OPTIONS_START + 12)
+#define SID_SPELL_MODIFIED (SID_OPTIONS_START + 15)
+#define SID_AUTOSPELL_CHECK (SID_OPTIONS_START + 21)
+
+// InetTabPage
+
+#define SID_INET_PROXY_TYPE (SID_OPTIONS_START + 23)
+#define SID_INET_PROXY_PORT (SID_OPTIONS_START + 25)
+
+#define SID_INET_SMTPSERVER (SID_OPTIONS_START + 33)
+#define SID_PASSWORD (SID_OPTIONS_START + 36)
+
+#define SID_INET_NOPROXY (SID_OPTIONS_START + 37)
+
+#define SID_INET_HTTP_PROXY_NAME (SID_OPTIONS_START + 38)
+#define SID_INET_HTTP_PROXY_PORT (SID_OPTIONS_START + 39)
+#define SID_INET_FTP_PROXY_NAME (SID_OPTIONS_START + 40)
+#define SID_INET_FTP_PROXY_PORT (SID_OPTIONS_START + 41)
+#define SID_INET_SOCKS_PROXY_PORT (SID_OPTIONS_START + 43)
+
+#define SID_INET_EXE_PLUGIN (SID_OPTIONS_START + 52)
+
+#define SID_INET_DNS_AUTO (SID_OPTIONS_START + 57)
+#define SID_INET_DNS_SERVER (SID_OPTIONS_START + 58)
+
+#define SID_SAVEREL_INET (SID_OPTIONS_START + 30)
+#define SID_SAVEREL_FSYS (SID_OPTIONS_START + 31)
+
+// Automatic update of Styles - manage TabPage
+#define SID_ATTR_AUTO_STYLE_UPDATE (SID_OPTIONS_START + 65)
+
+#define SID_SECURE_URL (SID_OPTIONS_START + 66)
+
+// configured locale changed
+#define SID_OPT_LOCALE_CHANGED (SID_OPTIONS_START + 94)
+//middle mouse button
+#define SID_ATTR_PRETTYPRINTING (SID_OPTIONS_START + 98)
+#define SID_HELP_STYLESHEET (SID_OPTIONS_START + 99)
+
+// slot IDs from SVX (svxids.hrc) ---------------------------------------------
+
+#define SID_ZOOM_TOOLBOX (SID_SVX_START + 96)
+#define SID_ZOOM_OUT (SID_SVX_START + 97)
+#define SID_ZOOM_IN (SID_SVX_START + 98)
+#define SID_SIZE_REAL (SID_SVX_START + 99)
+#define SID_SIZE_PAGE (SID_SVX_START + 100)
+#define SID_SHOW_BROWSER (SID_SVX_START + 163)
+#define SID_GALLERY_BG_BRUSH (SID_SVX_START + 279)
+#define SID_SEARCH_OPTIONS (SID_SVX_START + 281)
+#define SID_ZOOM (SID_SVX_START + 289)
+#define SID_SEARCH_ITEM (SID_SVX_START + 291)
+#define SID_HYPERLINK_GETLINK (SID_SVX_START + 361)
+#define SID_HYPERLINK_SETLINK (SID_SVX_START + 362)
+#define SID_INFOBARCONTAINER (SID_SVX_START + 365)
+#define SID_NAVIGATOR (SID_SVX_START + 366)
+#define SID_TASKPANE (SID_SVX_START + 370)
+#define SID_ZOOM_NEXT (SID_SVX_START + 402)
+#define SID_ZOOM_PREV (SID_SVX_START + 403)
+#define SID_INET_DLG (SID_SVX_START + 416)
+#define SID_AUTO_CORRECT_DLG (SID_SVX_START + 424)
+#define SID_SD_AUTOPILOT (SID_SVX_START + 425)
+#define SID_ATTR_CHAR_COLOR_EXT (SID_SVX_START + 488)
+#define SID_ATTR_CHAR_COLOR_BACKGROUND (SID_SVX_START + 489)
+#define SID_ATTR_CHAR_COLOR_BACKGROUND_EXT (SID_SVX_START + 490)
+#define SID_ATTR_CHAR_COLOR2 (SID_SVX_START + 537)
+#define SID_COMP_BIBLIOGRAPHY (SID_SVX_START + 880)
+#define SID_ADDRESS_DATA_SOURCE (SID_SVX_START + 934)
+
+#define FID_SVX_START (SID_LIB_START + 500)
+#define FID_SEARCH_NOW (FID_SVX_START + 2)
+
+// SlotIds for Basic -------------------------------------------------------
+#define SID_BASICIDE_TOGGLEBRKPNT ( SID_BASICIDE_START + 0 )
+#define SID_BASICIDE_ADDWATCH ( SID_BASICIDE_START + 1 )
+#define SID_BASICIDE_APPEAR ( SID_BASICIDE_START + 15 )
+#define SID_BASICIDE_BRKPNTSCHANGED ( SID_BASICIDE_START + 36 )
+#define SID_BASICIDE_CHOOSEMACRO ( SID_BASICIDE_START + 2 )
+#define SID_BASICIDE_CREATEMACRO ( SID_BASICIDE_START + 4 )
+#define SID_BASICIDE_DELETECURRENT ( SID_BASICIDE_START + 22 )
+#define SID_BASICIDE_EDITMACRO ( SID_BASICIDE_START + 3 )
+#define SID_BASICIDE_HIDECURPAGE ( SID_BASICIDE_START + 10 )
+#define SID_BASICIDE_LIBLOADED ( SID_BASICIDE_START + 27 )
+#define SID_BASICIDE_LIBSELECTOR ( SID_BASICIDE_START + 19 )
+#define SID_BASICIDE_LIBSELECTED ( SID_BASICIDE_START + 18 )
+#define SID_BASICIDE_LIBREMOVED ( SID_BASICIDE_START + 28 )
+#define SID_BASICIDE_ARG_LIBNAME ( SID_BASICIDE_START + 34 )
+#define SID_BASICIDE_MATCHGROUP ( SID_BASICIDE_START + 14 )
+#define SID_BASICIDE_MODULEDLG ( SID_BASICIDE_START + 5 )
+#define SID_BASICIDE_NAMECHANGEDONTAB ( SID_BASICIDE_START + 11 )
+#define SID_BASICIDE_ARG_TABID ( SID_BASICIDE_START + 30 )
+#define SID_BASICIDE_ARG_MACROINFO ( SID_BASICIDE_START + 32 )
+#define SID_BASICIDE_ARG_MODULENAME ( SID_BASICIDE_START + 35 )
+#define SID_BASICIDE_ARG_SBX ( SID_BASICIDE_START + 31 )
+#define SID_BASICIDE_NEWMODULE ( SID_BASICIDE_START + 21 )
+#define SID_BASICIDE_NEWDIALOG ( SID_BASICIDE_START + 20 )
+#define SID_BASICIDE_OBJCAT ( SID_BASICIDE_START + 6 )
+#define SID_BASICIDE_REMOVEWATCH ( SID_BASICIDE_START + 7 )
+#define SID_BASICIDE_RENAMECURRENT ( SID_BASICIDE_START + 23 )
+#define SID_BASICIDE_SBXDELETED ( SID_BASICIDE_START + 24 )
+#define SID_BASICIDE_SBXINSERTED ( SID_BASICIDE_START + 25 )
+#define SID_BASICIDE_SBXRENAMED ( SID_BASICIDE_START + 26 )
+#define SID_BASICIDE_SHOWSBX ( SID_BASICIDE_START + 9 )
+#define SID_BASICIDE_STAT_POS ( SID_BASICIDE_START + 38 )
+#define SID_BASICIDE_STAT_DATE ( SID_BASICIDE_START + 39 )
+#define SID_BASICIDE_STAT_TITLE ( SID_BASICIDE_START + 40 )
+#define SID_BASICIDE_STOREMODULESOURCE ( SID_BASICIDE_START + 13 )
+#define SID_BASICIDE_STOREALLMODULESOURCES ( SID_BASICIDE_START + 16 )
+#define SID_BASICIDE_UPDATEALLMODULESOURCES ( SID_BASICIDE_START + 17 )
+#define SID_BASICIDE_UPDATEMODULESOURCE ( SID_BASICIDE_START + 12 )
+#define SID_BASICIDE_MANAGEBRKPNTS ( SID_BASICIDE_START + 42 )
+#define SID_BASICIDE_TOGGLEBRKPNTENABLED ( SID_BASICIDE_START + 43 )
+#define SID_BASICIDE_SHOWWINDOW ( SID_BASICIDE_START + 44 )
+#define SID_BASICIDE_ARG_DOCUMENT ( SID_BASICIDE_START + 45 )
+#define SID_BASICIDE_ARG_NAME ( SID_BASICIDE_START + 46 )
+#define SID_BASICIDE_ARG_TYPE ( SID_BASICIDE_START + 47 )
+#define SID_BASICIDE_ARG_LINE ( SID_BASICIDE_START + 48 )
+#define SID_BASICIDE_ARG_COLUMN1 ( SID_BASICIDE_START + 49 )
+#define SID_BASICIDE_ARG_COLUMN2 ( SID_BASICIDE_START + 50 )
+#define SID_BASICIDE_ARG_DOCUMENT_MODEL ( SID_BASICIDE_START + 51 )
+#define SID_BASICIDE_MANAGE_LANG ( SID_BASICIDE_START + 52 )
+#define SID_BASICIDE_CURRENT_LANG ( SID_BASICIDE_START + 53 )
+
+// SlotIds for Apps --------------------------------------------------------
+#define FN_PARAM (SID_SW_START + 1100)
+#define FN_PARAM_1 (FN_PARAM+60)
+#define FN_PARAM_2 (FN_PARAM+61)
+#define FN_PARAM_3 (FN_PARAM+62)
+#define FN_PARAM_4 (FN_PARAM+63)
+#define FN_PARAM_5 (FN_PARAM+64)
+#define FN_PARAM_6 (FN_PARAM+65)
+#define FN_FAX (SID_SW_START + 28) /* Fax */
+
+#define SID_KEYFUNC_START (SID_SC_START + 521)
+#define SID_CURSORDOWN_SEL (SID_KEYFUNC_START + 0)
+#define SID_CURSORUP_SEL (SID_KEYFUNC_START + 1)
+#define SID_CURSORLEFT_SEL (SID_KEYFUNC_START + 2)
+#define SID_CURSORRIGHT_SEL (SID_KEYFUNC_START + 3)
+#define SID_CURSORPAGEDOWN_SEL (SID_KEYFUNC_START + 4)
+#define SID_CURSORPAGEUP_SEL (SID_KEYFUNC_START + 5)
+#define SID_CURSORPAGELEFT_SEL (SID_KEYFUNC_START + 7)
+#define SID_CURSORPAGERIGHT_SEL (SID_KEYFUNC_START + 9)
+#define SID_CURSORTOPOFFILE_SEL (SID_KEYFUNC_START + 10)
+#define SID_CURSORENDOFFILE_SEL (SID_KEYFUNC_START + 11)
+#define SID_CURSORHOME_SEL (SID_KEYFUNC_START + 12)
+#define SID_CURSOREND_SEL (SID_KEYFUNC_START + 13)
+#define SID_REPAINT (SID_SC_START + 12)
+
+#define SID_MODIFIED (SID_SD_START+89)
+#define ID_VAL_DUMMY0 (SID_SD_START+230)
+#define ID_VAL_ZOOM (SID_SD_START+234)
+#define SID_SIZE_OPTIMAL (SID_SD_START+99)
+
+//-----------------------------------------------------------------------
+
+#define SID_ZOOM_OPTIMAL (SID_SIZE_OPTIMAL)
+#define SID_ZOOM_ENTIRE_PAGE (SID_SIZE_PAGE)
+#define SID_ZOOM_PAGE_WIDTH (SID_SVX_START + 1420)
+#define SID_ZOOM_50_PERCENT (SID_SVX_START + 1421)
+#define SID_ZOOM_75_PERCENT (SID_SVX_START + 1422)
+#define SID_ZOOM_100_PERCENT (SID_SIZE_REAL)
+#define SID_ZOOM_150_PERCENT (SID_SVX_START + 1423)
+#define SID_ZOOM_200_PERCENT (SID_SVX_START + 1424)
+
+//-----------------------------------------------------------------------
+
+// SfxScriptOrganizerItem
+#define MID_SCRIPT_ORGANIZER_LANGUAGE 1 // Don't use zero for MID's. It's forbidden to do it!
+
+#define SID_NEWSD (SID_SFX_START + 1686)
+#define FN_LABEL (SID_SW_START + 1051 )
+#define FN_BUSINESS_CARD (SID_SW_START + 1052)
+#define FN_XFORMS_INIT (SID_SW_START + 1053)
+#define SID_OPTIONS_TREEDIALOG ( SID_BASICIDE_START + 862)
+
+
+#define SID_RESTORE_EDITING_VIEW (SID_SFX_START + 1663)
+
+#endif // #ifndef _SFXSIDS_HRC
+
+//-----------------------------------------------------------------------
+// SfxSecurityPage related stuff
+
+#define FN_EDIT2 (SID_SW_START + 1800)
+#define FN_REDLINE_PROTECT (FN_EDIT2 + 23)
+#define FN_REDLINE_ON (FN_EDIT2 + 25)
+
+#define SID_HTML_MODE (SID_SVX_START + 414)
+
+// Calc-Id's used for SfxSecurityPage
+#ifndef SC_FUNCTION_START
+#define SC_FUNCTION_START (SID_SC_START + 200)
+#endif
+#ifndef FILE_MENU_END
+#define FILE_MENU_END (SC_FUNCTION_START + 20)
+#endif
+#ifndef EDIT_MENU_START
+#define EDIT_MENU_START (FILE_MENU_END)
+#endif
+#ifndef SC_VIEW_START
+#define SC_VIEW_START (SID_SC_START)
+#endif
+#define FID_CHG_RECORD (EDIT_MENU_START + 18)
+#define SID_CHG_PROTECT (SC_VIEW_START + 84)
+
+// eof ------------------------------------------------------------------------
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sfxstatuslistener.hxx b/include/sfx2/sfxstatuslistener.hxx
new file mode 100644
index 000000000000..9e6be020db10
--- /dev/null
+++ b/include/sfx2/sfxstatuslistener.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SFXSTATUSLISTENER_HXX
+#define _SFXSTATUSLISTENER_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include <svl/poolitem.hxx>
+#include <cppuhelper/weak.hxx>
+#include <osl/conditn.hxx>
+#include <com/sun/star/frame/FeatureStateEvent.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/frame/XStatusListener.hpp>
+
+#include <sfx2/sfxuno.hxx>
+
+// Interface for implementations which needs to get notifications about state changes
+class SfxStatusListenerInterface
+{
+ public:
+ virtual void StateChanged( sal_uInt16 nSlotId, SfxItemState eState, const SfxPoolItem* pState ) = 0;
+
+ protected:
+ ~SfxStatusListenerInterface() {}
+};
+
+class SFX2_DLLPUBLIC SfxStatusListener :
+ public ::com::sun::star::frame::XStatusListener ,
+ public ::com::sun::star::lang::XTypeProvider ,
+ public ::com::sun::star::lang::XComponent ,
+ public ::cppu::OWeakObject
+{
+ public:
+ SFX_DECL_XINTERFACE_XTYPEPROVIDER
+
+ SfxStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& rDispatchProvider, sal_uInt16 nSlotId, const OUString& aCommand );
+ virtual ~SfxStatusListener();
+
+ // old methods from SfxControllerItem
+ sal_uInt16 GetId() const { return m_nSlotID; }
+ void UnBind();
+ void ReBind();
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+
+ // XComponent
+ virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XStatusListener
+ virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event) throw( ::com::sun::star::uno::RuntimeException );
+
+ private:
+ SfxStatusListener( const SfxStatusListener& );
+ SfxStatusListener();
+ SfxStatusListener& operator=( const SfxStatusListener& );
+
+ sal_uInt16 m_nSlotID;
+ ::com::sun::star::util::URL m_aCommand;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xDispatchProvider;
+ ::com::sun::star::uno::Reference< com::sun::star::frame::XDispatch > m_xDispatch;
+};
+
+#endif // _SFXSTATUSLISTENER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sfxuno.hxx b/include/sfx2/sfxuno.hxx
new file mode 100644
index 000000000000..6b0a2763497e
--- /dev/null
+++ b/include/sfx2/sfxuno.hxx
@@ -0,0 +1,638 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SFX_SFXUNO_HXX
+#define _SFX_SFXUNO_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/util/URL.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/task/ErrorCodeIOException.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+
+#include <com/sun/star/uno/Type.h>
+#include <com/sun/star/uno/Any.h>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <cppuhelper/queryinterface.hxx>
+#include <cppuhelper/factory.hxx>
+
+#include <osl/mutex.hxx>
+#include <rtl/ustring.hxx>
+
+
+inline sal_Bool operator==( const css::util::URL& aURL1, const css::util::URL& aURL2 )
+{
+ return aURL1.Complete == aURL2.Complete;
+}
+
+class SfxAllItemSet ;
+class SfxItemSet ;
+class SfxSlot ;
+
+SFX2_DLLPUBLIC void TransformParameters( sal_uInt16 nSlotId ,
+ const css::uno::Sequence< css::beans::PropertyValue >& seqArgs ,
+ SfxAllItemSet& aSet ,
+ const SfxSlot* pSlot = 0 );
+
+SFX2_DLLPUBLIC void TransformItems( sal_uInt16 nSlotId ,
+ const SfxItemSet& aSet ,
+ css::uno::Sequence< css::beans::PropertyValue >& seqArgs ,
+ const SfxSlot* pSlot = 0 );
+
+bool GetEncryptionData_Impl( const SfxItemSet* pSet, css::uno::Sequence< css::beans::NamedValue >& aEncryptionData );
+
+#define FrameSearchFlags sal_Int32
+
+// Macros to convert string -> unicode and unicode -> string.
+// We use UTF8 everytime. Its the best way to do this!
+#define S2U(STRING) OStringToOUString(STRING, RTL_TEXTENCODING_UTF8)
+#define U2S(STRING) OUStringToOString(STRING, RTL_TEXTENCODING_UTF8)
+
+//________________________________________________________________________________________________________________________
+// macros for declaration and definition of uno-services
+//________________________________________________________________________________________________________________________
+
+//************************************************************************************************************************
+// declaration of XInterface::queryInterface()
+// XInterface::aquire()
+// XInterface::release()
+// XTypeProvider::getTypes()
+// XTypeProvider::getImplementationId()
+//************************************************************************************************************************
+#define SFX_DECL_XINTERFACE \
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw( css::uno::RuntimeException ); \
+ virtual void SAL_CALL acquire() throw(); \
+ virtual void SAL_CALL release() throw();
+
+#define SFX_DECL_XTYPEPROVIDER \
+ /* XTypeProvider */ \
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw( css::uno::RuntimeException ); \
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw( css::uno::RuntimeException );
+
+#define SFX_DECL_XINTERFACE_XTYPEPROVIDER \
+ SFX_DECL_XINTERFACE \
+ SFX_DECL_XTYPEPROVIDER
+
+//************************************************************************************************************************
+// declaration of XInterface::queryInterface()
+// XInterface::aquire()
+// XInterface::release()
+// XTypeProvider::getTypes()
+// XTypeProvider::getImplementationId()
+// XServiceInfo::getImplementationName()
+// XServiceInfo::supportsService()
+// XServiceInfo::getSupportedServiceNames()
+// static xxx::impl_getStaticSupportedServiceNames()
+// static xxx::impl_getStaticImplementationName()
+// static xxx::impl_createInstance()
+//************************************************************************************************************************
+#define SFX_DECL_XSERVICEINFO_NOFACTORY \
+ /* XServiceInfo */ \
+ virtual OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException ); \
+ virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) throw( css::uno::RuntimeException ); \
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException ); \
+ \
+ /* Helper for XServiceInfo */ \
+ static css::uno::Sequence< OUString > impl_getStaticSupportedServiceNames(); \
+ static OUString impl_getStaticImplementationName(); \
+ \
+ /* Helper for registry */ \
+ static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) throw( css::uno::Exception );
+
+//************************************************************************************************************************
+// declaration of XInterface::queryInterface()
+// XInterface::aquire()
+// XInterface::release()
+// XTypeProvider::getTypes()
+// XTypeProvider::getImplementationId()
+// XServiceInfo::getImplementationName()
+// XServiceInfo::supportsService()
+// XServiceInfo::getSupportedServiceNames()
+// static xxx::impl_getStaticSupportedServiceNames()
+// static xxx::impl_getStaticImplementationName()
+// static xxx::impl_createInstance()
+// static xxx::impl_createFactory()
+//************************************************************************************************************************
+#define SFX_DECL_XSERVICEINFO \
+ SFX_DECL_XSERVICEINFO_NOFACTORY \
+ static css::uno::Reference< css::lang::XSingleServiceFactory > impl_createFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager );
+
+#define SFX_DECL_XINTERFACE_XTYPEPROVIDER_XSERVICEINFO \
+ \
+ /* XInterface + XTypeProvider */ \
+ SFX_DECL_XINTERFACE_XTYPEPROVIDER \
+ SFX_DECL_XSERVICEINFO
+
+//************************************************************************************************************************
+// implementation of XInterface::queryInterface()
+// XInterface::aquire()
+// XInterface::release()
+//************************************************************************************************************************
+/*_________________________________________________________________________________________________________________________*/
+// DON'T USE FOLLOW MACROS DIRECTLY!!!
+#define SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, IMPLINTERFACES ) \
+ \
+ void SAL_CALL IMPLCLASS::acquire() throw() \
+ { \
+ /* Don't use mutex in methods of XInterface! */ \
+ BASECLASS::acquire(); \
+ } \
+ \
+ void SAL_CALL IMPLCLASS::release() throw() \
+ { \
+ /* Don't use mutex in methods of XInterface! */ \
+ BASECLASS::release(); \
+ } \
+ \
+ css::uno::Any SAL_CALL IMPLCLASS::queryInterface( const css::uno::Type& rType ) throw( css::uno::RuntimeException ) \
+ { \
+ /* Attention: Don't use mutex or guard in this method!!! Is a method of XInterface. */ \
+ /* Ask for my own supported interfaces ... */ \
+ css::uno::Any aReturn ( ::cppu::queryInterface( rType, \
+ IMPLINTERFACES \
+ ) \
+ ); \
+ /* If searched interface supported by this class ... */ \
+ if ( aReturn.hasValue() == sal_True ) \
+ { \
+ /* ... return this information. */ \
+ return aReturn ; \
+ } \
+ else \
+ { \
+ /* Else; ... ask baseclass for interfaces! */ \
+ return BASECLASS::queryInterface( rType ); \
+ } \
+ }
+
+#define SFX_IMPL_INTERFACE_0 \
+ static_cast< css::lang::XTypeProvider* >( this )
+
+#define SFX_IMPL_INTERFACE_1( INTERFACE1 ) \
+ SFX_IMPL_INTERFACE_0, \
+ static_cast< INTERFACE1* >( this )
+
+#define SFX_IMPL_INTERFACE_2( INTERFACE1, INTERFACE2 ) \
+ SFX_IMPL_INTERFACE_1( INTERFACE1 ), \
+ static_cast< INTERFACE2* >( this )
+
+#define SFX_IMPL_INTERFACE_3( INTERFACE1, INTERFACE2, INTERFACE3 ) \
+ SFX_IMPL_INTERFACE_2( INTERFACE1, INTERFACE2 ), \
+ static_cast< INTERFACE3* >( this )
+
+#define SFX_IMPL_INTERFACE_4( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4 ) \
+ SFX_IMPL_INTERFACE_3( INTERFACE1, INTERFACE2, INTERFACE3 ), \
+ static_cast< INTERFACE4* >( this )
+
+#define SFX_IMPL_INTERFACE_5( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5 ) \
+ SFX_IMPL_INTERFACE_4( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4 ), \
+ static_cast< INTERFACE5* >( this )
+
+#define SFX_IMPL_INTERFACE_6( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6 ) \
+ SFX_IMPL_INTERFACE_5( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5 ), \
+ static_cast< INTERFACE6* >( this )
+
+#define SFX_IMPL_INTERFACE_7( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7 ) \
+ SFX_IMPL_INTERFACE_6( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6 ), \
+ static_cast< INTERFACE7* >( this )
+
+#define SFX_IMPL_INTERFACE_8( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8 ) \
+ SFX_IMPL_INTERFACE_7( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7 ), \
+ static_cast< INTERFACE8* >( this )
+
+#define SFX_IMPL_INTERFACE_9( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9 ) \
+ SFX_IMPL_INTERFACE_8( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8 ), \
+ static_cast< INTERFACE9* >( this )
+
+#define SFX_IMPL_INTERFACE_10( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10 ) \
+ SFX_IMPL_INTERFACE_9( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9 ), \
+ static_cast< INTERFACE10* >( this )
+
+#define SFX_IMPL_INTERFACE_11( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11 ) \
+ SFX_IMPL_INTERFACE_10( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10 ), \
+ static_cast< INTERFACE11* >( this )
+
+#define SFX_IMPL_INTERFACE_12( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12 ) \
+ SFX_IMPL_INTERFACE_11( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11 ), \
+ static_cast< INTERFACE12* >( this )
+
+#define SFX_IMPL_INTERFACE_13( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12, INTERFACE13 ) \
+ SFX_IMPL_INTERFACE_12( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12 ), \
+ static_cast< INTERFACE13* >( this )
+/*_________________________________________________________________________________________________________________________*/
+
+// Follow macros can used directly :-)
+// implementation of XInterface with 0 additional interface for queryInterface()
+#define SFX_IMPL_XINTERFACE_0( IMPLCLASS, BASECLASS ) \
+ SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_0 )
+
+// implementation of XInterface with 1 additional interface for queryInterface()
+#define SFX_IMPL_XINTERFACE_1( IMPLCLASS, BASECLASS, INTERFACE1 ) \
+ SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_1( INTERFACE1 ) )
+
+// implementation of XInterface with 2 additional interfaces for queryInterface()
+#define SFX_IMPL_XINTERFACE_2( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2 ) \
+ SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_2( INTERFACE1, INTERFACE2 ) )
+
+// implementation of XInterface with 3 additional interfaces for queryInterface()
+#define SFX_IMPL_XINTERFACE_3( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3 ) \
+ SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_3( INTERFACE1, INTERFACE2, INTERFACE3 ) )
+
+// implementation of XInterface with 4 additional interfaces for queryInterface()
+#define SFX_IMPL_XINTERFACE_4( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4 ) \
+ SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_4( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4 ) )
+
+// implementation of XInterface with 5 additional interfaces for queryInterface()
+#define SFX_IMPL_XINTERFACE_5( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5 ) \
+ SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_5( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5 ) )
+
+// implementation of XInterface with 6 additional interfaces for queryInterface()
+#define SFX_IMPL_XINTERFACE_6( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6 ) \
+ SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_6( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6 ) )
+
+// implementation of XInterface with 7 additional interfaces for queryInterface()
+#define SFX_IMPL_XINTERFACE_7( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7 ) \
+ SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_7( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7 ) )
+
+// implementation of XInterface with 8 additional interfaces for queryInterface()
+#define SFX_IMPL_XINTERFACE_8( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8 ) \
+ SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_8( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8 ) )
+
+// implementation of XInterface with 9 additional interfaces for queryInterface()
+#define SFX_IMPL_XINTERFACE_9( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9 ) \
+ SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_9( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9 ) )
+
+// implementation of XInterface with 10 additional interfaces for queryInterface()
+#define SFX_IMPL_XINTERFACE_10( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10 ) \
+ SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_10( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10 ) )
+
+// implementation of XInterface with 11 additional interfaces for queryInterface()
+#define SFX_IMPL_XINTERFACE_11( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11 ) \
+ SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_11( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11 ) )
+
+// implementation of XInterface with 11 additional interfaces for queryInterface()
+#define SFX_IMPL_XINTERFACE_12( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12 ) \
+ SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_12( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12 ) )
+
+// implementation of XInterface with 11 additional interfaces for queryInterface()
+#define SFX_IMPL_XINTERFACE_13( IMPLCLASS, BASECLASS, INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12, INTERFACE13 ) \
+ SFX_IMPL_XINTERFACE_BASE( IMPLCLASS, BASECLASS, SFX_IMPL_INTERFACE_13( INTERFACE1, INTERFACE2, INTERFACE3, INTERFACE4, INTERFACE5, INTERFACE6, INTERFACE7, INTERFACE8, INTERFACE9, INTERFACE10, INTERFACE11, INTERFACE12, INTERFACE13 ) )
+
+//************************************************************************************************************************
+// implementation of XTypeProvider::getTypes()
+// XTypeProvider::getImplementationId()
+//************************************************************************************************************************
+/*_________________________________________________________________________________________________________________________*/
+// DON'T USE FOLLOW MACROS DIRECTLY!!!
+#define SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, IMPLTYPES ) \
+ \
+ css::uno::Sequence< sal_Int8 > SAL_CALL IMPLCLASS::getImplementationId() throw( css::uno::RuntimeException ) \
+ { \
+ /* Create one Id for all instances of this class. */ \
+ /* Use ethernet address to do this! (sal_True) */ \
+ /* Optimize this method */ \
+ /* We initialize a static variable only one time. And we don't must use a mutex at every call! */ \
+ /* For the first call; pID is NULL - for the second call pID is different from NULL! */ \
+ static ::cppu::OImplementationId* pID = NULL ; \
+ if ( pID == NULL ) \
+ { \
+ /* Ready for multithreading; get global mutex for first call of this method only! see before */ \
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); \
+ /* Control these pointer again ... it can be, that another instance will be faster then these! */ \
+ if ( pID == NULL ) \
+ { \
+ /* Create a new static ID ... */ \
+ static ::cppu::OImplementationId aID( sal_False ); \
+ /* ... and set his address to static pointer! */ \
+ pID = &aID ; \
+ } \
+ } \
+ return pID->getImplementationId(); \
+ } \
+ \
+ css::uno::Sequence< css::uno::Type > SAL_CALL IMPLCLASS::getTypes() throw( css::uno::RuntimeException ) \
+ { \
+ /* Optimize this method ! */ \
+ /* We initialize a static variable only one time. And we don't must use a mutex at every call! */ \
+ /* For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL!*/ \
+ static ::cppu::OTypeCollection* pTypeCollection = NULL ; \
+ if ( pTypeCollection == NULL ) \
+ { \
+ /* Ready for multithreading; get global mutex for first call of this method only! see before */ \
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); \
+ /* Control these pointer again ... it can be, that another instance will be faster then these! */ \
+ if ( pTypeCollection == NULL ) \
+ { \
+ /* Create a static typecollection ... */ \
+ static ::cppu::OTypeCollection aTypeCollection( IMPLTYPES ); \
+ /* ... and set his address to static pointer! */ \
+ pTypeCollection = &aTypeCollection ; \
+ } \
+ } \
+ return pTypeCollection->getTypes(); \
+ }
+
+#define SFX_IMPL_TYPE_0 \
+ ::getCppuType(( const css::uno::Reference< css::lang::XTypeProvider >*)NULL )
+
+#define SFX_IMPL_TYPE_1( TYPE1 ) \
+ SFX_IMPL_TYPE_0, \
+ ::getCppuType(( const css::uno::Reference< TYPE1 >*)NULL )
+
+#define SFX_IMPL_TYPE_2( TYPE1, TYPE2 ) \
+ SFX_IMPL_TYPE_1( TYPE1 ), \
+ ::getCppuType(( const css::uno::Reference< TYPE2 >*)NULL )
+
+#define SFX_IMPL_TYPE_3( TYPE1, TYPE2, TYPE3 ) \
+ SFX_IMPL_TYPE_2( TYPE1, TYPE2 ), \
+ ::getCppuType(( const css::uno::Reference< TYPE3 >*)NULL )
+
+#define SFX_IMPL_TYPE_4( TYPE1, TYPE2, TYPE3, TYPE4 ) \
+ SFX_IMPL_TYPE_3( TYPE1, TYPE2, TYPE3 ), \
+ ::getCppuType(( const css::uno::Reference< TYPE4 >*)NULL )
+
+#define SFX_IMPL_TYPE_5( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5 ) \
+ SFX_IMPL_TYPE_4( TYPE1, TYPE2, TYPE3, TYPE4 ), \
+ ::getCppuType(( const css::uno::Reference< TYPE5 >*)NULL )
+
+#define SFX_IMPL_TYPE_6( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6 ) \
+ SFX_IMPL_TYPE_5( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5 ), \
+ ::getCppuType(( const css::uno::Reference< TYPE6 >*)NULL )
+
+#define SFX_IMPL_TYPE_7( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7 ) \
+ SFX_IMPL_TYPE_6( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6 ), \
+ ::getCppuType(( const css::uno::Reference< TYPE7 >*)NULL )
+
+#define SFX_IMPL_TYPE_8( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8 ) \
+ SFX_IMPL_TYPE_7( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7 ), \
+ ::getCppuType(( const css::uno::Reference< TYPE8 >*)NULL )
+
+#define SFX_IMPL_TYPE_9( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9 ) \
+ SFX_IMPL_TYPE_8( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8 ), \
+ ::getCppuType(( const css::uno::Reference< TYPE9 >*)NULL )
+
+#define SFX_IMPL_TYPE_10( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10 ) \
+ SFX_IMPL_TYPE_9( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9 ), \
+ ::getCppuType(( const css::uno::Reference< TYPE10 >*)NULL )
+
+#define SFX_IMPL_TYPE_11( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11 ) \
+ SFX_IMPL_TYPE_10( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10 ), \
+ ::getCppuType(( const css::uno::Reference< TYPE11 >*)NULL )
+
+#define SFX_IMPL_TYPE_12( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12 ) \
+ SFX_IMPL_TYPE_11( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11 ), \
+ ::getCppuType(( const css::uno::Reference< TYPE12 >*)NULL )
+
+#define SFX_IMPL_TYPE_13( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12, TYPE13 ) \
+ SFX_IMPL_TYPE_12( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12 ), \
+ ::getCppuType(( const css::uno::Reference< TYPE13 >*)NULL )
+/*_________________________________________________________________________________________________________________________*/
+
+// FOLLOW MACROS CAN USED DIRECTLY :-)
+
+// implementation of XInterface with 1 additional interface for queryInterface()
+#define SFX_IMPL_XTYPEPROVIDER_0( IMPLCLASS ) \
+ SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_0 )
+
+// implementation of XInterface with 1 additional interface for queryInterface()
+#define SFX_IMPL_XTYPEPROVIDER_1( IMPLCLASS, TYPE1 ) \
+ SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_1( TYPE1 ) )
+
+// implementation of XInterface with 2 additional interfaces for queryInterface()
+#define SFX_IMPL_XTYPEPROVIDER_2( IMPLCLASS, TYPE1, TYPE2 ) \
+ SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_2( TYPE1, TYPE2 ) )
+
+// implementation of XInterface with 3 additional interfaces for queryInterface()
+#define SFX_IMPL_XTYPEPROVIDER_3( IMPLCLASS, TYPE1, TYPE2, TYPE3 ) \
+ SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_3( TYPE1, TYPE2, TYPE3 ) )
+
+// implementation of XInterface with 4 additional interfaces for queryInterface()
+#define SFX_IMPL_XTYPEPROVIDER_4( IMPLCLASS, TYPE1, TYPE2, TYPE3, TYPE4 ) \
+ SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_4( TYPE1, TYPE2, TYPE3, TYPE4 ) )
+
+// implementation of XInterface with 5 additional interfaces for queryInterface()
+#define SFX_IMPL_XTYPEPROVIDER_5( IMPLCLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5 ) \
+ SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_5( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5 ) )
+
+// implementation of XInterface with 6 additional interfaces for queryInterface()
+#define SFX_IMPL_XTYPEPROVIDER_6( IMPLCLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6 ) \
+ SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_6( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6 ) )
+
+// implementation of XInterface with 7 additional interfaces for queryInterface()
+#define SFX_IMPL_XTYPEPROVIDER_7( IMPLCLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7 ) \
+ SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_7( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7 ) )
+
+// implementation of XInterface with 8 additional interfaces for queryInterface()
+#define SFX_IMPL_XTYPEPROVIDER_8( IMPLCLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8 ) \
+ SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_8( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8 ) )
+
+// implementation of XInterface with 9 additional interfaces for queryInterface()
+#define SFX_IMPL_XTYPEPROVIDER_9( IMPLCLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9 ) \
+ SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_9( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9 ) )
+
+// implementation of XInterface with 10 additional interfaces for queryInterface()
+#define SFX_IMPL_XTYPEPROVIDER_10( IMPLCLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10 ) \
+ SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_10( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10 ) )
+
+// implementation of XInterface with 11 additional interfaces for queryInterface()
+#define SFX_IMPL_XTYPEPROVIDER_11( IMPLCLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11 ) \
+ SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_11( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11 ) )
+
+// implementation of XInterface with 11 additional interfaces for queryInterface()
+#define SFX_IMPL_XTYPEPROVIDER_12( IMPLCLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12 ) \
+ SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_12( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12 ) )
+
+// implementation of XInterface with 11 additional interfaces for queryInterface()
+#define SFX_IMPL_XTYPEPROVIDER_13( IMPLCLASS, TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12, TYPE13 ) \
+ SFX_IMPL_XTYPEPROVIDER_BASE( IMPLCLASS, SFX_IMPL_TYPE_13( TYPE1, TYPE2, TYPE3, TYPE4, TYPE5, TYPE6, TYPE7, TYPE8, TYPE9, TYPE10, TYPE11, TYPE12, TYPE13 ) )
+
+//************************************************************************************************************************
+// implementation of XServiceInfo::getImplementationName()
+// XServiceInfo::supportsService()
+// XServiceInfo::getSupportedServiceNames()
+// static xxx::impl_getStaticSupportedServiceNames()
+// static xxx::impl_getStaticImplementationName()
+// static xxx::impl_createInstance()
+//************************************************************************************************************************
+#define SFX_IMPL_XSERVICEINFO( IMPLCLASS, IMPLSERVICENAME, IMPLNAME ) \
+ \
+ /* XServiceInfo */ \
+ OUString SAL_CALL IMPLCLASS::getImplementationName() throw( css::uno::RuntimeException ) \
+ { \
+ return impl_getStaticImplementationName(); \
+ } \
+ \
+ /* XServiceInfo */ \
+ sal_Bool SAL_CALL IMPLCLASS::supportsService( const OUString& sServiceName ) throw( css::uno::RuntimeException ) \
+ { \
+ css::uno::Sequence< OUString > seqServiceNames = getSupportedServiceNames(); \
+ const OUString* pArray = seqServiceNames.getConstArray(); \
+ for ( sal_Int32 nCounter=0; nCounter<seqServiceNames.getLength(); nCounter++ ) \
+ { \
+ if ( pArray[nCounter] == sServiceName ) \
+ { \
+ return sal_True ; \
+ } \
+ } \
+ return sal_False ; \
+ } \
+ \
+ /* XServiceInfo */ \
+ css::uno::Sequence< OUString > SAL_CALL IMPLCLASS::getSupportedServiceNames() throw( css::uno::RuntimeException ) \
+ { \
+ return impl_getStaticSupportedServiceNames(); \
+ } \
+ \
+ /* Helper for XServiceInfo */ \
+ css::uno::Sequence< OUString > IMPLCLASS::impl_getStaticSupportedServiceNames() \
+ { \
+ css::uno::Sequence< OUString > seqServiceNames( 1 ); \
+ seqServiceNames.getArray() [0] = OUString::createFromAscii( IMPLSERVICENAME ); \
+ return seqServiceNames ; \
+ } \
+ \
+ /* Helper for XServiceInfo */ \
+ OUString IMPLCLASS::impl_getStaticImplementationName() \
+ { \
+ return OUString::createFromAscii( IMPLNAME ); \
+ } \
+ \
+ /* Helper for registry */ \
+ css::uno::Reference< css::uno::XInterface > SAL_CALL IMPLCLASS::impl_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) throw( css::uno::Exception ) \
+ { \
+ return css::uno::Reference< css::uno::XInterface >( *new IMPLCLASS( xServiceManager ) ); \
+ }
+
+//************************************************************************************************************************
+// implementation of XServiceInfo::getImplementationName()
+// XServiceInfo::supportsService()
+// XServiceInfo::getSupportedServiceNames()
+// static xxx::impl_getStaticSupportedServiceNames()
+// static xxx::impl_getStaticImplementationName()
+// static xxx::impl_createInstance()
+//************************************************************************************************************************
+#define SFX_IMPL_XSERVICEINFO_CTX( IMPLCLASS, IMPLSERVICENAME, IMPLNAME ) \
+ \
+ /* XServiceInfo */ \
+ OUString SAL_CALL IMPLCLASS::getImplementationName() throw( css::uno::RuntimeException ) \
+ { \
+ return impl_getStaticImplementationName(); \
+ } \
+ \
+ /* XServiceInfo */ \
+ sal_Bool SAL_CALL IMPLCLASS::supportsService( const OUString& sServiceName ) throw( css::uno::RuntimeException ) \
+ { \
+ css::uno::Sequence< OUString > seqServiceNames = getSupportedServiceNames(); \
+ const OUString* pArray = seqServiceNames.getConstArray(); \
+ for ( sal_Int32 nCounter=0; nCounter<seqServiceNames.getLength(); nCounter++ ) \
+ { \
+ if ( pArray[nCounter] == sServiceName ) \
+ { \
+ return sal_True ; \
+ } \
+ } \
+ return sal_False ; \
+ } \
+ \
+ /* XServiceInfo */ \
+ css::uno::Sequence< OUString > SAL_CALL IMPLCLASS::getSupportedServiceNames() throw( css::uno::RuntimeException ) \
+ { \
+ return impl_getStaticSupportedServiceNames(); \
+ } \
+ \
+ /* Helper for XServiceInfo */ \
+ css::uno::Sequence< OUString > IMPLCLASS::impl_getStaticSupportedServiceNames() \
+ { \
+ css::uno::Sequence< OUString > seqServiceNames( 1 ); \
+ seqServiceNames.getArray() [0] = OUString::createFromAscii( IMPLSERVICENAME ); \
+ return seqServiceNames ; \
+ } \
+ \
+ /* Helper for XServiceInfo */ \
+ OUString IMPLCLASS::impl_getStaticImplementationName() \
+ { \
+ return OUString::createFromAscii( IMPLNAME ); \
+ } \
+ \
+ /* Helper for registry */ \
+ css::uno::Reference< css::uno::XInterface > SAL_CALL IMPLCLASS::impl_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) throw( css::uno::Exception ) \
+ { \
+ return css::uno::Reference< css::uno::XInterface >( *new IMPLCLASS( comphelper::getComponentContext(xServiceManager) ) ); \
+ }
+
+//************************************************************************************************************************
+// definition of createFactory() for MultiServices
+//************************************************************************************************************************
+#define SFX_IMPL_SINGLEFACTORY( IMPLCLASS ) \
+ \
+ css::uno::Reference< css::lang::XSingleServiceFactory > IMPLCLASS::impl_createFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) \
+ { \
+ css::uno::Reference< css::lang::XSingleServiceFactory > xReturn ( \
+ cppu::createSingleFactory( xServiceManager , \
+ IMPLCLASS::impl_getStaticImplementationName() , \
+ IMPLCLASS::impl_createInstance , \
+ IMPLCLASS::impl_getStaticSupportedServiceNames() ) \
+ ); \
+ return xReturn ; \
+ }
+
+//************************************************************************************************************************
+// definition of createFactory() for OneInstance-Services
+//************************************************************************************************************************
+#define SFX_IMPL_ONEINSTANCEFACTORY( IMPLCLASS ) \
+ \
+ css::uno::Reference< css::lang::XSingleServiceFactory > IMPLCLASS::impl_createFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) \
+ { \
+ css::uno::Reference< css::lang::XSingleServiceFactory > xReturn( \
+ cppu::createOneInstanceFactory( xServiceManager , \
+ IMPLCLASS::impl_getStaticImplementationName() , \
+ IMPLCLASS::impl_createInstance , \
+ IMPLCLASS::impl_getStaticSupportedServiceNames() ) \
+ ); \
+ return xReturn ; \
+ }
+
+//************************************************************************************************************************
+// definition for "extern c sfx_component_getFactory()"
+//************************************************************************************************************************
+#define CREATEFACTORY(CLASS) \
+ \
+ /* Create right factory ... */ \
+ xFactory = CLASS::impl_createFactory( xServiceManager );
+
+//************************************************************************************************************************
+// definition for "extern c sfx_component_getFactory()"
+//************************************************************************************************************************
+#define IF_NAME_CREATECOMPONENTFACTORY(CLASS) \
+ \
+ if ( CLASS::impl_getStaticImplementationName().equals( OUString::createFromAscii( pImplementationName ) ) ) \
+ { \
+ CREATEFACTORY ( CLASS ) \
+ }
+
+#endif // _SFX_SFXUNO_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/shell.hxx b/include/sfx2/shell.hxx
new file mode 100644
index 000000000000..cba6efaf8e36
--- /dev/null
+++ b/include/sfx2/shell.hxx
@@ -0,0 +1,371 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX_SHELL_HXX
+#define _SFX_SHELL_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include "sal/types.h"
+#include <com/sun/star/embed/VerbDescriptor.hpp>
+#include <tools/debug.hxx>
+#include <tools/rtti.hxx>
+#include <svl/brdcst.hxx>
+
+#include <tools/string.hxx>
+
+#include <sfx2/sfxuno.hxx>
+
+class ResMgr;
+class Window;
+class ToolBox;
+class SfxItemPool;
+class SfxPoolItem;
+class SfxRequest;
+class SfxItemSet;
+struct SfxFormalArgument;
+class StatusBar;
+class SfxInterface;
+class SfxViewShell;
+class SfxObjectShell;
+class SfxSlotPool;
+class SvGlobalName;
+
+class SfxShellObject;
+class SfxShell;
+struct SfxShell_Impl;
+class SfxShellObject;
+class SfxDispatcher;
+class SfxViewFrame;
+class SfxSlot;
+class SfxRepeatTarget;
+class SbxVariable;
+class SbxBase;
+class SfxBindings;
+
+namespace svl
+{
+ class IUndoManager;
+}
+
+//====================================================================
+
+enum SfxInterfaceId
+
+/* [Description]
+
+ Id for <SfxInterface>s, gives a quasi-static access to the interface
+ through an array to <SfxApplication>.
+*/
+
+{
+ SFX_INTERFACE_NONE,
+ SFX_INTERFACE_SFXAPP,
+ SFX_INTERFACE_SFXDOCSH,
+ SFX_INTERFACE_SFXIPFRM,
+ SFX_INTERFACE_SFXVIEWSH,
+ SFX_INTERFACE_SFXVIEWFRM,
+ SFX_INTERFACE_SFXPLUGINFRM,
+ SFX_INTERFACE_SFXPLUGINOBJ,
+ SFX_INTERFACE_SFXPLUGINVIEWSH,
+ SFX_INTERFACE_SFXFRAMESETOBJ,
+ SFX_INTERFACE_SFXFRAMESETVIEWSH,
+ SFX_INTERFACE_SFXINTERNALFRM,
+ SFX_INTERFACE_SFXCOMPONENTDOCSH,
+ SFX_INTERFACE_SFXGENERICOBJ,
+ SFX_INTERFACE_SFXGENERICVIEWSH,
+ SFX_INTERFACE_SFXEXPLOBJ,
+ SFX_INTERFACE_SFXEXPLVIEWSH,
+ SFX_INTERFACE_SFXPLUGINVIEWSHDYNAMIC,
+ SFX_INTERFACE_SFXEXTERNALVIEWFRM,
+ SFX_INTERFACE_SFXMODULE,
+ SFX_INTERFACE_SFXFRAMESETVIEW,
+ SFX_INTERFACE_SFXFRAMESETSOURCEVIEW,
+ SFX_INTERFACE_SFXHELP_DOCSH,
+ SFX_INTERFACE_SFXHELP_VIEWSH,
+ SFX_INTERFACE_SFXTASK,
+ SFX_INTERFACE_OFA_START = 100,
+ SFX_INTERFACE_OFA_END = 100,
+ SFX_INTERFACE_SC_START = 150,
+ SFX_INTERFACE_SC_END = 199,
+ SFX_INTERFACE_SD_START = 200,
+ SFX_INTERFACE_SD_END = 249,
+ SFX_INTERFACE_SW_START = 250,
+ SFX_INTERFACE_SW_END = 299,
+ SFX_INTERFACE_SIM_START = 300,
+ SFX_INTERFACE_SIM_END = 319,
+ SFX_INTERFACE_SCH_START = 320,
+ SFX_INTERFACE_SCH_END = 339,
+ SFX_INTERFACE_SMA_START = 340,
+ SFX_INTERFACE_SMA_END = 359,
+ SFX_INTERFACE_SBA_START = 360,
+ SFX_INTERFACE_SBA_END = 399,
+ SFX_INTERFACE_IDE_START = 400,
+ SFX_INTERFACE_IDE_END = 409,
+ //-if one is still needed
+ SFX_INTERFACE_APP = SFX_INTERFACE_SW_START,
+ SFX_INTERFACE_LIB = 450
+};
+
+//TODO/CLEANUP: replace by UNO constant
+#define SVVERB_SHOW -1
+
+//====================================================================
+
+typedef void (*SfxExecFunc)(SfxShell *, SfxRequest &rReq);
+typedef void (*SfxStateFunc)(SfxShell *, SfxItemSet &rSet);
+
+class SFX2_DLLPUBLIC SfxShell: public SfxBroadcaster
+
+/* [Description]
+
+ The class SfxShell is the base class for all classes, which provide
+ the functionality of the form <Slot>s.
+
+ Each instance has a reference to an interface description, which is
+ obtainable through <SfxShell::GetInterface()const>. This interface
+ provides the connection to specific methods and contains some other
+ descriptive data for controllers like menus and toolboxes, but also
+ for the various APIs. The main part of the interface description is in
+ the form of a <Type-Library>, which is generated from an IDL-file by
+ the <SVIDL-Compiler>. For each SfxShell Subclass-File there is one
+ such IDL-file to write.
+*/
+
+{
+ friend class SfxObjectItem;
+
+ SfxShell_Impl* pImp;
+ SfxItemPool* pPool;
+ ::svl::IUndoManager* pUndoMgr;
+
+private:
+ SfxShell( const SfxShell & ); // internal
+ SfxShell& operator = ( const SfxShell & ); // internal
+
+protected:
+ SfxShell();
+ SfxShell( SfxViewShell *pViewSh );
+
+#ifndef _SFXSH_HXX
+ SAL_DLLPRIVATE void SetViewShell_Impl( SfxViewShell* pView );
+ SAL_DLLPRIVATE void Invalidate_Impl( SfxBindings& rBindings, sal_uInt16 nId );
+ SAL_DLLPRIVATE SfxShellObject* GetShellObj_Impl() const;
+ SAL_DLLPRIVATE void SetShellObj_Impl( SfxShellObject* pObj );
+#endif
+
+public:
+ TYPEINFO();
+ virtual ~SfxShell();
+
+ virtual SfxInterface* GetInterface() const;
+ static SfxInterface* GetStaticInterface() { return 0; }
+
+ void SetName( const String &rName );
+ const String& GetName() const;
+
+ SfxViewShell* GetViewShell() const;
+
+ void CallExec( SfxExecFunc pFunc, SfxRequest &rReq )
+ { (*pFunc)(this, rReq); }
+ void CallState( SfxStateFunc pFunc, SfxItemSet &rSet )
+ { (*pFunc)(this, rSet); }
+
+ static void EmptyExecStub(SfxShell *pShell, SfxRequest &);
+ static void EmptyStateStub(SfxShell *pShell, SfxItemSet &);
+
+ const SfxPoolItem* GetSlotState( sal_uInt16 nSlotId, const SfxInterface *pIF = 0, SfxItemSet *pStateSet = 0 );
+ const SfxPoolItem* ExecuteSlot( SfxRequest &rReq, const SfxInterface *pIF = 0 );
+ const SfxPoolItem* ExecuteSlot( SfxRequest &rReq, sal_Bool bAsync );
+ sal_uIntPtr ExecuteSlot( sal_uInt16 nSlot, sal_uInt16 nMemberId, SbxVariable& rRet, SbxBase* pArgs = 0 );
+
+ inline SfxItemPool& GetPool() const;
+ inline void SetPool( SfxItemPool *pNewPool ) ;
+
+ virtual ::svl::IUndoManager*
+ GetUndoManager();
+ void SetUndoManager( ::svl::IUndoManager *pNewUndoMgr );
+
+ SfxRepeatTarget* GetRepeatTarget() const;
+ void SetRepeatTarget( SfxRepeatTarget *pTarget );
+
+ virtual void Invalidate(sal_uInt16 nId = 0);
+
+ sal_Bool IsActive() const;
+ virtual void Activate(sal_Bool bMDI);
+ virtual void Deactivate(sal_Bool bMDI);
+ virtual void ParentActivate();
+ virtual void ParentDeactivate();
+
+ SfxDispatcher* GetDispatcher() const;
+ SfxViewFrame* GetFrame() const;
+ ResMgr* GetResMgr() const;
+ virtual sal_Bool HasUIFeature( sal_uInt32 nFeature );
+ void UIFeatureChanged();
+
+ // Items
+ const SfxPoolItem* GetItem( sal_uInt16 nSlotId ) const;
+ void PutItem( const SfxPoolItem& rItem );
+
+ // TODO/CLEANUP: still needed?!
+ void SetVerbs(const com::sun::star::uno::Sequence < com::sun::star::embed::VerbDescriptor >& aVerbs);
+ const com::sun::star::uno::Sequence < com::sun::star::embed::VerbDescriptor >& GetVerbs() const;
+ void VerbExec (SfxRequest&);
+ void VerbState (SfxItemSet&);
+ SAL_DLLPRIVATE const SfxSlot* GetVerbSlot_Impl(sal_uInt16 nId) const;
+
+ void SetHelpId(sal_uIntPtr nId);
+ sal_uIntPtr GetHelpId() const;
+ virtual SfxObjectShell* GetObjectShell();
+ void SetDisableFlags( sal_uIntPtr nFlags );
+ sal_uIntPtr GetDisableFlags() const;
+
+ virtual SfxItemSet* CreateItemSet( sal_uInt16 nId );
+ virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet );
+
+#ifndef _SFXSH_HXX
+ SAL_DLLPRIVATE bool CanExecuteSlot_Impl( const SfxSlot &rSlot );
+ SAL_DLLPRIVATE void DoActivate_Impl( SfxViewFrame *pFrame, sal_Bool bMDI);
+ SAL_DLLPRIVATE void DoDeactivate_Impl( SfxViewFrame *pFrame, sal_Bool bMDI);
+#endif
+};
+
+//--------------------------------------------------------------------
+SfxItemPool& SfxShell::GetPool() const
+/*
+ [Description]
+
+ Each Subclass of SfxShell must reference a pool. This is partly set by
+ SFx's own set of subclasses (eg <SfxViewShell>). In particular however
+ this must be set directly from one derived SfxShell class and ny
+ derivatives of SfxObjectShell.
+
+ The SfxShell class itself does not have any SfxItemPool, therfore a
+ null-pointer is returned.
+*/
+
+{
+ DBG_ASSERT( pPool, "no pool" );
+ return *pPool;
+}
+//-------------------------------------------------------------------
+inline void SfxShell::SetPool
+(
+ SfxItemPool* pNewPool // Pointer to the new Pool or null
+)
+
+/* [Description]
+
+ With this method, the subclasses register their special <SfxItemPool>
+ in the SfxShell. Each SfxShell instance must have access to a SfxItemPool.
+ Usually this is the SfxItemPool of the SfxDocumentShell. The SfxShell
+ subclass does not take ownership of the orphaned pool. Before it is
+ deleted it has to be deregisted with SetPool(0).
+*/
+
+{
+ pPool = pNewPool;
+}
+
+//=====================================================================
+
+#define SFX_ARGUMENTMAP(ShellClass) static SfxFormalArgument a##ShellClass##Args_Impl[] =
+
+#define SFX_SLOTMAP(ShellClass) static SfxFormalArgument a##ShellClass##Args_Impl[1]; \
+ static SfxSlot a##ShellClass##Slots_Impl[] =
+
+#define SFX_SLOTMAP_ARG(ShellClass) static SfxSlot a##ShellClass##Slots_Impl[] =
+
+#define SFX_DECL_INTERFACE(nId) \
+ static SfxInterface* pInterface; \
+ private: \
+ static void InitInterface_Impl(); \
+ public: \
+ static const SfxFormalArgument* pSfxFormalArgs_Impl; \
+ static SfxInterface* GetStaticInterface(); \
+ static SfxInterfaceId GetInterfaceId() {return SfxInterfaceId(nId);} \
+ static void RegisterInterface(SfxModule* pMod=NULL); \
+ virtual SfxInterface* GetInterface() const;
+
+#define SFX_IMPL_INTERFACE(Class,SuperClass,NameResId) \
+ \
+ SfxInterface* Class::pInterface = 0; \
+ const SfxFormalArgument* Class::pSfxFormalArgs_Impl = a##Class##Args_Impl;\
+ SfxInterface* Class::GetStaticInterface() \
+ { \
+ if ( !pInterface ) \
+ { \
+ pInterface = \
+ new SfxInterface( \
+ #Class, NameResId, GetInterfaceId(), \
+ SuperClass::GetStaticInterface(), \
+ a##Class##Slots_Impl[0], \
+ (sal_uInt16) (sizeof(a##Class##Slots_Impl) / sizeof(SfxSlot) ) ); \
+ InitInterface_Impl(); \
+ } \
+ return pInterface; \
+ } \
+ \
+ SfxInterface* Class::GetInterface() const \
+ { \
+ return GetStaticInterface(); \
+ } \
+ \
+ void Class::RegisterInterface(SfxModule* pMod) \
+ { \
+ GetStaticInterface()->Register(pMod); \
+ } \
+ \
+ void Class::InitInterface_Impl()
+
+#define SFX_POSITION_MASK 0x000F
+#define SFX_VISIBILITY_MASK 0xFFF0
+#define SFX_VISIBILITY_UNVISIBLE 0x0000 // Never visible
+#define SFX_VISIBILITY_VIEWER 0x0040
+#define SFX_VISIBILITY_READONLYDOC 0x0400
+#define SFX_VISIBILITY_DESKTOP 0x0800
+#define SFX_VISIBILITY_STANDARD 0x1000
+#define SFX_VISIBILITY_FULLSCREEN 0x2000
+#define SFX_VISIBILITY_CLIENT 0x4000
+#define SFX_VISIBILITY_SERVER 0x8000
+#define SFX_VISIBILITY_NOCONTEXT 0xFFFF // Always visable
+
+#define SFX_OBJECTBAR_REGISTRATION(nPos,rResId) \
+ GetStaticInterface()->RegisterObjectBar( nPos, rResId )
+
+#define SFX_FEATURED_OBJECTBAR_REGISTRATION(nPos,rResId,nFeature) \
+ GetStaticInterface()->RegisterObjectBar( nPos, rResId, nFeature )
+
+#define SFX_CHILDWINDOW_REGISTRATION(nId) \
+ GetStaticInterface()->RegisterChildWindow( nId, (sal_Bool) sal_False )
+
+#define SFX_FEATURED_CHILDWINDOW_REGISTRATION(nId,nFeature) \
+ GetStaticInterface()->RegisterChildWindow( nId, (sal_Bool) sal_False, nFeature )
+
+#define SFX_CHILDWINDOW_CONTEXT_REGISTRATION(nId) \
+ GetStaticInterface()->RegisterChildWindow( nId, (sal_Bool) sal_True )
+
+#define SFX_POPUPMENU_REGISTRATION(rResId) \
+ GetStaticInterface()->RegisterPopupMenu( rResId )
+
+#define SFX_STATUSBAR_REGISTRATION(rResId) \
+ GetStaticInterface()->RegisterStatusBar( rResId )
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/signaturestate.hxx b/include/sfx2/signaturestate.hxx
new file mode 100644
index 000000000000..ff17355d2f48
--- /dev/null
+++ b/include/sfx2/signaturestate.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SFX2_SIGNATURESTATE_HXX
+#define SFX2_SIGNATURESTATE_HXX
+
+// xmlsec05, check with SFX team
+#define SIGNATURESTATE_UNKNOWN (sal_Int16)(-1)
+#define SIGNATURESTATE_NOSIGNATURES (sal_Int16)0
+#define SIGNATURESTATE_SIGNATURES_OK (sal_Int16)1
+#define SIGNATURESTATE_SIGNATURES_BROKEN (sal_Int16)2
+// State was SIGNATURES_OK, but doc is modified now
+#define SIGNATURESTATE_SIGNATURES_INVALID (sal_Int16)3
+// signature is OK, but certificate could not be validated
+#define SIGNATURESTATE_SIGNATURES_NOTVALIDATED (sal_Int16)4
+//signatur and certificate are ok,but not al files are signed, as was the case in
+//OOo 2.x - OOo 3.1.1. This state is only used together with document signatures.
+#define SIGNATURESTATE_SIGNATURES_PARTIAL_OK (sal_Int16)5
+
+#endif // SFX2_SIGNATURESTATE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/stbitem.hxx b/include/sfx2/stbitem.hxx
new file mode 100644
index 000000000000..d94e76841045
--- /dev/null
+++ b/include/sfx2/stbitem.hxx
@@ -0,0 +1,142 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXSTBITEM_HXX
+#define _SFXSTBITEM_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include <svl/poolitem.hxx>
+#include <svtools/statusbarcontroller.hxx>
+
+//------------------------------------------------------------------
+
+class SfxModule;
+class StatusBar;
+class SfxStatusBarControl;
+class SfxBindings;
+
+svt::StatusbarController* SAL_CALL SfxStatusBarControllerFactory(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ StatusBar* pStatusBar,
+ unsigned short nID,
+ const OUString& aCommandURL );
+typedef SfxStatusBarControl* (*SfxStatusBarControlCtor)( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar &rStb );
+
+struct SfxStbCtrlFactory
+{
+ SfxStatusBarControlCtor pCtor;
+ TypeId nTypeId;
+ sal_uInt16 nSlotId;
+
+ SfxStbCtrlFactory( SfxStatusBarControlCtor pTheCtor,
+ TypeId nTheTypeId, sal_uInt16 nTheSlotId ):
+ pCtor(pTheCtor),
+ nTypeId(nTheTypeId),
+ nSlotId(nTheSlotId)
+ {}
+};
+
+//------------------------------------------------------------------
+
+class CommandEvent;
+class MouseEvent;
+class UserDrawEvent;
+
+class SFX2_DLLPUBLIC SfxStatusBarControl: public svt::StatusbarController
+{
+ sal_uInt16 nSlotId;
+ sal_uInt16 nId;
+ StatusBar* pBar;
+
+protected:
+ // new controller API
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& aEvent ) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XComponent
+ virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
+
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XStatusbarController
+ virtual ::sal_Bool SAL_CALL mouseButtonDown( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL mouseMove( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL mouseButtonUp( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL command( const ::com::sun::star::awt::Point& aPos,
+ ::sal_Int32 nCommand,
+ ::sal_Bool bMouseEvent,
+ const ::com::sun::star::uno::Any& aData ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL paint( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics,
+ const ::com::sun::star::awt::Rectangle& rOutputRectangle,
+ ::sal_Int32 nItemId, ::sal_Int32 nStyle ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException);
+
+ // Old sfx2 interface
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+ virtual void Click();
+ virtual void DoubleClick();
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual sal_Bool MouseButtonDown( const MouseEvent & );
+ virtual sal_Bool MouseMove( const MouseEvent & );
+ virtual sal_Bool MouseButtonUp( const MouseEvent & );
+ virtual void Paint( const UserDrawEvent &rUDEvt );
+
+ static sal_uInt16 convertAwtToVCLMouseButtons( sal_Int16 nAwtMouseButtons );
+
+public:
+ SfxStatusBarControl( sal_uInt16 nSlotID, sal_uInt16 nId, StatusBar& rBar );
+ virtual ~SfxStatusBarControl();
+
+ sal_uInt16 GetSlotId() const { return nSlotId; }
+ sal_uInt16 GetId() const { return nId; }
+ StatusBar& GetStatusBar() const { return *pBar; }
+ void CaptureMouse();
+ void ReleaseMouse();
+
+ static SfxStatusBarControl* CreateControl( sal_uInt16 nSlotID, sal_uInt16 nId, StatusBar *pBar, SfxModule* );
+ static void RegisterStatusBarControl(SfxModule*, SfxStbCtrlFactory*);
+
+};
+
+//------------------------------------------------------------------
+
+#define SFX_DECL_STATUSBAR_CONTROL() \
+ static SfxStatusBarControl* CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar &rStb ); \
+ static void RegisterControl(sal_uInt16 nSlotId = 0, SfxModule *pMod=NULL)
+
+#define SFX_IMPL_STATUSBAR_CONTROL(Class, nItemClass) \
+ SfxStatusBarControl* Class::CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar &rStb ) \
+ { return new Class( nSlotId, nId, rStb ); } \
+ void Class::RegisterControl(sal_uInt16 nSlotId, SfxModule *pMod) \
+ { SfxStatusBarControl::RegisterStatusBarControl( pMod, new SfxStbCtrlFactory( \
+ Class::CreateImpl, TYPE(nItemClass), nSlotId ) ); }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/styfitem.hxx b/include/sfx2/styfitem.hxx
new file mode 100644
index 000000000000..b728be448a49
--- /dev/null
+++ b/include/sfx2/styfitem.hxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX_STYFITEM_HXX
+#define _SFX_STYFITEM_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+
+#include <vcl/bitmap.hxx>
+#include <vcl/image.hxx>
+#include <tools/rc.hxx>
+#include <rsc/rscsfx.hxx>
+#include <vector>
+
+struct SfxFilterTupel {
+ String aName;
+ sal_uInt16 nFlags;
+};
+typedef ::std::vector< SfxFilterTupel* > SfxStyleFilter;
+
+// CLASS -----------------------------------------------------------------
+
+class SfxStyleFamilyItem: public Resource
+{
+ Image aImage;
+ Bitmap aBitmap;
+ String aText;
+ String aHelpText;
+ sal_uInt16 nFamily;
+ SfxStyleFilter aFilterList;
+
+public:
+ SfxStyleFamilyItem( const ResId &rId );
+ ~SfxStyleFamilyItem();
+
+ const Bitmap& GetBitmap() const { return aBitmap; }
+ const String& GetText() const { return aText; }
+ const String& GetHelpText() const { return aHelpText; }
+ SfxStyleFamily GetFamily() const { return (SfxStyleFamily)nFamily; }
+ const SfxStyleFilter& GetFilterList() const { return aFilterList; }
+ const Image& GetImage() const { return aImage; }
+
+ // --------------------------------------------------------------------
+ class GrantAccess { friend class SfxStyleFamilies; };
+ void SetImage( const Image& _rImg ) { aImage = _rImg; }
+};
+
+typedef ::std::vector< SfxStyleFamilyItem* > SfxStyleFamilyList;
+
+class SFX2_DLLPUBLIC SfxStyleFamilies: public Resource
+{
+ SfxStyleFamilyList aEntryList;
+
+public:
+ /** ctor
+ <p>Will automatically call updateImages with BMP_COLOR_NORMAL.</p>
+ */
+ SfxStyleFamilies( const ResId &);
+ SfxStyleFamilies( ) {};
+ ~SfxStyleFamilies();
+
+ size_t size() const
+ { return aEntryList.size(); }
+
+ const SfxStyleFamilyItem* at(size_t nIdx) const
+ { return (SfxStyleFamilyItem*)(aEntryList.empty() ? NULL : aEntryList[nIdx]); }
+
+ /** updates the images of all single SfxStyleFamilyItems with new images from the given resource
+
+ <p>The resource must contain a local image lists, with the id beeing the integer equivalent for the
+ requested bitmap mode, incremented by 1.</p>
+
+ <p>Usually, you will use the same resource which originally constructed the object.</p>
+
+ @return
+ <TRUE/> if an image list for the requested mode could be found in the given resource.
+ */
+ sal_Bool updateImages( const ResId& _rId );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/styledlg.hxx b/include/sfx2/styledlg.hxx
new file mode 100644
index 000000000000..0580e4cae25c
--- /dev/null
+++ b/include/sfx2/styledlg.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX_STYLEDLG_HXX
+#define _SFX_STYLEDLG_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+
+#include <sfx2/tabdlg.hxx>
+
+class SfxStyleSheetBase;
+
+class SFX2_DLLPUBLIC SfxStyleDialog: public SfxTabDialog
+{
+private:
+ SfxStyleSheetBase* pStyle;
+ DECL_DLLPRIVATE_LINK( CancelHdl, Button * );
+protected:
+ virtual const SfxItemSet* GetRefreshedSet();
+
+public:
+#define ID_TABPAGE_MANAGESTYLES 1
+ SfxStyleDialog( Window* pParent, const ResId& rResId, SfxStyleSheetBase&,
+ sal_Bool bFreeRes = sal_True, const String* pUserBtnTxt = 0 );
+
+ ~SfxStyleDialog();
+
+ SfxStyleSheetBase& GetStyleSheet() { return *pStyle; }
+ const SfxStyleSheetBase& GetStyleSheet() const { return *pStyle; }
+
+ virtual short Ok();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx
new file mode 100644
index 000000000000..17016489e917
--- /dev/null
+++ b/include/sfx2/tabdlg.hxx
@@ -0,0 +1,306 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXTABDLG_HXX
+#define _SFXTABDLG_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include "sal/types.h"
+#include <vcl/button.hxx>
+#include <vcl/layout.hxx>
+#include <vcl/tabctrl.hxx>
+#include <vcl/tabdlg.hxx>
+#include <vcl/tabpage.hxx>
+#include <svl/itempool.hxx>
+#include <svl/itemset.hxx>
+#include <com/sun/star/frame/XFrame.hpp>
+
+class SfxPoolItem;
+class SfxTabDialog;
+class SfxViewFrame;
+class SfxTabPage;
+class SfxBindings;
+
+typedef SfxTabPage* (*CreateTabPage)(Window *pParent, const SfxItemSet &rAttrSet);
+typedef sal_uInt16* (*GetTabPageRanges)(); // provides international Which-value
+struct TabPageImpl;
+
+struct TabDlg_Impl;
+
+#define ID_TABCONTROL 1
+#define RET_USER 100
+#define RET_USER_CANCEL 101
+
+class SFX2_DLLPUBLIC SfxTabDialogItem: public SfxSetItem
+{
+public:
+ TYPEINFO();
+ SfxTabDialogItem( sal_uInt16 nId, const SfxItemSet& rItemSet );
+ SfxTabDialogItem(const SfxTabDialogItem& rAttr, SfxItemPool* pItemPool=NULL);
+ virtual SfxPoolItem* Clone(SfxItemPool* pToPool) const;
+ virtual SfxPoolItem* Create(SvStream& rStream, sal_uInt16 nVersion) const;
+};
+
+class SFX2_DLLPUBLIC SfxTabDialog : public TabDialog
+{
+private:
+friend class SfxTabPage;
+friend class SfxTabDialogController;
+
+ SfxViewFrame* pFrame;
+
+ VclBox *m_pBox;
+ TabControl *m_pTabCtrl;
+
+ OKButton *m_pOKBtn;
+ PushButton* m_pApplyBtn;
+ PushButton* m_pUserBtn;
+ CancelButton* m_pCancelBtn;
+ HelpButton* m_pHelpBtn;
+ PushButton* m_pResetBtn;
+ PushButton* m_pBaseFmtBtn;
+
+ bool m_bOwnsVBox;
+ bool m_bOwnsTabCtrl;
+ bool m_bOwnsActionArea;
+ bool m_bOwnsOKBtn;
+ bool m_bOwnsApplyBtn;
+ bool m_bOwnsUserBtn;
+ bool m_bOwnsCancelBtn;
+ bool m_bOwnsHelpBtn;
+ bool m_bOwnsResetBtn;
+ bool m_bOwnsBaseFmtBtn;
+
+ const SfxItemSet* pSet;
+ SfxItemSet* pOutSet;
+ TabDlg_Impl* pImpl;
+ sal_uInt16* pRanges;
+ sal_uInt32 nResId;
+ sal_uInt16 nAppPageId;
+ sal_Bool bItemsReset;
+ sal_Bool bFmt;
+
+ DECL_DLLPRIVATE_LINK( ActivatePageHdl, TabControl * );
+ DECL_DLLPRIVATE_LINK( DeactivatePageHdl, TabControl * );
+ DECL_DLLPRIVATE_LINK(OkHdl, void *);
+ DECL_DLLPRIVATE_LINK(ResetHdl, void *);
+ DECL_DLLPRIVATE_LINK(BaseFmtHdl, void *);
+ DECL_DLLPRIVATE_LINK(UserHdl, void *);
+ DECL_DLLPRIVATE_LINK(CancelHdl, void *);
+ SAL_DLLPRIVATE void Init_Impl( sal_Bool bFmtFlag, const String* pUserButtonText, const ResId* pResId );
+
+protected:
+ virtual short Ok();
+ // Is deleted in Sfx!
+ virtual SfxItemSet* CreateInputItemSet( sal_uInt16 nId );
+ // Is not deleted in Sfx!
+ virtual const SfxItemSet* GetRefreshedSet();
+ virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage );
+ virtual long Notify( NotifyEvent& rNEvt );
+
+ VclButtonBox* m_pActionArea;
+ SfxItemSet* pExampleSet;
+ SfxItemSet* GetInputSetImpl();
+ SfxTabPage* GetTabPage( sal_uInt16 nPageId ) const;
+
+ /** prepare to leace the current page. Calls the DeactivatePage method of the current page, (if necessary),
+ handles the item sets to copy.
+ @return sal_True if it is allowed to leave the current page, sal_False otherwise
+ */
+ bool PrepareLeaveCurrentPage();
+
+ /** save the position of the TabDialog and which tab page is the currently active one
+ */
+ void SavePosAndId();
+
+public:
+ SfxTabDialog( Window* pParent,
+ const OString& rID, const OUString& rUIXMLDescription,
+ const SfxItemSet * = 0, sal_Bool bEditFmt = sal_False );
+ SfxTabDialog( SfxViewFrame *pViewFrame, Window* pParent,
+ const OString& rID, const OUString& rUIXMLDescription,
+ const SfxItemSet * = 0, sal_Bool bEditFmt = sal_False );
+
+
+ SfxTabDialog( Window* pParent, const ResId &rResId, const SfxItemSet * = 0,
+ sal_Bool bEditFmt = sal_False, const String *pUserButtonText = 0 );
+ SfxTabDialog( SfxViewFrame *pViewFrame, Window* pParent, const ResId &rResId,
+ const SfxItemSet * = 0, sal_Bool bEditFmt = sal_False,
+ const String *pUserButtonText = 0 );
+ ~SfxTabDialog();
+
+ sal_uInt16 AddTabPage( const OString& rName, // Name of the label for the page in the notebook .ui
+ CreateTabPage pCreateFunc, // != 0
+ GetTabPageRanges pRangesFunc, // can be 0
+ sal_Bool bItemsOnDemand = sal_False);
+
+ sal_uInt16 AddTabPage ( const OString &rName, // Name of the label for the page in the notebook .ui
+ sal_uInt16 nPageCreateId ); // Identifier of the Factory Method to create the page
+
+ void AddTabPage( sal_uInt16 nId,
+ CreateTabPage pCreateFunc, // != 0
+ GetTabPageRanges pRangesFunc, // can be 0
+ sal_Bool bItemsOnDemand = sal_False);
+
+
+ void AddTabPage( sal_uInt16 nId,
+ const String &rRiderText,
+ CreateTabPage pCreateFunc, // != 0
+ GetTabPageRanges pRangesFunc, // can be 0
+ sal_Bool bItemsOnDemand = sal_False,
+ sal_uInt16 nPos = TAB_APPEND);
+ void AddTabPage( sal_uInt16 nId,
+ const Bitmap &rRiderBitmap,
+ CreateTabPage pCreateFunc, // != 0
+ GetTabPageRanges pRangesFunc, // can be 0
+ sal_Bool bItemsOnDemand = sal_False,
+ sal_uInt16 nPos = TAB_APPEND);
+
+ void AddTabPage( sal_uInt16 nId,
+ sal_Bool bItemsOnDemand = sal_False);
+ void AddTabPage( sal_uInt16 nId,
+ const String &rRiderText,
+ sal_Bool bItemsOnDemand = sal_False,
+ sal_uInt16 nPos = TAB_APPEND);
+ void AddTabPage( sal_uInt16 nId,
+ const Bitmap &rRiderBitmap,
+ sal_Bool bItemsOnDemand = sal_False,
+ sal_uInt16 nPos = TAB_APPEND);
+
+ void RemoveTabPage( const OString& rName ); // Name of the label for the page in the notebook .ui
+ void RemoveTabPage( sal_uInt16 nId );
+
+ void SetCurPageId(sal_uInt16 nId)
+ {
+ nAppPageId = nId;
+ }
+ void SetCurPageId(const OString& rName)
+ {
+ nAppPageId = m_pTabCtrl->GetPageId(rName);
+ }
+ sal_uInt16 GetCurPageId() const
+ {
+ return m_pTabCtrl->GetCurPageId();
+ }
+ void ShowPage( sal_uInt16 nId );
+
+ // may provide local slots converted by Map
+ const sal_uInt16* GetInputRanges( const SfxItemPool& );
+ void SetInputSet( const SfxItemSet* pInSet );
+ const SfxItemSet* GetOutputItemSet() const { return pOutSet; }
+ sal_Bool IsFormat() const { return bFmt; }
+
+ const OKButton& GetOKButton() const { return *m_pOKBtn; }
+ OKButton& GetOKButton() { return *m_pOKBtn; }
+ const CancelButton& GetCancelButton() const { return *m_pCancelBtn; }
+ CancelButton& GetCancelButton() { return *m_pCancelBtn; }
+ const HelpButton& GetHelpButton() const { return *m_pHelpBtn; }
+ HelpButton& GetHelpButton() { return *m_pHelpBtn; }
+
+ const PushButton* GetUserButton() const { return m_pUserBtn; }
+ PushButton* GetUserButton() { return m_pUserBtn; }
+ void RemoveResetButton();
+
+ short Execute();
+ void StartExecuteModal( const Link& rEndDialogHdl );
+ void Start( sal_Bool bShow = sal_True );
+
+ const SfxItemSet* GetExampleSet() const { return pExampleSet; }
+ SfxViewFrame* GetViewFrame() const { return pFrame; }
+
+ void EnableApplyButton(sal_Bool bEnable = sal_True);
+ sal_Bool IsApplyButtonEnabled() const;
+ void SetApplyHandler(const Link& _rHdl);
+
+ SAL_DLLPRIVATE void Start_Impl();
+
+ //calls Ok without closing dialog
+ bool Apply();
+};
+
+namespace sfx { class ItemConnectionBase; }
+
+class SFX2_DLLPUBLIC SfxTabPage: public TabPage
+{
+friend class SfxTabDialog;
+
+private:
+ const SfxItemSet* pSet;
+ String aUserString;
+ sal_Bool bHasExchangeSupport;
+ SfxTabDialog* pTabDlg;
+ TabPageImpl* pImpl;
+
+ SAL_DLLPRIVATE void SetTabDialog( SfxTabDialog* pNew ) { pTabDlg = pNew; }
+ SAL_DLLPRIVATE void SetInputSet( const SfxItemSet* pNew ) { pSet = pNew; }
+
+protected:
+ SfxTabPage( Window *pParent, const ResId &, const SfxItemSet &rAttrSet );
+ SfxTabPage(Window *pParent, const OString& rID, const OUString& rUIXMLDescription, const SfxItemSet &rAttrSet);
+
+ sal_uInt16 GetSlot( sal_uInt16 nWhich ) const
+ { return pSet->GetPool()->GetSlotId( nWhich ); }
+ sal_uInt16 GetWhich( sal_uInt16 nSlot, sal_Bool bDeep = sal_True ) const
+ { return pSet->GetPool()->GetWhich( nSlot, bDeep ); }
+ const SfxPoolItem* GetOldItem( const SfxItemSet& rSet, sal_uInt16 nSlot, sal_Bool bDeep = sal_True );
+ SfxTabDialog* GetTabDialog() const { return pTabDlg; }
+
+ void AddItemConnection( sfx::ItemConnectionBase* pConnection );
+
+public:
+ virtual ~SfxTabPage();
+
+ const SfxItemSet& GetItemSet() const { return *pSet; }
+
+ virtual sal_Bool FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet& );
+
+ sal_Bool HasExchangeSupport() const
+ { return bHasExchangeSupport; }
+ void SetExchangeSupport( sal_Bool bNew = sal_True )
+ { bHasExchangeSupport = bNew; }
+
+ enum sfxpg {
+ KEEP_PAGE = 0x0000, // Error handling; page does not change
+ // 2. Fill an itemset for update
+ // parent examples, this pointer can be NULL all the time!
+ LEAVE_PAGE = 0x0001,
+ // Set, refresh and update other Page
+ REFRESH_SET = 0x0002
+ };
+
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+ virtual void ActivatePage( const SfxItemSet& );
+ virtual int DeactivatePage( SfxItemSet* pSet = 0 );
+ void SetUserData(const String& rString)
+ { aUserString = rString; }
+ String GetUserData() { return aUserString; }
+ virtual void FillUserData();
+ virtual sal_Bool IsReadOnly() const;
+ virtual void PageCreated (SfxAllItemSet aSet);
+ static const SfxPoolItem* GetItem( const SfxItemSet& rSet, sal_uInt16 nSlot, sal_Bool bDeep = sal_True );
+
+ void SetFrame(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame);
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > GetFrame();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/tabpage.hrc b/include/sfx2/tabpage.hrc
new file mode 100644
index 000000000000..2c70183d433f
--- /dev/null
+++ b/include/sfx2/tabpage.hrc
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SFX2_TABPAGE_HRC
+#define INCLUDED_SFX2_TABPAGE_HRC
+
+// Width and height of all tab pages used in dialogs. Because tab pages
+// can be combined arbitrarily in tab dialogs, they have to have the
+// same dimensions. If you need to adjust either dimension of any tab
+// page (when adding new controls), do the change here.
+
+#define TP_WIDTH 260
+#define TP_HEIGHT 199
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/taskpane.hxx b/include/sfx2/taskpane.hxx
new file mode 100644
index 000000000000..0d0dd6eea199
--- /dev/null
+++ b/include/sfx2/taskpane.hxx
@@ -0,0 +1,233 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SFX_TASKPANE_HXX
+#define SFX_TASKPANE_HXX
+
+#include "sfx2/dllapi.h"
+#include "sfx2/childwin.hxx"
+#include "sfx2/titledockwin.hxx"
+
+#include <svtools/toolpanel/tabalignment.hxx>
+#include <svtools/toolpanel/tabitemcontent.hxx>
+
+#include <boost/scoped_ptr.hpp>
+#include <boost/optional.hpp>
+
+namespace svt
+{
+ class ToolPanelDeck;
+}
+
+//......................................................................................................................
+namespace sfx2
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= ITaskPaneToolPanelAccess
+ //==================================================================================================================
+ class SAL_NO_VTABLE ITaskPaneToolPanelAccess
+ {
+ public:
+ virtual void ActivateToolPanel( const OUString& i_rPanelURL ) = 0;
+
+ protected:
+ ~ITaskPaneToolPanelAccess() {}
+ };
+
+ //==================================================================================================================
+ //= TaskPaneWrapper
+ //==================================================================================================================
+ class SFX2_DLLPUBLIC TaskPaneWrapper :public SfxChildWindow
+ ,public ITaskPaneToolPanelAccess
+ {
+ public:
+ TaskPaneWrapper(
+ Window* i_pParent,
+ sal_uInt16 i_nId,
+ SfxBindings* i_pBindings,
+ SfxChildWinInfo* i_pInfo
+ );
+
+ SFX_DECL_CHILDWINDOW( TaskPaneWrapper );
+
+ // ITaskPaneToolPanelAccess
+ virtual void ActivateToolPanel( const OUString& i_rPanelURL );
+ };
+
+ //==================================================================================================================
+ //= IToolPanelCompare
+ //==================================================================================================================
+ class SFX2_DLLPUBLIC SAL_NO_VTABLE IToolPanelCompare
+ {
+ public:
+ /** compares to tool panel URLs
+ @return
+ <ul>
+ <li>-1 if the tool panel described by i_rLHS should precede the one described by i_rRHS</li>
+ <li>0 if the two panels have no particular relative order</li>
+ <li>1 if the tool panel described by i_rLHS should succeed the one described by i_rRHS</li>
+
+ */
+ virtual short compareToolPanelsURLs(
+ const OUString& i_rLHS,
+ const OUString& i_rRHS
+ ) const = 0;
+
+ protected:
+ ~IToolPanelCompare() {}
+ };
+
+ //==================================================================================================================
+ //= ModuleTaskPane
+ //==================================================================================================================
+ class ModuleTaskPane_Impl;
+ /** SFX-less version of a module dependent task pane, filled with tool panels as specified in the respective
+ module's configuration
+ */
+ class SFX2_DLLPUBLIC ModuleTaskPane : public Window
+ {
+ public:
+ /** creates a new instance
+ @param i_rParentWindow
+ the parent window
+ @param i_rDocumentFrame
+ the frame to which the task pane belongs. Will be passed to any custom tool panels created
+ via an XUIElementFactory. Also, it is used to determine the module which the task pane is
+ responsible for, thus controlling which tool panels are actually available.
+ */
+ ModuleTaskPane(
+ Window& i_rParentWindow,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rDocumentFrame
+ );
+ /** creates a new instance
+ @param i_rParentWindow
+ the parent window
+ @param i_rDocumentFrame
+ the frame to which the task pane belongs. Will be passed to any custom tool panels created
+ via an XUIElementFactory. Also, it is used to determine the module which the task pane is
+ responsible for, thus controlling which tool panels are actually available.
+ @param i_rCompare
+ a comparator for tool panel URLs, which allows controlling the order in which the panels are
+ added to the tool panel deck.
+ */
+ ModuleTaskPane(
+ Window& i_rParentWindow,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rDocumentFrame,
+ const IToolPanelCompare& i_rCompare
+ );
+ ~ModuleTaskPane();
+
+ /** determines whether a given module has any registered tool panels
+ */
+ static bool ModuleHasToolPanels( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rDocumentFrame );
+
+ /** provides access to the Window aspect of the PanelDeck
+
+ Be careful with this method. For instance, you're not allowed to insert arbitrary IToolPanel implementations
+ into the deck, as the ModuleTaskPane has certain assumptions about the panel implementations. However,
+ you're allowed to remove and re-insert panels, which have originally been created by the ModuleTaskPane
+ itself.
+ */
+ ::svt::ToolPanelDeck& GetPanelDeck();
+ const ::svt::ToolPanelDeck& GetPanelDeck() const;
+
+ /** returns the position of the panel with the given resource URL
+ */
+ ::boost::optional< size_t >
+ GetPanelPos( const OUString& i_rResourceURL );
+
+ /** returns the resource URL of the panel at the specified position
+ */
+ OUString
+ GetPanelResourceURL( const size_t i_nPanelPos ) const;
+
+ /// sets the "classical" layout of the tool panel deck, using drawers
+ void SetDrawersLayout();
+ /// sets the new layout of the tool panel deck, using tabs
+ void SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent );
+
+ protected:
+ // Window overridables
+ virtual void Resize();
+ virtual void GetFocus();
+
+ private:
+ ::boost::scoped_ptr< ModuleTaskPane_Impl > m_pImpl;
+ };
+
+ //==================================================================================================================
+ //= TaskPaneController
+ //==================================================================================================================
+ class TaskPaneController_Impl;
+ /** is a helper class for connecting a ModuleTaskPane and a TitledDockingWindow, for clients of the ModuleTaskPane
+ which do not use the TaskPaneDockingWindow
+
+ The controller will add a drop down menu to the docking window which contains one item for each panel in the
+ panel deck, and allows toggling their visibility.
+ */
+ class SFX2_DLLPUBLIC TaskPaneController
+ {
+ public:
+ TaskPaneController(
+ ModuleTaskPane& i_rTaskPane,
+ TitledDockingWindow& i_rDockingWindow
+ );
+ ~TaskPaneController();
+
+ /// activates the panel with the given URL
+ void ActivateToolPanel( const OUString& i_rPanelURL );
+
+ private:
+ ::boost::scoped_ptr< TaskPaneController_Impl > m_pImpl;
+ };
+
+ //==================================================================================================================
+ //= TaskPaneDockingWindow
+ //==================================================================================================================
+ class TaskPaneDockingWindow :public TitledDockingWindow
+ ,public ITaskPaneToolPanelAccess
+ {
+ public:
+ TaskPaneDockingWindow( SfxBindings* i_pBindings, TaskPaneWrapper& i_rWrapper,
+ Window* i_pParent, WinBits i_nBits );
+
+ // ITaskPaneToolPanelAccess
+ virtual void ActivateToolPanel( const OUString& i_rPanelURL );
+
+ protected:
+ // Window overridables
+ virtual void GetFocus();
+
+ // TitledDockingWindow overridables
+ virtual void onLayoutDone();
+
+ private:
+ ModuleTaskPane m_aTaskPane;
+ TaskPaneController m_aPaneController;
+ };
+
+//......................................................................................................................
+} // namespace sfx2
+//......................................................................................................................
+
+#endif // SFX_TASKPANE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/tbxctrl.hxx b/include/sfx2/tbxctrl.hxx
new file mode 100644
index 000000000000..56047d1e32ad
--- /dev/null
+++ b/include/sfx2/tbxctrl.hxx
@@ -0,0 +1,412 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXTBXCTRL_HXX
+#define _SFXTBXCTRL_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include "sal/types.h"
+#include <vcl/timer.hxx>
+#include <vcl/menu.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/floatwin.hxx>
+#include <comphelper/processfactory.hxx>
+#include <sfx2/ctrlitem.hxx>
+#include <sfx2/sfxstatuslistener.hxx>
+#include <svtools/toolboxcontroller.hxx>
+#include <svtools/framestatuslistener.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/awt/XDockableWindowListener.hpp>
+#include <com/sun/star/awt/XDockableWindow.hpp>
+#include <com/sun/star/frame/XSubToolbarController.hpp>
+
+//------------------------------------------------------------------
+
+class SfxToolBoxControl;
+class SfxBindings;
+class SfxModule;
+class SfxUnoControllerItem;
+
+svt::ToolboxController* SAL_CALL SfxToolBoxControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, ToolBox* pToolbox, unsigned short nID, const OUString& aCommandURL );
+
+typedef SfxToolBoxControl* (*SfxToolBoxControlCtor)( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rBox );
+
+struct SfxTbxCtrlFactory
+{
+ SfxToolBoxControlCtor pCtor;
+ TypeId nTypeId;
+ sal_uInt16 nSlotId;
+
+ SfxTbxCtrlFactory( SfxToolBoxControlCtor pTheCtor,
+ TypeId nTheTypeId, sal_uInt16 nTheSlotId ):
+ pCtor(pTheCtor),
+ nTypeId(nTheTypeId),
+ nSlotId(nTheSlotId)
+ {}
+};
+
+//------------------------------------------------------------------
+
+enum SfxPopupWindowType
+{
+ SFX_POPUPWINDOW_NONE,
+ SFX_POPUPWINDOW_ONCLICK,
+ SFX_POPUPWINDOW_ONTIMEOUT,
+ SFX_POPUPWINDOW_ONCLICKANDMOVE,
+ SFX_POPUPWINDOW_ONTIMEOUTANDMOVE,
+ SFX_POPUPWINDOW_CONTEXTMENU
+};
+
+//------------------------------------------------------------------
+
+class SfxFrameStatusListener : public svt::FrameStatusListener
+{
+ public:
+ SfxFrameStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame,
+ SfxStatusListenerInterface* pCallee );
+ virtual ~SfxFrameStatusListener();
+
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ private:
+ SfxStatusListenerInterface* m_pCallee;
+};
+
+//------------------------------------------------------------------
+
+/* Floating windows that can be torn from tool boxes should be derived from
+ this class. Since it is also derived from SfxControllerItem, its instances
+ will also receive the StateChanged calls.
+*/
+
+class SFX2_DLLPUBLIC SfxPopupWindow: public FloatingWindow, public SfxStatusListenerInterface
+{
+ sal_Bool m_bFloating;
+ sal_uIntPtr m_nEventId;
+ sal_Bool m_bCascading;
+ Link m_aDeleteLink;
+ sal_uInt16 m_nId;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
+ SfxFrameStatusListener* m_pStatusListener;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xStatusListener;
+
+private:
+ SfxFrameStatusListener* GetOrCreateStatusListener();
+
+ SAL_DLLPRIVATE SfxPopupWindow(SfxPopupWindow &); // not defined
+ SAL_DLLPRIVATE void operator =(SfxPopupWindow &); // not defined
+ void Delete();
+
+protected:
+ virtual void PopupModeEnd();
+ virtual sal_Bool Close();
+ virtual void DeleteFloatingWindow();
+
+ sal_uInt16 GetId() const { return m_nId; }
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& GetFrame() const { return m_xFrame; }
+
+ void BindListener();
+ void UnbindListener();
+ void AddStatusListener( const OUString& rCommandURL );
+
+ // SfxStatusListenerInterface
+ using FloatingWindow::StateChanged;
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+
+public:
+ SfxPopupWindow( sal_uInt16 nId,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ WinBits nBits );
+ SfxPopupWindow( sal_uInt16 nId,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ const ResId &rId );
+ SfxPopupWindow( sal_uInt16 nId,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ Window* pParentWindow,
+ WinBits nBits );
+ ~SfxPopupWindow();
+
+ virtual SfxPopupWindow* Clone() const;
+ virtual void MouseMove( const MouseEvent& rMEvt );
+
+ void StartCascading();
+ SAL_DLLPRIVATE void SetDeleteLink_Impl( const Link& rLink )
+ {
+ m_aDeleteLink = rLink;
+ }
+};
+
+//------------------------------------------------------------------
+
+#define SFX_DECL_TOOLBOX_CONTROL() \
+ static SfxToolBoxControl* CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx ); \
+ static void RegisterControl(sal_uInt16 nSlotId = 0, SfxModule *pMod=NULL)
+
+/* For special ToolBox controls, such as a font selection box or toolbox
+ tear-off floating windows, an appropriate Item-Subclass of SfxTooBoxControl
+ has to be implemented.
+
+ This class has to be registered in SfxApplication:Init() with the static
+ control method RegisterControl(). The SFx then automatically creates these
+ controls in the toolbox, if the associated slots are of the specific type.
+ */
+
+struct SfxToolBoxControl_Impl;
+class SFX2_DLLPUBLIC SfxToolBoxControl:
+ public ::com::sun::star::awt::XDockableWindowListener,
+ public ::com::sun::star::frame::XSubToolbarController,
+ public svt::ToolboxController
+
+{
+friend class SfxToolbox;
+friend class SfxPopupWindow;
+friend struct SfxTbxCtrlFactory;
+
+ SfxToolBoxControl_Impl* pImpl;
+
+protected:
+ DECL_LINK( PopupModeEndHdl, void * );
+ DECL_LINK( ClosePopupWindow, SfxPopupWindow * );
+
+ // old SfxToolBoxControl methods
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+ virtual void Select( sal_Bool bMod1 = sal_False );
+ virtual void Select( sal_uInt16 nModifier );
+
+ virtual void DoubleClick();
+ virtual void Click();
+ virtual SfxPopupWindowType GetPopupWindowType() const;
+ virtual SfxPopupWindow* CreatePopupWindow();
+ virtual SfxPopupWindow* CreatePopupWindowCascading();
+ virtual Window* CreateItemWindow( Window *pParent );
+
+ // Must be called by subclass to set a new popup window instance
+ void SetPopupWindow( SfxPopupWindow* pWindow );
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // XEventListener
+ using ::cppu::OPropertySetHelper::disposing;
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& aEvent ) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XComponent
+ virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
+
+ // new controller API
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XToolbarController
+ virtual void SAL_CALL execute( sal_Int16 KeyModifier )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL click()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL doubleClick()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& rParent )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XSubToolbarController
+ virtual ::sal_Bool SAL_CALL opensSubToolbar( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getSubToolbarName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL functionSelected( const OUString& aCommand ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateImage( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XDockableWindowListener
+ virtual void SAL_CALL startDocking( const ::com::sun::star::awt::DockingEvent& e ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::DockingData SAL_CALL docking( const ::com::sun::star::awt::DockingEvent& e ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endDocking( const ::com::sun::star::awt::EndDockingEvent& e ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL prepareToggleFloatingMode( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL toggleFloatingMode( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL closed( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endPopupMode( const ::com::sun::star::awt::EndPopupModeEvent& e ) throw (::com::sun::star::uno::RuntimeException);
+
+ // helper methods
+ void createAndPositionSubToolBar( const OUString& rSubToolBarResName );
+ ::Size getPersistentFloatingSize( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, const OUString& rSubToolBarResName );
+
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ SfxToolBoxControl( sal_uInt16 nSlotID, sal_uInt16 nId, ToolBox& rBox, sal_Bool bShowStrings = sal_False );
+ virtual ~SfxToolBoxControl();
+
+ ToolBox& GetToolBox() const;
+ unsigned short GetId() const;
+ unsigned short GetSlotId() const;
+
+ void Dispatch( const OUString& aCommand,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs );
+ static void Dispatch( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& rDispatchProvider,
+ const OUString& rCommand,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs );
+
+ static SfxItemState GetItemState( const SfxPoolItem* pState );
+ static SfxToolBoxControl* CreateControl( sal_uInt16 nSlotId, sal_uInt16 nTbxId, ToolBox *pBox, SfxModule *pMod );
+ static void RegisterToolBoxControl( SfxModule*, SfxTbxCtrlFactory*);
+};
+
+#define SFX_IMPL_TOOLBOX_CONTROL(Class, nItemClass) \
+ SfxToolBoxControl* Class::CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx ) \
+ { return new Class( nSlotId, nId, rTbx ); } \
+ void Class::RegisterControl(sal_uInt16 nSlotId, SfxModule *pMod) \
+ { SfxToolBoxControl::RegisterToolBoxControl( pMod, new SfxTbxCtrlFactory( \
+ Class::CreateImpl, TYPE(nItemClass), nSlotId ) ); }
+
+#define SFX_IMPL_TOOLBOX_CONTROL_ARG(Class, nItemClass, Arg) \
+ SfxToolBoxControl* Class::CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx ) \
+ { return new Class( nSlotId, nId, rTbx, Arg); } \
+ void Class::RegisterControl(sal_uInt16 nSlotId, SfxModule *pMod) \
+ { SfxToolBoxControl::RegisterToolBoxControl( pMod, new SfxTbxCtrlFactory( \
+ Class::CreateImpl, TYPE(nItemClass), nSlotId ) ); }
+
+//=========================================================================
+
+
+class SfxDragButton_Impl : public FixedImage
+{
+public:
+
+ SfxDragButton_Impl( Window *pParent );
+ virtual void Command ( const CommandEvent& rCEvt );
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+};
+
+class SfxDragToolBoxControl_Impl : public SfxToolBoxControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SfxDragToolBoxControl_Impl( sal_uInt16 nId, ToolBox& rBox );
+ virtual Window* CreateItemWindow( Window *pParent );
+ using SfxToolBoxControl::Select;
+ virtual void Select( sal_Bool bMod1 = sal_False );
+};
+
+//------------------------------------------------------------------------
+
+class SfxAppToolBoxControl_Impl : public SfxToolBoxControl
+
+/* [Description]
+
+ Internal helper class for the pop-up menu <AppMenu_Impl> under new
+ start in the SDT.
+*/
+
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SfxAppToolBoxControl_Impl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rBox );
+ ~SfxAppToolBoxControl_Impl();
+ void SetImage( const String& rFacName );
+
+ struct ExecuteInfo
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch;
+ ::com::sun::star::util::URL aTargetURL;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs;
+ };
+
+ DECL_STATIC_LINK( SfxAppToolBoxControl_Impl, ExecuteHdl_Impl, ExecuteInfo* );
+
+protected:
+ virtual void Click();
+ using SfxToolBoxControl::Select;
+ virtual void Select( sal_Bool );
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+ virtual SfxPopupWindow* CreatePopupWindow();
+ DECL_LINK( Activate, Menu * );
+private:
+ String aLastURL;
+ PopupMenu* pMenu;
+ sal_uIntPtr m_nSymbolsStyle;
+ sal_Bool m_bShowMenuImages;
+};
+
+class SfxHistoryToolBoxControl_Impl : public SfxToolBoxControl
+{
+ Timer aTimer;
+
+private:
+ DECL_LINK( Timeout, Timer * );
+
+protected:
+ virtual void Click( );
+ using SfxToolBoxControl::Select;
+ virtual void Select( sal_Bool );
+
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SfxHistoryToolBoxControl_Impl( sal_uInt16 nId, ToolBox& rBox );
+};
+
+class SfxReloadToolBoxControl_Impl : public SfxToolBoxControl
+{
+ protected:
+ using SfxToolBoxControl::Select;
+ virtual void Select( sal_uInt16 nSelectModifier );
+
+ public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SfxReloadToolBoxControl_Impl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rBox );
+};
+
+class SfxPopupMenuManager;
+class SfxAddonsToolBoxControl_Impl : public SfxToolBoxControl
+
+/* [Description]
+
+ Internal helper class to provide the addons popup menu through the addons
+ toolbox button.
+*/
+
+{
+ sal_Bool bBigImages;
+ PopupMenu* pMenu;
+ sal_Bool m_bShowMenuImages;
+
+protected:
+ virtual void Click();
+ using SfxToolBoxControl::Select;
+ virtual void Select( sal_Bool );
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+ DECL_LINK( Activate, Menu * );
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SfxAddonsToolBoxControl_Impl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rBox );
+ ~SfxAddonsToolBoxControl_Impl();
+
+ void RefreshMenuImages( Menu* pMenu );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/templateabstractview.hxx b/include/sfx2/templateabstractview.hxx
new file mode 100644
index 000000000000..5f1eca6a80fa
--- /dev/null
+++ b/include/sfx2/templateabstractview.hxx
@@ -0,0 +1,147 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef __SFX2_TEMPLATEABSTRACTVIEW_HXX__
+#define __SFX2_TEMPLATEABSTRACTVIEW_HXX__
+
+#include <sfx2/templateproperties.hxx>
+#include <sfx2/thumbnailview.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+
+//template thumbnail item defines
+#define TEMPLATE_ITEM_MAX_WIDTH 160
+#define TEMPLATE_ITEM_MAX_HEIGHT 140
+#define TEMPLATE_ITEM_PADDING 5
+#define TEMPLATE_ITEM_MAX_TEXT_LENGTH 20
+#define TEMPLATE_ITEM_THUMBNAIL_MAX_HEIGHT 88
+
+//template thumbnail height with a subtitle
+#define TEMPLATE_ITEM_MAX_HEIGHT_SUB 160
+
+//template thumbnail image defines
+#define TEMPLATE_THUMBNAIL_MAX_HEIGHT TEMPLATE_ITEM_THUMBNAIL_MAX_HEIGHT - 2*TEMPLATE_ITEM_PADDING
+#define TEMPLATE_THUMBNAIL_MAX_WIDTH TEMPLATE_ITEM_MAX_WIDTH - 2*TEMPLATE_ITEM_PADDING
+
+class SfxDocumentTemplates;
+
+enum FILTER_APPLICATION
+{
+ FILTER_APP_NONE,
+ FILTER_APP_WRITER,
+ FILTER_APP_CALC,
+ FILTER_APP_IMPRESS,
+ FILTER_APP_DRAW
+};
+
+// Display template items depending on the generator application
+class ViewFilter_Application
+{
+public:
+
+ ViewFilter_Application (FILTER_APPLICATION App)
+ : mApp(App)
+ {}
+
+ virtual ~ViewFilter_Application () {}
+
+ virtual bool operator () (const ThumbnailViewItem *pItem);
+
+ bool isValid (const OUString& rPath) const;
+
+protected:
+
+ FILTER_APPLICATION mApp;
+};
+
+class ViewFilter_Keyword
+{
+public:
+
+ ViewFilter_Keyword (const OUString &rKeyword)
+ : maKeyword(rKeyword)
+ {}
+
+ bool operator () (const ThumbnailViewItem *pItem);
+
+private:
+
+ OUString maKeyword;
+};
+
+class SFX2_DLLPUBLIC TemplateAbstractView : public ThumbnailView
+{
+public:
+
+ TemplateAbstractView (Window *pParent, WinBits nWinStyle, bool bDisableTransientChildren);
+
+ TemplateAbstractView ( Window* pParent, const ResId& rResId, bool bDisableTransientChildren = false );
+
+ virtual ~TemplateAbstractView ();
+
+ void insertItem (const TemplateItemProperties &rTemplate);
+
+ // Fill view with new item list
+ void insertItems (const std::vector<TemplateItemProperties> &rTemplates);
+
+ // Fill view with template folders thumbnails
+ virtual void Populate () { }
+
+ virtual void reload () { }
+
+ virtual void showRootRegion () = 0;
+
+ virtual void showRegion (ThumbnailViewItem *pItem) = 0;
+
+ virtual sal_uInt16 createRegion (const OUString &rName) = 0;
+
+ // Return if we can have regions inside the current region
+ virtual bool isNestedRegionAllowed () const = 0;
+
+ // Return if we can import templates to the current region
+ virtual bool isImportAllowed () const = 0;
+
+ sal_uInt16 getCurRegionId () const;
+
+ const OUString& getCurRegionName () const;
+
+ // Check if the root region is visible or not.
+ bool isNonRootRegionVisible () const;
+
+ void setOpenRegionHdl(const Link &rLink);
+
+ void setOpenTemplateHdl (const Link &rLink);
+
+ static BitmapEx scaleImg (const BitmapEx &rImg, long width, long height);
+
+ static BitmapEx getDefaultThumbnail( const OUString& rPath );
+
+ static BitmapEx fetchThumbnail (const OUString &msURL, long width, long height);
+
+protected:
+
+ DECL_LINK(ShowRootRegionHdl, void*);
+
+ virtual void OnItemDblClicked(ThumbnailViewItem *pItem);
+
+protected:
+
+ sal_uInt16 mnCurRegionId;
+ OUString maCurRegionName;
+
+ PushButton maAllButton;
+ FixedText maFTName;
+
+ Link maOpenRegionHdl;
+ Link maOpenTemplateHdl;
+};
+
+#endif // __SFX2_TEMPLATEABSTRACTVIEW_HXX__
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/templatecontaineritem.hxx b/include/sfx2/templatecontaineritem.hxx
new file mode 100644
index 000000000000..527571c80cac
--- /dev/null
+++ b/include/sfx2/templatecontaineritem.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Copyright 2012 LibreOffice contributors.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef TEMPLATEFOLDERVIEWITEM_HXX
+#define TEMPLATEFOLDERVIEWITEM_HXX
+
+#include <sfx2/templateproperties.hxx>
+#include <sfx2/thumbnailviewitem.hxx>
+
+class TemplateContainerItem : public ThumbnailViewItem
+{
+public:
+
+ sal_uInt16 mnRegionId;
+ BitmapEx maPreview2;
+ BitmapEx maPreview3;
+ BitmapEx maPreview4;
+ std::vector<TemplateItemProperties> maTemplates;
+
+ TemplateContainerItem (ThumbnailView &rView);
+
+ virtual ~TemplateContainerItem ();
+
+ virtual void Paint (drawinglayer::processor2d::BaseProcessor2D *pProcessor,
+ const ThumbnailItemAttributes *pAttrs);
+
+ virtual void calculateItemsPosition (const long nThumbnailHeight, const long nDisplayHeight,
+ const long nPadding, sal_uInt32 nMaxTextLenght,
+ const ThumbnailItemAttributes *pAttrs);
+
+ bool HasMissingPreview( );
+
+private:
+
+ Rectangle maThumbnailArea;
+};
+
+#endif // TEMPLATEFOLDERVIEWITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/templateinfodlg.hxx b/include/sfx2/templateinfodlg.hxx
new file mode 100644
index 000000000000..69d79b20da9a
--- /dev/null
+++ b/include/sfx2/templateinfodlg.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+* This file is part of the LibreOffice project.
+*
+* This Source Code Form is subject to the terms of the Mozilla Public
+* License, v. 2.0. If a copy of the MPL was not distributed with this
+* file, You can obtain one at http://mozilla.org/MPL/2.0/.
+*/
+
+#ifndef __SFX2_TEMPLATEINFODLG_HXX__
+#define __SFX2_TEMPLATEINFODLG_HXX__
+
+#include <vcl/dialog.hxx>
+#include <vcl/button.hxx>
+
+namespace svtools {
+ class ODocumentInfoPreview;
+}
+
+namespace com{ namespace sun { namespace star { namespace awt { class XWindow; } } } }
+namespace com{ namespace sun { namespace star { namespace frame { class XFrame2; } } } }
+
+class SfxTemplateInfoDlg : public ModalDialog
+{
+public:
+
+ SfxTemplateInfoDlg (Window *pParent = NULL);
+
+ ~SfxTemplateInfoDlg ();
+
+ void loadDocument (const OUString &rURL);
+
+protected:
+
+ DECL_LINK (CloseHdl, void*);
+
+private:
+
+ PushButton maBtnClose;
+
+ Window *mpPreviewView; // gets released when xWindows get destroyed (dont delete in constructor)
+ svtools::ODocumentInfoPreview *mpInfoView;
+
+ ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame2 > m_xFrame;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xWindow;
+};
+
+#endif // __SFX2_TEMPLATEINFODLG_HXX__
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/templatelocalview.hxx b/include/sfx2/templatelocalview.hxx
new file mode 100644
index 000000000000..6cefaf1782c0
--- /dev/null
+++ b/include/sfx2/templatelocalview.hxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Copyright 2012 LibreOffice contributors.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef TEMPLATEFOLDERVIEW_HXX
+#define TEMPLATEFOLDERVIEW_HXX
+
+#include <set>
+
+#include <sfx2/templateabstractview.hxx>
+
+class SfxDocumentTemplates;
+class TemplateContainerItem;
+
+namespace com {
+ namespace sun { namespace star { namespace frame {
+ class XModel;
+ } } }
+}
+
+class SFX2_DLLPUBLIC TemplateLocalView : public TemplateAbstractView
+{
+ typedef bool (*selection_cmp_fn)(const ThumbnailViewItem*,const ThumbnailViewItem*);
+
+public:
+
+ TemplateLocalView ( Window* pParent, const ResId& rResId, bool bDisableTransientChildren = false );
+
+ virtual ~TemplateLocalView ();
+
+ // Fill view with template folders thumbnails
+ virtual void Populate ();
+
+ virtual void reload ();
+
+ virtual void showRootRegion ();
+
+ virtual void showRegion (ThumbnailViewItem *pItem);
+
+ void showRegion (const OUString &rName);
+
+ sal_uInt16 getCurRegionItemId () const;
+
+ sal_uInt16 getRegionId (size_t pos) const;
+
+ OUString getRegionName(const sal_uInt16 nRegionId) const;
+
+ OUString getRegionItemName(const sal_uInt16 nItemId) const;
+
+ std::vector<OUString> getFolderNames ();
+
+ std::vector<TemplateItemProperties>
+ getFilteredItems (const boost::function<bool (const TemplateItemProperties&) > &rFunc) const;
+
+ virtual sal_uInt16 createRegion (const OUString &rName);
+
+ virtual bool isNestedRegionAllowed () const;
+
+ virtual bool isImportAllowed () const;
+
+ bool removeRegion (const sal_uInt16 nItemId);
+
+ bool removeTemplate (const sal_uInt16 nItemId, const sal_uInt16 nSrcItemId);
+
+ bool moveTemplate (const ThumbnailViewItem* pItem, const sal_uInt16 nSrcItem,
+ const sal_uInt16 nTargetItem);
+
+ bool moveTemplates (const std::set<const ThumbnailViewItem*,selection_cmp_fn> &rItems, const sal_uInt16 nTargetItem);
+
+ bool copyFrom (const sal_uInt16 nRegionItemId, const BitmapEx &rThumbnail, const OUString &rPath);
+
+ // Import a template to the current region
+ bool copyFrom (const OUString &rPath);
+
+ bool copyFrom(TemplateContainerItem *pItem, const OUString &rPath);
+
+ bool exportTo (const sal_uInt16 nItemId, const sal_uInt16 nRegionItemId, const OUString &rName);
+
+ bool saveTemplateAs (sal_uInt16 nItemId,
+ com::sun::star::uno::Reference<com::sun::star::frame::XModel> &rModel,
+ const OUString &rName);
+
+ bool saveTemplateAs (TemplateContainerItem *pDstItem,
+ com::sun::star::uno::Reference<com::sun::star::frame::XModel> &rModel,
+ const OUString &rName);
+
+ bool isTemplateNameUnique (const sal_uInt16 nRegionItemId, const OUString &rName) const;
+
+ virtual bool renameItem(ThumbnailViewItem* pItem, OUString sNewTitle);
+
+private:
+
+ SfxDocumentTemplates *mpDocTemplates;
+ std::vector<TemplateContainerItem* > maRegions;
+};
+
+#endif // TEMPLATEFOLDERVIEW_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/templatelocnames.hrc b/include/sfx2/templatelocnames.hrc
new file mode 100644
index 000000000000..7d3c52798461
--- /dev/null
+++ b/include/sfx2/templatelocnames.hrc
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ * Péter Rabi <prabi@caesar.elte.hu>
+ * Portions created by the Initial Developer are Copyright (C) 2011 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#define NUM_TEMPLATE_NAMES 10
+#define TEMPL_LOC_OFFSET 2190
+
+#define STR_TEMPLATE_NAME1_DEF (TEMPL_LOC_OFFSET + 1)
+#define STR_TEMPLATE_NAME2_DEF (TEMPL_LOC_OFFSET + 2)
+#define STR_TEMPLATE_NAME3_DEF (TEMPL_LOC_OFFSET + 3)
+#define STR_TEMPLATE_NAME4_DEF (TEMPL_LOC_OFFSET + 4)
+#define STR_TEMPLATE_NAME5_DEF (TEMPL_LOC_OFFSET + 5)
+#define STR_TEMPLATE_NAME6_DEF (TEMPL_LOC_OFFSET + 6)
+#define STR_TEMPLATE_NAME7_DEF (TEMPL_LOC_OFFSET + 7)
+#define STR_TEMPLATE_NAME8_DEF (TEMPL_LOC_OFFSET + 8)
+#define STR_TEMPLATE_NAME9_DEF (TEMPL_LOC_OFFSET + 9)
+#define STR_TEMPLATE_NAME10_DEF (TEMPL_LOC_OFFSET + 10)
+
+#define STR_TEMPLATE_NAME1 (TEMPL_LOC_OFFSET + 51)
+#define STR_TEMPLATE_NAME2 (TEMPL_LOC_OFFSET + 52)
+#define STR_TEMPLATE_NAME3 (TEMPL_LOC_OFFSET + 53)
+#define STR_TEMPLATE_NAME4 (TEMPL_LOC_OFFSET + 54)
+#define STR_TEMPLATE_NAME5 (TEMPL_LOC_OFFSET + 55)
+#define STR_TEMPLATE_NAME6 (TEMPL_LOC_OFFSET + 56)
+#define STR_TEMPLATE_NAME7 (TEMPL_LOC_OFFSET + 57)
+#define STR_TEMPLATE_NAME8 (TEMPL_LOC_OFFSET + 58)
+#define STR_TEMPLATE_NAME9 (TEMPL_LOC_OFFSET + 59)
+#define STR_TEMPLATE_NAME10 (TEMPL_LOC_OFFSET + 60)
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/templateproperties.hxx b/include/sfx2/templateproperties.hxx
new file mode 100644
index 000000000000..f0db901073f0
--- /dev/null
+++ b/include/sfx2/templateproperties.hxx
@@ -0,0 +1,29 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Copyright 2012 LibreOffice contributors.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef __SFX2_TEMPLATEPROPERTIES_HXX__
+#define __SFX2_TEMPLATEPROPERTIES_HXX__
+
+#include <rtl/ustring.hxx>
+#include <vcl/bitmapex.hxx>
+
+struct TemplateItemProperties
+{
+ bool aIsFolder;
+ sal_uInt16 nId; ///< Index for ThumbnailView
+ sal_uInt16 nDocId; ///< Index based on SfxTemplateDocument
+ sal_uInt16 nRegionId;
+ OUString aName;
+ OUString aPath;
+ BitmapEx aThumbnail;
+};
+
+#endif // __SFX2_TEMPLATEPROPERTIES_HXX__
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/templateremoteview.hxx b/include/sfx2/templateremoteview.hxx
new file mode 100644
index 000000000000..bcb2b68fc0a4
--- /dev/null
+++ b/include/sfx2/templateremoteview.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef __SFX2_TEMPLATEREMOTEVIEW_HXX__
+#define __SFX2_TEMPLATEREMOTEVIEW_HXX__
+
+#include <sfx2/templateabstractview.hxx>
+#include <sfx2/templateproperties.hxx>
+
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+
+class TemplateRepository;
+
+class TemplateRemoteView : public TemplateAbstractView
+{
+public:
+
+ TemplateRemoteView (Window *pParent, WinBits nWinStyle, bool bDisableTransientChildren);
+
+ virtual ~TemplateRemoteView ();
+
+ virtual void showRootRegion ();
+
+ virtual void showRegion (ThumbnailViewItem *pItem);
+
+ bool loadRepository (TemplateRepository* pRepository, bool bRefresh);
+
+ virtual sal_uInt16 createRegion (const OUString &rName);
+
+ virtual bool isNestedRegionAllowed () const;
+
+ virtual bool isImportAllowed () const;
+
+private:
+
+ com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > m_xCmdEnv;
+};
+
+#endif // __SFX2_TEMPLATEREMOTEVIEW_HXX__
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/templaterepository.hxx b/include/sfx2/templaterepository.hxx
new file mode 100644
index 000000000000..f134c9897bf6
--- /dev/null
+++ b/include/sfx2/templaterepository.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef __SFX2_TEMPLATEREPOSITORY_HXX__
+#define __SFX2_TEMPLATEREPOSITORY_HXX__
+
+#include <sfx2/templateproperties.hxx>
+
+class TemplateRepository
+{
+public:
+
+ TemplateRepository () : mnId(0) { };
+
+ virtual ~TemplateRepository () { };
+
+ void setURL (const OUString &rURL) { maUrl = rURL; }
+
+ const OUString& getURL () const { return maUrl; }
+
+ void insertTemplate (const TemplateItemProperties &prop) { maTemplates.push_back(prop); }
+
+ void clearTemplates () { maTemplates.clear(); }
+
+ const std::vector<TemplateItemProperties>& getTemplates () const { return maTemplates; }
+
+public:
+
+ sal_uInt16 mnId;
+ OUString maTitle;
+
+private:
+
+ OUString maUrl;
+ std::vector<TemplateItemProperties> maTemplates;
+};
+
+#endif // __SFX2_TEMPLATEREPOSITORY_HXX__
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/templateviewitem.hxx b/include/sfx2/templateviewitem.hxx
new file mode 100644
index 000000000000..efabd34ea4fd
--- /dev/null
+++ b/include/sfx2/templateviewitem.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Copyright 2012 LibreOffice contributors.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef TEMPLATEVIEWITEM_HXX
+#define TEMPLATEVIEWITEM_HXX
+
+#include <sfx2/thumbnailviewitem.hxx>
+
+class TemplateViewItem : public ThumbnailViewItem
+{
+public:
+
+ TemplateViewItem (ThumbnailView &rView);
+
+ virtual ~TemplateViewItem ();
+
+ void setPath (const OUString &rPath) { maPath = rPath; }
+
+ const OUString& getPath () const { return maPath; }
+
+ void setAuthor (const OUString &rAuthor) { maAuthor = rAuthor; }
+
+ const OUString& getAuthor () const { return maAuthor; }
+
+ void setKeywords (const OUString &rKeywords) { maKeywords = rKeywords; }
+
+ const OUString& getKeywords () const { return maKeywords; }
+
+ void setSubTitle (const OUString &rTitle) { maSubTitle = rTitle; }
+
+ const OUString& getSubTitle () const { return maSubTitle; }
+
+ virtual void calculateItemsPosition (const long nThumbnailHeight, const long nDisplayHeight,
+ const long nPadding, sal_uInt32 nMaxTextLenght,
+ const ThumbnailItemAttributes *pAttrs);
+
+ virtual void Paint (drawinglayer::processor2d::BaseProcessor2D *pProcessor,
+ const ThumbnailItemAttributes *pAttrs);
+
+ sal_uInt16 mnRegionId;
+ sal_uInt16 mnDocId;
+
+private:
+
+ OUString maPath;
+ OUString maAuthor;
+ OUString maKeywords;
+ OUString maSubTitle;
+
+ Point maSubTitlePos;
+};
+
+#endif // TEMPLATEVIEWITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/templdlg.hxx b/include/sfx2/templdlg.hxx
new file mode 100644
index 000000000000..e9fb3a5e4c51
--- /dev/null
+++ b/include/sfx2/templdlg.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX_TEMPLDLG_HXX
+#define _SFX_TEMPLDLG_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+
+#include <rsc/rscsfx.hxx>
+
+#include <sfx2/dockwin.hxx>
+#include <sfx2/childwin.hxx>
+#include <sfx2/basedlgs.hxx>
+
+class SfxTemplateDialog_Impl;
+
+// class ISfxTemplateCommon ----------------------------------------------
+
+class ISfxTemplateCommon
+{
+public:
+ virtual SfxStyleFamily GetActualFamily() const = 0;
+ virtual String GetSelectedEntry() const = 0;
+
+protected:
+ ~ISfxTemplateCommon() {}
+};
+
+// class SfxTemplateDialog -----------------------------------------------
+
+class SfxTemplateDialog : public SfxDockingWindow
+{
+private:
+friend class SfxTemplateDialogWrapper;
+friend class SfxTemplateDialog_Impl;
+
+ SfxTemplateDialog_Impl* pImpl;
+
+ virtual void DataChanged( const DataChangedEvent& _rDCEvt );
+ virtual void Resize();
+ virtual SfxChildAlignment CheckAlignment( SfxChildAlignment, SfxChildAlignment );
+ virtual void StateChanged( StateChangedType nStateChange );
+
+public:
+ SfxTemplateDialog( SfxBindings*, SfxChildWindow*, Window* );
+ ~SfxTemplateDialog();
+
+ virtual void Update();
+
+ ISfxTemplateCommon* GetISfxTemplateCommon();
+ void SetParagraphFamily();
+};
+
+// class SfxTemplateDialogWrapper ----------------------------------------
+
+class SFX2_DLLPUBLIC SfxTemplateDialogWrapper : public SfxChildWindow
+{
+public:
+ SfxTemplateDialogWrapper
+ (Window*,sal_uInt16,SfxBindings*,SfxChildWinInfo*);
+ SFX_DECL_CHILDWINDOW_WITHID(SfxTemplateDialogWrapper);
+
+ void SetParagraphFamily();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/thumbnailview.hxx b/include/sfx2/thumbnailview.hxx
new file mode 100644
index 000000000000..2bdf1b94ae09
--- /dev/null
+++ b/include/sfx2/thumbnailview.hxx
@@ -0,0 +1,332 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Copyright 2012 LibreOffice contributors.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef THUMBNAILVIEW_HXX
+#define THUMBNAILVIEW_HXX
+
+#include "sfx2/dllapi.h"
+
+#include <vector>
+#include <boost/function.hpp>
+
+#include <sfx2/thumbnailviewitem.hxx>
+#include <vcl/ctrl.hxx>
+#include <vcl/timer.hxx>
+
+class BitmapEx;
+class MouseEvent;
+class TrackingEvent;
+class HelpEvent;
+class KeyEvent;
+class DataChangedEvent;
+class ScrollBar;
+typedef ::std::vector< ThumbnailViewItem* > ValueItemList;
+
+struct ThumbnailItemAttributes;
+class ThumbnailViewAcc;
+class ThumbnailViewItemAcc;
+
+namespace drawinglayer {
+ namespace processor2d {
+ class BaseProcessor2D;
+ }
+}
+
+/*************************************************************************
+
+ Description
+ ============
+
+ class ThumbnailView
+
+ This class allows the selection of an item. In the process items are
+ drawn side by side. The selection of items can be more clear than in a
+ ListBox shape for example in case of colors or samples.
+ The amount of columns drawn by the control and whether the items
+ should be encircled can be specified. Optional a NoSelection or name
+ field could be shown. By default image and color items are supported.
+ Items could be drawn by oneself if InsertItem() is only called with
+ an ID. To achieve this the UserDraw handler needs to be overloaded. The
+ description text could be specified afterwards in case of UserDraw
+ and any other items.
+
+ Cross references
+
+ class ListBox
+
+ --------------------------------------------------------------------------
+
+ WinBits
+
+ WB_VSCROLL A scroolbar will be always shown. The visible number of
+ lines have to be specified with SetLineCount() if this
+ flag is set.
+ WB_TABSTOP It is possible to jump into the ValueSet with the tab key.
+ WB_NOTABSTOP It is not possible to jump into the ValueSet with the
+ tab key.
+ --------------------------------------------------------------------------
+
+ The number of columns must be either set with SetColCount() or
+ SetItemWidth(). If the number of colums is specified by SetColCount()
+ the width of the items will be calculated by the visible range.
+ If the items should have a static width, it has to be specified
+ with SetItemWidth(). In this case the number of columns will be calculated
+ by the visible range.
+
+ The number of rows is given by the number of items / number of columns. The
+ number of visible rows must either specified by SetLineCount() or
+ SetItemWidth(). If the number of visible rows is specified by SetLineCount(),
+ the height of the items will be calculated from the visible height. If the
+ items should have a fixed height it has to be specified with SetItemHeight().
+ In this case the number of visible rows is then calculated from the visible
+ height. If the number of visible rows is neither specified by SetLineCount()
+ nor by SetItemHeight() all rows will be shown. The height of the items will
+ be calculated by the visible height. If the number of visible rows is
+ specified by SetLineCount() or SetItemHeight() ValueSet does scroll
+ automatically when more lines are available, as are visible. If scrolling
+ should be also possible with a ScrollBar WB_VSCROLL needs to be set.
+
+ The distance between the items can be increased by SetExtraSpacing(). The
+ distance, which will be shown between two items (both in x and in y), is
+ measured in pixels.
+
+ The exact window size for a specific item size can be calculated by
+ CalcWindowSizePixel(). To do this all relevant data (number of columns/...)
+ have to be specified and if no number of rows was set, all items need to
+ be inserted. If the window was created with WB_BORDER/Border=sal_True the
+ size has to be specified with SetOutputSizePixel(). In other cases different
+ size-methods can be used. With CalcItemSize() the inner and outer size of
+ an item could be calculated (for this the free space defined by
+ SetExtraSpacing() will not be included).
+
+ The background color could be specified by SetColor(), with which the image
+ or UserDraw items will be underlayed. If no color is specified the color
+ of other windows (WindowColor) will be used for the background.
+
+ --------------------------------------------------------------------------
+
+ At first all items should be inserted and only then Show() should be called
+ since the output area will be precomputed. If this is not done the first
+ Paint will appear a little bit slower. Therefore the Control, if it is loaded
+ from the resource and only supplied with items during runtime, should be
+ loaded with Hide = sal_True and then displayed with Show().
+
+ In case of a visible Control the creation of the new output area could be
+ activated before Paint by calling Format().
+
+ --------------------------------------------------------------------------
+
+ If Drag and Drop will be called from the ValueSet the Command-Handler has to
+ be overloaded. From this StartDrag needs to be called. If this method returns
+ sal_True the drag-process could be initiated by ExecuteDrag(), otherwise no
+ processing will take place. This method makes sure that ValueSet stops its
+ processing and as appropriate selects the entry. Therefore the calling of
+ Select-Handler within this function must be expected.
+
+ For dropping QueryDrop() and Drop() need to be overloaded and ShowDropPos()
+ and HideDropPos() should be called within these methods.
+ To show the insertion point ShowDropPos() has to be called within the
+ QueryDrop-Handler. ShowDropPos() also scrolls the ValueSet if the passed
+ position is located at the window border. Furthermore ShowDropPos() returns
+ the position, at which the item should be inserted respectively which
+ insertion point was shown. If no insertion point was determined
+ VALUESET_ITEM_NOTFOUND will be returned. If the window was left during dragging
+ or the drag process is terminated HideDropPos() should be called in any case.
+
+ --------------------------------------------------------------------------
+
+ This class is currently still in the SV-Tools. That's why the ValueSet needs
+ to be loaded as a Control out of the resource and the desired WinBits have
+ to be set (before Show) with SetStyle().
+
+*************************************************************************/
+
+/* ThumbnailView types */
+
+#define THUMBNAILVIEW_APPEND ((sal_uInt16)-1)
+#define THUMBNAILVIEW_ITEM_NOTFOUND ((sal_uInt16)-1)
+
+// Display all the available items in the thumbnail.
+class ViewFilterAll
+{
+public:
+
+ bool operator () (const ThumbnailViewItem*) const
+ {
+ return true;
+ }
+};
+
+/**
+ *
+ * Class to display thumbnails with their names below their respective icons
+ *
+ **/
+
+class SFX2_DLLPUBLIC ThumbnailView : public Control
+{
+public:
+
+ ThumbnailView ( Window* pParent, WinBits nWinStyle = WB_TABSTOP, bool bDisableTransientChildren = false );
+
+ ThumbnailView ( Window* pParent, const ResId& rResId, bool bDisableTransientChildren = false );
+
+ virtual ~ThumbnailView ();
+
+ void AppendItem (ThumbnailViewItem *pItem);
+
+ void RemoveItem( sal_uInt16 nItemId );
+
+ void Clear();
+
+ // Change current thumbnail item list with new one (invalidates all pointers to a thumbnail item)
+ void updateItems(const std::vector<ThumbnailViewItem *> &items);
+
+ size_t GetItemPos( sal_uInt16 nItemId ) const;
+
+ sal_uInt16 GetItemId( size_t nPos ) const;
+
+ sal_uInt16 GetItemId( const Point& rPos ) const;
+
+ sal_uInt16 getNextItemId () const;
+
+ long GetItemWidth() const { return mnItemWidth; }
+
+ long GetItemHeight() const { return mnItemHeight; }
+
+ void setItemMaxTextLength (sal_uInt32 nLength);
+
+ void setItemDimensions (long ItemWidth, long ThumbnailHeight,
+ long DisplayHeight, int itemPadding);
+
+ sal_uInt16 GetFirstLine() const { return mnFirstLine; }
+
+ void SelectItem( sal_uInt16 nItemId );
+
+ void DeselectItem( sal_uInt16 nItemId );
+
+ bool IsItemSelected( sal_uInt16 nItemId ) const;
+
+ /**
+ *
+ * @brief deselect all current selected items.
+ *
+ **/
+
+ void deselectItems ();
+
+ OUString GetItemText( sal_uInt16 nItemId ) const;
+
+ void SetColor( const Color& rColor );
+
+ void SetColor() { SetColor( Color( COL_TRANSPARENT ) ); }
+
+ Color GetColor() const { return maColor; }
+
+ bool IsColor() const { return maColor.GetTransparency() == 0; }
+
+ void filterItems (const boost::function<bool (const ThumbnailViewItem*) > &func);
+
+ void sortItems (const boost::function<bool (const ThumbnailViewItem*,
+ const ThumbnailViewItem*) > &func);
+
+ void setItemStateHdl (const Link &aLink) { maItemStateHdl = aLink; }
+
+ virtual void Resize();
+
+ virtual bool renameItem(ThumbnailViewItem* pItem, OUString sNewTitle);
+
+protected:
+
+ virtual void KeyInput( const KeyEvent& rKEvt );
+
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+
+ virtual void Command( const CommandEvent& rCEvt );
+
+ virtual void Paint( const Rectangle& rRect );
+
+ virtual void GetFocus();
+
+ virtual void LoseFocus();
+
+ virtual void StateChanged( StateChangedType nStateChange );
+
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
+
+protected:
+
+ // Drawing item related functions, override them to make your own custom ones.
+
+ virtual void DrawItem (ThumbnailViewItem *pItem);
+
+ virtual void OnItemDblClicked (ThumbnailViewItem *pItem);
+
+protected:
+
+ friend class ThumbnailViewAcc;
+ friend class ThumbnailViewItemAcc;
+ using Control::ImplInitSettings;
+ using Window::ImplInit;
+
+ void CalculateItemPositions ();
+ void MakeItemVisible( sal_uInt16 nId );
+
+ SFX2_DLLPRIVATE void ImplInit();
+ SFX2_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
+ SFX2_DLLPRIVATE void ImplInitScrollBar();
+ SFX2_DLLPRIVATE void ImplDeleteItems();
+ SFX2_DLLPRIVATE void ImplDraw();
+ SFX2_DLLPRIVATE size_t ImplGetItem( const Point& rPoint, bool bMove = false ) const;
+ SFX2_DLLPRIVATE ThumbnailViewItem* ImplGetItem( size_t nPos );
+ SFX2_DLLPRIVATE sal_uInt16 ImplGetVisibleItemCount() const;
+ SFX2_DLLPRIVATE ThumbnailViewItem* ImplGetVisibleItem( sal_uInt16 nVisiblePos );
+ SFX2_DLLPRIVATE void ImplFireAccessibleEvent( short nEventId, const ::com::sun::star::uno::Any& rOldValue, const ::com::sun::star::uno::Any& rNewValue );
+ SFX2_DLLPRIVATE bool ImplHasAccessibleListeners();
+ DECL_DLLPRIVATE_LINK( ImplScrollHdl, ScrollBar* );
+
+ DECL_LINK(OnItemSelected, ThumbnailViewItem*);
+
+protected:
+
+ ValueItemList mItemList;
+ ValueItemList mFilteredItemList; ///< Cache to store the filtered items
+ ValueItemList::iterator mpStartSelRange;
+ ScrollBar* mpScrBar;
+ Rectangle maItemListRect;
+ long mnHeaderHeight;
+ long mnItemWidth;
+ long mnItemHeight;
+ long mnItemPadding;
+ long mnThumbnailHeight; // Maximum height of the thumbnail
+ long mnDisplayHeight; // Height of the data display box (name, etc)
+ long mnVisLines;
+ long mnLines;
+ sal_uInt16 mnHighItemId;
+ sal_uInt16 mnCols;
+ sal_uInt16 mnFirstLine;
+ sal_uInt16 mnSpacing;
+ bool mbScroll : 1;
+ bool mbIsTransientChildrenDisabled : 1;
+ bool mbHasVisibleItems : 1;
+ Color maColor;
+
+ Link maItemStateHdl;
+ ThumbnailItemAttributes *mpItemAttrs;
+ drawinglayer::processor2d::BaseProcessor2D *mpProcessor;
+ boost::function<bool (const ThumbnailViewItem*) > maFilterFunc;
+};
+
+#endif // THUMBNAILVIEW_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/thumbnailviewitem.hxx b/include/sfx2/thumbnailviewitem.hxx
new file mode 100644
index 000000000000..64a20cda910f
--- /dev/null
+++ b/include/sfx2/thumbnailviewitem.hxx
@@ -0,0 +1,134 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef THUMBNAILVIEWITEM_HXX
+#define THUMBNAILVIEWITEM_HXX
+
+#include <basegfx/vector/b2dvector.hxx>
+#include <drawinglayer/attribute/fontattribute.hxx>
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <osl/mutex.hxx>
+#include <vcl/bitmapex.hxx>
+#include <vcl/vclmedit.hxx>
+#include "sfx2/dllapi.h"
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+#define THUMBNAILVIEW_ITEM_NONEITEM 0xFFFE
+
+class CheckBox;
+class Font;
+class Window;
+class ThumbnailView;
+
+namespace basegfx {
+ class B2DPolygon;
+}
+
+namespace drawinglayer {
+ namespace processor2d {
+ class BaseProcessor2D;
+ }
+
+ namespace primitive2d {
+ class PolygonHairlinePrimitive2D;
+ }
+}
+
+struct ThumbnailItemAttributes
+{
+ sal_uInt32 nMaxTextLenght;
+ basegfx::BColor aFillColor;
+ basegfx::BColor aHighlightColor;
+ basegfx::B2DVector aFontSize;
+ drawinglayer::attribute::FontAttribute aFontAttr;
+};
+
+class SFX2_DLLPUBLIC ThumbnailViewItem
+{
+public:
+
+ ThumbnailView &mrParent;
+ sal_uInt16 mnId;
+ bool mbVisible;
+ bool mbSelected;
+ bool mbHover;
+ BitmapEx maPreview1;
+ OUString maTitle;
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >* mpxAcc;
+
+ ThumbnailViewItem (ThumbnailView &rView);
+
+ virtual ~ThumbnailViewItem ();
+
+ bool isVisible () const { return mbVisible; }
+
+ void show (bool bVisible);
+
+ bool isSelected () const { return mbSelected; }
+
+ void setSelection (bool state);
+
+ bool isHighlighted () const { return mbHover; }
+
+ void setHighlight (bool state);
+
+ void setEditTitle (bool edit, bool bChangeFocus = true);
+ void updateTitleEditSize ();
+ virtual void setTitle (const OUString& rTitle);
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ GetAccessible( bool bIsTransientChildrenDisabled );
+
+ void setDrawArea (const Rectangle &area);
+
+ const Rectangle& getDrawArea () const { return maDrawArea; }
+ Rectangle getTextArea () const;
+
+ virtual void calculateItemsPosition (const long nThumbnailHeight, const long nDisplayHeight,
+ const long nPadding, sal_uInt32 nMaxTextLenght,
+ const ThumbnailItemAttributes *pAttrs);
+
+ const Point& getTextPos () const { return maTextPos; }
+
+ const Point& getPrev1Pos () const { return maPrev1Pos; }
+
+ void setSelectClickHdl (const Link &link);
+
+ virtual void Paint (drawinglayer::processor2d::BaseProcessor2D *pProcessor,
+ const ThumbnailItemAttributes *pAttrs);
+ void addTextPrimitives (const OUString& rText, const ThumbnailItemAttributes *pAttrs, Point aPos, drawinglayer::primitive2d::Primitive2DSequence& rSeq);
+
+ static drawinglayer::primitive2d::PolygonHairlinePrimitive2D*
+ createBorderLine (const basegfx::B2DPolygon &rPolygon);
+
+protected:
+
+ Point maTextPos;
+ Point maPrev1Pos;
+ Rectangle maDrawArea;
+ Link maClickHdl;
+ bool mbEditTitle;
+ VclMultiLineEdit* mpTitleED;
+ Rectangle maTextEditMaxArea;
+};
+
+#endif // THUMBNAILVIEWITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/titledockwin.hxx b/include/sfx2/titledockwin.hxx
new file mode 100644
index 000000000000..09b500caa6bc
--- /dev/null
+++ b/include/sfx2/titledockwin.hxx
@@ -0,0 +1,161 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SFX_TITLEDOCKWIN_HXX
+#define SFX_TITLEDOCKWIN_HXX
+
+#include "sfx2/dllapi.h"
+#include "sfx2/dockwin.hxx"
+
+#include <vcl/toolbox.hxx>
+#include <tools/svborder.hxx>
+
+//......................................................................................................................
+namespace sfx2
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= TitledDockingWindow
+ //==================================================================================================================
+ class SFX2_DLLPUBLIC TitledDockingWindow : public SfxDockingWindow
+ {
+ public:
+ TitledDockingWindow(
+ SfxBindings* i_pBindings, SfxChildWindow* i_pChildWindow,
+ Window* i_pParent, WinBits i_nStyle = 0
+ );
+
+ TitledDockingWindow( SfxBindings* i_pBindings, SfxChildWindow* i_pChildWindow,
+ Window* i_pParent, const ResId& i_rResId
+ );
+
+ virtual ~TitledDockingWindow();
+
+ /** sets a title to be displayed in the docking window
+ */
+ void SetTitle( const String& i_rTitle );
+
+ /** adds a drop down item to the toolbox. Usually, this is used to add some kind of menu to the toolbox.
+
+ @param i_rItemText
+ the text to display for the item
+ @param i_nHelpId
+ the help ID for the new toolbox item
+ @param i_rCallback
+ the callback to invoke when the drop item has been clicked
+ @return
+ the ID of the newly created toolbox item
+ */
+ sal_uInt16 AddDropDownToolBoxItem( const String& i_rItemText, const OString& i_nHelpId, const Link& i_rCallback )
+ {
+ return impl_addDropDownToolBoxItem( i_rItemText, i_nHelpId, i_rCallback );
+ }
+
+ void SetEndDockingHdl( const Link& i_rEndDockingHdl ) { m_aEndDockingHdl = i_rEndDockingHdl; }
+ const Link& GetEndDockingHdl() const { return m_aEndDockingHdl; }
+
+ /** resets the toolbox. Upon return, the only item in the toolbox is the closer.
+ */
+ void ResetToolBox()
+ {
+ impl_resetToolBox();
+ }
+
+ /** returns the content window, which is to be used as parent window for any content to be displayed
+ in the docking window.
+ */
+ ::Window& GetContentWindow() { return m_aContentWindow; }
+ const ::Window& GetContentWindow() const { return m_aContentWindow; }
+
+ ToolBox& GetToolBox() { return m_aToolbox; }
+ const ToolBox& GetToolBox() const { return m_aToolbox; }
+
+ /** Return the border that is painted around the inner window as
+ decoration.
+ */
+ SvBorder GetDecorationBorder (void) const { return m_aBorder; }
+
+ protected:
+ // Window overridables
+ virtual void Paint( const Rectangle& i_rArea );
+ virtual void Resize();
+ virtual void StateChanged( StateChangedType i_nType );
+ virtual void DataChanged( const DataChangedEvent& i_rDataChangedEvent );
+ virtual void SetText( const OUString& i_rText );
+
+ // DockingWindow overridables
+ void EndDocking( const Rectangle& rRect, sal_Bool bFloatMode );
+
+ // own overridables
+ virtual void onLayoutDone();
+
+ protected:
+ /** internal version of ResetToolBox
+ */
+ void impl_resetToolBox();
+
+ /** internal version of AddDropDownToolBoxItem
+ */
+ sal_uInt16 impl_addDropDownToolBoxItem( const String& i_rItemText, const OString& i_nHelpId, const Link& i_rCallback );
+
+ /** returns the current title.
+
+ If no title has been set via SetTitle, then the window text (Window::GetText) is returned.
+ */
+ String impl_getTitle() const;
+
+ private:
+ DECL_LINK( OnToolboxItemSelected, ToolBox* );
+
+ void impl_construct();
+ void impl_layout();
+ void impl_scheduleLayout();
+
+ private:
+ OUString m_sTitle;
+ ToolBox m_aToolbox;
+ Window m_aContentWindow;
+
+ Link m_aEndDockingHdl;
+
+ /** The border that is painted arround the inner window. The bevel
+ shadow lines are part of the border, so where the border is 0 no
+ such line is painted.
+ */
+ SvBorder m_aBorder;
+
+ /** Remember that a layout is pending, i.e. Resize() has been called
+ since the last Paint().
+ */
+ bool m_bLayoutPending;
+
+ /** Height of the title bar. Calculated in impl_layout().
+ */
+ int m_nTitleBarHeight;
+
+ };
+
+//......................................................................................................................
+} // namespace sfx2
+//......................................................................................................................
+
+#endif // SFX_TITLEDOCKWIN_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/tplpitem.hxx b/include/sfx2/tplpitem.hxx
new file mode 100644
index 000000000000..58f0618443ae
--- /dev/null
+++ b/include/sfx2/tplpitem.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX_TPLPITEM_HXX
+#define _SFX_TPLPITEM_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include <tools/string.hxx>
+#include <tools/rtti.hxx>
+#include <svl/flagitem.hxx>
+#include <svl/style.hrc>
+
+class SFX2_DLLPUBLIC SfxTemplateItem: public SfxFlagItem
+{
+ String aStyle;
+public:
+ TYPEINFO();
+ SfxTemplateItem();
+ SfxTemplateItem( sal_uInt16 nWhich,
+ const String &rStyle,
+ sal_uInt16 nMask = SFXSTYLEBIT_ALL );
+ SfxTemplateItem( const SfxTemplateItem& );
+
+ const String& GetStyleName() const { return aStyle; }
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual sal_uInt8 GetFlagCount() const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/unoctitm.hxx b/include/sfx2/unoctitm.hxx
new file mode 100644
index 000000000000..d1d41b8ae689
--- /dev/null
+++ b/include/sfx2/unoctitm.hxx
@@ -0,0 +1,198 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX_UNOCTITM_HXX
+#define _SFX_UNOCTITM_HXX
+
+#include <functional>
+#include <com/sun/star/frame/XNotifyingDispatch.hpp>
+#include <com/sun/star/frame/XDispatchResultListener.hpp>
+#include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/XStatusListener.hpp>
+#include <com/sun/star/frame/FrameSearchFlag.hpp>
+#include <com/sun/star/frame/XDispatchProviderInterception.hpp>
+#include <com/sun/star/frame/FeatureStateEvent.hpp>
+#include <com/sun/star/frame/DispatchDescriptor.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+
+#include <sfx2/sfxuno.hxx>
+#include <sfx2/ctrlitem.hxx>
+#include <osl/mutex.hxx>
+
+class SfxBindings;
+class SfxFrame;
+class SfxDispatcher;
+
+class SfxUnoControllerItem : public ::com::sun::star::frame::XStatusListener ,
+ public ::com::sun::star::lang::XTypeProvider ,
+ public ::cppu::OWeakObject
+{
+ ::com::sun::star::util::URL aCommand;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch;
+ SfxControllerItem* pCtrlItem;
+ SfxBindings* pBindings;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > TryGetDispatch( SfxFrame* pFrame );
+
+public:
+ SFX_DECL_XINTERFACE_XTYPEPROVIDER
+
+
+ SfxUnoControllerItem( SfxControllerItem*, SfxBindings&, const String& );
+ ~SfxUnoControllerItem();
+
+ const ::com::sun::star::util::URL& GetCommand() const
+ { return aCommand; }
+
+ // XStatusListener
+ virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event) throw( ::com::sun::star::uno::RuntimeException );
+
+ // Something else
+ virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException );
+ void UnBind();
+ void GetNewDispatch();
+ void ReleaseDispatch();
+ void ReleaseBindings();
+};
+
+struct SfxStatusDispatcher_Impl_hashType
+{
+ size_t operator()(const OUString& s) const
+ { return s.hashCode(); }
+};
+
+typedef ::cppu::OMultiTypeInterfaceContainerHelperVar< OUString, SfxStatusDispatcher_Impl_hashType, std::equal_to< OUString > > SfxStatusDispatcher_Impl_ListenerContainer ;
+
+class SfxStatusDispatcher : public ::com::sun::star::frame::XNotifyingDispatch,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::cppu::OWeakObject
+{
+ ::osl::Mutex aMutex;
+ SfxStatusDispatcher_Impl_ListenerContainer aListeners;
+
+public:
+ SFX_DECL_XINTERFACE_XTYPEPROVIDER
+
+ SfxStatusDispatcher();
+
+ // XDispatch
+ virtual void SAL_CALL dispatchWithNotification( const ::com::sun::star::util::URL& aURL,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchResultListener >& rListener ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL addStatusListener(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xControl, const ::com::sun::star::util::URL& aURL) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL removeStatusListener(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xControl, const ::com::sun::star::util::URL& aURL) throw( ::com::sun::star::uno::RuntimeException );
+
+ // Something else
+ void ReleaseAll();
+ SfxStatusDispatcher_Impl_ListenerContainer& GetListeners()
+ { return aListeners; }
+};
+
+class SfxSlotServer;
+class SfxDispatchController_Impl;
+class SfxOfficeDispatch : public SfxStatusDispatcher
+ , public ::com::sun::star::lang::XUnoTunnel
+{
+friend class SfxDispatchController_Impl;
+ SfxDispatchController_Impl* pControllerItem;
+public:
+ SfxOfficeDispatch( SfxBindings& rBind,
+ SfxDispatcher* pDispat,
+ const SfxSlot* pSlot,
+ const ::com::sun::star::util::URL& rURL );
+ SfxOfficeDispatch( SfxDispatcher* pDispat,
+ const SfxSlot* pSlot,
+ const ::com::sun::star::util::URL& rURL );
+ ~SfxOfficeDispatch();
+
+ SFX_DECL_XINTERFACE_XTYPEPROVIDER
+
+ virtual void SAL_CALL dispatchWithNotification( const ::com::sun::star::util::URL& aURL,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchResultListener >& rListener )
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs )
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xControl,
+ const ::com::sun::star::util::URL& aURL)
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException) ;
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& impl_getStaticIdentifier();
+
+ static sal_Bool IsMasterUnoCommand( const ::com::sun::star::util::URL& aURL );
+ static OUString GetMasterUnoCommand( const ::com::sun::star::util::URL& aURL );
+
+ void SetFrame(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame);
+
+ void SetMasterUnoCommand( sal_Bool bSet );
+
+ SfxDispatcher* GetDispatcher_Impl();
+};
+
+class SfxDispatchController_Impl : public SfxControllerItem
+{
+ ::com::sun::star::util::URL aDispatchURL;
+ SfxDispatcher* pDispatcher;
+ SfxBindings* pBindings;
+ const SfxPoolItem* pLastState;
+ sal_uInt16 nSlot;
+ SfxOfficeDispatch* pDispatch;
+ sal_Bool bMasterSlave;
+ sal_Bool bVisible;
+ const char* pUnoName;
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XFrame > xFrame;
+
+ void addParametersToArgs( const com::sun::star::util::URL& aURL,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs ) const;
+ SfxMapUnit GetCoreMetric( SfxItemPool& rPool, sal_uInt16 nSlot );
+
+public:
+ SfxDispatchController_Impl( SfxOfficeDispatch* pDisp,
+ SfxBindings* pBind,
+ SfxDispatcher* pDispat,
+ const SfxSlot* pSlot,
+ const ::com::sun::star::util::URL& rURL );
+ ~SfxDispatchController_Impl();
+
+ static OUString getSlaveCommand( const ::com::sun::star::util::URL& rURL );
+
+ void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState, SfxSlotServer* pServ );
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+ void setMasterSlaveCommand( sal_Bool bSet );
+ void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchResultListener >& rListener ) throw( ::com::sun::star::uno::RuntimeException );
+ void SAL_CALL addStatusListener(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xControl, const ::com::sun::star::util::URL& aURL) throw( ::com::sun::star::uno::RuntimeException );
+ void UnBindController();
+ SfxDispatcher* GetDispatcher();
+ void SetFrame(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/userinputinterception.hxx b/include/sfx2/userinputinterception.hxx
new file mode 100644
index 000000000000..7350314b4835
--- /dev/null
+++ b/include/sfx2/userinputinterception.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef USERINPUTINTERCEPTION_HXX
+#define USERINPUTINTERCEPTION_HXX
+
+#include "sfx2/dllapi.h"
+
+#include <com/sun/star/awt/XUserInputInterception.hpp>
+
+#include <boost/noncopyable.hpp>
+#include <memory>
+
+class NotifyEvent;
+
+namespace cppu { class OWeakObject; }
+
+//........................................................................
+namespace sfx2
+{
+//........................................................................
+
+ //====================================================================
+ //= UserInputInterception
+ //====================================================================
+ struct UserInputInterception_Data;
+ /** helper class for implementing the XUserInputInterception interface
+ for a controller implementation
+ */
+ class SFX2_DLLPUBLIC UserInputInterception : public ::boost::noncopyable
+ {
+ public:
+ UserInputInterception( ::cppu::OWeakObject& _rControllerImpl, ::osl::Mutex& _rMutex );
+ ~UserInputInterception();
+
+ // delegator functions for your XUserInputInterception implementation
+ void addKeyHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException);
+ void removeKeyHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException);
+ void addMouseClickHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseClickHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException);
+ void removeMouseClickHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseClickHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException);
+
+ // state
+ bool hasKeyHandlers() const;
+ bool hasMouseClickListeners() const;
+
+ // forwarding a NotifyEvent to the KeyListeners respectively MouseClickListeners
+ bool handleNotifyEvent( const NotifyEvent& _rEvent );
+
+ private:
+ ::std::auto_ptr< UserInputInterception_Data > m_pData;
+ };
+
+//........................................................................
+} // namespace sfx2
+//........................................................................
+
+#endif // USERINPUTINTERCEPTION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/viewfac.hxx b/include/sfx2/viewfac.hxx
new file mode 100644
index 000000000000..3348cb69d199
--- /dev/null
+++ b/include/sfx2/viewfac.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _VIEWFAC_HXX
+#define _VIEWFAC_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include <tools/string.hxx>
+#include <tools/resid.hxx>
+
+class SfxViewFrame;
+class SfxViewShell;
+class Window;
+
+typedef SfxViewShell* (*SfxViewCtor)(SfxViewFrame*, SfxViewShell*);
+
+// CLASS -----------------------------------------------------------------
+class SFX2_DLLPUBLIC SfxViewFactory
+{
+public:
+ SfxViewFactory( SfxViewCtor fnC,
+ sal_uInt16 nOrdinal, const sal_Char* asciiViewName );
+
+ SfxViewShell *CreateInstance(SfxViewFrame *pViewFrame, SfxViewShell *pOldSh);
+ sal_uInt16 GetOrdinal() const { return nOrd; }
+
+ /// returns a legacy view name. This is "view" with an appended ordinal/ID.
+ String GetLegacyViewName() const;
+
+ /** returns a API-compatible view name.
+
+ For details on which view names are specified, see the XModel2.getAvailableViewControllerNames
+ documentation.
+ */
+ String GetAPIViewName() const;
+
+private:
+ SfxViewCtor fnCreate;
+ sal_uInt16 nOrd;
+ const String m_sViewName;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/viewfrm.hxx b/include/sfx2/viewfrm.hxx
new file mode 100644
index 000000000000..522b4719eac0
--- /dev/null
+++ b/include/sfx2/viewfrm.hxx
@@ -0,0 +1,335 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXVIEWFRM_HXX
+#define _SFXVIEWFRM_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include "sal/types.h"
+#include <svl/lstner.hxx>
+#include <sfx2/module.hxx>
+#include <sfx2/frame.hxx>
+#include <sfx2/shell.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <svl/poolitem.hxx>
+#include <vcl/button.hxx>
+#include <com/sun/star/frame/status/Verb.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/frame/XController2.hpp>
+
+#include <tools/svborder.hxx>
+
+class SvBorder;
+class SfxDispatcher;
+class SfxObjectShell;
+class SfxBindings;
+class SfxProgress;
+class SvData;
+class SfxViewShell;
+class SystemWindow;
+class Fraction;
+class Point;
+class Size;
+class SfxChildWindow;
+
+namespace sfx2
+{
+class SvLinkSource;
+}
+namespace svtools
+{
+ class AsynchronLink;
+}
+
+#ifndef SFX_DECL_OBJECTSHELL_DEFINED
+#define SFX_DECL_OBJECTSHELL_DEFINED
+SV_DECL_REF(SfxObjectShell)
+#endif
+
+//========================================================================
+DBG_NAMEEX(SfxViewFrame)
+class SFX2_DLLPUBLIC SfxViewFrame: public SfxShell, public SfxListener
+{
+ struct SfxViewFrame_Impl* pImp;
+
+ SfxObjectShellRef xObjSh;
+ SfxDispatcher* pDispatcher;
+ SfxBindings* pBindings;
+ sal_uInt16 nAdjustPosPixelLock;
+
+private:
+#ifndef _SFX_HXX
+ SAL_DLLPRIVATE void Construct_Impl( SfxObjectShell *pObjSh=NULL );
+#endif
+
+protected:
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+#ifndef _SFX_HXX
+ SAL_DLLPRIVATE void KillDispatcher_Impl();
+#endif
+
+ virtual ~SfxViewFrame();
+
+public:
+ SfxViewFrame( SfxFrame& rFrame, SfxObjectShell *pDoc = NULL );
+
+ TYPEINFO();
+ SFX_DECL_INTERFACE(SFX_INTERFACE_SFXVIEWFRM)
+
+ static void SetViewFrame( SfxViewFrame* );
+
+ static SfxViewFrame* LoadHiddenDocument( SfxObjectShell& i_rDoc, const sal_uInt16 i_nViewId );
+ static SfxViewFrame* LoadDocument( SfxObjectShell& i_rDoc, const sal_uInt16 i_nViewId );
+ static SfxViewFrame* LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const SfxFrameItem* i_pFrameItem, const sal_uInt16 i_nViewId = 0 );
+ static SfxViewFrame* LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrameItem, const sal_uInt16 i_nViewId = 0 );
+ static SfxViewFrame* DisplayNewDocument( SfxObjectShell& i_rDoc, const SfxRequest& i_rCreateDocRequest, const sal_uInt16 i_nViewId = 0 );
+
+ static SfxViewFrame* Current();
+ static SfxViewFrame* GetFirst( const SfxObjectShell* pDoc = 0, sal_Bool bOnlyVisible = sal_True );
+ static SfxViewFrame* GetNext( const SfxViewFrame& rPrev, const SfxObjectShell* pDoc = 0, sal_Bool bOnlyVisible = sal_True );
+
+ static SfxViewFrame* Get( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController>& i_rController, const SfxObjectShell* i_pDoc = NULL );
+
+ void DoActivate(sal_Bool bMDI, SfxViewFrame *pOld=NULL);
+ void DoDeactivate(sal_Bool bMDI, SfxViewFrame *pOld=NULL);
+
+ SfxViewFrame* GetParentViewFrame() const;
+
+ using SfxShell::GetDispatcher;
+ SfxDispatcher* GetDispatcher() { return pDispatcher; }
+ SfxBindings& GetBindings() { return *pBindings; }
+ const SfxBindings& GetBindings() const { return *pBindings; }
+ Window& GetWindow() const;
+ virtual void SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY );
+
+ SfxProgress* GetProgress() const;
+
+ SfxObjectShell* GetObjectShell() const
+ { return xObjSh; }
+
+ void LockAdjustPosSizePixel()
+ { nAdjustPosPixelLock++; }
+ void UnlockAdjustPosSizePixel()
+ { nAdjustPosPixelLock--; }
+ void DoAdjustPosSizePixel( SfxViewShell * pSh,
+ const Point &rPos, const Size &rSize );
+ void Show();
+ sal_Bool IsVisible() const;
+ void ToTop();
+ void Enable( sal_Bool bEnable );
+ virtual sal_Bool Close();
+ virtual void Activate( sal_Bool bUI );
+ virtual void Deactivate( sal_Bool bUI );
+
+ // DDE-Interface
+ virtual long DdeExecute( const String& rCmd );
+ virtual long DdeGetData( const String& rItem,
+ const String& rMimeType,
+ ::com::sun::star::uno::Any & rValue );
+ virtual long DdeSetData( const String& rItem,
+ const String& rMimeType,
+ const ::com::sun::star::uno::Any & rValue );
+ virtual ::sfx2::SvLinkSource* DdeCreateLinkSource( const String& rItem );
+
+ void UpdateTitle();
+
+ static void ActivateToolPanel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, const OUString& i_rPanelURL );
+
+ // interne Handler
+ SAL_DLLPRIVATE virtual sal_Bool SetBorderPixelImpl( const SfxViewShell *pSh, const SvBorder &rBorder );
+ SAL_DLLPRIVATE virtual const SvBorder& GetBorderPixelImpl( const SfxViewShell *pSh ) const;
+ SAL_DLLPRIVATE virtual void InvalidateBorderImpl( const SfxViewShell *pSh );
+
+ virtual SfxObjectShell* GetObjectShell();
+ sal_uInt16 GetCurViewId() const;
+ SfxFrame& GetFrame() const;
+ SfxViewFrame* GetTopViewFrame() const;
+
+ sal_Bool DoClose();
+ sal_uIntPtr GetFrameType() const
+ { return GetFrame().GetFrameType(); }
+ SfxFrame& GetTopFrame() const
+ { return GetFrame().GetTopFrame(); }
+ void GetTargetList( TargetList& rList ) const
+ { GetFrame().GetTargetList( rList ); }
+ void CancelTransfers()
+ { GetFrame().CancelTransfers(); }
+
+ void SetModalMode( sal_Bool );
+ sal_Bool IsInModalMode() const;
+ void Resize(sal_Bool bForce=sal_False);
+
+ void SetChildWindow(sal_uInt16 nId, sal_Bool bVisible, sal_Bool bSetFocus=sal_True);
+ void ToggleChildWindow(sal_uInt16);
+ sal_Bool HasChildWindow(sal_uInt16);
+ sal_Bool KnowsChildWindow(sal_uInt16);
+ void ShowChildWindow(sal_uInt16,sal_Bool bVisible=sal_True);
+ SfxChildWindow* GetChildWindow(sal_uInt16);
+ void ChildWindowExecute(SfxRequest&);
+ void ChildWindowState(SfxItemSet&);
+
+ /** Append a new InfoBar (see https://wiki.documentfoundation.org/Design/Whiteboards/Infobar).
+
+ The buttons will be added from Right to Left at the right of the info bar. The parent, size
+ and position of each button will be changed: only the width will remain unchanged.
+ */
+ void AppendInfoBar( const OUString& sId, const OUString& sMessage, std::vector< PushButton* > aButtons );
+ void RemoveInfoBar( const OUString& sId );
+
+ SAL_DLLPRIVATE void SetDowning_Impl();
+ SAL_DLLPRIVATE void GetDocNumber_Impl();
+ SAL_DLLPRIVATE sal_Bool IsDowning_Impl() const;
+ SAL_DLLPRIVATE void SetViewShell_Impl( SfxViewShell *pVSh );
+ SAL_DLLPRIVATE void ReleaseObjectShell_Impl();
+
+ SAL_DLLPRIVATE void GetState_Impl( SfxItemSet &rSet );
+ SAL_DLLPRIVATE void ExecReload_Impl( SfxRequest &rReq );
+ SAL_DLLPRIVATE void StateReload_Impl( SfxItemSet &rSet );
+ SAL_DLLPRIVATE void ExecView_Impl( SfxRequest &rReq );
+ SAL_DLLPRIVATE void StateView_Impl( SfxItemSet &rSet );
+ SAL_DLLPRIVATE void ExecHistory_Impl( SfxRequest &rReq );
+ SAL_DLLPRIVATE void StateHistory_Impl( SfxItemSet &rSet );
+ SAL_DLLPRIVATE SfxViewFrame* GetParentViewFrame_Impl() const;
+ SAL_DLLPRIVATE void ForceOuterResize_Impl(sal_Bool bOn=sal_True);
+ SAL_DLLPRIVATE sal_Bool IsResizeInToOut_Impl() const;
+ SAL_DLLPRIVATE sal_Bool IsAdjustPosSizePixelLocked_Impl() const
+ { return nAdjustPosPixelLock != 0; }
+ SAL_DLLPRIVATE void UpdateDocument_Impl();
+
+ SAL_DLLPRIVATE void LockObjectShell_Impl(sal_Bool bLock=sal_True);
+
+ SAL_DLLPRIVATE void MakeActive_Impl( sal_Bool bActivate );
+ SAL_DLLPRIVATE void SetQuietMode_Impl( sal_Bool );
+ SAL_DLLPRIVATE const Size& GetMargin_Impl() const;
+ SAL_DLLPRIVATE void SetActiveChildFrame_Impl( SfxViewFrame* );
+ SAL_DLLPRIVATE SfxViewFrame* GetActiveChildFrame_Impl() const;
+ SAL_DLLPRIVATE String GetActualPresentationURL_Impl() const;
+ SAL_DLLPRIVATE void MiscExec_Impl(SfxRequest &);
+ SAL_DLLPRIVATE void MiscState_Impl(SfxItemSet &);
+ SAL_DLLPRIVATE SfxWorkWindow* GetWorkWindow_Impl( sal_uInt16 nId );
+ SAL_DLLPRIVATE void AddDispatchMacroToBasic_Impl(const OUString& sMacro);
+
+ SAL_DLLPRIVATE void Exec_Impl(SfxRequest &);
+ SAL_DLLPRIVATE void INetExecute_Impl(SfxRequest &);
+ SAL_DLLPRIVATE void INetState_Impl(SfxItemSet &);
+
+ SAL_DLLPRIVATE void SetCurViewId_Impl( const sal_uInt16 i_nID );
+ SAL_DLLPRIVATE void ActivateToolPanel_Impl( const OUString& i_rPanelURL );
+
+private:
+ SAL_DLLPRIVATE sal_Bool SwitchToViewShell_Impl( sal_uInt16 nNo, sal_Bool bIsIndex = sal_False );
+ SAL_DLLPRIVATE void PopShellAndSubShells_Impl( SfxViewShell& i_rViewShell );
+ SAL_DLLPRIVATE void SaveCurrentViewData_Impl( const sal_uInt16 i_nNewViewId );
+
+ /** loads the given existing document into the given frame
+
+ This is done using the XComponentLoader interface of the frame, so the SFX document loader is invoked.
+
+ @param i_rDoc
+ the document to load
+ @param i_rFrame
+ the frame to load the document into
+ @param i_rLoadArgs
+ the arguments to pass to the component loader. If this sequence is empty, then the current arguments of the
+ model will be obtained, and passed to the loader. This ensures that any arguments in the model will be preserved,
+ instead of being reset.
+ @param i_nViewId
+ the ID of the view to create
+ @throws Exception
+ if something goes wrong. The caller is responsible for handling this.
+ */
+ SAL_DLLPRIVATE static SfxViewShell* LoadViewIntoFrame_Impl(
+ const SfxObjectShell& i_rDoc,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_rLoadArgs,
+ const sal_uInt16 i_nViewId,
+ const bool i_bHidden
+ );
+
+ /** loads the given existing document into the given frame
+
+ This is done using the XComponentLoader interface of the frame, so the SFX document loader is invoked.
+
+ If no frame is given, a blank top level frame is created.
+
+ If anything fails during the process, as much as possible is cleaned up.
+
+ @param i_rDoc
+ the document to load
+ @param i_rFrame
+ the frame to load the document into. Might be <NULL/>, in which case a new frame is created.
+ @param i_nViewId
+ the ID of the view to create
+ */
+ SAL_DLLPRIVATE static SfxViewFrame* LoadViewIntoFrame_Impl_NoThrow(
+ const SfxObjectShell& i_rDoc,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame,
+ const sal_uInt16 i_nViewId,
+ const bool i_bHidden
+ );
+};
+
+//--------------------------------------------------------------------
+
+class SFX2_DLLPUBLIC SfxViewFrameItem: public SfxPoolItem
+{
+ SfxViewFrame* pFrame;
+
+public:
+ TYPEINFO();
+ SfxViewFrameItem( SfxViewFrame *pViewFrame ):
+ SfxPoolItem( 0 ),
+ pFrame( pViewFrame)
+ {}
+ SfxViewFrameItem( sal_uInt16 nWhichId, SfxViewFrame *pViewFrame ):
+ SfxPoolItem( nWhichId ),
+ pFrame( pViewFrame)
+ {}
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual String GetValueText() const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+
+ SfxViewFrame* GetFrame() const
+ { return pFrame; }
+};
+
+class SfxVerbListItem : public SfxPoolItem
+{
+ com::sun::star::uno::Sequence < com::sun::star::embed::VerbDescriptor > aVerbs;
+
+public:
+ TYPEINFO();
+ SfxVerbListItem( sal_uInt16 nWhichId = SID_OBJECT ) :
+ SfxPoolItem( nWhichId )
+ {}
+
+ SfxVerbListItem( sal_uInt16 nWhichId, const com::sun::star::uno::Sequence < com::sun::star::embed::VerbDescriptor >& );
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ const com::sun::star::uno::Sequence < com::sun::star::embed::VerbDescriptor >& GetVerbList() const { return aVerbs; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
new file mode 100644
index 000000000000..ad4c64cd5272
--- /dev/null
+++ b/include/sfx2/viewsh.hxx
@@ -0,0 +1,343 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXVIEWSH_HXX
+#define _SFXVIEWSH_HXX
+
+#include "sal/config.h"
+#include "sfx2/dllapi.h"
+#include "sal/types.h"
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/view/XRenderable.hpp>
+#include <com/sun/star/uno/Reference.h>
+#include <svl/lstner.hxx>
+#include <com/sun/star/ui/XContextMenuInterceptor.hpp>
+#include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp>
+#include <com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp>
+#include <cppuhelper/interfacecontainer.hxx>
+#include "shell.hxx"
+#include <tools/gen.hxx>
+#include <tools/errcode.hxx>
+#include <vcl/jobset.hxx>
+#include <vector>
+
+class SfxBaseController;
+class Size;
+class Fraction;
+class Window;
+class KeyEvent;
+class WorkWindow;
+class SvBorder;
+class SdrView;
+class SfxFrame;
+class SfxMedium;
+class SfxModule;
+class SfxViewFrame;
+class SfxItemPool;
+class SfxTabPage;
+class SfxFrameSetDescriptor;
+class Printer;
+class SfxPrinter;
+class SfxProgress;
+class SfxFrameItem;
+class Dialog;
+class Menu;
+class NotifyEvent;
+
+#define SFX_PRINTER_PRINTER 1 // without JOB SETUP => Temporary
+#define SFX_PRINTER_JOBSETUP 2
+#define SFX_PRINTER_OPTIONS 4
+#define SFX_PRINTER_CHG_ORIENTATION 8
+#define SFX_PRINTER_CHG_SIZE 16
+#define SFX_PRINTER_ALL 31
+
+#define SFX_PRINTER_CHG_ORIENTATION_FLAG 3
+#define SFX_PRINTER_CHG_SIZE_FLAG 4
+
+#define SFX_PRINTERROR_NONE 0
+#define SFX_PRINTERROR_BUSY 1
+
+// "Verified" using www.apple.com and Netscape 3.01
+#define DEFAULT_MARGIN_WIDTH 8
+#define DEFAULT_MARGIN_HEIGHT 12
+
+//========================================================================
+
+// @[SfxViewShell-Flags]
+
+#define SFX_VIEW_HAS_PRINTOPTIONS 0x0010 /* Options-Button and Options-
+ Dialog in PrintDialog */
+#define SFX_VIEW_CAN_PRINT 0x0020 /* Printing enabled without having
+ to create a Printer */
+#define SFX_VIEW_NO_SHOW 0x0040 /* Window of the ViewShell shall
+ not be showed automatically */
+#define SFX_VIEW_NO_NEWWINDOW 0x0100 /* Allow N View */
+
+/* [Description]
+
+ The SfxViewShell flags control the behavior of SfxViewShell for the
+ duration of its lifetime. They are defined in the constructor of
+ <SfxViewShell>.
+*/
+
+//=========================================================================
+
+#define SFX_DECL_VIEWFACTORY(Class) \
+private: \
+ static SfxViewFactory *pFactory; \
+public: \
+ static SfxViewShell *CreateInstance(SfxViewFrame *pFrame, SfxViewShell *pOldView); \
+ static void RegisterFactory( sal_uInt16 nPrio = USHRT_MAX ); \
+ static SfxViewFactory&Factory() { return *pFactory; } \
+ static void InitFactory()
+
+#define SFX_IMPL_NAMED_VIEWFACTORY(Class, AsciiViewName) \
+ SfxViewFactory* Class::pFactory; \
+ SfxViewShell* Class::CreateInstance(SfxViewFrame *pFrame, SfxViewShell *pOldView) \
+ { return new Class(pFrame, pOldView); } \
+ void Class::RegisterFactory( sal_uInt16 nPrio ) \
+ { \
+ pFactory = new SfxViewFactory(&CreateInstance,nPrio,AsciiViewName);\
+ InitFactory(); \
+ } \
+ void Class::InitFactory()
+
+#define SFX_VIEW_REGISTRATION(DocClass) \
+ DocClass::Factory().RegisterViewFactory( Factory() )
+
+class SfxInPlaceClient;
+typedef ::std::vector< SfxInPlaceClient* > SfxInPlaceClientList;
+
+// -----------------------------------------------------------------------
+class SFX2_DLLPUBLIC SfxViewShell: public SfxShell, public SfxListener
+{
+#ifdef _SFXVIEWSH_HXX
+friend class SfxViewFrame;
+friend class SfxBaseController;
+friend class SfxPrinterController;
+#endif
+
+ struct SfxViewShell_Impl* pImp;
+ SfxInPlaceClientList* pIPClientList;
+ SfxViewFrame* pFrame;
+ SfxShell* pSubShell;
+ Window* pWindow;
+ sal_Bool bNoNewWindow;
+
+protected:
+ virtual void Activate(sal_Bool IsMDIActivate);
+ virtual void Deactivate(sal_Bool IsMDIActivate);
+
+ virtual void InnerResizePixel( const Point &rOfs, const Size &rSize );
+ virtual void OuterResizePixel( const Point &rOfs, const Size &rSize );
+ virtual void SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY );
+
+ virtual void Move();
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+public:
+ // Iteration
+ static SfxViewShell* GetFirst( const TypeId* pType = 0, sal_Bool bOnlyVisible = sal_True );
+ static SfxViewShell* GetNext( const SfxViewShell& rPrev,
+ const TypeId* pType = 0, sal_Bool bOnlyVisible = sal_True );
+ static SfxViewShell* Current();
+
+ static SfxViewShell* Get( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController>& i_rController );
+
+ // Initialize Constructors/Destructors
+ TYPEINFO();
+ SFX_DECL_INTERFACE(SFX_INTERFACE_SFXVIEWSH)
+
+ SfxViewShell( SfxViewFrame *pFrame, sal_uInt16 nFlags = 0 );
+ virtual ~SfxViewShell();
+
+ SfxInPlaceClient* GetIPClient() const;
+ SfxInPlaceClient* GetUIActiveClient() const;
+ SfxInPlaceClient* FindIPClient( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj, Window *pObjParentWin ) const;
+
+ virtual ErrCode DoVerb(long nVerb);
+
+ virtual void OutplaceActivated( sal_Bool bActive, SfxInPlaceClient* pClient );
+ virtual void InplaceActivating( SfxInPlaceClient* pClient );
+ virtual void InplaceDeactivated( SfxInPlaceClient* pClient );
+ virtual void UIActivating( SfxInPlaceClient* pClient );
+ virtual void UIDeactivated( SfxInPlaceClient* pClient );
+
+ virtual void JumpToMark( const String& rMark );
+ void VisAreaChanged(const Rectangle& rRect);
+
+ // Misc
+ virtual sal_uInt16 PrepareClose( sal_Bool bUI = sal_True, sal_Bool bForBrowsing = sal_False );
+ virtual String GetSelectionText( sal_Bool bCompleteWords = sal_False );
+ virtual sal_Bool HasSelection( sal_Bool bText = sal_True ) const;
+ virtual SdrView* GetDrawView() const;
+
+ SfxShell* GetSubShell() const { return pSubShell; }
+ void AddSubShell( SfxShell& rShell );
+ void RemoveSubShell( SfxShell *pShell=NULL );
+ SfxShell* GetSubShell( sal_uInt16 );
+
+ // Focus, KeyInput, Cursor
+ void GotFocus() const;
+ inline void LostFocus() const;
+ virtual void ShowCursor( bool bOn = true );
+ virtual bool KeyInput( const KeyEvent &rKeyEvent );
+ sal_Bool Escape();
+
+ // Viewing Interface
+ Window* GetWindow() const { return pWindow; }
+ void SetWindow( Window *pViewPort );
+ virtual void AdjustPosSizePixel( const Point &rOfs, const Size &rSize );
+ const SvBorder& GetBorderPixel() const;
+ void SetBorderPixel( const SvBorder &rBorder );
+ void InvalidateBorder();
+ inline SfxViewFrame* GetViewFrame() const;
+
+ // Printing Interface
+ virtual SfxPrinter* GetPrinter( sal_Bool bCreate = sal_False );
+ virtual sal_uInt16 SetPrinter( SfxPrinter *pNewPrinter, sal_uInt16 nDiffFlags = SFX_PRINTER_ALL, bool bIsAPI=sal_False );
+ virtual bool HasPrintOptionsPage() const;
+ virtual SfxTabPage* CreatePrintOptionsPage( Window *pParent, const SfxItemSet &rOptions );
+ virtual JobSetup GetJobSetup() const;
+ Printer* GetActivePrinter() const;
+
+ // Working set
+ virtual void WriteUserData( String&, sal_Bool bBrowse = sal_False );
+ virtual void ReadUserData( const String&, sal_Bool bBrowse = sal_False );
+ virtual void WriteUserDataSequence ( ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = sal_False );
+ virtual void ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = sal_False );
+ virtual void QueryObjAreaPixel( Rectangle& rRect ) const;
+
+ virtual SfxObjectShell* GetObjectShell();
+ /** retrieves the document which shall be considered the "current document" when the frame is active
+
+ The default implementation simply returns the XModel of the associated SfxObjectShell. You will rarely
+ need to overwrite this behavior.
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
+ GetCurrentDocument() const;
+ /** forwards the current document, as returned by ->GetCurrentDocument, to SfxObjectShell::SetWorkingDocument
+ */
+ void SetCurrentDocument() const;
+
+ /** get an XRenderable instance that can render this document
+ */
+ virtual com::sun::star::uno::Reference< com::sun::star::view::XRenderable > GetRenderable();
+
+
+ virtual void MarginChanged();
+ const Size& GetMargin() const;
+ void SetMargin( const Size& );
+ void DisconnectAllClients();
+ virtual SfxFrame* GetSmartSelf( SfxFrame* pSelf, SfxMedium& rMedium );
+ sal_Bool NewWindowAllowed() const { return !bNoNewWindow; }
+ void SetNewWindowAllowed( sal_Bool bSet ) { bNoNewWindow = !bSet; }
+
+ void SetController( SfxBaseController* pController );
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >
+ GetController();
+
+ sal_Bool TryContextMenuInterception( Menu& rIn, const OUString& rMenuIdentifier, Menu*& rpOut, ::com::sun::star::ui::ContextMenuExecuteEvent aEvent );
+
+ void ExecPrint( const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >&, sal_Bool, sal_Bool );
+
+ void AddRemoveClipboardListener( const com::sun::star::uno::Reference < com::sun::star::datatransfer::clipboard::XClipboardListener>&, sal_Bool );
+ ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardNotifier > GetClipboardNotifier();
+
+ SAL_DLLPRIVATE SfxInPlaceClient* GetUIActiveIPClient_Impl() const;
+ SAL_DLLPRIVATE void AddContextMenuInterceptor_Impl( const ::com::sun::star::uno::Reference < ::com::sun::star::ui::XContextMenuInterceptor >& xInterceptor );
+ SAL_DLLPRIVATE void RemoveContextMenuInterceptor_Impl( const ::com::sun::star::uno::Reference < ::com::sun::star::ui::XContextMenuInterceptor >& xInterceptor );
+ SAL_DLLPRIVATE bool GlobalKeyInput_Impl( const KeyEvent &rKeyEvent );
+
+ SAL_DLLPRIVATE void NewIPClient_Impl( SfxInPlaceClient *pIPClient )
+ { GetIPClientList_Impl(sal_True)->push_back(pIPClient); }
+ SAL_DLLPRIVATE void IPClientGone_Impl( SfxInPlaceClient *pIPClient );
+ SAL_DLLPRIVATE SfxInPlaceClientList* GetIPClientList_Impl( sal_Bool bCreate = sal_True ) const;
+ SAL_DLLPRIVATE void ResetAllClients_Impl( SfxInPlaceClient *pIP );
+ SAL_DLLPRIVATE void DiscardClients_Impl();
+
+ SAL_DLLPRIVATE SfxPrinter* SetPrinter_Impl( SfxPrinter *pNewPrinter );
+ SAL_DLLPRIVATE sal_Bool IsShowView_Impl() const;
+
+ SAL_DLLPRIVATE long HandleNotifyEvent_Impl( NotifyEvent& rEvent );
+ SAL_DLLPRIVATE sal_Bool HasKeyListeners_Impl();
+ SAL_DLLPRIVATE sal_Bool HasMouseClickListeners_Impl();
+
+ SAL_DLLPRIVATE SfxBaseController* GetBaseController_Impl() const;
+
+ // Shell Interface
+ SAL_DLLPRIVATE void ExecPrint_Impl(SfxRequest &);
+ SAL_DLLPRIVATE void ExecMisc_Impl(SfxRequest &);
+ SAL_DLLPRIVATE void GetState_Impl(SfxItemSet&);
+ SAL_DLLPRIVATE SfxFrameSetDescriptor* GetFrameSet_Impl() const;
+ SAL_DLLPRIVATE void SetFrameSet_Impl(SfxFrameSetDescriptor*);
+ SAL_DLLPRIVATE void CheckIPClient_Impl( SfxInPlaceClient*, const Rectangle& );
+ SAL_DLLPRIVATE void PushSubShells_Impl( sal_Bool bPush=sal_True );
+ SAL_DLLPRIVATE void PopSubShells_Impl() { PushSubShells_Impl( sal_False ); }
+ SAL_DLLPRIVATE void TakeOwnership_Impl();
+ SAL_DLLPRIVATE void TakeFrameOwnership_Impl();
+ SAL_DLLPRIVATE sal_Bool ExecKey_Impl(const KeyEvent& aKey);
+};
+
+//========================================================================
+
+inline void SfxViewShell::LostFocus() const
+
+/* [Description]
+
+ This method has to be called by the application developer, if the edit
+ window has lost the focus. The SFx has for example the ability to turn off
+ the accelerator, so that the cursor keys, the Delete button, etc. work in
+ certain Floating-Windows, even though they are redefined by the
+ Accelerator.
+
+ [Note]
+
+ <StarView> unfortunatly does not provide the possibility to define
+ such events 'from the side'.
+*/
+
+{
+}
+
+//------------------------------------------------------------------------
+
+inline SfxViewFrame* SfxViewShell::GetViewFrame() const
+
+/* [Description]
+
+ This method returns a pointer to the <SfxViewFrame> Instance in which
+ this SfxViewShell is displayed. This is the instance that was passed
+ on in the constructor. It is guaranteed that the returned pointer
+ points on the valid SfxViewFrame instance.
+
+ [Cross-reference]
+
+ <SfxShell::GetFrame()const>
+*/
+
+{
+ return pFrame;
+}
+
+#endif // #ifndef _SFXVIEWSH_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/zoomitem.hxx b/include/sfx2/zoomitem.hxx
new file mode 100644
index 000000000000..ab5c81c425aa
--- /dev/null
+++ b/include/sfx2/zoomitem.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_ZOOMITEM_HXX
+#define _SVX_ZOOMITEM_HXX
+
+#include <svl/intitem.hxx>
+#include <sfx2/sfxsids.hrc>
+#include "sfx2/dllapi.h"
+
+//-------------------------------------------------------------------------
+
+enum SvxZoomType
+{
+ SVX_ZOOM_PERCENT, // GetValue() ist kein besonderer prozentualer Wert
+ SVX_ZOOM_OPTIMAL, // GetValue() entspricht der optimalen Gr"o\se
+ SVX_ZOOM_WHOLEPAGE, // GetValue() entspricht der ganzen Seite
+ SVX_ZOOM_PAGEWIDTH, // GetValue() entspricht der Seitenbreite
+ SVX_ZOOM_PAGEWIDTH_NOBORDER // GetValue() pagewidth without border
+};
+
+//-------------------------------------------------------------------------
+
+class SFX2_DLLPUBLIC SvxZoomItem: public SfxUInt16Item
+{
+ sal_uInt16 nValueSet; // erlaubte Werte (siehe #defines unten)
+ SvxZoomType eType;
+
+public:
+ TYPEINFO();
+
+ SvxZoomItem( SvxZoomType eZoomType = SVX_ZOOM_PERCENT,
+ sal_uInt16 nVal = 0, sal_uInt16 nWhich = SID_ATTR_ZOOM );
+ SvxZoomItem( const SvxZoomItem& );
+ ~SvxZoomItem();
+
+ void SetValueSet( sal_uInt16 nValues ) { nValueSet = nValues; }
+ sal_uInt16 GetValueSet() const { return nValueSet; }
+ bool IsValueAllowed( sal_uInt16 nValue ) const
+ { return nValue == ( nValue & nValueSet ); }
+
+ SvxZoomType GetType() const { return eType; }
+ void SetType( SvxZoomType eNewType )
+ { eType = eNewType; }
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream& rStrm, sal_uInt16 nVersion ) const;
+ virtual SvStream& Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+};
+
+//------------------------------------------------------------------------
+
+#define SVX_ZOOM_ENABLE_50 0x0001
+#define SVX_ZOOM_ENABLE_75 0x0002
+#define SVX_ZOOM_ENABLE_100 0x0004
+#define SVX_ZOOM_ENABLE_150 0x0008
+#define SVX_ZOOM_ENABLE_200 0x0010
+#define SVX_ZOOM_ENABLE_OPTIMAL 0x1000
+#define SVX_ZOOM_ENABLE_WHOLEPAGE 0x2000
+#define SVX_ZOOM_ENABLE_PAGEWIDTH 0x4000
+#define SVX_ZOOM_ENABLE_ALL 0x701F
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/shell/kde_headers.h b/include/shell/kde_headers.h
new file mode 100644
index 000000000000..3ca3fa69ef26
--- /dev/null
+++ b/include/shell/kde_headers.h
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_KDE_HEADERS_H
+#define INCLUDED_VCL_KDE_HEADERS_H
+
+#include <config_vclplug.h>
+
+#if ENABLE_TDE
+
+#include "shell/tde_headers.h"
+
+#else // ENABLE_TDE
+
+/* ********* Suppress warnings if needed */
+#include "sal/config.h"
+
+#include <cstddef>
+
+#if defined __GNUC__
+#pragma GCC system_header
+#endif
+
+
+/* ********* Hack, but needed because of conflicting types... */
+#define Region QtXRegion
+
+
+/* ********* Qt headers */
+#include <qaccessible.h>
+#include <qcheckbox.h>
+#include <qcombobox.h>
+#include <qfont.h>
+#include <qframe.h>
+#include <qlineedit.h>
+#include <qlistview.h>
+#include <qmainwindow.h>
+#include <qmenudata.h>
+#include <qpaintdevice.h>
+#include <qpainter.h>
+#include <qpushbutton.h>
+#include <qradiobutton.h>
+#include <qrangecontrol.h>
+#include <qstring.h>
+#include <qtabbar.h>
+#include <qtabwidget.h>
+#include <qtoolbar.h>
+#include <qtoolbutton.h>
+#include <qwidget.h>
+#include <qprogressbar.h>
+
+/* ********* See hack on top of this file */
+#undef Region
+
+
+/* ********* KDE base headers */
+#include <kaboutdata.h>
+#include <kapplication.h>
+#include <kcmdlineargs.h>
+#include <kconfig.h>
+#include <kdeversion.h>
+#include <kemailsettings.h>
+#include <kglobal.h>
+#include <kglobalsettings.h>
+#include <klocale.h>
+#include <kmainwindow.h>
+#include <kmenubar.h>
+#include <kprotocolmanager.h>
+#include <kstartupinfo.h>
+#include <kstyle.h>
+
+
+/* ********* KDE address book connectivity headers */
+#include <kabc/addressbook.h>
+#include <kabc/addressee.h>
+#include <kabc/field.h>
+#include <kabc/stdaddressbook.h>
+
+#endif // ENABLE_TDE
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/shell/tde_defines.h b/include/shell/tde_defines.h
new file mode 100644
index 000000000000..0dc91e931cee
--- /dev/null
+++ b/include/shell/tde_defines.h
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ * Timothy Pearson <kb9vqf@pearsoncomputing.net> (C) 2012, All Rights Reserved.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_VCL_TDE_DEFINE_HEADERS_H
+#define INCLUDED_VCL_TDE_DEFINE_HEADERS_H
+
+#define QObject TQObject
+#define QWidget TQWidget
+#define QVBox TQVBox
+#define QHBox TQHBox
+#define QGrid TQGrid
+#define QString TQString
+#define QStringList TQStringList
+#define QCustomEvent TQCustomEvent
+#define QMutex TQMutex
+#define QEvent TQEvent
+#define QFont TQFont
+#define QDateTime TQDateTime
+#define QThread TQThread
+#define QStyle TQStyle
+#define QApplication TQApplication
+#define QRect TQRect
+#define QProgressBar TQProgressBar
+#define QPopupMenu TQPopupMenu
+#define QMenuBar TQMenuBar
+#define QToolButton TQToolButton
+#define QToolBar TQToolBar
+#define QScrollBar TQScrollBar
+#define QListView TQListView
+#define QSpinWidget TQSpinWidget
+#define QScrollBar TQScrollBar
+#define QLineEdit TQLineEdit
+#define QComboBox TQComboBox
+#define QCheckBox TQCheckBox
+#define QRadioButton TQRadioButton
+#define QPushButton TQPushButton
+#define QPainter TQPainter
+#define QResizeEvent TQResizeEvent
+#define QShowEvent TQShowEvent
+#define QPoint TQPoint
+#define QDialog TQDialog
+#define QFile TQFile
+#define QLabel TQLabel
+#define QObjectList TQObjectList
+#define QCString TQCString
+#define QRegExp TQRegExp
+#define QSessionManager TQSessionManager
+#define QPaintDevice TQPaintDevice
+#define QTextIStream TQTextIStream
+#define QTextStream TQTextStream
+#define QMutexLocker TQMutexLocker
+#define QValueList TQValueList
+#define QTab TQTab
+#define QTabBar TQTabBar
+#define QTabWidget TQTabWidget
+#define QMainWindow TQMainWindow
+#define QPixmap TQPixmap
+#define QColorGroup TQColorGroup
+#define QStyleOption TQStyleOption
+#define QSize TQSize
+#define QMenuItem TQMenuItem
+#define QFontInfo TQFontInfo
+
+#define qSwap tqSwap
+#define qt_cast tqt_cast
+#define qt_xdisplay tqt_xdisplay
+#define qVersion tqVersion
+
+#define KAboutData TDEAboutData
+#define KApplication TDEApplication
+#define KCmdLineArgs TDECmdLineArgs
+#define KConfig TDEConfig
+#define KGlobal TDEGlobal
+#define KGlobalSettings TDEGlobalSettings
+#define KMainWindow TDEMainWindow
+#define KStartupInfo TDEStartupInfo
+#define KStyle TDEStyle
+#define KToolBar TDEToolBar
+
+#define drawKStylePrimitive drawTDEStylePrimitive
+
+#define KIO TDEIO
+#define KABC TDEABC
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/shell/tde_headers.h b/include/shell/tde_headers.h
new file mode 100644
index 000000000000..ed3739eb2e43
--- /dev/null
+++ b/include/shell/tde_headers.h
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ * Timothy Pearson <kb9vqf@pearsoncomputing.net> (C) 2012, All Rights Reserved.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_VCL_TDE_HEADERS_H
+#define INCLUDED_VCL_TDE_HEADERS_H
+
+/* ********* Suppress warnings if needed */
+#include "sal/config.h"
+
+#include <cstddef>
+
+#if defined __GNUC__
+#pragma GCC system_header
+#endif
+
+
+/* ********* Hack, but needed because of conflicting types... */
+#define Region TQtXRegion
+
+
+/* ********* TQt headers */
+#include <tqaccessible.h>
+#include <tqcheckbox.h>
+#include <tqcombobox.h>
+#include <tqfont.h>
+#include <tqframe.h>
+#include <tqlineedit.h>
+#include <tqlistview.h>
+#include <tqmainwindow.h>
+#include <tqmenudata.h>
+#include <tqpaintdevice.h>
+#include <tqpainter.h>
+#include <tqpushbutton.h>
+#include <tqradiobutton.h>
+#include <tqrangecontrol.h>
+#include <tqstring.h>
+#include <tqtabbar.h>
+#include <tqtabwidget.h>
+#include <tqtoolbar.h>
+#include <tqtoolbutton.h>
+#include <tqwidget.h>
+#include <tqprogressbar.h>
+
+/* ********* See hack on top of this file */
+#undef Region
+
+
+/* ********* TDE base headers */
+#include <tdeaboutdata.h>
+#include <tdeapplication.h>
+#include <tdecmdlineargs.h>
+#include <tdeconfig.h>
+#include <tdeversion.h>
+#include <tdeemailsettings.h>
+#include <tdeglobal.h>
+#include <tdeglobalsettings.h>
+#include <tdelocale.h>
+#include <tdemainwindow.h>
+#include <tdemenubar.h>
+#include <tdeprotocolmanager.h>
+#include <tdestartupinfo.h>
+#include <tdestyle.h>
+
+
+/* ********* TDE address book connectivity headers */
+#include <tdeabc/addressbook.h>
+#include <tdeabc/addressee.h>
+#include <tdeabc/field.h>
+#include <tdeabc/stdaddressbook.h>
+
+#include "tde_defines.h"
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sot/exchange.hxx b/include/sot/exchange.hxx
new file mode 100644
index 000000000000..b4273682de40
--- /dev/null
+++ b/include/sot/exchange.hxx
@@ -0,0 +1,224 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SOT_EXCHANGE_HXX
+#define _SOT_EXCHANGE_HXX
+
+#include <list>
+#include <vector>
+#include <tools/string.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/datatransfer/DataFlavor.hpp>
+#include <com/sun/star/datatransfer/dnd/DNDConstants.hpp>
+#include "sot/sotdllapi.h"
+
+class SotDataObject;
+
+namespace com { namespace sun { namespace star { namespace datatransfer {
+ class XTransferable;
+} } } }
+
+// ---------------------
+// - SotFormatStringId -
+// ---------------------
+
+typedef sal_uLong SotFormatStringId;
+
+// ----------------
+// - DataFlavorEx -
+// ----------------
+
+struct DataFlavorEx : public ::com::sun::star::datatransfer::DataFlavor
+{
+ SotFormatStringId mnSotId;
+};
+
+typedef ::std::vector< ::com::sun::star::datatransfer::DataFlavor > DataFlavorVector;
+typedef ::std::vector< DataFlavorEx > _DataFlavorExVector;
+
+// JP 23.03.2001 - this struct is only for "hide" the STD of the vetor,
+// because our makefile filter all this symbols and so nowbody can use
+// these struct in any interfacses.
+struct DataFlavorExVector : public _DataFlavorExVector
+{
+};
+
+typedef ::std::list< ::com::sun::star::datatransfer::DataFlavor > DataFlavorList;
+typedef ::std::list< DataFlavorEx > DataFlavorExList;
+
+SOT_DLLPUBLIC sal_Bool IsFormatSupported( const DataFlavorExVector& rDataFlavorExVector,
+ sal_uLong nId );
+
+// -------------------------
+// - Vordefinierte Formate -
+// -------------------------
+
+// Die Reihenfolge und die Werte d�rfen nicht ge�ndert werden,
+// da die Implementation sich darauf verl��t.
+// Standard-Formate fuer die es auch Copy/Paste-Methoden gibt
+#define FORMAT_STRING 1
+#define FORMAT_BITMAP 2
+#define FORMAT_GDIMETAFILE 3
+#define FORMAT_PRIVATE 4
+#define FORMAT_FILE 5
+#define FORMAT_FILE_LIST 6
+
+// Weitere Standardformate (diese gehen nur ueber CopyData/PasteData)
+#define FORMAT_RTF 10
+
+// Source-Options
+#define EXCHG_SOURCE_MOVEABLE ((sal_uInt16)0x0001)
+#define EXCHG_SOURCE_COPYABLE ((sal_uInt16)0x0002)
+#define EXCHG_SOURCE_LINKABLE ((sal_uInt16)0x0004)
+#define EXCHG_SOURCE_PRINTABLE ((sal_uInt16)0x0008)
+#define EXCHG_SOURCE_DISCARDABLE ((sal_uInt16)0x0010)
+#define EXCHG_SOURCE_ALL ((sal_uInt16)0x001F)
+#define EXCHG_SOURCE_DEF_COPYABLE ((sal_uInt16)0x0020)
+
+// Aktionen
+#define EXCHG_ACTION_MASK ((sal_uInt16)0x00FF)
+#define EXCHG_INOUT_ACTION_NONE ((sal_uInt16)com::sun::star::datatransfer::dnd::DNDConstants::ACTION_NONE)
+#define EXCHG_IN_ACTION_DEFAULT EXCHG_INOUT_ACTION_NONE
+#define EXCHG_IN_ACTION_MOVE ((sal_uInt16)com::sun::star::datatransfer::dnd::DNDConstants::ACTION_MOVE)
+#define EXCHG_IN_ACTION_COPY ((sal_uInt16)com::sun::star::datatransfer::dnd::DNDConstants::ACTION_COPY)
+#define EXCHG_IN_ACTION_LINK ((sal_uInt16)com::sun::star::datatransfer::dnd::DNDConstants::ACTION_LINK)
+#define EXCHG_INOUT_ACTION_PRINT ((sal_uInt16)8)
+#define EXCHG_INOUT_ACTION_DISCARD ((sal_uInt16)16)
+#define EXCHG_OUT_ACTION_INSERT_OBJ ((sal_uInt16)17)
+#define EXCHG_OUT_ACTION_INSERT_BOOKMARK ((sal_uInt16)18)
+#define EXCHG_OUT_ACTION_INSERT_FILELINK ((sal_uInt16)19)
+#define EXCHG_OUT_ACTION_INSERT_FILE ((sal_uInt16)20)
+#define EXCHG_OUT_ACTION_INSERT_FILELIST ((sal_uInt16)21)
+#define EXCHG_OUT_ACTION_INSERT_IMAGEMAP ((sal_uInt16)22)
+#define EXCHG_OUT_ACTION_INSERT_OLE ((sal_uInt16)23)
+#define EXCHG_OUT_ACTION_INSERT_INTERACTIVE ((sal_uInt16)24)
+#define EXCHG_OUT_ACTION_INSERT_URLBUTTON ((sal_uInt16)25)
+#define EXCHG_OUT_ACTION_INSERT_CHAOSOBJ ((sal_uInt16)26) // OBSOLET ab 500.b ?
+#define EXCHG_OUT_ACTION_REPLACE_OBJ ((sal_uInt16)27)
+#define EXCHG_OUT_ACTION_REPLACE_LINK ((sal_uInt16)28)
+#define EXCHG_OUT_ACTION_REPLACE_IMAGEMAP ((sal_uInt16)29)
+#define EXCHG_OUT_ACTION_GET_ATTRIBUTES ((sal_uInt16)30)
+#define EXCHG_OUT_ACTION_UPLOAD ((sal_uInt16)31) // OBSOLET ab 500.b ?
+#define EXCHG_OUT_ACTION_MOVE_FILE ((sal_uInt16)32)
+#define EXCHG_OUT_ACTION_MOVE_FILELIST ((sal_uInt16)33)
+#define EXCHG_OUT_ACTION_UPDATE_RANGE ((sal_uInt16)34)
+#define EXCHG_OUT_ACTION_INSERT_PRIVATE ((sal_uInt16)35)
+#define EXCHG_OUT_ACTION_INSERT_HTML ((sal_uInt16)36)
+#define EXCHG_OUT_ACTION_MOVE_PRIVATE ((sal_uInt16)37)
+#define EXCHG_OUT_ACTION_INSERT_STRING ((sal_uInt16)38)
+#define EXCHG_OUT_ACTION_INSERT_DRAWOBJ ((sal_uInt16)39)
+#define EXCHG_OUT_ACTION_INSERT_SVXB ((sal_uInt16)40)
+#define EXCHG_OUT_ACTION_INSERT_GDIMETAFILE ((sal_uInt16)41)
+#define EXCHG_OUT_ACTION_INSERT_BITMAP ((sal_uInt16)42)
+#define EXCHG_OUT_ACTION_INSERT_DDE ((sal_uInt16)43)
+#define EXCHG_OUT_ACTION_INSERT_HYPERLINK ((sal_uInt16)44)
+#define EXCHG_OUT_ACTION_REPLACE_DRAWOBJ ((sal_uInt16)45)
+#define EXCHG_OUT_ACTION_REPLACE_SVXB ((sal_uInt16)46)
+#define EXCHG_OUT_ACTION_REPLACE_GDIMETAFILE ((sal_uInt16)47)
+#define EXCHG_OUT_ACTION_REPLACE_BITMAP ((sal_uInt16)48)
+#define EXCHG_OUT_ACTION_REPLACE_GRAPH ((sal_uInt16)49)
+#define EXCHG_OUT_ACTION_INSERT_GRAPH ((sal_uInt16)50)
+#define EXCHG_OUT_ACTION_INSERT_MSGATTACH ((sal_uInt16)51) // obsolet ab 500.b ?
+#define EXCHG_OUT_ACTION_COPY_CHAOSOBJ ((sal_uInt16)52)
+#define EXCHG_OUT_ACTION_MOVE_CHAOSOBJ ((sal_uInt16)53)
+#define EXCHG_OUT_ACTION_COPY_MSGATTACH ((sal_uInt16)54)
+#define EXCHG_OUT_ACTION_COPY_BOOKMARK ((sal_uInt16)55)
+#define EXCHG_OUT_ACTION_COPY_FILE ((sal_uInt16)56)
+
+#define EXCHG_OUT_ACTION_FLAG_CREATE_THEME ((sal_uInt16)0x0100)
+#define EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE ((sal_uInt16)0x0200)
+#define EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP ((sal_uInt16)0x0400)
+#define EXCHG_OUT_ACTION_FLAG_REPLACE_IMAGEMAP ((sal_uInt16)0x0800)
+#define EXCHG_OUT_ACTION_FLAG_FILL ((sal_uInt16)0x1000)
+#define EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL ((sal_uInt16)0x2000)
+
+// Ziele
+#define EXCHG_DEST_DOC_OLEOBJ 1
+#define EXCHG_DEST_CHARTDOC_OLEOBJ 2
+#define EXCHG_DEST_DOC_TEXTFRAME 3
+#define EXCHG_DEST_DOC_GRAPHOBJ 4
+#define EXCHG_DEST_DOC_LNKD_GRAPHOBJ 5
+#define EXCHG_DEST_DOC_GRAPH_W_IMAP 6
+#define EXCHG_DEST_DOC_LNKD_GRAPH_W_IMAP 7
+#define EXCHG_DEST_DOC_IMAPREGION 8
+#define EXCHG_DEST_DOC_DRAWOBJ 9
+#define EXCHG_DEST_DOC_URLBUTTON 10
+#define EXCHG_DEST_DOC_URLFIELD 11
+#define EXCHG_DEST_DOC_GROUPOBJ 12
+#define EXCHG_DEST_SWDOC_FREE_AREA 13
+#define EXCHG_DEST_SCDOC_FREE_AREA 14
+#define EXCHG_DEST_SDDOC_FREE_AREA 15
+#define EXCHG_DEST_DOC_TEXTFRAME_WEB 16
+#define EXCHG_DEST_SWDOC_FREE_AREA_WEB 17
+
+// ------------
+// - Exchange -
+// ------------
+class SvGlobalName;
+class SOT_DLLPUBLIC SotExchange
+{
+public:
+ static sal_uLong RegisterFormat( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+ static sal_uLong RegisterFormatName( const String& rName );
+ static sal_uLong RegisterFormatMimeType( const String& rMimeType );
+
+ static sal_uLong GetFormat( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+ static String GetFormatName( sal_uLong nFormat );
+ static sal_Bool GetFormatDataFlavor( sal_uLong nFormat, ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+ static String GetFormatMimeType( sal_uLong nFormat );
+ static sal_Bool IsInternal( const SvGlobalName& );
+ static sal_uLong GetFormatIdFromMimeType( const String& rMimeType );
+
+ // bestimme die SotFormatStringId von dem registrierten Format
+ //JP 12.11.98: diese 3 Methoden sind ab sofort ueberfluessig, da
+ // die ClipboardIds statisch sind und aequivalent zur
+ // SotFormatStringId ist!
+ static SotFormatStringId GetFormatStringId( sal_uLong nFormat )
+ { return nFormat; }
+ static SotFormatStringId GetFormatStringId( const String& rName )
+ { return SotExchange::RegisterFormatMimeType( rName ); }
+ static sal_uLong RegisterSotFormatName( SotFormatStringId nId )
+ { return nId; }
+
+ // same for XTransferable interface
+ static sal_uInt16 GetExchangeAction(
+ // XTransferable
+ const DataFlavorExVector& rDataFlavorExVector,
+ // Ziel der Aktion (EXCHG_DEST_*)
+ sal_uInt16 nDestination,
+ // Aktionen, die Quelle unterstuetzt (EXCHG_SOURCE_...)
+ sal_uInt16 nSourceOptions,
+ // vom Anwender gewaehlte Aktion (EXCHG_IN_*, EXCHG_INOUT_*)
+ sal_uInt16 nUserAction,
+ // In:- Out: Zu benutzendes Format
+ sal_uLong& rFormat,
+ // In:- Out: Default-Action (EXCHG_IN_*, EXCHG_INOUT_*)
+ sal_uInt16& rDefaultAction,
+ // In:- optional - check only for this specific format
+ sal_uLong nOnlyTestFormat = 0,
+ // In:- optional - check the contents of Xtransferable
+ const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >* pxTransferable = NULL );
+
+ static sal_uInt16 IsChart( const SvGlobalName& rName );
+ static sal_uInt16 IsMath( const SvGlobalName& rName );
+};
+
+#endif // _EXCHANGE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sot/factory.hxx b/include/sot/factory.hxx
new file mode 100644
index 000000000000..726b24382756
--- /dev/null
+++ b/include/sot/factory.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SOT_FACTORY_HXX
+#define _SOT_FACTORY_HXX
+
+#include <tools/globname.hxx>
+#include <tools/rtti.hxx>
+#include "sot/sotdllapi.h"
+#include <vector>
+
+/*************************************************************************
+*************************************************************************/
+class SotObject;
+class SotFactory;
+
+typedef ::std::vector< SotFactory* > SotFactoryList;
+typedef void * (*CreateInstanceType)( SotObject ** );
+
+//==================class SotFactory=======================================
+class SOT_DLLPUBLIC SotFactory : public SvGlobalName
+{
+ sal_uInt16 nSuperCount; // Anzahl der Superklassen
+ const SotFactory ** pSuperClasses; // Superklassen
+ CreateInstanceType pCreateFunc;
+
+ String aClassName;
+
+ static sal_Bool ExistTest( const SvGlobalName & );
+protected:
+ virtual ~SotFactory();
+public:
+ TYPEINFO();
+ static void IncSvObjectCount( SotObject * = NULL );
+ static void DecSvObjectCount( SotObject * = NULL );
+
+ static const SotFactory * Find( const SvGlobalName & );
+
+ SotFactory( const SvGlobalName &,
+ const String & rClassName, CreateInstanceType );
+
+ void PutSuperClass( const SotFactory * );
+ virtual void * CreateInstance( SotObject ** ppObj = NULL ) const;
+
+ sal_Bool Is( const SotFactory * pSuperClass ) const;
+ const SotFactory * GetSuper( sal_uInt16 nPos ) const
+ {
+ return nPos < nSuperCount ?
+ pSuperClasses[ nPos ]
+ : NULL;
+ }
+
+private:
+ SOT_DLLPRIVATE SotFactory( const SotFactory & );
+ SOT_DLLPRIVATE SotFactory & operator = ( const SotFactory & );
+};
+
+#endif // _FACTORY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sot/filelist.hxx b/include/sot/filelist.hxx
new file mode 100644
index 000000000000..2e69a95e5498
--- /dev/null
+++ b/include/sot/filelist.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _FILELIST_HXX
+#define _FILELIST_HXX
+
+#include <tools/stream.hxx>
+#include "sot/sotdllapi.h"
+
+#include <vector>
+typedef ::std::vector< String* > FileStringList;
+
+class SOT_DLLPUBLIC FileList : public SvDataCopyStream
+{
+ FileStringList aStrList;
+
+protected:
+
+ // SvData-Methoden
+ virtual void Load( SvStream& );
+ virtual void Save( SvStream& );
+ virtual void Assign( const SvDataCopyStream& );
+
+ // Liste loeschen;
+ void ClearAll( void );
+
+public:
+
+ TYPEINFO();
+ FileList() {};
+ ~FileList();
+
+ // Zuweisungsoperator
+ FileList& operator=( const FileList& rFileList );
+
+ // Im-/Export
+ SOT_DLLPUBLIC friend SvStream& operator<<( SvStream& rOStm, const FileList& rFileList );
+ SOT_DLLPUBLIC friend SvStream& operator>>( SvStream& rIStm, FileList& rFileList );
+
+ // Liste fuellen/abfragen
+ void AppendFile( const String& rStr );
+ String GetFile( size_t i ) const;
+ size_t Count( void ) const;
+
+};
+
+#endif // _FILELIST_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sot/formats.hxx b/include/sot/formats.hxx
new file mode 100644
index 000000000000..912947669e53
--- /dev/null
+++ b/include/sot/formats.hxx
@@ -0,0 +1,182 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SOT_FORMATS_HXX
+#define _SOT_FORMATS_HXX
+
+#ifdef _SOT_FORMATS_INCLUDE_SYSTEMFORMATS
+
+#ifdef WNT
+#ifdef _MSC_VER
+#pragma warning(push, 1)
+#pragma warning(disable: 4917)
+#endif
+#include <shlobj.h>
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+#endif
+
+#endif
+#include <sot/exchange.hxx>
+
+#define SOT_FORMAT_SYSTEM_START ((sal_uLong)0)
+#define SOT_FORMAT_STRING ((sal_uLong)FORMAT_STRING)
+#define SOT_FORMAT_BITMAP ((sal_uLong)FORMAT_BITMAP)
+#define SOT_FORMAT_GDIMETAFILE ((sal_uLong)FORMAT_GDIMETAFILE)
+#define SOT_FORMAT_PRIVATE ((sal_uLong)FORMAT_PRIVATE)
+#define SOT_FORMAT_FILE ((sal_uLong)FORMAT_FILE)
+#define SOT_FORMAT_FILE_LIST ((sal_uLong)FORMAT_FILE_LIST)
+#define SOT_FORMAT_RTF ((sal_uLong)FORMAT_RTF)
+
+#define SOT_FORMATSTR_ID_DRAWING ((sal_uLong)11)
+#define SOT_FORMATSTR_ID_SVXB ((sal_uLong)12)
+#define SOT_FORMATSTR_ID_SVIM ((sal_uLong)13)
+#define SOT_FORMATSTR_ID_XFA ((sal_uLong)14)
+#define SOT_FORMATSTR_ID_EDITENGINE ((sal_uLong)15)
+#define SOT_FORMATSTR_ID_INTERNALLINK_STATE ((sal_uLong)16)
+#define SOT_FORMATSTR_ID_SOLK ((sal_uLong)17)
+#define SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK ((sal_uLong)18)
+#define SOT_FORMATSTR_ID_TREELISTBOX ((sal_uLong)19)
+#define SOT_FORMATSTR_ID_NATIVE ((sal_uLong)20)
+#define SOT_FORMATSTR_ID_OWNERLINK ((sal_uLong)21)
+#define SOT_FORMATSTR_ID_STARSERVER ((sal_uLong)22)
+#define SOT_FORMATSTR_ID_STAROBJECT ((sal_uLong)23)
+#define SOT_FORMATSTR_ID_APPLETOBJECT ((sal_uLong)24)
+#define SOT_FORMATSTR_ID_PLUGIN_OBJECT ((sal_uLong)25)
+#define SOT_FORMATSTR_ID_STARWRITER_30 ((sal_uLong)26)
+#define SOT_FORMATSTR_ID_STARWRITER_40 ((sal_uLong)27)
+#define SOT_FORMATSTR_ID_STARWRITER_50 ((sal_uLong)28)
+#define SOT_FORMATSTR_ID_STARWRITERWEB_40 ((sal_uLong)29)
+#define SOT_FORMATSTR_ID_STARWRITERWEB_50 ((sal_uLong)30)
+#define SOT_FORMATSTR_ID_STARWRITERGLOB_40 ((sal_uLong)31)
+#define SOT_FORMATSTR_ID_STARWRITERGLOB_50 ((sal_uLong)32)
+#define SOT_FORMATSTR_ID_STARDRAW ((sal_uLong)33)
+#define SOT_FORMATSTR_ID_STARDRAW_40 ((sal_uLong)34)
+#define SOT_FORMATSTR_ID_STARIMPRESS_50 ((sal_uLong)35)
+#define SOT_FORMATSTR_ID_STARDRAW_50 ((sal_uLong)36)
+#define SOT_FORMATSTR_ID_STARCALC ((sal_uLong)37)
+#define SOT_FORMATSTR_ID_STARCALC_40 ((sal_uLong)38)
+#define SOT_FORMATSTR_ID_STARCALC_50 ((sal_uLong)39)
+#define SOT_FORMATSTR_ID_STARCHART ((sal_uLong)40)
+#define SOT_FORMATSTR_ID_STARCHART_40 ((sal_uLong)41)
+#define SOT_FORMATSTR_ID_STARCHART_50 ((sal_uLong)42)
+#define SOT_FORMATSTR_ID_STARIMAGE ((sal_uLong)43)
+#define SOT_FORMATSTR_ID_STARIMAGE_40 ((sal_uLong)44)
+#define SOT_FORMATSTR_ID_STARIMAGE_50 ((sal_uLong)45)
+#define SOT_FORMATSTR_ID_STARMATH ((sal_uLong)46)
+#define SOT_FORMATSTR_ID_STARMATH_40 ((sal_uLong)47)
+#define SOT_FORMATSTR_ID_STARMATH_50 ((sal_uLong)48)
+#define SOT_FORMATSTR_ID_STAROBJECT_PAINTDOC ((sal_uLong)49)
+#define SOT_FORMATSTR_ID_FILLED_AREA ((sal_uLong)50)
+#define SOT_FORMATSTR_ID_HTML ((sal_uLong)51)
+#define SOT_FORMATSTR_ID_HTML_SIMPLE ((sal_uLong)52)
+#define SOT_FORMATSTR_ID_CHAOS ((sal_uLong)53)
+#define SOT_FORMATSTR_ID_CNT_MSGATTACHFILE ((sal_uLong)54)
+#define SOT_FORMATSTR_ID_BIFF_5 ((sal_uLong)55)
+#define SOT_FORMATSTR_ID_BIFF__5 ((sal_uLong)56)
+#define SOT_FORMATSTR_ID_SYLK ((sal_uLong)57)
+#define SOT_FORMATSTR_ID_SYLK_BIGCAPS ((sal_uLong)58)
+#define SOT_FORMATSTR_ID_LINK ((sal_uLong)59)
+#define SOT_FORMATSTR_ID_DIF ((sal_uLong)60)
+#define SOT_FORMATSTR_ID_STARDRAW_TABBAR ((sal_uLong)61)
+#define SOT_FORMATSTR_ID_SONLK ((sal_uLong)62)
+#define SOT_FORMATSTR_ID_MSWORD_DOC ((sal_uLong)63)
+#define SOT_FORMATSTR_ID_STAR_FRAMESET_DOC ((sal_uLong)64)
+#define SOT_FORMATSTR_ID_OFFICE_DOC ((sal_uLong)65)
+#define SOT_FORMATSTR_ID_NOTES_DOCINFO ((sal_uLong)66)
+#define SOT_FORMATSTR_ID_NOTES_HNOTE ((sal_uLong)67)
+#define SOT_FORMATSTR_ID_NOTES_NATIVE ((sal_uLong)68)
+#define SOT_FORMATSTR_ID_SFX_DOC ((sal_uLong)69)
+#define SOT_FORMATSTR_ID_EVDF ((sal_uLong)70)
+#define SOT_FORMATSTR_ID_ESDF ((sal_uLong)71)
+#define SOT_FORMATSTR_ID_IDF ((sal_uLong)72)
+#define SOT_FORMATSTR_ID_EFTP ((sal_uLong)73)
+#define SOT_FORMATSTR_ID_EFD ((sal_uLong)74)
+#define SOT_FORMATSTR_ID_SVX_FORMFIELDEXCH ((sal_uLong)75)
+#define SOT_FORMATSTR_ID_EXTENDED_TABBAR ((sal_uLong)76)
+#define SOT_FORMATSTR_ID_SBA_DATAEXCHANGE ((sal_uLong)77)
+#define SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE ((sal_uLong)78)
+#define SOT_FORMATSTR_ID_SBA_PRIVATE_URL ((sal_uLong)79)
+#define SOT_FORMATSTR_ID_SBA_TABED ((sal_uLong)80)
+#define SOT_FORMATSTR_ID_SBA_TABID ((sal_uLong)81)
+#define SOT_FORMATSTR_ID_SBA_JOIN ((sal_uLong)82)
+#define SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ((sal_uLong)83)
+#define SOT_FORMATSTR_ID_LINKSRCDESCRIPTOR ((sal_uLong)84)
+#define SOT_FORMATSTR_ID_EMBED_SOURCE ((sal_uLong)85)
+#define SOT_FORMATSTR_ID_LINK_SOURCE ((sal_uLong)86)
+#define SOT_FORMATSTR_ID_EMBEDDED_OBJ ((sal_uLong)87)
+#define SOT_FORMATSTR_ID_FILECONTENT ((sal_uLong)88)
+#define SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR ((sal_uLong)89)
+#define SOT_FORMATSTR_ID_FILENAME ((sal_uLong)90)
+#define SOT_FORMATSTR_ID_SD_OLE ((sal_uLong)91)
+#define SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE ((sal_uLong)92)
+#define SOT_FORMATSTR_ID_EMBED_SOURCE_OLE ((sal_uLong)93)
+#define SOT_FORMATSTR_ID_OBJECTDESCRIPTOR_OLE ((sal_uLong)94)
+#define SOT_FORMATSTR_ID_LINKSRCDESCRIPTOR_OLE ((sal_uLong)95)
+#define SOT_FORMATSTR_ID_LINK_SOURCE_OLE ((sal_uLong)96)
+#define SOT_FORMATSTR_ID_SBA_CTRLDATAEXCHANGE ((sal_uLong)97)
+#define SOT_FORMATSTR_ID_OUTPLACE_OBJ ((sal_uLong)98)
+#define SOT_FORMATSTR_ID_CNT_OWN_CLIP ((sal_uLong)99)
+#define SOT_FORMATSTR_ID_INET_IMAGE ((sal_uLong)100)
+#define SOT_FORMATSTR_ID_NETSCAPE_IMAGE ((sal_uLong)101)
+#define SOT_FORMATSTR_ID_SBA_FORMEXCHANGE ((sal_uLong)102)
+#define SOT_FORMATSTR_ID_SBA_REPORTEXCHANGE ((sal_uLong)103)
+#define SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR ((sal_uLong)104)
+#define SOT_FORMATSTR_ID_STARCHARTDOCUMENT_50 ((sal_uLong)105)
+#define SOT_FORMATSTR_ID_GRAPHOBJ ((sal_uLong)106)
+#define SOT_FORMATSTR_ID_STARWRITER_60 ((sal_uLong)107)
+#define SOT_FORMATSTR_ID_STARWRITERWEB_60 ((sal_uLong)108)
+#define SOT_FORMATSTR_ID_STARWRITERGLOB_60 ((sal_uLong)109)
+#define SOT_FORMATSTR_ID_STARDRAW_60 ((sal_uLong)110)
+#define SOT_FORMATSTR_ID_STARIMPRESS_60 ((sal_uLong)111)
+#define SOT_FORMATSTR_ID_STARCALC_60 ((sal_uLong)112)
+#define SOT_FORMATSTR_ID_STARCHART_60 ((sal_uLong)113)
+#define SOT_FORMATSTR_ID_STARMATH_60 ((sal_uLong)114)
+#define SOT_FORMATSTR_ID_WMF ((sal_uLong)115)
+#define SOT_FORMATSTR_ID_DBACCESS_QUERY ((sal_uLong)116)
+#define SOT_FORMATSTR_ID_DBACCESS_TABLE ((sal_uLong)117)
+#define SOT_FORMATSTR_ID_DBACCESS_COMMAND ((sal_uLong)118)
+#define SOT_FORMATSTR_ID_DIALOG_60 ((sal_uLong)119)
+#define SOT_FORMATSTR_ID_EMF ((sal_uLong)120)
+#define SOT_FORMATSTR_ID_BIFF_8 ((sal_uLong)121)
+#define SOT_FORMATSTR_ID_BMP ((sal_uLong)122)
+#define SOT_FORMATSTR_ID_HTML_NO_COMMENT ((sal_uLong)123)
+#define SOT_FORMATSTR_ID_STARWRITER_8 ((sal_uLong)124)
+#define SOT_FORMATSTR_ID_STARWRITERWEB_8 ((sal_uLong)125)
+#define SOT_FORMATSTR_ID_STARWRITERGLOB_8 ((sal_uLong)126)
+#define SOT_FORMATSTR_ID_STARDRAW_8 ((sal_uLong)127)
+#define SOT_FORMATSTR_ID_STARIMPRESS_8 ((sal_uLong)128)
+#define SOT_FORMATSTR_ID_STARCALC_8 ((sal_uLong)129)
+#define SOT_FORMATSTR_ID_STARCHART_8 ((sal_uLong)130)
+#define SOT_FORMATSTR_ID_STARMATH_8 ((sal_uLong)131)
+#define SOT_FORMATSTR_ID_XFORMS ((sal_uLong)132)
+#define SOT_FORMATSTR_ID_STARWRITER_8_TEMPLATE ((sal_uLong)133)
+#define SOT_FORMATSTR_ID_STARDRAW_8_TEMPLATE ((sal_uLong)134)
+#define SOT_FORMATSTR_ID_STARIMPRESS_8_TEMPLATE ((sal_uLong)135)
+#define SOT_FORMATSTR_ID_STARCALC_8_TEMPLATE ((sal_uLong)136)
+#define SOT_FORMATSTR_ID_STARCHART_8_TEMPLATE ((sal_uLong)137)
+#define SOT_FORMATSTR_ID_STARMATH_8_TEMPLATE ((sal_uLong)138)
+#define SOT_FORMATSTR_ID_STARBASE_8 ((sal_uLong)139)
+#define SOT_FORMATSTR_ID_HC_GDIMETAFILE ((sal_uLong)140)
+#define SOT_FORMATSTR_ID_USER_END SOT_FORMATSTR_ID_HC_GDIMETAFILE
+
+#endif // _SOT_FORMATS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sot/object.hxx b/include/sot/object.hxx
new file mode 100644
index 000000000000..435dda8d4626
--- /dev/null
+++ b/include/sot/object.hxx
@@ -0,0 +1,307 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SOT_OBJECT_HXX
+#define _SOT_OBJECT_HXX
+
+#include <sot/sotdata.hxx>
+#include <tools/globname.hxx>
+#include <tools/ref.hxx>
+#include "sot/sotdllapi.h"
+
+/*************************************************************************
+*************************************************************************/
+
+#define SO2_DECL_BASIC_CLASS_DLL(ClassName,FacName) \
+private: \
+ static SotFactory ** GetFactoryAdress() \
+ { return &(FacName->p##ClassName##Factory); } \
+public: \
+ static void * CreateInstance( SotObject ** = NULL ); \
+ static SotFactory * ClassFactory(); \
+ virtual const SotFactory * GetSvFactory() const; \
+ virtual void * Cast( const SotFactory * );
+
+#define SO2_DECL_BASIC_CLASS(ClassName) \
+private: \
+ static SotFactory * pFactory; \
+ static SotFactory ** GetFactoryAdress() { return &pFactory; } \
+public: \
+ static void * CreateInstance( SotObject ** = NULL ); \
+ static SotFactory * ClassFactory(); \
+ virtual const SotFactory * GetSvFactory() const; \
+ virtual void * Cast( const SotFactory * );
+
+/**************************************************************************
+**************************************************************************/
+#define SO2_IMPL_BASIC_CLASS_DLL(ClassName,FactoryName,GlobalName) \
+SotFactory * ClassName::ClassFactory() \
+{ \
+ SotFactory **ppFactory = GetFactoryAdress(); \
+ if( !*ppFactory ) \
+ { \
+ *ppFactory = new FactoryName( GlobalName, \
+ OUString( #ClassName ), ClassName::CreateInstance ); \
+ } \
+ return *ppFactory; \
+} \
+void * ClassName::CreateInstance( SotObject ** ppObj ) \
+{ \
+ ClassName * p = new ClassName(); \
+ if( ppObj ) \
+ *ppObj = p; \
+ return p; \
+} \
+const SotFactory * ClassName::GetSvFactory() const \
+{ \
+ return ClassFactory(); \
+} \
+void * ClassName::Cast( const SotFactory * pFact ) \
+{ \
+ void * pRet = NULL; \
+ if( !pFact || pFact == ClassFactory() ) \
+ pRet = this; \
+ return pRet; \
+}
+
+#define SO2_IMPL_BASIC_CLASS(ClassName,FactoryName,GlobalName) \
+SotFactory * ClassName::pFactory = NULL; \
+ SO2_IMPL_BASIC_CLASS_DLL(ClassName,FactoryName,GlobalName)
+
+/**************************************************************************
+**************************************************************************/
+#define SO2_IMPL_BASIC_CLASS1_DLL(ClassName,FactoryName,Super1,GlobalName)\
+SotFactory * ClassName::ClassFactory() \
+{ \
+ SotFactory **ppFactory = GetFactoryAdress(); \
+ if( !*ppFactory ) \
+ { \
+ *ppFactory = new FactoryName( GlobalName, \
+ OUString( #ClassName ), ClassName::CreateInstance ); \
+ (*ppFactory)->PutSuperClass( Super1::ClassFactory() ); \
+ } \
+ return *ppFactory; \
+} \
+void * ClassName::CreateInstance( SotObject ** ppObj ) \
+{ \
+ ClassName * p = new ClassName(); \
+ Super1* pSuper1 = p; \
+ SotObject* pBasicObj = pSuper1; \
+ if( ppObj ) \
+ *ppObj = pBasicObj; \
+ return p; \
+} \
+const SotFactory * ClassName::GetSvFactory() const \
+{ \
+ return ClassFactory(); \
+} \
+void * ClassName::Cast( const SotFactory * pFact ) \
+{ \
+ void * pRet = NULL; \
+ if( !pFact || pFact == ClassFactory() ) \
+ pRet = this; \
+ if( !pRet ) \
+ pRet = Super1::Cast( pFact ); \
+ return pRet; \
+}
+
+#define SO2_IMPL_BASIC_CLASS1(ClassName,FactoryName,Super1,GlobalName) \
+SotFactory * ClassName::pFactory = NULL; \
+ SO2_IMPL_BASIC_CLASS1_DLL(ClassName,FactoryName,Super1,GlobalName)
+
+/**************************************************************************
+**************************************************************************/
+#define SO2_IMPL_BASIC_CLASS2_DLL(ClassName,FactoryName,Super1,Super2,GlobalName) \
+SotFactory * ClassName::ClassFactory() \
+{ \
+ SotFactory **ppFactory = GetFactoryAdress(); \
+ if( !*ppFactory ) \
+ { \
+ *ppFactory = new FactoryName( GlobalName, \
+ OUString( #ClassName ), ClassName::CreateInstance ); \
+ (*ppFactory)->PutSuperClass( Super1::ClassFactory() ); \
+ (*ppFactory)->PutSuperClass( Super2::ClassFactory() ); \
+ } \
+ return *ppFactory; \
+} \
+void * ClassName::CreateInstance( SotObject ** ppObj ) \
+{ \
+ ClassName * p = new ClassName(); \
+ if( ppObj ) \
+ *ppObj = p; \
+ return p; \
+} \
+const SotFactory * ClassName::GetSvFactory() const \
+{ \
+ return ClassFactory(); \
+} \
+void * ClassName::Cast( const SotFactory * pFact ) \
+{ \
+ void * pRet = NULL; \
+ if( !pFact || pFact == ClassFactory() ) \
+ pRet = this; \
+ if( !pRet ) \
+ pRet = Super1::Cast( pFact ); \
+ if( !pRet ) \
+ pRet = Super2::Cast( pFact ); \
+ return pRet; \
+}
+#define SO2_IMPL_BASIC_CLASS2(ClassName,FactoryName,Super1,Super2,GlobalName) \
+SotFactory * ClassName::pFactory = NULL; \
+ SO2_IMPL_BASIC_CLASS2_DLL(ClassName,FactoryName,Super1,Super2,GlobalName)
+
+/**************************************************************************
+**************************************************************************/
+#define SO2_IMPL_BASIC_CLASS3_DLL(ClassName,FactoryName,Super1,Super2,Super3,GlobalName) \
+SotFactory * ClassName::ClassFactory() \
+{ \
+ SotFactory **ppFactory = GetFactoryAdress(); \
+ if( !*ppFactory ) \
+ { \
+ *ppFactory = new FactoryName( GlobalName, \
+ OUString( #ClassName ), ClassName::CreateInstance ); \
+ (*ppFactory)->PutSuperClass( Super1::ClassFactory() ); \
+ (*ppFactory)->PutSuperClass( Super2::ClassFactory() ); \
+ (*ppFactory)->PutSuperClass( Super3::ClassFactory() ); \
+ } \
+ return *pFactory; \
+} \
+void * ClassName::CreateInstance( SotObject ** ppObj ) \
+{ \
+ ClassName * p = new ClassName(); \
+ if( ppObj ) \
+ *ppObj = p; \
+ return p; \
+} \
+const SotFactory * ClassName::GetSvFactory() const \
+{ \
+ return ClassFactory(); \
+} \
+void * ClassName::Cast( const SotFactory * pFact ) \
+{ \
+ void * pRet = NULL; \
+ if( !pFact || pFact == ClassFactory() ) \
+ pRet = this; \
+ if( !pRet ) \
+ pRet = Super1::Cast( pFact ); \
+ if( !pRet ) \
+ pRet = Super2::Cast( pFact ); \
+ if( !pRet ) \
+ pRet = Super3::Cast( pFact ); \
+ return pRet; \
+}
+
+#define SO2_IMPL_BASIC_CLASS3(ClassName,FactoryName,Super1,Super2,Super3,GlobalName) \
+SotFactory * ClassName::pFactory = NULL; \
+ SO2_IMPL_BASIC_CLASS3_DLL(ClassName,FactoryName,Super1,Super2,Super3,GlobalName)
+
+/**************************************************************************
+**************************************************************************/
+#define SO2_IMPL_BASIC_CLASS4_DLL(ClassName,FactoryName,Super1,Super2,Super3,Super4,GlobalName) \
+SotFactory * ClassName::ClassFactory() \
+{ \
+ SotFactory **ppFactory = GetFactoryAdress(); \
+ if( !*ppFactory ) \
+ { \
+ *ppFactory = new SotFactory( GlobalName, \
+ OUString( #ClassName ), ClassName::CreateInstance ); \
+ (*ppFactory)->PutSuperClass( Super1::ClassFactory() ); \
+ (*ppFactory)->PutSuperClass( Super2::ClassFactory() ); \
+ (*ppFactory)->PutSuperClass( Super3::ClassFactory() ); \
+ (*ppFactory)->PutSuperClass( Super4::ClassFactory() ); \
+ } \
+ return *ppFactory; \
+} \
+void * ClassName::CreateInstance( SotObject ** ppObj ) \
+{ \
+ ClassName * p = new ClassName(); \
+ if( ppObj ) \
+ *ppObj = p; \
+ return p; \
+} \
+const SotFactory * ClassName::GetSvFactory() const \
+{ \
+ return ClassFactory(); \
+} \
+void * ClassName::Cast( const SotFactory * pFact ) \
+{ \
+ void * pRet = NULL; \
+ if( !pFact || pFact == ClassFactory() ) \
+ pRet = this; \
+ if( !pRet ) \
+ pRet = Super1::Cast( pFact ); \
+ if( !pRet ) \
+ pRet = Super2::Cast( pFact ); \
+ if( !pRet ) \
+ pRet = Super3::Cast( pFact ); \
+ if( !pRet ) \
+ pRet = Super4::Cast( pFact ); \
+ return pRet; \
+}
+
+#define SO2_IMPL_BASIC_CLASS4(ClassName,FactoryName,Super1,Super2,Super3,Super4,GlobalName) \
+SotFactory * ClassName::pFactory = NULL; \
+ SO2_IMPL_BASIC_CLASS4_DLL(ClassName,FactoryName,Super1,Super2,Super3,Super4,GlobalName)
+
+//==================class SotObject========================================
+#ifdef _MSC_VER
+#pragma warning(disable: 4250)
+#endif
+
+struct IUnknown;
+class SOT_DLLPUBLIC SotObject : virtual public SvRefBase
+{
+friend class SotFactory;
+friend class SvObject;
+ sal_uInt16 nOwnerLockCount;
+ sal_Bool bOwner:1,
+ bSVObject:1, // Ist Proxy, dann TRUE wenn andere Seite SV ist
+ bInClose:1; // TRUE, im DoClose
+
+protected:
+ virtual ~SotObject();
+ void SetExtern() { bOwner = sal_False; }
+ virtual sal_Bool Close();
+public:
+ SotObject();
+ SO2_DECL_BASIC_CLASS_DLL(SotObject,SOTDATA())
+
+ // Nur damit die Makros in So3 nicht ganz ausufern
+ virtual IUnknown * GetInterface( const SvGlobalName & );
+
+ sal_Bool Owner() const { return bOwner; }
+
+ sal_uInt16 GetOwnerLockCount() const { return nOwnerLockCount; }
+
+ void OwnerLock( sal_Bool bLock );
+ sal_Bool DoClose();
+ sal_Bool IsInClose() const { return bInClose; }
+
+private:
+ // Kopieren und Zuweisen dieses Objekttyps ist nicht erlaubt
+ SOT_DLLPRIVATE SotObject & operator = ( const SotObject & );
+ SOT_DLLPRIVATE SotObject( const SotObject & );
+};
+
+//==================class SotObjectRef======================================
+SV_DECL_IMPL_REF(SotObject)
+
+#endif // _IFACE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sot/sotdata.hxx b/include/sot/sotdata.hxx
new file mode 100644
index 000000000000..da045079c76e
--- /dev/null
+++ b/include/sot/sotdata.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SOT_DATA_HXX
+#define _SOT_DATA_HXX
+
+/*************************************************************************
+*************************************************************************/
+
+#include <tools/solar.h>
+#include "sot/sotdllapi.h"
+#include <com/sun/star/datatransfer/DataFlavor.hpp>
+#include <vector>
+#include <list>
+
+//==================class SotData_Impl====================================
+
+class SotFactory;
+class SotObject;
+
+typedef ::std::vector< SotFactory* > SotFactoryList;
+typedef ::std::vector< com::sun::star::datatransfer::DataFlavor* > tDataFlavorList;
+
+struct SotData_Impl
+{
+ sal_uInt32 nSvObjCount;
+ std::list<SotObject*> aObjectList;
+ SotFactoryList * pFactoryList;
+ SotFactory * pSotObjectFactory;
+ SotFactory * pSotStorageStreamFactory;
+ SotFactory * pSotStorageFactory;
+ tDataFlavorList* pDataFlavorList;
+ SotData_Impl();
+ ~SotData_Impl();
+};
+
+SOT_DLLPUBLIC SotData_Impl* SOTDATA();
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sot/sotdllapi.h b/include/sot/sotdllapi.h
new file mode 100644
index 000000000000..722d2ee25f47
--- /dev/null
+++ b/include/sot/sotdllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SOTDLLAPI_H
+#define INCLUDED_SOTDLLAPI_H
+
+#include "sal/types.h"
+
+#if defined(SOT_DLLIMPLEMENTATION)
+#define SOT_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define SOT_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define SOT_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif /* INCLUDED_SOTDLLAPI_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sot/stg.hxx b/include/sot/stg.hxx
new file mode 100644
index 000000000000..bd124cc8df00
--- /dev/null
+++ b/include/sot/stg.hxx
@@ -0,0 +1,366 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _STG_HXX
+#define _STG_HXX
+
+#include <com/sun/star/uno/Any.h>
+#include <com/sun/star/uno/Reference.h>
+
+#include <com/sun/star/io/XInputStream.hpp>
+
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+
+#include <com/sun/star/embed/XStorage.hpp>
+
+
+#include <tools/rtti.hxx>
+#include <tools/stream.hxx>
+#include <tools/globname.hxx>
+#include "sot/storinfo.hxx"
+#include "sot/sotdllapi.h"
+
+class Storage;
+class StorageStream;
+class StgIo;
+class StgDirEntry;
+class StgStrm;
+class SvGlobalName;
+struct ClsId
+{
+ sal_Int32 n1;
+ sal_Int16 n2, n3;
+ sal_uInt8 n4, n5, n6, n7, n8, n9, n10, n11;
+};
+
+class SOT_DLLPUBLIC StorageBase : public SvRefBase
+{
+protected:
+ sal_uLong m_nError; // error code
+ StreamMode m_nMode; // open mode
+ sal_Bool m_bAutoCommit;
+ StorageBase();
+ virtual ~StorageBase();
+public:
+ TYPEINFO();
+ virtual const SvStream* GetSvStream() const = 0;
+ virtual sal_Bool Validate( sal_Bool=sal_False ) const = 0;
+ virtual sal_Bool ValidateMode( StreamMode ) const = 0;
+ void ResetError() const;
+ void SetError( sal_uLong ) const;
+ sal_uLong GetError() const;
+ sal_Bool Good() const { return sal_Bool( m_nError == SVSTREAM_OK ); }
+ StreamMode GetMode() const { return m_nMode; }
+ void SetAutoCommit( sal_Bool bSet )
+ { m_bAutoCommit = bSet; }
+};
+
+class BaseStorageStream : public StorageBase
+{
+public:
+ TYPEINFO();
+ virtual sal_uLong Read( void * pData, sal_uLong nSize ) = 0;
+ virtual sal_uLong Write( const void* pData, sal_uLong nSize ) = 0;
+ virtual sal_uLong Seek( sal_uLong nPos ) = 0;
+ virtual sal_uLong Tell() = 0;
+ virtual void Flush() = 0;
+ virtual sal_Bool SetSize( sal_uLong nNewSize ) = 0;
+ virtual sal_uLong GetSize() const = 0;
+ virtual sal_Bool CopyTo( BaseStorageStream * pDestStm ) = 0;
+ virtual sal_Bool Commit() = 0;
+ virtual sal_Bool Revert() = 0;
+ virtual sal_Bool Equals( const BaseStorageStream& rStream ) const = 0;
+};
+
+class BaseStorage : public StorageBase
+{
+public:
+ TYPEINFO();
+ virtual const String& GetName() const = 0;
+ virtual sal_Bool IsRoot() const = 0;
+ virtual void SetClassId( const ClsId& ) = 0;
+ virtual const ClsId& GetClassId() const = 0;
+ virtual void SetDirty() = 0;
+ virtual void SetClass( const SvGlobalName & rClass,
+ sal_uLong nOriginalClipFormat,
+ const String & rUserTypeName ) = 0;
+ virtual void SetConvertClass( const SvGlobalName & rConvertClass,
+ sal_uLong nOriginalClipFormat,
+ const String & rUserTypeName ) = 0;
+ virtual SvGlobalName GetClassName() = 0;
+ virtual sal_uLong GetFormat() = 0;
+ virtual String GetUserName() = 0;
+ virtual sal_Bool ShouldConvert() = 0;
+ virtual void FillInfoList( SvStorageInfoList* ) const = 0;
+ virtual sal_Bool CopyTo( BaseStorage* pDestStg ) const = 0;
+ virtual sal_Bool Commit() = 0;
+ virtual sal_Bool Revert() = 0;
+ virtual BaseStorageStream* OpenStream( const String & rEleName,
+ StreamMode = STREAM_STD_READWRITE,
+ sal_Bool bDirect = sal_True, const OString* pKey=0 ) = 0;
+ virtual BaseStorage* OpenStorage( const String & rEleName,
+ StreamMode = STREAM_STD_READWRITE,
+ bool bDirect = false ) = 0;
+ virtual BaseStorage* OpenUCBStorage( const String & rEleName,
+ StreamMode = STREAM_STD_READWRITE,
+ sal_Bool bDirect = sal_False ) = 0;
+ virtual BaseStorage* OpenOLEStorage( const String & rEleName,
+ StreamMode = STREAM_STD_READWRITE,
+ sal_Bool bDirect = sal_False ) = 0;
+ virtual sal_Bool IsStream( const String& rEleName ) const = 0;
+ virtual sal_Bool IsStorage( const String& rEleName ) const = 0;
+ virtual sal_Bool IsContained( const String& rEleName ) const = 0;
+ virtual sal_Bool Remove( const String & rEleName ) = 0;
+ virtual sal_Bool Rename( const String & rEleName, const String & rNewName ) = 0;
+ virtual sal_Bool CopyTo( const String & rEleName, BaseStorage * pDest, const String & rNewName ) = 0;
+ virtual sal_Bool MoveTo( const String & rEleName, BaseStorage * pDest, const String & rNewName ) = 0;
+ virtual sal_Bool ValidateFAT() = 0;
+ virtual sal_Bool Equals( const BaseStorage& rStream ) const = 0;
+};
+
+class OLEStorageBase
+{
+protected:
+ StreamMode& nStreamMode; // open mode
+ StgIo* pIo; // I/O subsystem
+ StgDirEntry* pEntry; // the dir entry
+ OLEStorageBase( StgIo*, StgDirEntry*, StreamMode& );
+ ~OLEStorageBase();
+ sal_Bool Validate_Impl( sal_Bool=sal_False ) const;
+ sal_Bool ValidateMode_Impl( StreamMode, StgDirEntry* p = NULL ) const ;
+ const SvStream* GetSvStream_Impl() const;
+public:
+};
+
+class StorageStream : public BaseStorageStream, public OLEStorageBase
+{
+//friend class Storage;
+ sal_uLong nPos; // current position
+protected:
+ ~StorageStream();
+public:
+ TYPEINFO();
+ StorageStream( StgIo*, StgDirEntry*, StreamMode );
+ virtual sal_uLong Read( void * pData, sal_uLong nSize );
+ virtual sal_uLong Write( const void* pData, sal_uLong nSize );
+ virtual sal_uLong Seek( sal_uLong nPos );
+ virtual sal_uLong Tell() { return nPos; }
+ virtual void Flush();
+ virtual sal_Bool SetSize( sal_uLong nNewSize );
+ virtual sal_uLong GetSize() const;
+ virtual sal_Bool CopyTo( BaseStorageStream * pDestStm );
+ virtual sal_Bool Commit();
+ virtual sal_Bool Revert();
+ virtual sal_Bool Validate( sal_Bool=sal_False ) const;
+ virtual sal_Bool ValidateMode( StreamMode ) const;
+ const SvStream* GetSvStream() const;
+ virtual sal_Bool Equals( const BaseStorageStream& rStream ) const;
+};
+
+class UCBStorageStream;
+
+class SOT_DLLPUBLIC Storage : public BaseStorage, public OLEStorageBase
+{
+ String aName;
+ sal_Bool bIsRoot;
+ void Init( sal_Bool bCreate );
+ Storage( StgIo*, StgDirEntry*, StreamMode );
+protected:
+ ~Storage();
+public:
+ TYPEINFO();
+ Storage( const String &, StreamMode = STREAM_STD_READWRITE, sal_Bool bDirect = sal_True );
+ Storage( SvStream& rStrm, sal_Bool bDirect = sal_True );
+ Storage( UCBStorageStream& rStrm, sal_Bool bDirect = sal_True );
+
+ static sal_Bool IsStorageFile( const String & rFileName );
+ static sal_Bool IsStorageFile( SvStream* );
+
+ virtual const String& GetName() const;
+ virtual sal_Bool IsRoot() const { return bIsRoot; }
+ virtual void SetClassId( const ClsId& );
+ virtual const ClsId& GetClassId() const;
+ virtual void SetDirty();
+ virtual void SetClass( const SvGlobalName & rClass,
+ sal_uLong nOriginalClipFormat,
+ const String & rUserTypeName );
+ virtual void SetConvertClass( const SvGlobalName & rConvertClass,
+ sal_uLong nOriginalClipFormat,
+ const String & rUserTypeName );
+ virtual SvGlobalName GetClassName();
+ virtual sal_uLong GetFormat();
+ virtual String GetUserName();
+ virtual sal_Bool ShouldConvert();
+ virtual void FillInfoList( SvStorageInfoList* ) const;
+ virtual sal_Bool CopyTo( BaseStorage* pDestStg ) const;
+ virtual sal_Bool Commit();
+ virtual sal_Bool Revert();
+ virtual BaseStorageStream* OpenStream( const String & rEleName,
+ StreamMode = STREAM_STD_READWRITE,
+ sal_Bool bDirect = sal_True, const OString* pKey=0 );
+ virtual BaseStorage* OpenStorage( const String & rEleName,
+ StreamMode = STREAM_STD_READWRITE,
+ bool bDirect = false );
+ virtual BaseStorage* OpenUCBStorage( const String & rEleName,
+ StreamMode = STREAM_STD_READWRITE,
+ sal_Bool bDirect = sal_False );
+ virtual BaseStorage* OpenOLEStorage( const String & rEleName,
+ StreamMode = STREAM_STD_READWRITE,
+ sal_Bool bDirect = sal_False );
+ virtual sal_Bool IsStream( const String& rEleName ) const;
+ virtual sal_Bool IsStorage( const String& rEleName ) const;
+ virtual sal_Bool IsContained( const String& rEleName ) const;
+ virtual sal_Bool Remove( const String & rEleName );
+ virtual sal_Bool Rename( const String & rEleName, const String & rNewName );
+ virtual sal_Bool CopyTo( const String & rEleName, BaseStorage * pDest, const String & rNewName );
+ virtual sal_Bool MoveTo( const String & rEleName, BaseStorage * pDest, const String & rNewName );
+ virtual sal_Bool ValidateFAT();
+ virtual sal_Bool Validate( sal_Bool=sal_False ) const;
+ virtual sal_Bool ValidateMode( StreamMode ) const;
+ sal_Bool ValidateMode( StreamMode, StgDirEntry* p ) const;
+ virtual const SvStream* GetSvStream() const;
+ virtual sal_Bool Equals( const BaseStorage& rStream ) const;
+};
+
+class UCBStorageStream_Impl;
+class UCBStorageStream : public BaseStorageStream
+{
+friend class UCBStorage;
+
+ UCBStorageStream_Impl*
+ pImp;
+protected:
+ ~UCBStorageStream();
+public:
+ TYPEINFO();
+ UCBStorageStream( const String& rName, StreamMode nMode, sal_Bool bDirect, const OString* pKey, sal_Bool bRepair, ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XProgressHandler > xProgress );
+ UCBStorageStream( UCBStorageStream_Impl* );
+
+ virtual sal_uLong Read( void * pData, sal_uLong nSize );
+ virtual sal_uLong Write( const void* pData, sal_uLong nSize );
+ virtual sal_uLong Seek( sal_uLong nPos );
+ virtual sal_uLong Tell();
+ virtual void Flush();
+ virtual sal_Bool SetSize( sal_uLong nNewSize );
+ virtual sal_uLong GetSize() const;
+ virtual sal_Bool CopyTo( BaseStorageStream * pDestStm );
+ virtual sal_Bool Commit();
+ virtual sal_Bool Revert();
+ virtual sal_Bool Validate( sal_Bool=sal_False ) const;
+ virtual sal_Bool ValidateMode( StreamMode ) const;
+ const SvStream* GetSvStream() const;
+ virtual sal_Bool Equals( const BaseStorageStream& rStream ) const;
+ sal_Bool SetProperty( const String& rName, const ::com::sun::star::uno::Any& rValue );
+
+ SvStream* GetModifySvStream();
+};
+
+namespace ucbhelper
+{
+ class Content;
+}
+
+class UCBStorage_Impl;
+struct UCBStorageElement_Impl;
+class SOT_DLLPUBLIC UCBStorage : public BaseStorage
+{
+ UCBStorage_Impl* pImp;
+
+protected:
+ ~UCBStorage();
+public:
+ static sal_Bool IsStorageFile( SvStream* );
+ static sal_Bool IsDiskSpannedFile( SvStream* );
+ static String GetLinkedFile( SvStream& );
+ static String CreateLinkFile( const String& rName );
+
+ UCBStorage( const ::ucbhelper::Content& rContent, const String& rName, StreamMode nMode, sal_Bool bDirect = sal_True, sal_Bool bIsRoot = sal_True );
+ UCBStorage( const String& rName,
+ StreamMode nMode,
+ sal_Bool bDirect = sal_True,
+ sal_Bool bIsRoot = sal_True );
+
+ UCBStorage( const String& rName,
+ StreamMode nMode,
+ sal_Bool bDirect,
+ sal_Bool bIsRoot,
+ sal_Bool bIsRepair,
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XProgressHandler >
+ xProgressHandler );
+
+ UCBStorage( UCBStorage_Impl* );
+ UCBStorage( SvStream& rStrm, sal_Bool bDirect = sal_True );
+
+ TYPEINFO();
+ virtual const String& GetName() const;
+ virtual sal_Bool IsRoot() const;
+ virtual void SetClassId( const ClsId& );
+ virtual const ClsId& GetClassId() const;
+ virtual void SetDirty();
+ virtual void SetClass( const SvGlobalName & rClass,
+ sal_uLong nOriginalClipFormat,
+ const String & rUserTypeName );
+ virtual void SetConvertClass( const SvGlobalName & rConvertClass,
+ sal_uLong nOriginalClipFormat,
+ const String & rUserTypeName );
+ virtual SvGlobalName GetClassName();
+ virtual sal_uLong GetFormat();
+ virtual String GetUserName();
+ virtual sal_Bool ShouldConvert();
+ virtual void FillInfoList( SvStorageInfoList* ) const;
+ virtual sal_Bool CopyTo( BaseStorage* pDestStg ) const;
+ virtual sal_Bool Commit();
+ virtual sal_Bool Revert();
+ virtual BaseStorageStream* OpenStream( const String & rEleName,
+ StreamMode = STREAM_STD_READWRITE,
+ sal_Bool bDirect = sal_True, const OString* pKey=0 );
+ virtual BaseStorage* OpenStorage( const String & rEleName,
+ StreamMode = STREAM_STD_READWRITE,
+ bool bDirect = false );
+ virtual BaseStorage* OpenUCBStorage( const String & rEleName,
+ StreamMode = STREAM_STD_READWRITE,
+ sal_Bool bDirect = sal_False );
+ virtual BaseStorage* OpenOLEStorage( const String & rEleName,
+ StreamMode = STREAM_STD_READWRITE,
+ sal_Bool bDirect = sal_False );
+ virtual sal_Bool IsStream( const String& rEleName ) const;
+ virtual sal_Bool IsStorage( const String& rEleName ) const;
+ virtual sal_Bool IsContained( const String& rEleName ) const;
+ virtual sal_Bool Remove( const String & rEleName );
+ virtual sal_Bool Rename( const String & rEleName, const String & rNewName );
+ virtual sal_Bool CopyTo( const String & rEleName, BaseStorage * pDest, const String & rNewName );
+ virtual sal_Bool MoveTo( const String & rEleName, BaseStorage * pDest, const String & rNewName );
+ virtual sal_Bool ValidateFAT();
+ virtual sal_Bool Validate( sal_Bool=sal_False ) const;
+ virtual sal_Bool ValidateMode( StreamMode ) const;
+ virtual const SvStream* GetSvStream() const;
+ virtual sal_Bool Equals( const BaseStorage& rStream ) const;
+ sal_Bool GetProperty( const String& rEleName, const String& rName, ::com::sun::star::uno::Any& rValue );
+
+ UCBStorageElement_Impl* FindElement_Impl( const String& rName ) const;
+ sal_Bool CopyStorageElement_Impl( UCBStorageElement_Impl& rElement,
+ BaseStorage* pDest, const String& rNew ) const;
+ BaseStorage* OpenStorage_Impl( const String & rEleName,
+ StreamMode, sal_Bool bDirect, sal_Bool bForceUCBStorage );
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sot/storage.hxx b/include/sot/storage.hxx
new file mode 100644
index 000000000000..db3995dfc374
--- /dev/null
+++ b/include/sot/storage.hxx
@@ -0,0 +1,223 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SOT_STORAGE_HXX
+#define _SOT_STORAGE_HXX
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.h>
+
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/embed/XStorage.hpp>
+#include <sot/object.hxx>
+#include <sot/factory.hxx>
+#include <tools/stream.hxx>
+#include <tools/errcode.hxx>
+#include "sot/storinfo.hxx"
+#include "sot/sotdllapi.h"
+
+#define STORAGE_FAILIFTHERE 0x02
+#define STORAGE_TRANSACTED 0x04
+#define STORAGE_PRIORITY 0x08
+#define STORAGE_DELETEONRELEASE 0x10
+#define STORAGE_CONVERT 0x20
+#define STORAGE_UNPACKED_MODE 0x40
+#define STORAGE_DISKSPANNED_MODE 0x80
+#define STORAGE_CREATE_UNPACKED 0x44
+typedef short StorageMode;
+
+class SvStorage;
+
+
+/*************************************************************************
+*************************************************************************/
+class SotStorage;
+class BaseStorageStream;
+class SOT_DLLPUBLIC SotStorageStream : virtual public SotObject, public SvStream
+{
+friend class SotStorage;
+ BaseStorageStream * pOwnStm;// Zeiger auf den eigenen Stream
+protected:
+ virtual sal_uLong GetData( void* pData, sal_uLong nSize );
+ virtual sal_uLong PutData( const void* pData, sal_uLong nSize );
+ virtual sal_uLong SeekPos( sal_uLong nPos );
+ virtual void FlushData();
+ ~SotStorageStream();
+public:
+ SotStorageStream( const String &,
+ StreamMode = STREAM_STD_READWRITE,
+ StorageMode = 0 );
+ SotStorageStream( BaseStorageStream *pStm );
+ SotStorageStream();
+ SO2_DECL_BASIC_CLASS_DLL(SotStorageStream,SOTDATA())
+
+ virtual void ResetError();
+
+ virtual void SetSize( sal_uLong nNewSize );
+ sal_uInt32 GetSize() const;
+ sal_Bool CopyTo( SotStorageStream * pDestStm );
+ virtual sal_Bool Commit();
+ virtual sal_Bool Revert();
+ sal_Bool SetProperty( const String& rName, const ::com::sun::star::uno::Any& rValue );
+ virtual sal_Size remainingSize();
+};
+
+#ifndef SOT_DECL_SOTSTORAGESTREAM_DEFINED
+#define SOT_DECL_SOTSTORAGESTREAM_DEFINED
+SV_DECL_REF(SotStorageStream)
+#endif
+SV_IMPL_REF(SotStorageStream)
+
+namespace ucbhelper
+{
+ class Content;
+}
+
+class BaseStorage;
+class UNOStorageHolder;
+class SOT_DLLPUBLIC SotStorage : virtual public SotObject
+{
+friend class SotStorageStream;
+friend class SvStorage;
+
+ BaseStorage * m_pTmpStg; // Temp-Storage fuer Transacted, nur auf diesem schreiben! ??? Useless ???
+ BaseStorage * m_pOwnStg; // Zielstorage
+ SvStream * m_pStorStm; // nur fuer SDSTORAGES
+ sal_uLong m_nError;
+ String m_aName; // Name des Storage
+ sal_Bool m_bIsRoot:1, // z.B.: File-Storage
+ m_bDelStm:1;
+ OString m_aKey; // aKey.Len != 0 -> Verschluesselung
+ long m_nVersion;
+
+protected:
+ ~SotStorage();
+ void CreateStorage( sal_Bool bUCBStorage, StreamMode, StorageMode );
+public:
+ SotStorage( const String &,
+ StreamMode = STREAM_STD_READWRITE,
+ StorageMode = 0 );
+ SotStorage( sal_Bool bUCBStorage, const String &,
+ StreamMode = STREAM_STD_READWRITE,
+ StorageMode = 0 );
+ SotStorage( BaseStorage * );
+ SotStorage( SvStream & rStm );
+ SotStorage( sal_Bool bUCBStorage, SvStream & rStm );
+ SotStorage( SvStream * pStm, sal_Bool bDelete );
+ SotStorage();
+ SO2_DECL_BASIC_CLASS_DLL(SotStorage,SOTDATA())
+
+ SvMemoryStream * CreateMemoryStream();
+
+ static sal_Bool IsStorageFile( const String & rFileName );
+ static sal_Bool IsStorageFile( SvStream* pStream );
+
+ virtual const String & GetName() const;
+
+ virtual sal_Bool Validate();
+
+ const OString& GetKey() const;
+
+ void SetVersion( long nVers )
+ {
+ m_nVersion = nVers;
+ }
+ long GetVersion() const
+ {
+ return m_nVersion;
+ }
+
+ sal_uLong GetErrorCode() const { return m_nError; }
+ sal_uLong GetError() const { return ERRCODE_TOERROR(m_nError); }
+ void SetError( sal_uLong nErrorCode )
+ {
+ if( m_nError == SVSTREAM_OK )
+ m_nError = nErrorCode;
+ }
+ virtual void ResetError();
+
+ sal_Bool IsRoot() const { return m_bIsRoot; }
+ void SignAsRoot( sal_Bool b = sal_True ) { m_bIsRoot = b; }
+ void SetDeleteStream( sal_Bool bDelete ) { m_bDelStm = bDelete; }
+
+ // eigener Datenbereich
+ virtual void SetClass( const SvGlobalName & rClass,
+ sal_uLong bOriginalClipFormat,
+ const String & rUserTypeName );
+ virtual void SetConvertClass( const SvGlobalName & rConvertClass,
+ sal_uLong bOriginalClipFormat,
+ const String & rUserTypeName );
+ virtual SvGlobalName GetClassName();// Typ der Daten im Storage
+ virtual sal_uLong GetFormat();
+ virtual String GetUserName();
+ virtual sal_Bool ShouldConvert();
+
+ // Liste aller Elemente
+ virtual void FillInfoList( SvStorageInfoList * ) const;
+ virtual sal_Bool CopyTo( SotStorage * pDestStg );
+ virtual sal_Bool Commit();
+ virtual sal_Bool Revert();
+
+ /* Element Methoden */
+ // Stream mit Verbindung zu Storage erzeugen,
+ // in etwa eine Parent-Child Beziehung
+ SotStorageStream * OpenSotStream( const String & rEleName,
+ StreamMode = STREAM_STD_READWRITE,
+ StorageMode = 0 );
+ SotStorage * OpenSotStorage( const String & rEleName,
+ StreamMode = STREAM_STD_READWRITE,
+ StorageMode = STORAGE_TRANSACTED );
+ // Abfrage auf Storage oder Stream
+ virtual sal_Bool IsStream( const String & rEleName ) const;
+ virtual sal_Bool IsStorage( const String & rEleName ) const;
+ virtual sal_Bool IsContained( const String & rEleName ) const;
+ // Element loeschen
+ virtual sal_Bool Remove( const String & rEleName );
+ // Elementnamen aendern
+ virtual sal_Bool Rename( const String & rEleName,
+ const String & rNewName );
+ virtual sal_Bool CopyTo( const String & rEleName, SotStorage * pDest,
+ const String & rNewName );
+ virtual sal_Bool MoveTo( const String & rEleName, SotStorage * pDest,
+ const String & rNewName );
+
+ sal_Bool IsOLEStorage() const;
+ static sal_Bool IsOLEStorage( const String & rFileName );
+ static sal_Bool IsOLEStorage( SvStream* pStream );
+
+ static SotStorage* OpenOLEStorage( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage,
+ const String& rEleName, StreamMode = STREAM_STD_READWRITE );
+ static sal_Int32 GetFormatID( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage );
+ static sal_Int32 GetVersion( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage );
+};
+
+#ifndef SOT_DECL_SOTSTORAGE_DEFINED
+#define SOT_DECL_SOTSTORAGE_DEFINED
+SV_DECL_REF(SotStorage)
+#endif
+SV_IMPL_REF(SotStorage)
+
+#define SvStorage SotStorage
+#define SvStorageRef SotStorageRef
+#define SvStorageStream SotStorageStream
+#define SvStorageStreamRef SotStorageStreamRef
+
+#endif // _SVSTOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sot/storinfo.hxx b/include/sot/storinfo.hxx
new file mode 100644
index 000000000000..5518d618bf36
--- /dev/null
+++ b/include/sot/storinfo.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SOT_STORINFO_HXX
+#define _SOT_STORINFO_HXX
+
+#include <tools/globname.hxx>
+#include <vector>
+#include "sot/sotdllapi.h"
+
+class StgDirEntry;
+class SvStorageInfo
+{
+friend class SvStorage;
+ String aName;
+ SvGlobalName aClassName;
+ sal_uLong nSize;
+ sal_Bool bStream:1,
+ bStorage:1;
+
+ SvStorageInfo(){}; // Fuer SvStorage
+public:
+ SvStorageInfo( const StgDirEntry& );
+ SvStorageInfo( const String& rName, sal_uLong nSz, sal_Bool bIsStorage )
+ : aName( rName )
+ , nSize( nSz )
+ , bStream( !bIsStorage )
+ , bStorage( bIsStorage )
+ {}
+
+ const SvGlobalName & GetClassName() const { return aClassName; }
+ const String & GetName() const { return aName; }
+ sal_Bool IsStream() const { return bStream; }
+ sal_Bool IsStorage() const { return bStorage; }
+ sal_uLong GetSize() const { return nSize; }
+};
+
+typedef ::std::vector< SvStorageInfo > SvStorageInfoList;
+
+SOT_DLLPUBLIC sal_uLong ReadClipboardFormat( SvStream & rStm );
+SOT_DLLPUBLIC void WriteClipboardFormat( SvStream & rStm, sal_uLong nFormat );
+
+#endif // _STORINFO_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/store/store.h b/include/store/store.h
new file mode 100644
index 000000000000..ff3f1ef0a390
--- /dev/null
+++ b/include/store/store.h
@@ -0,0 +1,405 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _STORE_STORE_H_
+#define _STORE_STORE_H_
+
+#include <store/types.h>
+#include <store/storedllapi.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Handle opaque type.
+ */
+typedef void* storeHandle;
+
+
+/** Acquire a Handle.
+ @param Handle [in] the Handle.
+ @return store_E_None upon success
+ */
+STORE_DLLPUBLIC storeError SAL_CALL store_acquireHandle (
+ storeHandle Handle
+) SAL_THROW_EXTERN_C();
+
+
+/** Release a Handle.
+ @param Handle [in] the Handle.
+ @return store_E_None upon success,
+ store_E_InvalidHandle otherwise.
+ */
+STORE_DLLPUBLIC storeError SAL_CALL store_releaseHandle (
+ storeHandle Handle
+) SAL_THROW_EXTERN_C();
+
+
+
+/** File Handle opaque type.
+ */
+typedef void* storeFileHandle;
+
+
+/** Open a temporary file in memory.
+ @param nPageSize [in] the creation page size,
+ integer multiple of minimum page size.
+ @param phFile [out] the File Handle.
+ @return store_E_None upon success
+ */
+STORE_DLLPUBLIC storeError SAL_CALL store_createMemoryFile (
+ sal_uInt16 nPageSize,
+ storeFileHandle *phFile
+) SAL_THROW_EXTERN_C();
+
+
+/** Open a file.
+ @param pFilename [in] the filename as URL or system path.
+ @param eAccessMode [in] the access mode.
+ store_AccessCreate truncate existing and create,
+ store_AccessReadCreate create not existing,
+ store_AccessReadWrite write existing,
+ store_AccessReadOnly never modifies.
+ @param nPageSize [in] the creation page size,
+ integer multiple of minimum page size.
+ @param phFile [out] the File Handle.
+ @return store_E_None upon success
+ */
+STORE_DLLPUBLIC storeError SAL_CALL store_openFile (
+ rtl_uString *pFilename,
+ storeAccessMode eAccessMode,
+ sal_uInt16 nPageSize,
+ storeFileHandle *phFile
+) SAL_THROW_EXTERN_C();
+
+
+/** Close a file.
+ @param hFile [in] the File Handle.
+ @return store_E_None upon success,
+ store_E_InvalidHandle otherwise.
+ */
+STORE_DLLPUBLIC storeError SAL_CALL store_closeFile (
+ storeFileHandle hFile
+) SAL_THROW_EXTERN_C();
+
+
+/** Flush a file.
+ @param hFile [in] the File Handle.
+ @return store_E_None upon success
+ */
+STORE_DLLPUBLIC storeError SAL_CALL store_flushFile (
+ storeFileHandle hFile
+) SAL_THROW_EXTERN_C();
+
+
+/** Get the number of referers to a file.
+ @param hFile [in] the File Handle.
+ @param pnRefCount [out] number of open directories and streams.
+ @return store_E_None upon success
+ */
+STORE_DLLPUBLIC storeError SAL_CALL store_getFileRefererCount (
+ storeFileHandle hFile,
+ sal_uInt32 *pnRefCount
+) SAL_THROW_EXTERN_C();
+
+
+/** Get the size of a file.
+ @param hFile [in] the File Handle.
+ @param pnSize [out] the file size in bytes.
+ @return store_E_None upon success
+ */
+STORE_DLLPUBLIC storeError SAL_CALL store_getFileSize (
+ storeFileHandle hFile,
+ sal_uInt32 *pnSize
+) SAL_THROW_EXTERN_C();
+
+
+/** Recover and Compact a file into another file.
+ @see store_openFile()
+
+ @param pSrcFilename [in] opened with store_AccessReadOnly.
+ @param pDstFilename [in] created with store_AccessCreate.
+ @return store_E_None upon success
+ */
+STORE_DLLPUBLIC storeError SAL_CALL store_rebuildFile (
+ rtl_uString *pSrcFilename,
+ rtl_uString *pDstFilename
+) SAL_THROW_EXTERN_C();
+
+
+
+/** Directory Handle opaque type.
+ */
+typedef void* storeDirectoryHandle;
+
+
+/** Open a directory.
+ @see store_openFile()
+
+ @param hFile [in] the File Handle.
+ @param pPath [in] the directory path.
+ @param pName [in] the directory name.
+ @param eAccessMode [in] the access mode.
+ @param phDirectory [out] the Directory Handle.
+ @return store_E_None upon success
+ */
+STORE_DLLPUBLIC storeError SAL_CALL store_openDirectory (
+ storeFileHandle hFile,
+ rtl_uString *pPath,
+ rtl_uString *pName,
+ storeAccessMode eAccessMode,
+ storeDirectoryHandle *phDirectory
+) SAL_THROW_EXTERN_C();
+
+
+/** Close a directory.
+ @param hDirectory [in] the Directory Handle.
+ @return store_E_None upon success,
+ store_E_InvalidHandle otherwise.
+ */
+STORE_DLLPUBLIC storeError SAL_CALL store_closeDirectory (
+ storeDirectoryHandle hDirectory
+) SAL_THROW_EXTERN_C();
+
+
+/** Find first directory entry.
+ @param hDirectory [in] the Directory Handle.
+ @param pFindData [out] the Find Data structure.
+ @return store_E_None upon success,
+ store_E_NoMoreFile upon end of iteration.
+ */
+STORE_DLLPUBLIC storeError SAL_CALL store_findFirst (
+ storeDirectoryHandle hDirectory,
+ storeFindData *pFindData
+) SAL_THROW_EXTERN_C();
+
+
+/** Find next directory entry.
+ @param hDirectory [in] the Directory Handle.
+ @param pFindData [out] the Find Data structure.
+ @return store_E_None upon success,
+ store_E_NoMoreFile upon end of iteration.
+ */
+STORE_DLLPUBLIC storeError SAL_CALL store_findNext (
+ storeDirectoryHandle hDirectory,
+ storeFindData *pFindData
+) SAL_THROW_EXTERN_C();
+
+
+
+/** Stream Handle opaque type.
+ */
+typedef void* storeStreamHandle;
+
+
+/** Open a stream.
+ @see store_openFile()
+
+ @param hFile [in] the File Handle.
+ @param pPath [in] the stream path.
+ @param pName [in] the stream name.
+ @param eMode [in] the access mode.
+ @param phStrm [out] the Stream Handle.
+ @return store_E_None upon success
+ */
+STORE_DLLPUBLIC storeError SAL_CALL store_openStream (
+ storeFileHandle hFile,
+ rtl_uString *pPath,
+ rtl_uString *pName,
+ storeAccessMode eMode,
+ storeStreamHandle *phStrm
+) SAL_THROW_EXTERN_C();
+
+
+/** Close a stream.
+ @param hStrm [in] the Stream Handle.
+ @return store_E_None upon success,
+ store_E_InvalidHandle otherwise.
+ */
+STORE_DLLPUBLIC storeError SAL_CALL store_closeStream (
+ storeStreamHandle hStrm
+) SAL_THROW_EXTERN_C();
+
+
+/** Read from a stream.
+ @param hStrm [in] the Stream Handle.
+ @param nOffset [in] the offset of the first byte to read.
+ @param pBuffer [out] the buffer.
+ @param nBytes [in] the number of bytes to read.
+ @param pnDone [out] the number of bytes actually read.
+ @return store_E_None upon success
+ */
+STORE_DLLPUBLIC storeError SAL_CALL store_readStream (
+ storeStreamHandle hStrm,
+ sal_uInt32 nOffset,
+ void *pBuffer,
+ sal_uInt32 nBytes,
+ sal_uInt32 *pnDone
+) SAL_THROW_EXTERN_C();
+
+
+/** Write to a stream.
+ @param hStrm [in] the Stream Handle.
+ @param nOffset [in] the offset of the first byte to write.
+ @param pBuffer [in] the buffer.
+ @param nBytes [in] the number of bytes to write.
+ @param pnDone [out] the number of bytes actually written.
+ @return store_E_None upon success
+ */
+STORE_DLLPUBLIC storeError SAL_CALL store_writeStream (
+ storeStreamHandle hStrm,
+ sal_uInt32 nOffset,
+ const void *pBuffer,
+ sal_uInt32 nBytes,
+ sal_uInt32 *pnDone
+) SAL_THROW_EXTERN_C();
+
+
+/** Flush a stream.
+ @param hStrm [in] the Stream Handle.
+ @return store_E_None upon success
+ */
+STORE_DLLPUBLIC storeError SAL_CALL store_flushStream (
+ storeStreamHandle hStrm
+) SAL_THROW_EXTERN_C();
+
+
+/** Get the size of a stream.
+ @param hStrm [in] the Stream Handle.
+ @param pnSize [out] the stream size in bytes.
+ @return store_E_None upon success
+ */
+STORE_DLLPUBLIC storeError SAL_CALL store_getStreamSize (
+ storeStreamHandle hStrm,
+ sal_uInt32 *pnSize
+) SAL_THROW_EXTERN_C();
+
+
+/** Set the size of a stream.
+ @param hStrm [in] the Stream Handle.
+ @param nSize [in] the new stream size in bytes.
+ @return store_E_None upon success
+ */
+STORE_DLLPUBLIC storeError SAL_CALL store_setStreamSize (
+ storeStreamHandle hStrm,
+ sal_uInt32 nSize
+) SAL_THROW_EXTERN_C();
+
+
+
+/** Set attributes of a file entry.
+ @param hFile [in] the File Handle.
+ @param pPath [in] the entry path.
+ @param pName [in] the entry name.
+ @param nMask1 [in] the attributes to be cleared.
+ @param nMask2 [in] the attributes to be set.
+ @param pnAttrib [out] the resulting attributes, may be NULL.
+ @return store_E_None upon success
+ */
+STORE_DLLPUBLIC storeError SAL_CALL store_attrib (
+ storeFileHandle hFile,
+ rtl_uString *pPath,
+ rtl_uString *pName,
+ sal_uInt32 nMask1,
+ sal_uInt32 nMask2,
+ sal_uInt32 *pnAttrib
+) SAL_THROW_EXTERN_C();
+
+
+/** Insert a file entry as 'hard link' to another file entry.
+ @pre Source must not exist, Destination must exist.
+ @post Source has attribute STORE_ATTRIB_ISLINK.
+ @see store_attrib()
+
+ @param hFile [in] the File Handle
+ @param pSrcPath [in] the Source path
+ @param pSrcName [in] the Source name
+ @param pDstPath [in] the Destination path
+ @param pDstName [in] the Destination name
+ @return store_E_None upon success
+ */
+STORE_DLLPUBLIC storeError SAL_CALL store_link (
+ storeFileHandle hFile,
+ rtl_uString *pSrcPath, rtl_uString *pSrcName,
+ rtl_uString *pDstPath, rtl_uString *pDstName
+) SAL_THROW_EXTERN_C();
+
+
+/** Insert a file entry as 'symbolic link' to another file entry.
+ @pre Source must not exist
+ @post Source has attribute STORE_ATTRIB_ISLINK.
+ @see store_attrib()
+
+ @param hFile [in] the File Handle
+ @param pSrcPath [in] the Source path
+ @param pSrcName [in] the Source name
+ @param pDstPath [in] the Destination path
+ @param pDstName [in] the Destination name
+ @return store_E_None upon success
+ */
+STORE_DLLPUBLIC storeError SAL_CALL store_symlink (
+ storeFileHandle hFile,
+ rtl_uString *pSrcPath, rtl_uString *pSrcName,
+ rtl_uString *pDstPath, rtl_uString *pDstName
+) SAL_THROW_EXTERN_C();
+
+
+/** Rename a file entry.
+ @param hFile [in] the File Handle
+ @param pSrcPath [in] the Source path
+ @param pSrcName [in] the Source name
+ @param pDstPath [in] the Destination path
+ @param pDstName [in] the Destination name
+ @return store_E_None upon success
+ */
+STORE_DLLPUBLIC storeError SAL_CALL store_rename (
+ storeFileHandle hFile,
+ rtl_uString *pSrcPath, rtl_uString *pSrcName,
+ rtl_uString *pDstPath, rtl_uString *pDstName
+) SAL_THROW_EXTERN_C();
+
+
+/** Remove a file entry.
+ @param hFile [in] the File Handle
+ @param pPath [in] the entry path
+ @param pName [in] the entry name
+ @return store_E_None upon success
+ */
+STORE_DLLPUBLIC storeError SAL_CALL store_remove (
+ storeFileHandle hFile,
+ rtl_uString *pPath,
+ rtl_uString *pName
+) SAL_THROW_EXTERN_C();
+
+/*========================================================================
+ *
+ * The End.
+ *
+ *======================================================================*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _STORE_STORE_H_ */
+
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/store/store.hxx b/include/store/store.hxx
new file mode 100644
index 000000000000..43ef8859c52e
--- /dev/null
+++ b/include/store/store.hxx
@@ -0,0 +1,605 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _STORE_STORE_HXX_
+#define _STORE_STORE_HXX_
+
+#include "sal/types.h"
+#include "rtl/ustring.hxx"
+#include "store/store.h"
+
+namespace store
+{
+
+/*========================================================================
+ *
+ * OStoreStream interface.
+ *
+ *======================================================================*/
+class OStoreStream
+{
+public:
+ /** Construction.
+ */
+ inline OStoreStream (void) SAL_THROW(())
+ : m_hImpl (0)
+ {}
+
+ /** Destruction.
+ */
+ inline ~OStoreStream (void) SAL_THROW(())
+ {
+ if (m_hImpl)
+ (void) store_releaseHandle (m_hImpl);
+ }
+
+ /** Copy construction.
+ */
+ inline OStoreStream (OStoreStream const & rhs) SAL_THROW(())
+ : m_hImpl (rhs.m_hImpl)
+ {
+ if (m_hImpl)
+ (void) store_acquireHandle (m_hImpl);
+ }
+
+ /** Assignment.
+ */
+ inline OStoreStream & operator= (OStoreStream const & rhs) SAL_THROW(())
+ {
+ if (rhs.m_hImpl)
+ (void) store_acquireHandle (rhs.m_hImpl);
+ if (m_hImpl)
+ (void) store_releaseHandle (m_hImpl);
+ m_hImpl = rhs.m_hImpl;
+ return *this;
+ }
+
+ /** Construction from Stream Handle.
+ */
+ inline explicit OStoreStream (storeStreamHandle Handle) SAL_THROW(())
+ : m_hImpl (Handle)
+ {
+ if (m_hImpl)
+ (void) store_acquireHandle (m_hImpl);
+ }
+
+ /** Conversion into Stream Handle.
+ */
+ inline operator storeStreamHandle (void) const SAL_THROW(())
+ {
+ return m_hImpl;
+ }
+
+ /** Check for a valid Stream Handle.
+ @return sal_True if valid, sal_False otherwise.
+ */
+ inline bool isValid (void) const SAL_THROW(())
+ {
+ return (m_hImpl != 0);
+ }
+
+ /** Open the stream.
+ @see store_openStream()
+ */
+ inline storeError create (
+ storeFileHandle hFile,
+ OUString const & rPath,
+ OUString const & rName,
+ storeAccessMode eMode) SAL_THROW(())
+ {
+ if (m_hImpl)
+ {
+ (void) store_releaseHandle (m_hImpl);
+ m_hImpl = 0;
+ }
+ return store_openStream (hFile, rPath.pData, rName.pData, eMode, &m_hImpl);
+ }
+
+ /** Close the stream.
+ @see store_closeStream()
+ */
+ inline void close (void) SAL_THROW(())
+ {
+ if (m_hImpl)
+ {
+ (void) store_closeStream (m_hImpl);
+ m_hImpl = 0;
+ }
+ }
+
+ /** Read from the stream.
+ @see store_readStream()
+ */
+ inline storeError readAt (
+ sal_uInt32 nOffset,
+ void * pBuffer,
+ sal_uInt32 nBytes,
+ sal_uInt32 & rnDone) SAL_THROW(())
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_readStream (m_hImpl, nOffset, pBuffer, nBytes, &rnDone);
+ }
+
+ /** Write to the stream.
+ @see store_writeStream()
+ */
+ inline storeError writeAt (
+ sal_uInt32 nOffset,
+ void const * pBuffer,
+ sal_uInt32 nBytes,
+ sal_uInt32 & rnDone) SAL_THROW(())
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_writeStream (m_hImpl, nOffset, pBuffer, nBytes, &rnDone);
+ }
+
+ /** Flush the stream.
+ @see store_flushStream()
+ */
+ inline storeError flush (void) const SAL_THROW(())
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_flushStream (m_hImpl);
+ }
+
+ /** Get the stream size.
+ @see store_getStreamSize()
+ */
+ inline storeError getSize (sal_uInt32 & rnSize) const SAL_THROW(())
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_getStreamSize (m_hImpl, &rnSize);
+ }
+
+ /** Set the stream size.
+ @see store_setStreamSize()
+ */
+ inline storeError setSize (sal_uInt32 nSize) SAL_THROW(())
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_setStreamSize (m_hImpl, nSize);
+ }
+
+private:
+ /** Representation.
+ */
+ storeStreamHandle m_hImpl;
+};
+
+/*========================================================================
+ *
+ * OStoreDirectory interface.
+ *
+ *======================================================================*/
+class OStoreDirectory
+{
+public:
+ /** Construction.
+ */
+ inline OStoreDirectory (void) SAL_THROW(())
+ : m_hImpl (0)
+ {}
+
+ /** Destruction.
+ */
+ inline ~OStoreDirectory (void) SAL_THROW(())
+ {
+ if (m_hImpl)
+ (void) store_releaseHandle (m_hImpl);
+ }
+
+ /** Copy construction.
+ */
+ inline OStoreDirectory (OStoreDirectory const & rhs) SAL_THROW(())
+ : m_hImpl (rhs.m_hImpl)
+ {
+ if (m_hImpl)
+ (void) store_acquireHandle (m_hImpl);
+ }
+
+ /** Assignment.
+ */
+ inline OStoreDirectory & operator= (OStoreDirectory const & rhs) SAL_THROW(())
+ {
+ if (rhs.m_hImpl)
+ (void) store_acquireHandle (rhs.m_hImpl);
+ if (m_hImpl)
+ (void) store_releaseHandle (m_hImpl);
+ m_hImpl = rhs.m_hImpl;
+ return *this;
+ }
+
+ /** Construction from Directory Handle.
+ */
+ inline explicit OStoreDirectory (storeDirectoryHandle Handle) SAL_THROW(())
+ : m_hImpl (Handle)
+ {
+ if (m_hImpl)
+ (void) store_acquireHandle (m_hImpl);
+ }
+
+ /** Conversion into Directory Handle.
+ */
+ inline operator storeDirectoryHandle(void) const SAL_THROW(())
+ {
+ return m_hImpl;
+ }
+
+ /** Check for a valid Directory Handle.
+ @return sal_True if valid, sal_False otherwise.
+ */
+ inline bool isValid (void) const SAL_THROW(())
+ {
+ return (m_hImpl != 0);
+ }
+
+ /** Open the directory.
+ @see store_openDirectory()
+ */
+ inline storeError create (
+ storeFileHandle hFile,
+ OUString const & rPath,
+ OUString const & rName,
+ storeAccessMode eMode) SAL_THROW(())
+ {
+ if (m_hImpl)
+ {
+ (void) store_releaseHandle (m_hImpl);
+ m_hImpl = 0;
+ }
+ return store_openDirectory (hFile, rPath.pData, rName.pData, eMode, &m_hImpl);
+ }
+
+ /** Close the directory.
+ @see store_closeDirectory()
+ */
+ inline void close (void) SAL_THROW(())
+ {
+ if (m_hImpl)
+ {
+ (void) store_closeDirectory (m_hImpl);
+ m_hImpl = 0;
+ }
+ }
+
+ /** Directory iterator type.
+ @see first()
+ @see next()
+ */
+ typedef storeFindData iterator;
+
+ /** Find first directory entry.
+ @see store_findFirst()
+ */
+ inline storeError first (iterator& it) SAL_THROW(())
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_findFirst (m_hImpl, &it);
+ }
+
+ /** Find next directory entry.
+ @see store_findNext()
+ */
+ inline storeError next (iterator& it) SAL_THROW(())
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_findNext (m_hImpl, &it);
+ }
+
+ /** Directory traversal helper.
+ @see travel()
+ */
+ class traveller
+ {
+ public:
+ /** Directory traversal callback.
+ @param it [in] current directory entry.
+ @return sal_True to continue iteration, sal_False to stop.
+ */
+ virtual sal_Bool visit (const iterator& it) = 0;
+
+ protected:
+ ~traveller() {}
+ };
+
+ /** Directory traversal.
+ @see store_findFirst()
+ @see store_findNext()
+
+ @param rTraveller [in] the traversal callback.
+ @return store_E_NoMoreFiles upon end of iteration.
+ */
+ inline storeError travel (traveller & rTraveller) const
+ {
+ storeError eErrCode = store_E_InvalidHandle;
+ if (m_hImpl)
+ {
+ iterator it;
+ eErrCode = store_findFirst (m_hImpl, &it);
+ while ((eErrCode == store_E_None) && rTraveller.visit(it))
+ eErrCode = store_findNext (m_hImpl, &it);
+ }
+ return eErrCode;
+ }
+
+private:
+ /** Representation.
+ */
+ storeDirectoryHandle m_hImpl;
+};
+
+/*========================================================================
+ *
+ * OStoreFile interface.
+ *
+ *======================================================================*/
+class OStoreFile
+{
+public:
+ /** Construction.
+ */
+ inline OStoreFile (void) SAL_THROW(())
+ : m_hImpl (0)
+ {}
+
+ /** Destruction.
+ */
+ inline ~OStoreFile (void) SAL_THROW(())
+ {
+ if (m_hImpl)
+ (void) store_releaseHandle (m_hImpl);
+ }
+
+ /** Copy construction.
+ */
+ inline OStoreFile (OStoreFile const & rhs) SAL_THROW(())
+ : m_hImpl (rhs.m_hImpl)
+ {
+ if (m_hImpl)
+ (void) store_acquireHandle (m_hImpl);
+ }
+
+ /** Assignment.
+ */
+ inline OStoreFile & operator= (OStoreFile const & rhs) SAL_THROW(())
+ {
+ if (rhs.m_hImpl)
+ (void) store_acquireHandle (rhs.m_hImpl);
+ if (m_hImpl)
+ (void) store_releaseHandle (m_hImpl);
+ m_hImpl = rhs.m_hImpl;
+ return *this;
+ }
+
+ /** Construction from File Handle.
+ */
+ inline explicit OStoreFile (storeFileHandle Handle) SAL_THROW(())
+ : m_hImpl (Handle)
+ {
+ if (m_hImpl)
+ (void) store_acquireHandle (m_hImpl);
+ }
+
+ /** Conversion into File Handle.
+ */
+ inline operator storeFileHandle (void) const SAL_THROW(())
+ {
+ return m_hImpl;
+ }
+
+ /** Check for a valid File Handle.
+ @return sal_True if valid, sal_False otherwise.
+ */
+ inline bool isValid (void) const SAL_THROW(())
+ {
+ return (m_hImpl != 0);
+ }
+
+ /** Open the file.
+ @see store_openFile()
+ */
+ inline storeError create (
+ OUString const & rFilename,
+ storeAccessMode eAccessMode,
+ sal_uInt16 nPageSize = STORE_DEFAULT_PAGESIZE) SAL_THROW(())
+ {
+ if (m_hImpl)
+ {
+ (void) store_releaseHandle (m_hImpl);
+ m_hImpl = 0;
+ }
+ return store_openFile (rFilename.pData, eAccessMode, nPageSize, &m_hImpl);
+ }
+
+ /** Open the temporary file in memory.
+ @see store_createMemoryFile()
+ */
+ inline storeError createInMemory (
+ sal_uInt16 nPageSize = STORE_DEFAULT_PAGESIZE) SAL_THROW(())
+ {
+ if (m_hImpl)
+ {
+ (void) store_releaseHandle (m_hImpl);
+ m_hImpl = 0;
+ }
+ return store_createMemoryFile (nPageSize, &m_hImpl);
+ }
+
+ /** Close the file.
+ @see store_closeFile()
+ */
+ inline void close (void) SAL_THROW(())
+ {
+ if (m_hImpl)
+ {
+ (void) store_closeFile (m_hImpl);
+ m_hImpl = 0;
+ }
+ }
+
+ /** Flush the file.
+ @see store_flushFile()
+ */
+ inline storeError flush (void) const SAL_THROW(())
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_flushFile (m_hImpl);
+ }
+
+ /** Get the number of referers to the file.
+ @see store_getFileRefererCount()
+ */
+ inline storeError getRefererCount (sal_uInt32 & rnRefCount) const SAL_THROW(())
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_getFileRefererCount (m_hImpl, &rnRefCount);
+ }
+
+ /** Get the file size.
+ @see store_getFileSize()
+ */
+ inline storeError getSize (sal_uInt32 & rnSize) const SAL_THROW(())
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_getFileSize (m_hImpl, &rnSize);
+ }
+
+ /** Set attributes of a file entry.
+ @see store_attrib()
+ */
+ inline storeError attrib (
+ OUString const & rPath,
+ OUString const & rName,
+ sal_uInt32 nMask1,
+ sal_uInt32 nMask2,
+ sal_uInt32 & rnAttrib) SAL_THROW(())
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_attrib (m_hImpl, rPath.pData, rName.pData, nMask1, nMask2, &rnAttrib);
+ }
+
+ /** Set attributes of a file entry.
+ @see store_attrib()
+ */
+ inline storeError attrib (
+ OUString const & rPath,
+ OUString const & rName,
+ sal_uInt32 nMask1,
+ sal_uInt32 nMask2) SAL_THROW(())
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_attrib (m_hImpl, rPath.pData, rName.pData, nMask1, nMask2, NULL);
+ }
+
+ /** Insert a file entry as 'hard link' to another file entry.
+ @see store_link()
+ */
+ inline storeError link (
+ OUString const & rSrcPath, OUString const & rSrcName,
+ OUString const & rDstPath, OUString const & rDstName) SAL_THROW(())
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_link (
+ m_hImpl, rSrcPath.pData, rSrcName.pData, rDstPath.pData, rDstName.pData);
+ }
+
+ /** Insert a file entry as 'symbolic link' to another file entry.
+ @see store_symlink()
+ */
+ inline storeError symlink (
+ OUString const & rSrcPath, OUString const & rSrcName,
+ OUString const & rDstPath, OUString const & rDstName) SAL_THROW(())
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_symlink (m_hImpl, rSrcPath.pData, rSrcName.pData, rDstPath.pData, rDstName.pData);
+ }
+
+ /** Rename a file entry.
+ @see store_rename()
+ */
+ inline storeError rename (
+ OUString const & rSrcPath, OUString const & rSrcName,
+ OUString const & rDstPath, OUString const & rDstName) SAL_THROW(())
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_rename (m_hImpl, rSrcPath.pData, rSrcName.pData, rDstPath.pData, rDstName.pData);
+ }
+
+ /** Remove a file entry.
+ @see store_remove()
+ */
+ inline storeError remove (
+ OUString const & rPath, OUString const & rName) SAL_THROW(())
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_remove (m_hImpl, rPath.pData, rName.pData);
+ }
+
+private:
+ /** Representation.
+ */
+ storeFileHandle m_hImpl;
+};
+
+/*========================================================================
+ *
+ * The End.
+ *
+ *======================================================================*/
+
+} // namespace store
+
+#endif /* !_STORE_STORE_HXX_ */
+
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/store/storedllapi.h b/include/store/storedllapi.h
new file mode 100644
index 000000000000..0a4b27a333ca
--- /dev/null
+++ b/include/store/storedllapi.h
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_STOREDLLAPI_H
+#define INCLUDED_STOREDLLAPI_H
+
+#include "sal/types.h"
+
+#if defined(STORE_DLLIMPLEMENTATION)
+#define STORE_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define STORE_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif /* INCLUDED_STOREDLLAPI_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/store/types.h b/include/store/types.h
new file mode 100644
index 000000000000..0d51995348a0
--- /dev/null
+++ b/include/store/types.h
@@ -0,0 +1,160 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _STORE_TYPES_H_
+#define _STORE_TYPES_H_
+
+#include <sal/types.h>
+#include <rtl/ustring.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** PageSize (recommended) default.
+ @see store_openFile()
+ */
+#define STORE_DEFAULT_PAGESIZE ((sal_uInt16)0x0400)
+
+
+/** PageSize (enforced) limits.
+ @see store_openFile()
+ */
+#define STORE_MINIMUM_PAGESIZE ((sal_uInt16)0x0200)
+#define STORE_MAXIMUM_PAGESIZE ((sal_uInt16)0x8000)
+
+
+/** NameSize (enforced) limit.
+ @see any param pName
+ @see store_E_NameTooLong
+ */
+#define STORE_MAXIMUM_NAMESIZE 256
+
+
+/** Attributes (predefined).
+ @see store_attrib()
+ */
+#define STORE_ATTRIB_ISLINK ((sal_uInt32)0x10000000)
+#define STORE_ATTRIB_ISDIR ((sal_uInt32)0x20000000)
+#define STORE_ATTRIB_ISFILE ((sal_uInt32)0x40000000)
+
+
+/** Access Mode enumeration.
+ @see store_openFile()
+ @see store_openDirectory()
+ @see store_openStream()
+ */
+enum __store_AccessMode
+{
+ store_AccessCreate,
+ store_AccessReadCreate,
+ store_AccessReadWrite,
+ store_AccessReadOnly,
+ store_Access_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+};
+
+/** Access Mode type.
+ */
+typedef enum __store_AccessMode storeAccessMode;
+
+
+/** Error Code enumeration.
+ */
+enum __store_Error
+{
+ store_E_None = 0,
+ store_E_AccessViolation,
+ store_E_LockingViolation,
+ store_E_CantSeek,
+ store_E_CantRead,
+ store_E_CantWrite,
+ store_E_InvalidAccess,
+ store_E_InvalidHandle,
+ store_E_InvalidParameter,
+ store_E_InvalidChecksum,
+ store_E_AlreadyExists,
+ store_E_NotExists,
+ store_E_NotDirectory,
+ store_E_NotFile,
+ store_E_NoMoreFiles,
+ store_E_NameTooLong,
+ store_E_OutOfMemory,
+ store_E_OutOfSpace,
+ store_E_Pending,
+ store_E_WrongFormat,
+ store_E_WrongVersion,
+ store_E_Unknown,
+ store_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+};
+
+/** Error Code type.
+ */
+typedef enum __store_Error storeError;
+
+
+/** Find Data structure.
+ @see store_findFirst()
+ @see store_findNext()
+ */
+struct __store_FindData
+{
+ /** Name.
+ @see m_nLength
+ */
+ sal_Unicode m_pszName[STORE_MAXIMUM_NAMESIZE];
+
+ /** Name Length.
+ @see m_pszName
+ */
+ sal_Int32 m_nLength;
+
+ /** Attributes.
+ @see store_attrib()
+ */
+ sal_uInt32 m_nAttrib;
+
+ /** Size.
+ @see store_getStreamSize()
+ @see store_setStreamSize()
+ */
+ sal_uInt32 m_nSize;
+
+ /** Reserved for internal use.
+ */
+ sal_uInt32 m_nReserved;
+};
+
+/** Find Data type.
+ */
+typedef struct __store_FindData storeFindData;
+
+
+/*========================================================================
+ *
+ * The End.
+ *
+ *======================================================================*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _STORE_TYPES_H_ */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/PasswordHelper.hxx b/include/svl/PasswordHelper.hxx
new file mode 100644
index 000000000000..7204ebdc845b
--- /dev/null
+++ b/include/svl/PasswordHelper.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVTOOLS_PASSWORDHELPER_HXX
+#define _SVTOOLS_PASSWORDHELPER_HXX
+
+#include "svl/svldllapi.h"
+#include "sal/types.h"
+#include "com/sun/star/uno/Sequence.hxx"
+
+class SvPasswordHelper
+{
+ static void GetHashPasswordLittleEndian(com::sun::star::uno::Sequence<sal_Int8>& rPassHash, const OUString& sPass);
+ static void GetHashPasswordBigEndian(com::sun::star::uno::Sequence<sal_Int8>& rPassHash, const OUString& sPass);
+
+public:
+ SVL_DLLPUBLIC static void GetHashPassword(com::sun::star::uno::Sequence <sal_Int8>& rPassHash, const sal_Char* pPass, sal_uInt32 nLen);
+
+ SVL_DLLPUBLIC static void GetHashPassword(com::sun::star::uno::Sequence<sal_Int8>& rPassHash, const OUString& sPass);
+ /**
+ Use this method to compare a given string with another given Hash value.
+ This is necessary, because in older versions exists different hashs of the same string. They were endian dependent.
+ We need this to handle old files. This method will compare against big and little endian. See #101326#
+ */
+ SVL_DLLPUBLIC static bool CompareHashPassword(const com::sun::star::uno::Sequence<sal_Int8>& rOldPassHash, const OUString& sNewPass);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/adrparse.hxx b/include/svl/adrparse.hxx
new file mode 100644
index 000000000000..063ba11a95a9
--- /dev/null
+++ b/include/svl/adrparse.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _ADRPARSE_HXX
+#define _ADRPARSE_HXX
+
+#include "svl/svldllapi.h"
+#include <vector>
+
+//============================================================================
+struct SvAddressEntry_Impl
+{
+ OUString m_aAddrSpec;
+ OUString m_aRealName;
+
+ SvAddressEntry_Impl()
+ {
+ }
+
+ SvAddressEntry_Impl(const OUString& rTheAddrSpec,
+ const OUString& rTheRealName)
+ : m_aAddrSpec(rTheAddrSpec)
+ , m_aRealName(rTheRealName)
+ {
+ }
+};
+
+//============================================================================
+typedef ::std::vector< SvAddressEntry_Impl* > SvAddressList_Impl;
+
+//============================================================================
+class SVL_DLLPUBLIC SvAddressParser
+{
+ friend class SvAddressParser_Impl;
+
+ SvAddressEntry_Impl m_aFirst;
+ SvAddressList_Impl m_aRest;
+ bool m_bHasFirst;
+
+public:
+ SvAddressParser(const OUString& rInput);
+
+ ~SvAddressParser();
+
+ sal_Int32 Count() const { return m_bHasFirst ? m_aRest.size() + 1 : 0; }
+
+ const OUString& GetEmailAddress(sal_Int32 nIndex) const
+ {
+ return nIndex == 0 ? m_aFirst.m_aAddrSpec :
+ m_aRest[ nIndex - 1 ]->m_aAddrSpec;
+ }
+
+ const OUString& GetRealName(sal_Int32 nIndex) const
+ {
+ return nIndex == 0 ? m_aFirst.m_aRealName :
+ m_aRest[ nIndex - 1 ]->m_aRealName;
+ }
+};
+
+#endif // _ADRPARSE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/aeitem.hxx b/include/svl/aeitem.hxx
new file mode 100644
index 000000000000..7dd741592015
--- /dev/null
+++ b/include/svl/aeitem.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _AEITEM_HXX
+#define _AEITEM_HXX
+
+#include "svl/svldllapi.h"
+#include <svl/poolitem.hxx>
+#include <svl/eitem.hxx>
+#include <vector>
+
+class SfxAllEnumValueArr;
+
+class SVL_DLLPUBLIC SfxAllEnumItem: public SfxEnumItem
+{
+ SfxAllEnumValueArr* pValues;
+ std::vector<sal_uInt16>* pDisabledValues;
+
+protected:
+ sal_uInt16 _GetPosByValue( sal_uInt16 nValue ) const;
+
+public:
+ TYPEINFO();
+ SfxAllEnumItem();
+ explicit SfxAllEnumItem( sal_uInt16 nWhich);
+ SfxAllEnumItem( sal_uInt16 nWhich, sal_uInt16 nVal );
+ SfxAllEnumItem( sal_uInt16 nWhich, SvStream &rStream );
+ SfxAllEnumItem( const SfxAllEnumItem & );
+ ~SfxAllEnumItem();
+
+ void InsertValue( sal_uInt16 nValue );
+ void InsertValue( sal_uInt16 nValue, const OUString &rText );
+ void RemoveValue( sal_uInt16 nValue );
+
+ sal_uInt16 GetPosByValue( sal_uInt16 nValue ) const;
+
+ virtual sal_uInt16 GetValueCount() const;
+ virtual sal_uInt16 GetValueByPos( sal_uInt16 nPos ) const;
+ virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16 nVersion) const;
+ virtual sal_Bool IsEnabled( sal_uInt16 ) const;
+ void DisableValue( sal_uInt16 );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/asiancfg.hxx b/include/svl/asiancfg.hxx
new file mode 100644
index 000000000000..622b1f8ff277
--- /dev/null
+++ b/include/svl/asiancfg.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVL_ASIANCFG_HXX
+#define INCLUDED_SVL_ASIANCFG_HXX
+
+#include "sal/config.h"
+
+#include "boost/noncopyable.hpp"
+#include "boost/scoped_ptr.hpp"
+#include "com/sun/star/uno/Sequence.hxx"
+#include "sal/types.h"
+#include "svl/svldllapi.h"
+
+namespace com { namespace sun { namespace star { namespace lang {
+ struct Locale;
+} } } }
+
+class SVL_DLLPUBLIC SvxAsianConfig: private boost::noncopyable {
+public:
+ SvxAsianConfig();
+
+ ~SvxAsianConfig();
+
+ void Commit();
+
+ bool IsKerningWesternTextOnly() const;
+
+ void SetKerningWesternTextOnly(bool value);
+
+ sal_Int16 GetCharDistanceCompression() const;
+
+ void SetCharDistanceCompression(sal_Int16 value);
+
+ com::sun::star::uno::Sequence< com::sun::star::lang::Locale >
+ GetStartEndCharLocales() const;
+
+ bool GetStartEndChars(
+ com::sun::star::lang::Locale const & locale, OUString & startChars,
+ OUString & endChars) const;
+
+ void SetStartEndChars(
+ com::sun::star::lang::Locale const & locale,
+ OUString const * startChars, OUString const * endChars);
+
+private:
+ struct Impl;
+
+ boost::scoped_ptr< Impl > impl_;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/brdcst.hxx b/include/svl/brdcst.hxx
new file mode 100644
index 000000000000..258cf6066e58
--- /dev/null
+++ b/include/svl/brdcst.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXBRDCST_HXX
+#define _SFXBRDCST_HXX
+
+#include "svl/svldllapi.h"
+#include <tools/rtti.hxx>
+#include <vector>
+
+class SfxListener;
+class SfxHint;
+
+//-------------------------------------------------------------------------
+
+class SVL_DLLPUBLIC SfxBroadcaster
+{
+ friend class SfxListener;
+ typedef std::vector<SfxListener*> SfxListenerArr_Impl;
+
+ SfxListenerArr_Impl m_Listeners;
+
+private:
+ void AddListener( SfxListener& rListener );
+ void RemoveListener( SfxListener& rListener );
+ const SfxBroadcaster& operator=(const SfxBroadcaster &); // verboten
+
+protected:
+ void Forward(SfxBroadcaster& rBC, const SfxHint& rHint);
+ virtual void ListenersGone();
+
+public:
+ TYPEINFO();
+
+ SfxBroadcaster();
+ SfxBroadcaster( const SfxBroadcaster &rBC );
+ virtual ~SfxBroadcaster();
+
+ void Broadcast( const SfxHint &rHint );
+ bool HasListeners() const;
+ size_t GetListenerCount() const
+ {
+ return m_Listeners.size();
+ }
+ SfxListener* GetListener( sal_uInt16 nNo ) const
+ {
+ return m_Listeners[nNo];
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/broadcast.hxx b/include/svl/broadcast.hxx
new file mode 100644
index 000000000000..ac2931986914
--- /dev/null
+++ b/include/svl/broadcast.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVT_BROADCAST_HXX
+#define _SVT_BROADCAST_HXX
+
+#include "svl/svldllapi.h"
+#include <tools/rtti.hxx>
+
+class SvtListener;
+class SfxHint;
+class SvtListenerBase;
+
+//-------------------------------------------------------------------------
+
+class SVL_DLLPUBLIC SvtBroadcaster
+{
+friend class SvtListener;
+friend class SvtListenerBase;
+friend class SvtListenerIter;
+ SvtListenerBase* pRoot;
+
+ const SvtBroadcaster& operator=(const SvtBroadcaster &); // verboten
+
+protected:
+ virtual void ListenersGone();
+
+public:
+ TYPEINFO();
+
+ SvtBroadcaster();
+ SvtBroadcaster( const SvtBroadcaster &rBC );
+ virtual ~SvtBroadcaster();
+
+ void Broadcast( const SfxHint &rHint );
+
+ sal_Bool HasListeners() const { return 0 != pRoot; }
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/cenumitm.hxx b/include/svl/cenumitm.hxx
new file mode 100644
index 000000000000..35024c3a6d44
--- /dev/null
+++ b/include/svl/cenumitm.hxx
@@ -0,0 +1,170 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVTOOLS_CENUMITM_HXX
+#define _SVTOOLS_CENUMITM_HXX
+
+#include "svl/svldllapi.h"
+#include <tools/debug.hxx>
+#include <svl/poolitem.hxx>
+
+//============================================================================
+DBG_NAMEEX(SfxEnumItemInterface)
+
+class SVL_DLLPUBLIC SfxEnumItemInterface: public SfxPoolItem
+{
+protected:
+ explicit SfxEnumItemInterface(sal_uInt16 which): SfxPoolItem(which) {}
+
+ SfxEnumItemInterface(const SfxEnumItemInterface & rItem):
+ SfxPoolItem(rItem) {}
+
+public:
+ TYPEINFO();
+
+ virtual int operator ==(const SfxPoolItem & rItem) const;
+
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation,
+ SfxMapUnit, SfxMapUnit,
+ OUString & rText,
+ const IntlWrapper * = 0)
+ const;
+
+ virtual bool QueryValue(com::sun::star::uno::Any & rVal, sal_uInt8 = 0) const;
+
+ virtual bool PutValue(const com::sun::star::uno::Any & rVal, sal_uInt8 = 0);
+
+ virtual sal_uInt16 GetValueCount() const = 0;
+
+ virtual OUString GetValueTextByPos(sal_uInt16 nPos) const;
+
+ virtual sal_uInt16 GetValueByPos(sal_uInt16 nPos) const;
+
+ /// Return the position of some value within this enumeration.
+ ///
+ /// @descr This method is implemented using GetValueCount() and
+ /// GetValueByPos(). Derived classes may replace this with a more
+ /// efficient implementation.
+ ///
+ /// @param nValue Some value.
+ ///
+ /// @return The position of nValue within this enumeration, or USHRT_MAX
+ /// if not included.
+ virtual sal_uInt16 GetPosByValue(sal_uInt16 nValue) const;
+
+ virtual sal_Bool IsEnabled(sal_uInt16 nValue) const;
+
+ virtual sal_uInt16 GetEnumValue() const = 0;
+
+ virtual void SetEnumValue(sal_uInt16 nValue) = 0;
+
+ virtual int HasBoolValue() const;
+
+ virtual sal_Bool GetBoolValue() const;
+
+ virtual void SetBoolValue(sal_Bool bValue);
+};
+
+//============================================================================
+DBG_NAMEEX(CntEnumItem)
+
+class SVL_DLLPUBLIC CntEnumItem: public SfxEnumItemInterface
+{
+ sal_uInt16 m_nValue;
+
+protected:
+ explicit CntEnumItem(sal_uInt16 which = 0, sal_uInt16 nTheValue = 0):
+ SfxEnumItemInterface(which), m_nValue(nTheValue) {}
+
+ CntEnumItem(sal_uInt16 which, SvStream & rStream);
+
+ CntEnumItem(const CntEnumItem & rItem):
+ SfxEnumItemInterface(rItem), m_nValue(rItem.m_nValue) {}
+
+public:
+ TYPEINFO();
+
+ virtual SvStream & Store(SvStream & rStream, sal_uInt16) const;
+
+ virtual sal_uInt16 GetEnumValue() const;
+
+ virtual void SetEnumValue(sal_uInt16 nTheValue);
+
+ sal_uInt16 GetValue() const { return m_nValue; }
+
+ inline void SetValue(sal_uInt16 nTheValue);
+};
+
+inline void CntEnumItem::SetValue(sal_uInt16 nTheValue)
+{
+ DBG_ASSERT(GetRefCount() == 0, "CntEnumItem::SetValue(): Pooled item");
+ m_nValue = nTheValue;
+}
+
+//============================================================================
+DBG_NAMEEX(CntBoolItem)
+
+class SVL_DLLPUBLIC CntBoolItem: public SfxPoolItem
+{
+ sal_Bool m_bValue;
+
+public:
+ TYPEINFO();
+
+ explicit CntBoolItem(sal_uInt16 which = 0, sal_Bool bTheValue = sal_False):
+ SfxPoolItem(which), m_bValue(bTheValue) {}
+
+ CntBoolItem(sal_uInt16 nWhich, SvStream & rStream);
+
+ CntBoolItem(const CntBoolItem & rItem):
+ SfxPoolItem(rItem), m_bValue(rItem.m_bValue) {}
+
+ virtual int operator ==(const SfxPoolItem & rItem) const;
+
+ using SfxPoolItem::Compare;
+ virtual int Compare(const SfxPoolItem & rWith) const;
+
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation,
+ SfxMapUnit, SfxMapUnit,
+ OUString & rText,
+ const IntlWrapper * = 0)
+ const;
+
+ virtual bool QueryValue(com::sun::star::uno::Any& rVal, sal_uInt8 = 0) const;
+
+ virtual bool PutValue(const com::sun::star::uno::Any& rVal, sal_uInt8 = 0);
+
+ virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const;
+
+ virtual SvStream & Store(SvStream & rStream, sal_uInt16) const;
+
+ virtual SfxPoolItem * Clone(SfxItemPool * = 0) const;
+
+ virtual sal_uInt16 GetValueCount() const;
+
+ virtual OUString GetValueTextByVal(sal_Bool bTheValue) const;
+
+ sal_Bool GetValue() const { return m_bValue; }
+
+ void SetValue(sal_Bool bTheValue) { m_bValue = bTheValue; }
+};
+
+#endif // _SVTOOLS_CENUMITM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/cintitem.hxx b/include/svl/cintitem.hxx
new file mode 100644
index 000000000000..e781ada09a35
--- /dev/null
+++ b/include/svl/cintitem.hxx
@@ -0,0 +1,274 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVTOOLS_CINTITEM_HXX
+#define _SVTOOLS_CINTITEM_HXX
+
+#include "svl/svldllapi.h"
+#include <tools/debug.hxx>
+#include <svl/poolitem.hxx>
+
+//============================================================================
+DBG_NAMEEX_VISIBILITY(CntByteItem, SVL_DLLPUBLIC)
+
+class SVL_DLLPUBLIC CntByteItem: public SfxPoolItem
+{
+ sal_uInt8 m_nValue;
+
+public:
+ TYPEINFO();
+
+ CntByteItem(sal_uInt16 which = 0, sal_uInt8 nTheValue = 0):
+ SfxPoolItem(which), m_nValue(nTheValue) { DBG_CTOR(CntByteItem, 0); }
+
+ CntByteItem(const CntByteItem & rItem):
+ SfxPoolItem(rItem), m_nValue(rItem.m_nValue)
+ { DBG_CTOR(CntByteItem, 0); }
+
+ virtual ~CntByteItem() { DBG_DTOR(CntByteItem, 0); }
+
+ virtual int operator ==(const SfxPoolItem & rItem) const;
+
+ using SfxPoolItem::Compare;
+ virtual int Compare(const SfxPoolItem & rWith) const;
+
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation,
+ SfxMapUnit, SfxMapUnit,
+ OUString & rText,
+ const IntlWrapper * = 0)
+ const;
+
+ virtual bool QueryValue(com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0) const;
+
+ virtual bool PutValue(const com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0);
+
+ virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const;
+
+ virtual SvStream & Store(SvStream & rStream, sal_uInt16) const;
+
+ virtual SfxPoolItem * Clone(SfxItemPool * = 0) const;
+
+ virtual sal_uInt8 GetMin() const;
+
+ virtual sal_uInt8 GetMax() const;
+
+ virtual SfxFieldUnit GetUnit() const;
+
+ sal_uInt8 GetValue() const { return m_nValue; }
+
+ inline void SetValue(sal_uInt8 nTheValue);
+};
+
+inline void CntByteItem::SetValue(sal_uInt8 nTheValue)
+{
+ DBG_ASSERT(GetRefCount() == 0, "CntByteItem::SetValue(): Pooled item");
+ m_nValue = nTheValue;
+}
+
+//============================================================================
+DBG_NAMEEX_VISIBILITY(CntUInt16Item, SVL_DLLPUBLIC)
+
+class SVL_DLLPUBLIC CntUInt16Item: public SfxPoolItem
+{
+ sal_uInt16 m_nValue;
+
+public:
+ TYPEINFO();
+
+ CntUInt16Item(sal_uInt16 which = 0, sal_uInt16 nTheValue = 0):
+ SfxPoolItem(which), m_nValue(nTheValue)
+ { DBG_CTOR(CntUInt16Item, 0); }
+
+ CntUInt16Item(sal_uInt16 which, SvStream & rStream);
+
+ CntUInt16Item(const CntUInt16Item & rItem):
+ SfxPoolItem(rItem), m_nValue(rItem.m_nValue)
+ { DBG_CTOR(CntUInt16Item, 0); }
+
+ virtual ~CntUInt16Item() { DBG_DTOR(CntUInt16Item, 0); }
+
+ virtual int operator ==(const SfxPoolItem & rItem) const;
+
+ using SfxPoolItem::Compare;
+ virtual int Compare(const SfxPoolItem & rWith) const;
+
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation,
+ SfxMapUnit, SfxMapUnit,
+ OUString & rText,
+ const IntlWrapper * = 0)
+ const;
+
+ virtual bool QueryValue(com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0) const;
+
+ virtual bool PutValue(const com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0);
+
+ virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const;
+
+ virtual SvStream & Store(SvStream & rStream, sal_uInt16) const;
+
+ virtual SfxPoolItem * Clone(SfxItemPool * = 0) const;
+
+ virtual sal_uInt16 GetMin() const;
+
+ virtual sal_uInt16 GetMax() const;
+
+ virtual SfxFieldUnit GetUnit() const;
+
+ sal_uInt16 GetValue() const { return m_nValue; }
+
+ inline void SetValue(sal_uInt16 nTheValue);
+};
+
+inline void CntUInt16Item::SetValue(sal_uInt16 nTheValue)
+{
+ DBG_ASSERT(GetRefCount() == 0, "CntUInt16Item::SetValue(): Pooled item");
+ m_nValue = nTheValue;
+}
+
+//============================================================================
+DBG_NAMEEX_VISIBILITY(CntInt32Item, SVL_DLLPUBLIC)
+
+class SVL_DLLPUBLIC CntInt32Item: public SfxPoolItem
+{
+ sal_Int32 m_nValue;
+
+public:
+ TYPEINFO();
+
+ CntInt32Item(sal_uInt16 which = 0, sal_Int32 nTheValue = 0):
+ SfxPoolItem(which), m_nValue(nTheValue)
+ { DBG_CTOR(CntInt32Item, 0); }
+
+ CntInt32Item(sal_uInt16 which, SvStream & rStream);
+
+ CntInt32Item(const CntInt32Item & rItem):
+ SfxPoolItem(rItem), m_nValue(rItem.m_nValue)
+ { DBG_CTOR(CntInt32Item, 0); }
+
+ virtual ~CntInt32Item() { DBG_DTOR(CntInt32Item, 0); }
+
+ virtual int operator ==(const SfxPoolItem & rItem) const;
+
+ using SfxPoolItem::Compare;
+ virtual int Compare(const SfxPoolItem & rWith) const;
+
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation,
+ SfxMapUnit, SfxMapUnit,
+ OUString & rText,
+ const IntlWrapper * = 0)
+ const;
+
+ virtual bool QueryValue(com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0) const;
+
+ virtual bool PutValue(const com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0);
+
+ virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const;
+
+ virtual SvStream & Store(SvStream &, sal_uInt16) const;
+
+ virtual SfxPoolItem * Clone(SfxItemPool * = 0) const;
+
+ virtual sal_Int32 GetMin() const;
+
+ virtual sal_Int32 GetMax() const;
+
+ virtual SfxFieldUnit GetUnit() const;
+
+ sal_Int32 GetValue() const { return m_nValue; }
+
+ inline void SetValue(sal_Int32 nTheValue);
+};
+
+inline void CntInt32Item::SetValue(sal_Int32 nTheValue)
+{
+ DBG_ASSERT(GetRefCount() == 0, "CntInt32Item::SetValue(): Pooled item");
+ m_nValue = nTheValue;
+}
+
+//============================================================================
+DBG_NAMEEX_VISIBILITY(CntUInt32Item, SVL_DLLPUBLIC)
+
+class SVL_DLLPUBLIC CntUInt32Item: public SfxPoolItem
+{
+ sal_uInt32 m_nValue;
+
+public:
+ TYPEINFO();
+
+ CntUInt32Item(sal_uInt16 which = 0, sal_uInt32 nTheValue = 0):
+ SfxPoolItem(which), m_nValue(nTheValue)
+ { DBG_CTOR(CntUInt32Item, 0); }
+
+ CntUInt32Item(sal_uInt16 nWhich, SvStream & rStream);
+
+ CntUInt32Item(const CntUInt32Item & rItem):
+ SfxPoolItem(rItem), m_nValue(rItem.m_nValue)
+ { DBG_CTOR(CntUInt32Item, 0); }
+
+ virtual ~CntUInt32Item() { DBG_DTOR(CntUInt32Item, 0); }
+
+ virtual int operator ==(const SfxPoolItem & rItem) const;
+
+ using SfxPoolItem::Compare;
+ virtual int Compare(const SfxPoolItem & rWith) const;
+
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation,
+ SfxMapUnit, SfxMapUnit,
+ OUString & rText,
+ const IntlWrapper * = 0)
+ const;
+
+ virtual bool QueryValue(com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0) const;
+
+ virtual bool PutValue(const com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0);
+
+ virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const;
+
+ virtual SvStream & Store(SvStream & rStream, sal_uInt16) const;
+
+ virtual SfxPoolItem * Clone(SfxItemPool * = 0) const;
+
+ virtual sal_uInt32 GetMin() const;
+
+ virtual sal_uInt32 GetMax() const;
+
+ virtual SfxFieldUnit GetUnit() const;
+
+ sal_uInt32 GetValue() const { return m_nValue; }
+
+ inline void SetValue(sal_uInt32 nTheValue);
+};
+
+inline void CntUInt32Item::SetValue(sal_uInt32 nTheValue)
+{
+ DBG_ASSERT(GetRefCount() == 0, "CntUInt32Item::SetValue(): Pooled item");
+ m_nValue = nTheValue;
+}
+
+#endif // _SVTOOLS_CINTITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/cjkoptions.hxx b/include/svl/cjkoptions.hxx
new file mode 100644
index 000000000000..22055e404b42
--- /dev/null
+++ b/include/svl/cjkoptions.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVTOOLS_CJKOPTIONS_HXX
+#define _SVTOOLS_CJKOPTIONS_HXX
+
+#include "svl/svldllapi.h"
+#include <sal/types.h>
+#include <unotools/options.hxx>
+
+class SvtCJKOptions_Impl;
+
+// class SvtCJKOptions --------------------------------------------------
+
+class SVL_DLLPUBLIC SvtCJKOptions: public utl::detail::Options
+{
+private:
+ SvtCJKOptions_Impl* pImp;
+
+public:
+
+ enum EOption
+ {
+ E_CJKFONT,
+ E_VERTICALTEXT,
+ E_ASIANTYPOGRAPHY,
+ E_JAPANESEFIND,
+ E_RUBY,
+ E_CHANGECASEMAP,
+ E_DOUBLELINES,
+ E_EMPHASISMARKS,
+ E_VERTICALCALLOUT,
+ E_ALL // special one for IsAnyEnabled()/SetAll() functionality
+ };
+
+ // bDontLoad is for referencing purposes only
+ SvtCJKOptions(sal_Bool bDontLoad = sal_False);
+ virtual ~SvtCJKOptions();
+
+ sal_Bool IsCJKFontEnabled() const;
+ sal_Bool IsVerticalTextEnabled() const;
+ sal_Bool IsAsianTypographyEnabled() const;
+ sal_Bool IsJapaneseFindEnabled() const;
+ sal_Bool IsRubyEnabled() const;
+ sal_Bool IsChangeCaseMapEnabled() const;
+ sal_Bool IsDoubleLinesEnabled() const;
+
+ void SetAll(sal_Bool bSet);
+ sal_Bool IsAnyEnabled() const;
+ sal_Bool IsReadOnly(EOption eOption) const;
+};
+
+#endif // _SVTOOLS_CJKOPTIONS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/cntwall.hxx b/include/svl/cntwall.hxx
new file mode 100644
index 000000000000..581c558b2575
--- /dev/null
+++ b/include/svl/cntwall.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _CNTWALL_HXX
+#define _CNTWALL_HXX
+
+#include "svl/svldllapi.h"
+
+#include <tools/shl.hxx>
+#include <tools/rtti.hxx>
+#include <tools/color.hxx>
+#include <svl/poolitem.hxx>
+
+class SvStream;
+
+class SVL_DLLPUBLIC CntWallpaperItem : public SfxPoolItem
+{
+private:
+ OUString _aURL;
+ Color _nColor;
+ sal_uInt16 _nStyle;
+
+public:
+ TYPEINFO();
+
+ CntWallpaperItem( sal_uInt16 nWhich );
+ CntWallpaperItem( sal_uInt16 nWhich, SvStream& rStream, sal_uInt16 nVersion );
+ CntWallpaperItem( const CntWallpaperItem& rCpy );
+ ~CntWallpaperItem();
+
+ virtual sal_uInt16 GetVersion(sal_uInt16) const;
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Create( SvStream&, sal_uInt16 nItemVersion ) const;
+ virtual SvStream& Store( SvStream&, sal_uInt16 nItemVersion ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue ( const com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 );
+
+ void SetBitmapURL( const OUString& rURL ) { _aURL = rURL; }
+ void SetColor( Color nColor ) { _nColor = nColor; }
+ void SetStyle( sal_uInt16 nStyle ) { _nStyle = nStyle; }
+
+ const OUString& GetBitmapURL() const { return _aURL; }
+ Color GetColor() const { return _nColor; }
+ sal_uInt16 GetStyle() const { return _nStyle; }
+};
+
+////////////////////////////////////////////////////////////////////////////////
+
+#endif // _CNTWALL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/cntwids.hrc b/include/svl/cntwids.hrc
new file mode 100644
index 000000000000..68a9b3ab3ee5
--- /dev/null
+++ b/include/svl/cntwids.hrc
@@ -0,0 +1,208 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CNTWIDS_HRC
+#define _CNTWIDS_HRC
+
+//=========================================================================
+// ARGS, MSG, ALL, FOLDER, BOXALL, BOXEXT
+//=========================================================================
+
+#define WID_CHAOS_START 500
+
+//PROP MSG
+#define WID_PRIORITY (WID_CHAOS_START + 15)
+#define WID_REPLY_TO (WID_CHAOS_START + 19)
+#define WID_IN_REPLY_TO (WID_CHAOS_START + 20)
+
+#define WID_MESSAGE_ID (WID_CHAOS_START + 21)
+#define WID_BCC (WID_CHAOS_START + 22)
+#define WID_CC (WID_CHAOS_START + 23)
+#define WID_TO (WID_CHAOS_START + 24)
+#define WID_FROM (WID_CHAOS_START + 25)
+#define WID_TITLE (WID_CHAOS_START + 26)
+#define WID_MESSAGEBODY (WID_CHAOS_START + 27)
+
+#define WID_REFERENCES (WID_CHAOS_START + 28)
+#define WID_NEWSGROUPS (WID_CHAOS_START + 29)
+#define WID_NEWS_XREFLIST (WID_CHAOS_START + 30)
+
+#define WID_OUTMSGINTERNALSTATE (WID_CHAOS_START + 31)
+#define WID_RECIPIENTLIST (WID_CHAOS_START + 32)
+
+//PROP ALL
+#define WID_CONTENT_TYPE (WID_CHAOS_START + 44)
+
+#define WID_OWN_URL (WID_CHAOS_START + 45)
+#define WID_REAL_URL (WID_CHAOS_START + 46)
+#define WID_FLAG_READONLY (WID_CHAOS_START + 48)
+
+#define WID_FLAG_IS_FOLDER (WID_CHAOS_START + 51)
+#define WID_FLAG_HAS_FOLDER (WID_CHAOS_START + 52)
+#define WID_FLAG_IS_MESSAGE (WID_CHAOS_START + 53)
+#define WID_FLAG_HAS_MESSAGES (WID_CHAOS_START + 54)
+
+#define WID_DATE_CREATED (WID_CHAOS_START + 55)
+#define WID_DATE_MODIFIED (WID_CHAOS_START + 56)
+#define WID_IS_READ (WID_CHAOS_START + 58)
+#define WID_IS_MARKED (WID_CHAOS_START + 59)
+
+//PROP FOLDER VIEW
+#define WID_THREADING (WID_CHAOS_START + 66)
+#define WID_FOLDERVIEW_MODE (WID_CHAOS_START + 69)
+#define WID_MESSAGEVIEW_MODE (WID_CHAOS_START + 70)
+#define WID_SENTMESSAGEVIEW_MODE (WID_CHAOS_START + 71)
+#define WID_THREADED (WID_CHAOS_START + 73)
+#define WID_RULES (WID_CHAOS_START + 75)
+#define WID_SUBSCRNEWSGROUPCOUNT (WID_CHAOS_START + 76)
+#define WID_FLAG_SUBSCRIBED (WID_CHAOS_START + 77)
+
+//PROP FOLDER DIR
+#define WID_TOTALCONTENTCOUNT (WID_CHAOS_START + 80)
+
+//PROP FOLDER USER
+#define WID_SEENCONTENTCOUNT (WID_CHAOS_START + 86)
+
+//PROP BOXALL
+#define WID_USERNAME (WID_CHAOS_START + 91)
+#define WID_PASSWORD (WID_CHAOS_START + 92)
+#define WID_SERVERNAME (WID_CHAOS_START + 93)
+#define WID_SERVERPORT (WID_CHAOS_START + 94)
+#define WID_SERVERBASE (WID_CHAOS_START + 101)
+
+// -> ..._DEFAULT
+
+#define WID_AUTOUPDATE_INTERVAL (WID_CHAOS_START + 105)
+#define WID_UPDATE_ENABLED (WID_CHAOS_START + 106)
+
+//PROP BOX RNMGR
+#define WID_CONNECTION_MODE (WID_CHAOS_START + 107)
+#define WID_MESSAGE_STOREMODE (WID_CHAOS_START + 109)
+#define WID_DELETE_ON_SERVER (WID_CHAOS_START + 110)
+
+//////////////////////////////////////////////////////////////////////////
+// MISC - Added after initial pool version
+//////////////////////////////////////////////////////////////////////////
+
+// PROP FOLDER
+#define WID_SHOW_MSGS_HAS_TIMELIMIT (WID_CHAOS_START + 121)
+#define WID_SHOW_MSGS_TIMELIMIT (WID_CHAOS_START + 122)
+#define WID_STORE_MSGS_HAS_TIMELIMIT (WID_CHAOS_START + 123)
+#define WID_STORE_MSGS_TIMELIMIT (WID_CHAOS_START + 124)
+
+//////////////////////////////////////////////////////////////////////////
+// WIDs added after SO 4.0 release
+//////////////////////////////////////////////////////////////////////////
+
+// PROP BOXALL
+#define WID_SEND_PUBLIC_PROT_ID (WID_CHAOS_START + 127)
+#define WID_SEND_PRIVATE_PROT_ID (WID_CHAOS_START + 128)
+#define WID_SEND_PUBLIC_OUTBOXPROPS (WID_CHAOS_START + 129)
+#define WID_SEND_PRIVATE_OUTBOXPROPS (WID_CHAOS_START + 130)
+#define WID_SEND_SERVERNAME (WID_CHAOS_START + 131)
+#define WID_SEND_USERNAME (WID_CHAOS_START + 132)
+#define WID_SEND_PASSWORD (WID_CHAOS_START + 133)
+#define WID_SEND_REPLY_TO_DEFAULT (WID_CHAOS_START + 134)
+#define WID_SEND_FROM_DEFAULT (WID_CHAOS_START + 135)
+#define WID_VIM_POPATH (WID_CHAOS_START + 136)
+#define WID_SEND_VIM_POPATH (WID_CHAOS_START + 137)
+#define WID_LOCALBASE (WID_CHAOS_START + 142)
+
+// PROP DOCUMENT
+#define WID_DOCUMENT_HEADER (WID_CHAOS_START + 143)
+#define WID_DOCUMENT_BODY (WID_CHAOS_START + 144)
+#define WID_DOCUMENT_SIZE (WID_CHAOS_START + 145)
+
+// PROP FSYS
+#define WID_FSYS_DISKSPACE_LEFT (WID_CHAOS_START + 148)
+
+// PROP ALL
+#define WID_KEYWORDS (WID_CHAOS_START + 150)
+
+// PROP SEARCH
+#define WID_SEARCH_CRITERIA (WID_CHAOS_START + 152)
+#define WID_SEARCH_LOCATIONS (WID_CHAOS_START + 153)
+#define WID_SEARCH_RECURSIVE (WID_CHAOS_START + 154)
+
+// PROP Channel
+#define WID_TARGET_URL (WID_CHAOS_START + 159)
+
+// PROP HTTP
+#define WID_HTTP_CONNECTION_LIMIT (WID_CHAOS_START + 161)
+
+// PROP BOXALL
+#define WID_ACCOUNT (WID_CHAOS_START + 172)
+
+// PROP FSYS
+#define WID_FSYS_FLAGS (WID_CHAOS_START + 174)
+
+// PROP FSYS
+#define WID_WHO_IS_MASTER (WID_CHAOS_START + 176)
+
+// PROP ALL
+#define WID_SIZE_LIMIT (WID_CHAOS_START + 179)
+
+// PROP FOLDER
+#define WID_MARKED_DOCUMENT_COUNT (WID_CHAOS_START + 180)
+#define WID_FOLDER_COUNT (WID_CHAOS_START + 181)
+
+// TRASHCAN
+#define WID_TRASHCAN_FLAG_AUTODELETE (WID_CHAOS_START + 184)
+#define WID_TRASHCAN_FLAG_CONFIRMEMPTY (WID_CHAOS_START + 185)
+
+// TRASH
+#define WID_TRASH_ORIGIN (WID_CHAOS_START + 189)
+
+// PROP ALL
+#define WID_TARGET_FRAMES (WID_CHAOS_START + 191)
+
+// PROP ALL
+#define WID_FLAG_UPDATE_ON_OPEN (WID_CHAOS_START + 213)
+
+// PROP HTTP
+#define WID_HTTP_KEEP_EXPIRED (WID_CHAOS_START + 220)
+#define WID_HTTP_VERIFY_MODE (WID_CHAOS_START + 221)
+#define WID_HTTP_NOCACHE_LIST (WID_CHAOS_START + 222)
+#define WID_HTTP_REFERER (WID_CHAOS_START + 223)
+
+// PROP HTTP
+#define WID_HTTP_COOKIE (WID_CHAOS_START + 231)
+
+//////////////////////////////////////////////////////////////////////////
+// WIDs added after SO 5.0 release
+//////////////////////////////////////////////////////////////////////////
+
+// PROP FOLDER
+#define WID_USER_SORT_CRITERIUM (WID_CHAOS_START + 233)
+
+// PROP FTP
+#define WID_FTP_ACCOUNT (WID_CHAOS_START + 243)
+
+// PROP SEARCH
+#define WID_SEARCH_INDIRECTIONS (WID_CHAOS_START + 250)
+
+// PROP ALL
+#define WID_SEND_FORMATS (WID_CHAOS_START + 251)
+#define WID_SEND_COPY_TARGET (WID_CHAOS_START + 252)
+
+// END
+
+#endif /* !_CNTWIDS_HRC */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/converter.hxx b/include/svl/converter.hxx
new file mode 100644
index 000000000000..8f423f786307
--- /dev/null
+++ b/include/svl/converter.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SV_CONVERTER_HXX_
+#define _SV_CONVERTER_HXX_
+
+#include "svl/svldllapi.h"
+#include <tools/solar.h>
+
+class SvDbaseConverter
+{
+public:
+ SVL_DLLPUBLIC static sal_Int32 ConvertPrecisionToDbase(sal_Int32 _nLen, sal_Int32 _nScale);
+ SVL_DLLPUBLIC static sal_Int32 ConvertPrecisionToOdbc(sal_Int32 _nLen, sal_Int32 _nScale);
+};
+
+#endif //_CONVERTER_HXX_
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/ctloptions.hxx b/include/svl/ctloptions.hxx
new file mode 100644
index 000000000000..525e8e73a795
--- /dev/null
+++ b/include/svl/ctloptions.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVTOOLS_CTLOPTIONS_HXX
+#define _SVTOOLS_CTLOPTIONS_HXX
+
+#include "svl/svldllapi.h"
+#include <sal/types.h>
+#include <svl/brdcst.hxx>
+#include <svl/lstner.hxx>
+#include <unotools/options.hxx>
+
+class SvtCTLOptions_Impl;
+
+// class SvtCTLOptions --------------------------------------------------------
+
+class SVL_DLLPUBLIC SvtCTLOptions : public utl::detail::Options
+{
+private:
+ SvtCTLOptions_Impl* m_pImp;
+
+public:
+
+ // bDontLoad is for referencing purposes only
+ SvtCTLOptions( bool bDontLoad = false );
+ virtual ~SvtCTLOptions();
+
+ void SetCTLFontEnabled( bool _bEnabled );
+ bool IsCTLFontEnabled() const;
+
+ void SetCTLSequenceChecking( bool _bEnabled );
+ bool IsCTLSequenceChecking() const;
+
+ void SetCTLSequenceCheckingRestricted( bool _bEnable );
+ bool IsCTLSequenceCheckingRestricted( void ) const;
+
+ void SetCTLSequenceCheckingTypeAndReplace( bool _bEnable );
+ bool IsCTLSequenceCheckingTypeAndReplace() const;
+
+ enum CursorMovement
+ {
+ MOVEMENT_LOGICAL = 0,
+ MOVEMENT_VISUAL
+ };
+ void SetCTLCursorMovement( CursorMovement _eMovement );
+ CursorMovement GetCTLCursorMovement() const;
+
+ enum TextNumerals
+ {
+ NUMERALS_ARABIC = 0,
+ NUMERALS_HINDI,
+ NUMERALS_SYSTEM,
+ NUMERALS_CONTEXT
+ };
+ void SetCTLTextNumerals( TextNumerals _eNumerals );
+ TextNumerals GetCTLTextNumerals() const;
+
+ enum EOption
+ {
+ E_CTLFONT,
+ E_CTLSEQUENCECHECKING,
+ E_CTLCURSORMOVEMENT,
+ E_CTLTEXTNUMERALS,
+ E_CTLSEQUENCECHECKINGRESTRICTED,
+ E_CTLSEQUENCECHECKINGTYPEANDREPLACE
+ };
+ bool IsReadOnly(EOption eOption) const;
+};
+
+#endif // _SVTOOLS_CTLOPTIONS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/ctypeitm.hxx b/include/svl/ctypeitm.hxx
new file mode 100644
index 000000000000..1a783bca78d8
--- /dev/null
+++ b/include/svl/ctypeitm.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVTOOLS_CTYPEITM_HXX
+#define _SVTOOLS_CTYPEITM_HXX
+
+#include <svl/inettype.hxx>
+#include <svl/custritm.hxx>
+
+//=========================================================================
+
+class CntContentTypeItem : public CntUnencodedStringItem
+{
+private:
+ INetContentType _eType;
+ OUString _aPresentation;
+
+public:
+ TYPEINFO();
+
+ CntContentTypeItem();
+ CntContentTypeItem( sal_uInt16 nWhich, const OUString& rType );
+ CntContentTypeItem( const CntContentTypeItem& rOrig );
+
+ virtual SfxPoolItem* Create( SvStream& rStream,
+ sal_uInt16 nItemVersion ) const;
+ virtual SvStream & Store(SvStream & rStream, sal_uInt16) const;
+
+ virtual int operator==( const SfxPoolItem& rOrig ) const;
+
+ virtual sal_uInt16 GetVersion(sal_uInt16) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = NULL ) const;
+
+ void SetValue( const OUString& rNewVal );
+
+ using SfxPoolItem::Compare;
+ virtual int Compare( const SfxPoolItem &rWith, const IntlWrapper& rIntlWrapper ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString & rText,
+ const IntlWrapper* pIntlWrapper = 0 ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue ( const com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0);
+
+ INetContentType GetEnumValue() const;
+
+ void SetValue( const INetContentType eType );
+};
+
+#endif /* !_SVTOOLS_CTYPEITM_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/custritm.hxx b/include/svl/custritm.hxx
new file mode 100644
index 000000000000..70948d8fbf43
--- /dev/null
+++ b/include/svl/custritm.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVTOOLS_CUSTRITM_HXX
+#define _SVTOOLS_CUSTRITM_HXX
+
+#include "svl/svldllapi.h"
+#include <tools/debug.hxx>
+#include <svl/poolitem.hxx>
+
+//============================================================================
+DBG_NAMEEX_VISIBILITY(CntUnencodedStringItem, SVL_DLLPUBLIC)
+
+class SVL_DLLPUBLIC CntUnencodedStringItem: public SfxPoolItem
+{
+ OUString m_aValue;
+
+public:
+ TYPEINFO();
+
+ CntUnencodedStringItem(sal_uInt16 which = 0): SfxPoolItem(which)
+ { DBG_CTOR(CntUnencodedStringItem, 0); }
+
+ CntUnencodedStringItem(sal_uInt16 which, const OUString & rTheValue):
+ SfxPoolItem(which), m_aValue(rTheValue)
+ { DBG_CTOR(CntUnencodedStringItem, 0); }
+
+ CntUnencodedStringItem(const CntUnencodedStringItem & rItem):
+ SfxPoolItem(rItem), m_aValue(rItem.m_aValue)
+ { DBG_CTOR(CntUnencodedStringItem, 0); }
+
+ virtual ~CntUnencodedStringItem() { DBG_DTOR(CntUnencodedStringItem, 0); }
+
+ virtual int operator ==(const SfxPoolItem & rItem) const;
+
+ virtual int Compare(const SfxPoolItem & rWith) const;
+
+ virtual int Compare(SfxPoolItem const & rWith,
+ IntlWrapper const & rIntlWrapper) const;
+
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation,
+ SfxMapUnit, SfxMapUnit,
+ OUString & rText,
+ const IntlWrapper * = 0)
+ const;
+
+ virtual bool QueryValue(com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0) const;
+
+ virtual bool PutValue(const com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0);
+
+ virtual SfxPoolItem * Clone(SfxItemPool * = 0) const;
+
+ const OUString & GetValue() const { return m_aValue; }
+
+ inline void SetValue(const OUString & rTheValue);
+};
+
+inline void CntUnencodedStringItem::SetValue(const OUString & rTheValue)
+{
+ DBG_ASSERT(GetRefCount() == 0,
+ "CntUnencodedStringItem::SetValue(): Pooled item");
+ m_aValue = rTheValue;
+}
+
+#endif // _SVTOOLS_CUSTRITM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/dateitem.hxx b/include/svl/dateitem.hxx
new file mode 100644
index 000000000000..043502966ffc
--- /dev/null
+++ b/include/svl/dateitem.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _DATETIMEITEM_HXX
+#define _DATETIMEITEM_HXX
+
+#include <tools/rtti.hxx>
+#include <tools/datetime.hxx>
+
+#include <svl/poolitem.hxx>
+
+class SvStream;
+
+DBG_NAMEEX(SfxDateTimeItem)
+
+// class SfxDateTimeItem -------------------------------------------------
+
+class SfxDateTimeItem : public SfxPoolItem
+{
+private:
+ DateTime aDateTime;
+
+public:
+ TYPEINFO();
+
+ SfxDateTimeItem( sal_uInt16 nWhich,
+ const DateTime& rDT );
+ SfxDateTimeItem( const SfxDateTimeItem& rCpy );
+
+ ~SfxDateTimeItem() {
+ DBG_DTOR(SfxDateTimeItem, 0); }
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ using SfxPoolItem::Compare;
+ virtual int Compare( const SfxPoolItem &rWith ) const;
+ virtual SfxPoolItem* Create( SvStream&, sal_uInt16 nItemVersion ) const;
+ virtual SvStream& Store( SvStream&, sal_uInt16 nItemVersion ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper * pIntlWrapper = 0 )
+ const;
+
+ const DateTime& GetDateTime() const { return aDateTime; }
+ void SetDateTime( const DateTime& rDT ) {
+ DBG_ASSERT( GetRefCount() == 0,
+ "SetDateTime() with pooled item" );
+ aDateTime = rDT; }
+
+ virtual bool PutValue ( const com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 );
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 ) const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/documentlockfile.hxx b/include/svl/documentlockfile.hxx
new file mode 100644
index 000000000000..437b59fbf127
--- /dev/null
+++ b/include/svl/documentlockfile.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVT_DOCUMENTLOCKFILE_HXX
+#define _SVT_DOCUMENTLOCKFILE_HXX
+
+#include <svl/svldllapi.h>
+
+#include <com/sun/star/io/XStream.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
+#include <com/sun/star/io/XTruncate.hpp>
+
+#include <svl/lockfilecommon.hxx>
+
+namespace svt {
+
+class SVL_DLLPUBLIC DocumentLockFile : public LockFileCommon
+{
+ // the workaround for automated testing!
+ static sal_Bool m_bAllowInteraction;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > OpenStream();
+
+ void WriteEntryToStream( ::com::sun::star::uno::Sequence< OUString > aEntry, ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xStream );
+
+public:
+ DocumentLockFile( const OUString& aOrigURL );
+ ~DocumentLockFile();
+
+ sal_Bool CreateOwnLockFile();
+ ::com::sun::star::uno::Sequence< OUString > GetLockData();
+ sal_Bool OverwriteOwnLockFile();
+ void RemoveFile();
+
+ // the methods allow to control whether UI interaction regarding the locked document file is allowed
+ // this is a workaround for automated tests
+ static void AllowInteraction( sal_Bool bAllow ) { m_bAllowInteraction = bAllow; }
+ static sal_Bool IsInteractionAllowed() { return m_bAllowInteraction; }
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/eitem.hxx b/include/svl/eitem.hxx
new file mode 100644
index 000000000000..c9c5e389132f
--- /dev/null
+++ b/include/svl/eitem.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SFXENUMITEM_HXX
+#define _SFXENUMITEM_HXX
+
+#include "svl/svldllapi.h"
+#include <svl/cenumitm.hxx>
+
+//============================================================================
+class SVL_DLLPUBLIC SfxEnumItem: public CntEnumItem
+{
+protected:
+ explicit SfxEnumItem(sal_uInt16 which = 0, sal_uInt16 nValue = 0):
+ CntEnumItem(which, nValue) {}
+
+ SfxEnumItem(sal_uInt16 which, SvStream & rStream):
+ CntEnumItem(which, rStream) {}
+
+public:
+ TYPEINFO();
+
+};
+
+//============================================================================
+class SVL_DLLPUBLIC SfxBoolItem: public CntBoolItem
+{
+public:
+ TYPEINFO();
+
+ explicit SfxBoolItem(sal_uInt16 which = 0, sal_Bool bValue = sal_False):
+ CntBoolItem(which, bValue) {}
+
+ SfxBoolItem(sal_uInt16 which, SvStream & rStream):
+ CntBoolItem(which, rStream) {}
+
+ virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const
+ { return new SfxBoolItem(Which(), rStream); }
+
+ virtual SfxPoolItem * Clone(SfxItemPool * = 0) const
+ { return new SfxBoolItem(*this); }
+};
+
+#endif // _SFXENUMITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/filenotation.hxx b/include/svl/filenotation.hxx
new file mode 100644
index 000000000000..00c2c16ed77c
--- /dev/null
+++ b/include/svl/filenotation.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVTOOLS_FILENOTATION_HXX
+#define SVTOOLS_FILENOTATION_HXX
+
+#include "svl/svldllapi.h"
+#include <rtl/ustring.hxx>
+
+//.........................................................................
+namespace svt
+{
+//.........................................................................
+
+ //=====================================================================
+ //= OFileNotation
+ //=====================================================================
+ class SVL_DLLPUBLIC OFileNotation
+ {
+ protected:
+ OUString m_sSystem;
+ OUString m_sFileURL;
+
+ public:
+ enum NOTATION
+ {
+ N_SYSTEM,
+ N_URL
+ };
+
+ OFileNotation( const OUString& _rUrlOrPath );
+ OFileNotation( const OUString& _rUrlOrPath, NOTATION _eInputNotation );
+
+ OUString get(NOTATION _eOutputNotation);
+
+ private:
+ SVL_DLLPRIVATE void construct( const OUString& _rUrlOrPath );
+ SVL_DLLPRIVATE bool implInitWithSystemNotation( const OUString& _rSystemPath );
+ SVL_DLLPRIVATE bool implInitWithURLNotation( const OUString& _rURL );
+ };
+
+//.........................................................................
+} // namespace svt
+//.........................................................................
+
+#endif // SVTOOLS_FILENOTATION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/filerec.hxx b/include/svl/filerec.hxx
new file mode 100644
index 000000000000..afc5f4632fd7
--- /dev/null
+++ b/include/svl/filerec.hxx
@@ -0,0 +1,1031 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SFXFILEREC_HXX
+#define _SFXFILEREC_HXX
+
+//=========================================================================
+
+#include "svl/svldllapi.h"
+#include <tools/debug.hxx>
+#include <tools/stream.hxx>
+#include <vector>
+
+//------------------------------------------------------------------------
+
+#define SFX_REC_PRETAG_EXT sal_uInt8(0x00) // Pre-Tag f"ur Extended-Records
+#define SFX_REC_PRETAG_EOR sal_uInt8(0xFF) // Pre-Tag f"ur End-Of-Records
+
+#define SFX_REC_TYPE_NONE sal_uInt8(0x00) // unbekannter Record-Typ
+#define SFX_REC_TYPE_FIRST sal_uInt8(0x01)
+#define SFX_REC_TYPE_SINGLE sal_uInt8(0x01) // Single-Content-Record
+#define SFX_REC_TYPE_FIXSIZE sal_uInt8(0x02) // Fix-Size-Multi-Content-Record
+#define SFX_REC_TYPE_VARSIZE_RELOC sal_uInt8(0x03) // variable Rec-Size
+#define SFX_REC_TYPE_VARSIZE sal_uInt8(0x04) // alt (nicht verschiebbar)
+#define SFX_REC_TYPE_MIXTAGS_RELOC sal_uInt8(0x07) // Mixed Tag Content-Record
+#define SFX_REC_TYPE_MIXTAGS sal_uInt8(0x08) // alt (nicht verschiebbar)
+#define SFX_REC_TYPE_LAST sal_uInt8(0x08)
+#define SFX_REC_TYPE_MINI 0x100 // Mini-Record
+#define SFX_REC_TYPE_DRAWENG 0x400 // Drawing-Engine-Record
+#define SFX_REC_TYPE_EOR 0xF00 // End-Of-Records
+
+//------------------------------------------------------------------------
+
+#define SFX_REC_HEADERSIZE_MINI 4 // Gr"o\se des Mini-Record-Headers
+#define SFX_REC_HEADERSIZE_SINGLE 4 // zzgl. HEADERSIZE_MINI => 8
+#define SFX_REC_HEADERSIZE_MULTI 6 // zzgl. HEADERSIZE_SINGLE => 14
+
+//------------------------------------------------------------------------
+
+#ifndef DBG
+#ifdef DBG_UTIL
+#define DBG(x) x
+#else
+#define DBG(x)
+#endif
+#endif
+
+//------------------------------------------------------------------------
+
+/* [Fileformat]
+
+ Jeder Record beginnt mit einem Byte, dem sogenannten 'Pre-Tag'.
+
+ Ist dieses 'Pre-Tag' == 0x00, dann handelt es sich um einen Extended-
+ Record, dessen Typ durch ein weiteres Byte an Position 5 n�her
+ beschrieben wird:
+
+ 0x01: SfxSingleRecord
+ 0x02: SfxMultiFixRecord
+ 0x03+0x04: SfxMultiVarRecord
+ 0x07+0x08: SfxMultiMixRecord
+ (Alle weiteren Record-Typ-Kennungen sind reserviert.)
+
+ I.d.R. werden File-Formate schon aus Performance-Gr"unden so aufgebaut,
+ da\s beim Lesen jeweils vorher schon feststeht, welcher Record-Typ
+ vorliegt. Diese Kennung dient daher hautps"achlich der "Uberpr"ufung
+ und File-Viewern, die das genaue File-Format (unterhalb der Records)
+ nicht kennen.
+
+ Der 'SfxMiniRecordReader' verf"ugt dazu auch "uber eine statische
+ Methode 'ScanRecordType()', mit der festgestellt werden kann, welcher
+ Record-Typ in dem "ubergebenen Stream zu finden ist.
+
+ Ein 'Pre-Tag' mit dem Wert 0xFF ist als Terminator reserviert.
+ Terminatoren werden verwendet, um das Suchen nach einem speziellen
+ Record zu terminieren, d.h. ist er bis dorthin nicht gefunden, wird
+ auch nicht weitergesucht.
+
+ Bei allen anderen Werten des 'Pre-Tags' (also von 0x01 bis 0xFE)
+ handelt es sich um einen zum SW3 kompatbilen Record, der hier
+ 'SfxMiniRecord' genannt wird, er kann daher mit einem <SfxMiniRecordReader>
+ gelesen werden.
+
+ Beginnt ein Record mit 0x44 k"onnte es sich um einen Drawing-Engine-
+ Record handeln. Dies ist dann der Fall, wenn die folgenden drei Bytes
+ die Zeichenkette 'RMD' bzw. 'RVW' ergeben (zusammen mit 'D'==0x44
+ ergibt dies die K"urzel f"ur 'DRaw-MoDel' bzw. 'DRaw-VieW'). Records
+ dieser Art k"onnen von den hier dargestellten Klassen weder gelesen,
+ noch in irgendeiner Weise interpretiert werden. Einzig die Methode
+ 'ScanRecordType()' kann sie erkennen - weitere Behandlung obliegt
+ jedoch der Anwendungsprogrammierung.
+
+ Diese drei Bytes an den Positionen 2 bis 4 enthalten normalerweise
+ die Gr"o\se des Records ohne Pre-Tag und Gr"o\sen-Bytes selbst,
+ also die Restgr"o\se nach diesem 4-Byte-Header.
+
+ Struktur des Mini-Records:
+
+ 1 sal_uInt8 Pre-Tag
+ 3 sal_uInt8 OffsetToEndOfRec
+ OffsetToEndOfRec* 1 sal_uInt8 Content
+
+ Bei den Extended-Reords folgt auf diesen 4-Byte-Header ein erweiterter
+ Header, der zun"achst den o.g. Record-Typ, dann eine Versions-Kennung
+ sowie ein Tag enth"alt, welches den Inhalt kennzeichnet.
+
+ Struktur des Extended-Records:
+
+ 1 sal_uInt8 Pre-Tag (==0x00)
+ 3 sal_uInt8 OffsetToEndOfRec
+ OffsetToEndOfRec* 1 sal_uInt8 Content
+ 1 sal_uInt8 Record-Type
+ 1 sal_uInt8 Version
+ 2 sal_uInt8 Tag
+ ContentSize* 1 sal_uInt8 Content
+
+ (ContentSize = OffsetToEndOfRec - 8)
+
+ [Anmerkung]
+
+ Der Aufbau der Records wird wie folgt begr"undet:
+
+ Der SW-Record-Typ war zuerst vorhanden, mu\ste also 1:1 "ubernommen
+ werden. Zum Gl"uck wurden einige Record-Tags nicht verwendet, (Z.B.
+ 0x00 und 0xFF).
+ => 1. Byte 0x00 kann als Kennung f"ur erweiterten Record verwendet werden
+ => 1. Byte 0xFF kann f"ur besondere Zwecke verwendet werden
+
+ Egal welcher Record-Typ vorliegt, sollte eine Erkennung des Typs, ein
+ Auslesen des Headers und ein "uberpspringen des Records m"oglich sein,
+ ohne zu"uck-seeken zu m"ussen und ohne "uberfl"ussige Daten lesen zu
+ m"ussen.
+ => die Bytes 2-4 werden bei allen Records als Offset zum Ende des
+ Records interpretiert, so da\s die Gesamt-Recors-Size sich wie
+ folgt berechnet: sizeof(sal_uInt32) + OffsetToEndOfRec
+
+ Die Records sollten einfach zu parsen un einheitlich aufgebaut sein.
+ => Sie bauen aufeinander auf, so ist z.B. der SfxMiniRecord in jedem
+ anderen enthalten.
+
+ Die Records sollten auch von denen der Drawing Enginge unterscheidbar
+ sein. Diese beginnen mit 'DRMD' und 'DRVW'.
+ => Mini-Records mit dem Pre-Tag 'D' d"urfen maximal 4MB gro\s sein,
+ um nicht in diesen Kennungs-Bereich zu reichen.
+
+ [Erweiterungen]
+
+ Es ist geplant das File-Format so zu erweitern, da\s das High-Nibble
+ des Record-Typs der erweiterten Records besondere Aufgaben "ubernehmen
+ soll. Zum Beispiel ist geplant, Record-Contents als 'nur aus Records
+ bestehend' zu kennzeichnen. Ein File-Viewer k"onnte sich dann automatisch
+ durch solche Strukturen 'hangeln', ohne Gefahr zu laufen, auf Daten
+ zu sto\sen, die sich zwar als Records interpretieren lassen, aber
+ tats"achlis als 'flache' Daten geschrieben wurden. Die m"ogliche
+ Erweiterung wird schon jetzt insofern vorbereitet, als da\s das
+ High-Nibble des Typs bei Vergleichen nicht ber"ucksichtigt wird.
+*/
+
+//------------------------------------------------------------------------
+
+class SVL_DLLPUBLIC SfxMiniRecordWriter
+
+/* [Beschreibung]
+
+ Mit Instanzen dieser Klasse kann ein einfacher Record in einen Stream
+ geschrieben werden, der sich durch ein sal_uInt8-Tag identifiziert, sowie
+ seine eigene L"ange speichert und somit auch von "alteren Versionen
+ bzw. Readern, die diesen Record-Type (Tag) nicht kennen, "ubersprungen
+ werden kann. Es wird keine Version-Nummer gespeichert.
+
+ Alternativ kann die Gr"o\se fest angegeben werden oder sie wird
+ automatisch aus der Differenz der Tell()-Angaben vor und nach dem
+ Streamen des Inhalts ermittelt.
+
+ Um Auf- und Abw"artskompatiblit"at gew"ahrleisten zu k"onnen, m"ussen
+ neue Versionen die Daten der "alteren immer komplett enthalten,
+ es d"urfen allenfalls neue Daten hintenan geh"angt werden!
+
+ [Fileformat]
+
+ 1* sal_uInt8 Content-Tag (!= 0)
+ 1* 3-sal_uInt8 OffsetToEndOfRec in Bytes
+ SizeOfContent* sal_uInt8 Content
+
+ [Beispiel]
+
+ {
+ SfxMiniRecordWriter aRecord( pStream, MY_TAG_X );
+ *aRecord << aMember1;
+ *aRecord << aMember2;
+ }
+*/
+
+{
+protected:
+ SvStream* _pStream; // <SvStream>, in dem der Record liegt
+ sal_uInt32 _nStartPos; // Start-Position des Gesamt-Records im Stream
+ bool _bHeaderOk; /* TRUE, wenn der Header schon geschrieben ist; */
+ sal_uInt8 _nPreTag; // in den Header zu schreibendes 'Pre-Tag'
+
+public:
+ inline SfxMiniRecordWriter( SvStream *pStream,
+ sal_uInt8 nTag );
+ inline SfxMiniRecordWriter( SvStream *pStream, sal_uInt8 nTag,
+ sal_uInt32 nSize );
+
+ inline ~SfxMiniRecordWriter();
+
+ inline SvStream& operator*() const;
+
+ inline void Reset();
+
+ sal_uInt32 Close( bool bSeekToEndOfRec = true );
+
+private:
+ // not implementend, not allowed
+ SfxMiniRecordWriter( const SfxMiniRecordWriter& );
+ SfxMiniRecordWriter& operator=(const SfxMiniRecordWriter&);
+};
+
+//------------------------------------------------------------------------
+
+class SVL_DLLPUBLIC SfxMiniRecordReader
+
+/* [Beschreibung]
+
+ Mit Instanzen dieser Klasse kann ein einfacher Record aus einem Stream
+ gelesen werden, der mit der Klasse <SfxRecordWriter> geschrieben wurde.
+
+ Es ist auch m"oglich, den Record zu "uberspringen, ohne sein internes
+ Format zu kennen.
+
+ [Beispiel]
+
+ {
+ SfxMiniRecordReader aRecord( pStream );
+ switch ( aRecord.GetTag() )
+ {
+ case MY_TAG_X:
+ *aRecord >> aMember1;
+ *aRecord >> aMember2;
+ break;
+
+ ...
+ }
+ }
+*/
+
+{
+protected:
+ SvStream* _pStream; // <SvStream>, aus dem gelesen wird
+ sal_uInt32 _nEofRec; // Position direkt hinter dem Record
+ bool _bSkipped; // TRUE: der Record wurde explizit geskippt
+ sal_uInt8 _nPreTag; // aus dem Header gelesenes Pre-Tag
+
+ // Drei-Phasen-Ctor f"ur Subklassen
+ SfxMiniRecordReader() {}
+ void Construct_Impl( SvStream *pStream, sal_uInt8 nTag )
+ {
+ _pStream = pStream;
+ _bSkipped = sal_False;
+ _nPreTag = nTag;
+ }
+ inline bool SetHeader_Impl( sal_uInt32 nHeader );
+
+ // als ung"ultig markieren und zur"uck-seeken
+ void SetInvalid_Impl( sal_uInt32 nRecordStartPos )
+ {
+ _nPreTag = SFX_REC_PRETAG_EOR;
+ _pStream->Seek( nRecordStartPos );
+ }
+
+public:
+ SfxMiniRecordReader( SvStream *pStream, sal_uInt8 nTag );
+ inline ~SfxMiniRecordReader();
+
+ inline sal_uInt8 GetTag() const;
+ inline bool IsValid() const;
+
+ inline SvStream& operator*() const;
+
+ inline void Skip();
+
+private:
+ // not implementend, not allowed
+ SfxMiniRecordReader( const SfxMiniRecordReader& );
+ SfxMiniRecordReader& operator=(const SfxMiniRecordReader&);
+};
+
+//------------------------------------------------------------------------
+
+class SVL_DLLPUBLIC SfxSingleRecordWriter: public SfxMiniRecordWriter
+
+/* [Beschreibung]
+
+ Mit Instanzen dieser Klasse kann ein Record in einen Stream geschrieben
+ werden, dessen einziger Inhalt sich durch ein sal_uInt16-Tag und eine
+ sal_uInt8-Versions-Nummer identifiziert, sowie seine eigene L"ange speichert
+ und somit auch von "alteren Versionen bzw. Readern, die diesen
+ Record-Type (Tag) nicht kennen, "ubersprungen werden kann.
+
+ Alternativ kann die Gr"o\se fest angegeben werden oder sie wird
+ automatisch aus der Differenz der Tell()-Angaben vor und nach dem
+ Streamen des Inhalts ermittelt.
+
+ Um Auf- und Abw"artskompatiblit"at gew"ahrleisten zu k"onnen, m"ussen
+ neue Versionen die Daten der "alteren immer komplett enthalten,
+ es d"urfen allenfalls neue Daten hintenan geh"angt werden!
+
+ [Fileformat]
+
+ 1* sal_uInt8 Pre-Tag (!= 0)
+ 1* 3-sal_uInt8 OffsetToEndOfRec in Bytes
+ 1* sal_uInt8 Record-Type (==SFX_REC_TYPE_SINGLE)
+ 1* sal_uInt8 Content-Version
+ 1* sal_uInt16 Content-Tag
+ SizeOfContent* sal_uInt8 Content
+*/
+
+{
+protected:
+ SfxSingleRecordWriter( sal_uInt8 nRecordType,
+ SvStream *pStream,
+ sal_uInt16 nTag, sal_uInt8 nCurVer );
+
+public:
+ inline void Reset();
+
+ sal_uInt32 Close( bool bSeekToEndOfRec = true );
+};
+
+//------------------------------------------------------------------------
+
+class SVL_DLLPUBLIC SfxSingleRecordReader: public SfxMiniRecordReader
+
+/* [Beschreibung]
+
+ Mit Instanzen dieser Klasse kann ein einfacher Record aus einem Stream
+ gelesen werden, der mit der Klasse <SfxSingleRecordWriter> geschrieben
+ wurde.
+
+ Es ist auch m"oglich, den Record zu "uberspringen, ohne sein internes
+ Format zu kennen.
+*/
+
+{
+protected:
+ sal_uInt16 _nRecordTag; // Art des Gesamt-Inhalts
+ sal_uInt8 _nRecordVer; // Version des Gesamt-Inhalts
+ sal_uInt8 _nRecordType; // Record Type aus dem Header
+
+ // Drei-Phasen-Ctor f"ur Subklassen
+ SfxSingleRecordReader() {}
+ void Construct_Impl( SvStream *pStream )
+ {
+ SfxMiniRecordReader::Construct_Impl(
+ pStream, SFX_REC_PRETAG_EXT );
+ }
+ bool FindHeader_Impl( sal_uInt16 nTypes, sal_uInt16 nTag );
+ bool ReadHeader_Impl( sal_uInt16 nTypes );
+
+public:
+
+ inline sal_uInt16 GetTag() const;
+
+ inline sal_uInt8 GetVersion() const;
+ inline bool HasVersion( sal_uInt16 nVersion ) const;
+};
+
+//------------------------------------------------------------------------
+
+class SVL_DLLPUBLIC SfxMultiFixRecordWriter: public SfxSingleRecordWriter
+
+/* [Beschreibung]
+
+ Mit Instanzen dieser Klasse kann ein Record in einen Stream geschrieben
+ werden, der seine eigene L"ange speichert und somit auch von "alteren
+ Versionen bzw. Readern, die diesen Record-Type (Tag) nicht kennen,
+ "ubersprungen werden kann.
+
+ Er enth"alt mehrere Inhalte von demselben Typ (Tag) und derselben
+ Version, die einmalig (stellvertretend f"ur alle) im Header des Records
+ identifiziert werden. Alle Inhalte haben eine vorher bekannte und
+ identische L"ange.
+
+ Um Auf- und Abw"artskompatiblit"at gew"ahrleisten zu k"onnen, m"ussen
+ neue Versionen die Daten der "alteren immer komplett enthalten,
+ es d"urfen allenfalls neue Daten hinten angeh"angt werden! Hier sind
+ damit selbstverst"andlich nur die Daten der einzelnen Inhalte gemeint,
+ die Anzahl der Inhalte ist selbstverst"andlich variabel und sollte
+ von lesenden Applikationen auch so behandelt werden.
+
+ [Fileformat]
+
+ 1* sal_uInt8 Pre-Tag (==0)
+ 1* 3-sal_uInt8 OffsetToEndOfRec in Bytes
+ 1* sal_uInt8 Record-Type (==SFX_REC_TYPE_FIXSIZE)
+ 1* sal_uInt8 Content-Version
+ 1* sal_uInt16 Content-Tag
+ 1* sal_uInt16 NumberOfContents
+ 1* sal_uInt32 SizeOfEachContent
+ NumberOfContents* (
+ SizeOfEachContent sal_uInt8 Content
+ )
+
+ [Beispiel]
+
+ {
+ SfxMultiFixRecordWriter aRecord( pStream, MY_TAG_X, MY_VERSION );
+ for ( sal_uInt16 n = 0; n < Count(); ++n )
+ {
+ aRecord.NewContent();
+ *aRecord << aMember1[n];
+ *aRecord << aMember2[n];
+ }
+ }
+*/
+
+{
+protected:
+ sal_uInt32 _nContentStartPos; /* Startposition des jeweiligen
+ Contents - nur bei DBG_UTIL
+ und f"ur Subklassen */
+ sal_uInt32 _nContentSize; // Gr"o\se jedes Contents
+ sal_uInt16 _nContentCount; // jeweilige Anzahl der Contents
+
+ SfxMultiFixRecordWriter( sal_uInt8 nRecordType,
+ SvStream *pStream,
+ sal_uInt16 nTag,
+ sal_uInt8 nCurVer );
+
+public:
+ inline ~SfxMultiFixRecordWriter();
+
+ inline void NewContent();
+
+ inline void Reset();
+
+ sal_uInt32 Close( bool bSeekToEndOfRec = true );
+};
+
+//------------------------------------------------------------------------
+
+class SVL_DLLPUBLIC SfxMultiVarRecordWriter: public SfxMultiFixRecordWriter
+
+/* [Beschreibung]
+
+ Mit Instanzen dieser Klasse kann ein Record in einen Stream geschrieben
+ werden, der seine eigene L"ange speichert und somit auch von "alteren
+ Versionen bzw. Readern, die diesen Record-Type (Tag) nicht kennen,
+ "ubersprungen werden kann.
+
+ Er enth"alt mehrere Inhalte von demselben Typ (Tag) und derselben
+ Version, die einmalig (stellvertretend f"ur alle) im Header des Records
+ identifiziert werden. Die L"ange f"ur jeden einzelnen Inhalt wird
+ automatisch berechnet und gespeichert, so da\s auch einzelne Inhalte
+ "ubersprungen werden k"onnen, ohne sie interpretieren zu m"ussen.
+
+ Um Auf- und Abw"artskompatiblit"at gew"ahrleisten zu k"onnen, m"ussen
+ neue Versionen die Daten der "alteren immer komplett enthalten,
+ es d"urfen allenfalls neue Daten hinten angeh"angt werden!
+
+ [Fileformat]
+
+ 1* sal_uInt8 Pre-Tag (==0)
+ 1* 3-sal_uInt8 OffsetToEndOfRec in Bytes
+ 1* sal_uInt8 Record-Type (==SFX_FILETYPE_TYPE_VARSIZE)
+ 1* sal_uInt8 Content-Version
+ 1* sal_uInt16 Content-Tag
+ 1* sal_uInt16 NumberOfContents
+ 1* sal_uInt32 OffsetToOfsTable
+ NumberOfContents* (
+ ContentSize* sal_uInt8 Content
+ )
+ NumberOfContents* sal_uInt32 ContentOfs (je per <<8 verschoben)
+
+ [Beispiel]
+
+ {
+ SfxMultiVarRecordWriter aRecord( pStream, MY_TAG_X, MY_VERSION );
+ for ( sal_uInt16 n = 0; n < Count(); ++n )
+ {
+ aRecord.NewContent();
+ *aRecord << aMember1[n];
+ *aRecord << aMember2[n];
+ }
+ }
+*/
+
+{
+protected:
+ std::vector<sal_uInt32> _aContentOfs;
+ sal_uInt16 _nContentVer; // nur f"ur SfxMultiMixRecordWriter
+
+ SfxMultiVarRecordWriter( sal_uInt8 nRecordType,
+ SvStream *pStream,
+ sal_uInt16 nRecordTag,
+ sal_uInt8 nRecordVer );
+
+ void FlushContent_Impl();
+
+public:
+ SfxMultiVarRecordWriter( SvStream *pStream,
+ sal_uInt16 nRecordTag,
+ sal_uInt8 nRecordVer );
+ virtual ~SfxMultiVarRecordWriter();
+
+ void NewContent();
+
+ virtual sal_uInt32 Close( bool bSeekToEndOfRec = true );
+};
+
+//------------------------------------------------------------------------
+
+class SVL_DLLPUBLIC SfxMultiMixRecordWriter: public SfxMultiVarRecordWriter
+
+/* [Beschreibung]
+
+ Mit Instanzen dieser Klasse kann ein Record in einen Stream geschrieben
+ werden, der seine eigene L"ange speichert und somit auch von "alteren
+ Versionen bzw. Readern, die diesen Record-Type (Tag) nicht kennen,
+ "ubersprungen werden kann.
+
+ Er enth"alt mehrere Inhalte von demselben Typ (Tag) und derselben
+ Version, die einmalig (stellvertretend f"ur alle) im Header des Records
+ identifiziert werden. Alle Inhalte haben eine vorher bekannte und
+ identische L"ange.
+
+ Um Auf- und Abw"artskompatiblit"at gew"ahrleisten zu k"onnen, m"ussen
+ neue Versionen die Daten der "alteren immer komplett enthalten,
+ es d"urfen allenfalls neue Daten hinten angeh"angt werden!
+
+ [Fileformat]
+
+ 1* sal_uInt8 Pre-Tag (==0)
+ 1* 3-sal_uInt8 OffsetToEndOfRec in Bytes
+ 1* sal_uInt8 Record-Type (==SFX_REC_TYPE_MIXTAGS)
+ 1* sal_uInt8 Content-Version
+ 1* sal_uInt16 Record-Tag
+ 1* sal_uInt16 NumberOfContents
+ 1* sal_uInt32 OffsetToOfsTable
+ NumberOfContents* (
+ 1* sal_uInt16 Content-Tag
+ ContentSize* sal_uInt8 Content
+ )
+ NumberOfContents* sal_uInt32 ( ContentOfs << 8 + Version )
+*/
+
+{
+public:
+ inline SfxMultiMixRecordWriter( SvStream *pStream,
+ sal_uInt16 nRecordTag,
+ sal_uInt8 nRecordVer );
+
+ void NewContent( sal_uInt16 nTag, sal_uInt8 nVersion );
+
+// private: geht nicht, da einige Compiler dann auch vorherige privat machen
+ void NewContent()
+ { OSL_FAIL( "NewContent() only allowed with args" ); }
+};
+
+//------------------------------------------------------------------------
+
+class SVL_DLLPUBLIC SfxMultiRecordReader: public SfxSingleRecordReader
+
+/* [Beschreibung]
+
+ Mit Instanzen dieser Klasse kann ein aus mehreren Contents bestehender
+ Record aus einem Stream gelesen werden, der mit einer der Klassen
+ <SfxMultiFixRecordWriter>, <SfxMultiVarRecordWriter> oder
+ <SfxMultiMixRecordWriter> geschrieben wurde.
+
+ Es ist auch m"oglich, den Record oder einzelne Contents zu "uberspringen,
+ ohne das jeweilis interne Format zu kennen.
+
+ [Beispiel]
+
+ {
+ SfxMultiRecordReader aRecord( pStream );
+ for ( sal_uInt16 nRecNo = 0; aRecord.GetContent(); ++nRecNo )
+ {
+ switch ( aRecord.GetTag() )
+ {
+ case MY_TAG_X:
+ X *pObj = new X;
+ *aRecord >> pObj.>aMember1;
+ if ( aRecord.HasVersion(2) )
+ *aRecord >> pObj->aMember2;
+ Append( pObj );
+ break;
+
+ ...
+ }
+ }
+ }
+*/
+
+{
+ sal_uInt32 _nStartPos; // Start-Position des Records
+ sal_uInt32* _pContentOfs; // Offsets der Startpositionen
+ sal_uInt32 _nContentSize; // Size jedes einzelnen / Tabellen-Pos
+ sal_uInt16 _nContentCount; // Anzahl der Contents im Record
+ sal_uInt16 _nContentNo; /* der Index des aktuellen Contents
+ enth"alt jeweils den Index des
+ Contents, der beim n"achsten
+ GetContent() geholt wird */
+ sal_uInt16 _nContentTag; // Art-Kennung des aktuellen Contents
+ sal_uInt8 _nContentVer; // Versions-Kennung des akt. Contents
+
+ bool ReadHeader_Impl();
+
+public:
+ SfxMultiRecordReader( SvStream *pStream, sal_uInt16 nTag );
+ ~SfxMultiRecordReader();
+
+ bool GetContent();
+ inline sal_uInt16 GetContentTag();
+ inline sal_uInt8 GetContentVersion() const;
+ inline bool HasContentVersion( sal_uInt16 nVersion ) const;
+
+ inline sal_uInt32 ContentCount() const;
+};
+
+//=========================================================================
+
+inline SfxMiniRecordWriter::SfxMiniRecordWriter
+(
+ SvStream* pStream, // Stream, in dem der Record angelegt wird
+ sal_uInt8 nTag // Record-Tag zwischen 0x01 und 0xFE
+)
+
+/* [Beschreibung]
+
+ Legt in 'pStream' einen 'SfxMiniRecord' an, dessen Content-Gr"o\se
+ nicht bekannt ist, sondern nach dam Streamen des Contents errechnet
+ werden soll.
+*/
+
+: _pStream( pStream ),
+ _nStartPos( pStream->Tell() ),
+ _bHeaderOk(false),
+ _nPreTag( nTag )
+{
+ DBG_ASSERT( _nPreTag != 0xFF, "invalid Tag" );
+ DBG( DbgOutf( "SfxFileRec: writing record to %ul", pStream->Tell() ) );
+
+ pStream->SeekRel( + SFX_REC_HEADERSIZE_MINI );
+}
+
+//-------------------------------------------------------------------------
+
+inline SfxMiniRecordWriter::SfxMiniRecordWriter
+(
+ SvStream* pStream, // Stream, in dem der Record angelegt wird
+ sal_uInt8 nTag, // Record-Tag zwischen 0x01 und 0xFE
+ sal_uInt32 nSize // Gr"o\se der Daten in Bytes
+)
+
+/* [Beschreibung]
+
+ Legt in 'pStream' einen 'SfxMiniRecord' an, dessen Content-Gr"o\se
+ von vornherein bekannt ist.
+*/
+
+: _pStream( pStream ),
+ // _nTag( uninitialized ),
+ // _nStarPos( uninitialized ),
+ _bHeaderOk(true)
+{
+ DBG_ASSERT( nTag != 0 && nTag != 0xFF, "invalid Tag" );
+ DBG(_nStartPos = pStream->Tell());
+ DBG( DbgOutf( "SfxFileRec: writing record to %ul", _nStartPos ) );
+
+ *pStream << ( ( nTag << 24 ) | nSize );
+}
+
+//-------------------------------------------------------------------------
+
+inline SfxMiniRecordWriter::~SfxMiniRecordWriter()
+
+/* [Beschreibung]
+
+ Der Dtor der Klasse <SfxMiniRecordWriter> schlie\st den Record
+ automatisch, falls <SfxMiniRecordWriter::Close()> nicht bereits
+ explizit gerufen wurde.
+*/
+
+{
+ // wurde der Header noch nicht geschrieben oder mu\s er gepr"uft werden
+ if ( !_bHeaderOk )
+ Close();
+}
+
+//-------------------------------------------------------------------------
+
+inline SvStream& SfxMiniRecordWriter::operator*() const
+
+/* [Beschreibung]
+
+ Dieser Operator liefert den Stream, in dem der Record liegt.
+ Der Record darf noch nicht geschlossen worden sein.
+*/
+
+{
+ DBG_ASSERT( !_bHeaderOk, "getting Stream of closed record" );
+ return *_pStream;
+}
+
+//-------------------------------------------------------------------------
+
+inline void SfxMiniRecordWriter::Reset()
+{
+ _pStream->Seek( _nStartPos + SFX_REC_HEADERSIZE_MINI );
+ _bHeaderOk = false;
+}
+
+//=========================================================================
+
+inline SfxMiniRecordReader::~SfxMiniRecordReader()
+
+/* [Beschreibung]
+
+ Der Dtor der Klasse <SfxMiniRecordReader> positioniert den Stream
+ automatisch auf die Position direkt hinter dem Record, falls nicht
+ <SfxMiniRecordReader::Skip()> bereits explizit gerufen wurde.
+*/
+
+{
+ // noch nicht explizit ans Ende gesprungen?
+ if ( !_bSkipped )
+ Skip();
+}
+
+//-------------------------------------------------------------------------
+
+inline void SfxMiniRecordReader::Skip()
+
+/* [Beschreibung]
+
+ Mit dieser Methode wird der Stream direkt hinter das Ende des Records
+ positioniert.
+*/
+
+{
+ _pStream->Seek(_nEofRec);
+ _bSkipped = sal_True;
+}
+
+//-------------------------------------------------------------------------
+
+inline sal_uInt8 SfxMiniRecordReader::GetTag() const
+
+/* [Beschreibung]
+
+ Liefert des aus dem Header gelesene Pre-Tag des Records. Dieses kann
+ auch SFX_REC_PRETAG_EXT oder SFX_REC_PRETAG_EOR sein, im
+ letzteren Fall ist am Stream der Fehlercode ERRCODE_IO_WRONGFORMAT
+ gesetzt. SFX_REC_PRETAG_EXT ist g"ultig, da diese extended-Records
+ nur eine Erweiterung des SfxMiniRecord darstellen.
+*/
+
+{
+ return _nPreTag;
+}
+
+//-------------------------------------------------------------------------
+
+inline bool SfxMiniRecordReader::IsValid() const
+
+/* [Beschreibung]
+
+ Hiermit kann abgefragt werden, ob der Record erfolgreich aus dem
+ Stream konstruiert werden konnte, der Header also f"ur diesen Record-Typ
+ passend war.
+*/
+
+{
+ return _nPreTag != SFX_REC_PRETAG_EOR;
+}
+
+//-------------------------------------------------------------------------
+
+inline SvStream& SfxMiniRecordReader::operator*() const
+
+/* [Beschreibung]
+
+ Dieser Operator liefert den Stream in dem der Record liegt.
+ Die aktuelle Position des Streams mu\s innerhalb des Records liegen.
+*/
+
+{
+ DBG_ASSERT( _pStream->Tell() < _nEofRec, "read behind record" );
+ return *_pStream;
+}
+
+//=========================================================================
+
+inline sal_uInt32 SfxSingleRecordWriter::Close( bool bSeekToEndOfRec )
+
+// siehe <SfxMiniRecordWriter::Close(bool)>
+
+{
+ sal_uInt32 nRet = 0;
+
+ // wurde der Header noch nicht geschrieben?
+ if ( !_bHeaderOk )
+ {
+ // Basisklassen-Header schreiben
+ sal_uInt32 nEndPos = SfxMiniRecordWriter::Close( bSeekToEndOfRec );
+
+ // ggf. ans Ende des eigenen Headers seeken oder hinter Rec bleiben
+ if ( !bSeekToEndOfRec )
+ _pStream->SeekRel( SFX_REC_HEADERSIZE_SINGLE );
+ nRet = nEndPos;
+ }
+#ifdef DBG_UTIL
+ else
+ // Basisklassen-Header pr"ufen
+ SfxMiniRecordWriter::Close( bSeekToEndOfRec );
+#endif
+
+ // Record war bereits geschlossen
+// nRet = 0;
+ return nRet;
+}
+
+//-------------------------------------------------------------------------
+
+inline void SfxSingleRecordWriter::Reset()
+{
+ _pStream->Seek( _nStartPos + SFX_REC_HEADERSIZE_MINI +
+ SFX_REC_HEADERSIZE_SINGLE );
+ _bHeaderOk = false;
+}
+
+//=========================================================================
+
+inline sal_uInt16 SfxSingleRecordReader::GetTag() const
+
+/* [Beschreibung]
+
+ Liefert des aus dem Header gelesene Tag f"ur den Gesamt-Record.
+*/
+
+{
+ return _nRecordTag;
+}
+
+//-------------------------------------------------------------------------
+
+inline sal_uInt8 SfxSingleRecordReader::GetVersion() const
+
+/* [Beschreibung]
+
+ Liefert die Version des aus dem Stream gelesenen Records.
+*/
+
+{
+ return _nRecordVer;
+}
+
+//-------------------------------------------------------------------------
+
+inline bool SfxSingleRecordReader::HasVersion( sal_uInt16 nVersion ) const
+
+/* [Beschreibung]
+
+ Stellt fest, ob der aus dem Stream gelese Record in der Version
+ 'nVersion' oder h"oher vorliegt.
+*/
+
+{
+ return _nRecordVer >= nVersion;
+}
+
+//=========================================================================
+
+inline SfxMultiFixRecordWriter::~SfxMultiFixRecordWriter()
+
+/* [Beschreibung]
+
+ Der Dtor der Klasse <SfxMultiFixRecordWriter> schlie\st den Record
+ automatisch, falls <SfxMutiFixRecordWriter::Close()> nicht bereits
+ explizit gerufen wurde.
+*/
+
+{
+ // wurde der Header noch nicht geschrieben oder mu\s er gepr"uft werden
+ if ( !_bHeaderOk )
+ Close();
+}
+
+//-------------------------------------------------------------------------
+
+inline void SfxMultiFixRecordWriter::NewContent()
+
+/* [Beschreibung]
+
+ Mit dieser Methode wird in den Record ein neuer Content eingef"ugt.
+ Jeder, auch der 1. Record mu\s durch Aufruf dieser Methode eingeleitet
+ werden.
+*/
+
+{
+ #ifdef DBG_UTIL
+ sal_uLong nOldStartPos;
+ // Startposition des aktuellen Contents merken - Achtung Subklassen!
+ nOldStartPos = _nContentStartPos;
+ #endif
+ _nContentStartPos = _pStream->Tell();
+
+#ifdef DBG_UTIL
+ // ist ein vorhergehender Content vorhanden?
+ if ( _nContentCount )
+ {
+ // pr"ufen, ob der vorhergehende die Soll-Gr"o\se eingehalten hat
+ DBG_ASSERT( _nContentStartPos - nOldStartPos == _nContentSize,
+ "wrong content size detected" );
+ }
+#endif
+
+ // Anzahl mitz"ahlen
+ ++_nContentCount;
+}
+
+//=========================================================================
+
+inline SfxMultiMixRecordWriter::SfxMultiMixRecordWriter
+(
+ SvStream* pStream, // Stream, in dem der Record angelegt wird
+ sal_uInt16 nRecordTag, // Gesamt-Record-Art-Kennung
+ sal_uInt8 nRecordVer // Gesamt-Record-Versions-Kennung
+)
+
+/* [Beschreibung]
+
+ Legt in 'pStream' einen 'SfxMultiMixRecord' an, f"ur dessen Contents
+ je eine separate Kennung f"ur Art (Tag) und Version gespeichert wird.
+ Die Gr"o\sen der einzelnen Contents werden automatisch ermittelt.
+*/
+
+: SfxMultiVarRecordWriter( SFX_REC_TYPE_MIXTAGS,
+ pStream, nRecordTag, nRecordVer )
+{
+}
+
+//=========================================================================
+
+inline void SfxMultiFixRecordWriter::Reset()
+{
+ _pStream->Seek( _nStartPos + SFX_REC_HEADERSIZE_MINI +
+ SFX_REC_HEADERSIZE_SINGLE +
+ SFX_REC_HEADERSIZE_MULTI );
+ _bHeaderOk = false;
+}
+
+//=========================================================================
+
+inline sal_uInt16 SfxMultiRecordReader::GetContentTag()
+
+/* [Beschreibung]
+
+ Diese Methode liefert die Art-Kennung des zuletzt mit der Methode
+ <SfxMultiRecordReder::GetContent()> ge"offneten Contents.
+*/
+
+{
+ return _nContentTag;
+}
+
+//-------------------------------------------------------------------------
+
+inline sal_uInt8 SfxMultiRecordReader::GetContentVersion() const
+
+/* [Beschreibung]
+
+ Diese Methode liefert die Version-Kennung des zuletzt mit der Methode
+ <SfxMultiRecordReder::GetContent()> ge"offneten Contents.
+*/
+
+{
+ return _nContentVer;
+}
+
+//-------------------------------------------------------------------------
+
+inline bool SfxMultiRecordReader::HasContentVersion( sal_uInt16 nVersion ) const
+
+/* [Beschreibung]
+
+ Diese Methode stellt fest, ob die Version 'nVersion' in der Version des
+ zuletzt mit der Methode <SfxMultiRecordReder::GetContent()> ge"offneten
+ Contents enthalten ist.
+*/
+
+{
+ return _nContentVer >= nVersion;
+}
+
+//-------------------------------------------------------------------------
+
+inline sal_uInt32 SfxMultiRecordReader::ContentCount() const
+
+/* [Beschreibung]
+
+ Diese Methode liefert die Anzahl im Record befindlichen Contents.
+*/
+
+{
+ return _nContentCount;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/flagitem.hxx b/include/svl/flagitem.hxx
new file mode 100644
index 000000000000..6b0c88ef8f7e
--- /dev/null
+++ b/include/svl/flagitem.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXFLAGITEM_HXX
+#define _SFXFLAGITEM_HXX
+
+#include "svl/svldllapi.h"
+#include <tools/solar.h>
+#include <tools/rtti.hxx>
+#include <svl/poolitem.hxx>
+
+class SvStream;
+
+// -----------------------------------------------------------------------
+
+DBG_NAMEEX_VISIBILITY(SfxFlagItem, SVL_DLLPUBLIC)
+
+class SVL_DLLPUBLIC SfxFlagItem: public SfxPoolItem
+{
+ sal_uInt16 nVal;
+
+public:
+ TYPEINFO();
+
+ explicit SfxFlagItem( sal_uInt16 nWhich = 0, sal_uInt16 nValue = 0 );
+ SfxFlagItem( const SfxFlagItem& );
+
+ ~SfxFlagItem() {
+ DBG_DTOR(SfxFlagItem, 0); }
+
+ virtual sal_uInt8 GetFlagCount() const;
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16 nVersion) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString & rText,
+ const IntlWrapper * = 0 ) const;
+ sal_uInt16 GetValue() const { return nVal; }
+ void SetValue( sal_uInt16 nNewVal ) {
+ DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
+ nVal = nNewVal;
+ }
+ bool GetFlag( sal_uInt8 nFlag ) const { return ( (nVal & ( 1<<nFlag))); }
+ void SetFlag( sal_uInt8 nFlag, bool bVal ) { if(bVal) { nVal |= (1<<nFlag); } else { nVal &= ~(1<<nFlag);};}
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/folderrestriction.hxx b/include/svl/folderrestriction.hxx
new file mode 100644
index 000000000000..4ddb9d4be7bc
--- /dev/null
+++ b/include/svl/folderrestriction.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVTOOLS_FOLDER_RESTRICTION_HXX
+#define SVTOOLS_FOLDER_RESTRICTION_HXX
+
+#include "svl/svldllapi.h"
+#include <tools/string.hxx>
+
+#include <vector>
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ /** retrieves a list of folders which's access is not restricted.
+
+ <p>Note that this is not meant as security feature, but only as
+ method to restrict some UI presentation, such as browsing
+ in the file open dialog.</p>
+ */
+ SVL_DLLPUBLIC void getUnrestrictedFolders( ::std::vector< String >& _rFolders );
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // SVTOOLS_FOLDER_RESTRICTION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/fstathelper.hxx b/include/svl/fstathelper.hxx
new file mode 100644
index 000000000000..9e69c6ed28ec
--- /dev/null
+++ b/include/svl/fstathelper.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVTOOLS_FSTATHELPER_HXX
+#define _SVTOOLS_FSTATHELPER_HXX
+
+#include "svl/svldllapi.h"
+#include <rtl/ustring.hxx>
+#include <tools/solar.h>
+
+class Date;
+class Time;
+
+namespace FStatHelper {
+
+/** Return the modified time and date stamp for this URL.
+
+ @param URL the asking URL
+
+ @param pDate if unequal 0, the function set the date stamp
+
+ @param pTime if unequal 0, the function set the time stamp
+
+ @return it was be able to get the date/time stamp
+*/
+SVL_DLLPUBLIC sal_Bool GetModifiedDateTimeOfFile( const OUString& rURL,
+ Date* pDate, Time* pTime );
+
+/** Return if under the URL a document exist. This is only a wrapper for the
+ UCB.IsContent.
+*/
+SVL_DLLPUBLIC sal_Bool IsDocument( const OUString& rURL );
+
+/** Return if under the URL a folder exist. This is only a wrapper for the
+ UCB.isFolder.
+*/
+SVL_DLLPUBLIC sal_Bool IsFolder( const OUString& rURL );
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/globalnameitem.hxx b/include/svl/globalnameitem.hxx
new file mode 100644
index 000000000000..618791bebb92
--- /dev/null
+++ b/include/svl/globalnameitem.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _GLOBALNAMEITEM_HXX
+#define _GLOBALNAMEITEM_HXX
+
+#include "svl/svldllapi.h"
+#include <tools/solar.h>
+#include <tools/rtti.hxx>
+#include <tools/globname.hxx>
+#include <svl/poolitem.hxx>
+
+// -----------------------------------------------------------------------
+
+class SVL_DLLPUBLIC SfxGlobalNameItem: public SfxPoolItem
+{
+ SvGlobalName m_aName;
+
+public:
+ TYPEINFO();
+ SfxGlobalNameItem();
+ SfxGlobalNameItem( sal_uInt16 nWhich, const SvGlobalName& );
+ ~SfxGlobalNameItem();
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ SvGlobalName GetValue() const { return m_aName; }
+
+ virtual bool PutValue ( const com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 );
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 ) const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx
new file mode 100644
index 000000000000..8f5356ac9a13
--- /dev/null
+++ b/include/svl/hint.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXHINT_HXX
+#define _SFXHINT_HXX
+
+#include "svl/svldllapi.h"
+#include <tools/rtti.hxx>
+
+class SVL_DLLPUBLIC SfxHint
+{
+public:
+ TYPEINFO();
+
+ virtual ~SfxHint();
+};
+
+//--------------------------------------------------------------------
+
+#define DECL_PTRHINT(Visibility, Name, Type) \
+ class Visibility Name: public SfxHint \
+ { \
+ Type* pObj; \
+ bool bIsOwner; \
+ \
+ public: \
+ TYPEINFO(); \
+ explicit Name( Type* Object, bool bOwnedByHint = false ); \
+ ~Name(); \
+ \
+ Type* GetObject() const { return pObj; } \
+ bool IsOwner() const { return bIsOwner; } \
+ }
+
+#define IMPL_PTRHINT(Name, Type) \
+ TYPEINIT1(Name, SfxHint); \
+ Name::Name( Type* pObject, bool bOwnedByHint ) \
+ { pObj = pObject; bIsOwner = bOwnedByHint; } \
+ Name::~Name() {}
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/ilstitem.hxx b/include/svl/ilstitem.hxx
new file mode 100644
index 000000000000..6c04ff239c74
--- /dev/null
+++ b/include/svl/ilstitem.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SFXILSTITEM_HXX
+#define _SFXILSTITEM_HXX
+
+#include "svl/svldllapi.h"
+#include <svl/poolitem.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <vector>
+
+class SVL_DLLPUBLIC SfxIntegerListItem : public SfxPoolItem
+{
+ ::com::sun::star::uno::Sequence < sal_Int32 > m_aList;
+
+public:
+ TYPEINFO();
+
+ SfxIntegerListItem();
+ SfxIntegerListItem( sal_uInt16 nWhich, const ::std::vector < sal_Int32 >& rList );
+ SfxIntegerListItem( sal_uInt16 nWhich, const ::com::sun::star::uno::Sequence < sal_Int32 >& rList );
+ SfxIntegerListItem( const SfxIntegerListItem& rItem );
+ ~SfxIntegerListItem();
+
+ ::com::sun::star::uno::Sequence < sal_Int32 > GetSequence()
+ { return m_aList; }
+ ::com::sun::star::uno::Sequence < sal_Int32 > GetConstSequence() const
+ { return (const_cast< SfxIntegerListItem * >(this))->GetSequence(); }
+
+ void GetList( ::std::vector < sal_Int32 >& rList ) const;
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual bool PutValue ( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+};
+
+#endif // _SFXINTITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/imageitm.hxx b/include/svl/imageitm.hxx
new file mode 100644
index 000000000000..0a2e26f80086
--- /dev/null
+++ b/include/svl/imageitm.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVT_IMAGEITM_HXX
+#define _SVT_IMAGEITM_HXX
+
+#include "svl/svldllapi.h"
+#include <svl/intitem.hxx>
+
+class String;
+
+struct SfxImageItem_Impl;
+class SVL_DLLPUBLIC SfxImageItem : public SfxInt16Item
+{
+ SfxImageItem_Impl* pImp;
+public:
+ TYPEINFO();
+ SfxImageItem( sal_uInt16 nWhich = 0, sal_uInt16 nImage = 0 );
+ SfxImageItem( const SfxImageItem& );
+ virtual ~SfxImageItem();
+
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ void SetRotation( long nValue );
+ long GetRotation() const;
+ void SetMirrored( bool bSet );
+ bool IsMirrored() const;
+};
+
+#endif // _SFX_IMAGEITM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/inethist.hxx b/include/svl/inethist.hxx
new file mode 100644
index 000000000000..4ee592faad16
--- /dev/null
+++ b/include/svl/inethist.hxx
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _INETHIST_HXX
+#define _INETHIST_HXX
+
+#include "svl/svldllapi.h"
+#include <tools/solar.h>
+#include <tools/string.hxx>
+#include <tools/urlobj.hxx>
+#include <svl/brdcst.hxx>
+#include <svl/hint.hxx>
+
+/*========================================================================
+ *
+ * INetURLHistory interface.
+ *
+ *=======================================================================*/
+class INetURLHistory_Impl;
+class INetURLHistory : public SfxBroadcaster
+{
+ struct StaticInstance
+ {
+ INetURLHistory * operator()();
+ };
+ friend INetURLHistory * StaticInstance::operator()();
+
+ /** Representation.
+ */
+ INetURLHistory_Impl *m_pImpl;
+
+ /** Construction/Destruction.
+ */
+ INetURLHistory (void);
+ virtual ~INetURLHistory (void);
+
+ /** Implementation.
+ */
+ static void NormalizeUrl_Impl (INetURLObject &rUrl);
+
+ SVL_DLLPUBLIC void PutUrl_Impl (const INetURLObject &rUrl);
+ SVL_DLLPUBLIC sal_Bool QueryUrl_Impl (const INetURLObject &rUrl);
+
+ /** Not implemented.
+ */
+ INetURLHistory (const INetURLHistory&);
+ INetURLHistory& operator= (const INetURLHistory&);
+
+public:
+ /** GetOrCreate.
+ */
+ SVL_DLLPUBLIC static INetURLHistory* GetOrCreate (void);
+
+ /** QueryProtocol.
+ */
+ sal_Bool QueryProtocol (INetProtocol eProto) const
+ {
+ return ((eProto == INET_PROT_FILE ) ||
+ (eProto == INET_PROT_FTP ) ||
+ (eProto == INET_PROT_HTTP ) ||
+ (eProto == INET_PROT_HTTPS) );
+ }
+
+ /** QueryUrl.
+ */
+ sal_Bool QueryUrl (const INetURLObject &rUrl)
+ {
+ if (QueryProtocol (rUrl.GetProtocol()))
+ return QueryUrl_Impl (rUrl);
+ else
+ return sal_False;
+ }
+
+ sal_Bool QueryUrl (const String &rUrl)
+ {
+ INetProtocol eProto =
+ INetURLObject::CompareProtocolScheme (rUrl);
+ if (QueryProtocol (eProto))
+ return QueryUrl_Impl (INetURLObject (rUrl));
+ else
+ return sal_False;
+ }
+
+ /** PutUrl.
+ */
+ void PutUrl (const INetURLObject &rUrl)
+ {
+ if (QueryProtocol (rUrl.GetProtocol()))
+ PutUrl_Impl (rUrl);
+ }
+
+ void PutUrl (const String &rUrl)
+ {
+ INetProtocol eProto =
+ INetURLObject::CompareProtocolScheme (rUrl);
+ if (QueryProtocol (eProto))
+ PutUrl_Impl (INetURLObject (rUrl));
+ }
+};
+
+/*========================================================================
+ *
+ * INetURLHistoryHint (broadcasted from PutUrl()).
+ *
+ *=======================================================================*/
+DECL_PTRHINT (SVL_DLLPUBLIC, INetURLHistoryHint, const INetURLObject);
+
+#endif /* _INETHIST_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/inettype.hxx b/include/svl/inettype.hxx
new file mode 100644
index 000000000000..48fca19aa5d6
--- /dev/null
+++ b/include/svl/inettype.hxx
@@ -0,0 +1,304 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _INETTYPE_HXX
+#define _INETTYPE_HXX
+
+#include "svl/svldllapi.h"
+#include <tools/inetmime.hxx>
+#include <i18nlangtag/languagetag.hxx>
+
+//============================================================================
+/** Definitions for frequently used media type names.
+ */
+#define CONTENT_TYPE_STR_APP_OCTSTREAM "application/octet-stream"
+#define CONTENT_TYPE_STR_APP_PDF "application/pdf"
+#define CONTENT_TYPE_STR_APP_RTF "application/rtf"
+#define CONTENT_TYPE_STR_APP_VND_CALC "application/vnd.stardivision.calc"
+#define CONTENT_TYPE_STR_APP_VND_CHART "application/vnd.stardivision.chart"
+#define CONTENT_TYPE_STR_APP_VND_DRAW "application/vnd.stardivision.draw"
+#define CONTENT_TYPE_STR_APP_VND_IMAGE "application/vnd.stardivision.image"
+#define CONTENT_TYPE_STR_APP_VND_IMPRESSPACKED "application/vnd.stardivision.impress-packed"
+#define CONTENT_TYPE_STR_APP_VND_IMPRESS "application/vnd.stardivision.impress"
+#define CONTENT_TYPE_STR_APP_VND_MAIL "application/vnd.stardivision.mail"
+#define CONTENT_TYPE_STR_APP_VND_MATH "application/vnd.stardivision.math"
+#define CONTENT_TYPE_STR_APP_VND_NEWS "application/vnd.stardivision.news"
+#define CONTENT_TYPE_STR_APP_VND_OUTTRAY "application/vnd.stardivision.outtray"
+#define CONTENT_TYPE_STR_APP_VND_TEMPLATE "application/vnd.stardivision.template"
+#define CONTENT_TYPE_STR_APP_VND_WRITER_GLOBAL "application/vnd.stardivision.writer-global"
+#define CONTENT_TYPE_STR_APP_VND_WRITER_WEB "application/vnd.stardivision.writer-web"
+#define CONTENT_TYPE_STR_APP_VND_WRITER "application/vnd.stardivision.writer"
+#define CONTENT_TYPE_STR_APP_FRAMESET "application/x-frameset"
+#define CONTENT_TYPE_STR_APP_GALLERY_THEME "application/x-gallery-theme"
+#define CONTENT_TYPE_STR_APP_GALLERY "application/x-gallery"
+#define CONTENT_TYPE_STR_APP_JAR "application/x-jar"
+#define CONTENT_TYPE_STR_APP_MACRO "application/x-macro"
+#define CONTENT_TYPE_STR_APP_MSEXCEL_TEMPL "application/x-msexcel-template"
+#define CONTENT_TYPE_STR_APP_MSEXCEL "application/x-msexcel"
+#define CONTENT_TYPE_STR_APP_MSPPOINT_TEMPL "application/x-mspowerpoint-template"
+#define CONTENT_TYPE_STR_APP_MSPPOINT "application/x-mspowerpoint"
+#define CONTENT_TYPE_STR_APP_MSWORD_TEMPL "application/x-msword-template"
+#define CONTENT_TYPE_STR_APP_MSWORD "application/x-msword"
+#define CONTENT_TYPE_STR_APP_SCHEDULE_EVT "application/x-schedule-event"
+#define CONTENT_TYPE_STR_APP_SCHEDULE_FEVT "application/x-schedule-form-event"
+#define CONTENT_TYPE_STR_APP_SCHEDULE_FTASK "application/x-schedule-form-task"
+#define CONTENT_TYPE_STR_APP_SCHEDULE_TASK "application/x-schedule-task"
+#define CONTENT_TYPE_STR_APP_SCHEDULE_CMB "application/x-schedule"
+#define CONTENT_TYPE_STR_APP_STARCALC "application/x-starcalc"
+#define CONTENT_TYPE_STR_APP_STARCHART "application/x-starchart"
+#define CONTENT_TYPE_STR_APP_STARDRAW "application/x-stardraw"
+#define CONTENT_TYPE_STR_APP_STARHELP "application/x-starhelp"
+#define CONTENT_TYPE_STR_APP_STARIMAGE "application/x-starimage"
+#define CONTENT_TYPE_STR_APP_STARIMPRESS "application/x-starimpress"
+#define CONTENT_TYPE_STR_APP_STARMAIL_SDM "application/x-starmail-sdm"
+#define CONTENT_TYPE_STR_APP_STARMAIL_SMD "application/x-starmail-smd"
+#define CONTENT_TYPE_STR_APP_STARMATH "application/x-starmath"
+#define CONTENT_TYPE_STR_APP_STARWRITER_GLOB "application/x-starwriter-global"
+#define CONTENT_TYPE_STR_APP_STARWRITER "application/x-starwriter"
+#define CONTENT_TYPE_STR_APP_CDE_CALENDAR_APP "application/x-sun-ae-file"
+#define CONTENT_TYPE_STR_APP_ZIP "application/x-zip-compressed"
+#define CONTENT_TYPE_STR_AUDIO_AIFF "audio/aiff"
+#define CONTENT_TYPE_STR_AUDIO_BASIC "audio/basic"
+#define CONTENT_TYPE_STR_AUDIO_MIDI "audio/midi"
+#define CONTENT_TYPE_STR_AUDIO_VORBIS "audio/vorbis"
+#define CONTENT_TYPE_STR_AUDIO_WAV "audio/wav"
+#define CONTENT_TYPE_STR_AUDIO_WEBM "audio/webm"
+#define CONTENT_TYPE_STR_X_CNT_FSYSBOX ".chaos/fsys-box"
+#define CONTENT_TYPE_STR_X_CNT_FSYSFOLDER ".chaos/fsys-folder"
+#define CONTENT_TYPE_STR_X_CNT_FSYSSPECIALFOLDER ".chaos/fsys-special-folder"
+#define CONTENT_TYPE_STR_IMAGE_GENERIC "image/generic"
+#define CONTENT_TYPE_STR_IMAGE_GIF "image/gif"
+#define CONTENT_TYPE_STR_IMAGE_JPEG "image/jpeg"
+#define CONTENT_TYPE_STR_IMAGE_PCX "image/pcx"
+#define CONTENT_TYPE_STR_IMAGE_PNG "image/png"
+#define CONTENT_TYPE_STR_IMAGE_TIFF "image/tiff"
+#define CONTENT_TYPE_STR_IMAGE_BMP "image/x-MS-bmp"
+#define CONTENT_TYPE_STR_INET_MSG_RFC822 "message/rfc822"
+#define CONTENT_TYPE_STR_INET_MULTI_ALTERNATIVE "multipart/alternative"
+#define CONTENT_TYPE_STR_INET_MULTI_DIGEST "multipart/digest"
+#define CONTENT_TYPE_STR_INET_MULTI_MIXED "multipart/mixed"
+#define CONTENT_TYPE_STR_INET_MULTI_PARALLEL "multipart/parallel"
+#define CONTENT_TYPE_STR_INET_MULTI_RELATED "multipart/related"
+#define CONTENT_TYPE_STR_TEXT_ICALENDAR "text/calendar"
+#define CONTENT_TYPE_STR_TEXT_HTML "text/html"
+#define CONTENT_TYPE_STR_TEXT_PLAIN "text/plain"
+#define CONTENT_TYPE_STR_TEXT_XMLICALENDAR "text/x-icalxml"
+#define CONTENT_TYPE_STR_TEXT_URL "text/x-url"
+#define CONTENT_TYPE_STR_TEXT_VCALENDAR "text/x-vCalendar"
+#define CONTENT_TYPE_STR_TEXT_VCARD "text/x-vCard"
+#define CONTENT_TYPE_STR_VIDEO_MSVIDEO "video/x-msvideo"
+#define CONTENT_TYPE_STR_VIDEO_THEORA "video/theora"
+#define CONTENT_TYPE_STR_VIDEO_VDO "video/vdo"
+#define CONTENT_TYPE_STR_VIDEO_WEBM "audio/webm"
+#define CONTENT_TYPE_STR_X_STARMAIL "x-starmail"
+#define CONTENT_TYPE_STR_X_VRML "x-world/x-vrml"
+#define CONTENT_TYPE_STR_APP_VND_SUN_XML_WRITER "application/vnd.sun.xml.writer"
+#define CONTENT_TYPE_STR_APP_VND_SUN_XML_CALC "application/vnd.sun.xml.calc"
+#define CONTENT_TYPE_STR_APP_VND_SUN_XML_IMPRESS "application/vnd.sun.xml.impress"
+#define CONTENT_TYPE_STR_APP_VND_SUN_XML_DRAW "application/vnd.sun.xml.draw"
+#define CONTENT_TYPE_STR_APP_VND_SUN_XML_CHART "application/vnd.sun.xml.chart"
+#define CONTENT_TYPE_STR_APP_VND_SUN_XML_MATH "application/vnd.sun.xml.math"
+#define CONTENT_TYPE_STR_APP_VND_SUN_XML_WRITER_GLOBAL "application/vnd.sun.xml.writer-global"
+#define CONTENT_TYPE_STR_APP_VND_SUN_XML_IMPRESSPACKED "application/vnd.sun.xml.impress-packed"
+
+//============================================================================
+/** Definitions for matching parts of URIs.
+ */
+#define INETTYPE_URL_PROT_COMPONENT ".component"
+#define INETTYPE_URL_PROT_DATA "data"
+#define INETTYPE_URL_PROT_FILE "file"
+#define INETTYPE_URL_PROT_HTTP "http"
+#define INETTYPE_URL_PROT_HTTPS "https"
+#define INETTYPE_URL_PROT_MACRO "macro"
+#define INETTYPE_URL_PROT_MAILTO "mailto"
+#define INETTYPE_URL_PROT_PRIVATE "private"
+
+#define INETTYPE_URL_SUB_FACTORY "factory"
+#define INETTYPE_URL_SUB_HELPID "helpid"
+
+#define INETTYPE_URL_SSUB_FRAMESET "frameset"
+#define INETTYPE_URL_SSUB_SCALC "scalc"
+#define INETTYPE_URL_SSUB_SCHART "schart"
+#define INETTYPE_URL_SSUB_SDRAW "sdraw"
+#define INETTYPE_URL_SSUB_SIMAGE "simage"
+#define INETTYPE_URL_SSUB_SIMPRESS "simpress"
+#define INETTYPE_URL_SSUB_SMATH "smath"
+#define INETTYPE_URL_SSUB_SS "ss"
+#define INETTYPE_URL_SSUB_SWRITER "swriter"
+
+#define INETTYPE_URL_SSSUB_GLOB "GlobalDocument"
+#define INETTYPE_URL_SSSUB_WEB "web"
+
+#define INETTYPE_URL_SCHED_CMB "cmbview"
+#define INETTYPE_URL_SCHED_FORM "formular"
+#define INETTYPE_URL_SCHED_TASK "type=task"
+
+//============================================================================
+enum INetContentType
+{
+ CONTENT_TYPE_UNKNOWN,
+ CONTENT_TYPE_APP_OCTSTREAM,
+ CONTENT_TYPE_APP_PDF,
+ CONTENT_TYPE_APP_RTF,
+ CONTENT_TYPE_APP_MSWORD,
+ CONTENT_TYPE_APP_MSWORD_TEMPL,
+ CONTENT_TYPE_APP_STARCALC,
+ CONTENT_TYPE_APP_STARCHART,
+ CONTENT_TYPE_APP_STARDRAW,
+ CONTENT_TYPE_APP_STARHELP,
+ CONTENT_TYPE_APP_STARIMAGE,
+ CONTENT_TYPE_APP_STARIMPRESS,
+ CONTENT_TYPE_APP_STARMATH,
+ CONTENT_TYPE_APP_STARWRITER,
+ CONTENT_TYPE_APP_ZIP,
+ CONTENT_TYPE_AUDIO_AIFF,
+ CONTENT_TYPE_AUDIO_BASIC,
+ CONTENT_TYPE_AUDIO_MIDI,
+ CONTENT_TYPE_AUDIO_VORBIS,
+ CONTENT_TYPE_AUDIO_WAV,
+ CONTENT_TYPE_AUDIO_WEBM,
+ CONTENT_TYPE_IMAGE_GIF,
+ CONTENT_TYPE_IMAGE_JPEG,
+ CONTENT_TYPE_IMAGE_PCX,
+ CONTENT_TYPE_IMAGE_PNG,
+ CONTENT_TYPE_IMAGE_TIFF,
+ CONTENT_TYPE_IMAGE_BMP,
+ CONTENT_TYPE_TEXT_HTML,
+ CONTENT_TYPE_TEXT_PLAIN,
+ CONTENT_TYPE_TEXT_URL,
+ CONTENT_TYPE_TEXT_VCARD,
+ CONTENT_TYPE_VIDEO_MSVIDEO,
+ CONTENT_TYPE_VIDEO_THEORA,
+ CONTENT_TYPE_VIDEO_VDO,
+ CONTENT_TYPE_VIDEO_WEBM,
+ CONTENT_TYPE_X_CNT_FSYSBOX,
+ CONTENT_TYPE_X_CNT_FSYSFOLDER,
+ CONTENT_TYPE_X_STARMAIL,
+ CONTENT_TYPE_X_VRML,
+ CONTENT_TYPE_APP_GALLERY,
+ CONTENT_TYPE_APP_GALLERY_THEME,
+ CONTENT_TYPE_APP_STARWRITER_GLOB,
+ CONTENT_TYPE_APP_STARMAIL_SDM,
+ CONTENT_TYPE_APP_STARMAIL_SMD,
+ CONTENT_TYPE_APP_VND_CALC,
+ CONTENT_TYPE_APP_VND_CHART,
+ CONTENT_TYPE_APP_VND_DRAW,
+ CONTENT_TYPE_APP_VND_IMAGE,
+ CONTENT_TYPE_APP_VND_IMPRESS,
+ CONTENT_TYPE_APP_VND_MAIL,
+ CONTENT_TYPE_APP_VND_MATH,
+ CONTENT_TYPE_APP_VND_WRITER,
+ CONTENT_TYPE_APP_VND_WRITER_GLOBAL,
+ CONTENT_TYPE_APP_VND_WRITER_WEB,
+ CONTENT_TYPE_APP_SCHEDULE,
+ CONTENT_TYPE_APP_SCHEDULE_EVT,
+ CONTENT_TYPE_APP_SCHEDULE_TASK,
+ CONTENT_TYPE_APP_SCHEDULE_FORM_EVT,
+ CONTENT_TYPE_APP_SCHEDULE_FORM_TASK,
+ CONTENT_TYPE_APP_FRAMESET,
+ CONTENT_TYPE_APP_MACRO,
+ CONTENT_TYPE_X_CNT_FSYSSPECIALFOLDER,
+ CONTENT_TYPE_APP_VND_TEMPLATE,
+ CONTENT_TYPE_IMAGE_GENERIC,
+ CONTENT_TYPE_APP_VND_NEWS,
+ CONTENT_TYPE_APP_VND_OUTTRAY,
+ CONTENT_TYPE_APP_MSEXCEL,
+ CONTENT_TYPE_APP_MSEXCEL_TEMPL,
+ CONTENT_TYPE_APP_MSPPOINT,
+ CONTENT_TYPE_APP_MSPPOINT_TEMPL,
+ CONTENT_TYPE_TEXT_VCALENDAR,
+ CONTENT_TYPE_TEXT_ICALENDAR,
+ CONTENT_TYPE_TEXT_XMLICALENDAR,
+ CONTENT_TYPE_APP_CDE_CALENDAR_APP,
+ CONTENT_TYPE_INET_MESSAGE_RFC822,
+ CONTENT_TYPE_INET_MULTIPART_ALTERNATIVE,
+ CONTENT_TYPE_INET_MULTIPART_DIGEST,
+ CONTENT_TYPE_INET_MULTIPART_PARALLEL,
+ CONTENT_TYPE_INET_MULTIPART_RELATED,
+ CONTENT_TYPE_INET_MULTIPART_MIXED,
+ CONTENT_TYPE_APP_VND_IMPRESSPACKED,
+ CONTENT_TYPE_APP_JAR,
+ CONTENT_TYPE_APP_VND_SUN_XML_WRITER,
+ CONTENT_TYPE_APP_VND_SUN_XML_CALC,
+ CONTENT_TYPE_APP_VND_SUN_XML_IMPRESS,
+ CONTENT_TYPE_APP_VND_SUN_XML_DRAW,
+ CONTENT_TYPE_APP_VND_SUN_XML_CHART,
+ CONTENT_TYPE_APP_VND_SUN_XML_MATH,
+ CONTENT_TYPE_APP_VND_SUN_XML_WRITER_GLOBAL,
+ CONTENT_TYPE_APP_VND_SUN_XML_IMPRESSPACKED,
+ CONTENT_TYPE_LAST = CONTENT_TYPE_APP_VND_SUN_XML_IMPRESSPACKED
+};
+
+//============================================================================
+class SVL_DLLPUBLIC INetContentTypes
+{
+public:
+ static INetContentType RegisterContentType(OUString const & rTypeName,
+ OUString const & rPresentation,
+ OUString const * pExtension = 0,
+ OUString const * pSystemFileType = 0);
+
+ static INetContentType GetContentType(OUString const & rTypeName);
+
+ static OUString GetContentType(INetContentType eTypeID);
+
+ static OUString GetPresentation(INetContentType eTypeID,
+ const LanguageTag& aLocale);
+
+ static INetContentType GetContentType4Extension(OUString const & rExtension);
+
+ static INetContentType GetContentTypeFromURL(OUString const & rURL);
+
+ static bool GetExtensionFromURL(OUString const & rURL, OUString & rExtension);
+
+ /** Parse the body of an RFC 2045 Content-Type header field.
+
+ @param rMediaType The body of the Content-Type header field. It must
+ be of the form
+
+ token "/" token *(";" token "=" (token / quoted-string))
+
+ with intervening linear white space and comments (cf. RFCs 822, 2045).
+ The RFC 2231 extension are supported. The encoding of rMediaType
+ should be US-ASCII, but any Unicode values in the range U+0080..U+FFFF
+ are interpretet 'as appropriate.'
+
+ @param rType Returns the type (the first of the above tokens), in US-
+ ASCII encoding and converted to lower case.
+
+ @param rSubType Returns the sub type (the second of the above
+ tokens), in US-ASCII encoding and converted to lower case.
+
+ @param rParameters If not null, returns the parameters as a list of
+ INetContentTypeParameters (the attributes are in US-ASCII encoding and
+ converted to lower case, the values are in Unicode encoding). If
+ null, only the syntax of the parameters is checked, but they are not
+ returned.
+
+ @return True if the syntax of the field body is correct. If false is
+ returned, none of the output parameters will be modified!
+ */
+ static bool parse(OUString const & rMediaType, OUString & rType,
+ OUString & rSubType,
+ INetContentTypeParameterList * pParameters = 0);
+};
+
+#endif // _INETTYPE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/instrm.hxx b/include/svl/instrm.hxx
new file mode 100644
index 000000000000..39c3a8589be9
--- /dev/null
+++ b/include/svl/instrm.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVTOOLS_INSTRM_HXX
+#define SVTOOLS_INSTRM_HXX
+
+#include "svl/svldllapi.h"
+#include <com/sun/star/uno/Reference.h>
+#include <tools/stream.hxx>
+
+namespace com { namespace sun { namespace star { namespace io {
+ class XInputStream;
+ class XSeekable;
+} } } }
+
+class SvDataPipe_Impl;
+
+//============================================================================
+class SVL_DLLPUBLIC SvInputStream: public SvStream
+{
+ com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
+ m_xStream;
+ com::sun::star::uno::Reference< com::sun::star::io::XSeekable >
+ m_xSeekable;
+ SvDataPipe_Impl * m_pPipe;
+ sal_uLong m_nSeekedFrom;
+
+ SVL_DLLPRIVATE bool open();
+
+ SVL_DLLPRIVATE virtual sal_uLong GetData(void * pData, sal_uLong nSize);
+
+ SVL_DLLPRIVATE virtual sal_uLong PutData(void const *, sal_uLong);
+
+ SVL_DLLPRIVATE virtual sal_uLong SeekPos(sal_uLong nPos);
+
+ SVL_DLLPRIVATE virtual void FlushData();
+
+ SVL_DLLPRIVATE virtual void SetSize(sal_uLong);
+
+public:
+ SvInputStream(
+ com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
+ const &
+ rTheStream);
+
+ virtual ~SvInputStream();
+
+ virtual sal_uInt16 IsA() const;
+
+ virtual void AddMark(sal_uLong nPos);
+
+ virtual void RemoveMark(sal_uLong nPos);
+};
+
+#endif // SVTOOLS_INSTRM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/intitem.hxx b/include/svl/intitem.hxx
new file mode 100644
index 000000000000..a9cb341aec10
--- /dev/null
+++ b/include/svl/intitem.hxx
@@ -0,0 +1,163 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SFXINTITEM_HXX
+#define _SFXINTITEM_HXX
+
+#include "svl/svldllapi.h"
+#include <svl/cintitem.hxx>
+
+//============================================================================
+class SVL_DLLPUBLIC SfxByteItem: public CntByteItem
+{
+public:
+ TYPEINFO();
+
+ explicit SfxByteItem(sal_uInt16 which = 0, sal_uInt8 nValue = 0):
+ CntByteItem(which, nValue) {}
+
+ virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const;
+
+ virtual SfxPoolItem * Clone(SfxItemPool * = 0) const
+ { return new SfxByteItem(*this); }
+};
+
+//============================================================================
+DBG_NAMEEX_VISIBILITY(SfxInt16Item, SVL_DLLPUBLIC)
+
+class SVL_DLLPUBLIC SfxInt16Item: public SfxPoolItem
+{
+ sal_Int16 m_nValue;
+
+public:
+ TYPEINFO();
+
+ explicit SfxInt16Item(sal_uInt16 which = 0, sal_Int16 nTheValue = 0):
+ SfxPoolItem(which), m_nValue(nTheValue)
+ { DBG_CTOR(SfxInt16Item, 0); }
+
+ SfxInt16Item(sal_uInt16 nWhich, SvStream & rStream);
+
+ SfxInt16Item(const SfxInt16Item & rItem):
+ SfxPoolItem(rItem), m_nValue(rItem.m_nValue)
+ { DBG_CTOR(SfxInt16Item, 0); }
+
+ virtual ~SfxInt16Item() { DBG_DTOR(SfxInt16Item, 0); }
+
+ virtual int operator ==(const SfxPoolItem & rItem) const;
+
+ using SfxPoolItem::Compare;
+ virtual int Compare(const SfxPoolItem & rWith) const;
+
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation,
+ SfxMapUnit, SfxMapUnit,
+ OUString & rText,
+ const IntlWrapper * = 0)
+ const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 ) const;
+
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 );
+
+ virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const;
+
+ virtual SvStream & Store(SvStream & rStream, sal_uInt16) const;
+
+ virtual SfxPoolItem * Clone(SfxItemPool * = 0) const;
+
+ virtual sal_Int16 GetMin() const;
+
+ virtual sal_Int16 GetMax() const;
+
+ virtual SfxFieldUnit GetUnit() const;
+
+ sal_Int16 GetValue() const { return m_nValue; }
+
+ inline void SetValue(sal_Int16 nTheValue);
+};
+
+inline void SfxInt16Item::SetValue(sal_Int16 nTheValue)
+{
+ DBG_ASSERT(GetRefCount() == 0, "SfxInt16Item::SetValue(); Pooled item");
+ m_nValue = nTheValue;
+}
+
+//============================================================================
+class SVL_DLLPUBLIC SfxUInt16Item: public CntUInt16Item
+{
+public:
+ TYPEINFO();
+
+ explicit SfxUInt16Item(sal_uInt16 which = 0, sal_uInt16 nValue = 0):
+ CntUInt16Item(which, nValue) {}
+
+ SfxUInt16Item(sal_uInt16 which, SvStream & rStream):
+ CntUInt16Item(which, rStream) {}
+
+ virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const
+ { return new SfxUInt16Item(Which(), rStream); }
+
+ virtual SfxPoolItem * Clone(SfxItemPool * = 0) const
+ { return new SfxUInt16Item(*this); }
+};
+
+//============================================================================
+class SVL_DLLPUBLIC SfxInt32Item: public CntInt32Item
+{
+public:
+ TYPEINFO();
+
+ explicit SfxInt32Item(sal_uInt16 which = 0, sal_Int32 nValue = 0):
+ CntInt32Item(which, nValue) {}
+
+ SfxInt32Item(sal_uInt16 which, SvStream & rStream):
+ CntInt32Item(which, rStream) {}
+
+ virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const
+ { return new SfxInt32Item(Which(), rStream); }
+
+ virtual SfxPoolItem * Clone(SfxItemPool * = 0) const
+ { return new SfxInt32Item(*this); }
+
+};
+
+//============================================================================
+class SVL_DLLPUBLIC SfxUInt32Item: public CntUInt32Item
+{
+public:
+ TYPEINFO();
+
+ explicit SfxUInt32Item(sal_uInt16 which = 0, sal_uInt32 nValue = 0):
+ CntUInt32Item(which, nValue) {}
+
+ SfxUInt32Item(sal_uInt16 which, SvStream & rStream):
+ CntUInt32Item(which, rStream) {}
+
+ virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const
+ { return new SfxUInt32Item(Which(), rStream); }
+
+ virtual SfxPoolItem * Clone(SfxItemPool * = 0) const
+ { return new SfxUInt32Item(*this); }
+};
+
+#endif // _SFXINTITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/isethint.hxx b/include/svl/isethint.hxx
new file mode 100644
index 000000000000..cd966f5fcc4f
--- /dev/null
+++ b/include/svl/isethint.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXISETHINT_HXX
+#define _SFXISETHINT_HXX
+
+#include "svl/svldllapi.h"
+
+#include <svl/hint.hxx>
+
+class SfxItemSet;
+
+//--------------------------------------------------------------------
+
+class SVL_DLLPUBLIC SfxItemSetHint: public SfxHint
+{
+ SfxItemSet* _pItemSet;
+
+public:
+ TYPEINFO();
+
+ SfxItemSetHint( const SfxItemSet &rItemSet );
+ virtual ~SfxItemSetHint();
+
+ const SfxItemSet& GetItemSet() const { return *_pItemSet; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/itemiter.hxx b/include/svl/itemiter.hxx
new file mode 100644
index 000000000000..4dada91a42b7
--- /dev/null
+++ b/include/svl/itemiter.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXITEMITER_HXX
+#define _SFXITEMITER_HXX
+
+#include "svl/svldllapi.h"
+#include <tools/solar.h>
+#include <svl/itemset.hxx>
+
+class SfxPoolItem;
+class SfxItemSet;
+class SfxItemPool;
+
+class SVL_DLLPUBLIC SfxItemIter
+{
+ // Item-Feld - Start & Ende
+ const SfxItemSet& _rSet;
+ sal_uInt16 _nStt, _nEnd, _nAkt;
+
+public:
+ SfxItemIter( const SfxItemSet& rSet );
+ ~SfxItemIter();
+
+ // falls es diese gibt, returne sie, sonst 0
+ const SfxPoolItem* FirstItem()
+ { _nAkt = _nStt;
+ return _rSet._nCount ? *(_rSet._aItems+_nAkt) : 0; }
+ const SfxPoolItem* LastItem()
+ { _nAkt = _nEnd;
+ return _rSet._nCount ? *(_rSet._aItems+_nAkt) : 0; }
+ const SfxPoolItem* GetCurItem()
+ { return _rSet._nCount ? *(_rSet._aItems+_nAkt) : 0; }
+ const SfxPoolItem* NextItem();
+
+ sal_Bool IsAtStart() const { return _nAkt == _nStt; }
+ sal_Bool IsAtEnd() const { return _nAkt == _nEnd; }
+
+ sal_uInt16 GetCurPos() const { return _nAkt; }
+ sal_uInt16 GetFirstPos() const { return _nStt; }
+ sal_uInt16 GetLastPos() const { return _nEnd; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/itempool.hxx b/include/svl/itempool.hxx
new file mode 100644
index 000000000000..ab9ff84d173d
--- /dev/null
+++ b/include/svl/itempool.hxx
@@ -0,0 +1,259 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SFXITEMPOOL_HXX
+#define _SFXITEMPOOL_HXX
+
+#include "svl/svldllapi.h"
+
+#include <limits.h>
+#include <tools/solar.h>
+#include <tools/string.hxx>
+#include <svl/poolitem.hxx>
+#include <vector>
+
+class SvStream;
+class SfxBroadcaster;
+struct SfxItemPool_Impl;
+
+#define SFX_WHICH_MAX 4999
+
+DBG_NAMEEX(SfxItemPool)
+
+//====================================================================
+
+#define SFX_ITEM_POOLABLE 0x0001
+#define SFX_ITEM_NOT_POOLABLE 0x0002
+
+#define SFX_ITEM_USERFLAG0 0x0100
+#define SFX_ITEM_USERFLAG1 0x0200
+#define SFX_ITEM_USERFLAG2 0x0400
+#define SFX_ITEM_USERFLAG3 0x0800
+#define SFX_ITEM_USERFLAG4 0x1000
+#define SFX_ITEM_USERFLAG5 0x2000
+#define SFX_ITEM_USERFLAG6 0x4000
+#define SFX_ITEM_USERFLAG7 0x8000
+#define SFX_ITEM_USERFLAG8 0x0010
+#define SFX_ITEM_USERFLAG9 0x0020
+#define SFX_ITEM_USERFLAGA 0x0040
+#define SFX_ITEM_USERFLAGB 0x0080
+
+//====================================================================
+
+struct SfxItemInfo
+{
+ sal_uInt16 _nSID;
+ sal_uInt16 _nFlags;
+};
+
+//====================================================================
+
+class SfxStyleSheetIterator;
+struct SfxPoolItemArray_Impl;
+class SfxItemPool;
+
+class SVL_DLLPUBLIC SfxItemPoolUser
+{
+public:
+ virtual void ObjectInDestruction(const SfxItemPool& rSfxItemPool) = 0;
+
+protected:
+ ~SfxItemPoolUser() {}
+};
+
+class SVL_DLLPUBLIC SfxItemPool
+
+/* [Beschreibung]
+
+ Die von dieser Klasse abgeleiteten Klassen dienen der Bereitstellung von
+ Defaults von SfxPoolItems und halten konkrete (konstante) Instanzen, die
+ dann von mehreren Stellen (i.d.R. eines Dokuments) referenziert werden
+ k�nnen.
+
+ Dadurch ist jeder Wert nur einmalig gespeichert, was zu wenig Konstruktor
+ und Destruktor-Aufrufen f�hrt, Vergleiche zwischen Items eines Dokuments
+ beschleunigt und ein einfaches Laden und Speichern von Attributen
+ bereitstellt.
+*/
+
+{
+ friend struct SfxItemPool_Impl;
+
+ const SfxItemInfo* pItemInfos;
+ SfxItemPool_Impl* pImp;
+
+public:
+ void AddSfxItemPoolUser(SfxItemPoolUser& rNewUser);
+ void RemoveSfxItemPoolUser(SfxItemPoolUser& rOldUser);
+
+ //---------------------------------------------------------------------
+#ifndef _SFXITEMS_HXX
+
+private:
+ sal_uInt16 GetIndex_Impl(sal_uInt16 nWhich) const;
+ sal_uInt16 GetSize_Impl() const;
+
+ SVL_DLLPRIVATE SvStream& Load1_Impl( SvStream &rStream );
+ SVL_DLLPRIVATE bool IsItemFlag_Impl( sal_uInt16 nWhich, sal_uInt16 nFlag ) const;
+
+public:
+ // fuer dflt. SfxItemSet::CTOR, setze dflt. WhichRanges
+ void FillItemIdRanges_Impl( sal_uInt16*& pWhichRanges ) const;
+ const sal_uInt16* GetFrozenIdRanges() const;
+
+#endif
+ //---------------------------------------------------------------------
+
+protected:
+ static inline void SetRefCount( SfxPoolItem& rItem, sal_uLong n );
+ static inline sal_uLong AddRef( const SfxPoolItem& rItem, sal_uLong n = 1 );
+ static inline sal_uLong ReleaseRef( const SfxPoolItem& rItem, sal_uLong n = 1);
+ static inline void SetKind( SfxPoolItem& rItem, sal_uInt16 nRef );
+
+public:
+ SfxItemPool( const SfxItemPool &rPool,
+ sal_Bool bCloneStaticDefaults = sal_False );
+ SfxItemPool( const OUString &rName,
+ sal_uInt16 nStart, sal_uInt16 nEnd,
+ const SfxItemInfo *pItemInfos,
+ SfxPoolItem **pDefaults = 0,
+ bool bLoadRefCounts = true );
+protected:
+ virtual ~SfxItemPool();
+public:
+ static void Free(SfxItemPool* pPool);
+
+ SfxBroadcaster& BC();
+
+ void SetPoolDefaultItem( const SfxPoolItem& );
+ const SfxPoolItem* GetPoolDefaultItem( sal_uInt16 nWhich ) const;
+ void ResetPoolDefaultItem( sal_uInt16 nWhich );
+
+ void SetDefaults( SfxPoolItem **pDefaults );
+ void ReleaseDefaults( sal_Bool bDelete = sal_False );
+ static void ReleaseDefaults( SfxPoolItem **pDefaults, sal_uInt16 nCount, sal_Bool bDelete = sal_False );
+
+ virtual SfxMapUnit GetMetric( sal_uInt16 nWhich ) const;
+ void SetDefaultMetric( SfxMapUnit eNewMetric );
+ virtual SfxItemPresentation GetPresentation( const SfxPoolItem& rItem,
+ SfxItemPresentation ePresentation,
+ SfxMapUnit ePresentationMetric,
+ OUString& rText,
+ const IntlWrapper * pIntlWrapper
+ = 0 ) const;
+ virtual SfxItemPool* Clone() const;
+ const OUString& GetName() const;
+
+ virtual const SfxPoolItem& Put( const SfxPoolItem&, sal_uInt16 nWhich = 0 );
+ virtual void Remove( const SfxPoolItem& );
+ virtual const SfxPoolItem& GetDefaultItem( sal_uInt16 nWhich ) const;
+
+ const SfxPoolItem* LoadItem( SvStream &rStream,
+ bool bDirect = false,
+ const SfxItemPool *pRefPool = 0 );
+ bool StoreItem( SvStream &rStream,
+ const SfxPoolItem &rItem,
+ bool bDirect = false ) const;
+
+ sal_uInt32 GetSurrogate(const SfxPoolItem *) const;
+ const SfxPoolItem * GetItem2(sal_uInt16 nWhich, sal_uInt32 nSurrogate) const;
+ sal_uInt32 GetItemCount2(sal_uInt16 nWhich) const;
+ const SfxPoolItem* LoadSurrogate(SvStream& rStream,
+ sal_uInt16 &rWhich, sal_uInt16 nSlotId,
+ const SfxItemPool* pRefPool = 0 );
+ bool StoreSurrogate(SvStream& rStream,
+ const SfxPoolItem *pItem ) const;
+
+ virtual SvStream & Load(SvStream &);
+ virtual SvStream & Store(SvStream &) const;
+ bool HasPersistentRefCounts() const;
+ void LoadCompleted();
+
+ sal_uInt16 GetFirstWhich() const;
+ sal_uInt16 GetLastWhich() const;
+ bool IsInRange( sal_uInt16 nWhich ) const;
+ bool IsInVersionsRange( sal_uInt16 nWhich ) const;
+ bool IsInStoringRange( sal_uInt16 nWhich ) const;
+ void SetStoringRange( sal_uInt16 nFrom, sal_uInt16 nTo );
+ void SetSecondaryPool( SfxItemPool *pPool );
+ SfxItemPool* GetSecondaryPool() const;
+ SfxItemPool* GetMasterPool() const;
+ void FreezeIdRanges();
+
+ void Delete();
+
+ bool IsItemFlag( sal_uInt16 nWhich, sal_uInt16 nFlag ) const;
+ bool IsItemFlag( const SfxPoolItem &rItem, sal_uInt16 nFlag ) const
+ { return IsItemFlag( rItem.Which(), nFlag ); }
+ void SetItemInfos( const SfxItemInfo *pInfos )
+ { pItemInfos = pInfos; }
+ sal_uInt16 GetWhich( sal_uInt16 nSlot, sal_Bool bDeep = sal_True ) const;
+ sal_uInt16 GetSlotId( sal_uInt16 nWhich, sal_Bool bDeep = sal_True ) const;
+ sal_uInt16 GetTrueWhich( sal_uInt16 nSlot, sal_Bool bDeep = sal_True ) const;
+ sal_uInt16 GetTrueSlotId( sal_uInt16 nWhich, sal_Bool bDeep = sal_True ) const;
+
+ void SetVersionMap( sal_uInt16 nVer,
+ sal_uInt16 nOldStart, sal_uInt16 nOldEnd,
+ const sal_uInt16 *pWhichIdTab );
+ sal_uInt16 GetNewWhich( sal_uInt16 nOldWhich ) const;
+ sal_uInt16 GetVersion() const;
+ void SetFileFormatVersion( sal_uInt16 nFileFormatVersion );
+ bool IsCurrentVersionLoading() const;
+
+ static int IsWhich(sal_uInt16 nId) {
+ return nId && nId <= SFX_WHICH_MAX; }
+ static int IsSlot(sal_uInt16 nId) {
+ return nId && nId > SFX_WHICH_MAX; }
+
+ static const SfxItemPool* GetStoringPool();
+
+private:
+ const SfxItemPool& operator=(const SfxItemPool &); // n.i.!!
+
+ static const SfxItemPool* pStoringPool_;
+};
+
+// --------------- Inline Implementierungen ------------------------------
+
+// nur der Pool darf den Referenz-Zaehler manipulieren !!!
+inline void SfxItemPool::SetRefCount( SfxPoolItem& rItem, sal_uLong n )
+{
+ rItem.SetRefCount(n);
+}
+
+// nur der Pool darf den Referenz-Zaehler manipulieren !!!
+inline sal_uLong SfxItemPool::AddRef( const SfxPoolItem& rItem, sal_uLong n )
+{
+ return rItem.AddRef(n);
+}
+
+// nur der Pool darf den Referenz-Zaehler manipulieren !!!
+inline sal_uLong SfxItemPool::ReleaseRef( const SfxPoolItem& rItem, sal_uLong n )
+{
+ return rItem.ReleaseRef(n);
+}
+
+inline void SfxItemPool::SetKind( SfxPoolItem& rItem, sal_uInt16 nRef )
+{
+ rItem.SetKind( nRef );
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/itemprop.hxx b/include/svl/itemprop.hxx
new file mode 100644
index 000000000000..c1b7ed68b400
--- /dev/null
+++ b/include/svl/itemprop.hxx
@@ -0,0 +1,203 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX_ITEMPROP_HXX
+#define _SFX_ITEMPROP_HXX
+
+#include "svl/svldllapi.h"
+#include <tools/solar.h>
+#include <tools/string.hxx>
+#include <svl/itemset.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/beans/PropertyState.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <vector>
+
+// UNO III - Implementation
+#define MAP_CHAR_LEN(cchar) cchar, sizeof(cchar) - 1
+
+struct SfxItemPropertyMapEntry
+{
+ const char* pName;
+ sal_uInt16 nNameLen;
+ sal_uInt16 nWID;
+ const com::sun::star::uno::Type* pType;
+ long nFlags;
+ sal_uInt8 nMemberId;
+
+};
+
+struct SfxItemPropertySimpleEntry
+{
+ sal_uInt16 nWID;
+ const com::sun::star::uno::Type* pType;
+ long nFlags;
+ sal_uInt8 nMemberId;
+
+ SfxItemPropertySimpleEntry() :
+ nWID( 0 ),
+ pType( 0 ),
+ nFlags( 0 ),
+ nMemberId( 0 ){}
+
+ SfxItemPropertySimpleEntry(sal_uInt16 _nWID, const com::sun::star::uno::Type* _pType,
+ long _nFlags, sal_uInt8 _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
+{
+ 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& rSource );
+ ~SfxItemPropertyMap();
+
+ const SfxItemPropertySimpleEntry* getByName( const OUString &rName ) const;
+ com::sun::star::uno::Sequence< com::sun::star::beans::Property > getProperties() const;
+ com::sun::star::beans::Property getPropertyByName( const OUString rName ) const
+ throw( ::com::sun::star::beans::UnknownPropertyException );
+ sal_Bool hasPropertyByName( const 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;
+
+};
+
+class SVL_DLLPUBLIC SfxItemPropertySet
+{
+ SfxItemPropertyMap m_aMap;
+ mutable com::sun::star::uno::Reference<com::sun::star::beans::XPropertySetInfo> m_xInfo;
+protected:
+ virtual sal_Bool FillItem(SfxItemSet& rSet, sal_uInt16 nWhich, sal_Bool bGetProperty) const;
+
+public:
+ 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 OUString &rName,
+ const SfxItemSet& rSet,
+ com::sun::star::uno::Any& rAny) const
+ throw(::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::beans::UnknownPropertyException);
+ com::sun::star::uno::Any
+ getPropertyValue( const OUString &rName,
+ const SfxItemSet& rSet ) const
+ throw(::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::beans::UnknownPropertyException);
+ 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 OUString& rPropertyName,
+ const com::sun::star::uno::Any& aVal,
+ SfxItemSet& rSet ) const
+ throw(::com::sun::star::uno::RuntimeException,
+ com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::beans::UnknownPropertyException);
+
+ com::sun::star::beans::PropertyState
+ getPropertyState(const OUString& rName, const SfxItemSet& rSet)const
+ throw(com::sun::star::beans::UnknownPropertyException);
+ com::sun::star::beans::PropertyState
+ 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 m_aMap;}
+};
+
+struct SfxItemPropertySetInfo_Impl;
+class SVL_DLLPUBLIC SfxItemPropertySetInfo : public
+ cppu::WeakImplHelper1<com::sun::star::beans::XPropertySetInfo>
+{
+ SfxItemPropertySetInfo_Impl* m_pImpl;
+
+public:
+ SfxItemPropertySetInfo(const SfxItemPropertyMap &rMap );
+ SfxItemPropertySetInfo(const SfxItemPropertyMapEntry *pEntries );
+ virtual ~SfxItemPropertySetInfo();
+
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL
+ getProperties( )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::beans::Property SAL_CALL
+ getPropertyByName( const OUString& aName )
+ throw(::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL
+ hasPropertyByName( const OUString& Name )
+ throw(::com::sun::star::uno::RuntimeException);
+
+};
+
+class SVL_DLLPUBLIC SfxExtItemPropertySetInfo: public cppu::WeakImplHelper1<com::sun::star::beans::XPropertySetInfo >
+{
+ SfxItemPropertyMap aExtMap;
+public:
+ SfxExtItemPropertySetInfo(
+ 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( )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::beans::Property SAL_CALL
+ getPropertyByName( const OUString& aName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL
+ hasPropertyByName( const OUString& Name )
+ throw(::com::sun::star::uno::RuntimeException);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/itemset.hxx b/include/svl/itemset.hxx
new file mode 100644
index 000000000000..a38398ac1ce7
--- /dev/null
+++ b/include/svl/itemset.hxx
@@ -0,0 +1,191 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXITEMSET_HXX
+#define _SFXITEMSET_HXX
+
+#include "svl/svldllapi.h"
+
+#include <cstdarg> // std::va_list and friends
+#include <svl/poolitem.hxx>
+#include <tools/rtti.hxx>
+#include <tools/solar.h>
+
+class SfxItemPool;
+class SfxPoolItem;
+class SvStream;
+
+typedef SfxPoolItem const** SfxItemArray;
+
+#define USHORT_ARG int
+
+#ifdef DBG
+#undef DBG
+#endif
+#define DBG(s)
+
+//========================================================================
+
+#define SFX_ITEMSET_GET( rSet, pItem, ItemType, nSlotId, bDeep ) \
+ const ItemType *pItem = (const ItemType*) \
+ (rSet).GetItem( nSlotId, bDeep, TYPE(ItemType) )
+
+//========================================================================
+
+class SVL_DLLPUBLIC SfxItemSet
+{
+ friend class SfxItemIter;
+
+ SfxItemPool* _pPool; // der verwendete Pool
+ const SfxItemSet* _pParent; // Ableitung
+ SfxItemArray _aItems; // Item-Feld
+ sal_uInt16* _pWhichRanges; // Array von Which-Bereichen
+ sal_uInt16 _nCount; // Anzahl Items
+
+ //---------------------------------------------------------------------
+#ifndef _SFXITEMS_HXX
+
+friend class SfxItemPoolCache;
+friend class SfxAllItemSet;
+friend const char *DbgCheckItemSet( const void* );
+
+private:
+ SVL_DLLPRIVATE void InitRanges_Impl(const sal_uInt16 *nWhichPairTable);
+ SVL_DLLPRIVATE void InitRanges_Impl(va_list pWhich, sal_uInt16 n1, sal_uInt16 n2, sal_uInt16 n3);
+ SVL_DLLPRIVATE void InitRanges_Impl(sal_uInt16 nWh1, sal_uInt16 nWh2);
+
+public:
+ SfxItemArray GetItems_Impl() const { return _aItems; }
+
+#endif
+ //---------------------------------------------------------------------
+
+private:
+ const SfxItemSet& operator=(const SfxItemSet &); // n.i.!!
+
+protected:
+ // Notification-Callback
+ virtual void Changed( const SfxPoolItem& rOld, const SfxPoolItem& rNew );
+
+ // direkte Put-Methode
+ int PutDirect(const SfxPoolItem &rItem);
+
+public:
+ SfxItemSet( const SfxItemSet& );
+
+ SfxItemSet( SfxItemPool&, sal_Bool bTotalPoolRanges = sal_False );
+ SfxItemSet( SfxItemPool&, sal_uInt16 nWhich1, sal_uInt16 nWhich2 );
+ SfxItemSet( SfxItemPool&, USHORT_ARG nWh1, USHORT_ARG nWh2, USHORT_ARG nNull, ... );
+ SfxItemSet( SfxItemPool&, const sal_uInt16* nWhichPairTable );
+ virtual ~SfxItemSet();
+
+ virtual SfxItemSet * Clone(sal_Bool bItems = sal_True, SfxItemPool *pToPool = 0) const;
+
+ // Items erfragen
+ sal_uInt16 Count() const { return _nCount; }
+ sal_uInt16 TotalCount() const;
+
+ virtual const SfxPoolItem& Get( sal_uInt16 nWhich, sal_Bool bSrchInParent = sal_True ) const;
+ const SfxPoolItem* GetItem( sal_uInt16 nWhich, sal_Bool bSrchInParent = sal_True,
+ TypeId aItemType = 0 ) const;
+
+ // Which-Wert des Items an der Position nPos erfragen
+ sal_uInt16 GetWhichByPos(sal_uInt16 nPos) const;
+
+ // Item-Status erfragen
+ SfxItemState GetItemState( sal_uInt16 nWhich,
+ sal_Bool bSrchInParent = sal_True,
+ const SfxPoolItem **ppItem = 0 ) const;
+
+ bool HasItem(sal_uInt16 nWhich, const SfxPoolItem** ppItem = NULL) const;
+
+ virtual void DisableItem(sal_uInt16 nWhich);
+ virtual void InvalidateItem( sal_uInt16 nWhich );
+ virtual sal_uInt16 ClearItem( sal_uInt16 nWhich = 0);
+ virtual void ClearInvalidItems( sal_Bool bHardDefault = sal_False );
+ void InvalidateAllItems(); // HACK(via nWhich = 0) ???
+
+ inline void SetParent( const SfxItemSet* pNew );
+
+ // Items hinzufuegen, loeschen etc.
+ virtual const SfxPoolItem* Put( const SfxPoolItem&, sal_uInt16 nWhich );
+ const SfxPoolItem* Put( const SfxPoolItem& rItem )
+ { return Put(rItem, rItem.Which()); }
+ virtual int Put( const SfxItemSet&,
+ sal_Bool bInvalidAsDefault = sal_True );
+ void PutExtended( const SfxItemSet&,
+ SfxItemState eDontCareAs = SFX_ITEM_UNKNOWN,
+ SfxItemState eDefaultAs = SFX_ITEM_UNKNOWN );
+
+ virtual int Set( const SfxItemSet&, sal_Bool bDeep = sal_True );
+
+ virtual void Intersect( const SfxItemSet& rSet );
+ virtual void MergeValues( const SfxItemSet& rSet, sal_Bool bOverwriteDefaults = sal_False );
+ virtual void Differentiate( const SfxItemSet& rSet );
+ virtual void MergeValue( const SfxPoolItem& rItem, sal_Bool bOverwriteDefaults = sal_False );
+
+ SfxItemPool* GetPool() const { return _pPool; }
+ const sal_uInt16* GetRanges() const { return _pWhichRanges; }
+ void SetRanges( const sal_uInt16 *pRanges );
+ void MergeRange( sal_uInt16 nFrom, sal_uInt16 nTo );
+ const SfxItemSet* GetParent() const { return _pParent; }
+
+ virtual SvStream & Load( SvStream &, bool bDirect = false,
+ const SfxItemPool *pRefPool = 0 );
+ virtual SvStream & Store( SvStream &, bool bDirect = false ) const;
+
+ virtual int operator==(const SfxItemSet &) const;
+};
+
+// --------------- Inline Implementierungen ------------------------
+
+inline void SfxItemSet::SetParent( const SfxItemSet* pNew )
+{
+ DBG( if (_pParent) --*_pChildCount(_pParent) );
+ _pParent = pNew;
+ DBG( if (_pParent) ++*_pChildCount(_pParent) );
+}
+
+//========================================================================
+
+class SVL_DLLPUBLIC SfxAllItemSet: public SfxItemSet
+
+/* versteht alle Ranges; werden durch das Putten der Items
+ automatisch angepasst
+*/
+
+{
+ SfxVoidItem aDefault;
+ sal_uInt16 nFree;
+
+public:
+ SfxAllItemSet( SfxItemPool &rPool );
+ SfxAllItemSet( const SfxItemSet & );
+ SfxAllItemSet( const SfxAllItemSet & );
+
+ virtual SfxItemSet * Clone( sal_Bool bItems = sal_True, SfxItemPool *pToPool = 0 ) const;
+ virtual const SfxPoolItem* Put( const SfxPoolItem&, sal_uInt16 nWhich );
+ const SfxPoolItem* Put( const SfxPoolItem& rItem )
+ { return Put(rItem, rItem.Which()); }
+ virtual int Put( const SfxItemSet&,
+ sal_Bool bInvalidAsDefault = sal_True );
+};
+
+#endif // #ifndef _SFXITEMSET_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/languageoptions.hxx b/include/svl/languageoptions.hxx
new file mode 100644
index 000000000000..ef8fb1b4ae5d
--- /dev/null
+++ b/include/svl/languageoptions.hxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVTOOLS_LANGUAGEOPTIONS_HXX
+#define _SVTOOLS_LANGUAGEOPTIONS_HXX
+
+#include "svl/svldllapi.h"
+#include <sal/types.h>
+#include <svl/brdcst.hxx>
+#include <svl/lstner.hxx>
+#include <unotools/configitem.hxx>
+#include <unotools/options.hxx>
+#include <i18nlangtag/lang.h>
+
+// class SvtLanguageOptions ----------------------------------------------------
+
+// these defines can be ored
+#define SCRIPTTYPE_LATIN 0x01
+#define SCRIPTTYPE_ASIAN 0x02
+#define SCRIPTTYPE_COMPLEX 0x04
+
+class SvtCJKOptions;
+class SvtCTLOptions;
+
+class SVL_DLLPUBLIC SvtLanguageOptions : public ::utl::detail::Options
+{
+private:
+ SvtCJKOptions* m_pCJKOptions;
+ SvtCTLOptions* m_pCTLOptions;
+
+public:
+ enum EOption
+ {
+ // cjk options
+ E_CJKFONT,
+ E_VERTICALTEXT,
+ E_ASIANTYPOGRAPHY,
+ E_JAPANESEFIND,
+ E_RUBY,
+ E_CHANGECASEMAP,
+ E_DOUBLELINES,
+ E_EMPHASISMARKS,
+ E_VERTICALCALLOUT,
+ E_ALLCJK,
+ // ctl options
+ E_CTLFONT,
+ E_CTLSEQUENCECHECKING,
+ E_CTLCURSORMOVEMENT,
+ E_CTLTEXTNUMERALS
+ };
+
+ // bDontLoad is for referencing purposes only
+ SvtLanguageOptions( sal_Bool _bDontLoad = sal_False );
+ ~SvtLanguageOptions();
+
+ // CJK options
+ sal_Bool IsCJKFontEnabled() const;
+ sal_Bool IsVerticalTextEnabled() const;
+ sal_Bool IsAsianTypographyEnabled() const;
+ sal_Bool IsJapaneseFindEnabled() const;
+ void SetAll( sal_Bool _bSet );
+ sal_Bool IsAnyEnabled() const;
+
+ // CTL options
+ void SetCTLFontEnabled( sal_Bool _bEnabled );
+ sal_Bool IsCTLFontEnabled() const;
+
+ void SetCTLSequenceChecking( sal_Bool _bEnabled );
+
+ void SetCTLSequenceCheckingRestricted( sal_Bool _bEnable );
+
+ void SetCTLSequenceCheckingTypeAndReplace( sal_Bool _bEnable );
+
+ sal_Bool IsReadOnly(EOption eOption) const;
+
+ // returns for a language the scripttype
+ static sal_uInt16 GetScriptTypeOfLanguage( sal_uInt16 nLang );
+};
+/** #i42730# Gives access to the Windows 16bit system locale
+ */
+class SVL_DLLPUBLIC SvtSystemLanguageOptions : public utl::ConfigItem
+{
+private:
+ OUString m_sWin16SystemLocale;
+
+public:
+ SvtSystemLanguageOptions();
+ ~SvtSystemLanguageOptions();
+
+ virtual void Commit();
+ virtual void Notify( const com::sun::star::uno::Sequence< OUString >& rPropertyNames );
+
+ LanguageType GetWin16SystemLanguage();
+};
+
+#endif // _SVTOOLS_LANGUAGEOPTIONS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/lckbitem.hxx b/include/svl/lckbitem.hxx
new file mode 100644
index 000000000000..163c2168c4c0
--- /dev/null
+++ b/include/svl/lckbitem.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _LCKBITEM_HXX
+#define _LCKBITEM_HXX
+
+#include "svl/svldllapi.h"
+#include <tools/solar.h>
+#include <tools/rtti.hxx>
+#include <tools/stream.hxx>
+#include <svl/poolitem.hxx>
+
+// -----------------------------------------------------------------------
+
+class SVL_DLLPUBLIC SfxLockBytesItem : public SfxPoolItem
+{
+ SvLockBytesRef _xVal;
+
+public:
+ TYPEINFO();
+ SfxLockBytesItem();
+ SfxLockBytesItem( sal_uInt16 nWhich, SvStream & );
+ SfxLockBytesItem( const SfxLockBytesItem& );
+ ~SfxLockBytesItem();
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16 nItemVersion) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
+
+ SvLockBytes* GetValue() const { return _xVal; }
+
+ virtual bool PutValue ( const com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 );
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 ) const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/listener.hxx b/include/svl/listener.hxx
new file mode 100644
index 000000000000..eeb275e302aa
--- /dev/null
+++ b/include/svl/listener.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVT_LISTENER_HXX
+#define _SVT_LISTENER_HXX
+
+#include "svl/svldllapi.h"
+#include <tools/rtti.hxx>
+
+class SvtBroadcaster;
+class SfxHint;
+class SvtListenerBase;
+
+//-------------------------------------------------------------------------
+
+class SVL_DLLPUBLIC SvtListener
+{
+ friend class SvtListenerBase;
+ SvtListenerBase *pBrdCastLst;
+
+ const SvtListener& operator=(const SvtListener &); // n.i., ist verboten
+
+public:
+ TYPEINFO();
+
+ SvtListener();
+ SvtListener( const SvtListener &rCopy );
+ virtual ~SvtListener();
+
+ sal_Bool StartListening( SvtBroadcaster& rBroadcaster );
+ sal_Bool EndListening( SvtBroadcaster& rBroadcaster );
+ void EndListeningAll();
+ sal_Bool IsListening( SvtBroadcaster& rBroadcaster ) const;
+
+ sal_Bool HasBroadcaster() const { return 0 != pBrdCastLst; }
+
+ virtual void Notify( SvtBroadcaster& rBC, const SfxHint& rHint );
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/listeneriter.hxx b/include/svl/listeneriter.hxx
new file mode 100644
index 000000000000..9a621d80e244
--- /dev/null
+++ b/include/svl/listeneriter.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVT_LISTENERITER_HXX
+#define _SVT_LISTENERITER_HXX
+
+#include "svl/svldllapi.h"
+#include <tools/rtti.hxx>
+
+class SvtListener;
+class SvtListenerBase;
+class SvtBroadcaster;
+
+//-------------------------------------------------------------------------
+
+class SVL_DLLPUBLIC SvtListenerIter
+{
+ friend class SvtListenerBase;
+
+ SvtBroadcaster& rRoot;
+ SvtListenerBase *pAkt, *pDelNext;
+
+ // for the update of all iterator's, if a listener is added or removed
+ // at the same time.
+ static SvtListenerIter *pListenerIters;
+ SvtListenerIter *pNxtIter;
+
+ SVL_DLLPRIVATE static void RemoveListener( SvtListenerBase& rDel,
+ SvtListenerBase* pNext );
+
+public:
+ SvtListenerIter( SvtBroadcaster& );
+ ~SvtListenerIter();
+
+ const SvtBroadcaster& GetBroadcaster() const { return rRoot; }
+ SvtBroadcaster& GetBroadcaster() { return rRoot; }
+
+ SvtListener* GoNext(); // to the next
+
+ SvtListener* GoStart(); // to the start of the list
+
+ SvtListener* GetCurr() const; // returns the current
+
+ int IsChanged() const { return pDelNext != pAkt; }
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/lngmisc.hxx b/include/svl/lngmisc.hxx
new file mode 100644
index 000000000000..c1b4a0160277
--- /dev/null
+++ b/include/svl/lngmisc.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVTOOLS_LNGMISC_HXX_
+#define _SVTOOLS_LNGMISC_HXX_
+
+#include "svl/svldllapi.h"
+
+#include <rtl/ustring.hxx>
+
+#define SVT_SOFT_HYPHEN (static_cast<sal_Unicode>(0x00AD))
+#define SVT_HARD_HYPHEN (static_cast<sal_Unicode>(0x2011))
+
+// the non-breaking space
+#define SVT_HARD_SPACE (static_cast<sal_Unicode>(0x00A0))
+
+namespace linguistic
+{
+ inline bool IsHyphen(sal_Unicode cChar)
+ {
+ return cChar == SVT_SOFT_HYPHEN || cChar == SVT_HARD_HYPHEN;
+ }
+
+ inline bool IsControlChar(sal_Unicode cChar)
+ {
+ // TODO: why doesn't this include 0x0F DEL?
+ return cChar < static_cast<sal_Unicode>(' ');
+ }
+
+ SVL_DLLPRIVATE sal_Int32 GetNumControlChars( const OUString &rTxt );
+
+ SVL_DLLPUBLIC bool RemoveHyphens(OUString &rTxt);
+ SVL_DLLPUBLIC bool RemoveControlChars(OUString &rTxt);
+ SVL_DLLPUBLIC bool ReplaceControlChars(OUString &rTxt);
+ SVL_DLLPUBLIC OUString GetThesaurusReplaceText(const OUString &rText);
+} // namespace linguistic
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/lockfilecommon.hxx b/include/svl/lockfilecommon.hxx
new file mode 100644
index 000000000000..b9f62cd78504
--- /dev/null
+++ b/include/svl/lockfilecommon.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVT_LOCKFILECOMMON_HXX
+#define _SVT_LOCKFILECOMMON_HXX
+
+#include <svl/svldllapi.h>
+
+#include <com/sun/star/io/XStream.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
+#include <com/sun/star/io/XTruncate.hpp>
+
+#include <osl/mutex.hxx>
+#include <tools/urlobj.hxx>
+
+#define LOCKFILE_OOOUSERNAME_ID 0
+#define LOCKFILE_SYSUSERNAME_ID 1
+#define LOCKFILE_LOCALHOST_ID 2
+#define LOCKFILE_EDITTIME_ID 3
+#define LOCKFILE_USERURL_ID 4
+#define LOCKFILE_ENTRYSIZE 5
+
+namespace svt {
+
+// This is a general implementation that is used in document lock file implementation and in sharing control file implementation
+class SVL_DLLPUBLIC LockFileCommon
+{
+protected:
+ ::osl::Mutex m_aMutex;
+ OUString m_aURL;
+
+ INetURLObject ResolveLinks( const INetURLObject& aDocURL );
+
+public:
+ LockFileCommon( const OUString& aOrigURL, const OUString& aPrefix );
+ ~LockFileCommon();
+
+ static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< OUString > > ParseList( const ::com::sun::star::uno::Sequence< sal_Int8 >& aBuffer );
+ static ::com::sun::star::uno::Sequence< OUString > ParseEntry( const ::com::sun::star::uno::Sequence< sal_Int8 >& aBuffer, sal_Int32& o_nCurPos );
+ static OUString ParseName( const ::com::sun::star::uno::Sequence< sal_Int8 >& aBuffer, sal_Int32& o_nCurPos );
+ static OUString EscapeCharacters( const OUString& aSource );
+ static OUString GetOOOUserName();
+ static OUString GetCurrentLocalTime();
+ static ::com::sun::star::uno::Sequence< OUString > GenerateOwnEntry();
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/lstner.hxx b/include/svl/lstner.hxx
new file mode 100644
index 000000000000..e54368abb557
--- /dev/null
+++ b/include/svl/lstner.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXLSTNER_HXX
+#define _SFXLSTNER_HXX
+
+#include "svl/svldllapi.h"
+#include <tools/rtti.hxx>
+#include <deque>
+
+class SfxBroadcaster;
+class SfxHint;
+
+typedef std::deque<SfxBroadcaster*> SfxBroadcasterArr_Impl;
+
+#define SFX_NOTIFY( rBC, rBCT, rHint, rHintT ) \
+ Notify( rBC, rHint )
+
+//-------------------------------------------------------------------------
+
+class SVL_DLLPUBLIC SfxListener
+{
+ SfxBroadcasterArr_Impl aBCs;
+
+private:
+ const SfxListener& operator=(const SfxListener &); // n.i., ist verboten
+
+public:
+ TYPEINFO();
+
+ SfxListener();
+ SfxListener( const SfxListener &rCopy );
+ virtual ~SfxListener();
+
+ sal_Bool StartListening( SfxBroadcaster& rBroadcaster, sal_Bool bPreventDups = sal_False );
+ sal_Bool EndListening( SfxBroadcaster& rBroadcaster, sal_Bool bAllDups = sal_False );
+ void EndListeningAll();
+ sal_Bool IsListening( SfxBroadcaster& rBroadcaster ) const;
+
+ sal_uInt16 GetBroadcasterCount() const
+ { return aBCs.size(); }
+ SfxBroadcaster* GetBroadcasterJOE( sal_uInt16 nNo ) const
+ { return aBCs[nNo]; }
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+#ifndef _NOTIFY_HXX
+ void RemoveBroadcaster_Impl( SfxBroadcaster& rBC );
+#endif
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/macitem.hxx b/include/svl/macitem.hxx
new file mode 100644
index 000000000000..9d73f6a3ded3
--- /dev/null
+++ b/include/svl/macitem.hxx
@@ -0,0 +1,215 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXMACITEM_HXX
+#define _SFXMACITEM_HXX
+
+// class SvxMacroItem ----------------------------------------------------
+
+#include "svl/svldllapi.h"
+#include <svl/poolitem.hxx>
+#include <tools/rtti.hxx>
+#include <tools/debug.hxx>
+#include <tools/string.hxx>
+#include <map>
+
+class SvStream;
+
+#define SVX_MACRO_LANGUAGE_JAVASCRIPT "JavaScript"
+#define SVX_MACRO_LANGUAGE_STARBASIC "StarBasic"
+#define SVX_MACRO_LANGUAGE_SF "Script"
+
+DBG_NAMEEX(SvxMacroItem)
+
+// -----------------------------------------------------------------------
+
+//Ein Macro
+
+enum ScriptType
+{
+ STARBASIC,
+ JAVASCRIPT,
+ EXTENDED_STYPE
+};
+
+// Basisklasse fuer SjJSbxObject mit virtuellem Destruktor
+class SjJSbxObjectBase
+{
+public:
+ virtual ~SjJSbxObjectBase();
+ virtual SjJSbxObjectBase* Clone( void );
+ //virtual SjJSbxObjectBase& operator=( const SjJSbxObjectBase& rBase );
+};
+
+class SjJSbxObject;
+
+class SVL_DLLPUBLIC SvxMacro
+{
+ OUString aMacName;
+ OUString aLibName;
+ // Fuer JavaScript muss ein Function-Objekt gehalten werden
+ SjJSbxObjectBase* pFunctionObject;
+ ScriptType eType;
+
+public:
+
+ SvxMacro( const OUString &rMacName, const OUString &rLanguage);
+
+ SvxMacro( const OUString &rMacName, const OUString &rLibName,
+ ScriptType eType); // = STARBASIC entfernt
+
+ SvxMacro( SjJSbxObjectBase* _pFunctionObject, const OUString &rSource );
+ ~SvxMacro(); // noetig fuer pFunctionObject
+
+ const OUString &GetLibName() const { return aLibName; }
+ const OUString &GetMacName() const { return aMacName; }
+ OUString GetLanguage()const;
+
+ ScriptType GetScriptType() const { return eType; }
+
+ bool HasMacro() const { return !aMacName.isEmpty(); }
+
+#ifdef SOLAR_JAVA
+ // JavaScript-Function-Objekt holen
+ // ACHTUNG: Implementation in SJ, Source/JScript/sjimpl.cxx
+ SjJSbxObjectBase* GetFunctionObject( SjJSbxObject* pParent );
+#endif
+
+ SvxMacro& operator=( const SvxMacro& rBase );
+};
+
+inline SvxMacro::SvxMacro( const OUString &rMacName, const OUString &rLibName,
+ ScriptType eTyp )
+ : aMacName( rMacName ), aLibName( rLibName ), pFunctionObject(NULL), eType( eTyp )
+{}
+
+inline SvxMacro::SvxMacro( SjJSbxObjectBase* _pFunctionObject, const OUString &rSource )
+ : aMacName( rSource ), pFunctionObject( _pFunctionObject ), eType( JAVASCRIPT )
+{}
+
+//Macro Table, zerstoert die Pointer im DTor!
+
+typedef std::map<sal_uInt16, SvxMacro> SvxMacroTable;
+
+#define SVX_MACROTBL_VERSION31 0
+#define SVX_MACROTBL_VERSION40 1
+
+#define SVX_MACROTBL_AKTVERSION SVX_MACROTBL_VERSION40
+
+class SVL_DLLPUBLIC SvxMacroTableDtor
+{
+private:
+ SvxMacroTable aSvxMacroTable;
+public:
+ inline SvxMacroTableDtor() {}
+ inline SvxMacroTableDtor( const SvxMacroTableDtor &rCpy ) : aSvxMacroTable(rCpy.aSvxMacroTable) { }
+
+ SvxMacroTableDtor& operator=( const SvxMacroTableDtor &rCpy );
+ int operator==( const SvxMacroTableDtor& rOther ) const;
+
+ // loescht alle Eintraege
+ void clear() { aSvxMacroTable.clear(); }
+
+ SvStream& Read( SvStream &, sal_uInt16 nVersion = SVX_MACROTBL_AKTVERSION );
+ SvStream& Write( SvStream & ) const;
+
+ sal_uInt16 GetVersion() const { return SVX_MACROTBL_AKTVERSION; }
+
+ SvxMacroTable::iterator begin() { return aSvxMacroTable.begin(); }
+ SvxMacroTable::const_iterator begin() const { return aSvxMacroTable.begin(); }
+ SvxMacroTable::iterator end() { return aSvxMacroTable.end(); }
+ SvxMacroTable::const_iterator end () const { return aSvxMacroTable.end(); }
+ SvxMacroTable::size_type size() const { return aSvxMacroTable.size(); }
+ bool empty() const { return aSvxMacroTable.empty(); }
+
+ // returns NULL if no entry exists, or a pointer to the internal value
+ const SvxMacro* Get(sal_uInt16 nEvent) const;
+ // returns NULL if no entry exists, or a pointer to the internal value
+ SvxMacro* Get(sal_uInt16 nEvent);
+ // return true if the key exists
+ bool IsKeyValid(sal_uInt16 nEvent) const;
+ // This stores a copy of the rMacro parameter
+ SvxMacro& Insert(sal_uInt16 nEvent, const SvxMacro& rMacro);
+ // If the entry exists, remove it from the map and release it's storage
+ sal_Bool Erase(sal_uInt16 nEvent);
+};
+
+
+/*
+[Beschreibung]
+Dieses Item beschreibt eine Makro-Tabelle.
+*/
+
+class SVL_DLLPUBLIC SvxMacroItem: public SfxPoolItem
+{
+public:
+ TYPEINFO();
+
+ explicit inline SvxMacroItem ( const sal_uInt16 nId /*= ITEMID_MACRO*/ );
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper * = 0 ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const;
+
+ inline const SvxMacroTableDtor& GetMacroTable() const { return aMacroTable;}
+ inline void SetMacroTable( const SvxMacroTableDtor& rTbl ) { aMacroTable = rTbl; }
+
+ inline const SvxMacro& GetMacro( sal_uInt16 nEvent ) const;
+ inline sal_Bool HasMacro( sal_uInt16 nEvent ) const;
+ void SetMacro( sal_uInt16 nEvent, const SvxMacro& );
+ inline sal_Bool DelMacro( sal_uInt16 nEvent );
+
+private:
+ SvxMacroTableDtor aMacroTable;
+
+ inline SvxMacroItem( const SvxMacroItem& );
+ SvxMacroItem &operator=( const SvxMacroItem & );
+};
+
+inline SvxMacroItem::SvxMacroItem( const sal_uInt16 nId )
+ : SfxPoolItem( nId )
+{}
+inline SvxMacroItem::SvxMacroItem( const SvxMacroItem &rCpy )
+ : SfxPoolItem( rCpy ),
+ aMacroTable( rCpy.GetMacroTable() )
+{}
+
+inline sal_Bool SvxMacroItem::HasMacro( sal_uInt16 nEvent ) const
+{
+ return aMacroTable.IsKeyValid( nEvent );
+}
+inline const SvxMacro& SvxMacroItem::GetMacro( sal_uInt16 nEvent ) const
+{
+ return *(aMacroTable.Get(nEvent));
+}
+inline sal_Bool SvxMacroItem::DelMacro( sal_uInt16 nEvent )
+{
+ return aMacroTable.Erase(nEvent);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/mailenum.hxx b/include/svl/mailenum.hxx
new file mode 100644
index 000000000000..a01c6bc109ed
--- /dev/null
+++ b/include/svl/mailenum.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _MAILENUM_HXX
+#define _MAILENUM_HXX
+
+// enum ------------------------------------------------------------------
+
+enum MailState
+{
+ MAIL_STATE_SUCCESS = 0,
+ MAIL_STATE_FAILURE,
+ MAIL_STATE_ATTACHED_NOT_FOUND,
+ MAIL_STATE_NO_MEMORY,
+ MAIL_STATE_LOGIN_FAILURE,
+ MAIL_STATE_RECEIVER_NOT_FOUND,
+ MAIL_STATE_TOO_MANY_FILES,
+ MAIL_STATE_TOO_MANY_RECEIVERS,
+ MAIL_STATE_NO_RECEIVERS,
+ MAIL_STATE_USER_CANCEL,
+ MAIL_STATE_DRIVER_NOT_AVAILABLE
+};
+
+enum MailDriver
+{
+ MAIL_DRIVER_DETECT = 0,
+ MAIL_DRIVER_BEGIN,
+ MAIL_DRIVER_VIM = MAIL_DRIVER_BEGIN,
+ MAIL_DRIVER_MAPI,
+ MAIL_DRIVER_CMC,
+ MAIL_DRIVER_SMP,
+ MAIL_DRIVER_UNIX,
+ MAIL_DRIVER_SMTP,
+ MAIL_DRIVER_END
+};
+
+enum MailPriority
+{
+ MAIL_PRIORITY_LOW = 0,
+ MAIL_PRIORITY_NORMAL,
+ MAIL_PRIORITY_URGENT
+};
+
+enum MailReceiverRole
+{
+ MAIL_RECEIVER_TO = 0,
+ MAIL_RECEIVER_CC,
+ MAIL_RECEIVER_BCC,
+ MAIL_RECEIVER_NEWSGROUP
+};
+
+enum MailAction
+{
+ MAIL_ACTION_DYING, // Server stirbt
+ MAIL_ACTION_SEND, // Mail wurde versendet
+ MAIL_ACTION_READ, // Mail wurde als gelesen gekennzeichnet
+ MAIL_ACTION_REMOVED, // Mail wurde gel"oscht
+ MAIL_ACTION_UPDATED, // alle Mails wurden neu eingelesen
+ MAIL_ACTION_NEXT, // Sprung zur n"achsten Mail
+ MAIL_ACTION_PREV // Sprung zur vorherigen Mail
+};
+
+// Textformat zum Versenden von Nachrichten ------------------------------
+
+#define TXTFORMAT_ASCII ((sal_uInt8)0x01)
+#define TXTFORMAT_HTML ((sal_uInt8)0x02)
+#define TXTFORMAT_RTF ((sal_uInt8)0x04)
+#define TXTFORMAT_OFFICE ((sal_uInt8)0x08)
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/memberid.hrc b/include/svl/memberid.hrc
new file mode 100644
index 000000000000..4d501b5ae2ab
--- /dev/null
+++ b/include/svl/memberid.hrc
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _MEMBERID_HRC
+#define _MEMBERID_HRC
+
+
+#define MID_X 1
+#define MID_Y 2
+#define MID_RECT_LEFT 3
+#define MID_RECT_TOP 4
+#define MID_WIDTH 5
+#define MID_HEIGHT 6
+#define MID_RECT_RIGHT 7
+
+// SvxSizeItem
+#define MID_SIZE_SIZE 0
+#define MID_SIZE_WIDTH 1
+#define MID_SIZE_HEIGHT 2
+
+// SvxSearchItem
+#define MID_SEARCH_STYLEFAMILY 1
+#define MID_SEARCH_CELLTYPE 2
+#define MID_SEARCH_ROWDIRECTION 3
+#define MID_SEARCH_ALLTABLES 4
+#define MID_SEARCH_SEARCHFILTERED 5
+#define MID_SEARCH_BACKWARD 6
+#define MID_SEARCH_PATTERN 7
+#define MID_SEARCH_CONTENT 8
+#define MID_SEARCH_ASIANOPTIONS 9
+#define MID_SEARCH_ALGORITHMTYPE 10
+#define MID_SEARCH_FLAGS 11
+#define MID_SEARCH_SEARCHSTRING 12
+#define MID_SEARCH_REPLACESTRING 13
+#define MID_SEARCH_LOCALE 14
+#define MID_SEARCH_CHANGEDCHARS 15
+#define MID_SEARCH_DELETEDCHARS 16
+#define MID_SEARCH_INSERTEDCHARS 17
+#define MID_SEARCH_TRANSLITERATEFLAGS 18
+#define MID_SEARCH_COMMAND 19
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/metitem.hxx b/include/svl/metitem.hxx
new file mode 100644
index 000000000000..090d95450159
--- /dev/null
+++ b/include/svl/metitem.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXMETRICITEM_HXX
+#define _SFXMETRICITEM_HXX
+
+#include "svl/svldllapi.h"
+#include <svl/intitem.hxx>
+
+DBG_NAMEEX_VISIBILITY(SfxMetricItem, SVL_DLLPUBLIC)
+
+// -----------------------------------------------------------------------
+
+class SVL_DLLPUBLIC SfxMetricItem: public SfxInt32Item
+{
+public:
+ TYPEINFO();
+ explicit SfxMetricItem( sal_uInt16 nWhich = 0, sal_uInt32 nValue = 0 );
+ SfxMetricItem( sal_uInt16 nWhich, SvStream & );
+ SfxMetricItem( const SfxMetricItem& );
+ ~SfxMetricItem() {
+ DBG_DTOR(SfxMetricItem, 0); }
+
+ virtual bool ScaleMetrics( long lMult, long lDiv );
+ virtual bool HasMetrics() const;
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/nfkeytab.hxx b/include/svl/nfkeytab.hxx
new file mode 100644
index 000000000000..fdedea036d00
--- /dev/null
+++ b/include/svl/nfkeytab.hxx
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVTOOLS_NFKEYTAB_HXX
+#define INCLUDED_SVTOOLS_NFKEYTAB_HXX
+
+#include <vector>
+#include <tools/string.hxx>
+
+//! For ImpSvNumberformatScan: first the short symbols, then the long symbols!
+//! e.g. first TT then TTTT
+//! The internal order is essentially for the format code string scanner!
+//! New keywords MUST NOT be inserted, only the NF_KEY_UNUSEDn may be used,
+//! NF_KEY_LASTKEYWORD must be adjusted accordingly. Otherwise old versions
+//! will fail upon reading these entries. Nevertheless, old versions are NOT
+//! able to display those new keywords => blank display.
+//
+// Note: 2005-09-02: the above applies to the binary file format.
+//
+// ER 15.12.99: This table is externally only to be used with method
+// String SvNumberformat::GetMappedFormatstring( const NfKeywordTable&, const LocaleDataWrapper& );
+// and method
+// void SvNumberFormatter::FillKeywordTable( NfKeywordTable&, LanguageType );
+enum NfKeywordIndex
+{
+ NF_KEY_NONE = 0,
+ NF_KEY_E, // exponential symbol
+ NF_KEY_AMPM, // AM/PM
+ NF_KEY_AP, // a/p
+ NF_KEY_MI, // minute (!)
+ NF_KEY_MMI, // minute 02 (!)
+ NF_KEY_M, // month (!)
+ NF_KEY_MM, // month 02 (!)
+ NF_KEY_MMM, // month short name
+ NF_KEY_MMMM, // month long name
+ NF_KEY_H, // hour
+ NF_KEY_HH, // hour 02
+ NF_KEY_S, // second
+ NF_KEY_SS, // second 02
+ NF_KEY_Q, // quarter
+ NF_KEY_QQ, // quarter 02
+ NF_KEY_D, // day of month
+ NF_KEY_DD, // day of month 02
+ NF_KEY_DDD, // day of week short
+ NF_KEY_DDDD, // day of week long
+ NF_KEY_YY, // year two digits
+ NF_KEY_YYYY, // year four digits
+ NF_KEY_NN, // day of week short
+ NF_KEY_NNNN, // day of week long with separator
+ NF_KEY_CCC, // currency bank symbol (old version)
+ NF_KEY_GENERAL, // General / Standard
+ NF_KEY_LASTOLDKEYWORD = NF_KEY_GENERAL,
+ NF_KEY_NNN, // day of week long without separator, as of version 6, 10.10.97
+ NF_KEY_WW, // week of year, as of version 8, 19.06.98
+ NF_KEY_MMMMM, // first letter of month name
+ NF_KEY_LASTKEYWORD = NF_KEY_MMMMM,
+ NF_KEY_UNUSED4,
+ NF_KEY_QUARTER, // was quarter word, not used anymore from SRC631 on (26.04.01)
+ NF_KEY_TRUE, // boolean true
+ NF_KEY_FALSE, // boolean false
+ NF_KEY_BOOLEAN, // boolean
+ NF_KEY_COLOR, // color
+ NF_KEY_FIRSTCOLOR,
+ NF_KEY_BLACK = NF_KEY_FIRSTCOLOR, // you do know colors, don't you?
+ NF_KEY_BLUE,
+ NF_KEY_GREEN,
+ NF_KEY_CYAN,
+ NF_KEY_RED,
+ NF_KEY_MAGENTA,
+ NF_KEY_BROWN,
+ NF_KEY_GREY,
+ NF_KEY_YELLOW,
+ NF_KEY_WHITE,
+ NF_KEY_LASTCOLOR = NF_KEY_WHITE,
+ NF_KEY_LASTKEYWORD_SO5 = NF_KEY_LASTCOLOR,
+ //! Keys from here on can't be saved in SO5 file format and MUST be
+ //! converted to string which means losing any information.
+ NF_KEY_AAA, // abbreviated day name from Japanese Xcl, same as DDD or NN English
+ NF_KEY_AAAA, // full day name from Japanese Xcl, same as DDDD or NNN English
+ NF_KEY_EC, // E non-gregorian calendar year without preceding 0
+ NF_KEY_EEC, // EE non-gregorian calendar year with preceding 0 (two digit)
+ NF_KEY_G, // abbreviated era name, latin characters M T S or H for Gengou calendar
+ NF_KEY_GG, // abbreviated era name
+ NF_KEY_GGG, // full era name
+ NF_KEY_R, // acts as EE (Xcl) => GR==GEE, GGR==GGEE, GGGR==GGGEE
+ NF_KEY_RR, // acts as GGGEE (Xcl)
+ NF_KEY_THAI_T, // Thai T modifier, speciality of Thai Excel, only used with Thai locale and converted to [NatNum1]
+ NF_KEYWORD_ENTRIES_COUNT
+};
+
+class NfKeywordTable
+{
+ typedef ::std::vector<OUString> Keywords_t;
+ Keywords_t m_keywords;
+
+public:
+ NfKeywordTable() : m_keywords(NF_KEYWORD_ENTRIES_COUNT) {};
+ virtual ~NfKeywordTable() {}
+
+ OUString & operator[] (Keywords_t::size_type n) { return m_keywords[n]; }
+ const OUString & operator[] (Keywords_t::size_type n) const { return m_keywords[n]; }
+};
+
+#endif // INCLUDED_SVTOOLS_NFKEYTAB_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/nfsymbol.hxx b/include/svl/nfsymbol.hxx
new file mode 100644
index 000000000000..0edfc33e112d
--- /dev/null
+++ b/include/svl/nfsymbol.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVTOOLS_NFSYMBOL_HXX
+#define INCLUDED_SVTOOLS_NFSYMBOL_HXX
+
+/* ATTENTION! If new types arrive that had its content previously handled as
+ * SYMBOLTYPE_STRING, they have to be added at several places in zforscan.cxx
+ * and/or zformat.cxx, and in xmloff/source/style/xmlnumfe.cxx. Mostly these
+ * are places where already NF_SYMBOLTYPE_STRING together with
+ * NF_SYMBOLTYPE_CURRENCY or NF_SYMBOLTYPE_DATESEP are used in the same case of
+ * a switch respectively an if-condition.
+ */
+
+namespace svt {
+
+/// Number formatter's symbol types of a token, if not key words, which are >0
+enum NfSymbolType
+{
+ NF_SYMBOLTYPE_STRING = -1, // literal string in output
+ NF_SYMBOLTYPE_DEL = -2, // special character
+ NF_SYMBOLTYPE_BLANK = -3, // blank for '_'
+ NF_SYMBOLTYPE_STAR = -4, // *-character
+ NF_SYMBOLTYPE_DIGIT = -5, // digit place holder
+ NF_SYMBOLTYPE_DECSEP = -6, // decimal separator
+ NF_SYMBOLTYPE_THSEP = -7, // group AKA thousand separator
+ NF_SYMBOLTYPE_EXP = -8, // exponent E
+ NF_SYMBOLTYPE_FRAC = -9, // fraction /
+ NF_SYMBOLTYPE_EMPTY = -10, // deleted symbols
+ NF_SYMBOLTYPE_FRACBLANK = -11, // delimiter between integer and fraction
+ NF_SYMBOLTYPE_CURRENCY = -12, // currency symbol
+ NF_SYMBOLTYPE_CURRDEL = -13, // currency symbol delimiter [$]
+ NF_SYMBOLTYPE_CURREXT = -14, // currency symbol extension -xxx
+ NF_SYMBOLTYPE_CALENDAR = -15, // calendar ID
+ NF_SYMBOLTYPE_CALDEL = -16, // calendar delimiter [~]
+ NF_SYMBOLTYPE_DATESEP = -17, // date separator
+ NF_SYMBOLTYPE_TIMESEP = -18, // time separator
+ NF_SYMBOLTYPE_TIME100SECSEP = -19, // time 100th seconds separator
+ NF_SYMBOLTYPE_PERCENT = -20, // percent %
+ NF_SYMBOLTYPE_FRAC_FDIV = -21 // forced divisors
+};
+
+} // namespace svt
+
+#endif // INCLUDED_SVTOOLS_NFSYMBOL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/nfversi.hxx b/include/svl/nfversi.hxx
new file mode 100644
index 000000000000..3e86af078fe4
--- /dev/null
+++ b/include/svl/nfversi.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef NF_NFVERSI_HXX
+#define NF_NFVERSI_HXX
+
+// file IDs
+
+#define SV_NUMBERFORMATTER_VERSION_SYSTORE 0x0004
+#define SV_NUMBERFORMATTER_VERSION_KEYWORDS 0x0005
+#define SV_NUMBERFORMATTER_VERSION_NEWSTANDARD 0x0006
+#define SV_NUMBERFORMATTER_VERSION_NF_TIME_HH_MMSS00 0x0007
+#define SV_NUMBERFORMATTER_VERSION_NF_DATE_WW 0x0008
+#define SV_NUMBERFORMATTER_VERSION_NEW_CURR 0x0009
+#define SV_NUMBERFORMATTER_VERSION_YEAR2000 0x000a
+#define SV_NUMBERFORMATTER_VERSION_TWODIGITYEAR 0x000b
+#define SV_NUMBERFORMATTER_VERSION_NF_DATETIME_SYS_DDMMYYYY_HHMMSS 0x000c
+#define SV_NUMBERFORMATTER_VERSION_CALENDAR 0x000d
+#define SV_NUMBERFORMATTER_VERSION_ADDITIONAL_I18N_FORMATS 0x000e
+#define SV_NUMBERFORMATTER_VERSION_FIXED_FRACTION 0x000f
+
+#define SV_NUMBERFORMATTER_VERSION 0x000f
+
+// 1 to 1996-01-18
+// 2 1996-01-19 added TT.MM.JJJJ
+// 3 1996-02-13 (not emergency) added #.##0,00 CCC
+// 4 1997-07-30 364i store what SYSTEM actually was (using existing
+// Dummy field, no change of file format)
+// 5 1997-08-07 non-German is not always English
+// convert older non-German user defined formats on load
+// 6 1997-10-17 new keyword NNN for long weekday without separator
+// not evaluated in older versions!
+// New standard date formats, DIN, EN etc.
+// 7 1998-05-25 Standard format [HH]:MM:SS,00 (NF_TIME_HH_MMSS00) for
+// automatic input recognition of 100th seconds with hours
+// 8 1998-06-10 Standard format WW (NF_DATE_WW) for calendar week
+// 9 1998-12-17 new currency formats [$DM-xxx]
+// A 1999-01-25 store/load Year2000
+// B 1999-02-12 Year2000 is general TwoDigitYearStart
+// C ????-??-?? date/time format of system variables
+// D 2000-11-23 new calendar
+// E 2001-01-19 additional formats provided by i18n
+// F 2012-04-27 fixed fraction formats ?/4 and ??/100, actually added
+// already 2010/2011 but without versioning
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/nranges.hxx b/include/svl/nranges.hxx
new file mode 100644
index 000000000000..364bf59a44f2
--- /dev/null
+++ b/include/svl/nranges.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifdef MACOSX
+// We need an empty block in here. Otherwise, if the #ifndef _SFXNRANGES_HXX
+// line is the first line, the Mac OS X version of the gcc preprocessor will
+// incorrectly optimize the inclusion process and will never include this file
+// a second time
+#endif
+
+#ifndef _SFXNRANGES_HXX
+#define _SFXNRANGES_HXX
+
+#include <tools/solar.h>
+
+//========================================================================
+
+class SfxUShortRanges
+{
+ sal_uInt16* _pRanges; // 0-terminated array of sal_uInt16-pairs
+
+public:
+ SfxUShortRanges() : _pRanges( 0 ) {}
+ SfxUShortRanges( const SfxUShortRanges &rOrig );
+ SfxUShortRanges( sal_uInt16 nWhich1, sal_uInt16 nWhich2 );
+ SfxUShortRanges( const sal_uInt16* nNumTable );
+ ~SfxUShortRanges()
+ { delete [] _pRanges; }
+
+ sal_Bool operator == ( const SfxUShortRanges & ) const;
+ sal_Bool operator != ( const SfxUShortRanges & rRanges ) const
+ { return !( *this == rRanges ); }
+
+ SfxUShortRanges& operator = ( const SfxUShortRanges & );
+
+ SfxUShortRanges& operator += ( const SfxUShortRanges & );
+ SfxUShortRanges& operator -= ( const SfxUShortRanges & );
+ SfxUShortRanges& operator /= ( const SfxUShortRanges & );
+
+ sal_uInt16 Count() const;
+ sal_Bool IsEmpty() const
+ { return !_pRanges || 0 == *_pRanges; }
+
+ operator const sal_uInt16* () const
+ { return _pRanges; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/numuno.hxx b/include/svl/numuno.hxx
new file mode 100644
index 000000000000..515a73fb26a6
--- /dev/null
+++ b/include/svl/numuno.hxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _NUMUNO_HXX
+#define _NUMUNO_HXX
+
+#include "svl/svldllapi.h"
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <cppuhelper/implbase2.hxx>
+
+class SvNumberFormatter;
+class SvNumFmtSuppl_Impl;
+
+namespace comphelper
+{
+ class SharedMutex;
+}
+
+//------------------------------------------------------------------
+
+// SvNumberFormatterServiceObj must be registered as service somewhere
+
+com::sun::star::uno::Reference<com::sun::star::uno::XInterface> SAL_CALL
+ SvNumberFormatterServiceObj_NewInstance(
+ const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory>& rSMgr );
+
+//------------------------------------------------------------------
+
+// SvNumberFormatsSupplierObj: aggregate to document,
+// construct with SvNumberFormatter
+
+class SVL_DLLPUBLIC SvNumberFormatsSupplierObj : public cppu::WeakAggImplHelper2<
+ com::sun::star::util::XNumberFormatsSupplier,
+ com::sun::star::lang::XUnoTunnel>
+{
+private:
+ SvNumFmtSuppl_Impl* pImpl;
+
+public:
+ SvNumberFormatsSupplierObj();
+ SvNumberFormatsSupplierObj(SvNumberFormatter* pForm);
+ virtual ~SvNumberFormatsSupplierObj();
+
+ void SetNumberFormatter(SvNumberFormatter* pNew);
+ SvNumberFormatter* GetNumberFormatter() const;
+
+ // ueberladen, um Attribute im Dokument anzupassen
+ virtual void NumberFormatDeleted(sal_uInt32 nKey);
+ // ueberladen, um evtl. neu zu formatieren
+ virtual void SettingsChanged();
+
+ // XNumberFormatsSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL
+ getNumberFormatSettings()
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats > SAL_CALL
+ getNumberFormats()
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence<
+ sal_Int8 >& aIdentifier )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId();
+ static SvNumberFormatsSupplierObj* getImplementation( const com::sun::star::uno::Reference<
+ com::sun::star::util::XNumberFormatsSupplier> xObj );
+
+ ::comphelper::SharedMutex& getSharedMutex() const;
+};
+
+#endif // #ifndef _NUMUNO_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/ondemand.hxx b/include/svl/ondemand.hxx
new file mode 100644
index 000000000000..b3a2c42e11e6
--- /dev/null
+++ b/include/svl/ondemand.hxx
@@ -0,0 +1,384 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVTOOLS_ONDEMAND_HXX
+#define INCLUDED_SVTOOLS_ONDEMAND_HXX
+
+#include <unotools/syslocale.hxx>
+#include <i18nlangtag/lang.h>
+#include <unotools/localedatawrapper.hxx>
+#include <unotools/calendarwrapper.hxx>
+#include <unotools/collatorwrapper.hxx>
+#include <com/sun/star/i18n/CollatorOptions.hpp>
+#include <unotools/transliterationwrapper.hxx>
+#include <com/sun/star/i18n/TransliterationModules.hpp>
+#include <unotools/nativenumberwrapper.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <comphelper/processfactory.hxx>
+
+/*
+ On demand instanciation and initialization of several i18n wrappers,
+ helping the number formatter to not perform worse than it already does.
+ */
+
+/** @short
+ Switch between LANGUAGE_SYSTEM and LANGUAGE_ENGLISH_US and any other
+ LocaleDataWrapper.
+ SvNumberformatter uses it upon switching locales.
+
+ @descr
+ Avoids reloading and analysing of locale data again and again.
+
+ @ATTENTION
+ If the default ctor is used the init() method MUST be called before
+ accessing any locale data. The passed parameters Locale and LanguageType
+ must match each other.
+ */
+
+class OnDemandLocaleDataWrapper
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+ SvtSysLocale aSysLocale;
+ LanguageType eCurrentLanguage;
+ LanguageType eLastAnyLanguage;
+ const LocaleDataWrapper* pSystem;
+ const LocaleDataWrapper* pEnglish;
+ LocaleDataWrapper* pAny;
+ const LocaleDataWrapper* pCurrent;
+ bool bInitialized;
+
+public:
+ OnDemandLocaleDataWrapper()
+ : eLastAnyLanguage( LANGUAGE_DONTKNOW )
+ , pEnglish(0)
+ , pAny(0)
+ , bInitialized(false)
+ {
+ pCurrent = pSystem = aSysLocale.GetLocaleDataPtr();
+ eCurrentLanguage = LANGUAGE_SYSTEM;
+ }
+ OnDemandLocaleDataWrapper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const LanguageTag& rLanguageTag
+ )
+ : pEnglish(0)
+ , pAny(0)
+ , pCurrent(0)
+ , bInitialized(false)
+ {
+ pSystem = aSysLocale.GetLocaleDataPtr();
+ init( rxContext, rLanguageTag );
+ }
+ ~OnDemandLocaleDataWrapper()
+ {
+ delete pEnglish;
+ delete pAny;
+ }
+
+ bool isInitialized() const { return bInitialized; }
+
+ bool is() const { return pCurrent != NULL; }
+
+ void init(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const LanguageTag& rLanguageTag
+ )
+ {
+ m_xContext = rxContext;
+ changeLocale( rLanguageTag );
+ bInitialized = true;
+ }
+
+ void changeLocale( const LanguageTag& rLanguageTag )
+ {
+ LanguageType eLang = rLanguageTag.getLanguageType( false);
+ switch ( eLang )
+ {
+ case LANGUAGE_SYSTEM :
+ pCurrent = pSystem;
+ break;
+ case LANGUAGE_ENGLISH_US :
+ if ( !pEnglish )
+ pEnglish = new LocaleDataWrapper( m_xContext, rLanguageTag );
+ pCurrent = pEnglish;
+ break;
+ default:
+ if ( !pAny )
+ {
+ pAny = new LocaleDataWrapper( m_xContext, rLanguageTag );
+ eLastAnyLanguage = eLang;
+ }
+ else if ( eLastAnyLanguage != eLang )
+ {
+ pAny->setLanguageTag( rLanguageTag );
+ eLastAnyLanguage = eLang;
+ }
+ pCurrent = pAny;
+ }
+ eCurrentLanguage = eLang;
+ }
+
+ LanguageType getCurrentLanguage() const
+ { return eCurrentLanguage; }
+
+ LocaleDataWrapper* getAnyLocale()
+ {
+ if ( !pAny )
+ {
+ pAny = new LocaleDataWrapper( m_xContext, pCurrent->getLanguageTag() );
+ eLastAnyLanguage = eCurrentLanguage;
+ }
+ else if ( pCurrent != pAny )
+ {
+ pAny->setLanguageTag( pCurrent->getLanguageTag() );
+ eLastAnyLanguage = eCurrentLanguage;
+ }
+ return pAny;
+ }
+
+ const LocaleDataWrapper* get() const { return pCurrent; }
+ const LocaleDataWrapper* operator->() const { return get(); }
+ const LocaleDataWrapper& operator*() const { return *get(); }
+};
+
+/** Load a calendar only if it's needed.
+ SvNumberformatter uses it upon switching locales.
+ @ATTENTION If the default ctor is used the init() method MUST be called
+ before accessing the calendar.
+ */
+class OnDemandCalendarWrapper
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+ ::com::sun::star::lang::Locale aLocale;
+ mutable CalendarWrapper* pPtr;
+ mutable bool bValid;
+ bool bInitialized;
+
+public:
+ OnDemandCalendarWrapper()
+ : pPtr(0)
+ , bValid(false)
+ , bInitialized(false)
+ {}
+ OnDemandCalendarWrapper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ ::com::sun::star::lang::Locale& rLocale
+ )
+ : bValid(false)
+ , bInitialized(false)
+ {
+ init( rxContext, rLocale );
+ }
+ ~OnDemandCalendarWrapper()
+ {
+ delete pPtr;
+ }
+
+ bool isInitialized() const { return bInitialized; }
+
+ bool is() const { return pPtr != NULL; }
+
+ void init(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::lang::Locale& rLocale
+ )
+ {
+ m_xContext = rxContext;
+ changeLocale( rLocale );
+ if ( pPtr )
+ {
+ delete pPtr;
+ pPtr = NULL;
+ }
+ bInitialized = true;
+ }
+
+ void changeLocale( const ::com::sun::star::lang::Locale& rLocale )
+ {
+ bValid = false;
+ aLocale = rLocale;
+ }
+
+ CalendarWrapper* get() const
+ {
+ if ( !bValid )
+ {
+ if ( !pPtr )
+ pPtr = new CalendarWrapper( m_xContext );
+ pPtr->loadDefaultCalendar( aLocale );
+ bValid = true;
+ }
+ return pPtr;
+ }
+
+ CalendarWrapper* operator->() { return get(); }
+ CalendarWrapper& operator*() { return *get(); }
+};
+
+/** Load a transliteration only if it's needed.
+ SvNumberformatter uses it upon switching locales.
+ @ATTENTION If the default ctor is used the init() method MUST be called
+ before accessing the transliteration.
+ */
+class OnDemandTransliterationWrapper
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+ LanguageType eLanguage;
+ ::com::sun::star::i18n::TransliterationModules nType;
+ mutable ::utl::TransliterationWrapper* pPtr;
+ mutable bool bValid;
+ bool bInitialized;
+
+public:
+ OnDemandTransliterationWrapper()
+ : eLanguage( LANGUAGE_SYSTEM )
+ , pPtr(0)
+ , bValid(false)
+ , bInitialized(false)
+ {}
+ OnDemandTransliterationWrapper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ LanguageType eLang,
+ ::com::sun::star::i18n::TransliterationModules nTypeP
+ )
+ : bValid(false)
+ , bInitialized(false)
+ {
+ init( rxContext, eLang, nTypeP );
+ }
+ ~OnDemandTransliterationWrapper()
+ {
+ delete pPtr;
+ }
+
+ bool isInitialized() const { return bInitialized; }
+
+ bool is() const { return pPtr != NULL; }
+
+ void init(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ LanguageType eLang,
+ ::com::sun::star::i18n::TransliterationModules nTypeP
+ )
+ {
+ m_xContext = rxContext;
+ nType = nTypeP;
+ changeLocale( eLang );
+ if ( pPtr )
+ {
+ delete pPtr;
+ pPtr = NULL;
+ }
+ bInitialized = true;
+ }
+
+ void changeLocale( LanguageType eLang )
+ {
+ bValid = false;
+ eLanguage = eLang;
+ }
+
+ const ::utl::TransliterationWrapper* get() const
+ {
+ if ( !bValid )
+ {
+ if ( !pPtr )
+ pPtr = new ::utl::TransliterationWrapper( m_xContext, nType );
+ pPtr->loadModuleIfNeeded( eLanguage );
+ bValid = true;
+ }
+ return pPtr;
+ }
+
+ const ::utl::TransliterationWrapper* getForModule( const String& rModule, LanguageType eLang ) const
+ {
+ if ( !pPtr )
+ pPtr = new ::utl::TransliterationWrapper( m_xContext, nType );
+ pPtr->loadModuleByImplName( rModule, eLang );
+ bValid = false; // reforce settings change in get()
+ return pPtr;
+ }
+
+ const ::utl::TransliterationWrapper* operator->() const { return get(); }
+ const ::utl::TransliterationWrapper& operator*() const { return *get(); }
+};
+
+/** Load a native number service wrapper only if it's needed.
+ SvNumberformatter uses it.
+
+ @ATTENTION
+ If the default ctor is used the init() method MUST be called
+ before accessing the native number supplier.
+ */
+class OnDemandNativeNumberWrapper
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+ mutable NativeNumberWrapper* pPtr;
+ bool bInitialized;
+
+public:
+ OnDemandNativeNumberWrapper()
+ : pPtr(0)
+ , bInitialized(false)
+ {}
+ OnDemandNativeNumberWrapper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
+ )
+ : pPtr(0)
+ , bInitialized(false)
+ {
+ init( rxContext );
+ }
+ ~OnDemandNativeNumberWrapper()
+ {
+ delete pPtr;
+ }
+
+ bool isInitialized() const { return bInitialized; }
+
+ void init(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
+ )
+ {
+ m_xContext = rxContext;
+ if ( pPtr )
+ {
+ delete pPtr;
+ pPtr = NULL;
+ }
+ bInitialized = true;
+ }
+
+ bool is() const { return pPtr != NULL; }
+
+ NativeNumberWrapper* get() const
+ {
+ if ( !pPtr )
+ pPtr = new NativeNumberWrapper( m_xContext );
+ return pPtr;
+ }
+
+ NativeNumberWrapper* operator->() { return get(); }
+ NativeNumberWrapper& operator*() { return *get(); }
+};
+
+#endif // INCLUDED_SVTOOLS_ONDEMAND_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/outstrm.hxx b/include/svl/outstrm.hxx
new file mode 100644
index 000000000000..31899599fc90
--- /dev/null
+++ b/include/svl/outstrm.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVTOOLS_OUTSTRM_HXX
+#define SVTOOLS_OUTSTRM_HXX
+
+#include "svl/svldllapi.h"
+#include <com/sun/star/uno/Reference.h>
+#include <tools/stream.hxx>
+
+namespace com { namespace sun { namespace star { namespace io {
+ class XOutputStream;
+} } } }
+
+//============================================================================
+class SVL_DLLPUBLIC SvOutputStream: public SvStream
+{
+ com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >
+ m_xStream;
+
+ SVL_DLLPRIVATE virtual sal_uLong GetData(void *, sal_uLong);
+
+ SVL_DLLPRIVATE virtual sal_uLong PutData(void const * pData, sal_uLong nSize);
+
+ SVL_DLLPRIVATE virtual sal_uLong SeekPos(sal_uLong);
+
+ SVL_DLLPRIVATE virtual void FlushData();
+
+ SVL_DLLPRIVATE virtual void SetSize(sal_uLong);
+
+public:
+ SvOutputStream(com::sun::star::uno::Reference<
+ com::sun::star::io::XOutputStream > const &
+ rTheStream);
+
+ virtual ~SvOutputStream();
+
+ virtual sal_uInt16 IsA() const;
+};
+
+#endif // SVTOOLS_OUTSTRM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/ownlist.hxx b/include/svl/ownlist.hxx
new file mode 100644
index 000000000000..e4cead159c8b
--- /dev/null
+++ b/include/svl/ownlist.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _OWNLIST_HXX
+#define _OWNLIST_HXX
+
+#include "svl/svldllapi.h"
+#include <com/sun/star/uno/Sequence.hxx>
+#include <vector>
+
+namespace com { namespace sun { namespace star {
+ namespace beans {
+ struct PropertyValue;
+ }
+}}}
+
+//=========================================================================
+class SvCommand
+/* [Beschreibung]
+
+ Enth"alt einen String, welcher das Kommando angibt und eine weiteren
+ String, der das Argument des Kommandos bildet. W"urde solch ein
+ Kommando "uber die Kommandozeile angegeben werden, s"ahe es wie folgt
+ aus: Kommando = Argument.
+*/
+{
+ OUString aCommand;
+ OUString aArgument;
+public:
+ SvCommand() {}
+ SvCommand( const OUString & rCommand, const OUString & rArg )
+ {
+ aCommand = rCommand;
+ aArgument = rArg;
+ }
+ const OUString & GetCommand() const { return aCommand; }
+ const OUString & GetArgument() const { return aArgument; }
+};
+
+typedef ::std::vector< SvCommand > SvCommandList_impl;
+
+//=========================================================================
+class SVL_DLLPUBLIC SvCommandList
+/* [Beschreibung]
+
+ Die Liste enth"alt Objekte vom Typ SvCommand. Wird ein Objekt
+ eingef"ugt, dann wird es kopiert und das neue Objekt wird
+ in die Liste gestellt.
+*/
+{
+private:
+ SvCommandList_impl aCommandList;
+
+public:
+ SvCommand& Append( const OUString & rCommand, const OUString & rArg );
+ bool AppendCommands( const OUString & rCmd, sal_Int32 * pEaten );
+
+ bool FillFromSequence( const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& );
+ void FillSequence( com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& );
+
+ size_t size() const { return aCommandList.size(); }
+
+ SvCommand operator[]( size_t i) {
+ return aCommandList[ i ];
+ }
+
+ void clear() {
+ aCommandList.clear();
+ }
+};
+
+#endif // _OWNLIST_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/pickerhistoryaccess.hxx b/include/svl/pickerhistoryaccess.hxx
new file mode 100644
index 000000000000..5f91d3578f9a
--- /dev/null
+++ b/include/svl/pickerhistoryaccess.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVTOOLS_PICKERHISTORYACCESS_HXX
+#define SVTOOLS_PICKERHISTORYACCESS_HXX
+
+#include "svl/svldllapi.h"
+
+#include <com/sun/star/uno/Reference.hxx>
+
+//.........................................................................
+namespace svt
+{
+//.........................................................................
+
+ // --------------------------------------------------------------------
+ SVL_DLLPUBLIC void addFolderPicker(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxPicker );
+
+ SVL_DLLPUBLIC void addFilePicker(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxPicker );
+
+//.........................................................................
+} // namespace svt
+//.........................................................................
+
+#endif // SVTOOLS_PICKERHISTORYACCESS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/poolcach.hxx b/include/svl/poolcach.hxx
new file mode 100644
index 000000000000..eaf6ad3deef9
--- /dev/null
+++ b/include/svl/poolcach.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXPOOLCACH_HXX
+#define _SFXPOOLCACH_HXX
+
+#include "svl/svldllapi.h"
+#include <tools/solar.h>
+#include <vector>
+
+//------------------------------------------------------------------------
+
+class SfxItemPool;
+class SfxItemSet;
+class SfxPoolItem;
+class SfxSetItem;
+
+struct SfxItemModifyImpl
+{
+ const SfxSetItem *pOrigItem;
+ SfxSetItem *pPoolItem;
+};
+
+typedef std::vector<SfxItemModifyImpl> SfxItemModifyArr_Impl;
+
+
+class SVL_DLLPUBLIC SfxItemPoolCache
+{
+ SfxItemPool *pPool;
+ SfxItemModifyArr_Impl *pCache;
+ const SfxItemSet *pSetToPut;
+ const SfxPoolItem *pItemToPut;
+
+public:
+ SfxItemPoolCache( SfxItemPool *pPool,
+ const SfxPoolItem *pPutItem );
+ SfxItemPoolCache( SfxItemPool *pPool,
+ const SfxItemSet *pPutSet );
+ ~SfxItemPoolCache();
+
+ const SfxSetItem& ApplyTo( const SfxSetItem& rSetItem, sal_Bool bNew = sal_False );
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/poolitem.hxx b/include/svl/poolitem.hxx
new file mode 100644
index 000000000000..5e041825186a
--- /dev/null
+++ b/include/svl/poolitem.hxx
@@ -0,0 +1,415 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXPOOLITEM_HXX
+#define _SFXPOOLITEM_HXX
+
+#include "svl/svldllapi.h"
+#include <com/sun/star/uno/Any.hxx>
+
+#include <sal/config.h>
+#include <tools/rtti.hxx>
+#include <limits.h>
+#include <tools/solar.h>
+#include <tools/debug.hxx>
+#include <tools/string.hxx>
+#include <svl/hint.hxx>
+
+typedef long SfxArgumentError;
+
+class SbxVariable;
+class SbxObject;
+class SvStream;
+class Color;
+class IntlWrapper;
+
+namespace com { namespace sun { namespace star { namespace uno { class Any; } } } }
+
+static const sal_uInt32 SFX_ITEMS_DIRECT= 0xffffffff;
+static const sal_uInt32 SFX_ITEMS_NULL= 0xfffffff0; // instead StoreSurrogate
+static const sal_uInt32 SFX_ITEMS_DEFAULT= 0xfffffffe;
+
+#define SFX_ITEMS_POOLDEFAULT 0xffff
+#define SFX_ITEMS_STATICDEFAULT 0xfffe
+#define SFX_ITEMS_DELETEONIDLE 0xfffd
+
+#define SFX_ITEMS_OLD_MAXREF 0xffef
+#define SFX_ITEMS_MAXREF 0xfffffffe
+#define SFX_ITEMS_SPECIAL 0xffffffff
+
+#define CONVERT_TWIPS 0x80 //Uno-Konvertierung fuer Massangaben (fuer MemberId)
+
+// -----------------------------------------------------------------------
+
+// UNO3 shortcuts
+
+// warning, if there is no boolean inside the any this will always return the value false
+inline sal_Bool Any2Bool( const ::com::sun::star::uno::Any&rValue )
+{
+ sal_Bool nValue = sal_False;
+ if( rValue.hasValue() )
+ {
+ if( rValue.getValueType() == ::getCppuBooleanType() )
+ {
+ nValue = *(sal_Bool*)rValue.getValue();
+ }
+ else
+ {
+ sal_Int32 nNum = 0;
+ if( rValue >>= nNum )
+ nValue = nNum != 0;
+ }
+ }
+
+ return nValue;
+}
+
+inline ::com::sun::star::uno::Any Bool2Any( sal_Bool bValue )
+{
+ return ::com::sun::star::uno::Any( &bValue, ::getCppuBooleanType() );
+}
+
+// -----------------------------------------------------------------------
+
+//! Notloesung!!!
+enum SfxFieldUnit
+{
+ SFX_FUNIT_NONE, SFX_FUNIT_MM, SFX_FUNIT_CM, SFX_FUNIT_M, SFX_FUNIT_KM,
+ SFX_FUNIT_TWIP, SFX_FUNIT_POINT, SFX_FUNIT_PICA,
+ SFX_FUNIT_INCH, SFX_FUNIT_FOOT, SFX_FUNIT_MILE, SFX_FUNIT_CHAR, SFX_FUNIT_LINE, SFX_FUNIT_CUSTOM
+};
+
+enum SfxMapUnit
+{
+ SFX_MAPUNIT_100TH_MM,
+ SFX_MAPUNIT_10TH_MM,
+ SFX_MAPUNIT_MM,
+ SFX_MAPUNIT_CM,
+ SFX_MAPUNIT_1000TH_INCH,
+ SFX_MAPUNIT_100TH_INCH,
+ SFX_MAPUNIT_10TH_INCH,
+ SFX_MAPUNIT_INCH,
+ SFX_MAPUNIT_POINT,
+ SFX_MAPUNIT_TWIP,
+ SFX_MAPUNIT_PIXEL,
+ SFX_MAPUNIT_SYSFONT,
+ SFX_MAPUNIT_APPFONT,
+ SFX_MAPUNIT_RELATIVE,
+ SFX_MAPUNIT_ABSOLUTE
+};
+
+// -----------------------------------------------------------------------
+
+enum SfxItemPresentation
+
+/* [Beschreibung]
+
+ Die Werte dieses Enums bezeichnen den Grad der textuellen
+ Presentation eines Items nach Aufruf der virtuellen Methode
+ <SfxPoolItem::GetPresentation()const>.
+*/
+
+{
+ SFX_ITEM_PRESENTATION_NONE,
+ SFX_ITEM_PRESENTATION_NAMEONLY,
+ SFX_ITEM_PRESENTATION_NAMELESS,
+ SFX_ITEM_PRESENTATION_COMPLETE
+};
+
+// -----------------------------------------------------------------------
+
+typedef sal_uInt16 SfxItemState;
+
+#define SFX_ITEM_UNKNOWN 0x0000
+
+#define SFX_ITEM_DISABLED 0x0001
+#define SFX_ITEM_READONLY 0x0002
+
+#define SFX_ITEM_DONTCARE 0x0010
+#define SFX_ITEM_DEFAULT 0x0020
+#define SFX_ITEM_SET 0x0030
+
+// old stuff - dont use!!!
+#define SFX_ITEM_AVAILABLE SFX_ITEM_DEFAULT
+#define SFX_ITEM_OFF SFX_ITEM_DEFAULT
+#define SFX_ITEM_ON SFX_ITEM_SET
+
+DBG_NAMEEX_VISIBILITY(SfxPoolItem, SVL_DLLPUBLIC)
+DBG_NAMEEX(SfxVoidItem)
+DBG_NAMEEX(SfxItemHandle)
+
+class SvXMLUnitConverter;
+class SfxItemPool;
+class SfxItemSet;
+
+
+// -----------------------------------------------------------------------
+
+class SVL_DLLPUBLIC SfxPoolItem
+{
+friend class SfxItemPool;
+friend class SfxItemDesruptor_Impl;
+friend class SfxItemPoolCache;
+friend class SfxItemSet;
+friend class SfxVoidItem;
+
+ sal_uLong m_nRefCount;
+ sal_uInt16 m_nWhich;
+ sal_uInt16 m_nKind;
+
+private:
+ inline void SetRefCount( sal_uLong n );
+ inline void SetKind( sal_uInt16 n );
+public:
+ inline sal_uLong AddRef( sal_uLong n = 1 ) const;
+private:
+ inline sal_uLong ReleaseRef( sal_uLong n = 1 ) const;
+ SVL_DLLPRIVATE long Delete_Impl(void*);
+
+protected:
+ explicit SfxPoolItem( sal_uInt16 nWhich = 0 );
+ SfxPoolItem( const SfxPoolItem& );
+
+public:
+ TYPEINFO();
+ virtual ~SfxPoolItem();
+
+ void SetWhich( sal_uInt16 nId ) {
+ DBG_CHKTHIS(SfxPoolItem, 0);
+ m_nWhich = nId; }
+ sal_uInt16 Which() const {
+ DBG_CHKTHIS(SfxPoolItem, 0);
+ return m_nWhich; }
+ virtual int operator==( const SfxPoolItem& ) const = 0;
+ int operator!=( const SfxPoolItem& rItem ) const
+ { return !(*this == rItem); }
+ virtual int Compare( const SfxPoolItem &rWith ) const;
+ virtual int Compare( const SfxPoolItem &rWith, const IntlWrapper& rIntlWrapper ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePresentation,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresentationMetric,
+ OUString &rText,
+ const IntlWrapper * pIntlWrapper = 0 ) const;
+
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const;
+ virtual bool ScaleMetrics( long lMult, long lDiv );
+ virtual bool HasMetrics() const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxPoolItem* Create( SvStream &, sal_uInt16 nItemVersion ) const;
+ virtual SvStream& Store( SvStream &, sal_uInt16 nItemVersion ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const = 0;
+
+ sal_uLong GetRefCount() const { return m_nRefCount; }
+ inline sal_uInt16 GetKind() const { return m_nKind; }
+
+ /** Read in a Unicode string from a streamed byte string representation.
+
+ @param rStream Some (input) stream. Its Stream/TargetCharSets must
+ be set to correct values!
+
+ @param rString On success, returns the reconstructed Unicode string.
+
+ @return True if the string was successfully read and reconstructed.
+ */
+ static OUString readByteString(SvStream & rStream);
+
+ /** Write a byte string representation of a Unicode string into a stream.
+
+ @param rStream Some (output) stream. Its Stream/TargetCharSets must
+ be set to correct values!
+
+ @param rString Some Unicode string.
+ */
+ static void writeByteString(SvStream & rStream,
+ const OUString& rString);
+
+ /** Read in a Unicode string from either a streamed Unicode or byte string
+ representation.
+
+ @param rStream Some (input) stream. If bUnicode is false, its
+ Stream/TargetCharSets must be set to correct values!
+
+ @param bUnicode Whether to read in a stream Unicode (true) or byte
+ string (false) representation.
+
+ @return On success, returns the reconstructed Unicode string.
+ */
+ static OUString readUnicodeString(SvStream & rStream, bool bUnicode);
+
+ /** Write a Unicode string representation of a Unicode string into a
+ stream.
+
+ @param rStream Some (output) stream.
+
+ @param rString Some Unicode string.
+ */
+ static void writeUnicodeString(SvStream & rStream,
+ const OUString& rString);
+
+private:
+ SfxPoolItem& operator=( const SfxPoolItem& ); // n.i.!!
+};
+
+// -----------------------------------------------------------------------
+
+inline void SfxPoolItem::SetRefCount( sal_uLong n )
+{
+ DBG_CHKTHIS( SfxPoolItem, 0 );
+ m_nRefCount = n;
+ m_nKind = 0;
+}
+
+inline void SfxPoolItem::SetKind( sal_uInt16 n )
+{
+ DBG_CHKTHIS( SfxPoolItem, 0 );
+ m_nRefCount = SFX_ITEMS_SPECIAL;
+ m_nKind = n;
+}
+
+inline sal_uLong SfxPoolItem::AddRef( sal_uLong n ) const
+{
+ DBG_CHKTHIS( SfxPoolItem, 0 );
+ DBG_ASSERT(m_nRefCount <= SFX_ITEMS_MAXREF, "AddRef with non-Pool-Item");
+ DBG_ASSERT(ULONG_MAX - m_nRefCount > n, "AddRef: refcount overflow");
+ return (const_cast<SfxPoolItem *>(this)->m_nRefCount += n);
+}
+
+inline sal_uLong SfxPoolItem::ReleaseRef( sal_uLong n ) const
+{
+ DBG_CHKTHIS( SfxPoolItem, 0 );
+ DBG_ASSERT(m_nRefCount <= SFX_ITEMS_MAXREF, "AddRef with non-Pool-Item");
+ DBG_ASSERT(m_nRefCount >= n, "AddRef: refcount underflow");
+ const_cast<SfxPoolItem *>(this)->m_nRefCount -= n;
+ return m_nRefCount;
+}
+
+// -----------------------------------------------------------------------
+
+inline int IsPoolDefaultItem(const SfxPoolItem *pItem )
+{
+ return pItem && pItem->GetKind() == SFX_ITEMS_POOLDEFAULT;
+}
+
+inline int IsStaticDefaultItem(const SfxPoolItem *pItem )
+{
+ return pItem && pItem->GetKind() == SFX_ITEMS_STATICDEFAULT;
+}
+
+inline int IsDefaultItem( const SfxPoolItem *pItem )
+{
+ return pItem && pItem->GetKind() >= SFX_ITEMS_STATICDEFAULT;
+}
+
+inline int IsPooledItem( const SfxPoolItem *pItem )
+{
+ return pItem && pItem->GetRefCount() > 0 && pItem->GetRefCount() <= SFX_ITEMS_MAXREF;
+}
+
+inline int IsInvalidItem(const SfxPoolItem *pItem)
+{
+ return pItem == (SfxPoolItem *)-1;
+}
+
+// -----------------------------------------------------------------------
+
+class SVL_DLLPUBLIC SfxVoidItem: public SfxPoolItem
+{
+ SfxVoidItem & operator=( const SfxVoidItem& ); // not implemented.
+public:
+ TYPEINFO();
+ explicit SfxVoidItem( sal_uInt16 nWhich );
+ SfxVoidItem( sal_uInt16 nWhich, SvStream & );
+ SfxVoidItem( const SfxVoidItem& );
+ ~SfxVoidItem();
+
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper * = 0 ) const;
+
+ // von sich selbst eine Kopie erzeugen
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ void SetWhich(sal_uInt16 nWh) { m_nWhich = nWh; }
+};
+
+// -----------------------------------------------------------------------
+
+class SVL_DLLPUBLIC SfxSetItem: public SfxPoolItem
+{
+ SfxItemSet *pSet;
+
+ SfxSetItem & operator=( const SfxSetItem& ); // not implemented.
+
+public:
+ TYPEINFO();
+ SfxSetItem( sal_uInt16 nWhich, SfxItemSet *pSet );
+ SfxSetItem( sal_uInt16 nWhich, const SfxItemSet &rSet );
+ SfxSetItem( const SfxSetItem&, SfxItemPool *pPool = 0 );
+ ~SfxSetItem();
+
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper * = 0 ) const;
+
+ // von sich selbst eine Kopie erzeugen
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const = 0;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16 nVersion) const = 0;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nVer) const;
+
+ const SfxItemSet& GetItemSet() const
+ { return *pSet; }
+ SfxItemSet& GetItemSet()
+ { return *pSet; }
+};
+
+// -----------------------------------------------------------------------
+// Handle Klasse fuer PoolItems
+
+class SVL_DLLPUBLIC SfxItemHandle
+{
+ sal_uInt16 *pRef;
+ SfxPoolItem *pItem;
+public:
+ explicit SfxItemHandle( SfxPoolItem& );
+ SfxItemHandle( const SfxItemHandle& );
+ ~SfxItemHandle();
+
+ const SfxItemHandle &operator=(const SfxItemHandle &);
+ const SfxPoolItem &GetItem() const { return *pItem; }
+};
+
+// -----------------------------------------------------------------------
+
+DECL_PTRHINT(SVL_DLLPUBLIC, SfxPoolItemHint, SfxPoolItem);
+
+// -----------------------------------------------------------------------
+
+#endif // #ifndef _SFXPOOLITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/ptitem.hxx b/include/svl/ptitem.hxx
new file mode 100644
index 000000000000..6906e24baaf7
--- /dev/null
+++ b/include/svl/ptitem.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXPTITEM_HXX
+#define _SFXPTITEM_HXX
+
+#include "svl/svldllapi.h"
+#include <svl/poolitem.hxx>
+#include <tools/gen.hxx>
+
+class SvStream;
+
+DBG_NAMEEX_VISIBILITY(SfxPointItem, SVL_DLLPUBLIC)
+
+// -----------------------------------------------------------------------
+
+class SVL_DLLPUBLIC SfxPointItem: public SfxPoolItem
+{
+ Point aVal;
+
+public:
+ TYPEINFO();
+ SfxPointItem();
+ SfxPointItem( sal_uInt16 nWhich, const Point& rVal );
+ SfxPointItem( const SfxPointItem& );
+ ~SfxPointItem() {
+ DBG_DTOR(SfxPointItem, 0); }
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper * = 0 ) const;
+
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16 nItemVersion) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+
+ const Point& GetValue() const { return aVal; }
+ void SetValue( const Point& rNewVal ) {
+ DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
+ aVal = rNewVal;
+ }
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/rectitem.hxx b/include/svl/rectitem.hxx
new file mode 100644
index 000000000000..b9f0f950eb63
--- /dev/null
+++ b/include/svl/rectitem.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXRECTITEM_HXX
+#define _SFXRECTITEM_HXX
+
+#include "svl/svldllapi.h"
+#include <tools/debug.hxx>
+#include <tools/gen.hxx>
+#include <svl/poolitem.hxx>
+
+class SvStream;
+
+DBG_NAMEEX_VISIBILITY(SfxRectangleItem, SVL_DLLPUBLIC)
+
+// -----------------------------------------------------------------------
+
+class SVL_DLLPUBLIC SfxRectangleItem: public SfxPoolItem
+{
+ Rectangle aVal;
+
+public:
+ TYPEINFO();
+ SfxRectangleItem();
+ SfxRectangleItem( sal_uInt16 nWhich, const Rectangle& rVal );
+ SfxRectangleItem( const SfxRectangleItem& );
+ ~SfxRectangleItem() {
+ DBG_DTOR(SfxRectangleItem, 0); }
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper * = 0 ) const;
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16 nItemVersion) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+
+ const Rectangle& GetValue() const { return aVal; }
+ void SetValue( const Rectangle& rNewVal ) {
+ DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
+ aVal = rNewVal;
+ }
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/restrictedpaths.hxx b/include/svl/restrictedpaths.hxx
new file mode 100644
index 000000000000..85326a569654
--- /dev/null
+++ b/include/svl/restrictedpaths.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVTOOLS_RESTRICTEDPATHS_HXX
+#define SVTOOLS_RESTRICTEDPATHS_HXX
+
+#include <svl/urlfilter.hxx>
+#include <svl/svldllapi.h>
+
+#include <vector>
+
+namespace svt
+{
+ class SVL_DLLPUBLIC RestrictedPaths : public IUrlFilter
+ {
+ private:
+ ::std::vector< OUString > m_aUnrestrictedURLs;
+ bool m_bFilterIsEnabled;
+
+ public:
+ RestrictedPaths();
+ virtual ~RestrictedPaths();
+
+ inline bool hasFilter() const { return !m_aUnrestrictedURLs.empty(); }
+ inline const ::std::vector< OUString >& getFilter() const { return m_aUnrestrictedURLs; }
+
+ inline void enableFilter( bool _bEnable ) { m_bFilterIsEnabled = _bEnable; }
+ inline bool isFilterEnabled() const { return m_bFilterIsEnabled; }
+
+ public:
+ /** checks URL access permissions
+
+ <p>with the "restriction" feature we have in the file dialog, it's possible that
+ only certain URLs can be browsed. This method checks whether a given URL belongs
+ to this set of permitted URLs.</p>
+
+ <p>If no "access restriction" is effective, this method always returns <TRUE/>.</p>
+ */
+ virtual bool isUrlAllowed( const OUString& _rURL ) const;
+
+ /** checks URL access permissions
+
+ <p>with the "restriction" feature we have in the file dialog, it's possible that
+ only certain URLs can be browsed. This method checks whether a given URL belongs
+ to this set of permitted URLs.</p>
+
+ <p>Default behavior allows access to parent folder of a restricted folder (but not to its siblings).
+ If allowParents is set to <FALSE/> parent folders will be treated as forbidden.
+
+ <p>If no "access restriction" is effective, this method always returns <TRUE/>.</p>
+ */
+ bool isUrlAllowed( const OUString& _rURL, bool allowParents ) const;
+ };
+
+} // namespace svt
+
+#endif // SVTOOLS_RESTRICTEDPATHS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/rngitem.hxx b/include/svl/rngitem.hxx
new file mode 100644
index 000000000000..450e958ec179
--- /dev/null
+++ b/include/svl/rngitem.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SFXRNGITEM_HXX
+#define _SFXRNGITEM_HXX
+
+#include "svl/svldllapi.h"
+#include <svl/poolitem.hxx>
+
+class SvStream;
+
+// -----------------------------------------------------------------------
+
+class SVL_DLLPUBLIC SfxRangeItem : public SfxPoolItem
+{
+private:
+ sal_uInt16 nFrom;
+ sal_uInt16 nTo;
+public:
+ TYPEINFO();
+ SfxRangeItem();
+ SfxRangeItem( sal_uInt16 nWID, sal_uInt16 nFrom, sal_uInt16 nTo );
+ SfxRangeItem( const SfxRangeItem& rItem );
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper * = 0 ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ inline sal_uInt16& From() { return nFrom; }
+ inline sal_uInt16 From() const { return nFrom; }
+ inline sal_uInt16& To() { return nTo; }
+ inline sal_uInt16 To() const { return nTo; }
+ inline sal_Bool HasRange() const { return nTo>nFrom; }
+ virtual SfxPoolItem* Create( SvStream &, sal_uInt16 nVersion ) const;
+ virtual SvStream& Store( SvStream &, sal_uInt16 nItemVersion ) const;
+};
+
+// -----------------------------------------------------------------------
+
+class SVL_DLLPUBLIC SfxUShortRangesItem : public SfxPoolItem
+{
+private:
+ sal_uInt16* _pRanges;
+
+public:
+ TYPEINFO();
+ SfxUShortRangesItem();
+ SfxUShortRangesItem( sal_uInt16 nWID, SvStream &rStream );
+ SfxUShortRangesItem( const SfxUShortRangesItem& rItem );
+ virtual ~SfxUShortRangesItem();
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper * = 0 ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ inline const sal_uInt16* GetRanges() const { return _pRanges; }
+ virtual SfxPoolItem* Create( SvStream &, sal_uInt16 nVersion ) const;
+ virtual SvStream& Store( SvStream &, sal_uInt16 nItemVersion ) const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/sfontitm.hxx b/include/svl/sfontitm.hxx
new file mode 100644
index 000000000000..f9bcbdc7f917
--- /dev/null
+++ b/include/svl/sfontitm.hxx
@@ -0,0 +1,207 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SFONTITM_HXX
+#define _SFONTITM_HXX
+
+#include <tools/color.hxx>
+#include <tools/gen.hxx>
+#include <i18nlangtag/lang.h>
+#include <svl/poolitem.hxx>
+
+//============================================================================
+class SfxFontItem: public SfxPoolItem
+{
+ XubString m_aName;
+ XubString m_aStyleName;
+ Size m_aSize;
+ Color m_aColor;
+ Color m_aFillColor;
+ rtl_TextEncoding m_nCharSet;
+ LanguageType m_nLanguage;
+ sal_Int16 m_nFamily;
+ sal_Int16 m_nPitch;
+ sal_Int16 m_nWeight;
+ sal_Int16 m_nWidthType;
+ sal_Int16 m_nItalic;
+ sal_Int16 m_nUnderline;
+ sal_Int16 m_nStrikeout;
+ sal_Int16 m_nOrientation;
+ unsigned m_bWordLine: 1;
+ unsigned m_bOutline: 1;
+ unsigned m_bShadow: 1;
+ unsigned m_bKerning: 1;
+ unsigned m_bHasFont: 1;
+ unsigned m_bHasColor: 1;
+ unsigned m_bHasFillColor: 1;
+
+public:
+ TYPEINFO();
+
+ inline SfxFontItem(sal_uInt16 nWhich);
+
+ virtual int operator ==(const SfxPoolItem & rItem) const;
+
+ virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const;
+ virtual SvStream & Store(SvStream & rStream, sal_uInt16) const;
+
+ virtual SfxPoolItem * Clone(SfxItemPool * = 0) const
+ { return new SfxFontItem(*this); }
+
+ sal_Bool hasFont() const { return m_bHasFont; }
+ sal_Bool hasColor() const { return m_bHasColor; }
+ sal_Bool hasFillColor() const { return m_bHasFillColor; }
+
+ const XubString & getName() const { return m_aName; }
+ const XubString & getStyleName() const { return m_aStyleName; }
+
+ const Size & getSize() const { return m_aSize; }
+ const Color & getColor() const { return m_aColor; }
+ const Color & getFillColor() const { return m_aFillColor; }
+
+ rtl_TextEncoding getCharSet() const { return m_nCharSet; }
+
+ LanguageType getLanguage() const { return m_nLanguage; }
+
+ sal_Int16 getFamily() const { return m_nFamily; }
+ sal_Int16 getPitch() const { return m_nPitch; }
+ sal_Int16 getWeight() const { return m_nWeight; }
+ sal_Int16 getWidthType() const { return m_nWidthType; }
+ sal_Int16 getItalic() const { return m_nItalic; }
+ sal_Int16 getUnderline() const { return m_nUnderline; }
+ sal_Int16 getStrikeout() const { return m_nStrikeout; }
+ sal_Int16 getOrientation() const { return m_nOrientation; }
+ sal_Bool getWordLine() const { return m_bWordLine; }
+ sal_Bool getOutline() const { return m_bOutline; }
+ sal_Bool getShadow() const { return m_bShadow; }
+ sal_Bool getKerning() const { return m_bKerning; }
+
+ inline void setFont(sal_Int16 nTheFamily, const XubString & rTheName,
+ const XubString & rTheStyleName, sal_Int16 nThePitch,
+ rtl_TextEncoding nTheCharSet);
+ inline void setWeight(sal_Int16 nTheWeight);
+ inline void setItalic(sal_Int16 nTheItalic);
+ inline void setHeight(sal_Int32 nHeight);
+ inline void setColor(const Color & rTheColor);
+ inline void setFillColor(const Color & rTheFillColor);
+ inline void setUnderline(sal_Int16 nTheUnderline);
+ inline void setStrikeout(sal_Int16 nTheStrikeout);
+ inline void setOutline(sal_Bool bTheOutline);
+ inline void setShadow(sal_Bool bTheShadow);
+ inline void setLanguage(LanguageType nTheLanguage);
+};
+
+inline SfxFontItem::SfxFontItem(sal_uInt16 which):
+ SfxPoolItem(which),
+ m_nCharSet(RTL_TEXTENCODING_DONTKNOW),
+ m_nLanguage(LANGUAGE_DONTKNOW),
+ m_nFamily(0), // FAMILY_DONTKNOW
+ m_nPitch(0), // PITCH_DONTKNOW
+ m_nWeight(0), // WEIGHT_DONTKNOW
+ m_nWidthType(0), // WIDTH_DONTKNOW
+ m_nItalic(3), // ITALIC_DONTKNOW
+ m_nUnderline(4), // UNDERLINE_DONTKNOW
+ m_nStrikeout(3), // STRIKEOUT_DONTKNOW
+ m_nOrientation(0),
+ m_bWordLine(sal_False),
+ m_bOutline(sal_False),
+ m_bShadow(sal_False),
+ m_bKerning(sal_False),
+ m_bHasFont(sal_False),
+ m_bHasColor(sal_False),
+ m_bHasFillColor(sal_False)
+{}
+
+inline void SfxFontItem::setFont(sal_Int16 nTheFamily,
+ const XubString & rTheName,
+ const XubString & rTheStyleName,
+ sal_Int16 nThePitch,
+ rtl_TextEncoding nTheCharSet)
+{
+ m_nFamily = nTheFamily;
+ m_aName = rTheName;
+ m_aStyleName = rTheStyleName;
+ m_nPitch = nThePitch;
+ m_nCharSet = nTheCharSet;
+ m_bHasFont = sal_True;
+}
+
+inline void SfxFontItem::setWeight(sal_Int16 nTheWeight)
+{
+ m_nWeight = nTheWeight;
+ m_bHasFont = sal_True;
+}
+
+inline void SfxFontItem::setItalic(sal_Int16 nTheItalic)
+{
+ m_nItalic = nTheItalic;
+ m_bHasFont = sal_True;
+}
+
+inline void SfxFontItem::setHeight(sal_Int32 nHeight)
+{
+ m_aSize.setHeight(nHeight);
+ m_bHasFont = sal_True;
+}
+
+inline void SfxFontItem::setColor(const Color & rTheColor)
+{
+ m_aColor = rTheColor;
+ m_bHasColor = sal_True;
+}
+
+inline void SfxFontItem::setFillColor(const Color & rTheFillColor)
+{
+ m_aFillColor = rTheFillColor;
+ m_bHasFillColor = sal_True;
+}
+
+inline void SfxFontItem::setUnderline(sal_Int16 nTheUnderline)
+{
+ m_nUnderline = nTheUnderline;
+ m_bHasFont = sal_True;
+}
+
+inline void SfxFontItem::setStrikeout(sal_Int16 nTheStrikeout)
+{
+ m_nStrikeout = nTheStrikeout;
+ m_bHasFont = sal_True;
+}
+
+inline void SfxFontItem::setOutline(sal_Bool bTheOutline)
+{
+ m_bOutline = bTheOutline;
+ m_bHasFont = sal_True;
+}
+
+inline void SfxFontItem::setShadow(sal_Bool bTheShadow)
+{
+ m_bShadow = bTheShadow;
+ m_bHasFont = sal_True;
+}
+
+inline void SfxFontItem::setLanguage(LanguageType nTheLanguage)
+{
+ m_nLanguage = nTheLanguage;
+ m_bHasFont = sal_True;
+}
+
+#endif // _SFONTITM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/sharecontrolfile.hxx b/include/svl/sharecontrolfile.hxx
new file mode 100644
index 000000000000..d2c842d98ebb
--- /dev/null
+++ b/include/svl/sharecontrolfile.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVT_SHARECONTROLFILE_HXX
+#define _SVT_SHARECONTROLFILE_HXX
+
+#include <svl/svldllapi.h>
+
+#include <com/sun/star/io/XStream.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
+#include <com/sun/star/io/XTruncate.hpp>
+
+#include <svl/lockfilecommon.hxx>
+
+#define SHARED_OOOUSERNAME_ID LOCKFILE_OOOUSERNAME_ID
+#define SHARED_SYSUSERNAME_ID LOCKFILE_SYSUSERNAME_ID
+#define SHARED_LOCALHOST_ID LOCKFILE_LOCALHOST_ID
+#define SHARED_EDITTIME_ID LOCKFILE_EDITTIME_ID
+#define SHARED_USERURL_ID LOCKFILE_USERURL_ID
+#define SHARED_ENTRYSIZE LOCKFILE_ENTRYSIZE
+
+namespace svt {
+
+class SVL_DLLPUBLIC ShareControlFile : public LockFileCommon
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > m_xStream;
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > m_xInputStream;
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > m_xOutputStream;
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XSeekable > m_xSeekable;
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XTruncate > m_xTruncate;
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< OUString > > m_aUsersData;
+
+ void OpenStream();
+ void Close();
+ sal_Bool IsValid()
+ {
+ return ( m_xStream.is() && m_xInputStream.is() && m_xOutputStream.is() && m_xSeekable.is() && m_xTruncate.is() );
+ }
+
+public:
+
+ // The constructor will throw exception in case the stream can not be opened
+ ShareControlFile( const OUString& aOrigURL );
+ ~ShareControlFile();
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< OUString > > GetUsersData();
+ void SetUsersDataAndStore( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< OUString > >& aUserNames );
+ ::com::sun::star::uno::Sequence< OUString > InsertOwnEntry();
+ bool HasOwnEntry();
+ void RemoveEntry( const ::com::sun::star::uno::Sequence< OUString >& aOptionalSpecification = ::com::sun::star::uno::Sequence< OUString >() );
+ void RemoveFile();
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/slstitm.hxx b/include/svl/slstitm.hxx
new file mode 100644
index 000000000000..90c873119b80
--- /dev/null
+++ b/include/svl/slstitm.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXSLSTITM_HXX
+#define _SFXSLSTITM_HXX
+
+#include <vector>
+
+#include "svl/svldllapi.h"
+#include <tools/rtti.hxx>
+#include <svl/poolitem.hxx>
+#include <com/sun/star/uno/Sequence.h>
+
+class SfxImpStringList;
+
+class SVL_DLLPUBLIC SfxStringListItem : public SfxPoolItem
+{
+protected:
+ SfxImpStringList* pImp;
+
+public:
+ TYPEINFO();
+
+ SfxStringListItem();
+ SfxStringListItem( sal_uInt16 nWhich, const std::vector<String> *pList=NULL );
+ SfxStringListItem( sal_uInt16 nWhich, SvStream& rStream );
+ SfxStringListItem( const SfxStringListItem& rItem );
+ ~SfxStringListItem();
+
+ std::vector<String>& GetList();
+
+ const std::vector<String>& GetList() const;
+
+ // String-Separator: \n
+ virtual void SetString( const XubString& );
+ virtual XubString GetString();
+
+ void SetStringList( const com::sun::star::uno::Sequence< OUString >& rList );
+ void GetStringList( com::sun::star::uno::Sequence< OUString >& rList ) const;
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper * = 0 ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream &, sal_uInt16 nVersion ) const;
+ virtual SvStream& Store( SvStream &, sal_uInt16 nItemVersion ) const;
+
+ virtual bool PutValue ( const com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 );
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 ) const;
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/smplhint.hxx b/include/svl/smplhint.hxx
new file mode 100644
index 000000000000..5c74a3dc4f6e
--- /dev/null
+++ b/include/svl/smplhint.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXSMPLHINT_HXX
+#define _SFXSMPLHINT_HXX
+
+#include "svl/svldllapi.h"
+#include <svl/hint.hxx>
+#include <tools/rtti.hxx>
+
+#define SFX_HINT_DYING 0x00000001
+#define SFX_HINT_NAMECHANGED 0x00000002
+#define SFX_HINT_TITLECHANGED 0x00000004
+#define SFX_HINT_DATACHANGED 0x00000008
+#define SFX_HINT_DOCCHANGED 0x00000010
+#define SFX_HINT_UPDATEDONE 0x00000020
+#define SFX_HINT_DEINITIALIZING 0x00000040
+#define SFX_HINT_MODECHANGED 0x00000080
+ // unused, formerly SFX_HINT_CANCELLABLE
+ // unused, formerly SFX_HINT_DATAAVAILABLE
+ // unused, formerly SFX_HINT_SAVECOMPLETED
+ // unused, formerly SFX_HINT_RELEASEREF
+#define SFX_HINT_COLORS_CHANGED 0x00001000
+#define SFX_HINT_CTL_SETTINGS_CHANGED 0x00002000
+#define SFX_HINT_ACCESSIBILITY_CHANGED 0x00004000
+ // unused, formerly SFX_HINT_VIEWCREATED
+#define SFX_HINT_USER00 0x00010000
+#define SFX_HINT_USER01 0x00020000
+#define SFX_HINT_USER02 0x00040000
+#define SFX_HINT_USER03 0x00080000
+#define SFX_HINT_USER04 0x00100000
+#define SFX_HINT_USER05 0x00200000
+#define SFX_HINT_USER06 0x00400000
+#define SFX_HINT_USER07 0x00800000
+#define SFX_HINT_USER08 0x01000000
+#define SFX_HINT_USER09 0x02000000
+#define SFX_HINT_USER10 0x04000000
+#define SFX_HINT_USER11 0x08000000
+#define SFX_HINT_USER12 0x10000000
+#define SFX_HINT_USER13 0x20000000
+#define SFX_HINT_UNDO_OPTIONS_CHANGED 0x40000000
+#define SFX_HINT_USER_OPTIONS_CHANGED 0x80000000
+#define SFX_HINT_ALL 0xFFFFFFFF
+
+class SVL_DLLPUBLIC SfxSimpleHint: public SfxHint
+{
+private:
+ sal_uLong nId;
+public:
+ TYPEINFO();
+ SfxSimpleHint( sal_uLong nId );
+ sal_uLong GetId() const { return nId; }
+};
+
+//--------------------------------------------------------------------
+
+#define DECL_OBJHINT(Name, Type) \
+ class Name: public SfxSimpleHint \
+ { \
+ Type aObj; \
+ \
+ public: \
+ TYPEINFO(); \
+ Name( sal_uInt16 nId, const Type& rObject ); \
+ ~Name(); \
+ const Type& GetObject() const { return aObj; } \
+ }
+
+#define IMPL_OBJHINT(Name, Type) \
+ TYPEINIT1(Name, SfxSimpleHint); \
+ Name::Name( sal_uInt16 nID, const Type& rObject ): \
+ SfxSimpleHint( nID ), aObj(rObject) \
+ { } \
+ Name::~Name() {}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/solar.hrc b/include/svl/solar.hrc
new file mode 100644
index 000000000000..05d2cedc533a
--- /dev/null
+++ b/include/svl/solar.hrc
@@ -0,0 +1,207 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SOLAR_HRC
+#define _SOLAR_HRC
+
+// defines ------------------------------------------------------------------
+
+#define OWN_ATTR_VALUE_START 3900
+#define OWN_ATTR_VALUE_END 3990
+
+#define CREATERESMGR_NAME( Name ) #Name
+#define CREATERESMGR( Name ) ResMgr::CreateResMgr( CREATERESMGR_NAME( Name ) )
+
+#define RID_SFX_START 260
+// RID_SFX_END 9999
+
+#define RID_LIB_START 10000
+#define RID_LIB_END 19999
+
+#define RID_SVX_START (RID_LIB_START)
+// RID_SVX_END (RID_LIB_START+499)
+
+// free: 500-2999
+
+#define RID_BASIC_START (RID_LIB_START+3000)
+// RID_BASIC_END (RID_LIB_START+4499)
+
+#define RID_UUI_START (RID_LIB_START+4500)
+// RID_UUI_END (RID_LIB_START+4599)
+
+// free: 4600-4849
+
+#define RID_BASICIDE_START (RID_LIB_START+4850)
+// RID_BASICIDE_END (RID_LIB_START+4949)
+
+#define RID_SVXITEMS_START (RID_LIB_START+4950)
+#define RID_SVXITEMS_END (RID_LIB_START+5599)
+
+// free: 5600-5699
+
+#define RID_EXTENSIONS_START (RID_LIB_START+5700)
+// RID_EXTENSIONS_END (RID_LIB_START+5799)
+
+#define RID_EDIT_START (RID_LIB_START+5800)
+#define RID_EDIT_END (RID_LIB_START+6369)
+
+#define RID_FPICKER_START (RID_LIB_START+6370)
+// RID_FPICKER_END (RID_LIB_START+6389)
+
+#define RID_SVTOOLS_START (RID_LIB_START+6390)
+// RID_SVTOOLS_END (RID_LIB_START+6499)
+
+// free: 6500-6799
+
+#define RID_DLG_START (RID_LIB_START+6800)
+// RID_DLG_END (RID_LIB_START+6899)
+
+#define RID_OFA_START (RID_LIB_START+6900)
+// RID_OFA_END (RID_LIB_START+7399)
+
+// free: RID_LIB_START+7400 to +7449
+
+#define RID_SVL_START (RID_LIB_START+7450)
+// RID_SVL_END (RID_LIB_START+7899)
+
+#define RID_CHAOS_START (RID_LIB_START+7900)
+// RID_CHAOS_END (RID_LIB_START+7999)
+
+#define RID_FORMS_START (RID_LIB_START+8000)
+// RID_FORMS_END (RID_LIB_START+8999)
+
+#define RID_FORMLAYER_START (RID_LIB_START+9000)
+// RID_FORMLAYER_END (RID_LIB_START+9199)
+
+#define RID_DBACCESS_START (RID_LIB_START+9200)
+#define RID_DBACCESS_END (RID_LIB_START+9699)
+
+#define RID_MORE_EXTENSIONS_START (RID_LIB_START+9700)
+#define RID_MORE_EXTENSIONS_END (RID_LIB_START+9999)
+
+// free: 10000-10199
+
+#define RID_FILTER_START (RID_LIB_START+10200)
+// RID_FILTER_END (RID_LIB_START+10299)
+
+// do *NOT* add more ranges here, RID_LIB_END is (RID_LIB_START + 10000)
+
+#define RID_APP_START 20000
+// RID_APP_END 31999
+
+#define RID_SW_START (20000)
+// RID_SW_END (25999)
+
+// free: 26000-26999
+
+#define RID_SD_START (27000)
+// RID_SD_END (27999)
+
+#define RID_OBJ_START (30000)
+// RID_OBJ_END (32767)
+
+#define RID_RPT_START (RID_OBJ_START+768)
+// RID_RPT_END (RID_OBJ_START+1000)
+
+#define RID_FORMULA_START (RID_OBJ_START+1001)
+// RID_FORMULA_END (RID_OBJ_START+1200)
+
+// Help-Ids --------------------------------------------------------------
+
+#define HID_START 32768
+
+#define HID_VCL_START (HID_START+100)
+// HID_VCL_END (HID_START+150)
+
+// free: 200-299
+
+#define HID_SFX_START (HID_START+300)
+// HID_SFX_END (HID_START+999)
+
+#define HID_LIB_START (HID_START+1000)
+// HID_LIB_END (HID_START+19999)
+
+// free: HID_LIB_START 0-1699
+
+// HID_OFA_START (HID_LIB_START+1760)
+#define HID_OFA_END (HID_LIB_START+1999)
+
+// free: HID_LIB_START 2000-2050
+
+#define HID_CHAOS_START (HID_LIB_START+2051)
+// HID_CHAOS_END (HID_LIB_START+2069)
+
+// free: HID_LIB_START 2070-9999
+
+// free: HID_START 20000-24999
+
+#define HID_SC_START (HID_START+25000)
+// HID_SC_END (HID_START+26999)
+
+#define HID_SD_START (HID_START+27000)
+// HID_SD_END (HID_START+27999)
+
+// free: HID_START 28000-29999
+
+#define HID_OBJ_START (HID_START+30000)
+// HID_OBJ_END (HID_START+32767)
+
+// free: HID_OBJ_START+2281 to HID_OBJ_START+2800
+
+// Slot Ids
+
+#define SID_SFX_START 5000
+// SID_SFX_END 8999
+#define SID_DOCKWIN_START 9800
+// SID_DOCKWIN_END 9999
+
+#define SID_LIB_START 10000
+// SID_LIB_END 19999
+// free: 20000-29999
+#define SID_OBJ_START 30000
+
+#define SID_SW_START 20000
+// SID_SW_END 25999
+#define SID_SC_START 26000
+// SID_SC_END 26999
+#define SID_SD_START 27000
+// SID_SD_END 27999
+
+#define SID_SMA_START (SID_OBJ_START + 256)
+// SID_SMA_END (SID_OBJ_START + 511)
+// free: SID_OBJ_START + 512 to SID_OBJ_START + 767
+#define SID_BASICIDE_START (SID_OBJ_START + 768)
+// SID_BASICIDE_END (SID_BASICIDE_START + 255)
+
+#define SID_SVX_START SID_LIB_START // 10000
+#define SID_SVX_END (SID_SVX_START + 1499)
+#define SID_EDIT_START (SID_SVX_END + 1) // 11500
+#define SID_EDIT_END (SID_EDIT_START + 499)
+#define SID_OPTIONS_START (SID_EDIT_END + 1) // 12000
+#define SID_OPTIONS_END (SID_OPTIONS_START + 100)
+#define SID_SBA_START (SID_OPTIONS_END + 1) // 12101
+#define SID_SBA_END (SID_SBA_START + 149)
+#define SID_DBACCESS_START (SID_SBA_END + 1) // 12251
+#define SID_DBACCESS_END (SID_DBACCESS_START + 200)
+#define SID_RPTUI_START (SID_DBACCESS_END + 1) // 12452
+// SID_RPTUI_END (SID_RPTUI_START + 199)
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/srchdefs.hxx b/include/svl/srchdefs.hxx
new file mode 100644
index 000000000000..f339ebff9273
--- /dev/null
+++ b/include/svl/srchdefs.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SFX_SRCHDEFS_HXX_
+#define _SFX_SRCHDEFS_HXX_
+
+
+#define SEARCH_OPTIONS_SEARCH ((sal_uInt16)0x0001)
+#define SEARCH_OPTIONS_SEARCH_ALL ((sal_uInt16)0x0002)
+#define SEARCH_OPTIONS_REPLACE ((sal_uInt16)0x0004)
+#define SEARCH_OPTIONS_REPLACE_ALL ((sal_uInt16)0x0008)
+#define SEARCH_OPTIONS_WHOLE_WORDS ((sal_uInt16)0x0010)
+#define SEARCH_OPTIONS_BACKWARDS ((sal_uInt16)0x0020)
+#define SEARCH_OPTIONS_REG_EXP ((sal_uInt16)0x0040)
+#define SEARCH_OPTIONS_EXACT ((sal_uInt16)0x0080)
+#define SEARCH_OPTIONS_SELECTION ((sal_uInt16)0x0100)
+#define SEARCH_OPTIONS_FAMILIES ((sal_uInt16)0x0200)
+#define SEARCH_OPTIONS_FORMAT ((sal_uInt16)0x0400)
+#define SEARCH_OPTIONS_MORE ((sal_uInt16)0x0800)
+#define SEARCH_OPTIONS_SIMILARITY ((sal_uInt16)0x1000)
+#define SEARCH_OPTIONS_CONTENT ((sal_uInt16)0x2000)
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/srchitem.hxx b/include/svl/srchitem.hxx
new file mode 100644
index 000000000000..5d4413ea8cab
--- /dev/null
+++ b/include/svl/srchitem.hxx
@@ -0,0 +1,287 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX_SRCHITEM_HXX
+#define _SFX_SRCHITEM_HXX
+
+#include "sal/config.h"
+#include "svl/svldllapi.h"
+#include <com/sun/star/util/XSearchDescriptor.hpp>
+#include <com/sun/star/util/SearchOptions.hpp>
+#include <com/sun/star/util/SearchFlags.hpp>
+#include <com/sun/star/i18n/TransliterationModules.hpp>
+#include <unotools/configitem.hxx>
+#include <rsc/rscsfx.hxx>
+#include <tools/string.hxx>
+#include <svl/poolitem.hxx>
+#include <svl/srchdefs.hxx>
+
+// defines ---------------------------------------------------------------
+
+// commands
+#define SVX_SEARCHCMD_FIND ((sal_uInt16)0)
+#define SVX_SEARCHCMD_FIND_ALL ((sal_uInt16)1)
+#define SVX_SEARCHCMD_REPLACE ((sal_uInt16)2)
+#define SVX_SEARCHCMD_REPLACE_ALL ((sal_uInt16)3)
+
+// search flags
+#define SVX_SEARCHIN_FORMULA ((sal_uInt16)0)
+#define SVX_SEARCHIN_VALUE ((sal_uInt16)1)
+#define SVX_SEARCHIN_NOTE ((sal_uInt16)2)
+#define SVX_SEARCHAPP_WRITER ((sal_uInt16)0)
+#define SVX_SEARCHAPP_CALC ((sal_uInt16)1)
+#define SVX_SEARCHAPP_DRAW ((sal_uInt16)2)
+#define SVX_SEARCHAPP_BASE ((sal_uInt16)3)
+
+// class SvxSearchItem ---------------------------------------------------
+
+class SVL_DLLPUBLIC SvxSearchItem :
+ public SfxPoolItem,
+ public utl::ConfigItem
+{
+ com::sun::star::util::SearchOptions aSearchOpt;
+
+ SfxStyleFamily eFamily; // Vorlagen-Familie
+
+ sal_uInt16 nCommand; // Kommando (Suchen, Alle Suchen, Ersetzen, Alle Ersetzen)
+
+ // Calc-Spezifische Daten
+ sal_uInt16 nCellType; // Suche in Formeln/Werten/Notizen
+ sal_uInt16 nAppFlag; // Fuer welche Applikation ist der Dialog ueberhaupt
+ bool bRowDirection; // Suchrichtung Zeilenweise/Spaltenweise
+ bool bAllTables; // in alle Tabellen suchen
+ bool bSearchFiltered; // search filtered cells.
+
+ // Writer-spezifisch
+ bool bNotes;
+
+ bool bBackward; // Suche Rueckwaerts
+ bool bPattern; // Suche nach Vorlagen
+ bool bContent; // Suche im Inhalt
+ bool bAsianOptions; // use asian options?
+
+public:
+ TYPEINFO();
+
+ explicit SvxSearchItem( const sal_uInt16 nId );
+ SvxSearchItem( const SvxSearchItem& rItem );
+ virtual ~SvxSearchItem();
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+ virtual int operator == ( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ // ConfigItem
+ virtual void Notify( const com::sun::star::uno::Sequence< OUString > &rPropertyNames );
+ virtual void Commit();
+
+ sal_uInt16 GetCommand() const { return nCommand; }
+ void SetCommand(sal_uInt16 nNewCommand) { nCommand = nNewCommand; }
+
+ inline const String GetSearchString() const;
+ inline void SetSearchString(const String& rNewString);
+
+ inline const String GetReplaceString() const;
+ inline void SetReplaceString(const String& rNewString);
+
+ inline bool GetWordOnly() const;
+ void SetWordOnly(bool bNewWordOnly);
+
+ inline bool GetExact() const;
+ void SetExact(bool bNewExact);
+
+ bool GetBackward() const { return bBackward; }
+ void SetBackward(bool bNewBackward) { bBackward = bNewBackward; }
+
+ inline bool GetSelection() const;
+ void SetSelection(bool bNewSelection);
+
+ inline bool GetRegExp() const;
+ void SetRegExp( bool bVal );
+
+ bool GetPattern() const { return bPattern; }
+ void SetPattern(bool bNewPattern) { bPattern = bNewPattern; }
+
+ bool IsContent() const { return bContent; }
+ void SetContent( bool bNew ) { bContent = bNew; }
+
+ SfxStyleFamily GetFamily() const { return eFamily; }
+ void SetFamily( SfxStyleFamily eNewFamily )
+ { eFamily = eNewFamily; }
+
+ bool GetRowDirection() const { return bRowDirection; }
+ void SetRowDirection(bool bNewRowDirection) { bRowDirection = bNewRowDirection; }
+
+ bool IsAllTables() const { return bAllTables; }
+ void SetAllTables(bool bNew) { bAllTables = bNew; }
+
+ bool IsSearchFiltered() const { return bSearchFiltered; }
+ void SetSearchFiltered(bool b) { bSearchFiltered = b; }
+
+ sal_uInt16 GetCellType() const { return nCellType; }
+ void SetCellType(sal_uInt16 nNewCellType) { nCellType = nNewCellType; }
+
+ bool GetNotes() const { return bNotes; }
+ void SetNotes(bool bNew) { bNotes = bNew; }
+
+ sal_uInt16 GetAppFlag() const { return nAppFlag; }
+ void SetAppFlag(sal_uInt16 nNewAppFlag) { nAppFlag = nNewAppFlag; }
+
+ inline bool IsLevenshtein() const;
+ void SetLevenshtein( bool bVal );
+
+ inline bool IsLEVRelaxed() const;
+ void SetLEVRelaxed(bool bSet);
+
+ inline sal_uInt16 GetLEVOther() const;
+ inline void SetLEVOther(sal_uInt16 nSet);
+
+ inline sal_uInt16 GetLEVShorter() const;
+ inline void SetLEVShorter(sal_uInt16 nSet);
+
+ inline sal_uInt16 GetLEVLonger() const;
+ inline void SetLEVLonger(sal_uInt16 nSet);
+
+ inline const com::sun::star::util::SearchOptions &
+ GetSearchOptions() const;
+ inline void SetSearchOptions( const com::sun::star::util::SearchOptions &rOpt );
+
+ inline sal_Int32 GetTransliterationFlags() const;
+ void SetTransliterationFlags( sal_Int32 nFlags );
+
+ inline bool IsMatchFullHalfWidthForms() const;
+ void SetMatchFullHalfWidthForms( bool bVal );
+
+ inline bool IsUseAsianOptions() const { return bAsianOptions; }
+ inline void SetUseAsianOptions( bool bVal ) { bAsianOptions = bVal; }
+};
+
+const String SvxSearchItem::GetSearchString() const
+{
+ return aSearchOpt.searchString;
+}
+
+void SvxSearchItem::SetSearchString(const String& rNewString)
+{
+ aSearchOpt.searchString = rNewString;
+}
+
+const String SvxSearchItem::GetReplaceString() const
+{
+ return aSearchOpt.replaceString;
+}
+
+void SvxSearchItem::SetReplaceString(const String& rNewString)
+{
+ aSearchOpt.replaceString = rNewString;
+}
+
+bool SvxSearchItem::GetWordOnly() const
+{
+ return 0 != (aSearchOpt.searchFlag &
+ com::sun::star::util::SearchFlags::NORM_WORD_ONLY);
+}
+
+bool SvxSearchItem::GetExact() const
+{
+ return 0 == (aSearchOpt.transliterateFlags &
+ com::sun::star::i18n::TransliterationModules_IGNORE_CASE);
+}
+
+bool SvxSearchItem::GetSelection() const
+{
+ return 0 != (aSearchOpt.searchFlag &
+ com::sun::star::util::SearchFlags::REG_NOT_BEGINOFLINE);
+}
+
+bool SvxSearchItem::GetRegExp() const
+{
+ return aSearchOpt.algorithmType == com::sun::star::util::SearchAlgorithms_REGEXP ;
+}
+
+bool SvxSearchItem::IsLEVRelaxed() const
+{
+ return 0 != (aSearchOpt.searchFlag &
+ com::sun::star::util::SearchFlags::LEV_RELAXED);
+}
+
+sal_uInt16 SvxSearchItem::GetLEVOther() const
+{
+ return (sal_Int16) aSearchOpt.changedChars;
+}
+
+void SvxSearchItem::SetLEVOther( sal_uInt16 nVal )
+{
+ aSearchOpt.changedChars = nVal;
+}
+
+sal_uInt16 SvxSearchItem::GetLEVShorter() const
+{
+ return (sal_Int16) aSearchOpt.insertedChars;
+}
+
+void SvxSearchItem::SetLEVShorter( sal_uInt16 nVal )
+{
+ aSearchOpt.insertedChars = nVal;
+}
+
+sal_uInt16 SvxSearchItem::GetLEVLonger() const
+{
+ return (sal_Int16) aSearchOpt.deletedChars;
+}
+
+void SvxSearchItem::SetLEVLonger( sal_uInt16 nVal )
+{
+ aSearchOpt.deletedChars = nVal;
+}
+
+bool SvxSearchItem::IsLevenshtein() const
+{
+ return aSearchOpt.algorithmType == com::sun::star::util::SearchAlgorithms_APPROXIMATE;
+}
+
+const com::sun::star::util::SearchOptions & SvxSearchItem::GetSearchOptions() const
+{
+ return aSearchOpt;
+}
+
+void SvxSearchItem::SetSearchOptions( const com::sun::star::util::SearchOptions &rOpt )
+{
+ aSearchOpt = rOpt;
+}
+
+sal_Int32 SvxSearchItem::GetTransliterationFlags() const
+{
+ return aSearchOpt.transliterateFlags;
+}
+
+bool SvxSearchItem::IsMatchFullHalfWidthForms() const
+{
+ return 0 != (aSearchOpt.transliterateFlags &
+ com::sun::star::i18n::TransliterationModules_IGNORE_WIDTH);
+}
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/stritem.hxx b/include/svl/stritem.hxx
new file mode 100644
index 000000000000..a4109218c79e
--- /dev/null
+++ b/include/svl/stritem.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SFXSTRITEM_HXX
+#define _SFXSTRITEM_HXX
+
+#include "svl/svldllapi.h"
+#include <svl/custritm.hxx>
+
+//============================================================================
+class SVL_DLLPUBLIC SfxStringItem: public CntUnencodedStringItem
+{
+public:
+ TYPEINFO();
+
+ SfxStringItem() {}
+
+ SfxStringItem(sal_uInt16 which, const OUString & rValue):
+ CntUnencodedStringItem(which, rValue) {}
+
+ SfxStringItem(sal_uInt16 nWhich, SvStream & rStream);
+
+ virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const;
+
+ virtual SvStream & Store(SvStream & rStream, sal_uInt16) const;
+
+ virtual SfxPoolItem * Clone(SfxItemPool * = 0) const;
+};
+
+#endif // _SFXSTRITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/strmadpt.hxx b/include/svl/strmadpt.hxx
new file mode 100644
index 000000000000..167d3696d3a2
--- /dev/null
+++ b/include/svl/strmadpt.hxx
@@ -0,0 +1,127 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVTOOLS_STRMADPT_HXX
+#define SVTOOLS_STRMADPT_HXX
+
+#include "svl/svldllapi.h"
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
+#include <cppuhelper/weak.hxx>
+#include <tools/stream.hxx>
+
+//============================================================================
+class SVL_DLLPUBLIC SvOutputStreamOpenLockBytes: public SvOpenLockBytes
+{
+ com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >
+ m_xOutputStream;
+ sal_uInt32 m_nPosition;
+
+public:
+ TYPEINFO();
+
+ SvOutputStreamOpenLockBytes(
+ const com::sun::star::uno::Reference<
+ com::sun::star::io::XOutputStream > &
+ rTheOutputStream):
+ m_xOutputStream(rTheOutputStream), m_nPosition(0) {}
+
+ virtual ErrCode ReadAt(sal_uLong, void *, sal_uLong, sal_uLong *) const;
+
+ virtual ErrCode WriteAt(sal_uLong nPos, const void * pBuffer, sal_uLong nCount,
+ sal_uLong * pWritten);
+
+ virtual ErrCode Flush() const;
+
+ virtual ErrCode SetSize(sal_uLong);
+
+ virtual ErrCode Stat(SvLockBytesStat * pStat, SvLockBytesStatFlag) const;
+
+ virtual ErrCode FillAppend(const void * pBuffer, sal_uLong nCount,
+ sal_uLong * pWritten);
+
+ virtual sal_uLong Tell() const;
+
+ virtual sal_uLong Seek(sal_uLong);
+
+ virtual void Terminate();
+};
+
+//============================================================================
+class SVL_DLLPUBLIC SvLockBytesInputStream: public cppu::OWeakObject,
+ public com::sun::star::io::XInputStream,
+ public com::sun::star::io::XSeekable
+{
+ SvLockBytesRef m_xLockBytes;
+ sal_Int64 m_nPosition;
+
+public:
+ SvLockBytesInputStream(SvLockBytes * pTheLockBytes):
+ m_xLockBytes(pTheLockBytes), m_nPosition(0) {}
+
+ virtual com::sun::star::uno::Any SAL_CALL
+ queryInterface(const com::sun::star::uno::Type & rType)
+ throw (com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL acquire() throw();
+
+ virtual void SAL_CALL release() throw();
+
+ virtual sal_Int32 SAL_CALL
+ readBytes(com::sun::star::uno::Sequence< sal_Int8 > & rData,
+ sal_Int32 nBytesToRead)
+ throw (com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException);
+
+ virtual sal_Int32 SAL_CALL
+ readSomeBytes(com::sun::star::uno::Sequence< sal_Int8 > & rData,
+ sal_Int32 nMaxBytesToRead)
+ throw (com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL skipBytes(sal_Int32 nBytesToSkip)
+ throw (com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException);
+
+ virtual sal_Int32 SAL_CALL available()
+ throw (com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL closeInput()
+ throw (com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL seek(sal_Int64 nLocation)
+ throw (com::sun::star::lang::IllegalArgumentException,
+ com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException);
+
+ virtual sal_Int64 SAL_CALL getPosition()
+ throw (com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException);
+
+ virtual sal_Int64 SAL_CALL getLength()
+ throw (com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException);
+};
+
+#endif // SVTOOLS_STRMADPT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/style.hrc b/include/svl/style.hrc
new file mode 100644
index 000000000000..352cfe18e2b0
--- /dev/null
+++ b/include/svl/style.hrc
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SFX_STYLE_HRC
+#define SFX_STYLE_HRC
+
+#define SFXSTYLEBIT_AUTO 0x0000 ///< automatic: flags from application
+#define SFXSTYLEBIT_HIDDEN 0x0200 ///< hidden styles (search mask)
+#define SFXSTYLEBIT_HIERARCHY 0x1000 ///< hierarchical view - just for dialog
+#define SFXSTYLEBIT_READONLY 0x2000 ///< readonly styles (search mask)
+#define SFXSTYLEBIT_USED 0x4000 ///< used styles (search mask)
+#define SFXSTYLEBIT_USERDEF 0x8000 ///< user defined styles (search mask)
+#define SFXSTYLEBIT_ALL_VISIBLE 0xFDFF ///< all styles
+#define SFXSTYLEBIT_ALL 0xFFFF ///< all styles
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/style.hxx b/include/svl/style.hxx
new file mode 100644
index 000000000000..af58cbc44327
--- /dev/null
+++ b/include/svl/style.hxx
@@ -0,0 +1,386 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SFXSTYLE_HXX
+#define _SFXSTYLE_HXX
+
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+
+#include <rtl/ref.hxx>
+#include <vector>
+#include <comphelper/weak.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include "svl/svldllapi.h"
+#include <rsc/rscsfx.hxx>
+#include <tools/string.hxx>
+#include <svl/hint.hxx>
+#include <svl/lstner.hxx>
+#include <svl/brdcst.hxx>
+#include <svl/poolitem.hxx>
+#include <svl/stylesheetuser.hxx>
+
+#include <svl/style.hrc>
+#include <boost/shared_ptr.hpp>
+
+class SfxItemSet;
+class SfxItemPool;
+class SfxStyleSheetBasePool;
+class SvStream;
+
+/*
+Everyone changing instances of SfxStyleSheetBasePool or SfxStyleSheetBase
+must broadcast this using <SfxStyleSheetBasePool::GetBroadcaster()> broadcasts.
+The class <SfxStyleSheetHint> is used for this, it contains an Action-Id and a
+pointer to the <SfxStyleSheetBase>. The actions are:
+
+#define SFX_STYLESHEET_CREATED // style is created
+#define SFX_STYLESHEET_MODIFIED // style is modified
+#define SFX_STYLESHEET_CHANGED // style is replaced
+#define SFX_STYLESHEET_ERASED // style is deleted
+
+The following methods already broadcast themself
+
+SfxSimpleHint(SFX_HINT_DYING) from:
+ SfxStyleSheetBasePool::~SfxStyleSheetBasePool()
+
+SfxStyleSheetHint( SFX_STYLESHEET_CREATED, *p ) from:
+ SfxStyleSheetBasePool::Make( const String& rName,
+ SfxStyleFamily eFam, sal_uInt16 mask, sal_uInt16 nPos)
+
+SfxStyleSheetHint( SFX_STYLESHEET_CHANGED, *pNew ) from:
+ SfxStyleSheetBasePool::Add( SfxStyleSheetBase& rSheet )
+
+SfxStyleSheetHint( SFX_STYLESHEET_ERASED, *p ) from:
+ SfxStyleSheetBasePool::Erase( SfxStyleSheetBase* p )
+ SfxStyleSheetBasePool::Clear()
+*/
+
+class SVL_DLLPUBLIC SfxStyleSheetBase : public comphelper::OWeakTypeObject
+{
+private:
+ friend class SfxStyleSheetBasePool;
+ SVL_DLLPRIVATE static SfxStyleSheetBasePool& implGetStaticPool();
+
+protected:
+ SfxStyleSheetBasePool* pPool; // zugehoeriger Pool
+ SfxStyleFamily nFamily; // Familie
+
+ UniString aName, aParent, aFollow;
+ OUString maDisplayName;
+ OUString aHelpFile; // Name der Hilfedatei
+ SfxItemSet* pSet; // ItemSet
+ sal_uInt16 nMask; // Flags
+
+ sal_uLong nHelpId; // Hilfe-ID
+
+ bool bMySet; // sal_True: Set loeschen im dtor
+ bool bHidden;
+
+ SfxStyleSheetBase( const UniString&, SfxStyleSheetBasePool*, SfxStyleFamily eFam, sal_uInt16 mask );
+ SfxStyleSheetBase( const SfxStyleSheetBase& );
+ virtual ~SfxStyleSheetBase();
+ virtual void Load( SvStream&, sal_uInt16 );
+ virtual void Store( SvStream& );
+
+public:
+ TYPEINFO();
+
+ // returns the internal name of this style
+ virtual const UniString& GetName() const;
+
+ // sets the internal name of this style
+ virtual bool SetName( const UniString& );
+
+ /** returns the display name of this style, it is used at the user interface.
+ If the display name is empty, this method returns the internal name. */
+ virtual OUString GetDisplayName() const;
+
+ // sets the display name of this style
+ virtual void SetDisplayName( const OUString& );
+
+ virtual const UniString& GetParent() const;
+ virtual bool SetParent( const UniString& );
+ virtual const UniString& GetFollow() const;
+ virtual bool SetFollow( const UniString& );
+ virtual bool HasFollowSupport() const; // Default true
+ virtual bool HasParentSupport() const; // Default true
+ virtual bool HasClearParentSupport() const; // Default false
+ virtual bool IsUsed() const; // Default true
+ // Default aus dem Itemset; entweder dem uebergebenen
+ // oder aus dem per GetItemSet() zurueckgelieferten Set
+ virtual UniString GetDescription();
+ virtual UniString GetDescription( SfxMapUnit eMetric );
+
+ SfxStyleSheetBasePool& GetPool() { return *pPool; }
+ SfxStyleFamily GetFamily() const { return nFamily; }
+ sal_uInt16 GetMask() const { return nMask; }
+ void SetMask( sal_uInt16 mask) { nMask = mask; }
+ bool IsUserDefined() const
+ { return ( nMask & SFXSTYLEBIT_USERDEF) != 0; }
+
+ virtual sal_Bool IsHidden() const { return bHidden; }
+ virtual void SetHidden( sal_Bool bValue );
+
+ virtual sal_uLong GetHelpId( OUString& rFile );
+ virtual void SetHelpId( const OUString& r, sal_uLong nId );
+
+ virtual SfxItemSet& GetItemSet();
+ virtual sal_uInt16 GetVersion() const;
+};
+
+//=========================================================================
+
+typedef std::vector< rtl::Reference< SfxStyleSheetBase > > SfxStyles;
+
+//=========================================================================
+
+class SVL_DLLPUBLIC SfxStyleSheetIterator
+
+/* [Beschreibung]
+
+ Klasse zum Iterieren und Suchen auf einem SfxStyleSheetBasePool.
+
+*/
+
+{
+public:
+ SfxStyleSheetIterator(SfxStyleSheetBasePool *pBase,
+ SfxStyleFamily eFam, sal_uInt16 n=SFXSTYLEBIT_ALL );
+ virtual sal_uInt16 GetSearchMask() const;
+ virtual SfxStyleFamily GetSearchFamily() const;
+ virtual sal_uInt16 Count();
+ virtual SfxStyleSheetBase *operator[](sal_uInt16 nIdx);
+ virtual SfxStyleSheetBase* First();
+ virtual SfxStyleSheetBase* Next();
+ virtual SfxStyleSheetBase* Find(const OUString& rStr);
+ virtual ~SfxStyleSheetIterator();
+
+protected:
+
+ SfxStyleSheetBasePool* pBasePool;
+ SfxStyleFamily nSearchFamily;
+ sal_uInt16 nMask;
+
+ bool SearchUsed() const { return bSearchUsed; }
+
+private:
+ sal_uInt16 GetPos() { return nAktPosition; }
+ SVL_DLLPRIVATE bool IsTrivialSearch();
+ SVL_DLLPRIVATE bool DoesStyleMatch(SfxStyleSheetBase *pStyle);
+
+ SfxStyleSheetBase* pAktStyle;
+ sal_uInt16 nAktPosition;
+ bool bSearchUsed;
+
+friend class SfxStyleSheetBasePool;
+};
+
+typedef ::boost::shared_ptr< SfxStyleSheetIterator > SfxStyleSheetIteratorPtr;
+//=========================================================================
+
+class SfxStyleSheetBasePool_Impl;
+
+class SVL_DLLPUBLIC SfxStyleSheetBasePool: public SfxBroadcaster, public comphelper::OWeakTypeObject
+{
+friend class SfxStyleSheetIterator;
+friend class SfxStyleSheetBase;
+
+ SfxStyleSheetBasePool_Impl *pImp;
+
+private:
+ SVL_DLLPRIVATE SfxStyleSheetIterator& GetIterator_Impl();
+protected:
+ String aAppName;
+ SfxItemPool& rPool;
+ SfxStyles aStyles;
+ SfxStyleFamily nSearchFamily;
+ sal_uInt16 nMask;
+
+ SfxStyleSheetBase& Add( SfxStyleSheetBase& );
+ void ChangeParent( const UniString&, const UniString&, bool bVirtual = true );
+ virtual SfxStyleSheetBase* Create( const UniString&, SfxStyleFamily, sal_uInt16 );
+ virtual SfxStyleSheetBase* Create( const SfxStyleSheetBase& );
+
+ virtual ~SfxStyleSheetBasePool();
+
+public:
+ SfxStyleSheetBasePool( SfxItemPool& );
+ SfxStyleSheetBasePool( const SfxStyleSheetBasePool& );
+
+ const String& GetAppName() const { return aAppName; }
+
+ SfxItemPool& GetPool();
+ const SfxItemPool& GetPool() const;
+
+ virtual SfxStyleSheetIteratorPtr CreateIterator(SfxStyleFamily, sal_uInt16 nMask);
+ virtual sal_uInt16 Count();
+ virtual SfxStyleSheetBase* operator[](sal_uInt16 nIdx);
+
+ virtual SfxStyleSheetBase& Make(const UniString&,
+ SfxStyleFamily eFam,
+ sal_uInt16 nMask = SFXSTYLEBIT_ALL ,
+ sal_uInt16 nPos = 0xffff);
+
+ virtual void Replace(
+ SfxStyleSheetBase& rSource, SfxStyleSheetBase& rTarget );
+
+ virtual void Remove( SfxStyleSheetBase* );
+ virtual void Insert( SfxStyleSheetBase* );
+
+ virtual void Clear();
+
+ SfxStyleSheetBasePool& operator=( const SfxStyleSheetBasePool& );
+ SfxStyleSheetBasePool& operator+=( const SfxStyleSheetBasePool& );
+
+ const SfxStyles& GetStyles();
+ virtual SfxStyleSheetBase* First();
+ virtual SfxStyleSheetBase* Next();
+ virtual SfxStyleSheetBase* Find( const UniString&, SfxStyleFamily eFam, sal_uInt16 n=SFXSTYLEBIT_ALL );
+
+ virtual bool SetParent(SfxStyleFamily eFam,
+ const UniString &rStyle,
+ const UniString &rParent);
+
+ SfxStyleSheetBase* Find(const UniString& rStr)
+ { return Find(rStr, nSearchFamily, nMask); }
+
+ void SetSearchMask(SfxStyleFamily eFam, sal_uInt16 n=SFXSTYLEBIT_ALL );
+ sal_uInt16 GetSearchMask() const;
+ SfxStyleFamily GetSearchFamily() const { return nSearchFamily; }
+};
+
+//=========================================================================
+
+class SVL_DLLPUBLIC SfxStyleSheet: public SfxStyleSheetBase,
+ public SfxListener, public SfxBroadcaster, public svl::StyleSheetUser
+{
+public:
+ TYPEINFO();
+
+ SfxStyleSheet( const UniString&, const SfxStyleSheetBasePool&, SfxStyleFamily, sal_uInt16 );
+ SfxStyleSheet( const SfxStyleSheet& );
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ virtual bool isUsedByModel() const;
+
+ virtual bool SetParent( const UniString& );
+
+protected:
+ SfxStyleSheet() // do not use! needed by MSVC at compile time to satisfy ImplInheritanceHelper2
+ : SfxStyleSheetBase(OUString("dummy"),
+ NULL, SFX_STYLE_FAMILY_ALL, 0)
+ {
+ assert(false);
+ }
+ virtual ~SfxStyleSheet();
+};
+
+//=========================================================================
+
+class SVL_DLLPUBLIC SfxStyleSheetPool: public SfxStyleSheetBasePool
+{
+protected:
+ using SfxStyleSheetBasePool::Create;
+ virtual SfxStyleSheetBase* Create(const UniString&, SfxStyleFamily, sal_uInt16 mask);
+ virtual SfxStyleSheetBase* Create(const SfxStyleSheet &);
+
+public:
+ SfxStyleSheetPool( SfxItemPool const& );
+
+// virtual sal_Bool CopyTo(SfxStyleSheetPool &rDest, const String &rSourceName);
+};
+
+//=========================================================================
+
+#define SFX_STYLESHEET_CREATED 1 // neu
+#define SFX_STYLESHEET_MODIFIED 2 // ver"andert
+#define SFX_STYLESHEET_CHANGED 3 // gel"oscht und neu (ausgetauscht)
+#define SFX_STYLESHEET_ERASED 4 // gel"oscht
+#define SFX_STYLESHEET_INDESTRUCTION 5 // wird gerade entfernt
+
+#define SFX_STYLESHEETPOOL_CHANGES 1 // Aenderungen, die den Zustand
+ // des Pools anedern, aber nicht
+ // ueber die STYLESHEET Hints
+ // verschickt werden sollen.
+
+//========================================================================
+
+class SVL_DLLPUBLIC SfxStyleSheetPoolHint : public SfxHint
+{
+ sal_uInt16 nHint;
+
+public:
+ TYPEINFO();
+
+ SfxStyleSheetPoolHint(sal_uInt16 nArgHint) : nHint(nArgHint){}
+ sal_uInt16 GetHint() const
+ { return nHint; }
+};
+
+//=========================================================================
+
+class SVL_DLLPUBLIC SfxStyleSheetHint: public SfxHint
+{
+ SfxStyleSheetBase* pStyleSh;
+ sal_uInt16 nHint;
+
+public:
+ TYPEINFO();
+
+ SfxStyleSheetHint( sal_uInt16, SfxStyleSheetBase& );
+ SfxStyleSheetBase* GetStyleSheet() const
+ { return pStyleSh; }
+ sal_uInt16 GetHint() const
+ { return nHint; }
+};
+
+class SVL_DLLPUBLIC SfxStyleSheetHintExtended: public SfxStyleSheetHint
+{
+ String aName;
+
+public:
+ TYPEINFO();
+
+ SfxStyleSheetHintExtended(
+ sal_uInt16, const String& rOld,
+ SfxStyleSheetBase& );
+ const String& GetOldName() { return aName; }
+};
+
+class SVL_DLLPUBLIC SfxUnoStyleSheet : public ::cppu::ImplInheritanceHelper2< SfxStyleSheet, ::com::sun::star::style::XStyle, ::com::sun::star::lang::XUnoTunnel >
+{
+public:
+ SfxUnoStyleSheet( const UniString& _rName, const SfxStyleSheetBasePool& _rPool, SfxStyleFamily _eFamily, sal_uInt16 _nMaske );
+
+ static SfxUnoStyleSheet* getUnoStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle >& xStyle );
+
+ // XUnoTunnel
+ virtual ::sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aIdentifier ) throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ SfxUnoStyleSheet(); // not implemented
+
+ static const ::com::sun::star::uno::Sequence< ::sal_Int8 >& getIdentifier();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/stylepool.hxx b/include/svl/stylepool.hxx
new file mode 100644
index 000000000000..deaed2591a83
--- /dev/null
+++ b/include/svl/stylepool.hxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVTOOLS_STYLEPOOL_HXX
+#define INCLUDED_SVTOOLS_STYLEPOOL_HXX
+
+#include <boost/shared_ptr.hpp>
+#include <rtl/ustring.hxx>
+#include <svl/itemset.hxx>
+
+class StylePoolImpl;
+class IStylePoolIteratorAccess;
+
+class SVL_DLLPUBLIC StylePool
+{
+private:
+ StylePoolImpl *pImpl;
+public:
+ typedef boost::shared_ptr<SfxItemSet> SfxItemSet_Pointer_t;
+
+ explicit StylePool( SfxItemSet* pIgnorableItems = 0 );
+
+ /** Insert a SfxItemSet into the style pool.
+
+ The pool makes a copy of the provided SfxItemSet.
+
+ @param SfxItemSet
+ the SfxItemSet to insert
+
+ @return a shared pointer to the SfxItemSet
+ */
+ virtual SfxItemSet_Pointer_t insertItemSet( const SfxItemSet& rSet );
+
+ /** Create an iterator
+
+ The iterator walks through the StylePool
+ OD 2008-03-07 #i86923#
+ introduce optional parameter to control, if unused SfxItemsSet are skipped or not
+ introduce optional parameter to control, if ignorable items are skipped or not
+
+ @attention every change, e.g. destruction, of the StylePool could cause undefined effects.
+
+ @param bSkipUnusedItemSets
+ input parameter - boolean, indicating if unused SfxItemSets are skipped or not
+
+ @param bSkipIgnorableItems
+ input parameter - boolean, indicating if ignorable items are skipped or not
+
+ @postcond the iterator "points before the first" SfxItemSet of the pool.
+ The first StylePoolIterator::getNext() call will deliver the first SfxItemSet.
+ */
+ virtual IStylePoolIteratorAccess* createIterator( const bool bSkipUnusedItemSets = false,
+ const bool bSkipIgnorableItems = false );
+
+ /** Returns the number of styles
+ */
+ virtual sal_Int32 getCount() const;
+
+ virtual ~StylePool();
+
+ static OUString nameOf( SfxItemSet_Pointer_t pSet );
+};
+
+class SVL_DLLPUBLIC IStylePoolIteratorAccess
+{
+public:
+ /** Delivers a shared pointer to the next SfxItemSet of the pool
+ If there is no more SfxItemSet, the delivered share_pointer is empty.
+ */
+ virtual StylePool::SfxItemSet_Pointer_t getNext() = 0;
+ virtual OUString getName() = 0;
+ virtual ~IStylePoolIteratorAccess() {};
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/stylesheetuser.hxx b/include/svl/stylesheetuser.hxx
new file mode 100644
index 000000000000..787263ff4a8e
--- /dev/null
+++ b/include/svl/stylesheetuser.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef SVL_STYLESHEETUSER_HXX_INCLUDED
+#define SVL_STYLESHEETUSER_HXX_INCLUDED
+
+namespace svl
+{
+
+/** Test whether object that uses a stylesheet is used itself.
+
+ This interface should be implemented by all classes that use
+ a SfxStyleSheet (and listen on it). It can be queried by the stylesheet
+ to determine if it is really used.
+ */
+class StyleSheetUser
+{
+public:
+ /** Test whether this object is used.
+
+ @return true, if the object is used, false otherwise
+ */
+ virtual bool isUsedByModel() const = 0;
+protected:
+ ~StyleSheetUser() {}
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/svdde.hxx b/include/svl/svdde.hxx
new file mode 100644
index 000000000000..c8a08beffbb9
--- /dev/null
+++ b/include/svl/svdde.hxx
@@ -0,0 +1,416 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVDDE_HXX
+#define _SVDDE_HXX
+
+#include "svl/svldllapi.h"
+#include <sot/exchange.hxx>
+#include <tools/string.hxx>
+#include <tools/link.hxx>
+#include <vector>
+
+class DdeString;
+class DdeData;
+class DdeConnection;
+class DdeTransaction;
+class DdeLink;
+class DdeRequest;
+class DdeWarmLink;
+class DdeHotLink;
+class DdePoke;
+class DdeExecute;
+class DdeItem;
+class DdeTopic;
+class DdeService;
+struct DdeDataImp;
+struct DdeImp;
+class DdeItemImp;
+struct Conversation;
+
+typedef ::std::vector< DdeService* > DdeServices;
+typedef ::std::vector< long > DdeFormats;
+typedef ::std::vector< Conversation* > ConvList;
+
+// -----------
+// - DdeData -
+// -----------
+
+class SVL_DLLPUBLIC DdeData
+{
+ friend class DdeInternal;
+ friend class DdeService;
+ friend class DdeConnection;
+ friend class DdeTransaction;
+ DdeDataImp* pImp;
+
+ SVL_DLLPRIVATE void Lock();
+
+ void SetFormat( sal_uLong nFmt );
+
+public:
+ DdeData();
+ DdeData( SAL_UNUSED_PARAMETER const void*, SAL_UNUSED_PARAMETER long, SAL_UNUSED_PARAMETER sal_uLong = FORMAT_STRING );
+ DdeData( SAL_UNUSED_PARAMETER const String& );
+ DdeData( const DdeData& );
+ ~DdeData();
+
+ operator const void*() const;
+ operator long() const;
+
+ sal_uLong GetFormat() const;
+
+ DdeData& operator = ( const DdeData& );
+
+ static sal_uLong GetExternalFormat( sal_uLong nFmt );
+ static sal_uLong GetInternalFormat( sal_uLong nFmt );
+};
+
+// ------------------
+// - DdeTransaction -
+// ------------------
+
+class SVL_DLLPUBLIC DdeTransaction
+{
+public:
+ virtual void Data( const DdeData* );
+ virtual void Done( sal_Bool bDataValid );
+protected:
+ DdeConnection& rDde;
+ DdeData aDdeData;
+ DdeString* pName;
+ short nType;
+ long nId;
+ long nTime;
+ Link aData;
+ Link aDone;
+ bool bBusy;
+
+ DdeTransaction( DdeConnection&, SAL_UNUSED_PARAMETER const String&, SAL_UNUSED_PARAMETER long = 0 );
+
+public:
+ virtual ~DdeTransaction();
+
+ bool IsBusy() { return bBusy; }
+ const OUString GetName() const;
+
+ void Execute();
+
+ void SetDataHdl( const Link& rLink ) { aData = rLink; }
+ const Link& GetDataHdl() const { return aData; }
+
+ void SetDoneHdl( const Link& rLink ) { aDone = rLink; }
+ const Link& GetDoneHdl() const { return aDone; }
+
+ void SetFormat( sal_uLong nFmt ) { aDdeData.SetFormat( nFmt ); }
+ sal_uLong GetFormat() const { return aDdeData.GetFormat(); }
+
+ long GetError();
+
+private:
+ friend class DdeInternal;
+ friend class DdeConnection;
+
+ DdeTransaction( const DdeTransaction& );
+ const DdeTransaction& operator= ( const DdeTransaction& );
+
+};
+
+// -----------
+// - DdeLink -
+// -----------
+
+class SVL_DLLPUBLIC DdeLink : public DdeTransaction
+{
+ Link aNotify;
+
+public:
+ DdeLink( DdeConnection&, const String&, long = 0 );
+ virtual ~DdeLink();
+
+ void SetNotifyHdl( const Link& rLink ) { aNotify = rLink; }
+ const Link& GetNotifyHdl() const { return aNotify; }
+ virtual void Notify();
+};
+
+// ---------------
+// - DdeWarmLink -
+// ---------------
+
+class SVL_DLLPUBLIC DdeWarmLink : public DdeLink
+{
+public:
+ DdeWarmLink( DdeConnection&, const String&, long = 0 );
+};
+
+// --------------
+// - DdeHotLink -
+// --------------
+
+class SVL_DLLPUBLIC DdeHotLink : public DdeLink
+{
+public:
+ DdeHotLink( DdeConnection&, const String&, long = 0 );
+};
+
+// --------------
+// - DdeRequest -
+// --------------
+
+class SVL_DLLPUBLIC DdeRequest : public DdeTransaction
+{
+public:
+ DdeRequest( DdeConnection&, const String&, long = 0 );
+};
+
+// -----------
+// - DdePoke -
+// -----------
+
+class SVL_DLLPUBLIC DdePoke : public DdeTransaction
+{
+public:
+ DdePoke( DdeConnection&, const String&, const char*, long,
+ sal_uLong = FORMAT_STRING, long = 0 );
+ DdePoke( DdeConnection&, const String&, SAL_UNUSED_PARAMETER const DdeData&, long = 0 );
+ DdePoke( DdeConnection&, const String&, const String&, long = 0 );
+};
+
+// --------------
+// - DdeExecute -
+// --------------
+
+class SVL_DLLPUBLIC DdeExecute : public DdeTransaction
+{
+public:
+ DdeExecute( DdeConnection&, const String&, long = 0 );
+};
+
+// -----------------
+// - DdeConnection -
+// -----------------
+
+class SVL_DLLPUBLIC DdeConnection
+{
+ friend class DdeInternal;
+ friend class DdeTransaction;
+ std::vector<DdeTransaction*> aTransactions;
+ DdeString* pService;
+ DdeString* pTopic;
+ DdeImp* pImp;
+
+public:
+ DdeConnection( SAL_UNUSED_PARAMETER const String&, SAL_UNUSED_PARAMETER const String& );
+ ~DdeConnection();
+
+ long GetError();
+ long GetConvId();
+
+ static const std::vector<DdeConnection*>& GetConnections();
+
+ sal_Bool IsConnected();
+
+ const String& GetServiceName();
+ const String& GetTopicName();
+
+private:
+ DdeConnection( const DdeConnection& );
+ const DdeConnection& operator= ( const DdeConnection& );
+};
+
+// -----------
+// - DdeItem -
+// -----------
+
+class SVL_DLLPUBLIC DdeItem
+{
+ friend class DdeInternal;
+ friend class DdeTopic;
+ DdeString* pName;
+ DdeTopic* pMyTopic;
+ DdeItemImp* pImpData;
+
+ void IncMonitor( sal_uLong );
+ void DecMonitor( sal_uLong );
+
+protected:
+ sal_uInt8 nType;
+
+public:
+ DdeItem( const sal_Unicode* );
+ DdeItem( SAL_UNUSED_PARAMETER const String& );
+ DdeItem( const DdeItem& );
+ virtual ~DdeItem();
+
+ const OUString GetName() const;
+ short GetLinks();
+ void NotifyClient();
+};
+
+// -----------
+// - DdeItem -
+// -----------
+
+class SVL_DLLPUBLIC DdeGetPutItem : public DdeItem
+{
+public:
+ DdeGetPutItem( const sal_Unicode* p );
+ DdeGetPutItem( const String& rStr );
+ DdeGetPutItem( const DdeItem& rItem );
+
+ virtual DdeData* Get( sal_uLong );
+ virtual sal_Bool Put( const DdeData* );
+ virtual void AdviseLoop( sal_Bool ); // AdviseLoop starten/stoppen
+};
+
+// ------------
+// - DdeTopic -
+// ------------
+
+class SVL_DLLPUBLIC DdeTopic
+{
+ SVL_DLLPRIVATE void _Disconnect( long );
+
+public:
+ virtual void Connect( long );
+ virtual void Disconnect( long );
+ virtual DdeData* Get( sal_uLong );
+ virtual sal_Bool Put( const DdeData* );
+ virtual sal_Bool Execute( const String* );
+ // evt. ein neues anlegen; return 0 -> es konnte nicht angelegt werden
+ virtual sal_Bool MakeItem( const OUString& rItem );
+
+ // es wird ein Warm-/Hot-Link eingerichtet. Return-Wert
+ // besagt ob es geklappt hat
+ virtual sal_Bool StartAdviseLoop();
+ virtual sal_Bool StopAdviseLoop();
+
+private:
+ friend class DdeInternal;
+ friend class DdeService;
+ friend class DdeItem;
+
+private:
+ DdeString* pName;
+ OUString aItem;
+ std::vector<DdeItem*> aItems;
+ Link aConnectLink;
+ Link aDisconnectLink;
+ Link aGetLink;
+ Link aPutLink;
+ Link aExecLink;
+
+public:
+ DdeTopic( SAL_UNUSED_PARAMETER const OUString& );
+ virtual ~DdeTopic();
+
+ const OUString GetName() const;
+ long GetConvId();
+
+ void SetConnectHdl( const Link& rLink ) { aConnectLink = rLink; }
+ const Link& GetConnectHdl() const { return aConnectLink; }
+ void SetDisconnectHdl( const Link& rLink ) { aDisconnectLink = rLink; }
+ const Link& GetDisconnectHdl() const { return aDisconnectLink; }
+ void SetGetHdl( const Link& rLink ) { aGetLink = rLink; }
+ const Link& GetGetHdl() const { return aGetLink; }
+ void SetPutHdl( const Link& rLink ) { aPutLink = rLink; }
+ const Link& GetPutHdl() const { return aPutLink; }
+ void SetExecuteHdl( const Link& rLink ) { aExecLink = rLink; }
+ const Link& GetExecuteHdl() const { return aExecLink; }
+
+ void NotifyClient( const String& );
+ sal_Bool IsSystemTopic();
+
+ void InsertItem( DdeItem* ); // fuer eigene Ableitungen!
+ DdeItem* AddItem( const DdeItem& ); // werden kopiert !
+ void RemoveItem( const DdeItem& );
+ const OUString& GetCurItem() { return aItem; }
+ const std::vector<DdeItem*>& GetItems() const { return aItems; }
+
+private:
+ DdeTopic( const DdeTopic& );
+ const DdeTopic& operator= ( const DdeTopic& );
+};
+
+// --------------
+// - DdeService -
+// --------------
+
+class SVL_DLLPUBLIC DdeService
+{
+ friend class DdeInternal;
+
+public:
+ virtual sal_Bool IsBusy();
+ virtual String GetHelp();
+ // evt. ein neues anlegen; return 0 -> es konnte nicht angelegt werden
+ virtual sal_Bool MakeTopic( const OUString& rItem );
+
+protected:
+ virtual String Topics();
+ virtual String Formats();
+ virtual String SysItems();
+ virtual String Status();
+ virtual String SysTopicGet( const String& );
+ virtual sal_Bool SysTopicExecute( const String* );
+
+ const DdeTopic* GetSysTopic() const { return pSysTopic; }
+private:
+ std::vector<DdeTopic*> aTopics;
+ DdeFormats aFormats;
+ DdeTopic* pSysTopic;
+ DdeString* pName;
+ ConvList* pConv;
+ short nStatus;
+
+ SVL_DLLPRIVATE sal_Bool HasCbFormat( sal_uInt16 );
+
+public:
+ DdeService( SAL_UNUSED_PARAMETER const String& );
+ virtual ~DdeService();
+
+ const OUString GetName() const;
+ short GetError() { return nStatus; }
+
+ static DdeServices& GetServices();
+ std::vector<DdeTopic*>& GetTopics() { return aTopics; }
+
+ void AddTopic( const DdeTopic& );
+ void RemoveTopic( const DdeTopic& );
+
+ void AddFormat( sal_uLong );
+ void RemoveFormat( sal_uLong );
+ sal_Bool HasFormat( sal_uLong );
+
+private:
+ // DdeService( const DdeService& );
+ //int operator= ( const DdeService& );
+};
+
+// ------------------
+// - DdeTransaction -
+// ------------------
+
+inline long DdeTransaction::GetError()
+{
+ return rDde.GetError();
+}
+#endif // _SVDDE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/svl.hrc b/include/svl/svl.hrc
new file mode 100644
index 000000000000..407fd6783c0f
--- /dev/null
+++ b/include/svl/svl.hrc
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVL_HRC
+#define _SVL_HRC
+
+#include <svl/solar.hrc>
+
+#define STR_SVT_MIMETYPE_START (RID_SVL_START)
+#define STR_SVT_MIMETYPE_APP_OCTSTREAM (STR_SVT_MIMETYPE_START+0)
+#define STR_SVT_MIMETYPE_APP_PDF (STR_SVT_MIMETYPE_START+1)
+#define STR_SVT_MIMETYPE_APP_RTF (STR_SVT_MIMETYPE_START+2)
+#define STR_SVT_MIMETYPE_APP_MSWORD (STR_SVT_MIMETYPE_START+3)
+#define STR_SVT_MIMETYPE_APP_STARCALC (STR_SVT_MIMETYPE_START+4)
+#define STR_SVT_MIMETYPE_APP_STARCHART (STR_SVT_MIMETYPE_START+5)
+#define STR_SVT_MIMETYPE_APP_STARDRAW (STR_SVT_MIMETYPE_START+6)
+#define STR_SVT_MIMETYPE_APP_STARIMAGE (STR_SVT_MIMETYPE_START+7)
+#define STR_SVT_MIMETYPE_APP_STARMATH (STR_SVT_MIMETYPE_START+8)
+#define STR_SVT_MIMETYPE_APP_STARWRITER (STR_SVT_MIMETYPE_START+9)
+#define STR_SVT_MIMETYPE_APP_ZIP (STR_SVT_MIMETYPE_START+10)
+#define STR_SVT_MIMETYPE_AUDIO_AIFF (STR_SVT_MIMETYPE_START+11)
+#define STR_SVT_MIMETYPE_AUDIO_BASIC (STR_SVT_MIMETYPE_START+12)
+#define STR_SVT_MIMETYPE_AUDIO_VORBIS (STR_SVT_MIMETYPE_START+13)
+#define STR_SVT_MIMETYPE_AUDIO_MIDI (STR_SVT_MIMETYPE_START+14)
+#define STR_SVT_MIMETYPE_AUDIO_WAV (STR_SVT_MIMETYPE_START+15)
+#define STR_SVT_MIMETYPE_IMAGE_GIF (STR_SVT_MIMETYPE_START+16)
+#define STR_SVT_MIMETYPE_IMAGE_JPEG (STR_SVT_MIMETYPE_START+17)
+#define STR_SVT_MIMETYPE_IMAGE_PCX (STR_SVT_MIMETYPE_START+18)
+#define STR_SVT_MIMETYPE_IMAGE_BMP (STR_SVT_MIMETYPE_START+19)
+#define STR_SVT_MIMETYPE_TEXT_HTML (STR_SVT_MIMETYPE_START+20)
+#define STR_SVT_MIMETYPE_TEXT_PLAIN (STR_SVT_MIMETYPE_START+21)
+#define STR_SVT_MIMETYPE_TEXT_URL (STR_SVT_MIMETYPE_START+22)
+#define STR_SVT_MIMETYPE_TEXT_VCARD (STR_SVT_MIMETYPE_START+23)
+#define STR_SVT_MIMETYPE_VIDEO_THEORA (STR_SVT_MIMETYPE_START+24)
+#define STR_SVT_MIMETYPE_VIDEO_VDO (STR_SVT_MIMETYPE_START+25)
+#define STR_SVT_MIMETYPE_VIDEO_MSVIDEO (STR_SVT_MIMETYPE_START+26)
+#define STR_SVT_MIMETYPE_X_STARMAIL (STR_SVT_MIMETYPE_START+27)
+#define STR_SVT_MIMETYPE_X_VRML (STR_SVT_MIMETYPE_START+28)
+#define STR_SVT_MIMETYPE_APP_STARHELP (STR_SVT_MIMETYPE_START+29)
+#define STR_SVT_MIMETYPE_APP_STARIMPRESS (STR_SVT_MIMETYPE_START+30)
+
+#define STR_SVT_MIMETYPE_CNT_FSYSBOX (STR_SVT_MIMETYPE_START+35)
+#define STR_SVT_MIMETYPE_CNT_FSYSFLD (STR_SVT_MIMETYPE_START+36)
+#define STR_SVT_MIMETYPE_APP_GAL (STR_SVT_MIMETYPE_START+37)
+#define STR_SVT_MIMETYPE_APP_GAL_THEME (STR_SVT_MIMETYPE_START+38)
+#define STR_SVT_MIMETYPE_APP_STARW_GLOB (STR_SVT_MIMETYPE_START+39)
+#define STR_SVT_MIMETYPE_APP_SDM (STR_SVT_MIMETYPE_START+40)
+#define STR_SVT_MIMETYPE_APP_SMD (STR_SVT_MIMETYPE_START+41)
+#define STR_SVT_MIMETYPE_APP_STARW_WEB (STR_SVT_MIMETYPE_START+42)
+#define STR_SVT_MIMETYPE_SCHEDULE (STR_SVT_MIMETYPE_START+43)
+#define STR_SVT_MIMETYPE_SCHEDULE_EVT (STR_SVT_MIMETYPE_START+44)
+#define STR_SVT_MIMETYPE_SCHEDULE_TASK (STR_SVT_MIMETYPE_START+45)
+#define STR_SVT_MIMETYPE_SCHEDULE_FEVT (STR_SVT_MIMETYPE_START+46)
+#define STR_SVT_MIMETYPE_SCHEDULE_FTASK (STR_SVT_MIMETYPE_START+47)
+#define STR_SVT_MIMETYPE_FRAMESET (STR_SVT_MIMETYPE_START+48)
+#define STR_SVT_MIMETYPE_MACRO (STR_SVT_MIMETYPE_START+49)
+#define STR_SVT_MIMETYPE_CNT_SFSYSFOLDER (STR_SVT_MIMETYPE_START+50)
+#define STR_SVT_MIMETYPE_APP_TEMPLATE (STR_SVT_MIMETYPE_START+51)
+#define STR_SVT_MIMETYPE_IMAGE_GENERIC (STR_SVT_MIMETYPE_START+52)
+#define STR_SVT_MIMETYPE_APP_MSEXCEL (STR_SVT_MIMETYPE_START+53)
+#define STR_SVT_MIMETYPE_APP_MSEXCEL_TEMPL (STR_SVT_MIMETYPE_START+54)
+#define STR_SVT_MIMETYPE_APP_MSPPOINT (STR_SVT_MIMETYPE_START+55)
+#define STR_SVT_MIMETYPE_TEXT_VCALENDAR (STR_SVT_MIMETYPE_START+56)
+#define STR_SVT_MIMETYPE_TEXT_ICALENDAR (STR_SVT_MIMETYPE_START+57)
+#define STR_SVT_MIMETYPE_TEXT_XMLICALENDAR (STR_SVT_MIMETYPE_START+58)
+#define STR_SVT_MIMETYPE_TEXT_CDE_CALENDAR_APP (STR_SVT_MIMETYPE_START+59)
+#define STR_SVT_MIMETYPE_INET_MSG_RFC822 (STR_SVT_MIMETYPE_START+60)
+#define STR_SVT_MIMETYPE_INET_MULTI_ALTERNATIVE (STR_SVT_MIMETYPE_START+61)
+#define STR_SVT_MIMETYPE_INET_MULTI_DIGEST (STR_SVT_MIMETYPE_START+62)
+#define STR_SVT_MIMETYPE_INET_MULTI_PARALLEL (STR_SVT_MIMETYPE_START+63)
+#define STR_SVT_MIMETYPE_INET_MULTI_RELATED (STR_SVT_MIMETYPE_START+64)
+#define STR_SVT_MIMETYPE_INET_MULTI_MIXED (STR_SVT_MIMETYPE_START+65)
+#define STR_SVT_MIMETYPE_APP_IMPRESSPACKED (STR_SVT_MIMETYPE_START+66)
+#define STR_SVT_MIMETYPE_APP_JAR (STR_SVT_MIMETYPE_START+67)
+#define STR_SVT_MIMETYPE_IMAGE_PNG (STR_SVT_MIMETYPE_START+68)
+#define STR_SVT_MIMETYPE_IMAGE_TIFF (STR_SVT_MIMETYPE_START+69)
+
+#define STR_SVT_MIMETYPE_APP_SXCALC (STR_SVT_MIMETYPE_START+70)
+#define STR_SVT_MIMETYPE_APP_SXCHART (STR_SVT_MIMETYPE_START+71)
+#define STR_SVT_MIMETYPE_APP_SXDRAW (STR_SVT_MIMETYPE_START+72)
+#define STR_SVT_MIMETYPE_APP_SXMATH (STR_SVT_MIMETYPE_START+73)
+#define STR_SVT_MIMETYPE_APP_SXWRITER (STR_SVT_MIMETYPE_START+74)
+#define STR_SVT_MIMETYPE_APP_SXIMPRESS (STR_SVT_MIMETYPE_START+75)
+#define STR_SVT_MIMETYPE_APP_SXGLOBAL (STR_SVT_MIMETYPE_START+76)
+#define STR_SVT_MIMETYPE_APP_SXIPACKED (STR_SVT_MIMETYPE_START+77)
+
+
+#define STR_SVT_MIMETYPE_VIDEO_WEBM (STR_SVT_MIMETYPE_START+78)
+#define STR_SVT_MIMETYPE_AUDIO_WEBM (STR_SVT_MIMETYPE_START+79)
+
+#define STR_SVT_MIMETYPE_END (STR_SVT_MIMETYPE_AUDIO_WEBM)
+
+#define STR_COLUM_DT_AUTO (STR_SVT_MIMETYPE_END+1)
+
+#endif // #ifndef _SVTOOLS_HRC
+
+// ******************************************************************* EOF
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/svldllapi.h b/include/svl/svldllapi.h
new file mode 100644
index 000000000000..5d0feda87469
--- /dev/null
+++ b/include/svl/svldllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVLDLLAPI_H
+#define INCLUDED_SVLDLLAPI_H
+
+#include "sal/types.h"
+
+#if defined(SVL_DLLIMPLEMENTATION)
+#define SVL_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define SVL_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define SVL_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif /* INCLUDED_SVLDLLAPI_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/szitem.hxx b/include/svl/szitem.hxx
new file mode 100644
index 000000000000..1a576eced6fd
--- /dev/null
+++ b/include/svl/szitem.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXSZITEM_HXX
+#define _SFXSZITEM_HXX
+
+#include <tools/gen.hxx>
+
+#include <svl/poolitem.hxx>
+
+class SvStream;
+
+DBG_NAMEEX(SfxSizeItem)
+
+// -----------------------------------------------------------------------
+
+class SfxSizeItem : public SfxPoolItem
+{
+private:
+ Size aVal;
+
+public:
+ TYPEINFO();
+ SfxSizeItem();
+ SfxSizeItem( sal_uInt16 nWhich, const Size& rVal );
+ SfxSizeItem( const SfxSizeItem& );
+ ~SfxSizeItem() { DBG_DTOR(SfxSizeItem, 0); }
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper * = 0 ) const;
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16 nItemVersion) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+
+ const Size& GetValue() const { return aVal; }
+ void SetValue( const Size& rNewVal ) {
+ DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
+ aVal = rNewVal; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/undo.hxx b/include/svl/undo.hxx
new file mode 100644
index 000000000000..f36cd816b607
--- /dev/null
+++ b/include/svl/undo.hxx
@@ -0,0 +1,474 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _UNDO_HXX
+#define _UNDO_HXX
+
+#include "svl/svldllapi.h"
+#include <tools/rtti.hxx>
+#include <tools/string.hxx>
+
+#include <boost/scoped_ptr.hpp>
+
+#include <vector>
+#include <limits>
+
+//====================================================================
+
+class SVL_DLLPUBLIC SfxRepeatTarget
+{
+public:
+ TYPEINFO();
+ virtual ~SfxRepeatTarget() = 0;
+};
+
+//====================================================================
+
+class SVL_DLLPUBLIC SfxUndoContext
+{
+public:
+ virtual ~SfxUndoContext() = 0;
+};
+
+//====================================================================
+
+class SVL_DLLPUBLIC SfxUndoAction
+{
+ sal_Bool bLinked;
+public:
+ TYPEINFO();
+ SfxUndoAction();
+ virtual ~SfxUndoAction();
+
+ virtual sal_Bool IsLinked();
+ virtual void SetLinked( sal_Bool bIsLinked = sal_True );
+ virtual void Undo();
+ virtual void UndoWithContext( SfxUndoContext& i_context );
+ virtual void Redo();
+ virtual void RedoWithContext( SfxUndoContext& i_context );
+ virtual void Repeat(SfxRepeatTarget&);
+ virtual sal_Bool CanRepeat(SfxRepeatTarget&) const;
+
+ virtual sal_Bool Merge( SfxUndoAction *pNextAction );
+
+ virtual OUString GetComment() const;
+ virtual OUString GetRepeatComment(SfxRepeatTarget&) const;
+ virtual sal_uInt16 GetId() const;
+
+private:
+ SfxUndoAction& operator=( const SfxUndoAction& ); // n.i.!!
+};
+
+//========================================================================
+
+/// is a mark on the Undo stack
+typedef sal_Int32 UndoStackMark;
+#define MARK_INVALID ::std::numeric_limits< UndoStackMark >::max()
+
+//========================================================================
+
+struct MarkedUndoAction
+{
+ SfxUndoAction* pAction;
+ ::std::vector< UndoStackMark > aMarks;
+
+ MarkedUndoAction( SfxUndoAction* i_action )
+ :pAction( i_action )
+ ,aMarks()
+ {
+ }
+};
+
+class SfxUndoActions
+{
+private:
+ ::std::vector< MarkedUndoAction > m_aActions;
+
+public:
+ SfxUndoActions()
+ {
+ }
+
+ bool empty() const { return m_aActions.empty(); }
+ size_t size() const { return m_aActions.size(); }
+
+ const MarkedUndoAction& operator[]( size_t i ) const { return m_aActions[i]; }
+ MarkedUndoAction& operator[]( size_t i ) { return m_aActions[i]; }
+
+ void Remove( size_t i_pos )
+ {
+ m_aActions.erase( m_aActions.begin() + i_pos );
+ }
+
+ void Remove( size_t i_pos, size_t i_count )
+ {
+ m_aActions.erase( m_aActions.begin() + i_pos, m_aActions.begin() + i_pos + i_count );
+ }
+
+ void Insert( SfxUndoAction* i_action, size_t i_pos )
+ {
+ m_aActions.insert( m_aActions.begin() + i_pos, MarkedUndoAction( i_action ) );
+ }
+};
+
+//====================================================================
+
+/** do not make use of these implementation details, unless you
+ really really have to! */
+struct SVL_DLLPUBLIC SfxUndoArray
+{
+ SfxUndoActions aUndoActions;
+ size_t nMaxUndoActions;
+ size_t nCurUndoAction;
+ SfxUndoArray *pFatherUndoArray;
+ SfxUndoArray(size_t nMax=0):
+ nMaxUndoActions(nMax), nCurUndoAction(0),
+ pFatherUndoArray(0) {}
+ ~SfxUndoArray();
+};
+
+//=========================================================================
+
+/** do not make use of these implementation details, unless you
+ really really have to! */
+class SVL_DLLPUBLIC SfxListUndoAction : public SfxUndoAction, public SfxUndoArray
+
+/* [Beschreibung]
+
+ UndoAction zur Klammerung mehrerer Undos in einer UndoAction.
+ Diese Actions werden vom SfxUndoManager verwendet. Dort
+ wird mit < SfxUndoManager::EnterListAction > eine Klammerebene
+ geoeffnet und mit <SfxUndoManager::LeaveListAction > wieder
+ geschlossen. Redo und Undo auf SfxListUndoActions wirken
+ Elementweise.
+
+*/
+{
+ public:
+ TYPEINFO();
+
+ SfxListUndoAction( const OUString &rComment,
+ const OUString rRepeatComment, sal_uInt16 Id, SfxUndoArray *pFather);
+ virtual void Undo();
+ virtual void UndoWithContext( SfxUndoContext& i_context );
+ virtual void Redo();
+ virtual void RedoWithContext( SfxUndoContext& i_context );
+ virtual void Repeat(SfxRepeatTarget&);
+ virtual sal_Bool CanRepeat(SfxRepeatTarget&) const;
+
+ virtual sal_Bool Merge( SfxUndoAction *pNextAction );
+
+ virtual OUString GetComment() const;
+ virtual OUString GetRepeatComment(SfxRepeatTarget&) const;
+ virtual sal_uInt16 GetId() const;
+
+ void SetComment(const OUString& rComment);
+
+ private:
+
+ sal_uInt16 nId;
+ OUString aComment;
+ OUString aRepeatComment;
+
+};
+
+//=========================================================================
+
+/** is a callback interface for notifications about state changes of an SfxUndoManager
+*/
+class SAL_NO_VTABLE SfxUndoListener
+{
+public:
+ virtual void actionUndone( const String& i_actionComment ) = 0;
+ virtual void actionRedone( const String& i_actionComment ) = 0;
+ virtual void undoActionAdded( const String& i_actionComment ) = 0;
+ virtual void cleared() = 0;
+ virtual void clearedRedo() = 0;
+ virtual void resetAll() = 0;
+ virtual void listActionEntered( const String& i_comment ) = 0;
+ virtual void listActionLeft( const String& i_comment ) = 0;
+ virtual void listActionLeftAndMerged() = 0;
+ virtual void listActionCancelled() = 0;
+ virtual void undoManagerDying() = 0;
+
+protected:
+ ~SfxUndoListener() {}
+};
+
+//=========================================================================
+
+namespace svl
+{
+ class SAL_NO_VTABLE IUndoManager
+ {
+ public:
+ enum
+ {
+ CurrentLevel = true,
+ TopLevel = false
+ };
+
+ virtual ~IUndoManager() { };
+
+ virtual void SetMaxUndoActionCount( size_t nMaxUndoActionCount ) = 0;
+ virtual size_t GetMaxUndoActionCount() const = 0;
+
+ virtual void AddUndoAction( SfxUndoAction *pAction, sal_Bool bTryMerg=sal_False ) = 0;
+
+ virtual size_t GetUndoActionCount( bool const i_currentLevel = CurrentLevel ) const = 0;
+ virtual sal_uInt16 GetUndoActionId() const = 0;
+ virtual OUString GetUndoActionComment( size_t nNo=0, bool const i_currentLevel = CurrentLevel ) const = 0;
+ virtual SfxUndoAction* GetUndoAction( size_t nNo=0 ) const = 0;
+
+ virtual size_t GetRedoActionCount( bool const i_currentLevel = CurrentLevel ) const = 0;
+ virtual OUString GetRedoActionComment( size_t nNo=0, bool const i_currentLevel = CurrentLevel ) const = 0;
+
+ virtual sal_Bool Undo() = 0;
+ virtual sal_Bool Redo() = 0;
+
+ /** clears both the Redo and the Undo stack.
+
+ Will assert and bail out when called while within a list action (<member>IsInListAction</member>).
+ */
+ virtual void Clear() = 0;
+
+ /** clears the Redo stack.
+
+ Will assert and bail out when called while within a list action (<member>IsInListAction</member>).
+ */
+ virtual void ClearRedo() = 0;
+
+ /** leaves any possible open list action (<member>IsInListAction</member>), and clears both the Undo and the
+ Redo stack.
+
+ Effectively, calling this method is equivalent to <code>while ( IsInListAction() ) LeaveListAction();</code>,
+ followed by <code>Clear()</code>. The only difference to this calling sequence is that Reset is an
+ atomic operation, also resulting in only one notification.
+ */
+ virtual void Reset() = 0;
+
+ /** determines whether an Undo or Redo is currently running
+ */
+ virtual bool IsDoing() const = 0;
+
+ virtual size_t GetRepeatActionCount() const = 0;
+ virtual OUString GetRepeatActionComment( SfxRepeatTarget &rTarget) const = 0;
+ virtual sal_Bool Repeat( SfxRepeatTarget &rTarget ) = 0;
+ virtual sal_Bool CanRepeat( SfxRepeatTarget &rTarget ) const = 0;
+
+ virtual void EnterListAction(const OUString &rComment, const OUString& rRepeatComment, sal_uInt16 nId=0) = 0;
+
+ /** leaves the list action entered with EnterListAction
+ @return the number of the sub actions in the list which has just been left. Note that in case no such
+ actions exist, the list action does not contribute to the Undo stack, but is silently removed.
+ */
+ virtual size_t LeaveListAction() = 0;
+
+ /** leaves the list action entered with EnterListAction, and forcefully merges the previous
+ action on the stack into the newly created list action.
+
+ Say you have an Undo action A on the stack, then call EnterListAction, followed by one or more calls to
+ AddUndoAction, followed by a call to LeaveAndMergeListAction. In opposite to LeaveListAction, your Undo
+ stack will now still contain one undo action: the newly created list action, whose first child is the
+ original A, whose other children are those you added via AddUndoAction, and whose comment is the same as
+ the comment of A.
+
+ Effectively, this means that all actions added between EnterListAction and LeaveAndMergeListAction are
+ hidden from the user.
+
+ @return the number of the sub actions in the list which has just been left. Note that in case no such
+ actions exist, the list action does not contribute to the Undo stack, but is silently removed.
+ */
+ virtual size_t LeaveAndMergeListAction() = 0;
+
+ /// determines whether we're within a ListAction context, i.e. a LeaveListAction/LeaveAndMergeListAction call is pending
+ virtual bool IsInListAction() const = 0;
+
+ /// determines how many nested list actions are currently open
+ virtual size_t GetListActionDepth() const = 0;
+
+ /** clears the redo stack and removes the top undo action */
+ virtual void RemoveLastUndoAction() = 0;
+
+ /** 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!
+
+ Multiple calls to <code>EnableUndo</code> are not cumulative. That is, calling <code>EnableUndo( false )</code>
+ twice, and then calling <code>EnableUndo( true )</code> means that Undo is enable afterwards.
+ */
+ virtual void EnableUndo( bool bEnable ) = 0;
+
+ // 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.
+ virtual bool IsUndoEnabled() const = 0;
+
+ /// adds a new listener to be notified about changes in the UndoManager's state
+ virtual void AddUndoListener( SfxUndoListener& i_listener ) = 0;
+ virtual void RemoveUndoListener( SfxUndoListener& i_listener ) = 0;
+ };
+}
+
+//=========================================================================
+
+namespace svl { namespace undo { namespace impl
+{
+ class UndoManagerGuard;
+ class LockGuard;
+} } }
+
+struct SfxUndoManager_Data;
+class SVL_DLLPUBLIC SfxUndoManager : public ::svl::IUndoManager
+{
+ friend class SfxLinkUndoAction;
+
+ ::boost::scoped_ptr< SfxUndoManager_Data >
+ m_pData;
+public:
+ SfxUndoManager( size_t nMaxUndoActionCount = 20 );
+ virtual ~SfxUndoManager();
+
+ // IUndoManager overridables
+ virtual void SetMaxUndoActionCount( size_t nMaxUndoActionCount );
+ virtual size_t GetMaxUndoActionCount() const;
+ virtual void AddUndoAction( SfxUndoAction *pAction, sal_Bool bTryMerg=sal_False );
+ virtual size_t GetUndoActionCount( bool const i_currentLevel = CurrentLevel ) const;
+ virtual sal_uInt16 GetUndoActionId() const;
+ virtual OUString GetUndoActionComment( size_t nNo=0, bool const i_currentLevel = CurrentLevel ) const;
+ virtual SfxUndoAction* GetUndoAction( size_t nNo=0 ) const;
+ virtual size_t GetRedoActionCount( bool const i_currentLevel = CurrentLevel ) const;
+ virtual OUString GetRedoActionComment( size_t nNo=0, bool const i_currentLevel = CurrentLevel ) const;
+ virtual sal_Bool Undo();
+ virtual sal_Bool Redo();
+ virtual void Clear();
+ virtual void ClearRedo();
+ virtual void Reset();
+ virtual bool IsDoing() const;
+ virtual size_t GetRepeatActionCount() const;
+ virtual OUString GetRepeatActionComment( SfxRepeatTarget &rTarget) const;
+ virtual sal_Bool Repeat( SfxRepeatTarget &rTarget );
+ virtual sal_Bool CanRepeat( SfxRepeatTarget &rTarget ) const;
+ virtual void EnterListAction(const OUString &rComment, const OUString& rRepeatComment, sal_uInt16 nId=0);
+ virtual size_t LeaveListAction();
+ virtual size_t LeaveAndMergeListAction();
+ virtual bool IsInListAction() const;
+ virtual size_t GetListActionDepth() const;
+ virtual void RemoveLastUndoAction();
+ virtual void EnableUndo( bool bEnable );
+ virtual bool IsUndoEnabled() const;
+ virtual void AddUndoListener( SfxUndoListener& i_listener );
+ virtual void RemoveUndoListener( SfxUndoListener& i_listener );
+
+ /** marks the current top-level element of the Undo stack, and returns a unique ID for it
+ */
+ UndoStackMark MarkTopUndoAction();
+
+ /** removes a mark given by its ID.
+ After the call, the mark ID is invalid.
+ */
+ void RemoveMark( UndoStackMark const i_mark );
+
+ /** determines whether the top action on the Undo stack has a given mark
+ */
+ bool HasTopUndoActionMark( UndoStackMark const i_mark );
+
+ /** removes the oldest Undo actions from the stack
+ */
+ void RemoveOldestUndoActions( size_t const i_count );
+
+protected:
+ sal_Bool UndoWithContext( SfxUndoContext& i_context );
+ sal_Bool RedoWithContext( SfxUndoContext& i_context );
+
+ void ImplClearRedo_NoLock( bool const i_currentLevel );
+
+ /** clears all undo actions on the current level, plus all undo actions on superordinate levels,
+ as soon as those levels are reached.
+
+ If no list action is active currently, i.e. we're on the top level already, this method is equivalent to
+ ->Clear.
+
+ Otherwise, the Undo actions on the current level are removed. Upon leaving the current list action, all
+ undo actions on the then-current level are removed, too. This is continued until the top level is reached.
+ */
+ void ClearAllLevels();
+
+private:
+ size_t ImplLeaveListAction( const bool i_merge, ::svl::undo::impl::UndoManagerGuard& i_guard );
+ bool ImplAddUndoAction_NoNotify( SfxUndoAction* pAction, bool bTryMerge, bool bClearRedo, ::svl::undo::impl::UndoManagerGuard& i_guard );
+ void ImplClearRedo( ::svl::undo::impl::UndoManagerGuard& i_guard, bool const i_currentLevel );
+ void ImplClearUndo( ::svl::undo::impl::UndoManagerGuard& i_guard );
+ void ImplClearCurrentLevel_NoNotify( ::svl::undo::impl::UndoManagerGuard& i_guard );
+ size_t ImplGetRedoActionCount_Lock( bool const i_currentLevel = CurrentLevel ) const;
+ bool ImplIsUndoEnabled_Lock() const;
+ bool ImplIsInListAction_Lock() const;
+ void ImplEnableUndo_Lock( bool const i_enable );
+
+ sal_Bool ImplUndo( SfxUndoContext* i_contextOrNull );
+ sal_Bool ImplRedo( SfxUndoContext* i_contextOrNull );
+
+ friend class ::svl::undo::impl::LockGuard;
+};
+
+//=========================================================================
+
+class SVL_DLLPUBLIC SfxLinkUndoAction : public SfxUndoAction
+
+/* [Beschreibung]
+
+ Die SfxLinkUndoAction dient zur Verbindung zweier SfxUndoManager. Die
+ im ersten SfxUndoManager eingefuegten SfxUndoAction leiten ihr Undo und Redo
+ an den zweiten weiter, so dass ein Undo und Redo am ersten
+ SfxUndoManager wie eine am zweiten wirkt.
+
+ Die SfxLinkUndoAction ist nach dem Einfuegen der SfxUndoAction am
+ zweiten SfxUndoManager einzufuegen. Waehrend der zweite SfxUndoManager
+ vom ersten ferngesteuert wird, duerfen an ihm weder Actions eingefuegt werden,
+ noch darf Undo/Redo aufgerufen werden.
+
+*/
+
+{
+public:
+ TYPEINFO();
+ SfxLinkUndoAction(::svl::IUndoManager *pManager);
+ ~SfxLinkUndoAction();
+
+ virtual void Undo();
+ virtual void Redo();
+ virtual sal_Bool CanRepeat(SfxRepeatTarget& r) const;
+
+ virtual void Repeat(SfxRepeatTarget&r);
+
+ virtual OUString GetComment() const;
+ virtual OUString GetRepeatComment(SfxRepeatTarget&r) const;
+ virtual sal_uInt16 GetId() const;
+
+ SfxUndoAction* GetAction() const { return pAction; }
+
+protected:
+ ::svl::IUndoManager *pUndoManager;
+ SfxUndoAction *pAction;
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/urihelper.hxx b/include/svl/urihelper.hxx
new file mode 100644
index 000000000000..321d9cd2ae0b
--- /dev/null
+++ b/include/svl/urihelper.hxx
@@ -0,0 +1,165 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVTOOLS_URIHELPER_HXX
+#define SVTOOLS_URIHELPER_HXX
+
+#include "svl/svldllapi.h"
+#include "com/sun/star/uno/Reference.hxx"
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <rtl/textenc.h>
+#include <tools/link.hxx>
+#include <tools/solar.h>
+#include <tools/urlobj.hxx>
+
+namespace com { namespace sun { namespace star {
+ namespace uno { class XComponentContext; }
+ namespace uri { class XUriReference; }
+} } }
+
+class CharClass;
+
+//============================================================================
+namespace URIHelper {
+
+/**
+ @ATT
+ Calling this function with defaulted arguments rMaybeFileHdl = Link() and
+ bCheckFileExists = true often leads to results that are not intended:
+ Whenever the given rTheBaseURIRef is a file URL, the given rTheRelURIRef is
+ relative, and rTheRelURIRef could also be smart-parsed as a non-file URL
+ (e.g., the relative URL "foo/bar" can be smart-parsed as "http://foo/bar"),
+ then SmartRel2Abs called with rMaybeFileHdl = Link() and bCheckFileExists =
+ true returns the non-file URL interpretation. To avoid this, either pass
+ some non-null rMaybeFileHdl if you want to check generated file URLs for
+ existence (see URIHelper::GetMaybeFileHdl), or use bCheckFileExists = false
+ if you want to generate file URLs without checking for their existence.
+*/
+SVL_DLLPUBLIC OUString SmartRel2Abs(INetURLObject const & rTheBaseURIRef,
+ OUString const & rTheRelURIRef,
+ Link const & rMaybeFileHdl = Link(),
+ bool bCheckFileExists = true,
+ bool bIgnoreFragment = false,
+ INetURLObject::EncodeMechanism eEncodeMechanism = INetURLObject::WAS_ENCODED,
+ INetURLObject::DecodeMechanism eDecodeMechanism = INetURLObject::DECODE_TO_IURI,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8,
+ bool bRelativeNonURIs = false,
+ INetURLObject::FSysStyle eStyle = INetURLObject::FSYS_DETECT);
+
+//============================================================================
+SVL_DLLPUBLIC void SetMaybeFileHdl(Link const & rTheMaybeFileHdl);
+
+//============================================================================
+SVL_DLLPUBLIC Link GetMaybeFileHdl();
+
+/**
+ Converts a URI reference to a relative one, ignoring certain differences (for
+ example, treating file URLs for case-ignoring file systems
+ case-insensitively).
+
+ @param context a component context; must not be null
+
+ @param baseUriReference a base URI reference
+
+ @param uriReference a URI reference
+
+ @return a URI reference representing the given uriReference relative to the
+ given baseUriReference; if the given baseUriReference is not an absolute,
+ hierarchical URI reference, or the given uriReference is not a valid URI
+ reference, null is returned
+
+ @exception std::bad_alloc if an out-of-memory condition occurs
+
+ @exception com::sun::star::uno::RuntimeException if any error occurs
+ */
+SVL_DLLPUBLIC com::sun::star::uno::Reference< com::sun::star::uri::XUriReference >
+normalizedMakeRelative(
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ const & context,
+ OUString const & baseUriReference, OUString const & uriReference);
+
+/**
+ A variant of normalizedMakeRelative with a simplified interface.
+
+ Internally calls normalizedMakeRelative with the default component context.
+
+ @param baseUriReference a base URI reference, passed to
+ normalizedMakeRelative
+
+ @param uriReference a URI reference, passed to normalizedMakeRelative
+
+ @return if the XUriReference returnd by normalizedMakeRelative is empty,
+ uriReference is returned unmodified; otherwise, the result of calling
+ XUriReference::getUriReference on the XUriReference returnd by
+ normalizedMakeRelative is returned
+
+ @exception std::bad_alloc if an out-of-memory condition occurs
+
+ @exception com::sun::star::uno::RuntimeException if any error occurs
+
+ @deprecated
+ No code should rely on the default component context.
+*/
+SVL_DLLPUBLIC OUString simpleNormalizedMakeRelative( OUString const & baseUriReference,
+ OUString const & uriReference);
+
+//============================================================================
+SVL_DLLPUBLIC OUString FindFirstURLInText(OUString const & rText,
+ sal_Int32 & rBegin,
+ sal_Int32 & rEnd,
+ CharClass const & rCharClass,
+ INetURLObject::EncodeMechanism eMechanism = INetURLObject::WAS_ENCODED,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8,
+ INetURLObject::FSysStyle eStyle = INetURLObject::FSYS_DETECT);
+
+//============================================================================
+/** Remove any password component from both absolute and relative URLs.
+
+ @ATT The current implementation will not remove a password from a
+ relative URL that has an authority component (e.g., the password is not
+ removed from the relative ftp URL <//user:password@domain/path>). But
+ since our functions to translate between absolute and relative URLs never
+ produce relative URLs with authority components, this is no real problem.
+
+ @ATT For relative URLs (or anything not recognized as an absolute URI),
+ the current implementation will return the input unmodified, not applying
+ any translations implied by the encode/decode parameters.
+
+ @param rURI An absolute or relative URI reference.
+
+ @param eEncodeMechanism See the general discussion for INetURLObject set-
+ methods.
+
+ @param eDecodeMechanism See the general discussion for INetURLObject get-
+ methods.
+
+ @param eCharset See the general discussion for INetURLObject get- and
+ set-methods.
+
+ @return The input URI with any password component removed.
+ */
+SVL_DLLPUBLIC OUString removePassword(OUString const & rURI,
+ INetURLObject::EncodeMechanism eEncodeMechanism = INetURLObject::WAS_ENCODED,
+ INetURLObject::DecodeMechanism eDecodeMechanism = INetURLObject::DECODE_TO_IURI,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
+}
+
+#endif // SVTOOLS_URIHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/urlbmk.hxx b/include/svl/urlbmk.hxx
new file mode 100644
index 000000000000..cc04b226d146
--- /dev/null
+++ b/include/svl/urlbmk.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _URLBMK_HXX
+#define _URLBMK_HXX
+
+
+#include <tools/string.hxx>
+
+//=========================================================================
+
+class INetBookmark
+
+/* [Beschreibung]
+
+ Diese Klasse stellt ein Bookmark dar, welches aus einer URL und
+ einem dazuge"horigen Beschreibungstext besteht.
+
+ Es gibt ein eigenes Clipboardformat und Hilfsmethoden zum Kopieren
+ und Einf"ugen in und aus Clipboard und DragServer.
+*/
+
+{
+ String aUrl;
+ String aDescr;
+
+protected:
+
+ void SetURL( const String& rS ) { aUrl = rS; }
+ void SetDescription( const String& rS ) { aDescr = rS; }
+
+public:
+ INetBookmark( const String &rUrl, const String &rDescr )
+ : aUrl( rUrl ), aDescr( rDescr )
+ {}
+ INetBookmark()
+ {}
+
+ const String& GetURL() const { return aUrl; }
+ const String& GetDescription() const { return aDescr; }
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/urlfilter.hxx b/include/svl/urlfilter.hxx
new file mode 100644
index 000000000000..abcf0fd07091
--- /dev/null
+++ b/include/svl/urlfilter.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVTOOLS_URL_FILTER_HXX
+#define SVTOOLS_URL_FILTER_HXX
+
+#include <tools/wldcrd.hxx>
+#include <functional>
+#include <vector>
+/** filters allowed URLs
+*/
+class IUrlFilter
+{
+public:
+ virtual bool isUrlAllowed( const OUString& _rURL ) const = 0;
+
+protected:
+ virtual inline ~IUrlFilter() = 0;
+};
+
+inline IUrlFilter::~IUrlFilter() {}
+
+struct FilterMatch : public ::std::unary_function< bool, WildCard >
+{
+private:
+ const OUString& m_rCompareString;
+public:
+ FilterMatch( const OUString& _rCompareString ) : m_rCompareString( _rCompareString ) { }
+
+ bool operator()( const WildCard& _rMatcher )
+ {
+ return _rMatcher.Matches( m_rCompareString ) ? true : false;
+ }
+
+ static void createWildCardFilterList(const OUString& _rFilterList,::std::vector< WildCard >& _rFilters);
+};
+
+#endif // SVTOOLS_URL_FILTER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/visitem.hxx b/include/svl/visitem.hxx
new file mode 100644
index 000000000000..adb72d0578e7
--- /dev/null
+++ b/include/svl/visitem.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SFXVISIBILITYITEM_HXX
+#define _SFXVISIBILITYITEM_HXX
+
+#include "svl/svldllapi.h"
+#include <tools/debug.hxx>
+#include <svl/poolitem.hxx>
+#include <com/sun/star/frame/status/Visibility.hpp>
+
+//============================================================================
+DBG_NAMEEX_VISIBILITY(SfxVisibilityItem, SVL_DLLPUBLIC)
+
+class SVL_DLLPUBLIC SfxVisibilityItem: public SfxPoolItem
+{
+ ::com::sun::star::frame::status::Visibility m_nValue;
+
+public:
+ TYPEINFO();
+
+ explicit SfxVisibilityItem(sal_uInt16 which = 0, sal_Bool bVisible = sal_True):
+ SfxPoolItem(which)
+ {
+ m_nValue.bVisible = bVisible;
+ DBG_CTOR(SfxVisibilityItem, 0);
+ }
+
+ SfxVisibilityItem(sal_uInt16 which, SvStream & rStream);
+
+ SfxVisibilityItem(const SfxVisibilityItem & rItem):
+ SfxPoolItem(rItem), m_nValue(rItem.m_nValue)
+ { DBG_CTOR(SfxVisibilityItem, 0); }
+
+ virtual ~SfxVisibilityItem() { DBG_DTOR(SfxVisibilityItem, 0); }
+
+ virtual int operator ==(const SfxPoolItem & rItem) const;
+
+ using SfxPoolItem::Compare;
+ virtual int Compare(const SfxPoolItem & rWith) const;
+
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation,
+ SfxMapUnit, SfxMapUnit,
+ OUString & rText,
+ const IntlWrapper * = 0)
+ const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 ) const;
+
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 );
+
+ virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const;
+
+ virtual SvStream & Store(SvStream & rStream, sal_uInt16) const;
+
+ virtual SfxPoolItem * Clone(SfxItemPool * = 0) const;
+
+ virtual sal_uInt16 GetValueCount() const;
+
+ virtual OUString GetValueTextByVal(sal_Bool bTheValue) const;
+
+ sal_Bool GetValue() const { return m_nValue.bVisible; }
+
+ void SetValue(sal_Bool bVisible) { m_nValue.bVisible = bVisible; }
+};
+
+#endif // _SFXVISIBILITYITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/whiter.hxx b/include/svl/whiter.hxx
new file mode 100644
index 000000000000..e92383624743
--- /dev/null
+++ b/include/svl/whiter.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFX_WHITER_HXX
+#define _SFX_WHITER_HXX
+
+#include "svl/svldllapi.h"
+
+#include <limits.h>
+#include <tools/solar.h>
+
+class SfxItemSet;
+
+
+// INCLUDE ---------------------------------------------------------------
+
+class SVL_DLLPUBLIC SfxWhichIter
+{
+ const sal_uInt16 *pRanges, *pStart;
+ sal_uInt16 nOfst, nFrom, nTo;
+
+public:
+ SfxWhichIter( const SfxItemSet& rSet, sal_uInt16 nFrom = 0, sal_uInt16 nTo = USHRT_MAX );
+ ~SfxWhichIter();
+
+ sal_uInt16 GetCurWhich() const { return *pRanges + nOfst; }
+ sal_uInt16 NextWhich();
+ sal_uInt16 FirstWhich();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/xmlement.hxx b/include/svl/xmlement.hxx
new file mode 100644
index 000000000000..c6b67d59105b
--- /dev/null
+++ b/include/svl/xmlement.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVTOOLS_XMLEMENT_HXX
+#define _SVTOOLS_XMLEMENT_HXX
+
+#include <sal/types.h>
+
+struct SvXMLEnumMapEntry
+{
+ const sal_Char *pName;
+ sal_uInt16 nValue;
+};
+
+
+#endif // _SVTOOLS_XMLEMENT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/zforlist.hxx b/include/svl/zforlist.hxx
new file mode 100644
index 000000000000..d5c84235a4f9
--- /dev/null
+++ b/include/svl/zforlist.hxx
@@ -0,0 +1,1037 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _ZFORLIST_HXX
+#define _ZFORLIST_HXX
+
+#include "svl/svldllapi.h"
+#include <rtl/ustrbuf.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/string.hxx>
+#include <i18nlangtag/lang.h>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/i18n/NumberFormatCode.hpp>
+#include <unotools/localedatawrapper.hxx>
+#include <tools/link.hxx>
+#include <svl/ondemand.hxx>
+#include <svl/nfkeytab.hxx>
+
+#include <map>
+#include <set>
+#include <boost/ptr_container/ptr_vector.hpp>
+
+class Date;
+class SvStream;
+class Color;
+class CharClass;
+class CalendarWrapper;
+
+class ImpSvNumberformatScan;
+class ImpSvNumberInputScan;
+class SvNumberformat;
+
+namespace com { namespace sun { namespace star {
+ namespace uno {
+ class XComponentContext;
+ }
+}}}
+
+#define SV_COUNTRY_LANGUAGE_OFFSET 10000 // Max count of formats per country/language
+#define SV_MAX_ANZ_STANDARD_FORMATE 100 // Max count of builtin default formats per CL
+
+// Format types
+#ifndef NUMBERFORMAT_ALL
+// also defined in com/sun/star/util/NumberFormat.hpp
+//! => put in single .idl file and include here
+#define NUMBERFORMAT_ALL 0x000 /// Just for Output of total list, not a real format type
+#define NUMBERFORMAT_DEFINED 0x001 /// Format defined by user
+#define NUMBERFORMAT_DATE 0x002 /// Number as date
+#define NUMBERFORMAT_TIME 0x004 /// Number as time
+#define NUMBERFORMAT_CURRENCY 0x008 /// Number as currency
+#define NUMBERFORMAT_NUMBER 0x010 /// Any "normal" number format
+#define NUMBERFORMAT_SCIENTIFIC 0x020 /// Number as scientific
+#define NUMBERFORMAT_FRACTION 0x040 /// Number as fraction
+#define NUMBERFORMAT_PERCENT 0x080 /// Number as percent
+#define NUMBERFORMAT_TEXT 0x100 /// Text format
+#define NUMBERFORMAT_DATETIME 0x006 /// Number as date and time
+#define NUMBERFORMAT_LOGICAL 0x400 /// Number as boolean value
+#define NUMBERFORMAT_UNDEFINED 0x800 /// Format undefined yet in analyzing
+#endif
+#define NUMBERFORMAT_ENTRY_NOT_FOUND (sal_uInt32)(0xffffffff) /// MAX_ULONG
+
+
+/** enum values for <method>SvNumberFormatter::GetFormatIndex</method>
+
+ <p>
+ Builtin standard formats, order should be also the arrangement in the
+ dialog list box representation.</p>
+
+ <p>
+ Date specials:<ul>
+ <li>SYSTEM: As set in System Regional Settings.
+ <li>SYS: short/long defined, order and separators from System Regional Settings.
+ <li>DEF: short/long and order defined, separators from System Regional Settings.
+ <li>DIN: all settings hard coded as DIN (Deutsche Industrie Norm) and EN (European Norm) require.
+ <li>all other: hard coded
+ </ul>
+
+ Do NOT insert any new values!
+ The values here correspond with those in offapi/com/sun/star/i18n/NumberFormatIndex.idl
+ */
+enum NfIndexTableOffset
+{
+ NF_NUMERIC_START = 0,
+
+ NF_NUMBER_START = NF_NUMERIC_START,
+ NF_NUMBER_STANDARD = NF_NUMBER_START, // Standard/General
+ NF_NUMBER_INT, // 0
+ NF_NUMBER_DEC2, // 0.00
+ NF_NUMBER_1000INT, // #,##0
+ NF_NUMBER_1000DEC2, // #,##0.00
+ NF_NUMBER_SYSTEM, // #,##0.00 or whatever is set in System Regional Settings
+ NF_NUMBER_END = NF_NUMBER_SYSTEM,
+
+ NF_SCIENTIFIC_START,
+ NF_SCIENTIFIC_000E000 = NF_SCIENTIFIC_START, // 0.00E+000
+ NF_SCIENTIFIC_000E00, // 0.00E+00
+ NF_SCIENTIFIC_END = NF_SCIENTIFIC_000E00,
+
+ NF_PERCENT_START,
+ NF_PERCENT_INT = NF_PERCENT_START, // 0%
+ NF_PERCENT_DEC2, // 0.00%
+ NF_PERCENT_END = NF_PERCENT_DEC2,
+
+ NF_FRACTION_START,
+ NF_FRACTION_1 = NF_FRACTION_START, // # ?/?
+ NF_FRACTION_2, // # ??/??
+ NF_FRACTION_END = NF_FRACTION_2,
+
+ NF_NUMERIC_END = NF_FRACTION_END,
+
+ NF_CURRENCY_START,
+ NF_CURRENCY_1000INT = NF_CURRENCY_START,// #,##0 DM
+ NF_CURRENCY_1000DEC2, // #,##0.00 DM
+ NF_CURRENCY_1000INT_RED, // #,##0 DM negative in red
+ NF_CURRENCY_1000DEC2_RED, // #,##0.00 DM negative in red
+ NF_CURRENCY_1000DEC2_CCC, // #,##0.00 DEM currency abbreviation
+ NF_CURRENCY_1000DEC2_DASHED, // #,##0.-- DM
+ NF_CURRENCY_END = NF_CURRENCY_1000DEC2_DASHED,
+
+ NF_DATE_START,
+ NF_DATE_SYSTEM_SHORT = NF_DATE_START, // 08.10.97
+ NF_DATE_SYSTEM_LONG, // Wednesday, 8. October 1997
+ NF_DATE_SYS_DDMMYY, // 08.10.97
+ NF_DATE_SYS_DDMMYYYY, // 08.10.1997
+ NF_DATE_SYS_DMMMYY, // 8. Oct 97
+ NF_DATE_SYS_DMMMYYYY, // 8. Oct 1997
+ NF_DATE_DIN_DMMMYYYY, // 8. Oct. 1997 DIN
+ NF_DATE_SYS_DMMMMYYYY, // 8. October 1997
+ NF_DATE_DIN_DMMMMYYYY, // 8. October 1997 DIN
+ NF_DATE_SYS_NNDMMMYY, // Wed, 8. Okt 97
+ NF_DATE_DEF_NNDDMMMYY, // Wed 08.Okt 97
+ NF_DATE_SYS_NNDMMMMYYYY, // Wed, 8. Oktober 1997
+ NF_DATE_SYS_NNNNDMMMMYYYY, // Wednesday, 8. Oktober 1997
+ NF_DATE_DIN_MMDD, // 10-08 DIN
+ NF_DATE_DIN_YYMMDD, // 97-10-08 DIN
+ NF_DATE_DIN_YYYYMMDD, // 1997-10-08 DIN
+ NF_DATE_SYS_MMYY, // 10.97
+ NF_DATE_SYS_DDMMM, // 08.Oct
+ NF_DATE_MMMM, // October
+ NF_DATE_QQJJ, // 4. Quarter 97
+ NF_DATE_WW, // week of year
+ NF_DATE_END = NF_DATE_WW,
+
+ NF_TIME_START,
+ NF_TIME_HHMM = NF_TIME_START, // HH:MM
+ NF_TIME_HHMMSS, // HH:MM:SS
+ NF_TIME_HHMMAMPM, // HH:MM AM/PM
+ NF_TIME_HHMMSSAMPM, // HH:MM:SS AM/PM
+ NF_TIME_HH_MMSS, // [HH]:MM:SS
+ NF_TIME_MMSS00, // MM:SS,00
+ NF_TIME_HH_MMSS00, // [HH]:MM:SS,00
+ NF_TIME_END = NF_TIME_HH_MMSS00,
+
+ NF_DATETIME_START,
+ NF_DATETIME_SYSTEM_SHORT_HHMM = NF_DATETIME_START, // 08.10.97 01:23
+ NF_DATETIME_SYS_DDMMYYYY_HHMMSS, // 08.10.1997 01:23:45
+ NF_DATETIME_END = NF_DATETIME_SYS_DDMMYYYY_HHMMSS,
+
+ NF_BOOLEAN, // BOOLEAN
+ NF_TEXT, // @
+
+ // From here on are values of new built-in formats that are not in the
+ // original NumberFormatIndex.idl
+
+ NF_FRACTION_3, // # ?/4
+ NF_FRACTION_4, // # ?/100
+
+ NF_INDEX_TABLE_ENTRIES
+};
+
+
+// #45717# IsNumberFormat( "98-10-24", 30, x ), YMD Format set with DMY
+// International settings doesn't recognize the string as a date.
+/** enum values for <method>SvNumberFormatter::SetEvalDateFormat</method>
+
+ <p>How <method>ImpSvNumberInputScan::GetDateRef</method> shall take the
+ DateFormat order (YMD,DMY,MDY) into account, if called from IsNumberFormat
+ with a date format to match against.
+ */
+enum NfEvalDateFormat
+{
+ /** DateFormat only from International, default. */
+ NF_EVALDATEFORMAT_INTL,
+
+ /** DateFormat only from date format passed to function (if any).
+ If no date format is passed then the DateFormat is taken from International. */
+ NF_EVALDATEFORMAT_FORMAT,
+
+ /** First try the DateFormat from International. If it doesn't match a
+ valid date try the DateFormat from the date format passed. */
+ NF_EVALDATEFORMAT_INTL_FORMAT,
+
+ /** First try the DateFormat from the date format passed. If it doesn't
+ match a valid date try the DateFormat from International. */
+ NF_EVALDATEFORMAT_FORMAT_INTL
+};
+
+
+typedef std::map<sal_uInt32, SvNumberformat*> SvNumberFormatTable;
+typedef std::map<sal_uInt16, sal_uInt32> SvNumberFormatterIndexTable;
+
+typedef ::std::map< sal_uInt32, sal_uInt32> SvNumberFormatterMergeMap;
+
+typedef ::std::set< LanguageType > NfInstalledLocales;
+
+
+/** Language/country dependent currency entries
+ */
+class SVL_DLLPUBLIC NfCurrencyEntry
+{
+ OUString aSymbol; /// currency symbol
+ OUString aBankSymbol; /// currency abbreviation
+ LanguageType eLanguage; /// language/country value
+ sal_uInt16 nPositiveFormat; /// position of symbol
+ sal_uInt16 nNegativeFormat; /// position of symbol and type and position of negative sign
+ sal_uInt16 nDigits; /// count of decimal digits
+ sal_Unicode cZeroChar; /// which character is used for zeros as last decimal digits
+
+ /// not implemented, prevent usage
+ NfCurrencyEntry( const NfCurrencyEntry& );
+ /// not implemented, prevent usage
+ NfCurrencyEntry& operator=( const NfCurrencyEntry& );
+
+private:
+
+ // nDecimalFormat := 0, 1, 2
+ // #,##0 or #,##0.00 or #,##0.-- is returned
+ SVL_DLLPRIVATE OUString Impl_BuildFormatStringNumChars( const LocaleDataWrapper&, sal_uInt16 nDecimalFormat) const;
+
+public:
+
+ NfCurrencyEntry( const LocaleDataWrapper& rLocaleData,
+ LanguageType eLang );
+ NfCurrencyEntry( const ::com::sun::star::i18n::Currency & rCurr,
+ const LocaleDataWrapper& rLocaleData,
+ LanguageType eLang );
+ ~NfCurrencyEntry() {}
+
+ /// Symbols and language identical
+ bool operator==( const NfCurrencyEntry& r ) const;
+
+ const OUString& GetSymbol() const { return aSymbol; }
+ const OUString& GetBankSymbol() const { return aBankSymbol; }
+ LanguageType GetLanguage() const { return eLanguage; }
+ sal_uInt16 GetPositiveFormat() const { return nPositiveFormat; }
+ sal_uInt16 GetNegativeFormat() const { return nNegativeFormat; }
+ sal_uInt16 GetDigits() const { return nDigits; }
+ sal_Unicode GetZeroChar() const { return cZeroChar; }
+
+ /** [$DM-407] (bBank==false) or [$DEM] (bBank==true)
+ is returned. If bBank==false and
+ bWithoutExtension==true only [$DM] */
+ OUString BuildSymbolString(bool bBank, bool bWithoutExtension = false) const;
+
+ /** #,##0.00 [$DM-407] is returned, separators
+ from rLoc, incl. minus sign but without [RED] */
+ OUString BuildPositiveFormatString(bool bBank, const LocaleDataWrapper&,
+ sal_uInt16 nDecimalFormat = 1) const;
+ OUString BuildNegativeFormatString(bool bBank, const LocaleDataWrapper&,
+ sal_uInt16 nDecimalFormat = 1) const;
+
+ /** [$DM-407] (or [$DEM] if bBank==true)
+ is appended/prepended to rStr, incl. minus sign */
+ void CompletePositiveFormatString(OUStringBuffer& rStr, bool bBank,
+ sal_uInt16 nPosiFormat) const;
+ void CompleteNegativeFormatString(OUStringBuffer& rStr, bool bBank,
+ sal_uInt16 nNegaFormat) const;
+
+ /// rSymStr is appended/prepended to rStr, incl. minus sign
+ static void CompletePositiveFormatString(OUStringBuffer& rStr,
+ const OUString& rSymStr, sal_uInt16 nPosiFormat);
+ static void CompleteNegativeFormatString(OUStringBuffer& rStr,
+ const OUString& rSymStr, sal_uInt16 nNegaFormat);
+
+ /** Representation of a currency (symbol position and
+ negative sign) in other language settings */
+ static sal_uInt16 GetEffectivePositiveFormat( sal_uInt16 nIntlFormat,
+ sal_uInt16 nCurrFormat, bool bBank );
+ static sal_uInt16 GetEffectiveNegativeFormat( sal_uInt16 nIntlFormat,
+ sal_uInt16 nCurrFormat, bool bBank );
+
+ /// General Unicode Euro symbol
+ static inline sal_Unicode GetEuroSymbol() { return sal_Unicode(0x20AC); }
+ /** Platform and CharSet dependent Euro symbol,
+ needed for import/export */
+ static sal_Char GetEuroSymbol( rtl_TextEncoding eTextEncoding );
+};
+
+typedef boost::ptr_vector<NfCurrencyEntry> NfCurrencyTable;
+
+typedef std::vector< OUString > NfWSStringsDtor;
+
+class SvNumberFormatterRegistry_Impl;
+
+class SVL_DLLPUBLIC SvNumberFormatter
+{
+public:
+ /**
+ * We can't technically have an "infinite" value, so we use an arbitrary
+ * upper precision threshold to represent the "unlimited" precision.
+ */
+ static const sal_uInt16 UNLIMITED_PRECISION;
+
+ /**
+ * Precision suitable for numbers displayed in input bar, for instance
+ * Calc's formula input bar.
+ */
+ static const sal_uInt16 INPUTSTRING_PRECISION;
+
+ /// Preferred ctor with service manager and language/country enum
+ SvNumberFormatter(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ LanguageType eLang
+ );
+
+ ~SvNumberFormatter();
+
+ /// Set CallBack to ColorTable
+ void SetColorLink( const Link& rColorTableCallBack ) { aColorLink = rColorTableCallBack; }
+ /// Do the CallBack to ColorTable
+ Color* GetUserDefColor(sal_uInt16 nIndex);
+
+ /// Change language/country, also input and format scanner
+ void ChangeIntl( LanguageType eLnge );
+ /// Change the reference null date
+ void ChangeNullDate(sal_uInt16 nDay, sal_uInt16 nMonth, sal_uInt16 nYear);
+ /// Change standard precision
+ void ChangeStandardPrec(short nPrec);
+ /// Set zero value suppression
+ void SetNoZero(bool bNZ) { bNoZero = bNZ; }
+
+ /** The language with which the formatter was initialized (system setting),
+ NOT the current language after a ChangeIntl() */
+ LanguageType GetLanguage() const { return IniLnge; }
+
+ // Determine whether two format types are input compatible or not
+ bool IsCompatible(short eOldType, short eNewType);
+
+ /** Get table of formats of a specific type of a locale. A format FIndex is
+ tested whether it has the type and locale requested, if it doesn't
+ match FIndex returns the default format for the type/locale. If no
+ specific format is to be selected FIndex may be initialized to 0. */
+ SvNumberFormatTable& GetEntryTable(short eType,
+ sal_uInt32& FIndex,
+ LanguageType eLnge);
+
+ /** Get table of formats of a specific type of a language/country.
+ FIndex returns the default format of that type.
+ If the language/country was never touched before new entries are generated */
+ SvNumberFormatTable& ChangeCL(short eType,
+ sal_uInt32& FIndex,
+ LanguageType eLnge);
+
+ /** Get table of formats of the same type as FIndex; eType and rLnge are
+ set accordingly. An unknown format is set to Standard/General */
+ SvNumberFormatTable& GetFirstEntryTable(short& eType,
+ sal_uInt32& FIndex,
+ LanguageType& rLnge);
+
+ /// Delete an entry including the format it is refering to
+ void DeleteEntry(sal_uInt32 nKey);
+
+ /** Create new entry of a format code string for language/country.
+ @return
+ <TRUE/> if string new and ok and inserted.
+ <FALSE/> if string already exists or an unresolvable parse error
+ occurred, in which case nCheckPos is the error position within rString.
+ If the error occurs at position 0 or rString is empty nCheckPos
+ will be 1, so an error in the string is always indicated by
+ nCheckPos not being zero.
+ The content of the rString variable can be changed and corrected
+ by the method.
+ nType contains the type of the format.
+ nKey contains the index key of the format.
+ */
+ bool PutEntry( OUString& rString, sal_Int32& nCheckPos, short& nType, sal_uInt32& nKey,
+ LanguageType eLnge = LANGUAGE_DONTKNOW );
+
+ /** Same as <method>PutEntry</method> but the format code string is
+ considered to be of language/country eLnge and is converted to
+ language/country eNewLnge */
+ bool PutandConvertEntry( OUString& rString, sal_Int32& nCheckPos,
+ short& nType, sal_uInt32& nKey,
+ LanguageType eLnge, LanguageType eNewLnge );
+
+ /** Same as <method>PutandConvertEntry</method> but the format code string
+ is considered to be of the System language/country eLnge and is
+ converted to another System language/country eNewLnge. In this case
+ the automatic currency is converted too. */
+ bool PutandConvertEntrySystem( OUString& rString, sal_Int32& nCheckPos,
+ short& nType, sal_uInt32& nKey,
+ LanguageType eLnge, LanguageType eNewLnge );
+
+ /** Similar to <method>PutEntry</method> and
+ <method>PutandConvertEntry</method> or
+ <method>PutandConvertEntrySystem</method>, the format code string
+ passed is considered to be of language/country eLnge. If
+ eLnge==LANGUAGE_SYSTEM the format code has to match eSysLnge, and if
+ eSysLnge is not the current application locale the format code is
+ converted to the current locale. Additionally, if the format code
+ represents an old "automatic" currency format, it is converted to the
+ new default currency format of the eLnge locale. The rString format
+ code passed as an argument may get adapted in case eLnge was used (or
+ is LANGUAGE_SYSTEM and eSysLnge is identical); in case it wasn't the
+ method works on a copy instead, otherwise the resulting string would
+ not match eSysLnge anymore.
+
+ <p> This method was introduced to handle the legacy currency formats of
+ the "autotbl.fmt" file used by Calc and Writer and convert them to
+ fixed currency codes of the actual currency. Note that in the case of
+ legacy currency formats no special attribution is converted, only the
+ default currency format of the locale is chosen, and that new fixed
+ currency codes are of course not converted to other currencies. The
+ method may also be used as a general method taking, converting and
+ inserting almost arbitrary format codes. To insert or use, for example,
+ the default currency format code matching the current locale, the
+ method could be called with<br/>
+
+ <code>
+ GetIndexPuttingAndConverting( "0 $", LANGUAGE_SYSTEM, LANGUAGE_ENGLISH_US, ...);
+ </code>
+
+ @return
+ The index key of the resulting number format. If the format code
+ was empty, could not be converted or has errors, the eLnge locale's
+ standard number format is chosen instead. The index key is
+ guaranteed to represent some valid number format. If
+ rNewInserted==false and rCheckPos>0 the format code has errors
+ and/or could not be converted.
+ */
+ sal_uInt32 GetIndexPuttingAndConverting( String & rString, LanguageType eLnge,
+ LanguageType eSysLnge, short & rType,
+ bool & rNewInserted,
+ xub_StrLen & rCheckPos );
+
+ sal_uInt32 GetIndexPuttingAndConverting( OUString & rString, LanguageType eLnge,
+ LanguageType eSysLnge, short & rType,
+ bool & rNewInserted, sal_Int32 & rCheckPos );
+
+ /** Create a format code string using format nIndex as a template and
+ applying other settings (passed from the dialog) */
+ OUString GenerateFormat(sal_uInt32 nIndex,
+ LanguageType eLnge = LANGUAGE_DONTKNOW,
+ bool bThousand = false, bool IsRed = false,
+ sal_uInt16 nPrecision = 0, sal_uInt16 nAnzLeading = 1);
+
+ /** Analyze an input string
+ @return
+ <TRUE/> if input is a number or is matching a format F_Index
+ F_Index is set to a matching format if number, the value is
+ returned in fOutNumber
+ <FALSE/> if input is not a number
+ */
+ bool IsNumberFormat( const OUString& sString, sal_uInt32& F_Index, double& fOutNumber );
+
+ /// Format a number according to a format index, return string and color
+ void GetOutputString( const double& fOutNumber, sal_uInt32 nFIndex,
+ String& sOutString, Color** ppColor, bool bUseStarFormat = false );
+
+ /// Format a number according to a format index, return string and color
+ void GetOutputString( const double& fOutNumber, sal_uInt32 nFIndex,
+ OUString& sOutString, Color** ppColor, bool bUseStarFormat = false );
+
+ /** Format a string according to a format index, return string and color.
+ Formats only if the format code is of type text or the 4th subcode
+ of a format code is specified, otherwise sOutString will be == "" */
+ void GetOutputString( const OUString& sString, sal_uInt32 nFIndex,
+ OUString& sOutString, Color** ppColor, bool bUseStarFormat = false );
+
+ /** Format a number according to the standard default format matching
+ the given format index */
+ void GetInputLineString( const double& fOutNumber,
+ sal_uInt32 nFIndex, String& sOutString );
+
+ void GetInputLineString( const double& fOutNumber,
+ sal_uInt32 nFIndex, OUString& rOutString );
+
+ /** Format a number according to a format code string to be scanned.
+ @return
+ <FALSE/> if format code contains an error
+ <TRUE/> else, in which case the string and color are returned.
+ */
+ bool GetPreviewString(const OUString& sFormatString,
+ double fPreviewNumber,
+ OUString& sOutString,
+ Color** ppColor,
+ LanguageType eLnge,
+ bool bUseStarFormat = false );
+
+ /** Same as <method>GetPreviewString</method> but the format code string
+ may be either language/country eLnge or en_US english US */
+ bool GetPreviewStringGuess( const OUString& sFormatString, double fPreviewNumber,
+ OUString& sOutString, Color** ppColor,
+ LanguageType eLnge = LANGUAGE_DONTKNOW );
+
+ /** Format a string according to a format code string to be scanned.
+ @return
+ <FALSE/> if format code contains an error
+ <TRUE/> else, in which case the string and color are returned.
+ */
+ bool GetPreviewString( const OUString& sFormatString, const OUString& sPreviewString,
+ OUString& sOutString, Color** ppColor,
+ LanguageType eLnge = LANGUAGE_DONTKNOW );
+
+ /** Test whether the format code string is already present in container
+ @return
+ NUMBERFORMAT_ENTRY_NOT_FOUND if not found, else the format index.
+ */
+ sal_uInt32 TestNewString( const OUString& sFormatString,
+ LanguageType eLnge = LANGUAGE_DONTKNOW );
+
+ /// Whether format index nFIndex is of type text or not
+ bool IsTextFormat(sal_uInt32 nFIndex) const;
+
+ /// Load all formats from a stream
+ bool Load( SvStream& rStream );
+ /// Save all formats to a stream
+ bool Save( SvStream& rStream ) const;
+
+ /// Get additional info of a format index, e.g. for dialog box
+ void GetFormatSpecialInfo(sal_uInt32 nFormat, bool& bThousand, bool& IsRed,
+ sal_uInt16& nPrecision, sal_uInt16& nAnzLeading);
+
+ /// Count of decimals
+ sal_uInt16 GetFormatPrecision( sal_uInt32 nFormat ) const;
+
+ /** Get additional info of a format code string, e.g. for dialog box.
+ Uses a temporary parse, if possible use only if format code is not
+ present in container yet, otherwise ineffective.
+ @return
+ 0 if format code string parsed without errors, otherwise error
+ position (like nCheckPos on <method>PutEntry</method>)
+ */
+ sal_uInt32 GetFormatSpecialInfo( const OUString&, bool& bThousand, bool& IsRed,
+ sal_uInt16& nPrecision, sal_uInt16& nAnzLeading,
+ LanguageType eLnge = LANGUAGE_DONTKNOW );
+
+ /// Check if format code string may be deleted by user
+ bool IsUserDefined( const OUString& sStr, LanguageType eLnge = LANGUAGE_DONTKNOW );
+
+ /** Return the format index of the format code string for language/country,
+ or NUMBERFORMAT_ENTRY_NOT_FOUND */
+ sal_uInt32 GetEntryKey( const OUString& sStr, LanguageType eLnge = LANGUAGE_DONTKNOW );
+
+ /// Return the format for a format index
+ const SvNumberformat* GetEntry( sal_uInt32 nKey ) const;
+
+ /// Return the format index of the standard default number format for language/country
+ sal_uInt32 GetStandardIndex(LanguageType eLnge = LANGUAGE_DONTKNOW);
+
+ /// Return the format index of the default format of a type for language/country
+ sal_uInt32 GetStandardFormat(short eType, LanguageType eLnge = LANGUAGE_DONTKNOW);
+
+ /** Return the format index of the default format of a type for language/country.
+ Maybe not the default format but a special builtin format, e.g. for
+ NF_TIME_HH_MMSS00, if that format is passed in nFIndex. */
+ sal_uInt32 GetStandardFormat( sal_uInt32 nFIndex, short eType, LanguageType eLnge );
+
+ /** Return the format index of the default format of a type for language/country.
+ Maybe not the default format but a special builtin format, e.g. for
+ NF_TIME_HH_MMSS00, or NF_TIME_HH_MMSS if fNumber >= 1.0 */
+ sal_uInt32 GetStandardFormat( double fNumber, sal_uInt32 nFIndex, short eType,
+ LanguageType eLnge );
+
+ /// Whether nFIndex is a special builtin format
+ bool IsSpecialStandardFormat( sal_uInt32 nFIndex, LanguageType eLnge );
+
+ /** Return the corresponding edit format of a format. */
+ sal_uInt32 GetEditFormat( double fNumber, sal_uInt32 nFIndex, short eType,
+ LanguageType eLnge, SvNumberformat* pFormat );
+
+ /// Return the reference date
+ Date* GetNullDate();
+ /// Return the standard decimal precision
+ sal_uInt16 GetStandardPrec();
+ /// Return whether zero suppression is switched on
+ bool GetNoZero() { return bNoZero; }
+ /** Get the type of a format (or NUMBERFORMAT_UNDEFINED if no entry),
+ but with NUMBERFORMAT_DEFINED masked out */
+ short GetType(sal_uInt32 nFIndex);
+
+ /// As the name says
+ void ClearMergeTable();
+ /// Merge in all new entries from rNewTable and return a table of resulting new format indices
+ SvNumberFormatterIndexTable* MergeFormatter(SvNumberFormatter& rNewTable);
+
+ /// Whether a merge table is present or not
+ inline bool HasMergeFmtTbl() const;
+ /// Return the new format index for an old format index, if a merge table exists
+ inline sal_uInt32 GetMergeFmtIndex( sal_uInt32 nOldFmt ) const;
+
+ /** Convert the ugly old tools' Table type bloated with new'ed sal_uInt32
+ entries merge table to ::std::map with old index key and new index key.
+ @ATTENTION! Also clears the old table using ClearMergeTable() */
+ SvNumberFormatterMergeMap ConvertMergeTableToMap();
+
+ /// Return the last used position ever of a language/country combination
+ sal_uInt16 GetLastInsertKey(sal_uInt32 CLOffset);
+
+ /** Return the format index of a builtin format for a specific language/country.
+ If nFormat is not a builtin format nFormat is returned. */
+ sal_uInt32 GetFormatForLanguageIfBuiltIn( sal_uInt32 nFormat,
+ LanguageType eLnge = LANGUAGE_DONTKNOW );
+
+ /** Return the format index for a builtin format of a specific language
+ @see NfIndexTableOffset
+ */
+ sal_uInt32 GetFormatIndex( NfIndexTableOffset, LanguageType eLnge = LANGUAGE_DONTKNOW );
+
+ /** Return enum index of a format index of a builtin format,
+ NF_INDEX_TABLE_ENTRIES if it's not a builtin format.
+ @see NfIndexTableOffset
+ */
+ NfIndexTableOffset GetIndexTableOffset( sal_uInt32 nFormat ) const;
+
+ /** Set evaluation type and order of input date strings
+ @see NfEvalDateFormat
+ */
+ void SetEvalDateFormat( NfEvalDateFormat eEDF ) { eEvalDateFormat = eEDF; }
+ NfEvalDateFormat GetEvalDateFormat() const { return eEvalDateFormat; }
+
+ /** Set TwoDigitYearStart, how the input string scanner handles a two digit year.
+ Default from VCL: 1930, 30-99 19xx, 00-29 20xx
+
+ <p> Historically (prior to src513e) it was a two digit number determing
+ until which number the string scanner recognizes a year to be 20xx,
+ default <= 29 is used by SFX/OfaMiscCfg.
+ The name Year2000 is kept although the actual functionality is now a
+ TwoDigitYearStart which might be in any century.
+ */
+ void SetYear2000( sal_uInt16 nVal );
+ sal_uInt16 GetYear2000() const;
+ static sal_uInt16 GetYear2000Default();
+
+ sal_uInt16 ExpandTwoDigitYear( sal_uInt16 nYear ) const;
+ inline static sal_uInt16 ExpandTwoDigitYear( sal_uInt16 nYear, sal_uInt16 nTwoDigitYearStart );
+
+ /// DEPRICATED: Return first character of the decimal separator of the current language/country
+ sal_Unicode GetDecSep() const { return GetNumDecimalSep()[0]; }
+ /// Return the decimal separator of the current language/country
+ OUString GetDecimalSep() const { return GetNumDecimalSep(); }
+
+ /// Return the decimal separator matching the locale of the given format
+ OUString GetFormatDecimalSep( sal_uInt32 nFormat ) const;
+
+ /// Return a <type>NfCurrencyTable</type> with pointers to <type>NfCurrencyEntry</type> entries
+ static const NfCurrencyTable& GetTheCurrencyTable();
+
+ /** Searches, according to the default locale currency, an entry of the
+ CurrencyTable which is <bold>not</bold> the first (LANGUAGE_SYSTEM) entry.
+ @return
+ <NULL/> if not found
+ else pointer to <type>NfCurrencyEntry</type>
+ */
+ static const NfCurrencyEntry* MatchSystemCurrency();
+
+ /** Return a <type>NfCurrencyEntry</type> matching a language/country.
+ If language/country is LANGUAGE_SYSTEM a <method>MatchSystemCurrency</method>
+ call is tried to get an entry. If that fails or the corresponding
+ language/country is not present the entry for LANGUAGE_SYSTEM is returned.
+ */
+ static const NfCurrencyEntry& GetCurrencyEntry( LanguageType );
+
+ /** Return a <type>NfCurrencyEntry</type> pointer matching a language/country
+ and currency abbreviation (AKA banking symbol).
+ This method is meant for the configuration of the default currency.
+ @return
+ <NULL/> if not found
+ else pointer to <type>NfCurrencyEntry</type>
+ */
+ static const NfCurrencyEntry* GetCurrencyEntry( const OUString& rAbbrev,
+ LanguageType eLang );
+
+ /** Return a <type>NfCurrencyEntry</type> pointer matching the symbol
+ combination of a LegacyOnly currency. Note that this means only that
+ the currency matching both symbols was once used in the Office, but is
+ not offered in dialogs anymore. It doesn't even mean that the currency
+ symbol combination is valid, since the reason for removing it may have
+ been just that. #i61657#
+ @return
+ A matching entry, or else <NULL/>.
+ */
+ static const NfCurrencyEntry* GetLegacyOnlyCurrencyEntry( const OUString& rSymbol, const OUString& rAbbrev );
+
+ /** Set the default system currency. The combination of abbreviation and
+ language must match an existent element of theCurrencyTable. If not,
+ the SYSTEM (current locale) entry becomes the default.
+ This method is meant for the configuration of the default currency.
+ */
+ static void SetDefaultSystemCurrency( const OUString& rAbbrev, LanguageType eLang );
+
+ /** Get all standard formats for a specific currency, formats are
+ appended to the <type>NfWSStringsDtor</type> list.
+ @param bBank
+ <TRUE/>: generate only format strings with currency abbreviation
+ <FALSE/>: mixed format strings
+ @return
+ position of default format
+ */
+ sal_uInt16 GetCurrencyFormatStrings( NfWSStringsDtor&, const NfCurrencyEntry&,
+ bool bBank ) const;
+
+ /** Whether nFormat is of type NUMBERFORMAT_CURRENCY and the format code
+ contains a new SYMBOLTYPE_CURRENCY and if so which one [$xxx-nnn].
+ If ppEntry is not NULL and exactly one entry is found, a [$xxx-nnn] is
+ returned, even if the format code only contains [$xxx] !
+ */
+ bool GetNewCurrencySymbolString( sal_uInt32 nFormat, String& rSymbol,
+ const NfCurrencyEntry** ppEntry = NULL,
+ bool* pBank = NULL ) const;
+
+ /** Look up the corresponding <type>NfCurrencyEntry</type> matching
+ rSymbol (may be CurrencySymbol or CurrencyAbbreviation) and possibly
+ a rExtension (being yyy of [$xxx-yyy]) or a given language/country
+ value. Tries to match a rSymbol with rExtension first, then with
+ eFormatLanguage, then rSymbol only. This is because a currency entry
+ might have been constructed using I18N locale data where a used locale
+ of a currrency format code must not necessarily match the locale of
+ the locale data itself, e.g. [$HK$-40C] (being "zh_HK" locale) in
+ zh_CN locale data. Here the rExtension would have the value 0x40c but
+ eFormatLanguage of the number format would have the value of zh_CN
+ locale, the value with which the corresponding CurrencyEntry is
+ constructed.
+
+ @param bFoundBank
+ Only used for output.
+ If the return value is not <NULL/> this value is set to <TRUE/> if
+ the matching entry was found by comparing rSymbol against the
+ CurrencyAbbreviation (AKA BankSymbol).
+ If the return value is <NULL/> the value of bFoundBank is undefined.
+ @param rSymbol
+ Currency symbol, preferably obtained of a format by a call to
+ <method>SvNumberformat::GetNewCurrencySymbol()</method>
+ @param rExtension
+ Currency extension, preferably obtained of a format by a call to
+ <method>SvNumberformat::GetNewCurrencySymbol()</method>
+ @param eFormatLanguage
+ The language/country value of the format of which rSymbol and
+ rExtension are obtained (<method>SvNumberformat::GetLanguage()</method>).
+ @param bOnlyStringLanguage
+ If <TRUE/> only entries with language/country of rExtension are
+ checked, no match on eFormatLanguage. If rExtension is empty all
+ entries are checked.
+ @return
+ The matching entry if unique (in which case bFoundBank is set),
+ else <NULL/>.
+ */
+ static const NfCurrencyEntry* GetCurrencyEntry( bool & bFoundBank,
+ const OUString& rSymbol,
+ const OUString& rExtension,
+ LanguageType eFormatLanguage,
+ bool bOnlyStringLanguage = false );
+
+ /// Get compatibility ("automatic" old style) currency from I18N locale data
+ void GetCompatibilityCurrency( OUString& rSymbol, OUString& rAbbrev ) const;
+
+ /// Fill rList with the language/country codes that have been allocated
+ void GetUsedLanguages( std::vector<sal_uInt16>& rList );
+
+ /// Fill a <type>NfKeywordIndex</type> table with keywords of a language/country
+ void FillKeywordTable( NfKeywordTable& rKeywords, LanguageType eLang );
+
+ /** Return a keyword for a language/country and <type>NfKeywordIndex</type>
+ for XML import, to generate number format strings. */
+ OUString GetKeyword( LanguageType eLnge, sal_uInt16 nIndex );
+
+ /** Return the GENERAL keyword in proper case ("General") for a
+ language/country, used in XML import */
+ OUString GetStandardName( LanguageType eLnge );
+
+ /** Check if a specific locale has supported locale data. */
+ static bool IsLocaleInstalled( LanguageType eLang );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+ LanguageTag maLanguageTag;
+ SvNumberFormatTable aFTable; // Table of format keys to format entries
+ typedef std::map<sal_uInt32, sal_uInt32> DefaultFormatKeysMap;
+ DefaultFormatKeysMap aDefaultFormatKeys; // Table of default standard to format keys
+ SvNumberFormatTable* pFormatTable; // For the UI dialog
+ SvNumberFormatterIndexTable* pMergeTable; // List of indices for merging two formatters
+ CharClass* pCharClass; // CharacterClassification
+ OnDemandLocaleDataWrapper xLocaleData; // LocaleData switched between SYSTEM, ENGLISH and other
+ OnDemandTransliterationWrapper xTransliteration; // Transliteration loaded on demand
+ OnDemandCalendarWrapper xCalendar; // Calendar loaded on demand
+ OnDemandNativeNumberWrapper xNatNum; // Native number service loaded on demand
+ ImpSvNumberInputScan* pStringScanner; // Input string scanner
+ ImpSvNumberformatScan* pFormatScanner; // Format code string scanner
+ Link aColorLink; // User defined color table CallBack
+ sal_uInt32 MaxCLOffset; // Max language/country offset used
+ sal_uInt32 nDefaultSystemCurrencyFormat; // NewCurrency matching SYSTEM locale
+ LanguageType IniLnge; // Initialized setting language/country
+ LanguageType ActLnge; // Current setting language/country
+ NfEvalDateFormat eEvalDateFormat; // DateFormat evaluation
+ bool bNoZero; // Zero value suppression
+
+ // cached locale data items needed almost any time
+ OUString aDecimalSep;
+ OUString aThousandSep;
+ OUString aDateSep;
+
+#ifdef _ZFORLIST_CXX // ----- private Methoden -----
+
+ SVL_DLLPRIVATE static bool bCurrencyTableInitialized;
+ SVL_DLLPRIVATE static sal_uInt16 nSystemCurrencyPosition;
+ SVL_DLLPRIVATE static SvNumberFormatterRegistry_Impl* pFormatterRegistry;
+
+ // get the registry, create one if none exists
+ SVL_DLLPRIVATE static SvNumberFormatterRegistry_Impl& GetFormatterRegistry();
+
+ // called by ctors
+ SVL_DLLPRIVATE void ImpConstruct( LanguageType eLang );
+
+ // Changes initialized language/country, clears the entries and generates
+ // new ones, may ONLY be called by the binary file format load
+ SVL_DLLPRIVATE void ImpChangeSysCL( LanguageType eLnge, bool bNoAdditionalFormats );
+
+ // Generate builtin formats provided by i18n behind CLOffset,
+ // if bNoAdditionalFormats==false also generate additional i18n formats.
+ SVL_DLLPRIVATE void ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditionalFormats );
+
+ // Generate additional formats provided by i18n
+ SVL_DLLPRIVATE void ImpGenerateAdditionalFormats( sal_uInt32 CLOffset,
+ NumberFormatCodeWrapper& rNumberFormatCode,
+ bool bAfterChangingSystemCL );
+
+ SVL_DLLPRIVATE SvNumberformat* ImpInsertFormat( const ::com::sun::star::i18n::NumberFormatCode& rCode,
+ sal_uInt32 nPos,
+ bool bAfterChangingSystemCL = false,
+ sal_Int16 nOrgIndex = 0 );
+ // ImpInsertNewStandardFormat for new (since version ...) builtin formats
+ SVL_DLLPRIVATE SvNumberformat* ImpInsertNewStandardFormat( const ::com::sun::star::i18n::NumberFormatCode& rCode,
+ sal_uInt32 nPos,
+ sal_uInt16 nVersion,
+ bool bAfterChangingSystemCL = false,
+ sal_Int16 nOrgIndex = 0 );
+
+ // Return CLOffset or (MaxCLOffset + SV_COUNTRY_LANGUAGE_OFFSET) if new language/country
+ SVL_DLLPRIVATE sal_uInt32 ImpGetCLOffset(LanguageType eLnge) const;
+
+ // Test whether format code already exists, then return index key,
+ // otherwise NUMBERFORMAT_ENTRY_NOT_FOUND
+ SVL_DLLPRIVATE sal_uInt32 ImpIsEntry( const OUString& rString,
+ sal_uInt32 CLOffset,
+ LanguageType eLnge );
+
+ // Create builtin formats for language/country if necessary, return CLOffset
+ SVL_DLLPRIVATE sal_uInt32 ImpGenerateCL( LanguageType eLnge, bool bNoAdditionalFormats = false );
+
+ // Build negative currency format, old compatibility style
+ SVL_DLLPRIVATE void ImpGetNegCurrFormat(OUStringBuffer& sNegStr, const OUString& rCurrSymbol);
+ // Build positive currency format, old compatibility style
+ SVL_DLLPRIVATE void ImpGetPosCurrFormat(OUStringBuffer& sPosStr, const OUString& rCurrSymbol);
+
+ // Create <type>theCurrencyTable</type> with all <type>NfCurrencyEntry</type>
+ SVL_DLLPRIVATE static void ImpInitCurrencyTable();
+
+ // Return the format index of the currency format of the system locale.
+ // Format is created if not already present.
+ SVL_DLLPRIVATE sal_uInt32 ImpGetDefaultSystemCurrencyFormat();
+
+ // Return the format index of the currency format of the current locale.
+ // Format is created if not already present.
+ SVL_DLLPRIVATE sal_uInt32 ImpGetDefaultCurrencyFormat();
+
+ // Return the default format for a given type and current locale.
+ // May ONLY be called from within GetStandardFormat().
+ SVL_DLLPRIVATE sal_uInt32 ImpGetDefaultFormat( short nType );
+
+ // Return the index in a sequence of format codes matching an enum of
+ // NfIndexTableOffset. If not found 0 is returned. If the sequence doesn't
+ // contain any format code elements a default element is created and inserted.
+ SVL_DLLPRIVATE sal_Int32 ImpGetFormatCodeIndex( ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::NumberFormatCode >& rSeq,
+ const NfIndexTableOffset nTabOff );
+
+ // Adjust a sequence of format codes to contain only one (THE) default
+ // instead of multiple defaults for short/medium/long types.
+ // If there is no medium but a short and a long default the long is taken.
+ // Return the default index in the sequence.
+ // Non-PRODUCT version may check locale data for matching defaults in one
+ // FormatElement group.
+ SVL_DLLPRIVATE sal_Int32 ImpAdjustFormatCodeDefault( ::com::sun::star::i18n::NumberFormatCode * pFormatArr,
+ sal_Int32 nCount, bool bCheckCorrectness = true );
+
+ // Obtain the format entry for a given key index.
+ SVL_DLLPRIVATE SvNumberformat* GetFormatEntry( sal_uInt32 nKey );
+ SVL_DLLPRIVATE const SvNumberformat* GetFormatEntry( sal_uInt32 nKey ) const
+ {
+ return GetEntry( nKey);
+ }
+
+ // used as a loop body inside of GetNewCurrencySymbolString() and GetCurrencyEntry()
+#ifndef DBG_UTIL
+ inline
+#endif
+ static bool ImpLookupCurrencyEntryLoopBody( const NfCurrencyEntry*& pFoundEntry,
+ bool& bFoundBank, const NfCurrencyEntry* pData,
+ sal_uInt16 nPos, const OUString& rSymbol );
+
+ // link to be set at <method>SvtSysLocaleOptions::SetCurrencyChangeLink()</method>
+ DECL_DLLPRIVATE_STATIC_LINK( SvNumberFormatter, CurrencyChangeLink, void* );
+
+#endif // _ZFORLIST_CXX
+
+public:
+
+ // own static mutex, may also be used by internal class SvNumberFormatterRegistry_Impl
+ static ::osl::Mutex& GetMutex();
+
+ // called by SvNumberFormatterRegistry_Impl::Notify if the default system currency changes
+ void ResetDefaultSystemCurrency();
+
+ // Called by SvNumberFormatterRegistry_Impl::Notify if the system locale's
+ // date acceptence patterns change.
+ void InvalidateDateAcceptancePatterns();
+
+ // Replace the SYSTEM language/country format codes. Called upon change of
+ // the user configurable locale.
+ // Old compatibility codes are replaced, user defined are converted, and
+ // new format codes are appended.
+ void ReplaceSystemCL( LanguageType eOldLanguage );
+
+ inline ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > GetComponentContext() const
+ {
+ return m_xContext;
+ }
+
+
+
+ //! The following method is not to be used from outside but must be
+ //! public for the InputScanner.
+ // return the current FormatScanner
+ inline const ImpSvNumberformatScan* GetFormatScanner() const { return pFormatScanner; }
+
+
+ //! The following methods are not to be used from outside but must be
+ //! public for the InputScanner and FormatScanner.
+
+ // return current (!) Locale
+ inline const LanguageTag& GetLanguageTag() const { return maLanguageTag; }
+
+ // return corresponding Transliteration wrapper
+ inline const ::utl::TransliterationWrapper* GetTransliteration() const
+ {
+ return xTransliteration.get();
+ }
+
+ // return corresponding Transliteration wrapper with loadModuleByImplName()
+ inline const ::utl::TransliterationWrapper* GetTransliterationForModule( const OUString& rModule,
+ LanguageType eLang ) const
+ {
+ return xTransliteration.getForModule( rModule, eLang );
+ }
+
+ // return the corresponding CharacterClassification wrapper
+ inline const CharClass* GetCharClass() const { return pCharClass; }
+
+ // return the corresponding LocaleData wrapper
+ inline const LocaleDataWrapper* GetLocaleData() const { return xLocaleData.get(); }
+
+ // return the corresponding Calendar wrapper
+ inline CalendarWrapper* GetCalendar() const { return xCalendar.get(); }
+
+ // return the corresponding NativeNumberSupplier wrapper
+ inline const NativeNumberWrapper* GetNatNum() const { return xNatNum.get(); }
+
+ // cached locale data items
+
+ // return the corresponding decimal separator
+ inline const OUString& GetNumDecimalSep() const { return aDecimalSep; }
+
+ // return the corresponding group (AKA thousand) separator
+ inline const OUString& GetNumThousandSep() const { return aThousandSep; }
+
+ // return the corresponding date separator
+ inline const OUString& GetDateSep() const { return aDateSep; }
+
+};
+
+
+// --------------------------- inline --------------------------------------
+
+inline sal_uInt32 SvNumberFormatter::GetMergeFmtIndex( sal_uInt32 nOldFmt ) const
+{
+ if (pMergeTable)
+ {
+ SvNumberFormatterIndexTable::iterator it = pMergeTable->find(nOldFmt);
+ if (it != pMergeTable->end())
+ {
+ return it->second;
+ }
+ }
+ return nOldFmt;
+}
+
+inline bool SvNumberFormatter::HasMergeFmtTbl() const
+{
+ return pMergeTable && !pMergeTable->empty();
+}
+
+
+// static
+inline sal_uInt16 SvNumberFormatter::ExpandTwoDigitYear( sal_uInt16 nYear, sal_uInt16 nTwoDigitYearStart )
+{
+ if ( nYear < 100 )
+ {
+ if ( nYear < (nTwoDigitYearStart % 100) )
+ {
+ return nYear + (((nTwoDigitYearStart / 100) + 1) * 100);
+ }
+ else
+ {
+ return nYear + ((nTwoDigitYearStart / 100) * 100);
+ }
+ }
+ return nYear;
+}
+
+#endif // _ZFORLIST_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/zformat.hxx b/include/svl/zformat.hxx
new file mode 100644
index 000000000000..20cc4d110c24
--- /dev/null
+++ b/include/svl/zformat.hxx
@@ -0,0 +1,712 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _ZFORMAT_HXX
+#define _ZFORMAT_HXX
+
+#include "svl/svldllapi.h"
+#include <i18nlangtag/mslangid.hxx>
+#include <svl/zforlist.hxx>
+#include <svl/nfversi.hxx>
+#include <svl/nfkeytab.hxx>
+
+// We need ImpSvNumberformatScan for the private SvNumberformat definitions.
+#ifdef _ZFORMAT_CXX
+#include "zforscan.hxx"
+#endif
+
+namespace utl {
+ class DigitGroupingIterator;
+}
+
+class SvStream;
+class Color;
+
+class ImpSvNumberformatScan; // format code string scanner
+class ImpSvNumberInputScan; // input string scanner
+class ImpSvNumMultipleWriteHeader; // compatible file format
+class ImpSvNumMultipleReadHeader; // compatible file format
+class SvNumberFormatter;
+
+enum SvNumberformatLimitOps
+{
+ NUMBERFORMAT_OP_NO = 0, // Undefined, no OP
+ NUMBERFORMAT_OP_EQ = 1, // Operator =
+ NUMBERFORMAT_OP_NE = 2, // Operator <>
+ NUMBERFORMAT_OP_LT = 3, // Operator <
+ NUMBERFORMAT_OP_LE = 4, // Operator <=
+ NUMBERFORMAT_OP_GT = 5, // Operator >
+ NUMBERFORMAT_OP_GE = 6 // Operator >=
+};
+
+// SYSTEM-german to SYSTEM-xxx and vice versa conversion hack onLoad
+enum NfHackConversion
+{
+ NF_CONVERT_NONE,
+ NF_CONVERT_GERMAN_ENGLISH,
+ NF_CONVERT_ENGLISH_GERMAN
+};
+
+struct ImpSvNumberformatInfo // Struct for FormatInfo
+{
+ OUString* sStrArray; // Array of symbols
+ short* nTypeArray; // Array of infos
+ sal_uInt16 nThousand; // Count of group separator sequences
+ sal_uInt16 nCntPre; // Count of digits before decimal point
+ sal_uInt16 nCntPost; // Count of digits after decimal point
+ sal_uInt16 nCntExp; // Count of exponent digits, or AM/PM
+ short eScannedType; // Type determined by scan
+ bool bThousand; // Has group (AKA thousand) separator
+
+ void Copy( const ImpSvNumberformatInfo& rNumFor, sal_uInt16 nAnz );
+ void Load(SvStream& rStream, sal_uInt16 nAnz);
+ void Save(SvStream& rStream, sal_uInt16 nAnz) const;
+};
+
+// NativeNumber, represent numbers using CJK or other digits if nNum>0,
+// eLang specifies the Locale to use.
+class SvNumberNatNum
+{
+ LanguageType eLang;
+ sal_uInt8 nNum;
+ bool bDBNum :1; // DBNum, to be converted to NatNum
+ bool bDate :1; // Used in date? (needed for DBNum/NatNum mapping)
+ bool bSet :1; // If set, since NatNum0 is possible
+
+public:
+
+ static sal_uInt8 MapDBNumToNatNum( sal_uInt8 nDBNum, LanguageType eLang, bool bDate );
+#ifdef THE_FUTURE
+ static sal_uInt8 MapNatNumToDBNum( sal_uInt8 nNatNum, LanguageType eLang, bool bDate );
+#endif
+
+ SvNumberNatNum() : eLang( LANGUAGE_DONTKNOW ), nNum(0),
+ bDBNum(0), bDate(0), bSet(0) {}
+ bool IsComplete() const { return bSet && eLang != LANGUAGE_DONTKNOW; }
+ sal_uInt8 GetRawNum() const { return nNum; }
+ sal_uInt8 GetNatNum() const { return bDBNum ? MapDBNumToNatNum( nNum, eLang, bDate ) : nNum; }
+#ifdef THE_FUTURE
+ sal_uInt8 GetDBNum() const { return bDBNum ? nNum : MapNatNumToDBNum( nNum, eLang, bDate ); }
+#endif
+ LanguageType GetLang() const { return eLang; }
+ void SetLang( LanguageType e ) { eLang = e; }
+ void SetNum( sal_uInt8 nNumber, bool bDBNumber )
+ {
+ nNum = nNumber;
+ bDBNum = bDBNumber;
+ bSet = true;
+ }
+ bool IsSet() const { return bSet; }
+ void SetDate( bool bDateP ) { bDate = (bDateP != 0); }
+};
+
+class CharClass;
+
+class ImpSvNumFor // One of four subformats of the format code string
+{
+public:
+ ImpSvNumFor(); // Ctor without filling the Info
+ ~ImpSvNumFor();
+
+ void Enlarge(sal_uInt16 nAnz); // Init of arrays to the right size
+ void Load( SvStream& rStream, ImpSvNumberformatScan& rSc,
+ OUString& rLoadedColorName);
+ void Save( SvStream& rStream ) const;
+
+ // if pSc is set, it is used to get the Color pointer
+ void Copy( const ImpSvNumFor& rNumFor, ImpSvNumberformatScan* pSc );
+
+ // Access to Info; call Enlarge before!
+ ImpSvNumberformatInfo& Info() { return aI;}
+ const ImpSvNumberformatInfo& Info() const { return aI; }
+
+ // Get count of substrings (symbols)
+ sal_uInt16 GetCount() const { return nAnzStrings;}
+
+ Color* GetColor() const { return pColor; }
+ void SetColor( Color* pCol, OUString& rName )
+ { pColor = pCol; sColorName = rName; }
+ const OUString& GetColorName() const { return sColorName; }
+
+ // new SYMBOLTYPE_CURRENCY in subformat?
+ bool HasNewCurrency() const;
+ bool GetNewCurrencySymbol( OUString& rSymbol, OUString& rExtension ) const;
+ void SaveNewCurrencyMap( SvStream& rStream ) const;
+ void LoadNewCurrencyMap( SvStream& rStream );
+
+ // [NatNum1], [NatNum2], ...
+ void SetNatNumNum( sal_uInt8 nNum, bool bDBNum ) { aNatNum.SetNum( nNum, bDBNum ); }
+ void SetNatNumLang( LanguageType eLang ) { aNatNum.SetLang( eLang ); }
+ void SetNatNumDate( bool bDate ) { aNatNum.SetDate( bDate ); }
+ const SvNumberNatNum& GetNatNum() const { return aNatNum; }
+
+private:
+ ImpSvNumberformatInfo aI; // Hilfsstruct fuer die restlichen Infos
+ OUString sColorName; // color name
+ Color* pColor; // pointer to color of subformat
+ sal_uInt16 nAnzStrings; // count of symbols
+ SvNumberNatNum aNatNum; // DoubleByteNumber
+
+};
+
+class SVL_DLLPUBLIC SvNumberformat
+{
+ struct LocaleType
+ {
+ sal_uInt8 mnNumeralShape;
+ sal_uInt8 mnCalendarType;
+ LanguageType meLanguage;
+
+ OUString generateCode() const;
+
+ LocaleType();
+ LocaleType(sal_uInt32 nRawCode);
+ };
+
+public:
+ // Ctor for Load
+ SvNumberformat( ImpSvNumberformatScan& rSc, LanguageType eLge );
+
+ // Normal ctor
+ SvNumberformat( OUString& rString,
+ ImpSvNumberformatScan* pSc,
+ ImpSvNumberInputScan* pISc,
+ sal_Int32& nCheckPos,
+ LanguageType& eLan,
+ bool bStand = false );
+
+ // Copy ctor
+ SvNumberformat( SvNumberformat& rFormat );
+
+ // Copy ctor with exchange of format code string scanner (used in merge)
+ SvNumberformat( SvNumberformat& rFormat, ImpSvNumberformatScan& rSc );
+
+ ~SvNumberformat();
+
+ /// Get type of format, may include NUMBERFORMAT_DEFINED bit
+ short GetType() const
+ { return (nNewStandardDefined &&
+ (nNewStandardDefined <= SV_NUMBERFORMATTER_VERSION)) ?
+ (eType & ~NUMBERFORMAT_DEFINED) : eType; }
+
+ void SetType(const short eSetType) { eType = eSetType; }
+ // Standard means the I18N defined standard format of this type
+ void SetStandard() { bStandard = true; }
+ bool IsStandard() const { return bStandard; }
+
+ // For versions before version nVer it is UserDefined, for newer versions
+ // it is builtin. nVer of SV_NUMBERFORMATTER_VERSION_...
+ void SetNewStandardDefined( sal_uInt16 nVer )
+ { nNewStandardDefined = nVer; eType |= NUMBERFORMAT_DEFINED; }
+
+ sal_uInt16 GetNewStandardDefined() const { return nNewStandardDefined; }
+ bool IsAdditionalStandardDefined() const
+ { return nNewStandardDefined == SV_NUMBERFORMATTER_VERSION_ADDITIONAL_I18N_FORMATS; }
+
+ LanguageType GetLanguage() const { return maLocale.meLanguage;}
+
+ const OUString& GetFormatstring() const { return sFormatstring; }
+
+ // Build a format string of application defined keywords
+ OUString GetMappedFormatstring( const NfKeywordTable& rKeywords,
+ const LocaleDataWrapper& rLoc,
+ bool bDontQuote = false ) const;
+
+ void SetUsed(const bool b) { bIsUsed = b; }
+ bool GetUsed() const { return bIsUsed; }
+ bool IsStarFormatSupported() const { return bStarFlag; }
+ void SetStarFormatSupport( bool b ) { bStarFlag = b; }
+
+ NfHackConversion Load( SvStream& rStream, ImpSvNumMultipleReadHeader& rHdr,
+ SvNumberFormatter* pConverter, ImpSvNumberInputScan& rISc );
+ void Save( SvStream& rStream, ImpSvNumMultipleWriteHeader& rHdr ) const;
+
+ // Load a string which might contain an Euro symbol,
+ // in fact that could be any string used in number formats.
+ static OUString LoadString( SvStream& rStream );
+
+ /**
+ * Get output string from a numeric value that fits the number of
+ * characters specified.
+ */
+ bool GetOutputString( double fNumber, sal_uInt16 nCharCount, OUString& rOutString ) const;
+
+ bool GetOutputString( double fNumber, OUString& OutString, Color** ppColor );
+ bool GetOutputString( const OUString& sString, OUString& OutString, Color** ppColor );
+
+ // True if type text
+ bool IsTextFormat() const { return (eType & NUMBERFORMAT_TEXT) != 0; }
+ // True if 4th subformat present
+ bool HasTextFormat() const
+ {
+ return (NumFor[3].GetCount() > 0) ||
+ (NumFor[3].Info().eScannedType == NUMBERFORMAT_TEXT);
+ }
+
+ void GetFormatSpecialInfo(bool& bThousand,
+ bool& IsRed,
+ sal_uInt16& nPrecision,
+ sal_uInt16& nAnzLeading) const;
+
+ /// Count of decimal precision
+ sal_uInt16 GetFormatPrecision() const { return NumFor[0].Info().nCntPost; }
+
+ //! Read/write access on a special sal_uInt16 component, may only be used on the
+ //! standard format 0, 5000, ... and only by the number formatter!
+ sal_uInt16 GetLastInsertKey() const
+ { return NumFor[0].Info().nThousand; }
+ void SetLastInsertKey(sal_uInt16 nKey)
+ { NumFor[0].Info().nThousand = nKey; }
+
+ //! Only onLoad: convert from stored to current system language/country
+ void ConvertLanguage( SvNumberFormatter& rConverter,
+ LanguageType eConvertFrom, LanguageType eConvertTo, bool bSystem = false );
+
+ // Substring of a subformat code nNumFor (0..3)
+ // nPos == 0xFFFF => last substring
+ // bString==true: first/last SYMBOLTYPE_STRING or SYMBOLTYPE_CURRENCY
+ const OUString* GetNumForString( sal_uInt16 nNumFor, sal_uInt16 nPos,
+ bool bString = false ) const;
+
+ // Subtype of a subformat code nNumFor (0..3)
+ // nPos == 0xFFFF => last substring
+ // bString==true: first/last SYMBOLTYPE_STRING or SYMBOLTYPE_CURRENCY
+ short GetNumForType( sal_uInt16 nNumFor, sal_uInt16 nPos, bool bString = false ) const;
+
+ sal_Int32 GetForcedDenominatorForType( sal_uInt16 nNumFor ) const;
+ /** If the count of string elements (substrings, ignoring [modifiers] and
+ so on) in a subformat code nNumFor (0..3) is equal to the given number.
+ Used by ImpSvNumberInputScan::IsNumberFormatMain() to detect a matched
+ format. */
+ bool IsNumForStringElementCountEqual( sal_uInt16 nNumFor, sal_uInt16 nAllCount,
+ sal_uInt16 nNumCount ) const
+ {
+ if ( nNumFor < 4 )
+ {
+ // First try a simple approach. Note that this is called only
+ // if all MidStrings did match so far, to verify that all
+ // strings of the format were matched and not just the starting
+ // sequence, so we don't have to check if GetnAnz() includes
+ // [modifiers] or anything else if both counts are equal.
+ sal_uInt16 nCnt = NumFor[nNumFor].GetCount();
+ if ( nAllCount == nCnt )
+ return true;
+ if ( nAllCount < nCnt ) // check ignoring [modifiers] and so on
+ return ImpGetNumForStringElementCount( nNumFor ) ==
+ (nAllCount - nNumCount);
+ }
+ return false;
+ }
+
+ // Whether the second subformat code is really for negative numbers
+ // or another limit set.
+ bool IsSecondSubformatRealNegative() const
+ {
+ return fLimit1 == 0.0 && fLimit2 == 0.0 &&
+ ( (eOp1 == NUMBERFORMAT_OP_GE && eOp2 == NUMBERFORMAT_OP_NO) ||
+ (eOp1 == NUMBERFORMAT_OP_GT && eOp2 == NUMBERFORMAT_OP_LT) ||
+ (eOp1 == NUMBERFORMAT_OP_NO && eOp2 == NUMBERFORMAT_OP_NO) );
+ }
+
+ // Whether the first subformat code is really for negative numbers
+ // or another limit set.
+ bool IsFirstSubformatRealNegative() const
+ {
+ return fLimit1 == 0.0 && fLimit2 == 0.0 &&
+ ((eOp1 == NUMBERFORMAT_OP_LT &&
+ (eOp2 == NUMBERFORMAT_OP_GT || eOp2 == NUMBERFORMAT_OP_EQ ||
+ eOp2 == NUMBERFORMAT_OP_GE || eOp2 == NUMBERFORMAT_OP_NO)) ||
+ (eOp1 == NUMBERFORMAT_OP_LE &&
+ (eOp2 == NUMBERFORMAT_OP_NO || eOp2 == NUMBERFORMAT_OP_GT)));
+ }
+
+ // Whether the negative format is without a sign or not
+ bool IsNegativeWithoutSign() const;
+
+ bool IsNegativeInBracket() const;
+
+ bool HasPositiveBracketPlaceholder() const;
+
+ // Whether a new SYMBOLTYPE_CURRENCY is contained in the format
+ bool HasNewCurrency() const;
+
+ // Build string from NewCurrency for saving it SO50 compatible
+ void Build50Formatstring( OUString& rStr ) const;
+
+ // strip [$-yyy] from all [$xxx-yyy] leaving only xxx's,
+ // if bQuoteSymbol==true the xxx will become "xxx"
+ static OUString StripNewCurrencyDelimiters( const OUString& rStr,
+ bool bQuoteSymbol );
+
+ // If a new SYMBOLTYPE_CURRENCY is contained if the format is of type
+ // NUMBERFORMAT_CURRENCY, and if so the symbol xxx and the extension nnn
+ // of [$xxx-nnn] are returned
+ bool GetNewCurrencySymbol( OUString& rSymbol, OUString& rExtension ) const;
+
+ static bool HasStringNegativeSign( const OUString& rStr );
+
+ /**
+ Whether a character at position nPos is somewhere between two matching
+ cQuote or not.
+ If nPos points to a cQuote, a true is returned on an opening cQuote,
+ a false is returned on a closing cQuote.
+ A cQuote between quotes may be escaped by a cEscIn, a cQuote outside of
+ quotes may be escaped by a cEscOut.
+ The default '\0' results in no escapement possible.
+ Defaults are set right according to the "unlogic" of the Numberformatter
+ */
+ static bool IsInQuote( const OUString& rString, sal_Int32 nPos,
+ sal_Unicode cQuote = '"',
+ sal_Unicode cEscIn = '\0', sal_Unicode cEscOut = '\\' );
+
+ /**
+ Return the position of a matching closing cQuote if the character at
+ position nPos is between two matching cQuote, otherwise return
+ STRING_NOTFOUND.
+ If nPos points to an opening cQuote the position of the matching
+ closing cQuote is returned.
+ If nPos points to a closing cQuote nPos is returned.
+ If nPos points into a part which starts with an opening cQuote but has
+ no closing cQuote, rString.Len() is returned.
+ Uses <method>IsInQuote</method> internally, so you don't have to call
+ that prior to a call of this method.
+ */
+ static sal_Int32 GetQuoteEnd( const OUString& rString, sal_Int32 nPos,
+ sal_Unicode cQuote = '"',
+ sal_Unicode cEscIn = '\0',
+ sal_Unicode cEscOut = '\\' );
+
+ void SetComment( const OUString& rStr )
+ { sComment = rStr; }
+ const OUString& GetComment() const { return sComment; }
+
+ /** Insert the number of blanks into the string that is needed to simulate
+ the width of character c for underscore formats */
+ static sal_Int32 InsertBlanks( OUString& r, sal_Int32 nPos, sal_Unicode c )
+ {
+ sal_Int32 result;
+ OUStringBuffer sBuff(r);
+
+ result = InsertBlanks(sBuff, nPos, c);
+ r = sBuff.makeStringAndClear();
+
+ return result;
+ }
+
+ /** Insert the number of blanks into the string that is needed to simulate
+ the width of character c for underscore formats */
+ static sal_Int32 InsertBlanks( OUStringBuffer& r, sal_Int32 nPos, sal_Unicode c );
+
+ /// One of YMD,DMY,MDY if date format
+ DateFormat GetDateOrder() const;
+
+ /** A coded value of the exact YMD combination used, if date format.
+ For example: YYYY-MM-DD => ('Y' << 16) | ('M' << 8) | 'D'
+ or: MM/YY => ('M' << 8) | 'Y' */
+ sal_uInt32 GetExactDateOrder() const;
+
+ ImpSvNumberformatScan& ImpGetScan() const { return rScan; }
+
+ // used in XML export
+ void GetConditions( SvNumberformatLimitOps& rOper1, double& rVal1,
+ SvNumberformatLimitOps& rOper2, double& rVal2 ) const;
+ Color* GetColor( sal_uInt16 nNumFor ) const;
+ void GetNumForInfo( sal_uInt16 nNumFor, short& rScannedType,
+ bool& bThousand, sal_uInt16& nPrecision, sal_uInt16& nAnzLeading ) const;
+
+ // rAttr.Number not empty if NatNum attributes are to be stored
+ void GetNatNumXml(
+ ::com::sun::star::i18n::NativeNumberXmlAttributes& rAttr,
+ sal_uInt16 nNumFor ) const;
+
+ /** @returns <TRUE/> if E,EE,R,RR,AAA,AAAA in format code of subformat
+ nNumFor (0..3) and <b>no</b> preceding calendar was specified and the
+ currently loaded calendar is "gregorian". */
+ bool IsOtherCalendar( sal_uInt16 nNumFor ) const
+ {
+ if ( nNumFor < 4 )
+ return ImpIsOtherCalendar( NumFor[nNumFor] );
+ return false;
+ }
+
+ /** Switches to the first non-"gregorian" calendar, but only if the current
+ calendar is "gregorian"; original calendar name and date/time returned,
+ but only if calendar switched and rOrgCalendar was empty. */
+ void SwitchToOtherCalendar( OUString& rOrgCalendar, double& fOrgDateTime ) const;
+
+ /** Switches to the "gregorian" calendar, but only if the current calendar
+ is non-"gregorian" and rOrgCalendar is not empty. Thus a preceding
+ ImpSwitchToOtherCalendar() call should have been placed prior to
+ calling this method. */
+ void SwitchToGregorianCalendar( const OUString& rOrgCalendar, double fOrgDateTime ) const;
+
+#ifdef THE_FUTURE
+ /** Switches to the first specified calendar, if any, in subformat nNumFor
+ (0..3). Original calendar name and date/time returned, but only if
+ calendar switched and rOrgCalendar was empty.
+
+ @return
+ <TRUE/> if a calendar was specified and switched to,
+ <FALSE/> else.
+ */
+ bool SwitchToSpecifiedCalendar( OUString& rOrgCalendar, double& fOrgDateTime,
+ sal_uInt16 nNumFor ) const
+ {
+ if ( nNumFor < 4 )
+ return ImpSwitchToSpecifiedCalendar( rOrgCalendar,
+ fOrgDateTime, NumFor[nNumFor] );
+ return false;
+ }
+#endif
+
+ /// Whether it's a (YY)YY-M(M)-D(D) format.
+ bool IsIso8601( sal_uInt16 nNumFor )
+ {
+ if ( nNumFor < 4 )
+ return ImpIsIso8601( NumFor[nNumFor]);
+ return false;
+ }
+
+private:
+ ImpSvNumFor NumFor[4]; // Array for the 4 subformats
+ OUString sFormatstring; // The format code string
+ OUString sComment; // Comment, since number formatter version 6
+ double fLimit1; // Value for first condition
+ double fLimit2; // Value for second condition
+ ImpSvNumberformatScan& rScan; // Format code scanner
+ LocaleType maLocale; // Language/country of the format, numeral shape and calendar type from Excel.
+ SvNumberformatLimitOps eOp1; // Operator for first condition
+ SvNumberformatLimitOps eOp2; // Operator for second condition
+ sal_uInt16 nNewStandardDefined; // new builtin formats as of version 6
+ short eType; // Type of format
+ bool bStarFlag; // Take *n format as ESC n
+ bool bStandard; // If this is a default standard format
+ bool bIsUsed; // Flag as used for storing
+
+ SVL_DLLPRIVATE sal_uInt16 ImpGetNumForStringElementCount( sal_uInt16 nNumFor ) const;
+
+ SVL_DLLPRIVATE bool ImpIsOtherCalendar( const ImpSvNumFor& rNumFor ) const;
+
+#ifdef THE_FUTURE
+ SVL_DLLPRIVATE bool ImpSwitchToSpecifiedCalendar( OUString& rOrgCalendar,
+ double& fOrgDateTime,
+ const ImpSvNumFor& rNumFor ) const;
+#endif
+
+ /** Whether to use possessive genitive case month name, or partitive case
+ month name, instead of nominative name (noun).
+
+ @param io_nState
+ 0: execute check <br>
+ set to 1 if nominative case is returned, <br>
+ set to 2 if genitive case is returned, <br>
+ set to 3 if partitive case is returned <br>
+ 1: don't execute check, return nominative case <br>
+ 2: don't execute check, return genitive case <br>
+ 3: don't execute check, return partitive case <br>
+
+ @param eCodeType
+ a NfKeywordIndex, must designate a month type code
+
+ @returns one of com::sun::star::i18n::CalendarDisplayCode values
+ according to eCodeType and the check executed (or passed).
+ */
+ SVL_DLLPRIVATE sal_Int32 ImpUseMonthCase( int & io_nState, const ImpSvNumFor& rNumFor, NfKeywordIndex eCodeType ) const;
+
+ /// Whether it's a (YY)YY-M(M)-D(D) format.
+ SVL_DLLPRIVATE bool ImpIsIso8601( const ImpSvNumFor& rNumFor );
+
+#ifdef _ZFORMAT_CXX // ----- private implementation methods -----
+
+ const CharClass& rChrCls() const { return rScan.GetChrCls(); }
+ const LocaleDataWrapper& rLoc() const { return rScan.GetLoc(); }
+ CalendarWrapper& GetCal() const { return rScan.GetCal(); }
+ const SvNumberFormatter& GetFormatter() const { return *rScan.GetNumberformatter(); }
+
+ // divide in substrings and color conditions
+ SVL_DLLPRIVATE short ImpNextSymbol( OUStringBuffer& rString,
+ sal_Int32& nPos,
+ OUString& sSymbol );
+
+ // read string until ']' and strip blanks (after condition)
+ SVL_DLLPRIVATE static sal_Int32 ImpGetNumber( OUStringBuffer& rString,
+ sal_Int32& nPos,
+ OUString& sSymbol );
+
+ /**
+ * Parse the content of '[$-xxx] or '[$-xxxxxxxx]' and extract the locale
+ * type from it. Given the string, start parsing at position specified by
+ * nPos, and store the end position with nPos when the parsing is
+ * complete. The nPos should point to the '$' before the parsing, and to
+ * the closing bracket after the parsing. When the content is [$-xxx],
+ * the xxx part represents the language type (aka LCID) in hex numerals.
+ * When the content is [$-xxxxxxxx] the last 4 digits represent the LCID
+ * (again in hex), the next 2 digits represent the calendar type, and the
+ * 2 highest digits (if exists) is the numeral shape.
+ *
+ * @reference
+ * http://office.microsoft.com/en-us/excel-help/creating-international-number-formats-HA001034635.aspx
+ *
+ * @param rString input string
+ * @param nPos position (see above).
+ *
+ * @return struct containing numeral shape, calendar type, and LCID that
+ * specifies language type. See i18nlangtag/lang.h for a complete
+ * list of language types. These numbers also correspond with the
+ * numbers used by Microsoft Office.
+ */
+ SVL_DLLPRIVATE static LocaleType ImpGetLocaleType( const OUString& rString, sal_Int32& nPos );
+
+ /** Obtain calendar and numerals from a LocaleType that was parsed from a
+ LCID with ImpGetLocaleType().
+
+ Inserts a NatNum modifier to rString at nPos if needed as determined
+ from the numeral code.
+
+ @ATTENTION: may modify <member>maLocale</member> to make it follow
+ aTmpLocale, in which case also nLang is adapted.
+
+ @returns a string with the calendar if one was determined from the
+ calendar code, else an empty string. The calendar string needs to be
+ inserted at a proper positon to rString after all bracketed prefixes.
+ */
+ SVL_DLLPRIVATE OUString ImpObtainCalendarAndNumerals( OUStringBuffer & rString,
+ sal_Int32 & nPos,
+ LanguageType & nLang,
+ const LocaleType & aTmpLocale );
+
+ // standard number output
+ SVL_DLLPRIVATE void ImpGetOutputStandard( double& fNumber, OUString& OutString );
+ SVL_DLLPRIVATE void ImpGetOutputStandard( double& fNumber, OUStringBuffer& OutString );
+ SVL_DLLPRIVATE void ImpGetOutputStdToPrecision( double& rNumber, OUString& rOutString, sal_uInt16 nPrecision ) const;
+ // numbers in input line
+ SVL_DLLPRIVATE void ImpGetOutputInputLine( double fNumber, OUString& OutString );
+
+ // check subcondition
+ // OP undefined => -1
+ // else 0 or 1
+ SVL_DLLPRIVATE short ImpCheckCondition(double& fNumber,
+ double& fLimit,
+ SvNumberformatLimitOps eOp);
+
+ SVL_DLLPRIVATE sal_uLong ImpGGT(sal_uLong x, sal_uLong y);
+ SVL_DLLPRIVATE sal_uLong ImpGGTRound(sal_uLong x, sal_uLong y);
+
+ // Helper function for number strings
+ // append string symbols, insert leading 0 or ' ', or ...
+ SVL_DLLPRIVATE bool ImpNumberFill( OUStringBuffer& sStr,
+ double& rNumber,
+ sal_Int32& k,
+ sal_uInt16& j,
+ sal_uInt16 nIx,
+ short eSymbolType );
+
+ // Helper function to fill in the integer part and the group (AKA thousand) separators
+ SVL_DLLPRIVATE bool ImpNumberFillWithThousands( OUStringBuffer& sStr,
+ double& rNumber,
+ sal_Int32 k,
+ sal_uInt16 j,
+ sal_uInt16 nIx,
+ sal_Int32 nDigCnt );
+ // Hilfsfunktion zum Auffuellen der Vor-
+ // kommazahl auch mit Tausenderpunkt
+
+ // Helper function to fill in the group (AKA thousand) separators
+ // or to skip additional digits
+ SVL_DLLPRIVATE void ImpDigitFill( OUStringBuffer& sStr,
+ sal_Int32 nStart,
+ sal_Int32& k,
+ sal_uInt16 nIx,
+ sal_Int32 & nDigitCount,
+ utl::DigitGroupingIterator & );
+
+ SVL_DLLPRIVATE bool ImpGetFractionOutput(double fNumber,
+ sal_uInt16 nIx,
+ OUStringBuffer& OutString);
+ SVL_DLLPRIVATE bool ImpGetScientificOutput(double fNumber,
+ sal_uInt16 nIx,
+ OUStringBuffer& OutString);
+
+ SVL_DLLPRIVATE bool ImpGetDateOutput( double fNumber,
+ sal_uInt16 nIx,
+ OUStringBuffer& OutString );
+ SVL_DLLPRIVATE bool ImpGetTimeOutput( double fNumber,
+ sal_uInt16 nIx,
+ OUStringBuffer& OutString );
+ SVL_DLLPRIVATE bool ImpGetDateTimeOutput( double fNumber,
+ sal_uInt16 nIx,
+ OUStringBuffer& OutString );
+
+ // Switches to the "gregorian" calendar if the current calendar is
+ // non-"gregorian" and the era is a "Dummy" era of a calendar which doesn't
+ // know a "before" era (like zh_TW ROC or ja_JP Gengou). If switched and
+ // rOrgCalendar was "gregorian" the string is emptied. If rOrgCalendar was
+ // empty the previous calendar name and date/time are returned.
+ SVL_DLLPRIVATE bool ImpFallBackToGregorianCalendar( OUString& rOrgCalendar, double& fOrgDateTime );
+
+ // Append a "G" short era string of the given calendar. In the case of a
+ // Gengou calendar this is a one character abbreviation, for other
+ // calendars the XExtendedCalendar::getDisplayString() method is called.
+ SVL_DLLPRIVATE static void ImpAppendEraG( OUStringBuffer& OutStringBuffer, const CalendarWrapper& rCal,
+ sal_Int16 nNatNum );
+
+ SVL_DLLPRIVATE bool ImpGetNumberOutput( double fNumber,
+ sal_uInt16 nIx,
+ OUStringBuffer& OutString );
+
+ SVL_DLLPRIVATE void ImpCopyNumberformat( const SvNumberformat& rFormat );
+
+ // normal digits or other digits, depending on ImpSvNumFor.aNatNum,
+ // [NatNum1], [NatNum2], ...
+ SVL_DLLPRIVATE OUString ImpGetNatNumString( const SvNumberNatNum& rNum, sal_Int32 nVal,
+ sal_uInt16 nMinDigits = 0 ) const;
+
+ OUString ImpIntToString( sal_uInt16 nIx, sal_Int32 nVal, sal_uInt16 nMinDigits = 0 ) const
+ {
+ const SvNumberNatNum& rNum = NumFor[nIx].GetNatNum();
+ if ( nMinDigits || rNum.IsComplete() )
+ {
+ return ImpGetNatNumString( rNum, nVal, nMinDigits );
+ }
+ return OUString::valueOf(nVal);
+ }
+
+ // transliterate according to NativeNumber
+ SVL_DLLPRIVATE OUString impTransliterateImpl(const OUString& rStr, const SvNumberNatNum& rNum) const;
+ SVL_DLLPRIVATE void impTransliterateImpl(OUStringBuffer& rStr, const SvNumberNatNum& rNum) const;
+
+ OUString impTransliterate(const OUString& rStr, const SvNumberNatNum& rNum) const
+ {
+ return rNum.IsComplete() ? impTransliterateImpl(rStr, rNum) : rStr;
+ }
+
+ SVL_DLLPRIVATE void impTransliterate(OUStringBuffer& rStr, const SvNumberNatNum& rNum) const
+ {
+ if(rNum.IsComplete())
+ {
+ impTransliterateImpl(rStr, rNum);
+ }
+ }
+
+#endif // _ZFORMAT_CXX
+
+};
+
+#endif // _ZFORMAT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/AccessibleBrowseBoxObjType.hxx b/include/svtools/AccessibleBrowseBoxObjType.hxx
new file mode 100644
index 000000000000..6334cb82aac1
--- /dev/null
+++ b/include/svtools/AccessibleBrowseBoxObjType.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef _SVTOOLS_ACCESSIBLEBROWSEBOXOBJTYPE_HXX
+#define _SVTOOLS_ACCESSIBLEBROWSEBOXOBJTYPE_HXX
+
+// ============================================================================
+
+namespace svt {
+
+// ============================================================================
+
+/** This enumeration contains a constant for each kind of accessible object of
+ a BrowseBox. */
+enum AccessibleBrowseBoxObjType
+{
+ BBTYPE_BROWSEBOX, /// The BrowseBox itself.
+ BBTYPE_TABLE, /// The data table.
+ BBTYPE_ROWHEADERBAR, /// The row header bar ("handle column").
+ BBTYPE_COLUMNHEADERBAR, /// The horizontal column header bar.
+ BBTYPE_TABLECELL, /// A cell of the data table.
+ BBTYPE_ROWHEADERCELL, /// A cell of the row header bar.
+ BBTYPE_COLUMNHEADERCELL, /// A cell of the column header bar.
+ BBTYPE_CHECKBOXCELL /// A cell with a checkbox.
+};
+
+// ============================================================================
+
+} // namespace svt
+
+// ============================================================================
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/DocumentInfoPreview.hxx b/include/svtools/DocumentInfoPreview.hxx
new file mode 100644
index 000000000000..167de92636de
--- /dev/null
+++ b/include/svtools/DocumentInfoPreview.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVTOOLS_DOCUMENTINFOPREVIEW_HXX
+#define SVTOOLS_DOCUMENTINFOPREVIEW_HXX
+
+#include "sal/config.h"
+
+#include "boost/scoped_ptr.hpp"
+#include "i18nlangtag/languagetag.hxx"
+#include "com/sun/star/uno/Reference.hxx"
+#include "svtools/svmedit2.hxx"
+#include "svtools/svtdllapi.h"
+#include "tools/wintypes.hxx"
+#include "vcl/window.hxx"
+
+class SvtDocInfoTable_Impl;
+
+namespace com { namespace sun { namespace star {
+ namespace document { class XDocumentProperties; }
+ namespace util { struct DateTime; }
+} } }
+
+namespace svtools {
+
+class SVT_DLLPUBLIC ODocumentInfoPreview: public Window {
+public:
+ ODocumentInfoPreview(Window * pParent, WinBits nBits);
+
+ virtual ~ODocumentInfoPreview();
+
+ virtual void Resize();
+
+ void clear();
+
+ void fill(
+ com::sun::star::uno::Reference<
+ com::sun::star::document::XDocumentProperties > const & xDocProps,
+ OUString const & rURL);
+
+private:
+ ExtMultiLineEdit m_pEditWin;
+ boost::scoped_ptr< SvtDocInfoTable_Impl > m_pInfoTable;
+ LanguageTag m_aLanguageTag;
+
+ void insertEntry(OUString const & title, OUString const & value);
+
+ void insertNonempty(long id, OUString const & value);
+
+ void insertDateTime(long id, com::sun::star::util::DateTime const & value);
+};
+
+}
+
+#endif // SVTOOLS_DOCUMENTINFOPREVIEW_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/DocumentToGraphicRenderer.hxx b/include/svtools/DocumentToGraphicRenderer.hxx
new file mode 100644
index 000000000000..3033e6473129
--- /dev/null
+++ b/include/svtools/DocumentToGraphicRenderer.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef _DOCUMENTTOGRAPHICRENDERER_HXX_
+#define _DOCUMENTTOGRAPHICRENDERER_HXX_
+
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/view/XRenderable.hpp>
+#include <com/sun/star/awt/XToolkit.hpp>
+
+#include <vcl/graph.hxx>
+
+#include "svtools/svtdllapi.h"
+
+using namespace css;
+using namespace css::uno;
+using namespace css::lang;
+using namespace css::beans;
+
+class SVT_DLLPUBLIC DocumentToGraphicRenderer
+{
+ const Reference<XComponent>& mxDocument;
+
+ Reference<frame::XModel> mxModel;
+ Reference<frame::XController> mxController;
+ Reference<view::XRenderable> mxRenderable;
+ Reference<awt::XToolkit> mxToolkit;
+
+public:
+ DocumentToGraphicRenderer(const Reference<XComponent>& xDocument);
+ ~DocumentToGraphicRenderer();
+
+ sal_Int32 getCurrentPageWriter( );
+
+ Size getDocumentSizeInPixels( sal_Int32 aCurrentPage );
+
+ Size getDocumentSizeIn100mm( sal_Int32 aCurrentPage );
+
+ Graphic renderToGraphic(sal_Int32 aCurrentPage, Size aDocumentSizePixel, Size aTargetSizePixel);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/GraphicExportOptionsDialog.hxx b/include/svtools/GraphicExportOptionsDialog.hxx
new file mode 100644
index 000000000000..b346f8c25671
--- /dev/null
+++ b/include/svtools/GraphicExportOptionsDialog.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _GRAPHICEXPORTOPTIONSDIALOG_HXX_
+#define _GRAPHICEXPORTOPTIONSDIALOG_HXX_
+
+#include <vcl/fltcall.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+#include <vcl/layout.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/scrbar.hxx>
+
+#include <svtools/DocumentToGraphicRenderer.hxx>
+
+#include "svtools/svtdllapi.h"
+
+using namespace css;
+using namespace css::uno;
+using namespace css::lang;
+using namespace css::frame;
+using namespace css::beans;
+
+class SVT_DLLPUBLIC GraphicExportOptionsDialog : public ModalDialog
+{
+private:
+ NumericField* mpWidth;
+ NumericField* mpHeight;
+ ComboBox* mpResolution;
+
+ Size mSize100mm;
+ double mResolution;
+
+ DocumentToGraphicRenderer mRenderer;
+
+ sal_Int32 mCurrentPage;
+
+ void initialize();
+ void updateWidth();
+ void updateHeight();
+ void updateResolution();
+
+ double getViewWidthInch();
+ double getViewHeightInch();
+
+ DECL_LINK( widthModifiedHandle, void* );
+ DECL_LINK( heightModifiedHandle, void* );
+ DECL_LINK( resolutionModifiedHandle, void* );
+
+public:
+ GraphicExportOptionsDialog( Window* pWindow, const Reference<XComponent>& rxSourceDocument );
+ ~GraphicExportOptionsDialog();
+
+ Sequence<PropertyValue> getFilterData();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/PlaceEditDialog.hxx b/include/svtools/PlaceEditDialog.hxx
new file mode 100644
index 000000000000..d529442cd738
--- /dev/null
+++ b/include/svtools/PlaceEditDialog.hxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * [ Copyright (C) 2012 Julien Levesy <jlevesy@gmail.com> (initial developer) ]
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+#ifndef _PLACEEDITDIALOG_HXX
+#define _PLACEEDITDIALOG_HXX
+
+#include "ServerDetailsControls.hxx"
+
+#include <vcl/button.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+
+#include <svtools/inettbc.hxx>
+#include <svtools/place.hxx>
+
+#include <boost/shared_ptr.hpp>
+#include <vector>
+
+class SVT_DLLPUBLIC PlaceEditDialog : public ModalDialog
+{
+private :
+
+ Edit* m_pEDServerName;
+ ListBox* m_pLBServerType;
+ boost::shared_ptr< DetailsContainer > m_pCurrentDetails;
+
+ Edit* m_pEDUsername;
+ OKButton* m_pBTOk;
+ CancelButton* m_pBTCancel;
+
+ PushButton* m_pBTDelete;
+
+ /** Vector holding the details UI control for each server type.
+
+ The elements in this vector need to match the order in the type listbox, e.g.
+ the m_aDetailsContainer[0] will be shown for the type corresponding to entry 0
+ in the listbox.
+ */
+ std::vector< boost::shared_ptr< DetailsContainer > > m_aDetailsContainers;
+
+public :
+
+ PlaceEditDialog( Window* pParent);
+ PlaceEditDialog(Window* pParent, const boost::shared_ptr<Place> &pPlace );
+ ~PlaceEditDialog();
+
+ // Returns a place instance with given information
+ boost::shared_ptr<Place> GetPlace();
+
+ OUString GetServerName() { return m_pEDServerName->GetText(); }
+ OUString GetServerUrl();
+
+private:
+
+ void InitDetails( );
+
+ DECL_LINK ( OKHdl, Button * );
+ DECL_LINK ( DelHdl, Button * );
+ DECL_LINK ( EditHdl, void * );
+ DECL_LINK ( SelectTypeHdl, void * );
+ DECL_LINK ( EditUsernameHdl, void * );
+
+};
+
+#endif //_PLACEEDITDIALOG_HXX
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/QueryFolderName.hxx b/include/svtools/QueryFolderName.hxx
new file mode 100644
index 000000000000..b3ff30d24b81
--- /dev/null
+++ b/include/svtools/QueryFolderName.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef SVT_QUERYFOLDER_HXX
+#define SVT_QUERYFOLDER_HXX
+
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/dialog.hxx>
+
+//-------------------------------------------------------------------------
+namespace svtools {
+
+//-------------------------------------------------------------------------
+// QueryFolderNameDialog
+//-------------------------------------------------------------------------
+
+class QueryFolderNameDialog : public ModalDialog
+{
+private:
+ FixedText aNameText;
+ Edit aNameEdit;
+ FixedLine aNameLine;
+ OKButton aOKBtn;
+ CancelButton aCancelBtn;
+
+ DECL_LINK( OKHdl, void * );
+ DECL_LINK( NameHdl, void * );
+
+public:
+ QueryFolderNameDialog( Window* _pParent,
+ const String& rTitle,
+ const String& rDefaultText,
+ String* pGroupName = NULL );
+ String GetName() const { return aNameEdit.GetText(); }
+};
+
+}
+#endif // SVT_QUERYFOLDER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/ServerDetailsControls.hxx b/include/svtools/ServerDetailsControls.hxx
new file mode 100644
index 000000000000..f75b8aa87e2a
--- /dev/null
+++ b/include/svtools/ServerDetailsControls.hxx
@@ -0,0 +1,148 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ */
+#ifndef _SERVERDETAILSCONTROLS_HXX
+#define _SERVERDETAILSCONTROLS_HXX
+
+#include <map>
+
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+
+#include <tools/urlobj.hxx>
+#include <vcl/builder.hxx>
+#include <vcl/button.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/layout.hxx>
+
+class DetailsContainer
+{
+ private:
+ Link m_aChangeHdl;
+ VclFrame* m_pFrame;
+
+ public:
+ DetailsContainer( VclBuilderContainer* pBuilder, const OString& rFrame );
+ virtual ~DetailsContainer( );
+
+ void setChangeHdl( const Link& rLink ) { m_aChangeHdl = rLink; }
+
+ virtual void show( bool bShow = true );
+ virtual INetURLObject getUrl( );
+
+ /** Try to split the URL in the controls of that container.
+
+ \param sUrl the URL to split
+ \return true if the split worked, false otherwise.
+ */
+ virtual bool setUrl( const INetURLObject& rUrl );
+
+ virtual void setUsername( const OUString& /*rUsername*/ ) { };
+
+ protected:
+ void notifyChange( );
+ DECL_LINK ( ValueChangeHdl, void * );
+};
+
+class HostDetailsContainer : public DetailsContainer
+{
+ private:
+ sal_uInt16 m_nDefaultPort;
+ OUString m_sScheme;
+
+ protected:
+ Edit* m_pEDHost;
+ NumericField* m_pEDPort;
+ Edit* m_pEDPath;
+
+ public:
+ HostDetailsContainer( VclBuilderContainer* pBuilder, sal_uInt16 nPort, OUString sScheme );
+ virtual ~HostDetailsContainer( ) { };
+
+ virtual void show( bool bShow = true );
+ virtual INetURLObject getUrl( );
+ virtual bool setUrl( const INetURLObject& rUrl );
+
+ protected:
+ void setScheme( OUString sScheme ) { m_sScheme = sScheme; }
+
+ /** Verifies that the schement split from the URL can be handled by
+ the container and set the proper controls accordingly if needed.
+ */
+ virtual bool verifyScheme( const OUString& rScheme );
+};
+
+class DavDetailsContainer : public HostDetailsContainer
+{
+ private:
+ CheckBox* m_pCBDavs;
+
+ public:
+ DavDetailsContainer( VclBuilderContainer* pBuilder );
+ ~DavDetailsContainer( ) { };
+
+ virtual void show( bool bShow = true );
+
+ protected:
+ virtual bool verifyScheme( const OUString& rScheme );
+
+ private:
+ DECL_LINK ( ToggledDavsHdl, CheckBox * pCheckBox );
+};
+
+class SmbDetailsContainer : public DetailsContainer
+{
+ private:
+ Edit* m_pEDHost;
+ Edit* m_pEDShare;
+ Edit* m_pEDPath;
+
+ public:
+ SmbDetailsContainer( VclBuilderContainer* pBuilder );
+ ~SmbDetailsContainer( ) { };
+
+ virtual INetURLObject getUrl( );
+ virtual bool setUrl( const INetURLObject& rUrl );
+};
+
+class CmisDetailsContainer : public DetailsContainer
+{
+ private:
+ OUString m_sUsername;
+ com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > m_xCmdEnv;
+ std::vector< OUString > m_aServerTypesURLs;
+ std::vector< OUString > m_aRepoIds;
+ OUString m_sRepoId;
+
+ Edit* m_pEDBinding;
+ ListBox* m_pLBRepository;
+ Button* m_pBTRepoRefresh;
+ ListBox* m_pLBServerType;
+ Edit* m_pEDPath;
+
+ public:
+ CmisDetailsContainer( VclBuilderContainer* pBuilder );
+ ~CmisDetailsContainer( ) { };
+
+ virtual INetURLObject getUrl( );
+ virtual bool setUrl( const INetURLObject& rUrl );
+ virtual void setUsername( const OUString& rUsername );
+
+ private:
+ void selectRepository( );
+ DECL_LINK ( SelectServerTypeHdl, void * );
+ DECL_LINK ( RefreshReposHdl, void * );
+ DECL_LINK ( SelectRepoHdl, void * );
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/acceleratorexecute.hxx b/include/svtools/acceleratorexecute.hxx
new file mode 100644
index 000000000000..0b3b473449b7
--- /dev/null
+++ b/include/svtools/acceleratorexecute.hxx
@@ -0,0 +1,246 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVTOOLS_ACCELERATOREXECUTE_HXX
+#define INCLUDED_SVTOOLS_ACCELERATOREXECUTE_HXX
+
+#include "svtools/svtdllapi.h"
+
+#include <vector>
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/ui/XAcceleratorConfiguration.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <com/sun/star/util/URL.hpp>
+#include <com/sun/star/awt/KeyEvent.hpp>
+#include <vcl/keycod.hxx>
+#include <vcl/evntpost.hxx>
+#include <osl/mutex.h>
+
+
+namespace svt
+{
+
+
+struct TMutexInit
+{
+ ::osl::Mutex m_aLock;
+};
+
+//===============================================
+/**
+ @descr implements a helper, which can be used to
+ convert vcl key codes into awt key codes ...
+ and reverse.
+
+ Further such key code can be triggered.
+ Doing so different accelerator
+ configurations are merged together; a suitable
+ command registered for the given key code is searched
+ and will be dispatched.
+
+ @attention
+
+ Because exceution of an accelerator command can be dangerous
+ (in case it force an office shutdown for key "ALT+F4"!)
+ all internal dispatches are done asynchronous.
+ Menas that the trigger call doesnt wait till the dispatch
+ is finished. You can call very often. All requests will be
+ queued internal and dispatched ASAP.
+
+ Of course this queue will be stopped if the environment
+ will be destructed ...
+ */
+class SVT_DLLPUBLIC AcceleratorExecute : private TMutexInit
+{
+ //-------------------------------------------
+ // const, types
+ private:
+
+ /** @deprecated
+ replaced by internal class AsyncAccelExec ...
+ remove this resource here if we go forwards to next major */
+ typedef ::std::vector< ::std::pair< css::util::URL, css::uno::Reference< css::frame::XDispatch > > > TCommandQueue;
+
+ //-------------------------------------------
+ // member
+ private:
+
+ /** TODO document me */
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+
+ /** TODO document me */
+ css::uno::Reference< css::util::XURLTransformer > m_xURLParser;
+
+ /** TODO document me */
+ css::uno::Reference< css::frame::XDispatchProvider > m_xDispatcher;
+
+ /** TODO document me */
+ css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xGlobalCfg;
+ css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xModuleCfg;
+ css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xDocCfg;
+
+ /** @deprecated
+ replaced by internal class AsyncAccelExec ...
+ remove this resource here if we go forwards to next major */
+ TCommandQueue m_lCommandQueue;
+
+ /** @deprecated
+ replaced by internal class AsyncAccelExec ...
+ remove this resource here if we go forwards to next major */
+ ::vcl::EventPoster m_aAsyncCallback;
+
+ //-------------------------------------------
+ // interface
+ public:
+
+ //---------------------------------------
+ /** @short factory method to create new accelerator
+ helper instance.
+
+ @descr Such helper instance must be initialized at first.
+ So it can know its environment (global/module or
+ document specific).
+
+ Afterwards it can be used to execute incoming
+ accelerator requests.
+
+ The "end of life" of such helper can be reached as follow:
+
+ - delete the object
+ => If it stands currently in its execute method, they will
+ be finished. All further queued requests will be removed
+ and further not executed!
+
+ - "let it stay alone"
+ => All currently queued events will be finished. The
+ helper kills itself afterwards. A shutdown of the
+ environment will be recognized ... The helper stop its
+ work immediately then!
+ */
+ static AcceleratorExecute* createAcceleratorHelper();
+
+ //---------------------------------------
+ /** @short fight against inlining ... */
+ virtual ~AcceleratorExecute();
+
+ //---------------------------------------
+ /** @short init this instance.
+
+ @descr It must be called as first method after creation.
+ And further it can be called more then once ...
+ but at least its should be used one times only.
+ Otherwhise nobody can say, which asynchronous
+ executions will be used inside the old and which one
+ will be used inside the new environment.
+
+ @param rxContext
+ reference to an uno service manager.
+
+ @param xEnv
+ if it points to a valid frame it will be used
+ to execute the dispatch there. Further the frame
+ is used to locate the right module configuration
+ and use it merged together with the document and
+ the global configuration.
+
+ If this parameter is set to NULL, the global configuration
+ is used only. Further the global Desktop instance is
+ used for dispatch.
+ */
+ virtual void init(const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::frame::XFrame >& xEnv );
+
+ //---------------------------------------
+ /** @short trigger this accelerator.
+
+ @descr The internal configuartions are used to find
+ as suitable command for this key code.
+ This command will be queued and executed later
+ asynchronous.
+
+ @param aKey
+ specify the accelerator for execute.
+
+ @return [sal_Bool]
+ sal_True if this key is configured and match to a command.
+ Attention: This state does not mean the success state
+ of the corresponding execute. Because its done asynchronous!
+ */
+ virtual sal_Bool execute(const KeyCode& aKey);
+ virtual sal_Bool execute(const css::awt::KeyEvent& aKey);
+
+ /** search the command for the given key event.
+ *
+ * @param aKey The key event
+ * @return The command or an empty string if the key event could not be found.
+ */
+ OUString findCommand(const ::com::sun::star::awt::KeyEvent& aKey);
+ //---------------------------------------
+ /** TODO document me */
+ static css::awt::KeyEvent st_VCLKey2AWTKey(const KeyCode& aKey);
+ static KeyCode st_AWTKey2VCLKey(const css::awt::KeyEvent& aKey);
+
+ //---------------------------------------
+ /** TODO document me */
+ static css::uno::Reference< css::ui::XAcceleratorConfiguration > st_openGlobalConfig(const css::uno::Reference< css::uno::XComponentContext >& rxContext);
+
+ //---------------------------------------
+ /** TODO document me */
+ static css::uno::Reference< css::ui::XAcceleratorConfiguration > st_openModuleConfig(const css::uno::Reference< css::uno::XComponentContext >& rxContext ,
+ const css::uno::Reference< css::frame::XFrame >& xFrame);
+
+ //---------------------------------------
+ /** TODO document me */
+ static css::uno::Reference< css::ui::XAcceleratorConfiguration > st_openDocConfig(const css::uno::Reference< css::frame::XModel >& xModel);
+
+ //-------------------------------------------
+ // internal
+ private:
+
+ //---------------------------------------
+ /** @short allow creation of instances of this class
+ by using our factory only!
+ */
+ SVT_DLLPRIVATE AcceleratorExecute();
+
+ AcceleratorExecute(const AcceleratorExecute& rCopy);
+ void operator=(const AcceleratorExecute&) {};
+ //---------------------------------------
+ /** TODO document me */
+ SVT_DLLPRIVATE OUString impl_ts_findCommand(const css::awt::KeyEvent& aKey);
+
+ //---------------------------------------
+ /** TODO document me */
+ SVT_DLLPRIVATE css::uno::Reference< css::util::XURLTransformer > impl_ts_getURLParser();
+
+ //---------------------------------------
+ /** @deprecated
+ replaced by internal class AsyncAccelExec ...
+ remove this resource here if we go forwards to next major */
+ DECL_DLLPRIVATE_LINK(impl_ts_asyncCallback, void*);
+};
+
+} // namespace svt
+
+#endif // INCLUDED_SVTOOLS_ACCELERATOREXECUTE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/accessibilityoptions.hxx b/include/svtools/accessibilityoptions.hxx
new file mode 100644
index 000000000000..4c168143aff9
--- /dev/null
+++ b/include/svtools/accessibilityoptions.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVTOOLS_ACCESSIBILITYOPTIONS_HXX
+#define INCLUDED_SVTOOLS_ACCESSIBILITYOPTIONS_HXX
+
+#include "svtools/svtdllapi.h"
+#include <unotools/configitem.hxx>
+#include <svl/brdcst.hxx>
+#include <svl/lstner.hxx>
+#include <unotools/options.hxx>
+
+class SvtAccessibilityOptions_Impl;
+
+class SVT_DLLPUBLIC SvtAccessibilityOptions:
+ public utl::detail::Options, private SfxListener
+{
+private:
+ static SvtAccessibilityOptions_Impl* sm_pSingleImplConfig;
+ static sal_Int32 sm_nAccessibilityRefCount;
+
+public:
+ SvtAccessibilityOptions();
+ virtual ~SvtAccessibilityOptions();
+
+ // get & set config entries
+ sal_Bool GetIsForPagePreviews() const;
+ sal_Bool GetIsHelpTipsDisappear() const;
+ sal_Bool GetIsAllowAnimatedGraphics() const;
+ sal_Bool GetIsAllowAnimatedText() const;
+ sal_Bool GetIsAutomaticFontColor() const;
+ sal_Bool GetIsSystemFont() const;
+ sal_Int16 GetHelpTipSeconds() const;
+ sal_Bool IsSelectionInReadonly() const;
+ sal_Bool GetAutoDetectSystemHC() const;
+
+ void SetIsForPagePreviews(sal_Bool bSet);
+ void SetIsHelpTipsDisappear(sal_Bool bSet);
+ void SetIsAllowAnimatedGraphics(sal_Bool bSet);
+ void SetIsAllowAnimatedText(sal_Bool bSet);
+ void SetIsAutomaticFontColor(sal_Bool bSet);
+ void SetIsSystemFont(sal_Bool bSet);
+ void SetHelpTipSeconds(sal_Int16 nSet);
+ void SetSelectionInReadonly(sal_Bool bSet);
+ void SetAutoDetectSystemHC(sal_Bool bSet);
+
+ sal_Bool IsModified() const;
+ void Commit();
+
+ //SfxListener:
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+ void SetVCLSettings();
+};
+
+#endif // #ifndef INCLUDED_SVTOOLS_ACCESSIBILITYOPTIONS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/accessiblefactory.hxx b/include/svtools/accessiblefactory.hxx
new file mode 100644
index 000000000000..d30af055c91d
--- /dev/null
+++ b/include/svtools/accessiblefactory.hxx
@@ -0,0 +1,184 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVTOOLS_ACCESSIBLE_FACTORY_HXX
+#define SVTOOLS_ACCESSIBLE_FACTORY_HXX
+
+#include "AccessibleBrowseBoxObjType.hxx"
+#include "accessibletableprovider.hxx"
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <rtl/ref.hxx>
+
+namespace com { namespace sun { namespace star {
+ namespace accessibility {
+ class XAccessible;
+ class XAccessibleContext;
+ }
+ namespace awt {
+ class XWindow;
+ }
+} } }
+class SvHeaderTabListBox;
+class SvtIconChoiceCtrl;
+class TabBar;
+class SvTreeListBox;
+class VCLXWindow;
+class TextEngine;
+class TextView;
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ class ToolPanelDeck;
+ class IToolPanelDeck;
+ class PanelTabBar;
+ namespace table
+ {
+ class IAccessibleTable;
+ class IAccessibleTableControl;
+ }
+
+ /** a function which is able to create a factory for the standard Accessible/Context
+ components needed for standard toolkit controls
+
+ The returned pointer denotes an instance of the IAccessibleFactory, which has been acquired
+ <em>once</em>. The caller is responsible for holding this reference as long as it needs the
+ factory, and release it afterwards.
+ */
+ typedef void* (SAL_CALL * GetSvtAccessibilityComponentFactory)( );
+
+ //================================================================
+ //= IAccessibleFactory
+ //================================================================
+ class IAccessibleFactory : public ::rtl::IReference
+ {
+ public:
+ virtual IAccessibleTabListBox*
+ createAccessibleTabListBox(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent,
+ SvHeaderTabListBox& rBox
+ ) const = 0;
+
+ virtual IAccessibleBrowseBox*
+ createAccessibleBrowseBox(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent,
+ IAccessibleTableProvider& _rBrowseBox
+ ) const = 0;
+ virtual table::IAccessibleTableControl*
+ createAccessibleTableControl(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent,
+ table::IAccessibleTable& _rTable
+ ) const = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ createAccessibleIconChoiceCtrl(
+ SvtIconChoiceCtrl& _rIconCtrl,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _xParent
+ ) const = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ createAccessibleTabBar(
+ TabBar& _rTabBar
+ ) const = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleTextWindowContext(
+ VCLXWindow* pVclXWindow, TextEngine& rEngine, TextView& rView, bool bCompoundControlChild
+ ) const = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ createAccessibleTreeListBox(
+ SvTreeListBox& _rListBox,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _xParent
+ ) const = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ createAccessibleBrowseBoxHeaderBar(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent,
+ IAccessibleTableProvider& _rOwningTable,
+ AccessibleBrowseBoxObjType _eObjType
+ ) const = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ createAccessibleBrowseBoxTableCell(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent,
+ IAccessibleTableProvider& _rBrowseBox,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow,
+ sal_Int32 _nRowId,
+ sal_uInt16 _nColId,
+ sal_Int32 _nOffset
+ ) const = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ createAccessibleBrowseBoxHeaderCell(
+ sal_Int32 _nColumnRowId,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent,
+ IAccessibleTableProvider& _rBrowseBox,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow,
+ AccessibleBrowseBoxObjType _eObjType
+ ) const = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ createAccessibleCheckBoxCell(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent,
+ IAccessibleTableProvider& _rBrowseBox,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow,
+ sal_Int32 _nRowPos,
+ sal_uInt16 _nColPos,
+ const TriState& _eState,
+ sal_Bool _bIsTriState
+ ) const = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ createEditBrowseBoxTableCellAccess(
+ const ::com::sun::star::uno::Reference< com::sun::star::accessibility::XAccessible >& _rxParent,
+ const ::com::sun::star::uno::Reference< com::sun::star::accessibility::XAccessible >& _rxControlAccessible,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _rxFocusWindow,
+ IAccessibleTableProvider& _rBrowseBox,
+ sal_Int32 _nRowPos,
+ sal_uInt16 _nColPos
+ ) const = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleToolPanelDeck(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent,
+ ::svt::ToolPanelDeck& i_rPanelDeck
+ ) = 0;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleToolPanelTabBar(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent,
+ ::svt::IToolPanelDeck& i_rPanelDeck,
+ ::svt::PanelTabBar& i_rTabBar
+ ) = 0;
+
+ protected:
+ ~IAccessibleFactory() {}
+ };
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // SVTOOLS_ACCESSIBLE_FACTORY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/accessibletable.hxx b/include/svtools/accessibletable.hxx
new file mode 100644
index 000000000000..7b314df4f4bf
--- /dev/null
+++ b/include/svtools/accessibletable.hxx
@@ -0,0 +1,203 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVTOOLS_ACCESSIBLETABLE_HXX
+#define _SVTOOLS_ACCESSIBLETABLE_HXX
+
+#include <vcl/window.hxx>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+
+
+namespace svt{ namespace table
+{
+
+typedef sal_Int32 RowPos;
+
+
+enum AccessibleTableType
+{
+ /** Child index of the column header bar (first row). */
+ TCINDEX_COLUMNHEADERBAR = 0,
+ /** Child index of the row header bar ("handle column"). */
+ TCINDEX_ROWHEADERBAR = 1,
+ /** Child index of the data table. */
+ TCINDEX_TABLE = 2
+};
+
+enum AccessibleTableControlObjType
+{
+ TCTYPE_GRIDCONTROL, /// The GridControl itself.
+ TCTYPE_TABLE, /// The data table.
+ TCTYPE_ROWHEADERBAR, /// The row header bar.
+ TCTYPE_COLUMNHEADERBAR, /// The horizontal column header bar.
+ TCTYPE_TABLECELL, /// A cell of the data table.
+ TCTYPE_ROWHEADERCELL, /// A cell of the row header bar.
+ TCTYPE_COLUMNHEADERCELL, /// A cell of the column header bar.
+};
+
+
+/** This abstract class provides methods to implement an accessible table object.
+*/
+class IAccessibleTable
+{
+public:
+ /** @return The position of the current row. */
+ virtual sal_Int32 GetCurrentRow() const = 0;
+ /** @return The position of the current column. */
+ virtual sal_Int32 GetCurrentColumn() const = 0;
+ /** Creates and returns the accessible object of the whole GridControl. */
+ virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible()= 0;
+ virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleControl( sal_Int32 _nIndex )= 0;
+ virtual OUString GetAccessibleObjectName(AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const= 0;
+ virtual sal_Bool GoToCell( sal_Int32 _nColumnPos, sal_Int32 _nRow )= 0;
+ virtual sal_Bool HasColHeader() = 0;
+ virtual sal_Bool HasRowHeader() = 0;
+
+ /** return the description of the specified object.
+ @param eObjType
+ The type to ask for
+ @param _nPosition
+ The position of a tablecell (index position), header bar colum/row cell
+ @return
+ The description of the specified object.
+ */
+ virtual OUString GetAccessibleObjectDescription(AccessibleTableControlObjType eObjType, sal_Int32 _nPosition = -1) const= 0;
+
+ /** Fills the StateSet with all states (except DEFUNC and SHOWING, done by
+ the accessible object), depending on the specified object type. */
+ virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& rStateSet,
+ AccessibleTableControlObjType eObjType ) const= 0;
+
+ // Window
+ virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const = 0;
+ virtual void GrabFocus()= 0;
+ virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible( sal_Bool bCreate = sal_True )= 0;
+ virtual Window* GetAccessibleParentWindow() const= 0;
+ virtual Window* GetWindowInstance()= 0;
+ virtual sal_Int32 GetAccessibleControlCount() const = 0;
+ virtual sal_Bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint )= 0;
+ virtual long GetRowCount() const= 0;
+ virtual long GetColumnCount() const= 0;
+ virtual sal_Bool HasRowHeader() const= 0;
+ virtual sal_Bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint )= 0;
+ virtual Rectangle calcHeaderRect( sal_Bool _bIsColumnBar, sal_Bool _bOnScreen = sal_True ) = 0;
+ virtual Rectangle calcHeaderCellRect( sal_Bool _bColHeader, sal_Int32 _nPos ) = 0;
+ virtual Rectangle calcTableRect( sal_Bool _bOnScreen = sal_True ) = 0;
+ virtual Rectangle calcCellRect( sal_Int32 _nRowPos, sal_Int32 _nColPos ) = 0;
+ virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex)= 0;
+ virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint)= 0;
+ virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const= 0;
+ virtual OUString GetRowDescription( sal_Int32 _nRow ) const = 0;
+ virtual OUString GetRowName(sal_Int32 _nIndex) const = 0;
+ virtual OUString GetColumnDescription( sal_uInt16 _nColumnPos ) const = 0;
+ virtual OUString GetColumnName( sal_Int32 _nIndex ) const = 0;
+ virtual css::uno::Any GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const = 0;
+ virtual OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) const = 0;
+
+ virtual sal_Int32 GetSelectedRowCount() const = 0;
+ virtual sal_Int32 GetSelectedRowIndex( sal_Int32 const i_selectionIndex ) const = 0;
+ virtual bool IsRowSelected( sal_Int32 const i_rowIndex ) const = 0;
+ virtual void SelectRow( sal_Int32 const i_rowIndex, bool const i_select ) = 0;
+ virtual void SelectAllRows( bool const i_select ) = 0;
+
+protected:
+ ~IAccessibleTable() {}
+};
+
+
+/** interface for an implementation of a table control's Accesible component
+*/
+class IAccessibleTableControl
+{
+public:
+ /** returns the XAccessible object itself
+
+ The reference returned here can be used to control the life time of the
+ IAccessibleTableImplementation object.
+
+ The returned reference is guaranteed to not be <NULL/>.
+ */
+ virtual css::uno::Reference< css::accessibility::XAccessible >
+ getMyself() = 0;
+
+ /** disposes the accessible implementation, so that it becomes defunc
+ */
+ virtual void dispose() = 0;
+
+ /** checks whether the accessible implementation, and its context, are still alive
+ @return <TRUE/>, if the object is not disposed or disposing.
+ */
+ virtual sal_Bool isAlive() const = 0;
+
+ /** returns the accessible object for the row or the column header bar
+ */
+ virtual css::uno::Reference< css::accessibility::XAccessible >
+ getTableHeader( ::svt::table::AccessibleTableControlObjType _eObjType ) = 0;
+
+ /** returns the accessible object for the table representation
+ */
+ virtual css::uno::Reference< css::accessibility::XAccessible >
+ getTable() = 0;
+
+ /** commits the event at all listeners of the cell
+ @param nEventId
+ the event id
+ @param rNewValue
+ the new value
+ @param rOldValue
+ the old value
+ */
+ virtual void commitCellEvent(
+ sal_Int16 nEventId,
+ const css::uno::Any& rNewValue,
+ const css::uno::Any& rOldValue
+ ) = 0;
+ /** commits the event at all listeners of the table
+ @param nEventId
+ the event id
+ @param rNewValue
+ the new value
+ @param rOldValue
+ the old value
+ */
+ virtual void commitTableEvent(
+ sal_Int16 nEventId,
+ const css::uno::Any& rNewValue,
+ const css::uno::Any& rOldValue
+ ) = 0;
+
+ ///** Commits an event to all listeners. */
+ virtual void commitEvent(
+ sal_Int16 nEventId,
+ const css::uno::Any& rNewValue,
+ const css::uno::Any& rOldValue
+ ) = 0;
+
+protected:
+ ~IAccessibleTableControl() {}
+};
+
+
+} // namespace table
+} // namespace svt
+
+#endif // _SVTOOLS_ACCESSIBLETABLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/accessibletableprovider.hxx b/include/svtools/accessibletableprovider.hxx
new file mode 100644
index 000000000000..775ac23c8ab2
--- /dev/null
+++ b/include/svtools/accessibletableprovider.hxx
@@ -0,0 +1,241 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVTOOLS_ACCESSIBLETABLEPROVIDER_HXX
+#define _SVTOOLS_ACCESSIBLETABLEPROVIDER_HXX
+
+#include <vcl/window.hxx>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <svtools/AccessibleBrowseBoxObjType.hxx>
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+
+
+namespace svt
+{
+
+#define OFFSET_DEFAULT ((sal_Int32)-1)
+#define OFFSET_NONE ((sal_Int32)0)
+
+enum AccessibleTableChildIndex
+{
+ /** Child index of the column header bar (first row). Exists always. */
+ BBINDEX_COLUMNHEADERBAR = 0,
+ /** Child index of the row header bar ("handle column"). Exists always. */
+ BBINDEX_ROWHEADERBAR = 1,
+ /** Child index of the data table. */
+ BBINDEX_TABLE = 2,
+ /** Child index of the first additional control. */
+ BBINDEX_FIRSTCONTROL = 3
+};
+
+
+/** This abstract class provides methods to implement an accessible table object.
+*/
+class IAccessibleTableProvider
+{
+public:
+ /** @return The count of the rows. */
+ virtual long GetRowCount() const = 0;
+ /** @return The count of the columns. */
+ virtual sal_uInt16 GetColumnCount() const = 0;
+
+ /** @return The position of the current row. */
+ virtual sal_Int32 GetCurrRow() const = 0;
+ /** @return The position of the current column. */
+ virtual sal_uInt16 GetCurrColumn() const = 0;
+
+ /** @return The description of a row.
+ @param _nRow The row which description is in demand. */
+ virtual OUString GetRowDescription( sal_Int32 _nRow ) const = 0;
+ /** @return The description of a column.
+ @param _nColumn The column which description is in demand. */
+ virtual OUString GetColumnDescription( sal_uInt16 _nColumnPos ) const = 0;
+
+ /** @return <TRUE/>, if the object has a row header. */
+ virtual sal_Bool HasRowHeader() const = 0; //GetColumnId
+ /** @return <TRUE/>, if the object can focus a cell. */
+ virtual sal_Bool IsCellFocusable() const = 0;
+ virtual sal_Bool GoToCell( sal_Int32 _nRow, sal_uInt16 _nColumnPos ) = 0;
+
+ virtual void SetNoSelection() = 0;
+ virtual void SelectAll() = 0;
+ virtual void SelectRow( long _nRow, sal_Bool _bSelect = sal_True, sal_Bool bExpand = sal_True ) = 0;
+ virtual void SelectColumn( sal_uInt16 _nColumnPos, sal_Bool _bSelect = sal_True ) = 0;
+ virtual sal_Int32 GetSelectedRowCount() const = 0;
+ virtual sal_Int32 GetSelectedColumnCount() const = 0;
+ /** @return <TRUE/>, if the row is selected. */
+ virtual bool IsRowSelected( long _nRow ) const = 0;
+ virtual sal_Bool IsColumnSelected( long _nColumnPos ) const = 0;
+ virtual void GetAllSelectedRows( css::uno::Sequence< sal_Int32 >& _rRows ) const = 0;
+ virtual void GetAllSelectedColumns( css::uno::Sequence< sal_Int32 >& _rColumns ) const = 0;
+
+ /** @return <TRUE/>, if the cell is visible. */
+ virtual sal_Bool IsCellVisible( sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const = 0;
+ virtual String GetAccessibleCellText( long _nRow, sal_uInt16 _nColumnPos ) const = 0;
+
+ virtual Rectangle calcHeaderRect( sal_Bool _bIsColumnBar, sal_Bool _bOnScreen = sal_True ) = 0;
+ virtual Rectangle calcTableRect( sal_Bool _bOnScreen = sal_True ) = 0;
+ virtual Rectangle GetFieldRectPixelAbs( sal_Int32 _nRow, sal_uInt16 _nColumnPos, sal_Bool _bIsHeader, sal_Bool _bOnScreen = sal_True ) = 0;
+
+ virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleCell( sal_Int32 _nRow, sal_uInt16 _nColumnPos ) = 0;
+ virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleRowHeader( sal_Int32 _nRow ) = 0;
+ virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleColumnHeader( sal_uInt16 _nColumnPos ) = 0;
+
+ virtual sal_Int32 GetAccessibleControlCount() const = 0;
+ virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleControl( sal_Int32 _nIndex ) = 0;
+ virtual sal_Bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint ) = 0;
+
+ virtual sal_Bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_uInt16& _rnColPos, const Point& _rPoint ) = 0;
+ virtual sal_Bool ConvertPointToRowHeader( sal_Int32& _rnRow, const Point& _rPoint ) = 0;
+ virtual sal_Bool ConvertPointToColumnHeader( sal_uInt16& _rnColPos, const Point& _rPoint ) = 0;
+
+ virtual OUString GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos = -1 ) const = 0;
+ virtual OUString GetAccessibleObjectDescription( ::svt::AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos = -1 ) const = 0;
+
+ virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& _rStateSet, ::svt::AccessibleBrowseBoxObjType _eType ) const = 0;
+ virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const = 0;
+ virtual void GrabTableFocus() = 0;
+
+ // OutputDevice
+ virtual sal_Bool GetGlyphBoundRects( const Point& rOrigin, const String& rStr, int nIndex, int nLen, int nBase, MetricVector& rVector ) = 0;
+
+ // Window
+ virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const = 0;
+ virtual void GrabFocus() = 0;
+ virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible( sal_Bool bCreate = sal_True ) = 0;
+ virtual Window* GetAccessibleParentWindow() const = 0;
+ virtual Window* GetWindowInstance() = 0;
+
+ virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex) = 0;
+ virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint) = 0;
+
+protected:
+ ~IAccessibleTableProvider() {}
+};
+
+
+/** interface for an implementation of a table control's Accesible component
+*/
+class IAccessibleTabListBox
+{
+public:
+ /** returns the XAccessible object itself
+
+ The reference returned here can be used to control the life time of the
+ IAccessibleTableImplementation object.
+
+ The returned reference is guaranteed to not be <NULL/>.
+ */
+ virtual css::uno::Reference< css::accessibility::XAccessible >
+ getMyself() = 0;
+
+ virtual css::uno::Reference< css::accessibility::XAccessible >
+ SAL_CALL getAccessibleChild( sal_Int32 nChildIndex )
+ throw ( css::lang::IndexOutOfBoundsException, css::uno::RuntimeException ) = 0;
+
+ /** returns the accessible object for the row or the column header bar
+ */
+ virtual css::uno::Reference< css::accessibility::XAccessible >
+ getHeaderBar( ::svt::AccessibleBrowseBoxObjType _eObjType ) = 0;
+
+protected:
+ ~IAccessibleTabListBox() {}
+};
+
+/** interface for an implementation of a browse box's Accesible component
+*/
+class IAccessibleBrowseBox
+{
+public:
+ /** returns the XAccessible object itself
+
+ The reference returned here can be used to control the life time of the
+ IAccessibleTableImplementation object.
+
+ The returned reference is guaranteed to not be <NULL/>.
+ */
+ virtual css::uno::Reference< css::accessibility::XAccessible >
+ getMyself() = 0;
+
+ /** disposes the accessible implementation, so that it becomes defunc
+ */
+ virtual void dispose() = 0;
+
+ /** checks whether the accessible implementation, and its context, are still alive
+ @return <TRUE/>, if the object is not disposed or disposing.
+ */
+ virtual sal_Bool isAlive() const = 0;
+
+ /** returns the accessible object for the row or the column header bar
+ */
+ virtual css::uno::Reference< css::accessibility::XAccessible >
+ getHeaderBar( ::svt::AccessibleBrowseBoxObjType _eObjType ) = 0;
+
+ /** returns the accessible object for the table representation
+ */
+ virtual css::uno::Reference< css::accessibility::XAccessible >
+ getTable() = 0;
+
+ /** commits the event at all listeners of the column/row header bar
+ @param nEventId
+ the event id
+ @param rNewValue
+ the new value
+ @param rOldValue
+ the old value
+ */
+ virtual void commitHeaderBarEvent(
+ sal_Int16 nEventId,
+ const css::uno::Any& rNewValue,
+ const css::uno::Any& rOldValue,
+ sal_Bool _bColumnHeaderBar
+ ) = 0;
+
+ /** commits the event at all listeners of the table
+ @param nEventId
+ the event id
+ @param rNewValue
+ the new value
+ @param rOldValue
+ the old value
+ */
+ virtual void commitTableEvent(
+ sal_Int16 nEventId,
+ const css::uno::Any& rNewValue,
+ const css::uno::Any& rOldValue
+ ) = 0;
+
+ /** Commits an event to all listeners. */
+ virtual void commitEvent(
+ sal_Int16 nEventId,
+ const css::uno::Any& rNewValue,
+ const css::uno::Any& rOldValue
+ ) = 0;
+
+protected:
+ ~IAccessibleBrowseBox() {}
+};
+
+
+} // namespace svt
+
+
+#endif // _SVTOOLS_ACCESSIBLETABLEPROVIDER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/addresstemplate.hxx b/include/svtools/addresstemplate.hxx
new file mode 100644
index 000000000000..d7406235b9a6
--- /dev/null
+++ b/include/svtools/addresstemplate.hxx
@@ -0,0 +1,144 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVT_ADDRESSTEMPLATE_HXX_
+#define _SVT_ADDRESSTEMPLATE_HXX_
+
+#include "svtools/svtdllapi.h"
+#include <vcl/dialog.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/combobox.hxx>
+#include <vcl/button.hxx>
+#include <vcl/layout.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/scrbar.hxx>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/util/AliasProgrammaticPair.hpp>
+#include <com/sun/star/sdb/XDatabaseContext.hpp>
+#include <com/sun/star/sdbc/XDataSource.hpp>
+#include <unotools/configitem.hxx>
+
+// .......................................................................
+namespace svt
+{
+// .......................................................................
+
+ // ===================================================================
+ // = AddressBookSourceDialog
+ // ===================================================================
+ struct AddressBookSourceDialogData;
+ class SVT_DLLPUBLIC AddressBookSourceDialog : public ModalDialog
+ {
+ protected:
+ // Controls
+ ComboBox* m_pDatasource;
+ PushButton* m_pAdministrateDatasources;
+ ComboBox* m_pTable;
+ ScrollBar* m_pFieldScroller;
+
+ // string to display for "no selection"
+ const String m_sNoFieldSelection;
+
+ /// the DatabaseContext for selecting data sources
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseContext >
+ m_xDatabaseContext;
+ // the ORB for creating objects
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ m_xORB;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
+ m_xCurrentDatasourceTables;
+
+ AddressBookSourceDialogData*
+ m_pImpl;
+
+ public:
+ AddressBookSourceDialog( Window* _pParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB );
+
+ /** if you use this ctor, the dialog
+ <ul><li>will not store it's data in the configuration (nor initially retrieve it from there)</li>
+ <li>will not allow to change the data source name</li>
+ <li>will not allow to change the table name</li>
+ <li>will not allow to call the data source administration dialog</li>
+ </ul>
+
+ @param _rxORB
+ a service factory to use for various UNO related needs
+ @param _rxTransientDS
+ the data source to obtain connections from
+ @param _rDataSourceName
+ the to-be name of _rxTransientDS. This is only for displaying this
+ name to the user, since the dialog completely works on _rxTransientDS,
+ and doesn't allow to change this.
+ @param _rTable
+ the table name to display. It must refer to a valid table, relative to a connection
+ obtained from <arg>_rxTransientDS</arg>
+ */
+ AddressBookSourceDialog( Window* _pParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource >& _rxTransientDS,
+ const OUString& _rDataSourceName,
+ const OUString& _rTable,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::util::AliasProgrammaticPair >& _rMapping
+ );
+
+ ~AddressBookSourceDialog();
+
+ // to be used if the object was constructed for editing a field mapping only
+ void getFieldMapping(
+ ::com::sun::star::uno::Sequence< ::com::sun::star::util::AliasProgrammaticPair >& _rMapping) const;
+
+ protected:
+ void implConstruct();
+
+ // Window overridables
+ virtual long PreNotify( NotifyEvent& _rNEvt );
+
+ // implementations
+ void implScrollFields(sal_Int32 _nPos, sal_Bool _bAdjustFocus, sal_Bool _bAdjustScrollbar);
+ void implSelectField(ListBox* _pBox, const String& _rText);
+
+ void initalizeListBox(ListBox* _pList);
+ void resetTables();
+ void resetFields();
+
+ // fill in the data sources listbox
+ void initializeDatasources();
+
+ // initialize the dialog from the configuration data
+ void loadConfiguration();
+
+ DECL_LINK(OnFieldScroll, ScrollBar*);
+ DECL_LINK(OnFieldSelect, ListBox*);
+ DECL_LINK(OnAdministrateDatasources, void*);
+ DECL_LINK(OnComboGetFocus, ComboBox*);
+ DECL_LINK(OnComboLoseFocus, ComboBox*);
+ DECL_LINK(OnComboSelect, ComboBox*);
+ DECL_LINK(OnOkClicked, void*);
+ DECL_LINK(OnDelayedInitialize, void*);
+ };
+
+
+// .......................................................................
+} // namespace svt
+// .......................................................................
+
+#endif // _SVT_ADDRESSTEMPLATE_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/apearcfg.hxx b/include/svtools/apearcfg.hxx
new file mode 100644
index 000000000000..fdfb4ef0f671
--- /dev/null
+++ b/include/svtools/apearcfg.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVT_APEARCFG_HXX
+#define _SVT_APEARCFG_HXX
+
+#include "svtools/svtdllapi.h"
+#include "tools/solar.h"
+#include <unotools/configitem.hxx>
+
+class Application;
+
+typedef enum {
+ SnapToButton = 0,
+ SnapToMiddle,
+ NoSnap
+} SnapType;
+
+typedef enum { // MUST match the order chosen in ListBox LB_DRAG_MODE in optgdlg.src
+ DragFullWindow,
+ DragFrame,
+ DragSystemDep
+} DragMode;
+
+
+class SVT_DLLPUBLIC SvtTabAppearanceCfg : public utl::ConfigItem
+{
+ short nDragMode ;
+ short nScaleFactor ;
+ short nSnapMode ;
+ short nMiddleMouse;
+#if defined( UNX )
+ short nAAMinPixelHeight ;
+#endif
+
+ sal_Bool bMenuMouseFollow ;
+#if defined( UNX )
+ sal_Bool bFontAntialiasing ;
+#endif
+
+ static sal_Bool bInitialized ;
+
+ SVT_DLLPRIVATE const com::sun::star::uno::Sequence<OUString>& GetPropertyNames();
+
+public:
+ SvtTabAppearanceCfg( );
+ ~SvtTabAppearanceCfg( );
+
+ virtual void Commit();
+ virtual void Notify( const com::sun::star::uno::Sequence< OUString >& _rPropertyNames);
+
+ sal_uInt16 GetDragMode () const { return nDragMode; }
+
+ sal_uInt16 GetScaleFactor () const { return nScaleFactor; }
+ void SetScaleFactor ( sal_uInt16 nSet );
+
+ sal_uInt16 GetSnapMode () const { return nSnapMode; }
+ void SetSnapMode ( sal_uInt16 nSet );
+
+ sal_uInt16 GetMiddleMouseButton () const { return nMiddleMouse; }
+ void SetMiddleMouseButton ( sal_uInt16 nSet );
+
+ void SetApplicationDefaults ( Application* pApp );
+
+ void SetMenuMouseFollow(sal_Bool bSet) {bMenuMouseFollow = bSet; SetModified();}
+ sal_Bool IsMenuMouseFollow() const{return bMenuMouseFollow;}
+
+#if defined( UNX )
+ void SetFontAntiAliasing( sal_Bool bSet ) { bFontAntialiasing = bSet; SetModified(); }
+ sal_Bool IsFontAntiAliasing() const { return bFontAntialiasing; }
+
+ sal_uInt16 GetFontAntialiasingMinPixelHeight( ) const { return nAAMinPixelHeight; }
+ void SetFontAntialiasingMinPixelHeight( sal_uInt16 _nMinHeight ) { nAAMinPixelHeight = _nMinHeight; SetModified(); }
+#endif
+
+ static sal_Bool IsInitialized() { return bInitialized; }
+ static void SetInitialized() { bInitialized = sal_True; }
+};
+
+#endif // _OFA_APEARCFG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/asynclink.hxx b/include/svtools/asynclink.hxx
new file mode 100644
index 000000000000..9551c1478f6b
--- /dev/null
+++ b/include/svtools/asynclink.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVTOOLS_ASYNCLINK_HXX
+#define SVTOOLS_ASYNCLINK_HXX
+
+#include "svtools/svtdllapi.h"
+#include <tools/solar.h>
+#include <tools/link.hxx>
+#include <osl/mutex.hxx>
+
+class Timer;
+
+namespace svtools {
+
+class SVT_DLLPUBLIC AsynchronLink
+{
+ Link _aLink;
+ sal_uLong _nEventId;
+ Timer* _pTimer;
+ sal_Bool _bInCall;
+ sal_Bool* _pDeleted;
+ void* _pArg;
+ ::osl::Mutex* _pMutex;
+
+ DECL_DLLPRIVATE_STATIC_LINK( AsynchronLink, HandleCall, void* );
+ SVT_DLLPRIVATE void Call_Impl( void* pArg );
+
+public:
+ AsynchronLink( const Link& rLink ) :
+ _aLink( rLink ), _nEventId( 0 ), _pTimer( 0 ), _bInCall( sal_False ),
+ _pDeleted( 0 ), _pMutex( 0 ){}
+ AsynchronLink() : _nEventId( 0 ), _pTimer( 0 ), _bInCall( sal_False ),
+ _pDeleted( 0 ), _pMutex( 0 ){}
+ ~AsynchronLink();
+
+ void CreateMutex();
+ void operator=( const Link& rLink ) { _aLink = rLink; }
+ void Call( void* pObj, sal_Bool bAllowDoubles = sal_False,
+ sal_Bool bUseTimer = sal_False );
+ void ClearPendingCall( );
+ sal_Bool IsSet() const { return _aLink.IsSet(); }
+ Link GetLink() const { return _aLink; }
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/bindablecontrolhelper.hxx b/include/svtools/bindablecontrolhelper.hxx
new file mode 100644
index 000000000000..0fdea457d5f5
--- /dev/null
+++ b/include/svtools/bindablecontrolhelper.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVTOOLS_INC_BINDABLECONTROL_HXX
+#define SVTOOLS_INC_BINDABLECONTROL_HXX
+
+#include "svtools/svtdllapi.h"
+
+#include <com/sun/star/frame/XModel.hpp>
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ //====================================================================
+ //= GraphicAccess
+ //====================================================================
+ /** helper class for obtaining streams (which also can be used with the ImageProducer)
+ from a resource
+ */
+ class BindableControlHelper
+ {
+ private:
+ BindableControlHelper(); // never implemented
+
+ public:
+ SVT_DLLPUBLIC static void ApplyListSourceAndBindableData( const com::sun::star::uno::Reference< com::sun::star::frame::XModel >& xModel, const com::sun::star::uno::Reference< com::sun::star::uno::XInterface >& rObj, const OUString& rsCtrlSource, const OUString& rsRowSource, sal_uInt16 nRefTab = 0 );
+ };
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // SVTOOLS_INC_BINDABLECONTROL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/borderhelper.hxx b/include/svtools/borderhelper.hxx
new file mode 100644
index 000000000000..77884bf2620a
--- /dev/null
+++ b/include/svtools/borderhelper.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BORDERHELPER_HXX
+#define _BORDERHELPER_HXX
+
+#include "svtools/svtdllapi.h"
+
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <vcl/outdev.hxx>
+
+namespace svtools
+{
+ SVT_DLLPUBLIC basegfx::B2DPolyPolygon ApplyLineDashing( const basegfx::B2DPolygon& rPolygon,
+ sal_uInt16 nDashing, MapUnit eUnit );
+
+ SVT_DLLPUBLIC basegfx::B2DPolyPolygon ApplyLineDashing( const basegfx::B2DPolygon& rPolygon,
+ sal_uInt16 nDashing, MapUnit eUnit, double fScale );
+
+ SVT_DLLPUBLIC void DrawLine( OutputDevice& rDev, const basegfx::B2DPoint& rBeg,
+ const basegfx::B2DPoint& rEnd, sal_uInt32 nWidth, sal_uInt16 nDashing );
+
+ SVT_DLLPUBLIC void DrawLine( OutputDevice& rDev, const Point& rBeg,
+ const Point& rEnd, sal_uInt32 nWidth, sal_uInt16 nDashing );
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/brwbox.hxx b/include/svtools/brwbox.hxx
new file mode 100644
index 000000000000..128c57c699c2
--- /dev/null
+++ b/include/svtools/brwbox.hxx
@@ -0,0 +1,831 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_BRWBOX_HXX
+#define _SVX_BRWBOX_HXX
+
+#include "svtools/svtdllapi.h"
+#include <vcl/scrbar.hxx>
+#include <vcl/ctrl.hxx>
+#include <tools/multisel.hxx>
+#include <svtools/headbar.hxx>
+#include <svtools/transfer.hxx>
+#include <svtools/AccessibleBrowseBoxObjType.hxx>
+#include <svtools/accessibletableprovider.hxx>
+#include <vector>
+
+#include <limits.h>
+#include <memory>
+
+class BrowserColumn;
+class BrowserDataWin;
+class MultiSelection;
+class BrowserHeader;
+
+typedef ::std::vector< BrowserColumn* > BrowserColumns;
+
+namespace svt {
+ class BrowseBoxImpl;
+ class IAccessibleFactory;
+}
+namespace utl {
+ class AccessibleStateSetHelper;
+}
+
+// -------------------
+// - BrowseBox-Types -
+// -------------------
+
+#define BROWSER_INVALIDID SAL_MAX_UINT16
+#define BROWSER_ENDOFSELECTION (static_cast<long>(SFX_ENDOFSELECTION))
+
+typedef sal_uLong BrowserMode;
+
+#define BROWSER_COLUMNSELECTION 0x0001
+#define BROWSER_MULTISELECTION 0x0002
+#define BROWSER_THUMBDRAGGING 0x0004
+#define BROWSER_KEEPHIGHLIGHT 0x0008
+#define BROWSER_KEEPSELECTION BROWSER_KEEPHIGHLIGHT // old, don't use!
+#define BROWSER_HLINES 0x0010
+#define BROWSER_VLINES 0x0020
+#define BROWSER_HLINESFULL BROWSER_HLINES // old, don't use!
+#define BROWSER_VLINESFULL BROWSER_VLINES // old, don't use!
+#define BROWSER_HLINESDOTS 0x0000 // old => don't use!
+#define BROWSER_VLINESDOTS 0x0000 // old => don't use!
+
+#define BROWSER_HIDESELECT 0x0100 // old => don't use!
+#define BROWSER_HIDECURSOR 0x0200
+
+#define BROWSER_NO_HSCROLL 0x0400
+#define BROWSER_NO_SCROLLBACK 0x0800
+
+#define BROWSER_AUTO_VSCROLL 0x1000
+#define BROWSER_AUTO_HSCROLL 0x2000
+
+#define BROWSER_TRACKING_TIPS 0x4000
+
+#define BROWSER_NO_VSCROLL 0x8000
+
+#define BROWSER_HIGHLIGHT_NONE 0x0100 // == BROWSER_HIDESELECT
+
+#define BROWSER_HEADERBAR_NEW 0x00040000
+#define BROWSER_AUTOSIZE_LASTCOL 0x00080000
+#define BROWSER_OWN_DATACHANGED 0x00100000
+
+#define BROWSER_CURSOR_WO_FOCUS 0x00200000
+ // Allows a cursor which is shown even if the control does not have the focus. This does not affect other
+ // situations which require to temporarily hide the cursor (such as scrolling).
+
+#define BROWSER_SMART_HIDECURSOR 0x00400000
+ // is an enhanced version of BROWSER_HIDECURSOR.
+ // When set, BROWSER_HIDECURSOR is overruled, and the cursor is hidden as long as no selection exists,
+ // but shown otherwise. This does not affect other situations which require to temporarily hide the
+ // cursor (such as scrolling).
+
+#define BROWSER_NONE 0
+#define BROWSER_SELECT 720
+#define BROWSER_ENHANCESELECTION 722
+#define BROWSER_SELECTDOWN 724
+#define BROWSER_SELECTUP 725
+#define BROWSER_CURSORDOWN 731
+#define BROWSER_CURSORUP 732
+#define BROWSER_CURSORLEFT 733
+#define BROWSER_CURSORRIGHT 734
+#define BROWSER_CURSORPAGEDOWN 735
+#define BROWSER_CURSORPAGEUP 736
+#define BROWSER_CURSORENDOFFILE 741
+#define BROWSER_CURSORTOPOFFILE 742
+#define BROWSER_CURSORENDOFSCREEN 743
+#define BROWSER_CURSORTOPOFSCREEN 744
+#define BROWSER_CURSORHOME 745
+#define BROWSER_CURSOREND 746
+#define BROWSER_SCROLLDOWN 751
+#define BROWSER_SCROLLUP 752
+#define BROWSER_SELECTHOME 753
+#define BROWSER_SELECTEND 754
+#define BROWSER_SELECTCOLUMN 755
+#define BROWSER_MOVECOLUMNLEFT 756
+#define BROWSER_MOVECOLUMNRIGHT 757
+
+// ---------------
+// - BrowseEvent -
+// ---------------
+
+class BrowseEvent
+{
+ Window* pWin;
+ long nRow;
+ Rectangle aRect;
+ sal_uInt16 nCol;
+ sal_uInt16 nColId;
+
+public:
+ BrowseEvent();
+ BrowseEvent( Window* pWindow,
+ long nAbsRow,
+ sal_uInt16 nColumn, sal_uInt16 nColumnId,
+ const Rectangle& rRect );
+
+ Window* GetWindow() const { return pWin; }
+ long GetRow() const { return nRow; }
+ sal_uInt16 GetColumn() const { return nCol; }
+ sal_uInt16 GetColumnId() const { return nColId; }
+ const Rectangle& GetRect() const { return aRect; }
+};
+
+// ---------------------
+// - BrowserMouseEvent -
+// ---------------------
+
+class BrowserMouseEvent: public MouseEvent, public BrowseEvent
+{
+public:
+ BrowserMouseEvent();
+ BrowserMouseEvent( BrowserDataWin* pWin, const MouseEvent& rEvt );
+ BrowserMouseEvent( Window* pWin, const MouseEvent& rEvt,
+ long nAbsRow, sal_uInt16 nColumn, sal_uInt16 nColumnId,
+ const Rectangle& rRect );
+};
+
+// --------------------------
+// - BrowserAcceptDropEvent -
+// --------------------------
+
+class BrowserAcceptDropEvent : public AcceptDropEvent, public BrowseEvent
+{
+public:
+ BrowserAcceptDropEvent();
+ BrowserAcceptDropEvent( BrowserDataWin* pWin, const AcceptDropEvent& rEvt );
+};
+
+// ---------------------------
+// - BrowserExecuteDropEvent -
+// ---------------------------
+
+class BrowserExecuteDropEvent : public ExecuteDropEvent, public BrowseEvent
+{
+public:
+ BrowserExecuteDropEvent();
+ BrowserExecuteDropEvent( BrowserDataWin* pWin, const ExecuteDropEvent& rEvt );
+};
+
+// -------------
+// - BrowseBox -
+// -------------
+
+// TODO
+// The whole selection thingie in this class is somewhat .... suspicious to me.
+// some oddities:
+// * method parameters named like members (and used in both semantics within the method!)
+// * the multi selection flag is sometimes used as if it is for row selection, sometimes as if
+// it's for column selection, too (and sometimes in an even stranger way :)
+// * it is not really defined like all these hundreds selection related flags/methods work together
+// and influence each other. I do not understand it very well, but this may be my fault :)
+// * There is a GetColumnSelection, but it can't be used to determine the selected columns (at least
+// not without a const_cast)
+//
+// We should clearly define this somewhere in the future. Or, even better, we should re-implement this
+// whole class, which is planned for a long time :)
+//
+// sorry for the ranting. could not resist
+
+class SVT_DLLPUBLIC BrowseBox
+ :public Control
+ ,public DragSourceHelper
+ ,public DropTargetHelper
+ ,public svt::IAccessibleTableProvider
+{
+ #define NO_CURSOR_HIDE 0
+ #define HARD_CURSOR_HIDE 1
+ #define SMART_CURSOR_HIDE 2
+
+ friend class BrowserDataWin;
+ friend class ::svt::BrowseBoxImpl;
+
+#ifdef DBG_UTIL
+ friend const char* BrowseBoxCheckInvariants( const void * pVoid );
+#endif
+
+public:
+ static const sal_uInt16 HandleColumnId = 0;
+
+private:
+ Window* pDataWin; // window to display data rows
+ ScrollBar* pVScroll; // vertical scrollbar
+ ScrollBar aHScroll; // horizontal scrollbar
+
+ long nDataRowHeight; // height of a single data-row
+ sal_uInt16 nTitleLines; // number of lines in title row
+ sal_uLong nControlAreaWidth; // width of fixed area beneeth hscroll
+ sal_Bool bThumbDragging; // handle thumb dragging
+ sal_Bool bColumnCursor; // single columns and fields selectable
+ sal_Bool bMultiSelection;// allow multiple selected rows
+ sal_Bool bKeepHighlight; // don't hide selection on LoseFocus
+
+ sal_Bool bHLines; // draw lines between rows
+ sal_Bool bVLines; // draw lines between columns
+ sal_Bool bHDots; // draw lines between rows dotted
+ sal_Bool bVDots; // draw lines between columns dotted
+ Color aGridLineColor; // color for lines, default dark grey
+ sal_Bool bBootstrapped; // child windows resized etc.
+ long nTopRow; // no. of first visible row (0...)
+ long nCurRow; // no. of row with cursor
+ long nRowCount; // total number of rows in model
+ sal_uInt16 nFirstCol; // no. of first visible scrollable column
+ sal_uInt16 nCurColId; // column id of cursor
+
+ sal_Bool bSelecting;
+ sal_Bool bRowDividerDrag;
+ sal_Bool bHit;
+ sal_Bool mbInteractiveRowHeight;
+ Point a1stPoint;
+ Point a2ndPoint;
+
+ long nResizeX; // mouse position at start of resizing
+ long nMinResizeX; // never drag more left
+ long nDragX; // last dragged column (MouseMove)
+ sal_uInt16 nResizeCol; // resize this column in MouseMove
+ sal_Bool bResizing; // mouse captured for column resizing
+
+ sal_Bool bSelect; // select or deselect
+ sal_Bool bSelectionIsVisible; // depending on focus
+ sal_Bool bScrolling; // hidden cursor while scrolling
+ sal_Bool bNotToggleSel; // set while in ToggleSelection() etc.
+ sal_Bool bHasFocus; // set/unset in Get/LoseFocus
+ sal_Bool bHideSelect; // hide selection (highlight)
+ sal_Bool bHideCursor; // hide cursor (frame)
+ Range aSelRange; // for selection expansion
+
+ BrowserColumns* pCols; // array of column-descriptions
+ union
+ {
+ MultiSelection* pSel; // selected rows for multi-selection
+ long nSel; // selected row for single-selection
+ } uRow;
+ MultiSelection* pColSel; // selected column-ids
+
+ ::std::auto_ptr< ::svt::BrowseBoxImpl > m_pImpl; // impl structure of the BrowseBox object
+
+ sal_Bool m_bFocusOnlyCursor; // hide cursor if we don't have the focus
+ Color m_aCursorColor; // special color for cursor, COL_TRANSPARENT for usual (VCL-painted) "inverted" cursor
+ BrowserMode m_nCurrentMode; // last argument of SetMode (redundant, as our other members represent the current settings, too)
+
+private:
+ SVT_DLLPRIVATE void ConstructImpl(BrowserMode nMode);
+ SVT_DLLPRIVATE void ExpandRowSelection( const BrowserMouseEvent& rEvt );
+ SVT_DLLPRIVATE void ToggleSelection( sal_Bool bForce = sal_False );
+
+ SVT_DLLPRIVATE void UpdateScrollbars();
+ SVT_DLLPRIVATE void AutoSizeLastColumn();
+
+ SVT_DLLPRIVATE long ImpGetDataRowHeight() const;
+ SVT_DLLPRIVATE Rectangle ImplFieldRectPixel( long nRow, sal_uInt16 nColId ) const;
+ SVT_DLLPRIVATE sal_uInt16 FrozenColCount() const;
+
+ SVT_DLLPRIVATE void ColumnInserted( sal_uInt16 nPos );
+
+ DECL_DLLPRIVATE_LINK( ScrollHdl, ScrollBar * );
+ DECL_DLLPRIVATE_LINK( EndScrollHdl, void * );
+ DECL_DLLPRIVATE_LINK( StartDragHdl, HeaderBar * );
+
+ SVT_DLLPRIVATE long GetFrozenWidth() const;
+
+ sal_Bool GoToRow(long nRow, sal_Bool bRowColMove, sal_Bool bDoNotModifySelection = sal_False );
+
+ sal_Bool GoToColumnId( sal_uInt16 nColId, sal_Bool bMakeVisible, sal_Bool bRowColMove = sal_False);
+ void SelectColumnPos( sal_uInt16 nCol, sal_Bool _bSelect, sal_Bool bMakeVisible);
+ void SelectColumnId( sal_uInt16 nColId, sal_Bool _bSelect, sal_Bool bMakeVisible)
+ { SelectColumnPos( GetColumnPos(nColId), _bSelect, bMakeVisible); }
+
+ void ImplPaintData(OutputDevice& _rOut, const Rectangle& _rRect, sal_Bool _bForeignDevice, sal_Bool _bDrawSelections);
+
+ sal_Bool PaintCursorIfHiddenOnce() const { return !m_bFocusOnlyCursor && !HasFocus(); }
+
+ sal_uInt16 ToggleSelectedColumn();
+ void SetToggledSelectedColumn(sal_uInt16 _nSelectedColumnId);
+
+protected:
+ /// retrieves the XAccessible implementation associated with the BrowseBox instance
+ ::svt::IAccessibleFactory& getAccessibleFactory();
+
+protected:
+ sal_uInt16 ColCount() const;
+
+ // software plug for database access
+ // Der RowCount wird jetzt intern automatisch gezaehlt
+ // (ueber RowInserted und RowRemoved), daher ist das Ueberladen
+ // dieser Methode ueberfluessig!
+public:
+ virtual long GetRowCount() const;
+
+protected:
+ // fuer Anzeige im VScrollBar z.B. auf "?" oder setzen
+ void SetRealRowCount( const String &rRealRowCount );
+
+ // Return Value muss immer sal_True sein - SeekRow *muss* klappen!
+ // (sonst ASSERT) MI: wer hat das eingebaut? Das darf nicht so sein!
+
+ /** seeks for the given row position
+ @param nRow
+ nRow starts at 0
+ */
+ virtual sal_Bool SeekRow( long nRow ) = 0;
+ virtual void DrawCursor();
+ virtual void PaintRow( OutputDevice &rDev, const Rectangle &rRect );
+ virtual void PaintData( Window& rWin, const Rectangle& rRect );
+ virtual void PaintField( OutputDevice& rDev, const Rectangle& rRect,
+ sal_uInt16 nColumnId ) const = 0;
+ // Benachrichtigung an die abgeleitete Klasse, dass sich der sichtbare
+ // Bereich von Rows geaendert hat. Aus dieser Methode heraus darf
+ // die abgeleitete Klasse Aenderungen des Model mit Hilfe der Methoden
+ // RowInserted und RowRemoved bekanntgeben. Mit sich daraus ergebenden
+ // neuen Zustand wird anschliessend ein Paint veranlasst (und entsprechend
+ // SeekRow etc. gerufen).
+ //
+ // Parameter: nNewTopRow: Nr. der neuen TopRow (kann von VisibleRowsChanged
+ // durch Aufruf von RowInserted und RowDeleted noch veraendert werden).
+ // nNumRows: Anzahl der sichtbaren Rows (auch eine teilweise sichtbare Row
+ // wird mitgezaehlt).
+ //
+ // Moegliche Ursachen fuer die Aenderung des sichtbaren Bereiches:
+ // - Vor dem sichtbaren Bereich sind Rows eingefuegt oder geloescht worden,
+ // dadurch aendert sich nur die Numerierung der sichtbaren Rows
+ // - Scrollen (und daraus resultierend eine andere erste sichtbare Row)
+ // - Resize des Fensters
+ virtual void VisibleRowsChanged( long nNewTopRow, sal_uInt16 nNumRows);
+
+ // Anzahl sichtbarer Rows in dem Fenster (inkl. "angeschnittener" Rows)
+ sal_uInt16 GetVisibleRows()
+ { return (sal_uInt16)((pDataWin->GetOutputSizePixel().Height() - 1 )/ GetDataRowHeight() + 1); }
+ long GetTopRow() { return nTopRow; }
+ sal_uInt16 GetFirstVisibleColNumber() const { return nFirstCol; }
+
+ // Focus-Rect ein-/ausschalten
+ void DoShowCursor( const char *pWhoLog );
+ void DoHideCursor( const char *pWhoLog );
+ short GetCursorHideCount() const;
+
+ virtual BrowserHeader* CreateHeaderBar( BrowseBox* pParent );
+
+ // HACK(virtuelles Create wird im Ctor nicht gerufen)
+ void SetHeaderBar( BrowserHeader* );
+
+ long CalcReverseZoom(long nVal);
+
+ inline const DataFlavorExVector&
+ GetDataFlavors() const;
+
+ sal_Bool IsDropFormatSupported( SotFormatStringId nFormat ); // need this because the base class' IsDropFormatSupported is not const ...
+ sal_Bool IsDropFormatSupported( SotFormatStringId nFormat ) const;
+
+ sal_Bool IsDropFormatSupported( const css::datatransfer::DataFlavor& _rFlavor ); // need this because the base class' IsDropFormatSupported is not const ...
+ sal_Bool IsDropFormatSupported( const css::datatransfer::DataFlavor& _rFlavor ) const;
+
+private:
+ void* implGetDataFlavors() const;
+ // with this we can make GetDataFlavors() inline, which is strongly needed as SVTOOLS does not export
+ // any sysbols containing an "_STL", so a non-inlined method would not be exported ....
+
+protected:
+ // callbacks for the data window
+ virtual void ImplStartTracking();
+ virtual void ImplTracking();
+ virtual void ImplEndTracking();
+
+public:
+ BrowseBox( Window* pParent, WinBits nBits = 0,
+ BrowserMode nMode = 0 );
+ BrowseBox( Window* pParent, const ResId& rId,
+ BrowserMode nMode = 0 );
+ ~BrowseBox();
+
+ // ererbte ueberladene Handler
+ virtual void StateChanged( StateChangedType nStateChange );
+ virtual void MouseButtonDown( const MouseEvent& rEvt );
+ virtual void MouseMove( const MouseEvent& rEvt );
+ virtual void MouseButtonUp( const MouseEvent& rEvt );
+ virtual void KeyInput( const KeyEvent& rEvt );
+ virtual void LoseFocus();
+ virtual void GetFocus();
+ virtual void Resize();
+ virtual void Paint( const Rectangle& rRect );
+ virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags );
+ virtual void Command( const CommandEvent& rEvt );
+ virtual void StartDrag( sal_Int8 _nAction, const Point& _rPosPixel );
+
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ); // will forward everything got to the second AcceptDrop method
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ); // will forward everything got to the second ExecuteDrop method
+
+ virtual sal_Int8 AcceptDrop( const BrowserAcceptDropEvent& rEvt );
+ virtual sal_Int8 ExecuteDrop( const BrowserExecuteDropEvent& rEvt );
+
+ // neue Handler
+ virtual void MouseButtonDown( const BrowserMouseEvent& rEvt );
+ virtual void MouseMove( const BrowserMouseEvent& rEvt );
+ virtual void MouseButtonUp( const BrowserMouseEvent& rEvt );
+ virtual void StartScroll();
+ virtual void EndScroll();
+ virtual void Select();
+ virtual void DoubleClick( const BrowserMouseEvent& rEvt );
+ virtual sal_Bool IsCursorMoveAllowed( long nNewRow, sal_uInt16 nNewColId ) const;
+ virtual void CursorMoved();
+ virtual void ColumnMoved( sal_uInt16 nColId );
+ virtual void ColumnResized( sal_uInt16 nColId );
+ virtual long QueryColumnResize( sal_uInt16 nColId, long nWidth );
+ /// called when the row height has been changed interactively
+ virtual void RowHeightChanged();
+ virtual long QueryMinimumRowHeight();
+
+ // Window-Control (pass to DataWindow)
+ void SetUpdateMode( sal_Bool bUpdate );
+ sal_Bool GetUpdateMode() const;
+
+ // map-mode and font control
+ void SetFont( const Font& rNewFont );
+ const Font& GetFont() const { return pDataWin->GetFont(); }
+ void SetTitleFont( const Font& rNewFont )
+ { Control::SetFont( rNewFont ); }
+ const Font& GetTitleFont() const { return Control::GetFont(); }
+
+ // color for line painting
+ void SetGridLineColor(const Color& rColor) {aGridLineColor = rColor;}
+ const Color& GetGridLineColor() const {return aGridLineColor;}
+
+ // inserting, changing, removing and freezing of columns
+ void InsertHandleColumn( sal_uLong nWidth );
+ void InsertDataColumn( sal_uInt16 nItemId, const XubString& rText,
+ long nSize, HeaderBarItemBits nBits = HIB_STDSTYLE,
+ sal_uInt16 nPos = HEADERBAR_APPEND );
+ void SetColumnTitle( sal_uInt16 nColumnId, const String &rTitle );
+ void SetColumnWidth( sal_uInt16 nColumnId, sal_uLong nWidth );
+ void SetColumnPos( sal_uInt16 nColumnId, sal_uInt16 nPos );
+ void FreezeColumn( sal_uInt16 nColumnId, sal_Bool bFreeze = sal_True );
+ void UnfreezeColumns();
+ void RemoveColumn( sal_uInt16 nColumnId );
+ void RemoveColumns();
+
+ // control of title and data row height
+ void SetDataRowHeight( long nPixel );
+ long GetDataRowHeight() const;
+ void SetTitleLines( sal_uInt16 nLines );
+ sal_uInt16 GetTitleLines() const { return nTitleLines; }
+ virtual long GetTitleHeight() const;
+
+ // access to dynamic values of cursor row
+ String GetColumnTitle( sal_uInt16 nColumnId ) const;
+ Rectangle GetFieldRect( sal_uInt16 nColumnId ) const;
+ sal_uLong GetColumnWidth( sal_uInt16 nColumnId ) const;
+ sal_uInt16 GetColumnId( sal_uInt16 nPos ) const;
+ sal_uInt16 GetColumnPos( sal_uInt16 nColumnId ) const;
+ sal_Bool IsFrozen( sal_uInt16 nColumnId ) const;
+
+ // movement of visible area
+ void ResetScroll();
+ long ScrollColumns( long nColumns );
+ long ScrollRows( long nRows );
+ sal_Bool MakeFieldVisible( long nRow, sal_uInt16 nColId, sal_Bool bComplete = sal_False );
+
+ // access and movement of cursor
+ long GetCurRow() const { return nCurRow; }
+ sal_uInt16 GetCurColumnId() const { return nCurColId; }
+ sal_Bool GoToRow( long nRow );
+ sal_Bool GoToColumnId( sal_uInt16 nColId );
+ sal_Bool GoToRowColumnId( long nRow, sal_uInt16 nColId );
+
+ // selections
+ virtual void SetNoSelection();
+ virtual void SelectAll();
+ virtual void SelectRow( long nRow, sal_Bool _bSelect = sal_True, sal_Bool bExpand = sal_True );
+ void SelectColumnPos( sal_uInt16 nCol, sal_Bool _bSelect = sal_True )
+ { SelectColumnPos( nCol, _bSelect, sal_True); }
+ void SelectColumnId( sal_uInt16 nColId, sal_Bool _bSelect = sal_True )
+ { SelectColumnPos( GetColumnPos(nColId), _bSelect, sal_True); }
+ long GetSelectRowCount() const;
+ sal_uInt16 GetSelectColumnCount() const;
+ virtual bool IsRowSelected( long nRow ) const;
+ bool IsColumnSelected( sal_uInt16 nColumnId ) const;
+ long FirstSelectedRow( sal_Bool bInverse = sal_False );
+ long LastSelectedRow();
+ long NextSelectedRow();
+ const MultiSelection* GetColumnSelection() const { return pColSel; }
+ const MultiSelection* GetSelection() const
+ { return bMultiSelection ? uRow.pSel : 0; }
+
+ long FirstSelectedColumn( ) const;
+
+ sal_Bool IsResizing() const { return bResizing; }
+
+ // access to positions of fields, column and rows
+ Window& GetDataWindow() const { return *pDataWin; }
+ Rectangle GetRowRectPixel( long nRow,
+ sal_Bool bRelToBrowser = sal_True ) const;
+ Rectangle GetFieldRectPixel( long nRow, sal_uInt16 nColId,
+ sal_Bool bRelToBrowser = sal_True) const;
+ sal_Bool IsFieldVisible( long nRow, sal_uInt16 nColId,
+ sal_Bool bComplete = sal_False ) const;
+ long GetRowAtYPosPixel( long nY,
+ sal_Bool bRelToBrowser = sal_True ) const;
+ sal_uInt16 GetColumnAtXPosPixel( long nX,
+ sal_Bool bRelToBrowser = sal_True ) const;
+
+ // invalidations
+ void Clear();
+ void RowRemoved( long nRow, long nNumRows = 1, sal_Bool bDoPaint = sal_True );
+ void RowModified( long nRow, sal_uInt16 nColId = BROWSER_INVALIDID );
+ void RowInserted( long nRow, long nNumRows = 1, sal_Bool bDoPaint = sal_True, sal_Bool bKeepSelection = sal_False );
+
+ // miscellanous
+ void ReserveControlArea( sal_uInt16 nWidth = USHRT_MAX );
+ Rectangle GetControlArea() const;
+ sal_Bool ProcessKey( const KeyEvent& rEvt );
+ void Dispatch( sal_uInt16 nId );
+ void SetMode( BrowserMode nMode = 0 );
+ BrowserMode GetMode( ) const { return m_nCurrentMode; }
+
+ void SetCursorColor(const Color& _rCol);
+ Color GetCursorColor() const { return m_aCursorColor; }
+ void ResetSelecting() { bSelecting = sal_False; }
+
+ /** specifies that the user is allowed to interactively change the height of a row,
+ by simply dragging an arbitrary row separator.
+
+ Note that this works only if there's a handle column, since only in this case,
+ there *is* something for the user to click onto
+ */
+ void EnableInteractiveRowHeight( sal_Bool _bEnable = sal_True ) { mbInteractiveRowHeight = _bEnable; }
+ sal_Bool IsInteractiveRowHeightEnabled( ) const { return mbInteractiveRowHeight; }
+
+ /// access to selected methods, to be granted to the BrowserColumn
+ struct BrowserColumnAccess { friend class BrowserColumn; private: BrowserColumnAccess() { } };
+ /** public version of PaintField, with selected access rights for the BrowserColumn
+ */
+ void DoPaintField( OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId, BrowserColumnAccess ) const
+ { PaintField( rDev, rRect, nColumnId ); }
+
+ /** suggests a default width for a column containing a given text
+
+ The width is calculated so that the text fits completely, plus som margin.
+ */
+ sal_uLong GetDefaultColumnWidth( const String& _rText ) const;
+
+ /** GetCellText returns the text at the given position
+ @param _nRow
+ the number of the row
+ @param _nColId
+ the ID of the column
+ @return
+ the text out of the cell
+ */
+ virtual String GetCellText(long _nRow, sal_uInt16 _nColId) const;
+
+ /** @return
+ the current column count
+ */
+ sal_uInt16 GetColumnCount() const { return ColCount(); }
+
+ /** commitBrowseBoxEvent commit the event at all listeners of the browsebox
+ @param nEventId
+ the event id
+ @param rNewValue
+ the new value
+ @param rOldValue
+ the old value
+ */
+ void commitBrowseBoxEvent(sal_Int16 nEventId,
+ const css::uno::Any& rNewValue,
+ const css::uno::Any& rOldValue);
+
+ /** commitTableEvent commit the event at all listeners of the table
+ @param nEventId
+ the event id
+ @param rNewValue
+ the new value
+ @param rOldValue
+ the old value
+ */
+ void commitTableEvent(sal_Int16 nEventId,
+ const css::uno::Any& rNewValue,
+ const css::uno::Any& rOldValue);
+
+ /** fires an AccessibleEvent relative to a header bar AccessibleContext
+
+ @param nEventId
+ the event id
+ @param rNewValue
+ the new value
+ @param rOldValue
+ the old value
+ */
+ void commitHeaderBarEvent(sal_Int16 nEventId,
+ const css::uno::Any& rNewValue,
+ const css::uno::Any& rOldValue,
+ sal_Bool _bColumnHeaderBar
+ );
+
+ /** returns the Rectangle for either the column header bar ot the row header bar
+ @param _bIsColumnBar
+ <TRUE/> when column header bar is used
+ @param _bOnScreen
+ <TRUE/> when the rectangle should be calculated OnScreen
+ @return
+ the Rectangle
+ */
+ virtual Rectangle calcHeaderRect(sal_Bool _bIsColumnBar,sal_Bool _bOnScreen = sal_True);
+
+ /** calculates the Rectangle of the table
+ @param _bOnScreen
+ <TRUE/> when the rectangle should be calculated OnScreen
+ @return
+ the Rectangle
+ */
+ virtual Rectangle calcTableRect(sal_Bool _bOnScreen = sal_True);
+
+ /**
+ @param _nRowId
+ the current row
+ @param _nColId
+ the column id
+ @param _bOnScreen
+ <TRUE/> when the rectangle should be calculated OnScreen
+ @return
+ the Rectangle
+ */
+ virtual Rectangle GetFieldRectPixelAbs(sal_Int32 _nRowId,sal_uInt16 _nColId, sal_Bool _bIsHeader, sal_Bool _bOnScreen = sal_True);
+
+ /// return <TRUE/> if and only if the accessible object for this instance has been created and is alive
+ sal_Bool isAccessibleAlive( ) const;
+
+ // ACCESSIBILITY ==========================================================
+public:
+ /** Creates and returns the accessible object of the whole BrowseBox. */
+ virtual css::uno::Reference<
+ css::accessibility::XAccessible > CreateAccessible();
+
+ // Children ---------------------------------------------------------------
+
+ /** Creates the accessible object of a data table cell.
+ @param nRow The row index of the cell.
+ @param nColumnId The column pos of the cell.
+ @return The XAccessible interface of the specified cell. */
+ virtual css::uno::Reference<
+ css::accessibility::XAccessible >
+ CreateAccessibleCell( sal_Int32 nRow, sal_uInt16 nColumnPos );
+
+ /** Creates the accessible object of a row header.
+ @param nRow The row index of the header.
+ @return The XAccessible interface of the specified row header. */
+ virtual css::uno::Reference<
+ css::accessibility::XAccessible >
+ CreateAccessibleRowHeader( sal_Int32 nRow );
+
+ /** Creates the accessible object of a column header.
+ @param nColumnId The column ID of the header.
+ @return The XAccessible interface of the specified column header. */
+ virtual css::uno::Reference<
+ css::accessibility::XAccessible >
+ CreateAccessibleColumnHeader( sal_uInt16 nColumnPos );
+
+ /** @return The count of additional controls of the control area. */
+ virtual sal_Int32 GetAccessibleControlCount() const;
+
+ /** Creates the accessible object of an additional control.
+ @param nIndex The 0-based index of the control.
+ @return The XAccessible interface of the specified control. */
+ virtual css::uno::Reference<
+ css::accessibility::XAccessible >
+ CreateAccessibleControl( sal_Int32 nIndex );
+
+ // Conversions ------------------------------------------------------------
+
+ /** Converts a point relative to the data window origin to a cell address.
+ @param rnRow Out-parameter that takes the row index.
+ @param rnColumnId Out-parameter that takes the column ID.
+ @param rPoint The position in pixels relative to the data window.
+ @return <TRUE/>, if the point could be converted to a valid address. */
+ virtual sal_Bool ConvertPointToCellAddress(
+ sal_Int32& rnRow, sal_uInt16& rnColumnId, const Point& rPoint );
+
+ /** Converts a point relative to the row header bar origin to a row header
+ index.
+ @param rnRow Out-parameter that takes the row index.
+ @param rPoint The position in pixels relative to the header bar.
+ @return <TRUE/>, if the point could be converted to a valid index. */
+ virtual sal_Bool ConvertPointToRowHeader( sal_Int32& rnRow, const Point& rPoint );
+
+ /** Converts a point relative to the column header bar origin to a column
+ header index.
+ @param rnColumnId Out-parameter that takes the column ID.
+ @param rPoint The position in pixels relative to the header bar.
+ @return <TRUE/>, if the point could be converted to a valid index. */
+ virtual sal_Bool ConvertPointToColumnHeader( sal_uInt16& rnColumnPos, const Point& rPoint );
+
+ /** Converts a point relative to the BrowseBox origin to the index of an
+ existing control.
+ @param rnRow Out-parameter that takes the 0-based control index.
+ @param rPoint The position in pixels relative to the BrowseBox.
+ @return <TRUE/>, if the point could be converted to a valid index. */
+ virtual sal_Bool ConvertPointToControlIndex( sal_Int32& rnIndex, const Point& rPoint );
+
+ // Object data and state --------------------------------------------------
+
+ /** return the name of the specified object.
+ @param eObjType
+ The type to ask for
+ @param _nPosition
+ The position of a tablecell (index position), header bar colum/row cell
+ @return
+ The name of the specified object.
+ */
+ virtual OUString GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const;
+
+ /** return the description of the specified object.
+ @param eObjType
+ The type to ask for
+ @param _nPosition
+ The position of a tablecell (index position), header bar colum/row cell
+ @return
+ The description of the specified object.
+ */
+ virtual OUString GetAccessibleObjectDescription( ::svt::AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const;
+
+ /** @return The header text of the specified row. */
+ virtual OUString GetRowDescription( sal_Int32 nRow ) const;
+
+ /** @return The header text of the specified column. */
+ virtual OUString GetColumnDescription( sal_uInt16 _nColumn ) const;
+
+ /** Fills the StateSet with all states (except DEFUNC and SHOWING, done by
+ the accessible object), depending on the specified object type. */
+ virtual void FillAccessibleStateSet(
+ ::utl::AccessibleStateSetHelper& rStateSet,
+ ::svt::AccessibleBrowseBoxObjType eObjType ) const;
+
+ /** Fills the StateSet with all states for one cell (except DEFUNC and SHOWING, done by
+ the accessible object). */
+ virtual void FillAccessibleStateSetForCell(
+ ::utl::AccessibleStateSetHelper& _rStateSet,
+ sal_Int32 _nRow, sal_uInt16 _nColumn ) const;
+
+ /** Sets focus to current cell of the data table. */
+ virtual void GrabTableFocus();
+
+ // IAccessibleTableProvider
+ virtual sal_Int32 GetCurrRow() const;
+ virtual sal_uInt16 GetCurrColumn() const;
+ virtual sal_Bool HasRowHeader() const;
+ virtual sal_Bool IsCellFocusable() const;
+ virtual sal_Bool GoToCell( sal_Int32 _nRow, sal_uInt16 _nColumn );
+ virtual void SelectColumn( sal_uInt16 _nColumn, sal_Bool _bSelect = sal_True );
+ virtual sal_Bool IsColumnSelected( long _nColumn ) const;
+ virtual sal_Int32 GetSelectedRowCount() const;
+ virtual sal_Int32 GetSelectedColumnCount() const;
+ virtual void GetAllSelectedRows( css::uno::Sequence< sal_Int32 >& _rRows ) const;
+ virtual void GetAllSelectedColumns( css::uno::Sequence< sal_Int32 >& _rColumns ) const;
+ virtual sal_Bool IsCellVisible( sal_Int32 _nRow, sal_uInt16 _nColumn ) const;
+ virtual String GetAccessibleCellText(long _nRow, sal_uInt16 _nColPos) const;
+ virtual sal_Bool GetGlyphBoundRects( const Point& rOrigin, const String& rStr, int nIndex, int nLen, int nBase, MetricVector& rVector );
+ virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const;
+ virtual void GrabFocus();
+ virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible( sal_Bool bCreate = sal_True );
+ virtual Window* GetAccessibleParentWindow() const;
+ virtual Window* GetWindowInstance();
+
+private:
+ // the following declares some Window/OutputDevice methods private. This happened in the course
+ // of CWS warnings01, which pointed out nameclashs in those methods. If the build breaks in some
+ // upper module, you should investigate whether you really wanted to call base class methods,
+ // or the versions at this class. In the latter case, use the renamed versions above.
+
+ // Set/GetLineColor - superseded by Set/GetGridLineColor
+ using OutputDevice::SetLineColor;
+ using OutputDevice::GetLineColor;
+
+ // ToTop/ToBottom were never property implemented. If you currently call it, this is most probably wrong
+ // and not doing as intended
+ using Window::ToTop;
+};
+
+//-------------------------------------------------------------------
+inline const DataFlavorExVector& BrowseBox::GetDataFlavors() const
+{
+ return *reinterpret_cast<DataFlavorExVector*>(implGetDataFlavors());
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/brwhead.hxx b/include/svtools/brwhead.hxx
new file mode 100644
index 000000000000..6eaa06a5f62b
--- /dev/null
+++ b/include/svtools/brwhead.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BRWHEAD_HXX
+#define _BRWHEAD_HXX
+
+#include "svtools/svtdllapi.h"
+#include <svtools/headbar.hxx>
+
+class BrowseBox;
+
+//===================================================================
+
+class SVT_DLLPUBLIC BrowserHeader: public HeaderBar
+{
+ BrowseBox* _pBrowseBox;
+
+protected:
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual void Select();
+ virtual void EndDrag();
+
+public:
+ BrowserHeader( BrowseBox* pParent, WinBits nWinBits = WB_STDHEADERBAR | WB_DRAG );
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/calendar.hxx b/include/svtools/calendar.hxx
new file mode 100644
index 000000000000..2c41ae7ed929
--- /dev/null
+++ b/include/svtools/calendar.hxx
@@ -0,0 +1,451 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CALENDAR_HXX
+#define _CALENDAR_HXX
+
+#include "svtools/svtdllapi.h"
+#include <unotools/calendarwrapper.hxx>
+#include <com/sun/star/i18n/Weekdays.hpp>
+
+#include <vcl/ctrl.hxx>
+#include <vcl/timer.hxx>
+#include <vcl/field.hxx>
+#include <set>
+
+class MouseEvent;
+class TrackingEvent;
+class KeyEvent;
+class HelpEvent;
+class DataChangedEvent;
+class FloatingWindow;
+class PushButton;
+class ImplCFieldFloatWin;
+
+/*************************************************************************
+
+Description
+============
+
+class Calendar
+
+This class allows for the selection of a date. The displayed date range is
+the one specified by the Date class. We display as many months as we have
+space in the control. The user can switch between months using a ContextMenu
+(clicking on the month's name) or via two ScrollButtons in-between the months.
+
+--------------------------------------------------------------------------
+
+WinBits
+
+WB_BORDER We draw a border around the window.
+WB_TABSTOP Keyboard control is possible. We get the focus, when
+ the user clicks in the Control.
+WB_QUICKHELPSHOWSDATEINFO Show DateInfo as BallonHelp even if QuickInfo is enabled
+WB_BOLDTEXT We format by bold texts and DIB_BOLD is evaluated by
+ AddDateInfo()
+WB_FRAMEINFO We format in a way, so that FrameInfo can be displayed
+ and the FrameColor is evaluated by AddDateInfo()
+WB_RANGESELECT The user can select multiple days, which need to be
+ consecutive
+WB_MULTISELECT The user can select multiple days
+WB_WEEKNUMBER We also display the weekdays
+
+--------------------------------------------------------------------------
+
+We set and get the selected date by SetCurDate()/GetCurDate().
+If the user selects a date Select() is called. If the user double clicks
+DoubleClick() is called.
+
+--------------------------------------------------------------------------
+
+CalcWindowSizePixel() calculates the window size in pixel that is needed
+to display a certain number of months.
+
+--------------------------------------------------------------------------
+
+SetSaturdayColor() and SetSundayColor() set a special color for Saturdays
+and Sundays.
+AddDateInfo() marks special days. With that we can set e.g. public holidays
+to another color or encircle them (for e.g. appointments).
+If we do not supply a year in the date, the day is used in EVERY year.
+
+AddDateInfo() can also add text for every date, which is displayed if the
+BalloonHelp is enabled.
+In order to not have to supply all years with the relevant data, we call
+the RequestDateInfo() handler if a new year is displayed. We can then query
+the year in the handler with GetRequestYear().
+
+--------------------------------------------------------------------------
+
+In order to display a ContextMenu for a date, we need to override the
+Command handler. GetDate() can infer the date from the mouse's position.
+If we use the keyboard, the current date should be use.
+
+If a ContextMenu is displayed, the baseclass' handler must not be called.
+
+--------------------------------------------------------------------------
+
+For multiple selection (WB_RANGESELECT or WB_MULTISELECT) SelectDate(),
+SelectDateRange() can select date ranges. SelectDateRange() selects
+including the end date.
+SetNoSelection() deselects everything.
+SetCurDate() does not select the current date, but only defines the focus
+rectangle.
+GetSelectDateCount()/GetSelectDate() query the selected range.
+IsDateSelected() queries for the status of a date.
+
+The SelectionChanging() handler is being called while a user selects a
+date. In it, we can change the selected range. E.g. if we want to limit
+or extend the selected range. The selected range is realised via SelectDate()
+and SelectDateRange() and queried with GetSelectDateCount()/GetSelectDate().
+
+IsSelectLeft() returns the direction of the selection:
+sal_True is a selection to the left or up
+sal_False is a selection to the right or down
+
+--------------------------------------------------------------------------
+
+If the DateRange area changes and we want to take over the selection, we
+should only do this is if IsScrollDateRangeChanged() retruns sal_True.
+This method returns sal_True if the area change was triggered by using the
+ScrollButtons and sal_False if it was triggered by Resize(), other method
+calls or by ending a selection.
+
+*************************************************************************/
+
+// ------------------
+// - Calendar types -
+// ------------------
+
+#define WB_QUICKHELPSHOWSDATEINFO ((WinBits)0x00004000)
+#define WB_BOLDTEXT ((WinBits)0x00008000)
+#define WB_FRAMEINFO ((WinBits)0x00010000)
+#define WB_WEEKNUMBER ((WinBits)0x00020000)
+// Needs to in agreement with the WinBits in the TabBar or
+// we move it to \vcl\inc\wintypes.hxx
+#ifndef WB_RANGESELECT
+#define WB_RANGESELECT ((WinBits)0x00200000)
+#endif
+#ifndef WB_MULTISELECT
+#define WB_MULTISELECT ((WinBits)0x00400000)
+#endif
+
+#define DIB_BOLD ((sal_uInt16)0x0001)
+
+// ------------
+// - Calendar -
+// ------------
+
+typedef std::set<sal_uInt32> IntDateSet;
+
+
+class SVT_DLLPUBLIC Calendar : public Control
+{
+private:
+ IntDateSet* mpSelectTable;
+ IntDateSet* mpOldSelectTable;
+ IntDateSet* mpRestoreSelectTable;
+ OUString maDayTexts[31];
+ OUString maDayText;
+ OUString maWeekText;
+ CalendarWrapper maCalendarWrapper;
+ Rectangle maPrevRect;
+ Rectangle maNextRect;
+ String maDayOfWeekText;
+ sal_Int32 mnDayOfWeekAry[7];
+ Date maOldFormatFirstDate;
+ Date maOldFormatLastDate;
+ Date maFirstDate;
+ Date maOldFirstDate;
+ Date maCurDate;
+ Date maOldCurDate;
+ Date maAnchorDate;
+ Date maDropDate;
+ Color maSelColor;
+ Color maOtherColor;
+ Color* mpStandardColor;
+ Color* mpSaturdayColor;
+ Color* mpSundayColor;
+ sal_uLong mnDayCount;
+ long mnDaysOffX;
+ long mnWeekDayOffY;
+ long mnDaysOffY;
+ long mnMonthHeight;
+ long mnMonthWidth;
+ long mnMonthPerLine;
+ long mnLines;
+ long mnDayWidth;
+ long mnDayHeight;
+ long mnWeekWidth;
+ WinBits mnWinStyle;
+ sal_uInt16 mnFirstYear;
+ sal_uInt16 mnLastYear;
+ sal_uInt16 mnRequestYear;
+ sal_Bool mbCalc:1,
+ mbFormat:1,
+ mbDrag:1,
+ mbSelection:1,
+ mbMultiSelection:1,
+ mbWeekSel:1,
+ mbUnSel:1,
+ mbMenuDown:1,
+ mbSpinDown:1,
+ mbPrevIn:1,
+ mbNextIn:1,
+ mbDirect:1,
+ mbInSelChange:1,
+ mbTravelSelect:1,
+ mbScrollDateRange:1,
+ mbSelLeft:1,
+ mbAllSel:1,
+ mbDropPos:1;
+ Link maSelectionChangingHdl;
+ Link maDateRangeChangedHdl;
+ Link maRequestDateInfoHdl;
+ Link maDoubleClickHdl;
+ Link maSelectHdl;
+ Timer maDragScrollTimer;
+ sal_uInt16 mnDragScrollHitTest;
+
+#ifdef _SV_CALENDAR_CXX
+ using Control::ImplInitSettings;
+ using Window::ImplInit;
+ SVT_DLLPRIVATE void ImplInit( WinBits nWinStyle );
+ SVT_DLLPRIVATE void ImplInitSettings();
+ SVT_DLLPRIVATE void ImplGetWeekFont( Font& rFont ) const;
+ SVT_DLLPRIVATE void ImplFormat();
+ using Window::ImplHitTest;
+ SVT_DLLPRIVATE sal_uInt16 ImplHitTest( const Point& rPos, Date& rDate ) const;
+ SVT_DLLPRIVATE void ImplDrawSpin( sal_Bool bDrawPrev = sal_True, sal_Bool bDrawNext = sal_True );
+ SVT_DLLPRIVATE void ImplDrawDate( long nX, long nY,
+ sal_uInt16 nDay, sal_uInt16 nMonth, sal_uInt16 nYear,
+ DayOfWeek eDayOfWeek,
+ sal_Bool bBack = sal_True, sal_Bool bOther = sal_False,
+ sal_uLong nToday = 0 );
+ SVT_DLLPRIVATE void ImplDraw( sal_Bool bPaint = sal_False );
+ SVT_DLLPRIVATE void ImplUpdateDate( const Date& rDate );
+ SVT_DLLPRIVATE void ImplUpdateSelection( IntDateSet* pOld );
+ SVT_DLLPRIVATE void ImplMouseSelect( const Date& rDate, sal_uInt16 nHitTest,
+ sal_Bool bMove, sal_Bool bExpand, sal_Bool bExtended );
+ SVT_DLLPRIVATE void ImplUpdate( sal_Bool bCalcNew = sal_False );
+ using Window::ImplScroll;
+ SVT_DLLPRIVATE void ImplScroll( sal_Bool bPrev );
+ SVT_DLLPRIVATE void ImplInvertDropPos();
+ SVT_DLLPRIVATE void ImplShowMenu( const Point& rPos, const Date& rDate );
+ SVT_DLLPRIVATE void ImplTracking( const Point& rPos, sal_Bool bRepeat );
+ SVT_DLLPRIVATE void ImplEndTracking( sal_Bool bCancel );
+ SVT_DLLPRIVATE DayOfWeek ImplGetWeekStart() const;
+#endif
+
+protected:
+
+ DECL_STATIC_LINK( Calendar, ScrollHdl, Timer *);
+
+public:
+ Calendar( Window* pParent, WinBits nWinStyle = 0 );
+ ~Calendar();
+
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void Tracking( const TrackingEvent& rMEvt );
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void Paint( const Rectangle& rRect );
+ virtual void Resize();
+ virtual void GetFocus();
+ virtual void LoseFocus();
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual void StateChanged( StateChangedType nStateChange );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ virtual void SelectionChanging();
+ virtual void DateRangeChanged();
+ virtual void RequestDateInfo();
+ virtual void DoubleClick();
+ virtual void Select();
+
+ const CalendarWrapper& GetCalendarWrapper() const { return maCalendarWrapper; }
+
+ void SelectDate( const Date& rDate, sal_Bool bSelect = sal_True );
+ void SetNoSelection();
+ sal_Bool IsDateSelected( const Date& rDate ) const;
+ Date GetFirstSelectedDate() const;
+ void EnableCallEverySelect( sal_Bool bEvery = sal_True ) { mbAllSel = bEvery; }
+ sal_Bool IsCallEverySelectEnabled() const { return mbAllSel; }
+
+ sal_uInt16 GetRequestYear() const { return mnRequestYear; }
+ void SetCurDate( const Date& rNewDate );
+ Date GetCurDate() const { return maCurDate; }
+ void SetFirstDate( const Date& rNewFirstDate );
+ Date GetFirstDate() const { return maFirstDate; }
+ Date GetLastDate() const { return GetFirstDate() + mnDayCount; }
+ sal_uLong GetDayCount() const { return mnDayCount; }
+ Date GetFirstMonth() const;
+ Date GetLastMonth() const;
+ sal_uInt16 GetMonthCount() const;
+ sal_Bool GetDate( const Point& rPos, Date& rDate ) const;
+ Rectangle GetDateRect( const Date& rDate ) const;
+
+ long GetCurMonthPerLine() const { return mnMonthPerLine; }
+ long GetCurLines() const { return mnLines; }
+
+ const Color& GetStandardColor() const;
+ const Color& GetSaturdayColor() const;
+ const Color& GetSundayColor() const;
+
+ void StartSelection();
+ void EndSelection();
+
+ sal_Bool IsTravelSelect() const { return mbTravelSelect; }
+ sal_Bool IsScrollDateRangeChanged() const { return mbScrollDateRange; }
+ sal_Bool IsSelectLeft() const { return mbSelLeft; }
+
+ Size CalcWindowSizePixel( long nCalcMonthPerLine = 1,
+ long nCalcLines = 1 ) const;
+
+ void SetSelectionChangingHdl( const Link& rLink ) { maSelectionChangingHdl = rLink; }
+ const Link& GetSelectionChangingHdl() const { return maSelectionChangingHdl; }
+ void SetDateRangeChangedHdl( const Link& rLink ) { maDateRangeChangedHdl = rLink; }
+ const Link& GetDateRangeChangedHdl() const { return maDateRangeChangedHdl; }
+ void SetRequestDateInfoHdl( const Link& rLink ) { maRequestDateInfoHdl = rLink; }
+ const Link& GetRequestDateInfoHdl() const { return maRequestDateInfoHdl; }
+ void SetDoubleClickHdl( const Link& rLink ) { maDoubleClickHdl = rLink; }
+ const Link& GetDoubleClickHdl() const { return maDoubleClickHdl; }
+ void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; }
+ const Link& GetSelectHdl() const { return maSelectHdl; }
+};
+
+inline const Color& Calendar::GetStandardColor() const
+{
+ if ( mpStandardColor )
+ return *mpStandardColor;
+ else
+ return GetFont().GetColor();
+}
+
+inline const Color& Calendar::GetSaturdayColor() const
+{
+ if ( mpSaturdayColor )
+ return *mpSaturdayColor;
+ else
+ return GetFont().GetColor();
+}
+
+inline const Color& Calendar::GetSundayColor() const
+{
+ if ( mpSundayColor )
+ return *mpSundayColor;
+ else
+ return GetFont().GetColor();
+}
+
+/*************************************************************************
+
+Description
+============
+
+class CalendarField
+
+This class is a DateField with which one can select a date via a DropDownButton
+and the CalendarControl.
+
+--------------------------------------------------------------------------
+
+WinBits
+
+See DateField
+
+The preferences for the CalendarControl can be set via SetCalendarStyle().
+
+--------------------------------------------------------------------------
+
+With EnableToday()/EnableNone() we can enable a TodayButton and a NoneButton.
+
+--------------------------------------------------------------------------
+
+If we set WB_RANGESELECT with SetCalendarStyle(), we can select multiple days
+in the Calendar.
+
+Because we only take over the start date into the field, we should query
+with GetCalendar() in the SelectHandler and with GetSelectDateCount()/GetSelectDate()
+the selected range. We then can e.g. take over that value to another field.
+
+--------------------------------------------------------------------------
+
+If a derived Calendar should be used, we can override the CreateCalendar()
+method in CalendarField and create an own calendar there ourselves.
+
+*************************************************************************/
+
+// -----------------
+// - CalendarField -
+// -----------------
+
+class SVT_DLLPUBLIC CalendarField : public DateField
+{
+private:
+ ImplCFieldFloatWin* mpFloatWin;
+ Calendar* mpCalendar;
+ WinBits mnCalendarStyle;
+ PushButton* mpTodayBtn;
+ PushButton* mpNoneBtn;
+ Date maDefaultDate;
+ sal_Bool mbToday;
+ sal_Bool mbNone;
+ Link maSelectHdl;
+
+#ifdef _SV_CALENDAR_CXX
+ DECL_DLLPRIVATE_LINK( ImplSelectHdl, Calendar* );
+ DECL_DLLPRIVATE_LINK( ImplClickHdl, PushButton* );
+ DECL_DLLPRIVATE_LINK( ImplPopupModeEndHdl, void* );
+#endif
+
+public:
+ CalendarField( Window* pParent, WinBits nWinStyle );
+ ~CalendarField();
+
+ virtual void Select();
+
+ virtual sal_Bool ShowDropDown( sal_Bool bShow );
+ virtual Calendar* CreateCalendar( Window* pParent );
+ Calendar* GetCalendar();
+
+ void SetDefaultDate( const Date& rDate ) { maDefaultDate = rDate; }
+ Date GetDefaultDate() const { return maDefaultDate; }
+
+ void EnableToday( sal_Bool bToday = sal_True ) { mbToday = bToday; }
+ sal_Bool IsTodayEnabled() const { return mbToday; }
+ void EnableNone( sal_Bool bNone = sal_True ) { mbNone = bNone; }
+ sal_Bool IsNoneEnabled() const { return mbNone; }
+
+ void SetCalendarStyle( WinBits nStyle ) { mnCalendarStyle = nStyle; }
+ WinBits GetCalendarStyle() const { return mnCalendarStyle; }
+
+ void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; }
+ const Link& GetSelectHdl() const { return maSelectHdl; }
+
+protected:
+ virtual void StateChanged( StateChangedType nStateChange );
+};
+
+#endif // _CALENDAR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/cliplistener.hxx b/include/svtools/cliplistener.hxx
new file mode 100644
index 000000000000..47ff64403dc6
--- /dev/null
+++ b/include/svtools/cliplistener.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CLIPLISTENER_HXX
+#define _CLIPLISTENER_HXX
+
+#include "svtools/svtdllapi.h"
+#include <tools/link.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp>
+
+class Window;
+
+
+class SVT_DLLPUBLIC TransferableClipboardListener : public ::cppu::WeakImplHelper1<
+ ::com::sun::star::datatransfer::clipboard::XClipboardListener >
+{
+ Link aLink;
+
+public:
+ // Link is called with a TransferableDataHelper pointer
+ TransferableClipboardListener( const Link& rCallback );
+ ~TransferableClipboardListener();
+
+ void AddRemoveListener( Window* pWin, sal_Bool bAdd );
+ void ClearCallbackLink();
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source )
+ throw(::com::sun::star::uno::RuntimeException);
+ // XClipboardListener
+ virtual void SAL_CALL changedContents( const ::com::sun::star::datatransfer::clipboard::ClipboardEvent& event )
+ throw(::com::sun::star::uno::RuntimeException);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/collatorres.hxx b/include/svtools/collatorres.hxx
new file mode 100644
index 000000000000..d8abf68ccf82
--- /dev/null
+++ b/include/svtools/collatorres.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVTOOLS_COLLATORRESOURCE_HXX
+#define SVTOOLS_COLLATORRESOURCE_HXX
+
+#include "svtools/svtdllapi.h"
+#include <rtl/ustring.hxx>
+
+class CollatorResourceData;
+
+class SVT_DLLPUBLIC CollatorResource
+{
+ private:
+
+ CollatorResourceData *mp_Data;
+
+ public:
+ CollatorResource();
+ ~CollatorResource();
+ const OUString& GetTranslation (const OUString& r_Algorithm);
+};
+
+#endif /* SVTOOLS_COLLATORRESOURCE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/colorcfg.hxx b/include/svtools/colorcfg.hxx
new file mode 100644
index 000000000000..2ea6649bdb8c
--- /dev/null
+++ b/include/svtools/colorcfg.hxx
@@ -0,0 +1,138 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVTOOLS_COLORCFG_HXX
+#define INCLUDED_SVTOOLS_COLORCFG_HXX
+
+#include "svtools/svtdllapi.h"
+#include <rtl/ustring.hxx>
+#include <tools/color.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <svl/brdcst.hxx>
+#include <svl/lstner.hxx>
+#include <unotools/options.hxx>
+
+//-----------------------------------------------------------------------------
+namespace svtools{
+enum ColorConfigEntry
+{
+ DOCCOLOR ,
+ DOCBOUNDARIES ,
+ APPBACKGROUND ,
+ OBJECTBOUNDARIES ,
+ TABLEBOUNDARIES ,
+ FONTCOLOR ,
+ LINKS ,
+ LINKSVISITED ,
+ SPELL ,
+ SMARTTAGS ,
+ SHADOWCOLOR ,
+ WRITERTEXTGRID ,
+ WRITERFIELDSHADINGS ,
+ WRITERIDXSHADINGS ,
+ WRITERDIRECTCURSOR ,
+ WRITERSCRIPTINDICATOR,
+ WRITERSECTIONBOUNDARIES,
+ WRITERHEADERFOOTERMARK,
+ WRITERPAGEBREAKS,
+ HTMLSGML ,
+ HTMLCOMMENT ,
+ HTMLKEYWORD ,
+ HTMLUNKNOWN ,
+ CALCGRID ,
+ CALCPAGEBREAK ,
+ CALCPAGEBREAKMANUAL,
+ CALCPAGEBREAKAUTOMATIC,
+ CALCDETECTIVE ,
+ CALCDETECTIVEERROR ,
+ CALCREFERENCE ,
+ CALCNOTESBACKGROUND ,
+ DRAWGRID ,
+ BASICIDENTIFIER,
+ BASICCOMMENT ,
+ BASICNUMBER ,
+ BASICSTRING ,
+ BASICOPERATOR ,
+ BASICKEYWORD ,
+ BASICERROR ,
+ SQLIDENTIFIER,
+ SQLNUMBER,
+ SQLSTRING,
+ SQLOPERATOR,
+ SQLKEYWORD,
+ SQLPARAMETER,
+ SQLCOMMENT,
+ ColorConfigEntryCount
+};
+
+class ColorConfig_Impl;
+struct ColorConfigValue
+{
+
+ sal_Bool bIsVisible; //validity depends on the element type
+ sal_Int32 nColor;
+ ColorConfigValue() : bIsVisible(sal_False), nColor(0) {}
+ sal_Bool operator !=(const ColorConfigValue& rCmp) const
+ { return nColor != rCmp.nColor || bIsVisible != rCmp.bIsVisible;}
+};
+
+class SVT_DLLPUBLIC ColorConfig:
+ public utl::detail::Options
+{
+ friend class ColorConfig_Impl;
+private:
+ static ColorConfig_Impl* m_pImpl;
+public:
+ ColorConfig();
+ virtual ~ColorConfig();
+
+ // get the configured value - if bSmart is set the default color setting is provided
+ // instead of the automatic color
+ ColorConfigValue GetColorValue(ColorConfigEntry eEntry, sal_Bool bSmart = sal_True)const;
+ static Color GetDefaultColor(ColorConfigEntry eEntry);
+};
+
+class SVT_DLLPUBLIC EditableColorConfig
+{
+ ColorConfig_Impl* m_pImpl;
+ sal_Bool m_bModified;
+public:
+ EditableColorConfig();
+ ~EditableColorConfig();
+
+ ::com::sun::star::uno::Sequence< OUString > GetSchemeNames() const;
+ void DeleteScheme(const OUString& rScheme );
+ void AddScheme(const OUString& rScheme );
+ sal_Bool LoadScheme(const OUString& rScheme );
+ const OUString& GetCurrentSchemeName()const;
+ void SetCurrentSchemeName(const OUString& rScheme);
+
+ const ColorConfigValue& GetColorValue(ColorConfigEntry eEntry)const;
+ void SetColorValue(ColorConfigEntry eEntry, const ColorConfigValue& rValue);
+ void SetModified();
+ void ClearModified(){m_bModified = sal_False;}
+ sal_Bool IsModified()const{return m_bModified;}
+ void Commit();
+
+ void DisableBroadcast();
+ void EnableBroadcast();
+};
+}//namespace svtools
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/colrdlg.hxx b/include/svtools/colrdlg.hxx
new file mode 100644
index 000000000000..ce155302865b
--- /dev/null
+++ b/include/svtools/colrdlg.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SV_COLRDLG_HXX
+#define _SV_COLRDLG_HXX
+
+#include "svtools/svtdllapi.h"
+
+#include <tools/color.hxx>
+
+class Window;
+
+// ---------------
+// - ColorDialog -
+// ---------------
+
+namespace svtools
+{
+ // SELECT is the default
+ enum ColorPickerMode { ColorPickerMode_SELECT = 0, ColorPickerMode_ADD = 1, ColorPickerMode_MODIFY = 2 };
+}
+
+class SVT_DLLPUBLIC SvColorDialog
+{
+public:
+ SvColorDialog( ::Window* pParent );
+ virtual ~SvColorDialog();
+
+ void SetColor( const Color& rColor );
+ const Color& GetColor() const;
+
+ void SetMode( sal_Int16 eMode );
+
+ virtual short Execute();
+
+private:
+ Window* mpParent;
+ Color maColor;
+ sal_Int16 meMode;
+};
+
+#endif // _SV_COLRDLG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/contextmenuhelper.hxx b/include/svtools/contextmenuhelper.hxx
new file mode 100644
index 000000000000..258da5dedbfb
--- /dev/null
+++ b/include/svtools/contextmenuhelper.hxx
@@ -0,0 +1,116 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVTOOLS_CONTEXTMENUHELPER_HXX
+#define INCLUDED_SVTOOLS_CONTEXTMENUHELPER_HXX
+
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/awt/XPopupMenu.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <com/sun/star/ui/XImageManager.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+
+#include <rtl/ustring.hxx>
+#include <cppuhelper/weak.hxx>
+#include <vcl/menu.hxx>
+#include "svtools/svtdllapi.h"
+
+namespace svt
+{
+
+/**
+ Context menu helper class.
+
+ Fills images and labels for a provided popup menu or
+ com.sun.star.awt.XPopupMenu.
+
+ PRECONDITION:
+ All commands must be set via SetItemCommand and are part
+ of the configuration files
+ (see org.openoffice.Office.UI.[Module]Commands.xcu)
+*/
+struct ExecuteInfo;
+class SVT_DLLPUBLIC ContextMenuHelper
+{
+ public:
+ // create context menu helper
+ // ARGS: xFrame = frame defines the context of the context menu
+ // bAutoRefresh = specifies that the context will be constant or not
+ ContextMenuHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, bool bAutoRefresh=true );
+ ~ContextMenuHelper();
+
+ // methods to complete a popup menu (set images, labels, enable/disable states)
+ // ATTENTION: The item ID's must be unique for the whole popup (inclusive the sub menus!)
+ void completeAndExecute( const Point& aPos, PopupMenu& aPopupMenu );
+ void completeAndExecute( const Point& aPos, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& xPopupMenu );
+
+ private:
+ // asynchronous link to prevent destruction while on stack
+ DECL_STATIC_LINK( ContextMenuHelper, ExecuteHdl_Impl, ExecuteInfo* );
+
+ // no copy-ctor and operator=
+ ContextMenuHelper( const ContextMenuHelper& );
+ const ContextMenuHelper& operator=( const ContextMenuHelper& );
+
+ // show context menu and dispatch command automatically
+ void executePopupMenu( const Point& aPos, PopupMenu* pMenu );
+
+ // fill image and label for every menu item on the provided menu
+ void completeMenuProperties( Menu* pMenu );
+
+ // dispatch provided command
+ bool dispatchCommand( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, const OUString& aCommandURL );
+
+
+ // methods to retrieve a single command URL dependent value from a
+ // ui configuratin manager
+ Image getImageFromCommandURL( const OUString& aCmdURL ) const;
+ OUString getLabelFromCommandURL( const OUString& aCmdURL ) const;
+
+ // creates an association between current module/controller bound to the
+ // provided frame and their ui configuration managers.
+ bool associateUIConfigurationManagers();
+
+ // resets associations to create associations again on-demand.
+ // Useful for implementations which recycle frames. Normal
+ // implementations can profit from caching and should set
+ // auto refresh on ctor to false (default).
+ void resetAssociations()
+ {
+ if ( m_bAutoRefresh )
+ m_bUICfgMgrAssociated = false;
+ }
+
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XFrame > m_xWeakFrame;
+ OUString m_aModuleIdentifier;
+ OUString m_aSelf;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > m_aDefaultArgs;
+ ::com::sun::star::uno::Reference< ::com::sun::star::ui::XImageManager > m_xDocImageMgr;
+ ::com::sun::star::uno::Reference< ::com::sun::star::ui::XImageManager > m_xModuleImageMgr;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xUICommandLabels;
+ bool m_bAutoRefresh;
+ bool m_bUICfgMgrAssociated;
+};
+
+} // namespace svt
+
+#endif // INCLUDED_SVTOOLS_CONTEXTMENUHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/controldims.hrc b/include/svtools/controldims.hrc
new file mode 100644
index 000000000000..2d01ddc668e1
--- /dev/null
+++ b/include/svtools/controldims.hrc
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#define _SVT_CONTROLDIMS_HRC_
+
+//
+// From: Dialogue Specification and Guidelines - Visual Design V1.3
+// by Christian Jansen
+//
+
+//
+// Usage:
+// ======
+//
+// all values have to be mapped by MAP_APPFONT
+//
+
+// Base
+#define RSC_BS_CHARHEIGHT 8
+#define RSC_BS_CHARWIDTH 4
+
+// control dimensions
+#define RSC_CD_PUSHBUTTON_WIDTH 50
+#define RSC_CD_PUSHBUTTON_HEIGHT 14
+
+#define RSC_CD_FIXEDTEXT_HEIGHT RSC_BS_CHARHEIGHT
+#define RSC_CD_FIXEDLINE_HEIGHT RSC_BS_CHARHEIGHT
+#define RSC_CD_FIXEDLINE_WIDTH RSC_BS_CHARWIDTH // for vertical FixedLines
+
+#define RSC_CD_DROPDOWN_HEIGHT 12 // also combobox and dropdown list
+#define RSC_CD_TEXTBOX_HEIGHT 12 // also numeric fields etc.
+
+#define RSC_CD_CHECKBOX_HEIGHT 10 // also tristate
+#define RSC_CD_RADIOBUTTON_HEIGHT 10
+
+// spacings
+#define RSC_SP_CTRL_X 6 // controls that are unrelated
+#define RSC_SP_CTRL_Y 7
+#define RSC_SP_CTRL_GROUP_X 3 // related controls, or controls in a groupbox
+#define RSC_SP_CTRL_GROUP_Y 4
+#define RSC_SP_CTRL_DESC_X 3 // between description text and related control
+#define RSC_SP_CTRL_DESC_Y 3
+
+// overruled spacings between certain controls
+#define RSC_SP_FLGR_SPACE_X 6 // between groupings made with FixedLine
+#define RSC_SP_FLGR_SPACE_Y 4
+#define RSC_SP_GRP_SPACE_X 6 // between groupings made with GroupBox
+#define RSC_SP_GRP_SPACE_Y 6
+#define RSC_SP_CHK_TEXTINDENT 8 // x indent of text aligned to checkbox title
+
+// dialog inner border
+#define RSC_SP_DLG_INNERBORDER_LEFT 6
+#define RSC_SP_DLG_INNERBORDER_TOP 6
+#define RSC_SP_DLG_INNERBORDER_RIGHT 6
+#define RSC_SP_DLG_INNERBORDER_BOTTOM 6
+
+// tab page inner border
+#define RSC_SP_TBPG_INNERBORDER_LEFT 6 // for tabpage groupings
+#define RSC_SP_TBPG_INNERBORDER_TOP 3
+#define RSC_SP_TBPG_INNERBORDER_RIGHT 6
+#define RSC_SP_TBPG_INNERBORDER_BOTTOM 6
+
+// FixedLine group inner border
+#define RSC_SP_FLGR_INNERBORDER_LEFT 6 // for FixedLine groupings
+#define RSC_SP_FLGR_INNERBORDER_TOP 3
+#define RSC_SP_FLGR_INNERBORDER_RIGHT 0
+#define RSC_SP_FLGR_INNERBORDER_BOTTOM 0
+
+// GroupBox inner border
+#define RSC_SP_GRP_INNERBORDER_LEFT 6 // for GroupBox groupings
+#define RSC_SP_GRP_INNERBORDER_TOP 6
+#define RSC_SP_GRP_INNERBORDER_RIGHT 6
+
+#endif // _SVT_CONTROLDIMS_HRC_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/ctrlbox.hxx b/include/svtools/ctrlbox.hxx
new file mode 100644
index 000000000000..39e5bb02bcc0
--- /dev/null
+++ b/include/svtools/ctrlbox.hxx
@@ -0,0 +1,552 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CTRLBOX_HXX
+#define _CTRLBOX_HXX
+
+#include "svtools/svtdllapi.h"
+
+#include <tools/string.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/combobox.hxx>
+#include <vcl/image.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/metric.hxx>
+#include <vcl/field.hxx>
+
+class FontList;
+class ImplColorListData;
+class ImpLineListData;
+
+typedef ::std::vector< ImplColorListData* > ImpColorList;
+typedef ::std::vector< ImpLineListData* > ImpLineList;
+typedef ::std::vector< FontInfo > ImplFontList;
+
+// FIXME: STYLE_* duplicate values from editeng::SvxBorderStyle,
+// which in turn duplicates values from com::sun::star::table::BorderLineStyle:
+// this needs cleaning up on master
+#define STYLE_SOLID ( ( sal_uInt16 ) 0 )
+#define STYLE_DOTTED ( ( sal_uInt16 ) 1 )
+#define STYLE_DASHED ( ( sal_uInt16 ) 2 )
+#define STYLE_FINE_DASHED ( ( sal_uInt16 ) 14 )
+#define STYLE_NONE ( ( sal_uInt16 ) -1)
+
+#define CHANGE_LINE1 ( ( sal_uInt16 ) 1 )
+#define CHANGE_LINE2 ( ( sal_uInt16 ) 2 )
+#define CHANGE_DIST ( ( sal_uInt16 ) 4 )
+#define ADAPT_DIST ( ( sal_uInt16 ) 8 )
+
+
+
+/*************************************************************************
+
+Description
+============
+
+class ColorListBox
+
+Description
+
+Allows color selection
+
+--------------------------------------------------------------------------
+
+class LineListBox
+
+Description
+
+Allows selection of line styles and sizes. Not that before first insert,
+units and window size need to be set. Supported units are typographic point
+(pt) and millimeters (mm). For SourceUnit, pt, mm and twips are supported.
+All scalar numbers in 1/100 of the corresponding unit.
+
+Line1 is the outer, Line2 the inner line, Distance is the distance between
+these two lines. If Line2 == 0, only Line1 will be shown. Defaults for
+source and target unit are FUNIT_POINT.
+
+SetColor() sets the line color.
+
+Remarks
+
+Contrary to a simple ListBox, user-specific data are not supported.
+If UpdateMode is disabled, no data should be read, no selections
+should be set, and the return code shall be ignore, as in these are
+not defined in this mode. Also the bit WinBit WB_SORT may not be set.
+
+--------------------------------------------------------------------------
+
+class FontNameBox
+
+Description
+
+Allows selection of fonts. The ListBox will be filled using Fill parameter,
+which is pointer to an FontList object.
+
+Calling EnableWYSIWYG() enables rendering the font name in the currently
+selected font.
+
+See also
+
+FontList; FontStyleBox; FontSizeBox; FontNameMenu
+
+--------------------------------------------------------------------------
+
+class FontStyleBox
+
+Description
+
+Allows select of FontStyle's. The parameter Fill points to a list
+of available font styles for the font.
+
+Reproduced styles are always added - this could change in future, as
+potentially not all applications [Draw,Equation,FontWork] can properly
+handle synthetic fonts. On filling, the previous name will be retained
+if possible.
+
+For DontKnow, the FontStyleBox should be filled with String(),
+so it will contain a list with the default attributes. The currently
+shown style probably needs to be reset by the application.
+
+See also
+
+FontList; FontNameBox; FontSizeBox;
+
+--------------------------------------------------------------------------
+
+class FontSizeBox
+
+Description
+
+Allows selection of font sizes. The values are retrieved via GetValue()
+and set via SetValue(). The Fill parameter fills the ListBox with the
+available sizes for the passed font.
+
+All sizes are in 1/10 typographic point (pt).
+
+The passed FontList must be retained until the next fill call.
+
+Additionally it supports an relative mod, which allows entering
+percentage values. This, eg., can be useful for template dialogs.
+This mode can only be enabled, but not disabled again.
+
+For DontKnow the FontSizeBox should be filled FontInfo(), so it will
+contain an list with the standard sizes. Th currently shown size
+probably needs to be reset by the application.
+
+See also
+
+FontList; FontNameBox; FontStyleBox; FontSizeMenu
+
+*************************************************************************/
+
+// ----------------
+// - ColorListBox -
+// ----------------
+
+class SVT_DLLPUBLIC ColorListBox : public ListBox
+{
+ ImpColorList* pColorList; // separate liste, in case of user data are required from outside
+ Size aImageSize;
+
+#ifdef _CTRLBOX_CXX
+ using Window::ImplInit;
+ SVT_DLLPRIVATE void ImplInit();
+ SVT_DLLPRIVATE void ImplDestroyColorEntries();
+#endif
+public:
+ ColorListBox( Window* pParent,
+ WinBits nWinStyle = WB_BORDER );
+ ColorListBox( Window* pParent, const ResId& rResId );
+ virtual ~ColorListBox();
+
+ virtual void UserDraw( const UserDrawEvent& rUDEvt );
+
+ using ListBox::InsertEntry;
+ virtual sal_uInt16 InsertEntry( const XubString& rStr,
+ sal_uInt16 nPos = LISTBOX_APPEND );
+ virtual sal_uInt16 InsertEntry( const Color& rColor, const XubString& rStr,
+ sal_uInt16 nPos = LISTBOX_APPEND );
+ void InsertAutomaticEntryColor(const Color &rAutoColorValue);
+ bool IsAutomaticSelected() { return !GetSelectEntryPos(); }
+ using ListBox::RemoveEntry;
+ virtual void RemoveEntry( sal_uInt16 nPos );
+ virtual void Clear();
+ void CopyEntries( const ColorListBox& rBox );
+
+ using ListBox::GetEntryPos;
+ virtual sal_uInt16 GetEntryPos( const Color& rColor ) const;
+ virtual Color GetEntryColor( sal_uInt16 nPos ) const;
+ Size GetImageSize() const { return aImageSize; }
+
+ void SelectEntry( const XubString& rStr, sal_Bool bSelect = sal_True )
+ { ListBox::SelectEntry( rStr, bSelect ); }
+ void SelectEntry( const Color& rColor, sal_Bool bSelect = sal_True );
+ XubString GetSelectEntry( sal_uInt16 nSelIndex = 0 ) const
+ { return ListBox::GetSelectEntry( nSelIndex ); }
+ Color GetSelectEntryColor( sal_uInt16 nSelIndex = 0 ) const;
+ sal_Bool IsEntrySelected( const XubString& rStr ) const
+ { return ListBox::IsEntrySelected( rStr ); }
+
+ sal_Bool IsEntrySelected( const Color& rColor ) const;
+
+private:
+ // declared as private because some compilers would generate the default functions
+ ColorListBox( const ColorListBox& );
+ ColorListBox& operator =( const ColorListBox& );
+
+ void SetEntryData( sal_uInt16 nPos, void* pNewData );
+ void* GetEntryData( sal_uInt16 nPos ) const;
+};
+
+inline void ColorListBox::SelectEntry( const Color& rColor, sal_Bool bSelect )
+{
+ sal_uInt16 nPos = GetEntryPos( rColor );
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ ListBox::SelectEntryPos( nPos, bSelect );
+}
+
+inline sal_Bool ColorListBox::IsEntrySelected( const Color& rColor ) const
+{
+ sal_uInt16 nPos = GetEntryPos( rColor );
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ return IsEntryPosSelected( nPos );
+ else
+ return sal_False;
+}
+
+inline Color ColorListBox::GetSelectEntryColor( sal_uInt16 nSelIndex ) const
+{
+ sal_uInt16 nPos = GetSelectEntryPos( nSelIndex );
+ Color aColor;
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ aColor = GetEntryColor( nPos );
+ return aColor;
+}
+
+// ---------------
+// - LineListBox -
+// ---------------
+
+/**
+ Class computing border widths shared between Line style listbox and the
+ SvxBorderLine implementation.
+
+ This class doesn't know anything about units: it all depends on the different
+ values set. A border is composed of 2 lines separated by a gap. The computed
+ widths are the ones of each line and the gap and they can either be fix or vary.
+
+ The #m_nflags member will define which widths will vary (value 0 means that all
+ widths are fixed). The available flags are:
+ - CHANGE_LINE1
+ - CHANGE_LINE2
+ - CHANGE_DIST
+
+ For each line, the rate member is used as a multiplication factor is the width
+ isn't fixed. Otherwise it is the width in the unit expected by the client code.
+ */
+class SVT_DLLPUBLIC BorderWidthImpl
+{
+ sal_uInt16 m_nFlags;
+ double m_nRate1;
+ double m_nRate2;
+ double m_nRateGap;
+
+public:
+
+ BorderWidthImpl( sal_uInt16 nFlags = CHANGE_LINE1, double nRate1 = 0.0,
+ double nRate2 = 0.0, double nRateGap = 0.0 );
+
+ BorderWidthImpl& operator= ( const BorderWidthImpl& r );
+ bool operator== ( const BorderWidthImpl& r ) const;
+
+ long GetLine1 ( long nWidth ) const;
+ long GetLine2( long nWidth ) const;
+ long GetGap( long nWidth ) const;
+
+ long GuessWidth( long nLine1, long nLine2, long nGap );
+
+ bool IsEmpty( ) const { return (0 == m_nRate1) && (0 == m_nRate2); }
+ bool IsDouble( ) const { return (0 != m_nRate1) && (0 != m_nRate2); }
+};
+
+SVT_DLLPUBLIC inline Color sameColor( Color rMain )
+{
+ return rMain;
+}
+
+SVT_DLLPUBLIC inline Color sameDistColor( Color /*rMain*/, Color rDefault )
+{
+ return rDefault;
+}
+
+
+class SVT_DLLPUBLIC LineListBox : public ListBox
+{
+ ImpLineList* pLineList;
+ long m_nWidth;
+ XubString m_sNone;
+
+ VirtualDevice aVirDev;
+ Size aTxtSize;
+ Color aColor;
+ Color maPaintCol;
+ FieldUnit eUnit;
+ FieldUnit eSourceUnit;
+
+ SVT_DLLPRIVATE void ImpGetLine( long nLine1, long nLine2, long nDistance,
+ Color nColor1, Color nColor2, Color nColorDist,
+ sal_uInt16 nStyle, Bitmap& rBmp );
+ using Window::ImplInit;
+ SVT_DLLPRIVATE void ImplInit();
+ sal_Bool UpdatePaintLineColor( void ); // returns sal_True if maPaintCol has changed
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ void UpdateEntries( long nOldWidth );
+ sal_uInt16 GetStylePos( sal_uInt16 nListPos, long nWidth );
+
+public:
+ LineListBox( Window* pParent, WinBits nWinStyle = WB_BORDER );
+ LineListBox( Window* pParent, const ResId& rResId );
+ virtual ~LineListBox();
+
+ /** Set the width in Twips */
+ void SetWidth( long nWidth );
+ void SetNone( const XubString& sNone );
+
+ using ListBox::InsertEntry;
+ virtual sal_uInt16 InsertEntry( const XubString& rStr, sal_uInt16 nPos = LISTBOX_APPEND );
+ /** Insert a listbox entry with all widths in Twips. */
+ void InsertEntry( BorderWidthImpl aWidthImpl,
+ sal_uInt16 nStyle, long nMinWidth = 0,
+ Color (*pColor1Fn)(Color) = &sameColor,
+ Color (*pColor2Fn)( Color ) = &sameColor,
+ Color (*pColorDistFn)( Color, Color ) = &sameDistColor );
+
+ using ListBox::RemoveEntry;
+ virtual void RemoveEntry( sal_uInt16 nPos );
+ virtual void Clear();
+
+ using ListBox::GetEntryPos;
+ virtual sal_uInt16 GetEntryPos( sal_uInt16 nStyle = STYLE_SOLID ) const;
+ sal_uInt16 GetEntryStyle( sal_uInt16 nPos ) const;
+
+ void SelectEntry( const XubString& rStr, sal_Bool bSelect = sal_True ) { ListBox::SelectEntry( rStr, bSelect ); }
+ void SelectEntry( sal_uInt16 nStyle = STYLE_SOLID, sal_Bool bSelect = sal_True );
+ sal_uInt16 GetSelectEntryStyle( sal_uInt16 nSelIndex = 0 ) const;
+ inline sal_Bool IsEntrySelected( const XubString& rStr ) const { return ListBox::IsEntrySelected( rStr ); }
+ sal_Bool IsEntrySelected( sal_uInt16 nStyle1 = STYLE_SOLID ) const;
+
+ inline void SetUnit( FieldUnit eNewUnit ) { eUnit = eNewUnit; }
+ inline FieldUnit GetUnit() const { return eUnit; }
+ inline void SetSourceUnit( FieldUnit eNewUnit ) { eSourceUnit = eNewUnit; }
+ inline FieldUnit GetSourceUnit() const { return eSourceUnit; }
+
+ void SetColor( const Color& rColor );
+ inline Color GetColor( void ) const;
+
+protected:
+
+ inline const Color& GetPaintColor( void ) const;
+ Color GetColorLine1( sal_uInt16 nPos = 0 );
+ Color GetColorLine2( sal_uInt16 nPos = 0 );
+ Color GetColorDist( sal_uInt16 nPos = 0 );
+
+private:
+ // declared as private because some compilers would generate the default methods
+ LineListBox( const LineListBox& );
+ LineListBox& operator =( const LineListBox& );
+ void SetEntryData( sal_uInt16 nPos, void* pNewData );
+ void* GetEntryData( sal_uInt16 nPos ) const;
+};
+
+inline sal_Bool LineListBox::IsEntrySelected( sal_uInt16 nStyle ) const
+{
+ sal_uInt16 nPos = GetEntryPos( nStyle );
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ return IsEntryPosSelected( nPos );
+ else
+ return sal_False;
+}
+
+inline void LineListBox::SetColor( const Color& rColor )
+{
+ aColor = rColor;
+
+ UpdateEntries( m_nWidth );
+}
+
+inline Color LineListBox::GetColor( void ) const
+{
+ return aColor;
+}
+
+const Color& LineListBox::GetPaintColor( void ) const
+{
+ return maPaintCol;
+}
+
+inline void LineListBox::SetWidth( long nWidth )
+{
+ long nOldWidth = m_nWidth;
+ m_nWidth = nWidth;
+ UpdateEntries( nOldWidth );
+}
+
+inline void LineListBox::SetNone( const XubString& sNone )
+{
+ m_sNone = sNone;
+}
+
+// ---------------
+// - FontNameBox -
+// ---------------
+
+class SVT_DLLPUBLIC FontNameBox : public ComboBox
+{
+private:
+ ImplFontList* mpFontList;
+ sal_Bool mbWYSIWYG;
+ String maFontMRUEntriesFile;
+
+#ifdef _CTRLBOX_CXX
+ SVT_DLLPRIVATE void ImplCalcUserItemSize();
+ SVT_DLLPRIVATE void ImplDestroyFontList();
+#endif
+
+protected:
+ void LoadMRUEntries( const String& aFontMRUEntriesFile, sal_Unicode cSep = ';' );
+ void SaveMRUEntries( const String& aFontMRUEntriesFile, sal_Unicode cSep = ';' ) const;
+public:
+ FontNameBox( Window* pParent,
+ WinBits nWinStyle = WB_SORT );
+ FontNameBox( Window* pParent, const ResId& rResId );
+ virtual ~FontNameBox();
+
+ virtual void UserDraw( const UserDrawEvent& rUDEvt );
+
+ void Fill( const FontList* pList );
+
+ void EnableWYSIWYG( sal_Bool bEnable = sal_True );
+ sal_Bool IsWYSIWYGEnabled() const { return mbWYSIWYG; }
+
+private:
+ void InitFontMRUEntriesFile();
+
+ // declared as private because some compilers would generate the default functions
+ FontNameBox( const FontNameBox& );
+ FontNameBox& operator =( const FontNameBox& );
+};
+
+// ----------------
+// - FontStyleBox -
+// ----------------
+
+class SVT_DLLPUBLIC FontStyleBox : public ComboBox
+{
+ XubString aLastStyle;
+
+private:
+ using ComboBox::SetText;
+public:
+ FontStyleBox( Window* pParent, const ResId& rResId );
+ FontStyleBox( Window* pParent, WinBits nBits );
+ virtual ~FontStyleBox();
+
+ virtual void Select();
+ virtual void LoseFocus();
+ virtual void Modify();
+
+ void SetText( const OUString& rText );
+ void Fill( const XubString& rName, const FontList* pList );
+
+private:
+ // declared as private because some compilers would generate the default functions
+ FontStyleBox( const FontStyleBox& );
+ FontStyleBox& operator =( const FontStyleBox& );
+};
+
+inline void FontStyleBox::SetText( const OUString& rText )
+{
+ aLastStyle = rText;
+ ComboBox::SetText( rText );
+}
+
+// ---------------
+// - FontSizeBox -
+// ---------------
+
+class SVT_DLLPUBLIC FontSizeBox : public MetricBox
+{
+ FontInfo aFontInfo;
+ const FontList* pFontList;
+ sal_uInt16 nRelMin;
+ sal_uInt16 nRelMax;
+ sal_uInt16 nRelStep;
+ short nPtRelMin;
+ short nPtRelMax;
+ short nPtRelStep;
+ sal_Bool bRelativeMode:1,
+ bRelative:1,
+ bPtRelative:1,
+ bStdSize:1;
+
+#ifdef _CTRLBOX_CXX
+ using Window::ImplInit;
+ SVT_DLLPRIVATE void ImplInit();
+#endif
+
+protected:
+ virtual OUString CreateFieldText( sal_Int64 nValue ) const;
+
+public:
+ FontSizeBox( Window* pParent, WinBits nWinStyle = 0 );
+ FontSizeBox( Window* pParent, const ResId& rResId );
+ virtual ~FontSizeBox();
+
+ void Reformat();
+ void Modify();
+
+ void Fill( const FontInfo* pInfo, const FontList* pList );
+
+ void EnableRelativeMode( sal_uInt16 nMin = 50, sal_uInt16 nMax = 150,
+ sal_uInt16 nStep = 5 );
+ void EnablePtRelativeMode( short nMin = -200, short nMax = 200,
+ short nStep = 10 );
+ sal_Bool IsRelativeMode() const { return bRelativeMode; }
+ void SetRelative( sal_Bool bRelative = sal_False );
+ sal_Bool IsRelative() const { return bRelative; }
+ void SetPtRelative( sal_Bool bPtRel = sal_True )
+ { bPtRelative = bPtRel; SetRelative( sal_True ); }
+ sal_Bool IsPtRelative() const { return bPtRelative; }
+
+ virtual void SetValue( sal_Int64 nNewValue, FieldUnit eInUnit );
+ virtual void SetValue( sal_Int64 nNewValue );
+ virtual sal_Int64 GetValue( FieldUnit eOutUnit ) const;
+ virtual sal_Int64 GetValue() const;
+ sal_Int64 GetValue( sal_uInt16 nPos, FieldUnit eOutUnit ) const;
+
+private:
+ // declared as private because some compilers would generate the default functions
+ FontSizeBox( const FontSizeBox& );
+ FontSizeBox& operator =( const FontSizeBox& );
+};
+
+#endif // _CTRLBOX_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/ctrltool.hxx b/include/svtools/ctrltool.hxx
new file mode 100644
index 000000000000..b90f1b67a532
--- /dev/null
+++ b/include/svtools/ctrltool.hxx
@@ -0,0 +1,241 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CTRLTOOL_HXX
+#define _CTRLTOOL_HXX
+
+#include <boost/ptr_container/ptr_vector.hpp>
+
+#include "svtools/svtdllapi.h"
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+#include <vcl/metric.hxx>
+
+class ImplFontListNameInfo;
+class OutputDevice;
+
+/*************************************************************************
+
+Beschreibung
+============
+
+class FontList
+
+Diese Klasse verwaltet alle Fonts, die auf einem oder zwei Ausgabegeraeten
+dargestellt werden koennen. Zusaetzlich bietet die Klasse Methoden an, um
+aus Fett und Kursiv den StyleName zu generieren oder aus einem Stylename
+die fehlenden Attribute. Zusaetzlich kann diese Klasse syntetisch nachgebildete
+Fonts verarbeiten. Diese Klasse kann mit verschiedenen Standard-Controls und
+Standard-Menus zusammenarbeiten.
+
+Querverweise
+
+class FontNameBox, class FontStyleBox, class FontSizeBox,
+class FontNameMenu, class FontSizeMenu
+
+--------------------------------------------------------------------------
+
+FontList::FontList( OutputDevice* pDevice, OutputDevice* pDevice2 = NULL,
+ sal_Bool bAll = sal_True );
+
+Konstruktor der Klasse FontList. Vom uebergebenen OutputDevice werden die
+entsprechenden Fonts abgefragt. Das OutputDevice muss solange existieren,
+wie auch die Klasse FontList existiert. Optional kann noch ein 2tes
+Ausgabedevice uebergeben werden, damit man zum Beispiel die Fonts von
+einem Drucker und dem Bildschirm zusammen in einer FontListe verwalten kann
+und somit auch den FontListen und FontMenus die Fonts von beiden OutputDevices
+zu uebergeben. Auch das pDevice2 muss solange existieren, wie die Klasse
+FontList existiert.
+
+Das OutputDevice, welches als erstes uebergeben wird, sollte das bevorzugte
+sein. Dies sollte im normalfall der Drucker sein. Denn wenn 2 verschiede
+Device-Schriften (eine fuer Drucker und eine fuer den Bildschirm) vorhanden
+sind, wird die vom uebergebenen Device "pDevice" bevorzugt.
+
+Mit dem dritten Parameter kann man angeben, ob nur skalierbare Schriften
+abgefragt werden sollen oder alle. Wenn sal_True uebergeben wird, werden auch
+Bitmap-Schriften mit abgefragt. Bei sal_False werden Vector-Schriften und
+scalierbare Schriften abgefragt.
+
+--------------------------------------------------------------------------
+
+String FontList::GetStyleName( const FontInfo& rInfo ) const;
+
+Diese Methode gibt den StyleName von einer FontInfo zurueck. Falls kein
+StyleName gesetzt ist, wird aus den gesetzten Attributen ein entsprechender
+Name generiert, der dem Anwender praesentiert werden kann.
+
+--------------------------------------------------------------------------
+
+XubString FontList::GetFontMapText( const FontInfo& rInfo ) const;
+
+Diese Methode gibt einen Matchstring zurueck, der dem Anwender
+anzeigen soll, welche Probleme es mit diesem Font geben kann.
+
+--------------------------------------------------------------------------
+
+FontInfo FontList::Get( const String& rName, const String& rStyleName ) const;
+
+Diese Methode sucht aus dem uebergebenen Namen und dem uebergebenen StyleName
+die entsprechende FontInfo-Struktur raus. Der Stylename kann in dieser
+Methode auch ein syntetischer sein. In diesem Fall werden die entsprechenden
+Werte in der FontInfo-Struktur entsprechend gesetzt. Wenn ein StyleName
+uebergeben wird, kann jedoch eine FontInfo-Struktur ohne Stylename
+zurueckgegeben werden. Um den StyleName dem Anwender zu repraesentieren,
+muss GetStyleName() mit dieser FontInfo-Struktur aufgerufen werden.
+
+Querverweise
+
+FontList::GetStyleName()
+
+--------------------------------------------------------------------------
+
+FontInfo FontList::Get( const String& rName, FontWeight eWeight,
+ FontItalic eItalic ) const;
+
+Diese Methode sucht aus dem uebergebenen Namen und den uebergebenen Styles
+die entsprechende FontInfo-Struktur raus. Diese Methode kann auch eine
+FontInfo-Struktur ohne Stylename zurueckgegeben. Um den StyleName dem
+Anwender zu repraesentieren, muss GetStyleName() mit dieser FontInfo-Struktur
+aufgerufen werden.
+
+Querverweise
+
+FontList::GetStyleName()
+
+--------------------------------------------------------------------------
+
+const long* FontList::GetSizeAry( const FontInfo& rInfo ) const;
+
+Diese Methode liefert zum uebergebenen Font die vorhandenen Groessen.
+Falls es sich dabei um einen skalierbaren Font handelt, werden Standard-
+Groessen zurueckgegeben. Das Array enthaelt die Hoehen des Fonts in 10tel
+Point. Der letzte Wert des Array ist 0. Das Array, was zurueckgegeben wird,
+wird von der FontList wieder zerstoert. Nach dem Aufruf der naechsten Methode
+von der FontList, sollte deshalb das Array nicht mehr referenziert werden.
+
+*************************************************************************/
+
+// ------------
+// - FontList -
+// ------------
+
+#define FONTLIST_FONTINFO_NOTFOUND ((sal_uInt16)0xFFFF)
+
+#define FONTLIST_FONTNAMETYPE_PRINTER ((sal_uInt16)0x0001)
+#define FONTLIST_FONTNAMETYPE_SCREEN ((sal_uInt16)0x0002)
+
+class SVT_DLLPUBLIC FontList
+{
+private:
+ OUString maMapBoth;
+ OUString maMapPrinterOnly;
+ OUString maMapScreenOnly;
+ OUString maMapSizeNotAvailable;
+ OUString maMapStyleNotAvailable;
+ OUString maMapNotAvailable;
+ OUString maLight;
+ OUString maLightItalic;
+ OUString maNormal;
+ OUString maNormalItalic;
+ OUString maBold;
+ OUString maBoldItalic;
+ OUString maBlack;
+ OUString maBlackItalic;
+ long* mpSizeAry;
+ OutputDevice* mpDev;
+ OutputDevice* mpDev2;
+ boost::ptr_vector<ImplFontListNameInfo> maEntries;
+#ifdef CTRLTOOL_CXX
+ SVT_DLLPRIVATE ImplFontListNameInfo* ImplFind( const OUString& rSearchName, sal_uLong* pIndex ) const;
+ SVT_DLLPRIVATE ImplFontListNameInfo* ImplFindByName( const OUString& rStr ) const;
+ SVT_DLLPRIVATE void ImplInsertFonts( OutputDevice* pDev, sal_Bool bAll,
+ sal_Bool bInsertData );
+#endif
+
+public:
+ FontList( OutputDevice* pDevice,
+ OutputDevice* pDevice2 = NULL,
+ sal_Bool bAll = sal_True );
+ ~FontList();
+
+ FontList* Clone() const;
+
+ OutputDevice* GetDevice() const { return mpDev; }
+ OutputDevice* GetDevice2() const { return mpDev2; }
+ XubString GetFontMapText( const FontInfo& rInfo ) const;
+
+ const OUString& GetNormalStr() const { return maNormal; }
+ const OUString& GetItalicStr() const { return maNormalItalic; }
+ const OUString& GetBoldStr() const { return maBold; }
+ const OUString& GetBoldItalicStr() const { return maBoldItalic; }
+ const OUString& GetStyleName( FontWeight eWeight, FontItalic eItalic ) const;
+ OUString GetStyleName( const FontInfo& rInfo ) const;
+
+ FontInfo Get( const OUString& rName,
+ const OUString& rStyleName ) const;
+ FontInfo Get( const OUString& rName,
+ FontWeight eWeight,
+ FontItalic eItalic ) const;
+
+ sal_Bool IsAvailable( const OUString& rName ) const;
+ sal_uInt16 GetFontNameCount() const
+ {
+ return (sal_uInt16)maEntries.size();
+ }
+ const FontInfo& GetFontName( sal_uInt16 nFont ) const;
+ sal_Handle GetFirstFontInfo( const OUString& rName ) const;
+ sal_Handle GetNextFontInfo( sal_Handle hFontInfo ) const;
+ const FontInfo& GetFontInfo( sal_Handle hFontInfo ) const;
+
+ const long* GetSizeAry( const FontInfo& rInfo ) const;
+ static const long* GetStdSizeAry();
+
+private:
+ FontList( const FontList& );
+ FontList& operator =( const FontList& );
+};
+
+
+// -----------------
+// - FontSizeNames -
+// -----------------
+
+class SVT_DLLPUBLIC FontSizeNames
+{
+private:
+ const struct ImplFSNameItem* mpArray;
+ sal_uLong mnElem;
+
+public:
+ FontSizeNames( LanguageType eLanguage /* = LANGUAGE_DONTKNOW */ );
+
+ sal_uLong Count() const { return mnElem; }
+ sal_Bool IsEmpty() const { return !mnElem; }
+
+ long Name2Size( const String& ) const;
+ String Size2Name( long ) const;
+
+ String GetIndexName( sal_uLong nIndex ) const;
+ long GetIndexSize( sal_uLong nIndex ) const;
+};
+
+#endif // _CTRLTOOL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/dialogclosedlistener.hxx b/include/svtools/dialogclosedlistener.hxx
new file mode 100644
index 000000000000..afaad3854827
--- /dev/null
+++ b/include/svtools/dialogclosedlistener.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVTOOLS_DIALOGCLOSEDLISTENER_HXX
+#define _SVTOOLS_DIALOGCLOSEDLISTENER_HXX
+
+#include "svtools/svtdllapi.h"
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/ui/dialogs/XDialogClosedListener.hpp>
+#include <tools/link.hxx>
+
+//.........................................................................
+namespace svt
+{
+//.........................................................................
+
+ //=====================================================================
+ //= ODialogClosedListener
+ //=====================================================================
+ /**
+ C++ class to implement a ::com::sun::star::ui::dialogs::XDialogClosedListener
+ */
+ class SVT_DLLPUBLIC DialogClosedListener :
+ public ::cppu::WeakImplHelper1< ::com::sun::star::ui::dialogs::XDialogClosedListener >
+ {
+ private:
+ /**
+ This link will be called when the dialog was closed.
+
+ The link must have the type:
+ DECL_LINK( DialogClosedHdl, ::com::sun::star::ui::dialogs::DialogClosedEvent* );
+ */
+ Link m_aDialogClosedLink;
+
+ public:
+ DialogClosedListener();
+
+ inline void SetDialogClosedLink( const Link& rLink ) { m_aDialogClosedLink = rLink; }
+
+ // XDialogClosedListener methods
+ virtual void SAL_CALL dialogClosed( const ::com::sun::star::ui::dialogs::DialogClosedEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XEventListener methods
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw( ::com::sun::star::uno::RuntimeException );
+ };
+
+//.........................................................................
+} // namespace svt
+//.........................................................................
+
+#endif// COMPHELPER_DIALOGCLOSEDLISTENER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/dialogcontrolling.hxx b/include/svtools/dialogcontrolling.hxx
new file mode 100644
index 000000000000..56d31d4e7161
--- /dev/null
+++ b/include/svtools/dialogcontrolling.hxx
@@ -0,0 +1,293 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVTOOLS_DIALOGCONTROLLING_HXX
+#define SVTOOLS_DIALOGCONTROLLING_HXX
+
+#include <svtools/svtdllapi.h>
+
+#include <tools/link.hxx>
+#include <vcl/button.hxx>
+
+#include <vector>
+#include <boost/shared_ptr.hpp>
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ //=====================================================================
+ //= IWindowOperator
+ //=====================================================================
+ /** an abstract interface for operating on a ->Window
+ */
+ class SVT_DLLPUBLIC SAL_NO_VTABLE IWindowOperator
+ {
+ public:
+ /** called when an event happened which should be reacted to
+
+ @param _rTrigger
+ the event which triggered the call. If the Id of the event is 0, then this is the initial
+ call which is made when ->_rOperateOn is added to the responsibility of the DialogController.
+ @param _rOperateOn
+ the window on which to operate
+ */
+ virtual void operateOn( const VclWindowEvent& _rTrigger, Window& _rOperateOn ) const = 0;
+
+ virtual ~IWindowOperator();
+ };
+ typedef ::boost::shared_ptr< IWindowOperator > PWindowOperator;
+
+ //=====================================================================
+ //= IWindowEventFilter
+ //=====================================================================
+ /** an abstract interface for deciding whether a ->VclWindowEvent
+ is worth paying attention to
+ */
+ class SVT_DLLPUBLIC SAL_NO_VTABLE IWindowEventFilter
+ {
+ public:
+ virtual bool payAttentionTo( const VclWindowEvent& _rEvent ) const = 0;
+
+ virtual ~IWindowEventFilter();
+ };
+ typedef ::boost::shared_ptr< IWindowEventFilter > PWindowEventFilter;
+
+ //=====================================================================
+ //= DialogController
+ //=====================================================================
+ struct DialogController_Data;
+ /** a class controlling interactions between dialog controls
+
+ An instance of this class listens to all events fired by a certain
+ ->Control (more precise, a ->Window), the so-called instigator.
+
+ Additionally, the ->DialogController maintains a list of windows which
+ are affected by changes in the instigator window. Let's call those the
+ dependent windows.
+
+ Now, by help of an owner-provided ->IWindowEventFilter, the ->DialogController
+ decides which events are worth attention. By help of an owner-provided
+ ->IWindowOperator, it handles those events for all dependent windows.
+ */
+ class SVT_DLLPUBLIC DialogController
+ {
+ private:
+ ::std::auto_ptr< DialogController_Data > m_pImpl;
+
+ public:
+ DialogController( Window& _rInstigator, const PWindowEventFilter& _pEventFilter, const PWindowOperator& _pOperator );
+ virtual ~DialogController();
+
+ /** adds a window to the list of dependent windows
+
+ @param _rWindow
+ The window to add to the list of dependent windows.
+
+ The caller is responsible for life-time control: The given window
+ must live at least as long as the ->DialogController instance does.
+ */
+ void addDependentWindow( Window& _rWindow );
+
+ /** resets the controller so that no actions happened anymore.
+
+ The instances is disfunctional after this method has been called.
+ */
+ void reset();
+
+ private:
+ void impl_Init();
+ void impl_updateAll( const VclWindowEvent& _rTriggerEvent );
+ void impl_update( const VclWindowEvent& _rTriggerEvent, Window& _rWindow );
+
+ DECL_LINK( OnWindowEvent, const VclWindowEvent* );
+
+ private:
+ DialogController( const DialogController& ); // never implemented
+ DialogController& operator=( const DialogController& ); // never implemented
+ };
+ typedef ::boost::shared_ptr< DialogController > PDialogController;
+
+ //=====================================================================
+ //= ControlDependencyManager
+ //=====================================================================
+ struct ControlDependencyManager_Data;
+ /** helper class for managing control dependencies
+
+ Instances of this class are intended to be held as members of a dialog/tabpage/whatever
+ class, with easy administration of inter-control dependencies (such as "Enable
+ control X if and only if checkbox Y is checked).
+ */
+ class SVT_DLLPUBLIC ControlDependencyManager
+ {
+ private:
+ ::std::auto_ptr< ControlDependencyManager_Data > m_pImpl;
+
+ public:
+ ControlDependencyManager();
+ ~ControlDependencyManager();
+
+ /** clears all dialog controllers previously added to the manager
+ */
+ void clear();
+
+ /** ensures that a given window is enabled or disabled, according to the check state
+ of a given radio button
+ @param _rRadio
+ denotes the radio button whose check state is to observe
+ @param _rDependentWindow
+ denotes the window which should be enabled when ->_rRadio is checked, and
+ disabled when it's unchecked
+ */
+ void enableOnRadioCheck( RadioButton& _rRadio, Window& _rDependentWindow );
+ void enableOnRadioCheck( RadioButton& _rRadio, Window& _rDependentWindow1, Window& _rDependentWindow2, Window& _rDependentWindow3 );
+ void enableOnRadioCheck( RadioButton& _rRadio, Window& _rDependentWindow1, Window& _rDependentWindow2, Window& _rDependentWindow3, Window& _rDependentWindow4, Window& _rDependentWindow5 );
+
+ /** ensures that a given window is enabled or disabled, according to the mark state
+ of a given check box
+ @param _rBox
+ denotes the check box whose mark state is to observe
+ @param _rDependentWindow
+ denotes the window which should be enabled when ->_rBox is marked, and
+ disabled when it's unmarked
+ */
+ void enableOnCheckMark( CheckBox& _rBox, Window& _rDependentWindow );
+ void enableOnCheckMark( CheckBox& _rBox, Window& _rDependentWindow1, Window& _rDependentWindow2 );
+ void enableOnCheckMark( CheckBox& _rBox, Window& _rDependentWindow1, Window& _rDependentWindow2, Window& _rDependentWindow3, Window& _rDependentWindow4 );
+
+ /** adds a non-standard controller whose functionality is not covered by the other methods
+
+ @param _pController
+ the controller to add to the manager. Must not be <NULL/>.
+ */
+ void addController( const PDialogController& _pController );
+
+ private:
+ ControlDependencyManager( const ControlDependencyManager& ); // never implemented
+ ControlDependencyManager& operator=( const ControlDependencyManager& ); // never implemented
+ };
+
+ //=====================================================================
+ //= EnableOnCheck
+ //=====================================================================
+ /** a helper class implementing the ->IWindowOperator interface,
+ which enables a dependent window depending on the check state of
+ an instigator window.
+
+ @see DialogController
+ */
+ template< class CHECKABLE >
+ class SVT_DLLPUBLIC EnableOnCheck : public IWindowOperator
+ {
+ public:
+ typedef CHECKABLE SourceType;
+
+ private:
+ SourceType& m_rCheckable;
+
+ public:
+ /** constructs the instance
+
+ @param _rCheckable
+ a ->Window instance which supports a boolean method IsChecked. Usually
+ a ->RadioButton or ->CheckBox
+ */
+ EnableOnCheck( SourceType& _rCheckable )
+ :m_rCheckable( _rCheckable )
+ {
+ }
+
+ virtual void operateOn( const VclWindowEvent& /*_rTrigger*/, Window& _rOperateOn ) const
+ {
+ _rOperateOn.Enable( m_rCheckable.IsChecked() );
+ }
+ };
+
+ //=====================================================================
+ //= FilterForRadioOrCheckToggle
+ //=====================================================================
+ /** a helper class implementing the ->IWindowEventFilter interface,
+ which filters for radio buttons or check boxes being toggled.
+
+ Technically, the class simply filters for the ->VCLEVENT_RADIOBUTTON_TOGGLE
+ and the ->VCLEVENT_CHECKBOX_TOGGLE event.
+ */
+ class SVT_DLLPUBLIC FilterForRadioOrCheckToggle : public IWindowEventFilter
+ {
+ const Window& m_rWindow;
+ public:
+ FilterForRadioOrCheckToggle( const Window& _rWindow )
+ :m_rWindow( _rWindow )
+ {
+ }
+
+ bool payAttentionTo( const VclWindowEvent& _rEvent ) const
+ {
+ if ( ( _rEvent.GetWindow() == &m_rWindow )
+ && ( ( _rEvent.GetId() == VCLEVENT_RADIOBUTTON_TOGGLE )
+ || ( _rEvent.GetId() == VCLEVENT_CHECKBOX_TOGGLE )
+ )
+ )
+ return true;
+ return false;
+ }
+ };
+
+ //=====================================================================
+ //= RadioDependentEnabler
+ //=====================================================================
+ /** a ->DialogController derivee which enables or disables its dependent windows,
+ depending on the check state of a radio button.
+
+ The usage of this class is as simple as
+ <code>
+ pController = new RadioDependentEnabler( m_aOptionSelectSomething );
+ pController->addDependentWindow( m_aLabelSelection );
+ pController->addDependentWindow( m_aListSelection );
+ </code>
+
+ With this, both <code>m_aLabelSelection</code> and <code>m_aListSelection</code> will
+ be disabled if and only <code>m_aOptionSelectSomething</code> is checked.
+ */
+ class SVT_DLLPUBLIC RadioDependentEnabler : public DialogController
+ {
+ public:
+ RadioDependentEnabler( RadioButton& _rButton )
+ :DialogController( _rButton,
+ PWindowEventFilter( new FilterForRadioOrCheckToggle( _rButton ) ),
+ PWindowOperator( new EnableOnCheck< RadioButton >( _rButton ) ) )
+ {
+ }
+
+ RadioDependentEnabler( CheckBox& _rBox )
+ :DialogController( _rBox,
+ PWindowEventFilter( new FilterForRadioOrCheckToggle( _rBox ) ),
+ PWindowOperator( new EnableOnCheck< CheckBox >( _rBox ) ) )
+ {
+ }
+ };
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // SVTOOLS_DIALOGCONTROLLING_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/editbrowsebox.hxx b/include/svtools/editbrowsebox.hxx
new file mode 100644
index 000000000000..c9299d363c0a
--- /dev/null
+++ b/include/svtools/editbrowsebox.hxx
@@ -0,0 +1,685 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVTOOLS_EDITBROWSEBOX_HXX_
+#define _SVTOOLS_EDITBROWSEBOX_HXX_
+#define SVTOOLS_IN_EDITBROWSEBOX_HXX
+
+#include "svtools/svtdllapi.h"
+#include <tools/ref.hxx>
+#include <tools/rtti.hxx>
+#include <vcl/window.hxx>
+#include <vcl/combobox.hxx>
+#include <vcl/lstbox.hxx>
+
+#include <vcl/button.hxx>
+#include <svtools/brwbox.hxx>
+#include <vcl/timer.hxx>
+#include <svtools/brwhead.hxx>
+#include <svtools/svmedit.hxx>
+#include <vcl/svapp.hxx>
+
+//==================================================================
+// EditBrowseBoxFlags (EBBF)
+
+#define EBBF_NONE ((sal_Int32)0x0000)
+/** if this bit is _not_ set, the handle column will be invalidated upon
+ changing the row in the browse box. This is for forcing the row picture to
+ be repainted. If you do not have row pictures or text, you don't need this
+ invalidation, then you would specify this bit to prevent flicker
+*/
+#define EBBF_NO_HANDLE_COLUMN_CONTENT ((sal_Int32)0x0001)
+/** set this bit to activate the cell on a MouseButtonDown, not a MouseButtonUp event
+ */
+#define EBBF_ACTIVATE_ON_BUTTONDOWN ((sal_Int32)0x0002)
+/** if this bit is set and EBBF_NO_HANDLE_COLUMN_CONTENT is _not_ set, the handle
+ column is drawn with the text contained in column 0 instead of an image
+*/
+#define EBBF_HANDLE_COLUMN_TEXT ((sal_Int32)0x0004)
+
+/** If this bit is set, tab traveling is somewhat modified<br/>
+ If the control gets the focus because the user pressed the TAB key, then the
+ first or last cell (depending on whether the traveling was cycling forward or backward)
+ gets activated.
+ @see Window::GetGetFocusFlags
+ @see GETFOCUS_*
+*/
+#define EBBF_SMART_TAB_TRAVEL ((sal_Int32)0x0008)
+
+/// @deprecated
+#define EBBF_NOROWPICTURE EBBF_NO_HANDLE_COLUMN_CONTENT
+
+//==================================================================
+
+class Edit;
+class SpinField;
+class FormattedField;
+
+// .......................................................................
+namespace svt
+{
+// .......................................................................
+
+ class CellControllerRef;
+
+ //==================================================================
+ //= CellController
+ //==================================================================
+ class SVT_DLLPUBLIC CellController : public SvRefBase
+ {
+ friend class EditBrowseBox;
+
+ protected:
+ Control* pWindow;
+ sal_Bool bSuspended; // <sal_True> if the window is hidden and disabled
+
+ public:
+ TYPEINFO();
+
+ CellController(Control* pW);
+ virtual ~CellController();
+
+ Control& GetWindow() const { return *const_cast< CellController* >( this )->pWindow; }
+
+ virtual void SetModified();
+ virtual void ClearModified() = 0;
+ virtual sal_Bool IsModified() const = 0;
+
+ // commit any current changes. Especially, do any reformatting you need (from input formatting
+ // to output formatting) here
+ virtual void CommitModifications();
+
+ // suspending the controller is not culmulative!
+ void suspend( );
+ void resume( );
+ inline sal_Bool isSuspended( ) const { return bSuspended; }
+
+ protected:
+ virtual sal_Bool MoveAllowed(const KeyEvent& rEvt) const;
+ virtual void SetModifyHdl(const Link& rLink) = 0;
+ virtual sal_Bool WantMouseEvent() const;
+ };
+
+ SV_DECL_IMPL_REF(CellController);
+
+ //==================================================================
+ //= IEditImplementation
+ //==================================================================
+ class SVT_DLLPUBLIC IEditImplementation
+ {
+ public:
+ virtual ~IEditImplementation() = 0;
+
+ virtual Control& GetControl() = 0;
+
+ virtual String GetText( LineEnd aSeparator ) const = 0;
+ virtual void SetText( const OUString& _rStr ) = 0;
+
+ virtual sal_Bool IsReadOnly() const = 0;
+ virtual void SetReadOnly( sal_Bool bReadOnly ) = 0;
+
+ virtual xub_StrLen GetMaxTextLen() const = 0;
+ virtual void SetMaxTextLen( xub_StrLen _nMaxLen ) = 0;
+
+ virtual Selection GetSelection() const = 0;
+ virtual void SetSelection( const Selection& _rSelection ) = 0;
+
+ virtual void ReplaceSelected( const String& _rStr ) = 0;
+ virtual void DeleteSelected() = 0;
+ virtual String GetSelected( LineEnd aSeparator ) const = 0;
+
+ virtual void SetModified() = 0;
+ virtual sal_Bool IsModified() const = 0;
+ virtual void ClearModified() = 0;
+ virtual void SetModifyHdl( const Link& _rLink ) = 0;
+ };
+
+ //==================================================================
+ //= GenericEditImplementation
+ //==================================================================
+ template <class EDIT>
+ class GenericEditImplementation : public IEditImplementation
+ {
+ EDIT& m_rEdit;
+ public:
+ GenericEditImplementation( EDIT& _rEdit );
+
+ EDIT& GetEditWindow() { return static_cast< EDIT& >( GetControl() ); }
+
+ virtual Control& GetControl();
+
+ virtual String GetText( LineEnd aSeparator ) const;
+ virtual void SetText( const OUString& _rStr );
+
+ virtual sal_Bool IsReadOnly() const;
+ virtual void SetReadOnly( sal_Bool bReadOnly );
+
+ virtual xub_StrLen GetMaxTextLen() const;
+ virtual void SetMaxTextLen( xub_StrLen _nMaxLen );
+
+ virtual Selection GetSelection() const;
+ virtual void SetSelection( const Selection& _rSelection );
+
+ virtual void ReplaceSelected( const String& _rStr );
+ virtual void DeleteSelected();
+ virtual String GetSelected( LineEnd aSeparator ) const;
+
+ virtual void SetModified();
+ virtual sal_Bool IsModified() const;
+ virtual void ClearModified();
+ virtual void SetModifyHdl( const Link& _rLink );
+ };
+
+ #include <svtools/editimplementation.hxx>
+
+ //==================================================================
+ //= MultiLineTextCell
+ //==================================================================
+ /** a multi line edit which can be used in a cell of a EditBrowseBox
+ */
+ class SVT_DLLPUBLIC MultiLineTextCell : public MultiLineEdit
+ {
+ public:
+ MultiLineTextCell( Window* _pParent, WinBits _nStyle )
+ :MultiLineEdit( _pParent, _nStyle )
+ {
+ }
+
+ protected:
+ // Window overridables
+ virtual long PreNotify( NotifyEvent& rNEvt );
+
+ // MultiLineEdit overridables
+ virtual void Modify();
+
+ private:
+ sal_Bool dispatchKeyEvent( const KeyEvent& _rEvent );
+ };
+
+ //==================================================================
+ //= concrete edit implementations
+ //==================================================================
+ typedef GenericEditImplementation< Edit > EditImplementation;
+
+ typedef GenericEditImplementation< MultiLineTextCell > MultiLineEditImplementation_Base;
+ class SVT_DLLPUBLIC MultiLineEditImplementation : public MultiLineEditImplementation_Base
+ {
+ public:
+ MultiLineEditImplementation( MultiLineTextCell& _rEdit ) : MultiLineEditImplementation_Base( _rEdit )
+ {
+ }
+
+ virtual String GetText( LineEnd aSeparator ) const;
+ virtual String GetSelected( LineEnd aSeparator ) const;
+ };
+
+ //==================================================================
+ //= EditCellController
+ //==================================================================
+ class SVT_DLLPUBLIC EditCellController : public CellController
+ {
+ IEditImplementation* m_pEditImplementation;
+ sal_Bool m_bOwnImplementation; // did we create m_pEditImplementation?
+
+ public:
+ TYPEINFO();
+ EditCellController( Edit* _pEdit );
+ EditCellController( IEditImplementation* _pImplementation );
+ ~EditCellController( );
+
+ const IEditImplementation* GetEditImplementation( ) const { return m_pEditImplementation; }
+ IEditImplementation* GetEditImplementation( ) { return m_pEditImplementation; }
+
+ virtual void SetModified();
+ virtual sal_Bool IsModified() const;
+ virtual void ClearModified();
+
+ protected:
+ virtual sal_Bool MoveAllowed(const KeyEvent& rEvt) const;
+ virtual void SetModifyHdl(const Link& rLink);
+ };
+
+ //==================================================================
+ //= SpinCellController
+ //==================================================================
+ class SVT_DLLPUBLIC SpinCellController : public CellController
+ {
+ public:
+ TYPEINFO();
+ SpinCellController(SpinField* pSpinField);
+ SpinField& GetSpinWindow() const {return (SpinField &)GetWindow();}
+
+ virtual void SetModified();
+ virtual sal_Bool IsModified() const;
+ virtual void ClearModified();
+
+ protected:
+ virtual sal_Bool MoveAllowed(const KeyEvent& rEvt) const;
+ virtual void SetModifyHdl(const Link& rLink);
+ };
+
+ //==================================================================
+ //= CheckBoxControl
+ //==================================================================
+ class SVT_DLLPUBLIC CheckBoxControl : public Control
+ {
+ CheckBox* pBox;
+ Rectangle aFocusRect;
+ Link m_aClickLink,m_aModifyLink;
+
+ public:
+ CheckBoxControl(Window* pParent, WinBits nWinStyle = 0);
+ ~CheckBoxControl();
+
+ virtual void GetFocus();
+ virtual long PreNotify(NotifyEvent& rEvt);
+ virtual void Paint(const Rectangle& rClientRect);
+ virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags );
+ virtual void StateChanged( StateChangedType nStateChange );
+ virtual void DataChanged( const DataChangedEvent& _rEvent );
+ virtual void Resize();
+
+ void SetClickHdl(const Link& rHdl) {m_aClickLink = rHdl;}
+ const Link& GetClickHdl() const {return m_aClickLink;}
+
+ void SetModifyHdl(const Link& rHdl) {m_aModifyLink = rHdl;}
+ const Link& GetModifyHdl() const {return m_aModifyLink;}
+
+ CheckBox& GetBox() {return *pBox;};
+
+ private:
+ DECL_LINK( OnClick, void* );
+ };
+
+ //==================================================================
+ //= CheckBoxCellController
+ //==================================================================
+ class SVT_DLLPUBLIC CheckBoxCellController : public CellController
+ {
+ public:
+ TYPEINFO();
+
+ CheckBoxCellController(CheckBoxControl* pWin):CellController(pWin){}
+ CheckBox& GetCheckBox() const;
+
+ virtual sal_Bool IsModified() const;
+ virtual void ClearModified();
+
+ protected:
+ virtual void SetModifyHdl(const Link& rLink);
+ virtual sal_Bool WantMouseEvent() const;
+ };
+
+ //==================================================================
+ //= ComboBoxControl
+ //==================================================================
+ class SVT_DLLPUBLIC ComboBoxControl : public ComboBox
+ {
+ friend class ComboBoxCellController;
+
+ public:
+ ComboBoxControl(Window* pParent, WinBits nWinStyle = 0);
+
+ protected:
+ virtual long PreNotify( NotifyEvent& rNEvt );
+ };
+
+ //==================================================================
+ //= ComboBoxCellController
+ //==================================================================
+ class SVT_DLLPUBLIC ComboBoxCellController : public CellController
+ {
+ public:
+ TYPEINFO();
+
+ ComboBoxCellController(ComboBoxControl* pParent);
+ ComboBoxControl& GetComboBox() const {return (ComboBoxControl &)GetWindow();}
+
+ virtual sal_Bool IsModified() const;
+ virtual void ClearModified();
+
+ protected:
+ virtual sal_Bool MoveAllowed(const KeyEvent& rEvt) const;
+ virtual void SetModifyHdl(const Link& rLink);
+ };
+
+ //==================================================================
+ //= ListBoxControl
+ //==================================================================
+ class SVT_DLLPUBLIC ListBoxControl : public ListBox
+ {
+ friend class ListBoxCellController;
+
+ public:
+ ListBoxControl(Window* pParent, WinBits nWinStyle = 0);
+
+ protected:
+ virtual long PreNotify( NotifyEvent& rNEvt );
+ };
+
+ //==================================================================
+ //= ListBoxCellController
+ //==================================================================
+ class SVT_DLLPUBLIC ListBoxCellController : public CellController
+ {
+ public:
+ TYPEINFO();
+
+ ListBoxCellController(ListBoxControl* pParent);
+ ListBoxControl& GetListBox() const {return (ListBoxControl &)GetWindow();}
+
+ virtual sal_Bool IsModified() const;
+ virtual void ClearModified();
+
+ protected:
+ virtual sal_Bool MoveAllowed(const KeyEvent& rEvt) const;
+ virtual void SetModifyHdl(const Link& rLink);
+ };
+
+ //==================================================================
+ //= FormattedFieldCellController
+ //==================================================================
+ class SVT_DLLPUBLIC FormattedFieldCellController : public EditCellController
+ {
+ public:
+ TYPEINFO();
+ FormattedFieldCellController( FormattedField* _pFormatted );
+
+ virtual void CommitModifications();
+ };
+
+ //==================================================================
+ //= EditBrowserHeader
+ //==================================================================
+ class SVT_DLLPUBLIC EditBrowserHeader : public BrowserHeader
+ {
+ public:
+ EditBrowserHeader( BrowseBox* pParent, WinBits nWinBits = WB_BUTTONSTYLE )
+ :BrowserHeader(pParent, nWinBits){}
+
+ protected:
+ virtual void DoubleClick();
+ };
+
+ //==================================================================
+ //= EditBrowseBox
+ //==================================================================
+ class EditBrowseBoxImpl;
+ class SVT_DLLPUBLIC EditBrowseBox: public BrowseBox
+ {
+ friend class EditBrowserHeader;
+
+ enum BrowseInfo
+ {
+ COLSELECT = 1,
+ ROWSELECT = 2,
+ ROWCHANGE = 4,
+ COLCHANGE = 8
+ };
+
+ public:
+ enum RowStatus
+ {
+ CLEAN = 0,
+ CURRENT = 1,
+ CURRENTNEW = 2,
+ MODIFIED = 3,
+ NEW = 4,
+ DELETED = 5,
+ PRIMARYKEY = 6,
+ CURRENT_PRIMARYKEY = 7,
+ FILTER = 8,
+ HEADERFOOTER = 9
+ };
+
+ private:
+ // forbid these ones
+ EditBrowseBox(EditBrowseBox&);
+ EditBrowseBox& operator=(EditBrowseBox&);
+
+ class BrowserMouseEventPtr
+ {
+ BrowserMouseEvent* pEvent;
+ sal_Bool bDown;
+
+ public:
+ BrowserMouseEventPtr():pEvent(NULL){}
+ ~BrowserMouseEventPtr(){Clear();}
+
+ sal_Bool Is() const {return pEvent != NULL;}
+ sal_Bool IsDown() const {return bDown;}
+ const BrowserMouseEvent* operator->() const {return pEvent;}
+ const BrowserMouseEvent& operator*() const {return *pEvent;}
+
+ SVT_DLLPUBLIC void Clear();
+ void Set(const BrowserMouseEvent* pEvt, sal_Bool bIsDown);
+ } aMouseEvent;
+
+ const BrowserMouseEvent* pMouseEvent; // is set during a mouse event
+ CellControllerRef aController,
+ aOldController;
+
+ sal_uLong nStartEvent, nEndEvent, nCellModifiedEvent; // event ids
+ Window* m_pFocusWhileRequest;
+ // In ActivateCell, we grab the focus asynchronously, but if between requesting activation
+ // and the asynchornous event the focus has changed, we won't grab it for ourself.
+
+ long nPaintRow; // row beeing painted
+ long nEditRow, nOldEditRow;
+ sal_uInt16 nEditCol, nOldEditCol;
+
+ sal_Bool bHasFocus : 1;
+ mutable sal_Bool bPaintStatus : 1; // paint a status (image) in the handle column
+ sal_Bool bActiveBeforeTracking;
+
+ CheckBoxControl* pCheckBoxPaint;
+
+ sal_Int32 m_nBrowserFlags;
+ ImageList m_aStatusImages;
+ ::std::auto_ptr< EditBrowseBoxImpl> m_aImpl;
+
+ protected:
+ BrowserHeader* pHeader;
+
+ sal_Bool isGetCellFocusPending() const { return nStartEvent != 0; }
+ void cancelGetCellFocus() { if (nStartEvent) Application::RemoveUserEvent(nStartEvent); nStartEvent = 0; }
+ void forceGetCellFocus() { cancelGetCellFocus(); LINK(this, EditBrowseBox, StartEditHdl).Call((void*)NULL); }
+
+ BrowserMouseEventPtr& getMouseEvent() { return aMouseEvent; }
+
+ protected:
+ BrowserHeader* GetHeaderBar() const {return pHeader;}
+
+ virtual BrowserHeader* CreateHeaderBar(BrowseBox* pParent);
+
+ // if you want to have an own header ...
+ virtual BrowserHeader* imp_CreateHeaderBar(BrowseBox* pParent);
+
+ virtual void ColumnMoved(sal_uInt16 nId);
+ virtual void ColumnResized(sal_uInt16 nColId);
+ virtual void Resize();
+ virtual void ArrangeControls(sal_uInt16& nX, sal_uInt16 nY);
+ virtual sal_Bool SeekRow(long nRow);
+
+ virtual void GetFocus();
+ virtual void LoseFocus();
+ virtual void KeyInput(const KeyEvent& rEvt);
+ virtual void MouseButtonDown(const BrowserMouseEvent& rEvt);
+ virtual void MouseButtonUp(const BrowserMouseEvent& rEvt);
+ virtual void StateChanged( StateChangedType nType );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ using BrowseBox::MouseButtonUp;
+ using BrowseBox::MouseButtonDown;
+
+ virtual long PreNotify(NotifyEvent& rNEvt );
+ virtual long Notify(NotifyEvent& rNEvt);
+
+ virtual void EndScroll();
+
+ // should be used instead of GetFieldRectPixel, 'cause this method here takes into account the borders
+ Rectangle GetCellRect(long nRow, sal_uInt16 nColId, sal_Bool bRelToBrowser = sal_True) const;
+ virtual sal_uInt32 GetTotalCellWidth(long nRow, sal_uInt16 nColId);
+ virtual sal_uInt32 GetAutoColumnWidth(sal_uInt16 nColId);
+
+ virtual void PaintStatusCell(OutputDevice& rDev, const Rectangle& rRect) const;
+ virtual void PaintCell(OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColId) const = 0;
+
+ virtual RowStatus GetRowStatus(long nRow) const;
+
+ virtual void RowHeightChanged();
+
+ // callbacks for the data window
+ virtual void ImplStartTracking();
+ virtual void ImplTracking();
+ virtual void ImplEndTracking();
+
+ // when changing a row:
+ // CursorMoving: cursor is beeing moved, but GetCurRow() still provides the old row
+ virtual sal_Bool CursorMoving(long nNewRow, sal_uInt16 nNewCol);
+
+ // cursor has been moved
+ virtual void CursorMoved();
+
+ virtual void CellModified(); // called whenever a cell has been modified
+ virtual sal_Bool SaveModified(); // called whenever a cell should be left, and it's content should be saved
+ // return sal_False prevents leaving the cell
+ virtual sal_Bool SaveRow(); // commit the current row
+
+ virtual sal_Bool IsModified() const {return aController.Is() && aController->IsModified();}
+
+ virtual CellController* GetController(long nRow, sal_uInt16 nCol);
+ virtual void InitController(CellControllerRef& rController, long nRow, sal_uInt16 nCol);
+ virtual void ResizeController(CellControllerRef& rController, const Rectangle&);
+ virtual void ReleaseController(CellControllerRef& pController, long nRow, sal_uInt16 nCol);
+ virtual void DoubleClick(const BrowserMouseEvent&);
+
+ void ActivateCell() { ActivateCell(GetCurRow(), GetCurColumnId()); }
+
+ // retrieve the image for the row status
+ virtual Image GetImage(RowStatus) const;
+
+ // inserting columns
+ // if you don't set a width, this will be calculated automatically
+ // if the id isn't set the smallest unused will do it ...
+ virtual sal_uInt16 AppendColumn(const String& rName, sal_uInt16 nWidth = 0, sal_uInt16 nPos = HEADERBAR_APPEND, sal_uInt16 nId = (sal_uInt16)-1);
+
+ // called whenever (Shift)Tab or Enter is pressed. If true is returned, these keys
+ // result in traveling to the next or to th previous cell
+ virtual sal_Bool IsTabAllowed(sal_Bool bForward) const;
+
+ virtual sal_Bool IsCursorMoveAllowed(long nNewRow, sal_uInt16 nNewColId) const;
+
+ void PaintTristate(OutputDevice& rDev, const Rectangle& rRect,const TriState& eState,sal_Bool _bEnabled=sal_True) const;
+
+ void AsynchGetFocus();
+ // secure starting of StartEditHdl
+
+ public:
+ EditBrowseBox(Window* pParent, sal_Int32 nBrowserFlags = EBBF_NONE, WinBits nBits = WB_TABSTOP, BrowserMode nMode = 0 );
+ EditBrowseBox(Window* pParent, const ResId& rId, sal_Int32 nBrowserFlags = EBBF_NONE, BrowserMode nMode = 0 );
+ ~EditBrowseBox();
+
+ sal_Bool IsEditing() const {return aController.Is();}
+ void InvalidateStatusCell(long nRow) {RowModified(nRow, 0);}
+ void InvalidateHandleColumn();
+
+ // late construction
+ virtual void Init();
+ virtual void RemoveRows();
+ virtual void Dispatch(sal_uInt16 nId);
+
+ CellControllerRef Controller() const { return aController; }
+ sal_Int32 GetBrowserFlags() const { return m_nBrowserFlags; }
+ void SetBrowserFlags(sal_Int32 nFlags);
+
+ virtual void ActivateCell(long nRow, sal_uInt16 nCol, sal_Bool bSetCellFocus = sal_True);
+ virtual void DeactivateCell(sal_Bool bUpdate = sal_True);
+ // Children ---------------------------------------------------------------
+
+ /** Creates the accessible object of a data table cell.
+ @param nRow
+ The row index of the cell.
+ @param nColumnId
+ The column ID of the cell.
+ @return
+ The XAccessible interface of the specified cell. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >
+ CreateAccessibleCell( sal_Int32 nRow, sal_uInt16 nColumnPos );
+
+ /** @return The count of additional controls of the control area. */
+ virtual sal_Int32 GetAccessibleControlCount() const;
+
+ /** Creates the accessible object of an additional control.
+ @param nIndex
+ The 0-based index of the control.
+ @return
+ The XAccessible interface of the specified control. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >
+ CreateAccessibleControl( sal_Int32 nIndex );
+
+ /** Creates the accessible object of a column header.
+ @param nColumnId
+ The column ID of the header.
+ @return
+ The XAccessible interface of the specified column header. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >
+ CreateAccessibleRowHeader( sal_Int32 _nRow );
+
+ /** Sets focus to current cell of the data table. */
+ virtual void GrabTableFocus();
+
+ virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex);
+ virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint);
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > CreateAccessibleCheckBoxCell(long _nRow, sal_uInt16 _nColumnPos,const TriState& eState);
+ protected:
+ // creates the accessible which wraps the active cell
+ void implCreateActiveAccessible( );
+
+ private:
+ virtual void PaintField(OutputDevice& rDev, const Rectangle& rRect,
+ sal_uInt16 nColumnId ) const;
+ using Control::ImplInitSettings;
+ SVT_DLLPRIVATE void ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground );
+ SVT_DLLPRIVATE void DetermineFocus( const sal_uInt16 _nGetFocusFlags = 0);
+ inline void HideAndDisable(CellControllerRef& rController);
+ inline void EnableAndShow() const;
+
+ SVT_DLLPRIVATE void implActivateCellOnMouseEvent(const BrowserMouseEvent& _rEvt, sal_Bool _bUp);
+ SVT_DLLPRIVATE void impl_construct();
+
+ DECL_DLLPRIVATE_LINK(ModifyHdl, void* );
+ DECL_DLLPRIVATE_LINK(StartEditHdl, void* );
+ DECL_DLLPRIVATE_LINK(EndEditHdl, void* );
+ DECL_DLLPRIVATE_LINK(CellModifiedHdl, void* );
+ };
+
+// .......................................................................
+} // namespace svt
+// .......................................................................
+
+#undef SVTOOLS_IN_EDITBROWSEBOX_HXX
+#endif // _SVTOOLS_EDITBROWSEBOX_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/editimplementation.hxx b/include/svtools/editimplementation.hxx
new file mode 100644
index 000000000000..983bf6dae5e8
--- /dev/null
+++ b/include/svtools/editimplementation.hxx
@@ -0,0 +1,144 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVTOOLS_IN_EDITBROWSEBOX_HXX
+#error "not to be included directly!"
+#endif
+
+//----------------------------------------------------------------------
+template <class EDIT>
+GenericEditImplementation< EDIT >::GenericEditImplementation( EDIT& _rEdit )
+ :m_rEdit( _rEdit )
+{
+}
+
+//----------------------------------------------------------------------
+template <class EDIT>
+Control& GenericEditImplementation< EDIT >::GetControl()
+{
+ return m_rEdit;
+}
+
+//----------------------------------------------------------------------
+template <class EDIT>
+String GenericEditImplementation< EDIT >::GetText( LineEnd ) const
+{
+ // ignore the line end - this base implementation does not support it
+ return m_rEdit.GetText( );
+}
+
+//----------------------------------------------------------------------
+template <class EDIT>
+void GenericEditImplementation< EDIT >::SetText( const OUString& _rStr )
+{
+ m_rEdit.SetText( _rStr );
+}
+
+//----------------------------------------------------------------------
+template <class EDIT>
+Selection GenericEditImplementation< EDIT >::GetSelection() const
+{
+ return m_rEdit.GetSelection( );
+}
+
+//----------------------------------------------------------------------
+template <class EDIT>
+void GenericEditImplementation< EDIT >::SetSelection( const Selection& _rSelection )
+{
+ m_rEdit.SetSelection( _rSelection );
+}
+
+//----------------------------------------------------------------------
+template <class EDIT>
+void GenericEditImplementation< EDIT >::SetReadOnly( sal_Bool bReadOnly )
+{
+ m_rEdit.SetReadOnly( bReadOnly );
+}
+
+//----------------------------------------------------------------------
+template <class EDIT>
+sal_Bool GenericEditImplementation< EDIT >::IsReadOnly() const
+{
+ return m_rEdit.IsReadOnly();
+}
+
+//----------------------------------------------------------------------
+template <class EDIT>
+void GenericEditImplementation< EDIT >::ReplaceSelected( const String& _rStr )
+{
+ m_rEdit.ReplaceSelected( _rStr );
+}
+
+//----------------------------------------------------------------------
+template <class EDIT>
+void GenericEditImplementation< EDIT >::DeleteSelected()
+{
+ m_rEdit.DeleteSelected();
+}
+
+//----------------------------------------------------------------------
+template <class EDIT>
+String GenericEditImplementation< EDIT >::GetSelected( LineEnd ) const
+{
+ return m_rEdit.GetSelected( );
+}
+
+//----------------------------------------------------------------------
+template <class EDIT>
+void GenericEditImplementation< EDIT >::SetMaxTextLen( xub_StrLen _nMaxLen )
+{
+ m_rEdit.SetMaxTextLen( _nMaxLen );
+}
+
+//----------------------------------------------------------------------
+template <class EDIT>
+xub_StrLen GenericEditImplementation< EDIT >::GetMaxTextLen() const
+{
+ return (xub_StrLen)m_rEdit.GetMaxTextLen( );
+}
+
+//----------------------------------------------------------------------
+template <class EDIT>
+void GenericEditImplementation< EDIT >::SetModified()
+{
+ m_rEdit.SetModifyFlag();
+}
+
+//----------------------------------------------------------------------
+template <class EDIT>
+sal_Bool GenericEditImplementation< EDIT >::IsModified() const
+{
+ return m_rEdit.IsModified();
+}
+
+//----------------------------------------------------------------------
+template <class EDIT>
+void GenericEditImplementation< EDIT >::ClearModified()
+{
+ m_rEdit.ClearModifyFlag();
+}
+
+//----------------------------------------------------------------------
+template <class EDIT>
+void GenericEditImplementation< EDIT >::SetModifyHdl( const Link& _rLink )
+{
+ m_rEdit.SetModifyHdl( _rLink );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/editsyntaxhighlighter.hxx b/include/svtools/editsyntaxhighlighter.hxx
new file mode 100644
index 000000000000..747d0567c213
--- /dev/null
+++ b/include/svtools/editsyntaxhighlighter.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _EDITSYNTAXHIGHLIGHTER_HXX
+#define _EDITSYNTAXHIGHLIGHTER_HXX
+
+#include <comphelper/syntaxhighlight.hxx>
+#include <svtools/svmedit.hxx>
+#include <svtools/svtdllapi.h>
+#include <svtools/colorcfg.hxx>
+
+class SVT_DLLPUBLIC MultiLineEditSyntaxHighlight : public MultiLineEdit
+{
+ private:
+ bool mbDoBracketHilight;
+ SyntaxHighlighter aHighlighter;
+ svtools::ColorConfig m_aColorConfig;
+
+ private:
+ virtual void DoBracketHilight(sal_uInt16 aKey);
+
+ protected:
+ virtual long PreNotify( NotifyEvent& rNEvt );
+
+ public:
+ MultiLineEditSyntaxHighlight( Window* pParent, WinBits nWinStyle = WB_LEFT | WB_BORDER , HighlighterLanguage aLanguage = HIGHLIGHT_SQL);
+ MultiLineEditSyntaxHighlight( Window* pParent, const ResId& rResId , HighlighterLanguage aLanguage = HIGHLIGHT_SQL);
+ ~MultiLineEditSyntaxHighlight();
+
+ virtual void UpdateData();
+ virtual void SetText(const OUString& rNewText);
+ virtual void SetText( const OUString& rStr, const Selection& rNewSelection )
+ { SetText( rStr ); SetSelection( rNewSelection ); }
+
+ Color GetColorValue(TokenTypes aToken);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/ehdl.hxx b/include/svtools/ehdl.hxx
new file mode 100644
index 000000000000..4b06a6e9d781
--- /dev/null
+++ b/include/svtools/ehdl.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _EHDL_HXX
+#define _EHDL_HXX
+
+#ifndef __RSC
+
+#include "svtools/svtdllapi.h"
+
+#include <tools/errinf.hxx>
+
+class Window;
+class ResMgr;
+
+class SVT_DLLPUBLIC SfxErrorContext : private ErrorContext
+{
+public:
+ SfxErrorContext(
+ sal_uInt16 nCtxIdP, Window *pWin=0,
+ sal_uInt16 nResIdP=USHRT_MAX, ResMgr *pMgrP=0);
+ SfxErrorContext(
+ sal_uInt16 nCtxIdP, const String &aArg1, Window *pWin=0,
+ sal_uInt16 nResIdP=USHRT_MAX, ResMgr *pMgrP=0);
+ virtual sal_Bool GetString(sal_uLong nErrId, OUString &rStr);
+
+private:
+ sal_uInt16 nCtxId;
+ sal_uInt16 nResId;
+ ResMgr *pMgr;
+ String aArg1;
+};
+
+class SVT_DLLPUBLIC SfxErrorHandler : private ErrorHandler
+{
+public:
+ SfxErrorHandler(sal_uInt16 nId, sal_uLong lStart, sal_uLong lEnd, ResMgr *pMgr=0);
+ ~SfxErrorHandler();
+
+protected:
+ virtual sal_Bool GetErrorString(sal_uLong lErrId, OUString &, sal_uInt16&) const;
+ virtual sal_Bool GetMessageString(sal_uLong lErrId, OUString &, sal_uInt16&) const;
+
+private:
+
+ sal_uLong lStart;
+ sal_uLong lEnd;
+ sal_uInt16 nId;
+ ResMgr *pMgr;
+ ResMgr *pFreeMgr;
+
+ SVT_DLLPRIVATE sal_Bool GetClassString(sal_uLong lErrId, String &) const;
+ virtual sal_Bool CreateString(
+ const ErrorInfo *, OUString &, sal_uInt16 &) const;
+};
+
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/embedhlp.hxx b/include/svtools/embedhlp.hxx
new file mode 100644
index 000000000000..ba948376af9b
--- /dev/null
+++ b/include/svtools/embedhlp.hxx
@@ -0,0 +1,124 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVTOOLS_EMBEDHLP_HXX
+#define _SVTOOLS_EMBEDHLP_HXX
+
+#include "svtools/svtdllapi.h"
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <vcl/graph.hxx>
+#include <tools/mapunit.hxx>
+#include <rtl/ustring.hxx>
+
+namespace comphelper
+{
+ class EmbeddedObjectContainer;
+}
+
+namespace com { namespace sun { namespace star { namespace embed {
+ class XEmbeddedObject;
+}}}}
+
+class Rectangle;
+class OutputDevice;
+
+namespace svt {
+
+struct EmbeddedObjectRef_Impl;
+
+class SVT_DLLPUBLIC EmbeddedObjectRef
+{
+ EmbeddedObjectRef_Impl* mpImpl;
+
+ SVT_DLLPRIVATE SvStream* GetGraphicStream( bool bUpdate ) const;
+ SVT_DLLPRIVATE void GetReplacement( bool bUpdate );
+
+ EmbeddedObjectRef& operator = ( const EmbeddedObjectRef& );
+
+public:
+ static void DrawPaintReplacement( const Rectangle &rRect, const OUString &rText, OutputDevice *pOut );
+ static void DrawShading( const Rectangle &rRect, OutputDevice *pOut );
+ static bool TryRunningState( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& );
+ static void SetGraphicToContainer( const Graphic& rGraphic,
+ comphelper::EmbeddedObjectContainer& aContainer,
+ const OUString& aName,
+ const OUString& aMediaType );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetGraphicReplacementStream(
+ sal_Int64 nViewAspect,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&,
+ OUString* pMediaType )
+ throw();
+
+ const com::sun::star::uno::Reference <com::sun::star::embed::XEmbeddedObject>& operator->() const;
+ const com::sun::star::uno::Reference <com::sun::star::embed::XEmbeddedObject>& GetObject() const;
+
+ // default constructed object; needs further assignment before it can be used
+ EmbeddedObjectRef();
+
+ // assign a previously default constructed object
+ void Assign( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj, sal_Int64 nAspect );
+
+ // create object for a certain view aspect
+ EmbeddedObjectRef( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj, sal_Int64 nAspect );
+
+ ~EmbeddedObjectRef();
+ EmbeddedObjectRef( const EmbeddedObjectRef& );
+
+ // assigning to a container enables the object to exchange graphical representations with a storage
+ void AssignToContainer( comphelper::EmbeddedObjectContainer* pContainer, const OUString& rPersistName );
+ comphelper::EmbeddedObjectContainer* GetContainer() const;
+
+ sal_Int64 GetViewAspect() const;
+ void SetViewAspect( sal_Int64 nAspect );
+ const Graphic* GetGraphic( OUString* pMediaType = NULL ) const;
+
+ // the original size of the object ( size of the icon for iconified object )
+ // no conversion is done if no target mode is provided
+ Size GetSize( MapMode* pTargetMapMode = NULL ) const;
+
+ void SetGraphic( const Graphic& rGraphic, const OUString& rMediaType );
+ void SetGraphicStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInGrStream,
+ const OUString& rMediaType );
+
+ void UpdateReplacement();
+ void UpdateReplacementOnDemand();
+ void Lock( bool bLock = true );
+ void Clear();
+ bool is() const;
+
+ bool IsLocked() const;
+ bool IsChart() const;
+
+ // #i104867#
+ // Provides a graphic version number for the fetchable Graphic during this object's lifetime. Internally,
+ // that number is incremented at each change of the Graphic. This mechanism is needed to identify if a
+ // remembered Graphic (e.g. primitives) has changed compared to the current one, but without actively
+ // fetching the Graphic what would be too expensive e.g. for charts
+ sal_uInt32 getGraphicVersion() const;
+ void SetDefaultSizeForChart( const Size& rSizeIn_100TH_MM );//#i103460# charts do not necessaryly have an own size within ODF files, in this case they need to use the size settings from the surrounding frame, which is made available with this method
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/embedtransfer.hxx b/include/svtools/embedtransfer.hxx
new file mode 100644
index 000000000000..9da80b87f37a
--- /dev/null
+++ b/include/svtools/embedtransfer.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _EMBEDTRANSFER_HXX
+#define _EMBEDTRANSFER_HXX
+
+#include "svtools/svtdllapi.h"
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include <svtools/transfer.hxx>
+
+class Graphic;
+class SVT_DLLPUBLIC SvEmbedTransferHelper : public TransferableHelper
+{
+private:
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject > m_xObj;
+ Graphic* m_pGraphic;
+ sal_Int64 m_nAspect;
+
+protected:
+
+ virtual void AddSupportedFormats();
+ virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+ virtual void ObjectReleased();
+
+public:
+ // object, replacement image, and the aspect
+ SvEmbedTransferHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject >& xObj,
+ const Graphic* pGraphic,
+ sal_Int64 nAspect );
+ ~SvEmbedTransferHelper();
+
+ static void FillTransferableObjectDescriptor( TransferableObjectDescriptor& rDesc,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject >& xObj,
+ const Graphic* pGraphic,
+ sal_Int64 nAspect );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/extcolorcfg.hxx b/include/svtools/extcolorcfg.hxx
new file mode 100644
index 000000000000..226e6065d5b0
--- /dev/null
+++ b/include/svtools/extcolorcfg.hxx
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVTOOLS_EXTCOLORCFG_HXX
+#define INCLUDED_SVTOOLS_EXTCOLORCFG_HXX
+
+#include "svtools/svtdllapi.h"
+#include <rtl/ustring.hxx>
+#include <tools/color.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <svl/brdcst.hxx>
+#include <svl/lstner.hxx>
+
+//-----------------------------------------------------------------------------
+namespace svtools{
+
+class ExtendedColorConfig_Impl;
+class ExtendedColorConfigValue
+{
+ OUString m_sName;
+ OUString m_sDisplayName;
+ sal_Int32 m_nColor;
+ sal_Int32 m_nDefaultColor;
+public:
+ ExtendedColorConfigValue() : m_nColor(0),m_nDefaultColor(0){}
+ ExtendedColorConfigValue(const OUString& _sName
+ ,const OUString& _sDisplayName
+ ,sal_Int32 _nColor
+ ,sal_Int32 _nDefaultColor)
+ : m_sName(_sName)
+ ,m_sDisplayName(_sDisplayName)
+ ,m_nColor(_nColor)
+ ,m_nDefaultColor(_nDefaultColor)
+ {}
+
+ inline OUString getName() const { return m_sName; }
+ inline OUString getDisplayName() const { return m_sDisplayName; }
+ inline sal_Int32 getColor() const { return m_nColor; }
+ inline sal_Int32 getDefaultColor() const { return m_nDefaultColor; }
+
+ inline void setColor(sal_Int32 _nColor) { m_nColor = _nColor; }
+
+ sal_Bool operator !=(const ExtendedColorConfigValue& rCmp) const
+ { return m_nColor != rCmp.m_nColor;}
+};
+
+class SVT_DLLPUBLIC ExtendedColorConfig : public SfxBroadcaster, public SfxListener
+{
+ friend class ExtendedColorConfig_Impl;
+private:
+ static ExtendedColorConfig_Impl* m_pImpl;
+public:
+ ExtendedColorConfig();
+ ~ExtendedColorConfig();
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ // get the configured value
+ ExtendedColorConfigValue GetColorValue(const OUString& _sComponentName,const OUString& _sName)const;
+ sal_Int32 GetComponentCount() const;
+ OUString GetComponentName(sal_uInt32 _nPos) const;
+ OUString GetComponentDisplayName(const OUString& _sComponentName) const;
+ sal_Int32 GetComponentColorCount(const OUString& _sName) const;
+ ExtendedColorConfigValue GetComponentColorConfigValue(const OUString& _sComponentName,sal_uInt32 _nPos) const;
+};
+
+class SVT_DLLPUBLIC EditableExtendedColorConfig
+{
+ ExtendedColorConfig_Impl* m_pImpl;
+ sal_Bool m_bModified;
+public:
+ EditableExtendedColorConfig();
+ ~EditableExtendedColorConfig();
+
+ void DeleteScheme(const OUString& rScheme );
+ void AddScheme(const OUString& rScheme );
+ sal_Bool LoadScheme(const OUString& rScheme );
+ void SetCurrentSchemeName(const OUString& rScheme);
+
+ sal_Int32 GetComponentCount() const;
+ OUString GetComponentName(sal_uInt32 _nPos) const;
+ sal_Int32 GetComponentColorCount(const OUString& _sName) const;
+ ExtendedColorConfigValue GetComponentColorConfigValue(const OUString& _sName,sal_uInt32 _nPos) const;
+ void SetColorValue(const OUString& _sComponentName, const ExtendedColorConfigValue& rValue);
+ void SetModified();
+ void ClearModified(){m_bModified = sal_False;}
+ sal_Bool IsModified()const{return m_bModified;}
+ void Commit();
+
+ void DisableBroadcast();
+ void EnableBroadcast();
+};
+}//namespace svtools
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/extensionlistbox.hxx b/include/svtools/extensionlistbox.hxx
new file mode 100644
index 000000000000..62f5c383579a
--- /dev/null
+++ b/include/svtools/extensionlistbox.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVTOOLS_EXTENSIONLISTBOX_HXX
+#define _SVTOOLS_EXTENSIONLISTBOX_HXX
+
+#include <vcl/ctrl.hxx>
+#include <rtl/ustring.hxx>
+
+// ============================================================================
+
+namespace svt
+{
+
+// ============================================================================
+
+/** This abstract class provides methods to implement an extension list box.
+ This header is needed for the automatic test tool
+*/
+class IExtensionListBox: public Control
+{
+public:
+ enum { ENTRY_NOTFOUND = -1 };
+
+ IExtensionListBox( Window* pParent, WinBits nWinStyle = 0 ): Control( pParent, nWinStyle ){}
+
+ /** @return The count of the entries in the list box. */
+ virtual sal_Int32 getItemCount() const = 0;
+
+ /** @return The index of the first selected entry in the list box.
+ When nothing is selected, which is the case when getItemCount returns '0',
+ then this function returns ENTRY_NOTFOUND */
+ virtual sal_Int32 getSelIndex() const = 0;
+
+ /** @return The item name of the entry with the given index
+ The index starts with 0.
+ Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
+ virtual OUString getItemName( sal_Int32 index ) const = 0;
+
+ /** @return The version string of the entry with the given index
+ The index starts with 0.
+ Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
+ virtual OUString getItemVersion( sal_Int32 index ) const = 0;
+
+ /** @return The description string of the entry with the given index
+ The index starts with 0.
+ Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
+ virtual OUString getItemDescription( sal_Int32 index ) const = 0;
+
+ /** @return The publisher string of the entry with the given index
+ The index starts with 0.
+ Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
+ virtual OUString getItemPublisher( sal_Int32 index ) const = 0;
+
+ /** @return The link behind the publisher text of the entry with the given index
+ The index starts with 0.
+ Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
+ virtual OUString getItemPublisherLink( sal_Int32 index ) const = 0;
+
+ /** The entry at the given position will be selected
+ Index starts with 0.
+ Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
+ virtual void select( sal_Int32 index ) = 0;
+
+ /** The first found entry with the given name will be selected
+ When there was no entry found with the name, the selection doesn't change.
+ Please note that there might be more than one entry with the same
+ name, because:
+ 1. the name is not unique
+ 2. one extension can be installed as user and shared extension.
+ */
+ virtual void select( const OUString & sName ) = 0;
+};
+// ============================================================================
+
+} // namespace svt
+
+// ============================================================================
+
+#endif // _SVTOOLS_EXTENSIONLISTBOX_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/filechangedchecker.hxx b/include/svtools/filechangedchecker.hxx
new file mode 100644
index 000000000000..2b8caa9d2da5
--- /dev/null
+++ b/include/svtools/filechangedchecker.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ * [ Surendran Mahendran <surenspost@gmail.com>]
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+#ifndef SVTOOLS_INCLUDED_FILECHANGEDCHECKER_HXX
+#define SVTOOLS_INCLUDED_FILECHANGEDCHECKER_HXX
+
+#include "svtools/svtdllapi.h"
+#include <boost/function.hpp>
+#include <osl/file.hxx>
+#include <vcl/timer.hxx>
+
+/** Periodically checks if a file has been modified
+
+ Instances of this class setup a vcl timer to occasionally wake up
+ check whether file modification time has changed.
+ */
+class SVT_DLLPUBLIC FileChangedChecker
+{
+private :
+ Timer mTimer;
+ OUString mFileName;
+ TimeValue mLastModTime;
+ ::boost::function0<void> mpCallback;
+
+ bool SVT_DLLPRIVATE getCurrentModTime(TimeValue& o_rValue) const;
+ DECL_LINK(TimerHandler, void *);
+
+public :
+ void resetTimer();
+ bool hasFileChanged();
+ FileChangedChecker(const OUString& rFilename, const ::boost::function0<void>& rCallback);
+};
+
+#endif
diff --git a/include/svtools/filectrl.hxx b/include/svtools/filectrl.hxx
new file mode 100644
index 000000000000..5654f004f69c
--- /dev/null
+++ b/include/svtools/filectrl.hxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SV_FILECTRL_HXX
+#define _SV_FILECTRL_HXX
+
+#include "svtools/svtdllapi.h"
+#include <vcl/window.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/button.hxx>
+
+
+#define STR_FILECTRL_BUTTONTEXT 333 // ID-Range?!
+
+// Flags for FileControl
+typedef sal_uInt16 FileControlMode;
+#define FILECTRL_RESIZEBUTTONBYPATHLEN ((sal_uInt16)0x0001)//if this is set, the button will become small as soon as the Text in the Edit Field is to long to be shown completely
+
+
+// Flags for internal use of FileControl
+typedef sal_uInt16 FileControlMode_Internal;
+#define FILECTRL_INRESIZE ((sal_uInt16)0x0001)
+#define FILECTRL_ORIGINALBUTTONTEXT ((sal_uInt16)0x0002)
+
+
+class SVT_DLLPUBLIC FileControl : public Window
+{
+private:
+ Edit maEdit;
+ PushButton maButton;
+
+ String maButtonText;
+ sal_Bool mbOpenDlg;
+
+ Link maDialogCreatedHdl;
+
+ FileControlMode mnFlags;
+ FileControlMode_Internal mnInternalFlags;
+
+private:
+ SVT_DLLPRIVATE void ImplBrowseFile( );
+
+protected:
+ SVT_DLLPRIVATE void Resize();
+ SVT_DLLPRIVATE void GetFocus();
+ SVT_DLLPRIVATE void StateChanged( StateChangedType nType );
+ SVT_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle );
+ DECL_DLLPRIVATE_LINK( ButtonHdl, void* );
+
+public:
+ FileControl( Window* pParent, WinBits nStyle, FileControlMode = 0 );
+ ~FileControl();
+
+ Edit& GetEdit() { return maEdit; }
+ PushButton& GetButton() { return maButton; }
+
+ void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags );
+
+ void SetOpenDialog( sal_Bool bOpen ) { mbOpenDlg = bOpen; }
+ sal_Bool IsOpenDialog() const { return mbOpenDlg; }
+
+ void SetText( const OUString& rStr );
+ OUString GetText() const;
+ OUString GetSelectedText() const { return maEdit.GetSelected(); }
+
+ void SetSelection( const Selection& rSelection ) { maEdit.SetSelection( rSelection ); }
+ Selection GetSelection() const { return maEdit.GetSelection(); }
+
+ void SetReadOnly( sal_Bool bReadOnly = sal_True ) { maEdit.SetReadOnly( bReadOnly ); }
+ sal_Bool IsReadOnly() const { return maEdit.IsReadOnly(); }
+
+ //------
+ //use this to manipulate the dialog bevore executing it:
+ void SetDialogCreatedHdl( const Link& rLink ) { maDialogCreatedHdl = rLink; }
+ const Link& GetDialogCreatedHdl() const { return maDialogCreatedHdl; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/filedlg2.hrc b/include/svtools/filedlg2.hrc
new file mode 100644
index 000000000000..4da7f5e0f894
--- /dev/null
+++ b/include/svtools/filedlg2.hrc
@@ -0,0 +1,23 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#define STR_FILEDLG_OPEN 1002
+#define STR_FILEDLG_TYPE 1005
+#define STR_FILEDLG_SAVE 1010
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/fileurlbox.hxx b/include/svtools/fileurlbox.hxx
new file mode 100644
index 000000000000..5a9219d48050
--- /dev/null
+++ b/include/svtools/fileurlbox.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVTOOLS_FILEURLBOX_HXX
+#define SVTOOLS_FILEURLBOX_HXX
+
+#include "svtools/svtdllapi.h"
+#include <svtools/inettbc.hxx>
+
+//.........................................................................
+namespace svt
+{
+//.........................................................................
+
+ //=====================================================================
+ //= FileURLBox
+ //=====================================================================
+ class SVT_DLLPUBLIC FileURLBox : public SvtURLBox
+ {
+ protected:
+ String m_sPreservedText;
+
+ public:
+ FileURLBox( Window* _pParent, WinBits _nStyle );
+
+ protected:
+ virtual long PreNotify( NotifyEvent& rNEvt );
+ virtual long Notify( NotifyEvent& rNEvt );
+
+ public:
+ /** transforms the given URL content into a system-dependent notation, if possible, and
+ sets it as current display text
+
+ <p>If the user enters an URL such as "file:///c:/some%20directory", then this will be converted
+ to "c:\some directory" for better readability.</p>
+
+ @param _rURL
+ denotes the URL to set. Note that no check is made whether it is a valid URL - this
+ is the responsibility of the caller.
+
+ @see SvtURLBox::GetURL
+ */
+ void DisplayURL( const String& _rURL );
+ };
+
+//.........................................................................
+} // namespace svt
+//.........................................................................
+
+#endif // SVTOOLS_FILEURLBOX_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/fileview.hxx b/include/svtools/fileview.hxx
new file mode 100644
index 000000000000..d7cb77a19a47
--- /dev/null
+++ b/include/svtools/fileview.hxx
@@ -0,0 +1,258 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVT_FILEVIEW_HXX
+#define _SVT_FILEVIEW_HXX
+
+#include "svtools/svtdllapi.h"
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/ucb/XContent.hpp>
+#include <vcl/ctrl.hxx>
+#include <vcl/image.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <vcl/dialog.hxx>
+#include <rtl/ustring.hxx>
+
+// class SvtFileView -----------------------------------------------------
+
+#define FILEVIEW_ONLYFOLDER 0x0001
+#define FILEVIEW_MULTISELECTION 0x0002
+
+#define FILEVIEW_SHOW_ONLYTITLE 0x0010
+#define FILEVIEW_SHOW_NONE 0x0020
+
+class ViewTabListBox_Impl;
+class SvtFileView_Impl;
+class SvTreeListEntry;
+class HeaderBar;
+class IUrlFilter;
+
+/// the result of an action in the FileView
+enum FileViewResult
+{
+ eSuccess,
+ eFailure,
+ eTimeout,
+ eStillRunning
+};
+
+/// describes parameters for doing an action on the FileView asynchronously
+struct FileViewAsyncAction
+{
+ sal_uInt32 nMinTimeout; /// minimum time to wait for a result, in milliseconds
+ sal_uInt32 nMaxTimeout; /// maximum time to wait for a result, in milliseconds, until eTimeout is returned
+ Link aFinishHandler; /// the handler to be called when the action is finished. Called in every case, no matter of the result
+
+ FileViewAsyncAction()
+ {
+ nMinTimeout = nMaxTimeout = 0;
+ }
+};
+
+class SVT_DLLPUBLIC SvtFileView : public Control
+{
+private:
+ SvtFileView_Impl* mpImp;
+ sal_Bool bSortColumn;
+
+ ::com::sun::star::uno::Sequence< OUString > mpBlackList;
+
+ DECL_DLLPRIVATE_LINK( HeaderSelect_Impl, HeaderBar * );
+ DECL_DLLPRIVATE_LINK( HeaderEndDrag_Impl, HeaderBar * );
+
+protected:
+ virtual void GetFocus();
+
+public:
+ SvtFileView( Window* pParent, const ResId& rResId, sal_Bool bOnlyFolder, sal_Bool bMultiSelection );
+ SvtFileView( Window* pParent, const ResId& rResId, sal_uInt8 nFlags );
+ ~SvtFileView();
+
+ const String& GetViewURL() const;
+ String GetURL( SvTreeListEntry* pEntry ) const;
+ String GetCurrentURL() const;
+
+ sal_Bool GetParentURL( String& _rParentURL ) const;
+ void CreatedFolder( const String& rUrl, const String& rNewFolder );
+
+ void SetHelpId( const OString& rHelpId );
+ const OString& GetHelpId( ) const;
+ void SetSizePixel( const Size& rNewSize );
+ virtual void SetPosSizePixel( const Point& rNewPos, const Size& rNewSize );
+ void SetSortColumn( sal_Bool bValue ) { bSortColumn = bValue; }
+ sal_Bool GetSortColumn() { return bSortColumn; }
+
+ /** initialize the view with the content of a folder given by URL, and aply an immediate filter
+
+ @param rFolderURL
+ the URL of the folder whose content is to be read
+ @param rFilter
+ the initial filter to be applied
+ @param pAsyncDescriptor
+ If not <NULL/>, this struct describes the parameters for doing the
+ action asynchronously.
+ */
+ FileViewResult Initialize(
+ const String& rFolderURL,
+ const String& rFilter,
+ const FileViewAsyncAction* pAsyncDescriptor,
+ const ::com::sun::star::uno::Sequence< OUString >& rBlackList
+ );
+
+ FileViewResult Initialize(
+ const String& rFolderURL,
+ const String& rFilter,
+ const FileViewAsyncAction* pAsyncDescriptor );
+ /** initialze the view with a sequence of contents, which have already been obtained elsewhere
+
+ This method will never return <member>eStillRunning</member>, since it will fill the
+ view synchronously
+ */
+ sal_Bool Initialize( const ::com::sun::star::uno::Sequence< OUString >& aContents );
+
+ /** initializes the view with the content of a folder given by an UCB content
+ */
+ sal_Bool Initialize( const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent>& _xContent,
+ const String& rFilter );
+
+ /** reads the current content of the current folder again, and applies the given filter to it
+
+ Note 1: The folder is really read a second time. This implies that any new elements (which were
+ not present when you called Initialize the last time) are now displayed.
+
+ Note 2: This method must not be called when you previously initialized the view from a sequence
+ of strings, or a UNO content object.
+
+ @param rFilter
+ the filter to be applied
+ @param pAsyncDescriptor
+ If not <NULL/>, this struct describes the parameters for doing the
+ action asynchronously.
+ */
+ FileViewResult ExecuteFilter(
+ const String& rFilter,
+ const FileViewAsyncAction* pAsyncDescriptor
+ );
+
+ /** cancels a running async action (if any)
+
+ @seealso Initialize
+ @seealso ExecuteFilter
+ @seealso FileViewAsyncAction
+ */
+ void CancelRunningAsyncAction();
+
+ /** initializes the view with the parent folder of the current folder
+
+ @param rNewURL
+ the URL of the folder which we just navigated to
+ @param pAsyncDescriptor
+ If not <NULL/>, this struct describes the parameters for doing the
+ action asynchronously.
+ */
+ FileViewResult PreviousLevel(
+ const FileViewAsyncAction* pAsyncDescriptor
+ );
+
+ void SetNoSelection();
+
+ void SetSelectHdl( const Link& rHdl );
+ void SetDoubleClickHdl( const Link& rHdl );
+ void SetOpenDoneHdl( const Link& rHdl );
+
+ sal_uLong GetSelectionCount() const;
+ SvTreeListEntry* FirstSelected() const;
+ SvTreeListEntry* NextSelected( SvTreeListEntry* pEntry ) const;
+ void EnableAutoResize();
+ void SetFocus();
+
+ void EnableContextMenu( sal_Bool bEnable );
+ void EnableDelete( sal_Bool bEnable );
+ void EnableNameReplacing( sal_Bool bEnable = sal_True );
+ // translate folder names or display doc-title instead of file name
+ // EnableContextMenu( sal_True )/EnableDelete(sal_True) disable name replacing!
+
+ // save and load column size and sort order
+ String GetConfigString() const;
+ void SetConfigString( const String& rCfgStr );
+
+ void SetUrlFilter( const IUrlFilter* _pFilter );
+
+ void EndInplaceEditing( bool _bCancel );
+
+protected:
+ virtual void StateChanged( StateChangedType nStateChange );
+};
+
+// struct SvtContentEntry ------------------------------------------------
+
+struct SvtContentEntry
+{
+ sal_Bool mbIsFolder;
+ OUString maURL;
+
+ SvtContentEntry( const OUString& rURL, sal_Bool bIsFolder ) :
+ mbIsFolder( bIsFolder ), maURL( rURL ) {}
+};
+
+namespace svtools {
+
+// -----------------------------------------------------------------------
+// QueryDeleteDlg_Impl
+// -----------------------------------------------------------------------
+
+enum QueryDeleteResult_Impl
+{
+ QUERYDELETE_YES = 0,
+ QUERYDELETE_NO,
+ QUERYDELETE_ALL,
+ QUERYDELETE_CANCEL
+};
+
+class SVT_DLLPUBLIC QueryDeleteDlg_Impl : public ModalDialog
+{
+ FixedText _aEntryLabel;
+ FixedText _aEntry;
+ FixedText _aQueryMsg;
+
+ PushButton _aYesButton;
+ PushButton _aAllButton;
+ PushButton _aNoButton;
+ CancelButton _aCancelButton;
+
+ QueryDeleteResult_Impl _eResult;
+
+private:
+
+ DECL_DLLPRIVATE_STATIC_LINK( QueryDeleteDlg_Impl, ClickLink, PushButton* );
+
+public:
+
+ QueryDeleteDlg_Impl( Window* pParent,
+ const String& rName );
+
+ void EnableAllButton() { _aAllButton.Enable( sal_True ); }
+ QueryDeleteResult_Impl GetResult() const { return _eResult; }
+};
+
+}
+
+#endif // _SVT_FILEVIEW_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/fmtfield.hxx b/include/svtools/fmtfield.hxx
new file mode 100644
index 000000000000..8486926e53a9
--- /dev/null
+++ b/include/svtools/fmtfield.hxx
@@ -0,0 +1,319 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _FMTFIELD_HXX_
+#define _FMTFIELD_HXX_
+
+#include "svtools/svtdllapi.h"
+#include <vcl/spinfld.hxx>
+#include <svl/zforlist.hxx>
+
+namespace validation { class NumberValidator; }
+
+typedef sal_uInt16 FORMAT_CHANGE_TYPE;
+#define FCT_KEYONLY 0x00 // only a new key was set
+#define FCT_FORMATTER 0x01 // a new formatter weas set, usually implies a change of the key, too
+#define FCT_PRECISION 0x02 // a new precision was set
+#define FCT_THOUSANDSSEP 0x03 // the thousands separator setting changed
+
+//------------------------------------------------------------------------------
+class SVT_DLLPUBLIC FormattedField : public SpinField
+{
+private:
+ // Da ein SvNumberFormatter eine ziemlich teure (sowohl zeit- als auch platz-maessig) Angelegenheit ist,
+ // haelt sich nicht jedes Field, an dem kein Formatter gesetzt wurde, eine eigenen Instanz, sondern es gibt nur eine
+ // einzige statische.
+ class StaticFormatter
+ {
+ static SvNumberFormatter* s_cFormatter;
+ static sal_uLong s_nReferences;
+ public:
+ StaticFormatter();
+ ~StaticFormatter();
+
+ operator SvNumberFormatter* () { return GetFormatter(); }
+ SVT_DLLPUBLIC SvNumberFormatter* GetFormatter();
+ };
+
+protected:
+ String m_sLastValidText;
+ // hat nichts mit dem current value zu tun, ist der letzte Text, der waehrend einer Eingabe als gueltig erkannt
+ // wurde (also durch CheckText geprueft, nicht durch den Formatter gejagt)
+ Selection m_aLastSelection;
+
+ double m_dMinValue;
+ double m_dMaxValue;
+ sal_Bool m_bHasMin : 1;
+ sal_Bool m_bHasMax : 1;
+
+ sal_Bool m_bStrictFormat : 1;
+
+ sal_Bool m_bValueDirty : 1;
+ sal_Bool m_bEnableEmptyField : 1;
+ sal_Bool m_bAutoColor : 1;
+ sal_Bool m_bEnableNaN : 1;
+ double m_dCurrentValue;
+ double m_dDefaultValue;
+
+ sal_uLong m_nFormatKey;
+ SvNumberFormatter* m_pFormatter;
+ StaticFormatter m_aStaticFormatter;
+
+ double m_dSpinSize;
+ double m_dSpinFirst;
+ double m_dSpinLast;
+
+ // es macht einen Unterschied, ob man bei eingestellter Textformatierung beim LostFocus den aktuellen String durch
+ // den Formatter jagt und das Ergebnis anzeigt oder erst aus dem String ein double macht, das formatiert und dann
+ // ausgibt
+ sal_Bool m_bTreatAsNumber;
+ // und mit den folgenden Members koennen wir das Ganze hier auch zur formatierten Text-Ausgabe benutzen ...
+ String m_sCurrentTextValue;
+ String m_sDefaultText;
+
+ // die bei der letzten Ausgabe-Operation vom Formatter gelieferte Farbe (nicht dass wir sie beachten wuerden, aber
+ // man kann sie von aussen abfragen)
+ Color* m_pLastOutputColor;
+
+ bool m_bUseInputStringForFormatting;
+
+public:
+ FormattedField(Window* pParent, WinBits nStyle = 0, SvNumberFormatter* pInitialFormatter = NULL, sal_Int32 nFormatKey = 0);
+ FormattedField(Window* pParent, const ResId& rResId, SvNumberFormatter* pInitialFormatter = NULL, sal_Int32 nFormatKey = 0);
+ virtual ~FormattedField();
+
+ // Min-/Max-Verwaltung
+ sal_Bool HasMinValue() const { return m_bHasMin; }
+ void ClearMinValue() { m_bHasMin = sal_False; }
+ void SetMinValue(double dMin);
+ double GetMinValue() const { return m_dMinValue; }
+
+ sal_Bool HasMaxValue() const { return m_bHasMax; }
+ void ClearMaxValue() { m_bHasMax = sal_False; }
+ void SetMaxValue(double dMax);
+ double GetMaxValue() const { return m_dMaxValue; }
+
+ // aktueller Wert
+ virtual void SetValue(double dVal);
+ virtual double GetValue();
+ // die Standard-Implementierung jagt die Eingabe jeweils durch den Formatter, so einer vorhanden ist
+
+ void GetColor() const;
+
+ void SetTextValue(const OUString& rText);
+ // der String wird in ein double umgewandelt (durch den Formatter) und anschliessen in SetValue gesteckt
+
+ sal_Bool IsEmptyFieldEnabled() const { return m_bEnableEmptyField; }
+ void EnableEmptyField(sal_Bool bEnable);
+ // wenn nicht enabled, wird beim Verlassen des Feldes der Text auf den letzten gueltigen zurueckgesetzt
+
+ void SetDefaultValue(double dDefault) { m_dDefaultValue = dDefault; m_bValueDirty = sal_True; }
+ // wenn der aktuelle String ungueltig ist, liefert GetValue() diesen Default-Wert
+ double GetDefaultValue() const { return m_dDefaultValue; }
+
+ // Einstellungen fuer das Format
+ sal_uLong GetFormatKey() const { return m_nFormatKey; }
+ void SetFormatKey(sal_uLong nFormatKey);
+
+ SvNumberFormatter* GetFormatter() const { return m_pFormatter; }
+ void SetFormatter(SvNumberFormatter* pFormatter, sal_Bool bResetFormat = sal_True);
+ // wenn bResetFormat sal_False ist, wird versucht, das alte eingestellte Format mit 'hinueberzuretten' (teuer, wenn es sich nicht
+ // um eines der Standard-Formate handelt, die in allen Formattern gleich sind)
+ // wenn sal_True, wird als neuer FormatKey 0 gesetzt
+
+ sal_Bool GetThousandsSep() const;
+ void SetThousandsSep(sal_Bool _bUseSeparator);
+ // the is no check if the current format is numeric, so be cautious when calling these functions
+
+ sal_uInt16 GetDecimalDigits() const;
+ void SetDecimalDigits(sal_uInt16 _nPrecision);
+ // the is no check if the current format is numeric, so be cautious when calling these functions
+
+ SvNumberFormatter* StandardFormatter() { return m_aStaticFormatter; }
+ // Wenn man keinen eigenen Formatter explizit anlegen will, kann man diesen hier in SetFormatter stecken ...
+ // Das hier gelieferte Objekt wird allerdings zwischen allen Instanzen der Klasse geteilt (aus Zeit- und Platzgruenden),
+ // also ist etwas Vorsicht angebracht ...
+
+ OUString GetFormat(LanguageType& eLang) const;
+ sal_Bool SetFormat(const OUString& rFormatString, LanguageType eLang);
+ // sal_False, wenn der FormatString nicht gesetzt werden konnte (also wahrscheinlich ungueltig ist)
+
+ sal_Bool IsStrictFormat() const { return m_bStrictFormat; }
+ void SetStrictFormat(sal_Bool bEnable) { m_bStrictFormat = bEnable; }
+ // Formatueberpruefung waehrend der Eingabe ?
+
+ // Spin-Handling
+ virtual void Up();
+ virtual void Down();
+ // Standard-Implementierung : hoch- oder runterzaehlen des aktuellen double einfach um die gesetzte SpinSize
+ virtual void First();
+ virtual void Last();
+ // Standard-Implementierung : aktuelles double setzen auf eingestellten first respektive last value
+
+ void SetSpinSize(double dStep) { m_dSpinSize = dStep; }
+ double GetSpinSize() const { return m_dSpinSize; }
+
+ void SetSpinFirst(double dFirst) { m_dSpinFirst = dFirst; }
+ double GetSpinFirst() const { return m_dSpinFirst; }
+
+ void SetSpinLast(double dLast) { m_dSpinLast = dLast; }
+ double GetSpinLast() const { return m_dSpinLast; }
+
+ sal_Bool TreatingAsNumber() const { return m_bTreatAsNumber; }
+ void TreatAsNumber(sal_Bool bDoSo) { m_bTreatAsNumber = bDoSo; }
+
+public:
+ virtual void SetText( const OUString& rStr );
+ virtual void SetText( const OUString& rStr, const Selection& rNewSelection );
+
+ // die folgenden Methoden sind interesant, wenn m_bTreatAsNumber auf sal_False sitzt
+ /** nehmen wir mal an, irgendjemand will das ganze schoene double-Handling gar nicht haben, sondern
+ einfach den Text formatiert ausgeben ...
+ (der Text wird einfach nur durch den Formatter gejagt und dann gesetzt)
+ */
+ void SetTextFormatted(const OUString& rText);
+ String GetTextValue() const;
+
+ void SetDefaultText(const OUString& rDefault) { m_sDefaultText = rDefault; }
+ String GetDefaultText() const { return m_sDefaultText; }
+
+ // die bei der letzten Ausgabe-Operation vom Formatter gelieferte Farbe (Ausgabe-Operationen werden getriggert durch
+ // SetValue, SetTextValue, SetTextFormatted, also indirekt eventuell auch durch SetMin-/-MaxValue)
+ Color* GetLastOutputColor() const { return m_pLastOutputColor; }
+
+ /** reformats the current text. Interesting if the user entered some text in an "input format", and
+ this should be formatted in the "output format" (which may differ, e.g. by additional numeric
+ digits or such).
+ */
+ void Commit();
+
+ // enable automatic coloring. if set to sal_True, and the format the field is working with for any current value
+ // says that it has to be painted in a special color (e.g. a format where negative numbers should be printed
+ // red), the text is painted with that color automatically.
+ // The color used is the same as returned by GetLastOutputColor()
+ void SetAutoColor(sal_Bool _bAutomatic);
+ sal_Bool GetAutoColor() const { return m_bAutoColor; }
+
+ /** enables handling of not-a-number value.
+
+ When this is set to <FALSE/> (the default), then invalid inputs (i.e. text which cannot be
+ intepreted, according to the current formatting) will be handled as if the default value
+ has been entered. GetValue the will return this default value.
+
+ When set to <TRUE/>, then GetValue will return NaN (not a number, see <method scope="rtl::math">isNan</method>)
+ when the current input is invalid.
+
+ Note that setting this to <TRUE/> implies that upon leaving the control, the input
+ will *not* be corrected to a valid value. For example, if the user enters "foo" in the
+ control, and then tabs out of it, the text "foo" will persist, and GetValue will
+ return NaN in subsequent calls.
+ */
+ void EnableNotANumber( sal_Bool _bEnable );
+ sal_Bool IsNotANumberEnabled( ) const { return m_bEnableNaN; }
+
+ /** When being set to true, the strings in the field are formatted using the
+ InputLine format. That's also what you get in Calc when you edit a cell
+ using F2
+ */
+ void UseInputStringForFormatting( bool bUseInputStr = true );
+ bool IsUsingInputStringForFormatting() const;
+
+protected:
+ virtual long Notify(NotifyEvent& rNEvt);
+ virtual void Modify();
+
+ // CheckText ueberschreiben fuer Ueberpruefung zur Eingabezeit
+ virtual sal_Bool CheckText(const OUString&) const { return sal_True; }
+
+ // any aspect of the current format has changed
+ virtual void FormatChanged(FORMAT_CHANGE_TYPE nWhat);
+
+ void ImplSetTextImpl(const OUString& rNew, Selection* pNewSel);
+ void ImplSetValue(double dValue, sal_Bool bForce);
+ sal_Bool ImplGetValue(double& dNewVal);
+
+ void ImplSetFormatKey(sal_uLong nFormatKey);
+ // SetFormatKey without FormatChanged notification
+
+ virtual SvNumberFormatter* CreateFormatter() { SetFormatter(StandardFormatter()); return m_pFormatter; }
+ SvNumberFormatter* ImplGetFormatter() const { return m_pFormatter ? m_pFormatter : ((FormattedField*)this)->CreateFormatter(); }
+
+ long PreNotify(NotifyEvent& rNEvt);
+
+ virtual void ReFormat();
+};
+
+//------------------------------------------------------------------------------
+class SVT_DLLPUBLIC DoubleNumericField : public FormattedField
+{
+protected:
+ validation::NumberValidator* m_pNumberValidator;
+
+public:
+ DoubleNumericField(Window* pParent, WinBits nStyle = 0)
+ :FormattedField(pParent, nStyle)
+ ,m_pNumberValidator( NULL )
+ {
+ ResetConformanceTester();
+ }
+
+ DoubleNumericField(Window* pParent, const ResId& rResId)
+ :FormattedField(pParent, rResId)
+ ,m_pNumberValidator( NULL )
+ {
+ ResetConformanceTester();
+ }
+ virtual ~DoubleNumericField();
+
+protected:
+ virtual sal_Bool CheckText(const OUString& sText) const;
+
+ virtual void FormatChanged(FORMAT_CHANGE_TYPE nWhat);
+ void ResetConformanceTester();
+};
+
+//==============================================================================
+#define FCT_CURRENCY_SYMBOL 0x10
+#define FCT_CURRSYM_POSITION 0x20
+
+//------------------------------------------------------------------------------
+class DoubleCurrencyField : public FormattedField
+{
+ OUString m_sCurrencySymbol;
+ sal_Bool m_bPrependCurrSym;
+ sal_Bool m_bChangingFormat;
+
+public:
+ DoubleCurrencyField(Window* pParent, WinBits nStyle = 0);
+
+ OUString getCurrencySymbol() const { return m_sCurrencySymbol; }
+ void setCurrencySymbol(const OUString& rSymbol);
+
+ sal_Bool getPrependCurrSym() const { return m_bPrependCurrSym; }
+ void setPrependCurrSym(sal_Bool _bPrepend);
+
+protected:
+ virtual void FormatChanged(FORMAT_CHANGE_TYPE nWhat);
+
+ void UpdateCurrencyFormat();
+};
+
+#endif // _FMTFIELD_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/fontsubstconfig.hxx b/include/svtools/fontsubstconfig.hxx
new file mode 100644
index 000000000000..5221e29aa585
--- /dev/null
+++ b/include/svtools/fontsubstconfig.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVT_FONTSUBSTCONFIG_HXX
+#define _SVT_FONTSUBSTCONFIG_HXX
+
+#include "svtools/svtdllapi.h"
+#include <unotools/configitem.hxx>
+
+struct SvtFontSubstConfig_Impl;
+
+//-----------------------------------------------------------------------------
+struct SubstitutionStruct
+{
+ OUString sFont;
+ OUString sReplaceBy;
+ sal_Bool bReplaceAlways;
+ sal_Bool bReplaceOnScreenOnly;
+};
+//-----------------------------------------------------------------------------
+class SVT_DLLPUBLIC SvtFontSubstConfig : public utl::ConfigItem
+{
+ sal_Bool bIsEnabled;
+ SvtFontSubstConfig_Impl* pImpl;
+public:
+ SvtFontSubstConfig();
+ virtual ~SvtFontSubstConfig();
+
+ virtual void Commit();
+ virtual void Notify( const com::sun::star::uno::Sequence< OUString >& _rPropertyNames);
+
+ sal_Bool IsEnabled() const {return bIsEnabled;}
+ void Enable(sal_Bool bSet) {bIsEnabled = bSet; SetModified();}
+
+ sal_Int32 SubstitutionCount() const;
+ void ClearSubstitutions();
+ const SubstitutionStruct* GetSubstitution(sal_Int32 nPos);
+ void AddSubstitution(const SubstitutionStruct& rToAdd);
+ void Apply();
+};
+
+#endif
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/framestatuslistener.hxx b/include/svtools/framestatuslistener.hxx
new file mode 100644
index 000000000000..7543788f5afc
--- /dev/null
+++ b/include/svtools/framestatuslistener.hxx
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVTOOLS_FRAMESTATUSLISTENER_HXX
+#define _SVTOOLS_FRAMESTATUSLISTENER_HXX
+
+#include "svtools/svtdllapi.h"
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XFrameActionListener.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XStatusListener.hpp>
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <comphelper/broadcasthelper.hxx>
+
+#include <boost/unordered_map.hpp>
+
+namespace svt
+{
+
+class SVT_DLLPUBLIC FrameStatusListener : public ::com::sun::star::frame::XStatusListener,
+ public ::com::sun::star::frame::XFrameActionListener,
+ public ::com::sun::star::lang::XComponent,
+ public ::comphelper::OBaseMutex,
+ public ::cppu::OWeakObject
+{
+ public:
+ FrameStatusListener( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame );
+ virtual ~FrameStatusListener();
+
+ // methods to support status forwarder, known by the old sfx2 toolbox controller implementation
+ void addStatusListener( const OUString& aCommandURL );
+ void bindListener();
+ void unbindListener();
+ sal_Bool isBound() const;
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw ();
+ virtual void SAL_CALL release() throw ();
+
+ // XComponent
+ virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) = 0;
+
+ // XFrameActionListener
+ virtual void SAL_CALL frameAction( const com::sun::star::frame::FrameActionEvent& Action ) throw ( ::com::sun::star::uno::RuntimeException );
+
+ protected:
+ struct Listener
+ {
+ Listener( const ::com::sun::star::util::URL& rURL, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& rDispatch ) :
+ aURL( rURL ), xDispatch( rDispatch ) {}
+
+ ::com::sun::star::util::URL aURL;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch;
+ };
+
+ typedef ::boost::unordered_map< OUString,
+ com::sun::star::uno::Reference< com::sun::star::frame::XDispatch >,
+ OUStringHash,
+ ::std::equal_to< OUString > > URLToDispatchMap;
+
+ sal_Bool m_bInitialized : 1,
+ m_bDisposed : 1;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+ URLToDispatchMap m_aListenerMap;
+};
+
+}
+
+#endif // _SVTOOLS_FRAMESTATUSLISTENER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/generictoolboxcontroller.hxx b/include/svtools/generictoolboxcontroller.hxx
new file mode 100644
index 000000000000..f01d5428a44f
--- /dev/null
+++ b/include/svtools/generictoolboxcontroller.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __SVTOOLS_GENERICTOOLBOXCONTROLLER_HXX_
+#define __SVTOOLS_GENERICTOOLBOXCONTROLLER_HXX_
+
+#include "svtools/svtdllapi.h"
+#include <svtools/toolboxcontroller.hxx>
+#include <vcl/toolbox.hxx>
+
+namespace svt
+{
+
+struct ExecuteInfo;
+class SVT_DLLPUBLIC GenericToolboxController : public svt::ToolboxController
+{
+ public:
+ GenericToolboxController( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext,
+ const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame,
+ ToolBox* pToolBox,
+ sal_uInt16 nID,
+ const OUString& aCommand );
+ virtual ~GenericToolboxController();
+
+ // XComponent
+ virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XToolbarController
+ virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
+
+ DECL_STATIC_LINK( GenericToolboxController, ExecuteHdl_Impl, ExecuteInfo* );
+
+ private:
+ ToolBox* m_pToolbox;
+ sal_uInt16 m_nID;
+};
+
+}
+
+#endif // __SVTOOLS_GENERICTOOLBOXCONTROLLER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/genericunodialog.hxx b/include/svtools/genericunodialog.hxx
new file mode 100644
index 000000000000..808282255bf5
--- /dev/null
+++ b/include/svtools/genericunodialog.hxx
@@ -0,0 +1,185 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVT_GENERICUNODIALOG_HXX_
+#define _SVT_GENERICUNODIALOG_HXX_
+
+#include "svtools/svtdllapi.h"
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/lang/NotInitializedException.hpp>
+
+#include <cppuhelper/implbase3.hxx>
+#include <cppuhelper/propshlp.hxx>
+#include <comphelper/proparrhlp.hxx>
+#include <comphelper/uno3.hxx>
+#include <comphelper/propertycontainer.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <tools/link.hxx>
+
+class Dialog;
+class Window;
+class VclWindowEvent;
+
+//.........................................................................
+namespace svt
+{
+//.........................................................................
+
+ //=========================================================================
+#define UNODIALOG_PROPERTY_ID_TITLE 1
+#define UNODIALOG_PROPERTY_ID_PARENT 2
+
+#define UNODIALOG_PROPERTY_TITLE "Title"
+#define UNODIALOG_PROPERTY_PARENT "ParentWindow"
+
+
+ //=========================================================================
+ typedef ::cppu::WeakImplHelper3 < com::sun::star::ui::dialogs::XExecutableDialog
+ , com::sun::star::lang::XServiceInfo
+ , com::sun::star::lang::XInitialization
+ > OGenericUnoDialogBase;
+
+ /** abstract base class for implementing UNO objects representing dialogs (<type scope="com.sun.star.awt">XDialog</type>)
+ */
+ class SVT_DLLPUBLIC OGenericUnoDialog
+ :public OGenericUnoDialogBase
+ ,public ::comphelper::OMutexAndBroadcastHelper
+ ,public ::comphelper::OPropertyContainer
+ {
+ private:
+ ::osl::Mutex m_aExecutionMutex; /// acess safety for execute/cancel
+
+ protected:
+ Dialog* m_pDialog; /// the dialog to execute
+ sal_Bool m_bExecuting : 1; /// we're currently executing the dialog
+ sal_Bool m_bCanceled : 1; /// endDialog was called while we were executing
+ sal_Bool m_bTitleAmbiguous : 1; /// m_sTitle has not been set yet
+ bool m_bInitialized : 1; /// has "initialize" been called?
+ bool m_bNeedInitialization : 1; /// do we need to be initialized before any other API call is allowed?
+
+ // <properties>
+ OUString m_sTitle; /// title of the dialog
+ com::sun::star::uno::Reference<com::sun::star::awt::XWindow> m_xParent; /// parent window
+ // </properties>
+
+ com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> m_aContext;
+
+ public:
+ inline bool needInitialization() const { return m_bNeedInitialization && !m_bInitialized; }
+
+ protected:
+ OGenericUnoDialog(const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& _rxContext);
+ virtual ~OGenericUnoDialog();
+
+ public:
+ // UNO
+ DECLARE_UNO3_DEFAULTS(OGenericUnoDialog, OGenericUnoDialogBase);
+ virtual com::sun::star::uno::Any SAL_CALL queryInterface(const com::sun::star::uno::Type& _rType) throw (com::sun::star::uno::RuntimeException);
+
+ // XTypeProvider
+ virtual com::sun::star::uno::Sequence<com::sun::star::uno::Type> SAL_CALL getTypes( ) throw(com::sun::star::uno::RuntimeException);
+ virtual com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) throw(com::sun::star::uno::RuntimeException) = 0;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw(com::sun::star::uno::RuntimeException) = 0;
+ virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw(com::sun::star::uno::RuntimeException);
+ virtual ::comphelper::StringSequence SAL_CALL getSupportedServiceNames() throw(com::sun::star::uno::RuntimeException) = 0;
+
+ // OPropertySetHelper
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const com::sun::star::uno::Any& rValue ) throw(com::sun::star::uno::Exception);
+ virtual sal_Bool SAL_CALL convertFastPropertyValue( com::sun::star::uno::Any& rConvertedValue, com::sun::star::uno::Any& rOldValue, sal_Int32 nHandle, const com::sun::star::uno::Any& rValue) throw(com::sun::star::lang::IllegalArgumentException);
+
+ // XExecutableDialog
+ virtual void SAL_CALL setTitle( const OUString& aTitle ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL execute( ) 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);
+
+ protected:
+ /** create the concret dialog instance. note that m_aMutex is not locked when this method get's called,
+ but the application-wide solar mutex is (to guard the not thread-safe ctor of the dialog).
+ @param pParent the parent window for the new dialog
+ */
+ virtual Dialog* createDialog(Window* _pParent) = 0;
+
+ /// called to destroy the dialog used. the default implementation just deletes m_pDialog and resets it to NULL
+ virtual void destroyDialog();
+
+ /** called after the dialog has been executed
+ @param _nExecutionResult the execution result as returned by Dialog::Execute
+ */
+ virtual void executedDialog(sal_Int16 /*_nExecutionResult*/) { }
+
+ /** smaller form of <method>initialize</method>.<p/>
+ The <method>initialize</method> method is called with a sequence of <type scope="com.sun.star.uno">Any</type>'s,
+ which is split up into the single elements, which are passed to implInitialize. The default implementation
+ tries to exract an <type scope="com.sun.star.beans">PropertyValue</type> from the value an pass it to the
+ <type scope="com.sun.star.beans">XPropertySet</type> interface of the object.
+ */
+ virtual void implInitialize(const com::sun::star::uno::Any& _rValue);
+
+ private:
+ DECL_LINK( OnDialogDying, VclWindowEvent* );
+
+ /** ensures that m_pDialog is not <NULL/>
+
+ This method does nothing if m_pDialog is already non-<NULL/>. Else, it calls createDialog and does
+ all necessary initializations of the new dialog instance.
+
+ @precond
+ m_aMutex is locked
+
+ @return
+ <TRUE/> if and only if m_pDialog is non-<NULL/> upon returning from the method. Note that the only
+ case where m_pDialog is <NULL/> is when createDialog returned <NULL/>, which is will fire an assertion
+ in non-product builds.
+ */
+ bool impl_ensureDialog_lck();
+ };
+
+ /// helper class for guarding access to methods of a OGenericUnoDialog
+ class UnoDialogEntryGuard
+ {
+ public:
+ UnoDialogEntryGuard( OGenericUnoDialog& _rDialog )
+ :m_aGuard( _rDialog.GetMutex() )
+ {
+ if ( _rDialog.needInitialization() )
+ throw ::com::sun::star::lang::NotInitializedException();
+ }
+
+ private:
+ ::osl::MutexGuard m_aGuard;
+ };
+
+//.........................................................................
+} // namespace svt
+//.........................................................................
+
+#endif // _SVT_GENERICUNODIALOG_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/grfmgr.hxx b/include/svtools/grfmgr.hxx
new file mode 100644
index 000000000000..9a3bd8c1d1ff
--- /dev/null
+++ b/include/svtools/grfmgr.hxx
@@ -0,0 +1,624 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _GRFMGR_HXX
+#define _GRFMGR_HXX
+
+#include <vcl/graph.hxx>
+#include <svtools/svtdllapi.h>
+
+#define GRFMGR_DRAW_NOTCACHED 0x00000000UL
+#define GRFMGR_DRAW_CACHED 0x00000001UL
+#define GRFMGR_DRAW_SMOOTHSCALE 0x00000002UL
+#define GRFMGR_DRAW_USE_DRAWMODE_SETTINGS 0x00000004UL
+#define GRFMGR_DRAW_SUBSTITUTE 0x00000008UL
+#define GRFMGR_DRAW_NO_SUBSTITUTE 0x00000010UL
+#define GRFMGR_DRAW_STANDARD (GRFMGR_DRAW_CACHED|GRFMGR_DRAW_SMOOTHSCALE)
+
+// AutoSwap defines
+
+#define GRFMGR_AUTOSWAPSTREAM_LINK ((SvStream*)0x00000000UL)
+#define GRFMGR_AUTOSWAPSTREAM_LOADED ((SvStream*)0xfffffffdUL)
+#define GRFMGR_AUTOSWAPSTREAM_TEMP ((SvStream*)0xfffffffeUL)
+#define GRFMGR_AUTOSWAPSTREAM_NONE ((SvStream*)0xffffffffUL)
+
+// Adjustment defines
+
+#define ADJUSTMENT_NONE 0x00000000UL
+#define ADJUSTMENT_DRAWMODE 0x00000001UL
+#define ADJUSTMENT_COLORS 0x00000002UL
+#define ADJUSTMENT_MIRROR 0x00000004UL
+#define ADJUSTMENT_ROTATE 0x00000008UL
+#define ADJUSTMENT_TRANSPARENCY 0x00000010UL
+#define ADJUSTMENT_ALL 0xFFFFFFFFUL
+
+enum GraphicDrawMode
+{
+ GRAPHICDRAWMODE_STANDARD = 0,
+ GRAPHICDRAWMODE_GREYS = 1,
+ GRAPHICDRAWMODE_MONO = 2,
+ GRAPHICDRAWMODE_WATERMARK = 3
+};
+
+class GraphicManager;
+class SvStream;
+class BitmapWriteAccess;
+class GraphicCache;
+class VirtualDevice;
+struct GrfSimpleCacheObj;
+struct ImplTileInfo;
+
+class SVT_DLLPUBLIC GraphicAttr
+{
+private:
+
+ double mfGamma;
+ sal_uInt32 mnMirrFlags;
+ long mnLeftCrop;
+ long mnTopCrop;
+ long mnRightCrop;
+ long mnBottomCrop;
+ sal_uInt16 mnRotate10;
+ short mnContPercent;
+ short mnLumPercent;
+ short mnRPercent;
+ short mnGPercent;
+ short mnBPercent;
+ sal_Bool mbInvert;
+ sal_uInt8 mcTransparency;
+ GraphicDrawMode meDrawMode;
+
+public:
+
+ GraphicAttr();
+ ~GraphicAttr();
+
+ sal_Bool operator==( const GraphicAttr& rAttr ) const;
+ sal_Bool operator!=( const GraphicAttr& rAttr ) const { return !( *this == rAttr ); }
+
+ void SetDrawMode( GraphicDrawMode eDrawMode ) { meDrawMode = eDrawMode; }
+ GraphicDrawMode GetDrawMode() const { return meDrawMode; }
+
+ void SetMirrorFlags( sal_uLong nMirrFlags ) { mnMirrFlags = nMirrFlags; }
+ sal_uLong GetMirrorFlags() const { return mnMirrFlags; }
+
+ void SetCrop( long nLeft_100TH_MM, long nTop_100TH_MM, long nRight_100TH_MM, long nBottom_100TH_MM )
+ {
+ mnLeftCrop = nLeft_100TH_MM; mnTopCrop = nTop_100TH_MM;
+ mnRightCrop = nRight_100TH_MM; mnBottomCrop = nBottom_100TH_MM;
+ }
+ long GetLeftCrop() const { return mnLeftCrop; }
+ long GetTopCrop() const { return mnTopCrop; }
+ long GetRightCrop() const { return mnRightCrop; }
+ long GetBottomCrop() const { return mnBottomCrop; }
+
+ void SetRotation( sal_uInt16 nRotate10 ) { mnRotate10 = nRotate10; }
+ sal_uInt16 GetRotation() const { return mnRotate10; }
+
+ void SetLuminance( short nLuminancePercent ) { mnLumPercent = nLuminancePercent; }
+ short GetLuminance() const { return mnLumPercent; }
+
+ void SetContrast( short nContrastPercent ) { mnContPercent = nContrastPercent; }
+ short GetContrast() const { return mnContPercent; }
+
+ void SetChannelR( short nChannelRPercent ) { mnRPercent = nChannelRPercent; }
+ short GetChannelR() const { return mnRPercent; }
+
+ void SetChannelG( short nChannelGPercent ) { mnGPercent = nChannelGPercent; }
+ short GetChannelG() const { return mnGPercent; }
+
+ void SetChannelB( short nChannelBPercent ) { mnBPercent = nChannelBPercent; }
+ short GetChannelB() const { return mnBPercent; }
+
+ void SetGamma( double fGamma ) { mfGamma = fGamma; }
+ double GetGamma() const { return mfGamma; }
+
+ void SetInvert( sal_Bool bInvert ) { mbInvert = bInvert; }
+ sal_Bool IsInvert() const { return mbInvert; }
+
+ void SetTransparency( sal_uInt8 cTransparency ) { mcTransparency = cTransparency; }
+ sal_uInt8 GetTransparency() const { return mcTransparency; }
+
+ sal_Bool IsSpecialDrawMode() const { return( meDrawMode != GRAPHICDRAWMODE_STANDARD ); }
+ sal_Bool IsMirrored() const { return( mnMirrFlags != 0UL ); }
+ sal_Bool IsCropped() const
+ {
+ return( mnLeftCrop != 0 || mnTopCrop != 0 ||
+ mnRightCrop != 0 || mnBottomCrop != 0 );
+ }
+ sal_Bool IsRotated() const { return( ( mnRotate10 % 3600 ) != 0 ); }
+ sal_Bool IsTransparent() const { return( mcTransparency > 0 ); }
+ sal_Bool IsAdjusted() const
+ {
+ return( mnLumPercent != 0 || mnContPercent != 0 || mnRPercent != 0 ||
+ mnGPercent != 0 || mnBPercent != 0 || mfGamma != 1.0 || mbInvert );
+ }
+
+ friend SvStream& operator<<( SvStream& rOStm, const GraphicAttr& rAttr );
+ friend SvStream& operator>>( SvStream& rIStm, GraphicAttr& rAttr );
+};
+
+class SVT_DLLPUBLIC GraphicObject : public SvDataCopyStream
+{
+ friend class GraphicManager;
+
+private:
+
+ static GraphicManager* mpGlobalMgr;
+
+ Graphic maGraphic;
+ GraphicAttr maAttr;
+ Size maPrefSize;
+ MapMode maPrefMapMode;
+ sal_uLong mnSizeBytes;
+ GraphicType meType;
+ GraphicManager* mpMgr;
+ String* mpLink;
+ Link* mpSwapStreamHdl;
+ String* mpUserData;
+ Timer* mpSwapOutTimer;
+ GrfSimpleCacheObj* mpSimpleCache;
+ sal_uLong mnAnimationLoopCount;
+ sal_Bool mbAutoSwapped : 1;
+ sal_Bool mbTransparent : 1;
+ sal_Bool mbAnimated : 1;
+ sal_Bool mbEPS : 1;
+ sal_Bool mbIsInSwapIn : 1;
+ sal_Bool mbIsInSwapOut : 1;
+ sal_Bool mbAlpha : 1;
+
+ void SVT_DLLPRIVATE ImplConstruct();
+ void SVT_DLLPRIVATE ImplAssignGraphicData();
+ void SVT_DLLPRIVATE ImplSetGraphicManager(
+ const GraphicManager* pMgr,
+ const OString* pID = NULL,
+ const GraphicObject* pCopyObj = NULL
+ );
+ void SVT_DLLPRIVATE ImplAutoSwapIn();
+ sal_Bool SVT_DLLPRIVATE ImplIsAutoSwapped() const { return mbAutoSwapped; }
+ sal_Bool SVT_DLLPRIVATE ImplGetCropParams(
+ OutputDevice* pOut,
+ Point& rPt,
+ Size& rSz,
+ const GraphicAttr* pAttr,
+ PolyPolygon& rClipPolyPoly,
+ sal_Bool& bRectClipRegion
+ ) const;
+
+ /** Render a given number of tiles in an optimized way
+
+ This method recursively subdivides the tile rendering problem
+ in smaller parts, i.e. rendering output size x with few tiles
+ of size y, which in turn are generated from the original
+ bitmap in a recursive fashion. The subdivision size can be
+ controlled by the exponent argument, which specifies the
+ minimal number of smaller tiles used in one recursion
+ step. The resulting tile size is given as the integer number
+ of repetitions of the original bitmap along x and y. As the
+ exponent need not necessarily divide these numbers without
+ remainder, the repetition counts are effectively converted to
+ base-exponent numbers, where each place denotes the number of
+ times the corresponding tile size is rendered.
+
+ @param rVDev
+ Virtual device to render everything into
+
+ @param nExponent
+ Number of repetitions per subdivision step, _must_ be greater than 1
+
+ @param nNumTilesX
+ Number of original tiles to generate in x direction
+
+ @param nNumTilesY
+ Number of original tiles to generate in y direction
+
+ @param rTileSizePixel
+ Size in pixel of the original tile bitmap to render it in
+
+ @param pAttr
+ Graphic attributes to be used for rendering
+
+ @param nFlags
+ Graphic flags to be used for rendering
+
+ @param rCurrPos
+ Current output point for this recursion level (should start with (0,0))
+
+ @return true, if everything was successfully rendered.
+ */
+ bool SVT_DLLPRIVATE ImplRenderTempTile(
+ VirtualDevice& rVDev,
+ int nExponent,
+ int nNumTilesX,
+ int nNumTilesY,
+ const Size& rTileSizePixel,
+ const GraphicAttr* pAttr,
+ sal_uLong nFlags
+ );
+
+ /// internally called by ImplRenderTempTile()
+ bool SVT_DLLPRIVATE ImplRenderTileRecursive(
+ VirtualDevice& rVDev,
+ int nExponent,
+ int nMSBFactor,
+ int nNumOrigTilesX,
+ int nNumOrigTilesY,
+ int nRemainderTilesX,
+ int nRemainderTilesY,
+ const Size& rTileSizePixel,
+ const GraphicAttr* pAttr,
+ sal_uLong nFlags,
+ ImplTileInfo& rTileInfo
+ );
+
+ bool SVT_DLLPRIVATE ImplDrawTiled(
+ OutputDevice* pOut,
+ const Rectangle& rArea,
+ const Size& rSizePixel,
+ const Size& rOffset,
+ const GraphicAttr* pAttr,
+ sal_uLong nFlags,
+ int nTileCacheSize1D
+ );
+
+ bool SVT_DLLPRIVATE ImplDrawTiled(
+ OutputDevice& rOut,
+ const Point& rPos,
+ int nNumTilesX,
+ int nNumTilesY,
+ const Size& rTileSize,
+ const GraphicAttr* pAttr,
+ sal_uLong nFlags
+ );
+
+ void SVT_DLLPRIVATE ImplTransformBitmap(
+ BitmapEx& rBmpEx,
+ const GraphicAttr& rAttr,
+ const Size& rCropLeftTop,
+ const Size& rCropRightBottom,
+ const Rectangle& rCropRect,
+ const Size& rDstSize,
+ sal_Bool bEnlarge
+ ) const;
+
+ DECL_LINK( ImplAutoSwapOutHdl, void* );
+
+protected:
+
+ virtual void GraphicManagerDestroyed();
+ virtual SvStream* GetSwapStream() const;
+
+ virtual void Load( SvStream& );
+ virtual void Save( SvStream& );
+ virtual void Assign( const SvDataCopyStream& );
+
+public:
+
+ TYPEINFO();
+
+ GraphicObject( const GraphicManager* pMgr = NULL );
+ GraphicObject( const Graphic& rGraphic, const GraphicManager* pMgr = NULL );
+ GraphicObject( const GraphicObject& rCacheObj, const GraphicManager* pMgr = NULL );
+ explicit GraphicObject( const OString& rUniqueID, const GraphicManager* pMgr = NULL );
+ ~GraphicObject();
+
+ GraphicObject& operator=( const GraphicObject& rCacheObj );
+ sal_Bool operator==( const GraphicObject& rCacheObj ) const;
+ sal_Bool operator!=( const GraphicObject& rCacheObj ) const { return !( *this == rCacheObj ); }
+
+ sal_Bool HasSwapStreamHdl() const { return( mpSwapStreamHdl != NULL && mpSwapStreamHdl->IsSet() ); }
+ void SetSwapStreamHdl();
+ void SetSwapStreamHdl( const Link& rHdl, const sal_uLong nSwapOutTimeout = 0UL );
+ sal_uLong GetSwapOutTimeout() const { return( mpSwapOutTimer ? mpSwapOutTimer->GetTimeout() : 0 ); }
+
+ void FireSwapInRequest();
+ void FireSwapOutRequest();
+
+ GraphicManager& GetGraphicManager() const { return *mpMgr; }
+
+ sal_Bool IsCached(
+ OutputDevice* pOut,
+ const Point& rPt,
+ const Size& rSz,
+ const GraphicAttr* pAttr = NULL,
+ sal_uLong nFlags = GRFMGR_DRAW_STANDARD
+ ) const;
+ void ReleaseFromCache();
+
+ const Graphic& GetGraphic() const;
+ void SetGraphic( const Graphic& rGraphic, const GraphicObject* pCopyObj = 0);
+ void SetGraphic( const Graphic& rGraphic, const String& rLink );
+
+ /** Get graphic transformed according to given attributes
+
+ This method returns a Graphic transformed, cropped and scaled
+ to the given parameters, ready to be rendered to printer or
+ display. The returned graphic has the same visual appearance
+ as if it had been drawn via GraphicObject::Draw() to a
+ specific output device.
+
+ @param rDestSize
+ Desired output size in logical coordinates. The mapmode to
+ interpret these logical coordinates in is given by the second
+ parameter, rDestMap.
+
+ @param rDestMap
+ Mapmode the output should be interpreted in. This is used to
+ interpret rDestSize, to set the appropriate PrefMapMode on the
+ returned Graphic, and to deal correctly with metafile graphics.
+
+ @param rAttr
+ Graphic attributes used to transform the graphic. This
+ includes cropping, rotation, mirroring, and various color
+ adjustment parameters.
+
+ @return the readily transformed Graphic
+ */
+ Graphic GetTransformedGraphic(
+ const Size& rDestSize,
+ const MapMode& rDestMap,
+ const GraphicAttr& rAttr
+ ) const;
+ Graphic GetTransformedGraphic( const GraphicAttr* pAttr = NULL ) const; // TODO: Change to Impl
+
+ void SetAttr( const GraphicAttr& rAttr );
+ const GraphicAttr& GetAttr() const { return maAttr; }
+
+ sal_Bool HasLink() const { return( mpLink != NULL && mpLink->Len() > 0 ); }
+ void SetLink();
+ void SetLink( const String& rLink );
+ String GetLink() const;
+
+ sal_Bool HasUserData() const { return( mpUserData != NULL && mpUserData->Len() > 0 ); }
+ void SetUserData();
+ void SetUserData( const String& rUserData );
+ String GetUserData() const;
+
+ OString GetUniqueID() const;
+
+ GraphicType GetType() const { return meType; }
+ const Size& GetPrefSize() const { return maPrefSize; }
+ const MapMode& GetPrefMapMode() const { return maPrefMapMode; }
+ sal_uLong GetSizeBytes() const { return mnSizeBytes; }
+ sal_Bool IsTransparent() const { return mbTransparent; }
+ sal_Bool IsAlpha() const { return mbAlpha; }
+ sal_Bool IsAnimated() const { return mbAnimated; }
+ sal_Bool IsEPS() const { return mbEPS; }
+
+ Link GetAnimationNotifyHdl() const { return maGraphic.GetAnimationNotifyHdl(); }
+
+ sal_Bool SwapOut();
+ sal_Bool SwapOut( SvStream* pOStm );
+ sal_Bool SwapIn();
+
+ sal_Bool IsInSwapIn() const { return mbIsInSwapIn; }
+ sal_Bool IsInSwapOut() const { return mbIsInSwapOut; }
+ sal_Bool IsInSwap() const { return( mbIsInSwapOut || mbIsInSwapOut ); }
+ sal_Bool IsSwappedOut() const { return( mbAutoSwapped || maGraphic.IsSwapOut() ); }
+ void SetSwapState();
+
+ bool Draw(
+ OutputDevice* pOut,
+ const Point& rPt,
+ const Size& rSz,
+ const GraphicAttr* pAttr = NULL,
+ sal_uLong nFlags = GRFMGR_DRAW_STANDARD
+ );
+
+ sal_Bool DrawWithPDFHandling(
+ OutputDevice& rOutDev,
+ const Point& rPt,
+ const Size& rSz,
+ const GraphicAttr* pGrfAttr = NULL,
+ const sal_uLong nFlags = GRFMGR_DRAW_STANDARD
+ );
+
+ /** Draw the graphic repeatedly into the given output rectangle
+
+ @param pOut
+ OutputDevice where the rendering should take place
+
+ @param rArea
+ The output area that is filled with tiled instances of this graphic
+
+ @param rSize
+ The actual size of a single tile
+
+ @param rOffset
+ Offset from the left, top position of rArea, where to start
+ the tiling. The upper left corner of the graphic tilings will
+ virtually start at this position. Concretely, only that many
+ tiles are drawn to completely fill the given output area.
+
+ @param pAttr
+ Optional GraphicAttr
+
+ @param nFlags
+ Optional rendering flags
+
+ @param nTileCacheSize1D
+ Optional dimension of the generated cache tiles. The pOut sees
+ a number of tile draws, which have approximately
+ nTileCacheSize1D times nTileCacheSize1D bitmap sizes if the
+ tile bitmap is smaller. Otherwise, the tile is drawn as
+ is. This is useful if e.g. you want only a few, very large
+ bitmap drawings appear on the outdev.
+
+ @return sal_True, if drawing completed successfully
+ */
+ sal_Bool DrawTiled(
+ OutputDevice* pOut,
+ const Rectangle& rArea,
+ const Size& rSize,
+ const Size& rOffset,
+ const GraphicAttr* pAttr = NULL,
+ sal_uLong nFlags = GRFMGR_DRAW_STANDARD,
+ int nTileCacheSize1D=128
+ );
+
+ sal_Bool StartAnimation(
+ OutputDevice* pOut,
+ const Point& rPt,
+ const Size& rSz,
+ long nExtraData = 0L,
+ const GraphicAttr* pAttr = NULL,
+ sal_uLong nFlags = GRFMGR_DRAW_STANDARD,
+ OutputDevice* pFirstFrameOutDev = NULL
+ );
+
+ void StopAnimation( OutputDevice* pOut = NULL, long nExtraData = 0L );
+
+ friend SvStream& operator<<( SvStream& rOStm, const GraphicObject& rGraphicObj );
+ friend SvStream& operator>>( SvStream& rIStm, GraphicObject& rGraphicObj );
+
+ static GraphicObject CreateGraphicObjectFromURL( const OUString &rURL );
+ // will inspect an object ( e.g. a control ) for any 'ImageURL'
+ // properties and return these in a vector. Note: this implementation
+ // will cater for XNameContainer objects and deepinspect any containees
+ // if they exist
+ static void InspectForGraphicObjectImageURL( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIf, std::vector< OUString >& rvEmbedImgUrls );
+};
+
+typedef ::std::vector< GraphicObject* > GraphicObjectList_impl;
+
+class SVT_DLLPUBLIC GraphicManager
+{
+ friend class GraphicObject;
+ friend class GraphicDisplayCacheEntry;
+
+private:
+
+ GraphicObjectList_impl maObjList;
+ GraphicCache* mpCache;
+
+ GraphicManager( const GraphicManager& ) {}
+ GraphicManager& operator=( const GraphicManager& ) { return *this; }
+
+ sal_Bool SVT_DLLPRIVATE ImplDraw(
+ OutputDevice* pOut,
+ const Point& rPt,
+ const Size& rSz,
+ GraphicObject& rObj,
+ const GraphicAttr& rAttr,
+ const sal_uLong nFlags,
+ sal_Bool& rCached
+ );
+
+ sal_Bool SVT_DLLPRIVATE ImplCreateOutput(
+ OutputDevice* pOut,
+ const Point& rPt,
+ const Size& rSz,
+ const BitmapEx& rBmpEx,
+ const GraphicAttr& rAttr,
+ const sal_uLong nFlags,
+ BitmapEx* pBmpEx = NULL
+ );
+ sal_Bool SVT_DLLPRIVATE ImplCreateOutput(
+ OutputDevice* pOut,
+ const Point& rPt,
+ const Size& rSz,
+ const GDIMetaFile& rMtf,
+ const GraphicAttr& rAttr,
+ const sal_uLong nFlags,
+ GDIMetaFile& rOutMtf,
+ BitmapEx& rOutBmpEx
+ );
+
+ static void SVT_DLLPRIVATE ImplAdjust(
+ BitmapEx& rBmpEx,
+ const GraphicAttr& rAttr,
+ sal_uLong nAdjustmentFlags
+ );
+ static void SVT_DLLPRIVATE ImplAdjust(
+ GDIMetaFile& rMtf,
+ const GraphicAttr& rAttr,
+ sal_uLong nAdjustmentFlags
+ );
+ static void SVT_DLLPRIVATE ImplAdjust(
+ Animation& rAnimation,
+ const GraphicAttr& rAttr,
+ sal_uLong nAdjustmentFlags
+ );
+
+ static void SVT_DLLPRIVATE ImplDraw(
+ OutputDevice* pOut,
+ const Point& rPt,
+ const Size& rSz,
+ const GDIMetaFile& rMtf,
+ const GraphicAttr& rAttr
+ );
+
+ // Only used by GraphicObject's Ctor's and Dtor's
+ void SVT_DLLPRIVATE ImplRegisterObj(
+ const GraphicObject& rObj,
+ Graphic& rSubstitute,
+ const OString* pID = NULL,
+ const GraphicObject* pCopyObj = NULL
+ );
+ void SVT_DLLPRIVATE ImplUnregisterObj( const GraphicObject& rObj );
+ inline sal_Bool SVT_DLLPRIVATE ImplHasObjects() const { return !maObjList.empty(); }
+
+ // Only used in swap case by GraphicObject
+ void SVT_DLLPRIVATE ImplGraphicObjectWasSwappedOut( const GraphicObject& rObj );
+ sal_Bool SVT_DLLPRIVATE ImplFillSwappedGraphicObject(
+ const GraphicObject& rObj,
+ Graphic& rSubstitute
+ );
+ void SVT_DLLPRIVATE ImplGraphicObjectWasSwappedIn( const GraphicObject& rObj );
+
+ OString SVT_DLLPRIVATE ImplGetUniqueID( const GraphicObject& rObj ) const;
+
+public:
+
+ GraphicManager( sal_uLong nCacheSize = 10000000UL, sal_uLong nMaxObjCacheSize = 2400000UL );
+ ~GraphicManager();
+
+ void SetMaxCacheSize( sal_uLong nNewCacheSize );
+
+ void SetMaxObjCacheSize(
+ sal_uLong nNewMaxObjSize,
+ sal_Bool bDestroyGreaterCached = sal_False
+ );
+
+ void SetCacheTimeout( sal_uLong nTimeoutSeconds );
+
+ void ReleaseFromCache( const GraphicObject& rObj );
+
+ sal_Bool IsInCache(
+ OutputDevice* pOut,
+ const Point& rPt,
+ const Size& rSz,
+ const GraphicObject& rObj,
+ const GraphicAttr& rAttr
+ ) const;
+
+ sal_Bool DrawObj(
+ OutputDevice* pOut,
+ const Point& rPt,
+ const Size& rSz,
+ GraphicObject& rObj,
+ const GraphicAttr& rAttr,
+ const sal_uLong nFlags,
+ sal_Bool& rCached
+ );
+};
+
+#endif // _GRFMGR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/headbar.hxx b/include/svtools/headbar.hxx
new file mode 100644
index 000000000000..9be63ce3229d
--- /dev/null
+++ b/include/svtools/headbar.hxx
@@ -0,0 +1,377 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _HEADBAR_HXX
+#define _HEADBAR_HXX
+
+#include "svtools/svtdllapi.h"
+#include <tools/link.hxx>
+#include <vcl/window.hxx>
+
+/*************************************************************************
+
+Beschreibung
+============
+
+class HeaderBar
+
+Diese Klasse dient zur Anzeige einer Ueberschiftszeile. Diese kann Texte,
+Images oder beides anzeigen. Man kann die Items in der Groesse aendern,
+verschieben oder anklicken. In vielen Faellen macht es zum Beispiel Sinn,
+dieses Control mit einer SvTabListBox zu verbinden.
+
+--------------------------------------------------------------------------
+
+WinBits
+
+WB_BORDER Oben und unten wird ein Border gezeichnet
+WB_BOTTOMBORDER Unten wird ein Border gezeichnet
+WB_BUTTONSTYLE Die Items sehen aus wie Buttons, ansonsten sind sie flach
+WB_3DLOOK 3D-Darstellung
+WB_DRAG Items koennen verschoben werden
+WB_STDHEADERBAR WB_BUTTONSTYLE | WB_BOTTOMBORDER
+
+--------------------------------------------------------------------------
+
+ItemBits
+
+HIB_LEFT Inhalt wird im Item linksbuendig ausgegeben
+HIB_CENTER Inhalt wird im Item zentriert ausgegeben
+HIB_RIGHT Inhalt wird im Item rechtsbuendig ausgegeben
+HIB_TOP Inhalt wird im Item an der oberen Kante ausgegeben
+HIB_VCENTER Inhalt wird im Item vertikal zentiert ausgegeben
+HIB_BOTTOM Inhalt wird im Item an der unteren Kante ausgegeben
+HIB_LEFTIMAGE Bei Text und Image, wird Image links vom Text ausgegeben
+HIB_RIGHTIMAGE Bei Text und Image, wird Image rechts vom Text ausgegeben
+HIB_FIXED Item laesst sich nicht in der Groesse aendern
+HIB_FIXEDPOS Item laesst sich nicht verschieben
+HIB_CLICKABLE Item laesst sich anklicken
+ (Select-Handler wird erst bei MouseButtonUp gerufen)
+HIB_FLAT Item wird flach dargestellt, auch wenn WB_BUTTONSTYLE gesetzt ist
+HIB_DOWNARROW Es wird ein Pfeil nach unter hinter dem Text ausgegeben,
+ welcher zum Beispiel angezeigt werden sollte, wenn nach
+ diesem Item eine dazugehoerende Liste absteigend sortiert
+ ist. Der Status des Pfeils kann mit SetItemBits()
+ gesetzt/zurueckgesetzt werden.
+HIB_UPARROW Es wird ein Pfeil nach oben hinter dem Text ausgegeben,
+ welcher zum Beispiel angezeigt werden sollte, wenn nach
+ diesem Item eine dazugehoerende Liste aufsteigend sortiert
+ ist.Der Status des Pfeils kann mit SetItemBits()
+ gesetzt/zurueckgesetzt werden.
+HIB_USERDRAW Zu diesem Item wird auch der UserDraw-Handler gerufen.
+HIB_STDSTYLE (HIB_LEFT | HIB_LEFTIMAGE | HIB_VCENTER | HIB_CLICKABLE)
+
+--------------------------------------------------------------------------
+
+Handler
+
+Select() Wird gerufen, wenn Item angeklickt wird. Wenn
+ HIB_CLICKABLE beim Item gesetzt ist und nicht HIB_FLAT,
+ wird der Handler erst im MouseButtonUp-Handler gerufen,
+ wenn die Maus ueber dem Item losgelassen wurde. Dann
+ verhaellt sich der Select-Handler wie bei einem
+ ToolBox-Button.
+DoubleClick() Dieser Handler wird gerufen, wenn ein Item
+ doppelt geklickt wird. Ob das Item oder der
+ Trenner angeklickt wurden, kann mit IsItemMode()
+ abgefragt werden. Wenn ein Trenner doppelt angeklickt
+ wird, sollte normalerweise die optimale Spaltenbreite
+ berechnet werden und diese gesetzt werden.
+StartDrag() Dieser Handler wird gerufen, wenn Draggen gestartet
+ wird, bzw. wenn ein Item angeklickt wurde.
+ In diesem Handler sollte spaetestens mit SetDragSize()
+ die Groesse der Size-Linie gesetzt werden, wenn
+ IsItemMode() sal_False zurueckliefert.
+Drag() Dieser Handler wird gerufen, wenn gedraggt wird. Wenn
+ mit SetDragSize() keine Groesse gesetzt wird, kann
+ dieser Handler dafuer benutzt werden, um die
+ Linie im angrenzenden Fenster selber zu zeichnen. Mit
+ GetDragPos() kann die aktuelle Drag-Position abgefragt
+ werden. Mit IsItemMode() sollte in diesem Fall
+ abgefragt werden, ob auch ein Trenner gedraggt wird.
+EndDrag() Dieser Handler wird gerufen, wenn ein Drag-Vorgang
+ beendet wurde. Wenn im EndDrag-Handler GetCurItemId()
+ 0 zurueckliefert, wurde der Drag-Vorgang abgebrochen.
+ Wenn dies nicht der Fall ist und IsItemMode() sal_False
+ zurueckliefert, sollte von dem gedraggten Item
+ die neue Groesse mit GetItemSize() abgefragt werden
+ und entsprechend im dazugehoerigem Control uebernommen
+ werden. Wenn IsItemMode() sal_True, GetCurItemId() eine Id
+ und IsItemDrag() sal_True zurueckliefert, wurde dieses
+ Item verschoben. Es sollte dann mit GetItemPos() die
+ neue Position abgefragt werden und auch die Daten
+ im dazugehoerigem Control angepasst werden. Ansonsten
+ koennte auch mit GetItemDragPos() die Position abgefragt
+ werden, an welche Stelle das Item verschoben wurde.
+
+
+Weitere Methoden, die fuer die Handler wichtig sind.
+
+GetCurItemId() Liefert die Id vom Item zurueck, fuer welches gerade
+ der Handler gerufen wurde. Liefert nur eine gueltige
+ Id in den Handlern Select(), DoubleClick(), StartDrag(),
+ Drag() und EndDrag(). Im EndDrag-Handler leifert
+ diese Methode die Id vom gedraggten Item zurueck oder
+ 0, wenn der Drag-Vorgang abgebrochen wurde.
+GetItemDragPos() Liefert die Position zurueck, an der ein Item verschoben
+ wird bzw. wurde. HEADERBAR_ITEM_NOTFOUND wird
+ zurueckgeliefert, wenn der Vorgang abgebrochen wurde
+ oder wenn kein ItemDrag aktiv ist.
+IsItemMode() Mit dieser Methode kann abgefragt werden, ob fuer ein
+ Item oder einen Trenner der Handler gerufen wurde.
+ sal_True - Handler wurde fuer das Item gerufen
+ sal_False - Handler wurde fuer den Trenner gerufen
+IsItemDrag() Mit dieser Methode kann abgefragt werden, ob ein
+ Item gedragt oder selektiert wurde.
+ sal_True - Item wird verschoben
+ sal_False - Item wird selektiert
+SetDragSize() Mit dieser Methode wird gesetzt, wir gross der
+ Trennstrich sein soll, der vom Control gemalt wird.
+ Dies sollte so gross sein, wie das angrenzende Fenster
+ hoch ist. Die Hoehe vom HeaderBar wird automatisch
+ dazugerechnet.
+
+--------------------------------------------------------------------------
+
+Weitere Methoden
+
+SetOffset() Mit dieser Methode wird der Offset gesetzt, ab dem
+ die Items ausgegeben werden. Dies wird benoetigt,
+ wenn das dazugehoerige Fenster gescrollt wird.
+CalcWindowSizePixel() Mit dieser Methode kann man die Hoehe des Fensters
+ berechnen, damit der Inhalt der Items ausgegeben
+ werden kann.
+
+--------------------------------------------------------------------------
+
+Tips und Tricks:
+
+1) KontextMenu
+Wenn ein kontextsensitives PopupMenu anzeigt werden soll, muss der
+Command-Handler ueberlagert werden. Mit GetItemId() und bei
+Uebergabe der Mausposition kann ermittelt werden, ob der Mausclick
+ueber einem bzw. ueber welchem Item durchgefuehrt wurde.
+
+2) Letztes Item
+Wenn man ButtonStyle gesetzt hat, sieht es besser aus, wenn man am
+Ende noch ein leeres Item setzt, was den restlichen Platz einnimmt.
+Dazu fuegt man ein Item mit einem leeren String ein und uebergibt als
+Groesse HEADERBAR_FULLSIZE. Bei diesem Item sollte man dann auch
+nicht HIB_CLICKABLE setzen und dafuer HIB_FIXEDPOS.
+
+*************************************************************************/
+
+class Accelerator;
+class ImplHeadItem;
+
+typedef ::std::vector< ImplHeadItem* > ImplHeadItemList;
+
+// -----------
+// - WinBits -
+// -----------
+
+#define WB_BOTTOMBORDER ((WinBits)0x0400)
+#define WB_BUTTONSTYLE ((WinBits)0x0800)
+#define WB_STDHEADERBAR (WB_BUTTONSTYLE | WB_BOTTOMBORDER)
+
+// ---------------------
+// - HeaderBarItemBits -
+// ---------------------
+
+typedef sal_uInt16 HeaderBarItemBits;
+
+// ----------------------------
+// - Bits fuer HeaderBarItems -
+// ----------------------------
+
+#define HIB_LEFT ((HeaderBarItemBits)0x0001)
+#define HIB_CENTER ((HeaderBarItemBits)0x0002)
+#define HIB_RIGHT ((HeaderBarItemBits)0x0004)
+#define HIB_TOP ((HeaderBarItemBits)0x0008)
+#define HIB_VCENTER ((HeaderBarItemBits)0x0010)
+#define HIB_BOTTOM ((HeaderBarItemBits)0x0020)
+#define HIB_LEFTIMAGE ((HeaderBarItemBits)0x0040)
+#define HIB_RIGHTIMAGE ((HeaderBarItemBits)0x0080)
+#define HIB_FIXED ((HeaderBarItemBits)0x0100)
+#define HIB_FIXEDPOS ((HeaderBarItemBits)0x0200)
+#define HIB_CLICKABLE ((HeaderBarItemBits)0x0400)
+#define HIB_FLAT ((HeaderBarItemBits)0x0800)
+#define HIB_DOWNARROW ((HeaderBarItemBits)0x1000)
+#define HIB_UPARROW ((HeaderBarItemBits)0x2000)
+#define HIB_USERDRAW ((HeaderBarItemBits)0x4000)
+#define HIB_STDSTYLE (HIB_LEFT | HIB_LEFTIMAGE | HIB_VCENTER | HIB_CLICKABLE)
+
+// -------------------
+// - HeaderBar-Types -
+// -------------------
+
+#define HEADERBAR_APPEND ((sal_uInt16)0xFFFF)
+#define HEADERBAR_ITEM_NOTFOUND ((sal_uInt16)0xFFFF)
+#define HEADERBAR_FULLSIZE ((long)1000000000)
+
+#define HEADERBAR_TEXTOFF 2
+
+// -------------
+// - HeaderBar -
+// -------------
+
+class SVT_DLLPUBLIC HeaderBar : public Window
+{
+private:
+ ImplHeadItemList* mpItemList;
+ long mnBorderOff1;
+ long mnBorderOff2;
+ long mnOffset;
+ long mnDX;
+ long mnDY;
+ long mnDragSize;
+ long mnStartPos;
+ long mnDragPos;
+ long mnMouseOff;
+ sal_uInt16 mnCurItemId;
+ sal_uInt16 mnItemDragPos;
+ sal_Bool mbDragable;
+ sal_Bool mbDrag;
+ sal_Bool mbItemDrag;
+ sal_Bool mbOutDrag;
+ sal_Bool mbButtonStyle;
+ sal_Bool mbItemMode;
+ Link maStartDragHdl;
+ Link maDragHdl;
+ Link maEndDragHdl;
+ Link maSelectHdl;
+ Link maDoubleClickHdl;
+ Link maCreateAccessibleHdl;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >
+ mxAccessible;
+
+#ifdef _SV_HEADBAR_CXX
+ using Window::ImplInit;
+ SVT_DLLPRIVATE void ImplInit( WinBits nWinStyle );
+ SVT_DLLPRIVATE void ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground );
+ SVT_DLLPRIVATE long ImplGetItemPos( sal_uInt16 nPos ) const;
+ SVT_DLLPRIVATE Rectangle ImplGetItemRect( sal_uInt16 nPos ) const;
+ using Window::ImplHitTest;
+ SVT_DLLPRIVATE sal_uInt16 ImplHitTest( const Point& rPos, long& nMouseOff, sal_uInt16& nPos ) const;
+ SVT_DLLPRIVATE void ImplInvertDrag( sal_uInt16 nStartPos, sal_uInt16 nEndPos );
+ SVT_DLLPRIVATE void ImplDrawItem( OutputDevice* pDev,
+ sal_uInt16 nPos, sal_Bool bHigh, sal_Bool bDrag,
+ const Rectangle& rItemRect,
+ const Rectangle* pRect,
+ sal_uLong nFlags );
+ SVT_DLLPRIVATE void ImplDrawItem( sal_uInt16 nPos, sal_Bool bHigh = sal_False,
+ sal_Bool bDrag = sal_False,
+ const Rectangle* pRect = NULL );
+ SVT_DLLPRIVATE void ImplUpdate( sal_uInt16 nPos,
+ sal_Bool bEnd = sal_False, sal_Bool bDirect = sal_False );
+ SVT_DLLPRIVATE void ImplStartDrag( const Point& rPos, sal_Bool bCommand );
+ SVT_DLLPRIVATE void ImplDrag( const Point& rPos );
+ SVT_DLLPRIVATE void ImplEndDrag( sal_Bool bCancel );
+#endif
+
+public:
+ HeaderBar( Window* pParent, WinBits nWinBits = WB_STDHEADERBAR );
+ HeaderBar( Window* pParent, const ResId& rResId );
+ ~HeaderBar();
+
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void Tracking( const TrackingEvent& rTEvt );
+ virtual void Paint( const Rectangle& rRect );
+ virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags );
+ virtual void Resize();
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+ virtual void StateChanged( StateChangedType nStateChange );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ virtual void UserDraw( const UserDrawEvent& rUDEvt );
+ virtual void StartDrag();
+ virtual void Drag();
+ virtual void EndDrag();
+ virtual void Select();
+ virtual void DoubleClick();
+
+ void InsertItem( sal_uInt16 nItemId, const XubString& rText,
+ long nSize, HeaderBarItemBits nBits = HIB_STDSTYLE,
+ sal_uInt16 nPos = HEADERBAR_APPEND );
+ void RemoveItem( sal_uInt16 nItemId );
+ void MoveItem( sal_uInt16 nItemId, sal_uInt16 nNewPos );
+ void Clear();
+
+ void SetOffset( long nNewOffset = 0 );
+ long GetOffset() const { return mnOffset; }
+ inline void SetDragSize( long nNewSize = 0 ) { mnDragSize = nNewSize; }
+ long GetDragSize() const { return mnDragSize; }
+
+ sal_uInt16 GetItemCount() const;
+ sal_uInt16 GetItemPos( sal_uInt16 nItemId ) const;
+ sal_uInt16 GetItemId( sal_uInt16 nPos ) const;
+ sal_uInt16 GetItemId( const Point& rPos ) const;
+ Rectangle GetItemRect( sal_uInt16 nItemId ) const;
+ sal_uInt16 GetCurItemId() const { return mnCurItemId; }
+ long GetDragPos() const { return mnDragPos; }
+ sal_uInt16 GetItemDragPos() const { return mnItemDragPos; }
+ sal_Bool IsItemMode() const { return mbItemMode; }
+ sal_Bool IsItemDrag() const { return mbItemDrag; }
+
+ void SetItemSize( sal_uInt16 nItemId, long nNewSize );
+ long GetItemSize( sal_uInt16 nItemId ) const;
+ void SetItemBits( sal_uInt16 nItemId, HeaderBarItemBits nNewBits );
+ HeaderBarItemBits GetItemBits( sal_uInt16 nItemId ) const;
+
+ void SetItemText( sal_uInt16 nItemId, const XubString& rText );
+ XubString GetItemText( sal_uInt16 nItemId ) const;
+
+ XubString GetHelpText( sal_uInt16 nItemId ) const;
+ OString GetHelpId( sal_uInt16 nItemId ) const;
+
+ Size CalcWindowSizePixel() const;
+
+ inline void SetHelpText( const String& rText ) { Window::SetHelpText( rText ); }
+ inline const String& GetHelpText() const { return Window::GetHelpText(); }
+ inline void SetHelpId( const OString& rId ) { Window::SetHelpId( rId ); }
+ inline const OString& GetHelpId() const { return Window::GetHelpId(); }
+
+ inline void SetStartDragHdl( const Link& rLink ) { maStartDragHdl = rLink; }
+ inline const Link& GetStartDragHdl() const { return maStartDragHdl; }
+ inline void SetDragHdl( const Link& rLink ) { maDragHdl = rLink; }
+ inline const Link& GetDragHdl() const { return maDragHdl; }
+ inline void SetEndDragHdl( const Link& rLink ) { maEndDragHdl = rLink; }
+ inline const Link& GetEndDragHdl() const { return maEndDragHdl; }
+ inline void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; }
+ inline const Link& GetSelectHdl() const { return maSelectHdl; }
+ inline void SetDoubleClickHdl( const Link& rLink ) { maDoubleClickHdl = rLink; }
+ inline const Link& GetDoubleClickHdl() const { return maDoubleClickHdl; }
+ inline void SetCreateAccessibleHdl( const Link& rLink ) { maCreateAccessibleHdl = rLink; }
+ inline const Link& GetCreateAccessibleHdl() const { return maCreateAccessibleHdl; }
+
+ inline sal_Bool IsDragable() const { return mbDragable; }
+
+ /** Creates and returns the accessible object of the header bar. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > CreateAccessible();
+ void SetAccessible( ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > );
+};
+
+#endif // _HEADBAR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/helpid.hrc b/include/svtools/helpid.hrc
new file mode 100644
index 000000000000..0751c5b70cd7
--- /dev/null
+++ b/include/svtools/helpid.hrc
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVT_HELPID_HRC
+#define _SVT_HELPID_HRC
+
+#define HID_FILEDLG_PATHDLG "SVT_HID_FILEDLG_PATHDLG"
+#define HID_FILEDLG_DIR "SVT_HID_FILEDLG_DIR"
+#define HID_FILEDLG_EDIT "SVT_HID_FILEDLG_EDIT"
+#define HID_FILEDLG_DIRS "SVT_HID_FILEDLG_DIRS"
+#define HID_FILEDLG_DRIVE "SVT_HID_FILEDLG_DRIVE"
+#define HID_FILEDLG_DRIVES "SVT_HID_FILEDLG_DRIVES"
+#define HID_FILEDLG_NEWDIR "SVT_HID_FILEDLG_NEWDIR"
+#define HID_FILEDLG_HOME "SVT_HID_FILEDLG_HOME"
+#define HID_FILEDLG_FILE "SVT_HID_FILEDLG_FILE"
+#define HID_FILEDLG_LINK_CB "SVT_HID_FILEDLG_LINK_CB"
+#define HID_FILEDLG_PREVIEW_CB "SVT_HID_FILEDLG_PREVIEW_CB"
+#define HID_FILEDLG_STANDARD "SVT_HID_FILEDLG_STANDARD"
+#define HID_FILEDLG_MANAGER "SVT_HID_FILEDLG_MANAGER"
+#define HID_FILEDLG_URL "SVT_HID_FILEDLG_URL"
+#define HID_FILEDLG_USE_PASSWD "SVT_HID_FILEDLG_USE_PASSWD"
+#define HID_FILEDLG_READ_ONLY "SVT_HID_FILEDLG_READ_ONLY"
+#define HID_FILEDLG_AUTOCOMPLETEBOX "SVT_HID_FILEDLG_AUTOCOMPLETEBOX"
+#define HID_FILEDLG_SAVE_BTN "SVT_HID_FILEDLG_SAVE_BTN"
+#define HID_FILEDLG_SAVE_FILENAME "SVT_HID_FILEDLG_SAVE_FILENAME"
+#define HID_FILEDLG_SAVE_FILETYPE "SVT_HID_FILEDLG_SAVE_FILETYPE"
+#define HID_FILEDLG_INSERT_BTN "SVT_HID_FILEDLG_INSERT_BTN"
+#define HID_FILEDLG_PATH_BTN "SVT_HID_FILEDLG_PATH_BTN"
+#define HID_FILEDLG_PATH_FILENAME "SVT_HID_FILEDLG_PATH_FILENAME"
+#define HID_FILEDLG_FOLDER_BTN "SVT_HID_FILEDLG_FOLDER_BTN"
+#define HID_FILEDLG_FOLDER_FILENAME "SVT_HID_FILEDLG_FOLDER_FILENAME"
+#define HID_FILEDLG_SRCHFOLDER_BTN "SVT_HID_FILEDLG_SRCHFOLDER_BTN"
+#define HID_FILEDLG_EDIT_FAVORITES_LISTBOX "SVT_HID_FILEDLG_EDIT_FAVORITES_LISTBOX"
+#define HID_FILEDLG_EDIT_FAVORITES_HEADERBAR "SVT_HID_FILEDLG_EDIT_FAVORITES_HEADERBAR"
+
+// Help ids of template dialog
+#define HID_TEMPLATEDLG_DIALOG "SVT_HID_TEMPLATEDLG_DIALOG"
+#define HID_TEMPLATEDLG_ICONCTRL "SVT_HID_TEMPLATEDLG_ICONCTRL"
+#define HID_TEMPLATEDLG_FILEVIEW "SVT_HID_TEMPLATEDLG_FILEVIEW"
+#define HID_TEMPLATEDLG_TB_BACK "SVT_HID_TEMPLATEDLG_TB_BACK"
+#define HID_TEMPLATEDLG_TB_PREV "SVT_HID_TEMPLATEDLG_TB_PREV"
+#define HID_TEMPLATEDLG_TB_PRINT "SVT_HID_TEMPLATEDLG_TB_PRINT"
+#define HID_TEMPLATEDLG_TB_DOCINFO "SVT_HID_TEMPLATEDLG_TB_DOCINFO"
+#define HID_TEMPLATEDLG_TB_PREVIEW "SVT_HID_TEMPLATEDLG_TB_PREVIEW"
+
+// Help ids for the filepicker dialogs
+#define HID_EXPLORERDLG_FILE "SVT_HID_EXPLORERDLG_FILE"
+
+// help ids for fileview contextmenu
+#define HID_FILEVIEW_MENU_DELETE "SVT_HID_FILEVIEW_MENU_DELETE"
+#define HID_FILEVIEW_MENU_RENAME "SVT_HID_FILEVIEW_MENU_RENAME"
+
+// help ids for the different modi of the file picker dialog
+ // FREE
+#define HID_FILESAVE_LEVELUP "SVT_HID_FILESAVE_LEVELUP"
+#define HID_FILESAVE_CREATEDIRECTORY "SVT_HID_FILESAVE_CREATEDIRECTORY"
+#define HID_FILESAVE_DEFAULTDIRECTORY "SVT_HID_FILESAVE_DEFAULTDIRECTORY"
+#define HID_FILESAVE_FILEVIEW "SVT_HID_FILESAVE_FILEVIEW"
+#define HID_FILESAVE_TEMPLATE "SVT_HID_FILESAVE_TEMPLATE"
+#define HID_FILESAVE_FILEURL "SVT_HID_FILESAVE_FILEURL"
+#define HID_FILESAVE_FILETYPE "SVT_HID_FILESAVE_FILETYPE"
+#define HID_FILESAVE_DOSAVE "SVT_HID_FILESAVE_DOSAVE"
+#define HID_FILESAVE_AUTOEXTENSION "SVT_HID_FILESAVE_AUTOEXTENSION"
+#define HID_FILESAVE_SAVEWITHPASSWORD "SVT_HID_FILESAVE_SAVEWITHPASSWORD"
+#define HID_FILESAVE_CUSTOMIZEFILTER "SVT_HID_FILESAVE_CUSTOMIZEFILTER"
+#define HID_FILESAVE_SELECTION "SVT_HID_FILESAVE_SELECTION"
+#define HID_FILESAVE_DIALOG "SVT_HID_FILESAVE_DIALOG"
+#define HID_FILESAVE_DOPLAY "SVT_HID_FILESAVE_DOPLAY"
+
+#define HID_FILEOPEN_READONLY "SVT_HID_FILEOPEN_READONLY"
+#define HID_FILEOPEN_VERSION "SVT_HID_FILEOPEN_VERSION"
+#define HID_FILEOPEN_IMAGE_TEMPLATE "SVT_HID_FILEOPEN_IMAGE_TEMPLATE"
+
+#define HID_PRINTDIALOG_TOFILE "SVT_HID_PRINTDIALOG_TOFILE"
+
+#define HID_WIZARD_NEXT "SVT_HID_WIZARD_NEXT"
+#define HID_WIZARD_PREVIOUS "SVT_HID_WIZARD_PREVIOUS"
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/helpopt.hxx b/include/svtools/helpopt.hxx
new file mode 100644
index 000000000000..6004ab4dd77a
--- /dev/null
+++ b/include/svtools/helpopt.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVTOOLS_HELPOPT_HXX
+#define INCLUDED_SVTOOLS_HELPOPT_HXX
+
+#include "svtools/svtdllapi.h"
+
+#include <list>
+#include <tools/string.hxx>
+#include <unotools/options.hxx>
+
+typedef std::list< sal_Int32 > IdList;
+
+class SvtHelpOptions_Impl;
+
+class SVT_DLLPUBLIC SvtHelpOptions: public utl::detail::Options
+{
+ SvtHelpOptions_Impl* pImp;
+
+public:
+ SvtHelpOptions();
+ virtual ~SvtHelpOptions();
+
+ void SetExtendedHelp( sal_Bool b );
+ sal_Bool IsExtendedHelp() const;
+ void SetHelpTips( sal_Bool b );
+ sal_Bool IsHelpTips() const;
+
+ void SetHelpAgentAutoStartMode( sal_Bool b );
+ sal_Bool IsHelpAgentAutoStartMode() const;
+ void SetHelpAgentTimeoutPeriod( sal_Int32 _nSeconds );
+ sal_Int32 GetHelpAgentTimeoutPeriod( ) const;
+
+ const String& GetHelpStyleSheet()const;
+ void SetHelpStyleSheet(const String& rStyleSheet);
+
+ /** resets the help agent's ignore counter for all URL's
+ */
+ void resetAgentIgnoreURLCounter();
+
+ void SetWelcomeScreen( sal_Bool b );
+ sal_Bool IsWelcomeScreen() const;
+
+ String GetSystem() const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/htmlcfg.hxx b/include/svtools/htmlcfg.hxx
new file mode 100644
index 000000000000..62640e2bffe6
--- /dev/null
+++ b/include/svtools/htmlcfg.hxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_HTMLCFG_HXX
+#define _SVX_HTMLCFG_HXX
+
+// -----------------------------------------------------------------------
+
+#include <tools/solar.h>
+#include <unotools/configitem.hxx>
+#include <svtools/svtdllapi.h>
+
+#define HTML_FONT_COUNT 7
+
+// !!!be aware!!!: the following defines are _not_ used as values in the configuration file
+// this is because of compatibility reasons
+#define HTML_CFG_MSIE 1 // Internet Explorer
+#define HTML_CFG_WRITER 2 // Writer
+#define HTML_CFG_NS40 3 // Netscape 4.0
+
+#define HTML_CFG_MAX HTML_CFG_NS40
+
+class Link;
+struct HtmlOptions_Impl;
+// -----------------------------------------------------------------------
+
+class SVT_DLLPUBLIC SvxHtmlOptions : public utl::ConfigItem
+{
+ HtmlOptions_Impl*pImp;
+ const com::sun::star::uno::Sequence<OUString>& GetPropertyNames();
+ void Load( const com::sun::star::uno::Sequence< OUString >& rPropertyNames );
+ void CallListeners();
+
+public:
+ SvxHtmlOptions();
+ ~SvxHtmlOptions();
+
+ virtual void Commit();
+ virtual void Notify( const com::sun::star::uno::Sequence< OUString >& _rPropertyNames);
+
+ sal_uInt16 GetFontSize(sal_uInt16 nPos) const;
+ void SetFontSize(sal_uInt16 nPos, sal_uInt16 nSize);
+
+ sal_Bool IsImportUnknown() const;
+ void SetImportUnknown(sal_Bool bSet);
+
+ sal_uInt16 GetExportMode() const;
+ void SetExportMode(sal_uInt16 nSet);
+
+ sal_Bool IsStarBasic() const;
+ void SetStarBasic(sal_Bool bSet);
+
+ sal_Bool IsStarBasicWarning() const;
+ void SetStarBasicWarning(sal_Bool bSet);
+
+ sal_Bool IsSaveGraphicsLocal() const;
+ void SetSaveGraphicsLocal(sal_Bool bSet);
+
+ sal_Bool IsPrintLayoutExtension() const;
+ void SetPrintLayoutExtension(sal_Bool bSet);
+
+ sal_Bool IsIgnoreFontFamily() const;
+ void SetIgnoreFontFamily(sal_Bool bSet);
+
+ sal_Bool IsDefaultTextEncoding() const;
+ rtl_TextEncoding GetTextEncoding() const;
+ void SetTextEncoding( rtl_TextEncoding );
+ static SvxHtmlOptions& Get();
+
+ sal_Bool IsNumbersEnglishUS() const;
+ void SetNumbersEnglishUS(sal_Bool bSet);
+};
+
+#endif
+
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/htmlkywd.hxx b/include/svtools/htmlkywd.hxx
new file mode 100644
index 000000000000..72b48c417aa3
--- /dev/null
+++ b/include/svtools/htmlkywd.hxx
@@ -0,0 +1,796 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _HTMLKYWD_HXX
+#define _HTMLKYWD_HXX
+
+#include "sal/config.h"
+
+#define OOO_STRING_SVTOOLS_HTML_doctype32 \
+ "HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\""
+#define OOO_STRING_SVTOOLS_HTML_doctype40 \
+ "HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\""
+
+// diese werden nur eingeschaltet
+#define OOO_STRING_SVTOOLS_HTML_area "AREA"
+#define OOO_STRING_SVTOOLS_HTML_base "BASE"
+#define OOO_STRING_SVTOOLS_HTML_comment "!--"
+#define OOO_STRING_SVTOOLS_HTML_doctype "!DOCTYPE"
+#define OOO_STRING_SVTOOLS_HTML_embed "EMBED"
+#define OOO_STRING_SVTOOLS_HTML_figureoverlay "OVERLAY"
+#define OOO_STRING_SVTOOLS_HTML_horzrule "HR"
+#define OOO_STRING_SVTOOLS_HTML_horztab "TAB"
+#define OOO_STRING_SVTOOLS_HTML_image "IMG"
+#define OOO_STRING_SVTOOLS_HTML_image2 "IMAGE"
+#define OOO_STRING_SVTOOLS_HTML_input "INPUT"
+#define OOO_STRING_SVTOOLS_HTML_isindex "ISINDEX"
+#define OOO_STRING_SVTOOLS_HTML_linebreak "BR"
+#define OOO_STRING_SVTOOLS_HTML_li "LI"
+#define OOO_STRING_SVTOOLS_HTML_link "LINK"
+#define OOO_STRING_SVTOOLS_HTML_meta "META"
+#define OOO_STRING_SVTOOLS_HTML_nextid "NEXTID"
+#define OOO_STRING_SVTOOLS_HTML_nobr "NOBR"
+#define OOO_STRING_SVTOOLS_HTML_of "OF"
+#define OOO_STRING_SVTOOLS_HTML_option "OPTION"
+#define OOO_STRING_SVTOOLS_HTML_param "PARAM"
+#define OOO_STRING_SVTOOLS_HTML_range "RANGE"
+#define OOO_STRING_SVTOOLS_HTML_spacer "SPACER"
+#define OOO_STRING_SVTOOLS_HTML_wbr "WBR"
+
+// diese werden wieder abgeschaltet
+#define OOO_STRING_SVTOOLS_HTML_abbreviation "ABBREV"
+#define OOO_STRING_SVTOOLS_HTML_above "ABOVE"
+#define OOO_STRING_SVTOOLS_HTML_acronym "ACRONYM"
+#define OOO_STRING_SVTOOLS_HTML_address "ADDRESS"
+#define OOO_STRING_SVTOOLS_HTML_anchor "A"
+#define OOO_STRING_SVTOOLS_HTML_applet "APPLET"
+#define OOO_STRING_SVTOOLS_HTML_array "ARRAY"
+#define OOO_STRING_SVTOOLS_HTML_author "AU"
+#define OOO_STRING_SVTOOLS_HTML_banner "BANNER"
+#define OOO_STRING_SVTOOLS_HTML_bar "BAR"
+#define OOO_STRING_SVTOOLS_HTML_basefont "BASEFONT"
+#define OOO_STRING_SVTOOLS_HTML_below "BELOW"
+#define OOO_STRING_SVTOOLS_HTML_bigprint "BIG"
+#define OOO_STRING_SVTOOLS_HTML_blink "BLINK"
+#define OOO_STRING_SVTOOLS_HTML_blockquote "BLOCKQUOTE"
+#define OOO_STRING_SVTOOLS_HTML_blockquote30 "BQ"
+#define OOO_STRING_SVTOOLS_HTML_body "BODY"
+#define OOO_STRING_SVTOOLS_HTML_bold "B"
+#define OOO_STRING_SVTOOLS_HTML_boldtext "BT"
+#define OOO_STRING_SVTOOLS_HTML_box "BOX"
+#define OOO_STRING_SVTOOLS_HTML_caption "CAPTION"
+#define OOO_STRING_SVTOOLS_HTML_center "CENTER"
+#define OOO_STRING_SVTOOLS_HTML_citiation "CITE"
+#define OOO_STRING_SVTOOLS_HTML_code "CODE"
+#define OOO_STRING_SVTOOLS_HTML_col "COL"
+#define OOO_STRING_SVTOOLS_HTML_colgroup "COLGROUP"
+#define OOO_STRING_SVTOOLS_HTML_credit "CREDIT"
+#define OOO_STRING_SVTOOLS_HTML_dd "DD"
+#define OOO_STRING_SVTOOLS_HTML_deflist "DL"
+#define OOO_STRING_SVTOOLS_HTML_deletedtext "DEL"
+#define OOO_STRING_SVTOOLS_HTML_dirlist "DIR"
+#define OOO_STRING_SVTOOLS_HTML_division "DIV"
+#define OOO_STRING_SVTOOLS_HTML_dot "DOT"
+#define OOO_STRING_SVTOOLS_HTML_doubledot "DDOT"
+#define OOO_STRING_SVTOOLS_HTML_dt "DT"
+#define OOO_STRING_SVTOOLS_HTML_emphasis "EM"
+#define OOO_STRING_SVTOOLS_HTML_figure "FIG"
+#define OOO_STRING_SVTOOLS_HTML_font "FONT"
+#define OOO_STRING_SVTOOLS_HTML_footnote "FN"
+#define OOO_STRING_SVTOOLS_HTML_form "FORM"
+#define OOO_STRING_SVTOOLS_HTML_frame "FRAME"
+#define OOO_STRING_SVTOOLS_HTML_frameset "FRAMESET"
+#define OOO_STRING_SVTOOLS_HTML_hat "HAT"
+#define OOO_STRING_SVTOOLS_HTML_head1 "H1"
+#define OOO_STRING_SVTOOLS_HTML_head2 "H2"
+#define OOO_STRING_SVTOOLS_HTML_head3 "H3"
+#define OOO_STRING_SVTOOLS_HTML_head4 "H4"
+#define OOO_STRING_SVTOOLS_HTML_head5 "H5"
+#define OOO_STRING_SVTOOLS_HTML_head6 "H6"
+#define OOO_STRING_SVTOOLS_HTML_head "HEAD"
+#define OOO_STRING_SVTOOLS_HTML_html "HTML"
+#define OOO_STRING_SVTOOLS_HTML_iframe "IFRAME"
+#define OOO_STRING_SVTOOLS_HTML_ilayer "ILAYER"
+#define OOO_STRING_SVTOOLS_HTML_insertedtext "INS"
+#define OOO_STRING_SVTOOLS_HTML_italic "I"
+#define OOO_STRING_SVTOOLS_HTML_item "ITEM"
+#define OOO_STRING_SVTOOLS_HTML_keyboard "KBD"
+#define OOO_STRING_SVTOOLS_HTML_language "LANG"
+#define OOO_STRING_SVTOOLS_HTML_layer "LAYER"
+#define OOO_STRING_SVTOOLS_HTML_listheader "LH"
+#define OOO_STRING_SVTOOLS_HTML_map "MAP"
+#define OOO_STRING_SVTOOLS_HTML_math "MATH"
+#define OOO_STRING_SVTOOLS_HTML_menulist "MENU"
+#define OOO_STRING_SVTOOLS_HTML_multicol "MULTICOL"
+#define OOO_STRING_SVTOOLS_HTML_noembed "NOEMBED"
+#define OOO_STRING_SVTOOLS_HTML_noframe "NOFRAME"
+#define OOO_STRING_SVTOOLS_HTML_noframes "NOFRAMES"
+#define OOO_STRING_SVTOOLS_HTML_noscript "NOSCRIPT"
+#define OOO_STRING_SVTOOLS_HTML_note "NOTE"
+#define OOO_STRING_SVTOOLS_HTML_object "OBJECT"
+#define OOO_STRING_SVTOOLS_HTML_orderlist "OL"
+#define OOO_STRING_SVTOOLS_HTML_parabreak "P"
+#define OOO_STRING_SVTOOLS_HTML_person "PERSON"
+#define OOO_STRING_SVTOOLS_HTML_plaintext "T"
+#define OOO_STRING_SVTOOLS_HTML_preformtxt "PRE"
+#define OOO_STRING_SVTOOLS_HTML_root "ROOT"
+#define OOO_STRING_SVTOOLS_HTML_row "ROW"
+#define OOO_STRING_SVTOOLS_HTML_sample "SAMP"
+#define OOO_STRING_SVTOOLS_HTML_script "SCRIPT"
+#define OOO_STRING_SVTOOLS_HTML_select "SELECT"
+#define OOO_STRING_SVTOOLS_HTML_shortquote "Q"
+#define OOO_STRING_SVTOOLS_HTML_smallprint "SMALL"
+#define OOO_STRING_SVTOOLS_HTML_span "SPAN"
+#define OOO_STRING_SVTOOLS_HTML_squareroot "AQRT"
+#define OOO_STRING_SVTOOLS_HTML_strikethrough "S"
+#define OOO_STRING_SVTOOLS_HTML_strong "STRONG"
+#define OOO_STRING_SVTOOLS_HTML_style "STYLE"
+#define OOO_STRING_SVTOOLS_HTML_subscript "SUB"
+#define OOO_STRING_SVTOOLS_HTML_superscript "SUP"
+#define OOO_STRING_SVTOOLS_HTML_table "TABLE"
+#define OOO_STRING_SVTOOLS_HTML_tablerow "TR"
+#define OOO_STRING_SVTOOLS_HTML_tabledata "TD"
+#define OOO_STRING_SVTOOLS_HTML_tableheader "TH"
+#define OOO_STRING_SVTOOLS_HTML_tbody "TBODY"
+#define OOO_STRING_SVTOOLS_HTML_teletype "TT"
+#define OOO_STRING_SVTOOLS_HTML_text "TEXT"
+#define OOO_STRING_SVTOOLS_HTML_textarea "TEXTAREA"
+#define OOO_STRING_SVTOOLS_HTML_textflow "TEXTFLOW"
+#define OOO_STRING_SVTOOLS_HTML_tfoot "TFOOT"
+#define OOO_STRING_SVTOOLS_HTML_thead "THEAD"
+#define OOO_STRING_SVTOOLS_HTML_tilde "TILDE"
+#define OOO_STRING_SVTOOLS_HTML_title "TITLE"
+#define OOO_STRING_SVTOOLS_HTML_underline "U"
+#define OOO_STRING_SVTOOLS_HTML_unorderlist "UL"
+#define OOO_STRING_SVTOOLS_HTML_variable "VAR"
+#define OOO_STRING_SVTOOLS_HTML_vector "VEC"
+
+// obsolete features
+#define OOO_STRING_SVTOOLS_HTML_xmp "XMP"
+#define OOO_STRING_SVTOOLS_HTML_listing "LISTING"
+
+// proposed features
+#define OOO_STRING_SVTOOLS_HTML_definstance "DFN"
+#define OOO_STRING_SVTOOLS_HTML_strike "STRIKE"
+#define OOO_STRING_SVTOOLS_HTML_bgsound "BGSOUND"
+#define OOO_STRING_SVTOOLS_HTML_comment2 "COMMENT"
+#define OOO_STRING_SVTOOLS_HTML_marquee "MARQUEE"
+#define OOO_STRING_SVTOOLS_HTML_plaintext2 "PLAINTEXT"
+#define OOO_STRING_SVTOOLS_HTML_sdfield "SDFIELD"
+
+// die Namen fuer alle Zeichen
+#define OOO_STRING_SVTOOLS_HTML_C_lt "lt"
+#define OOO_STRING_SVTOOLS_HTML_C_gt "gt"
+#define OOO_STRING_SVTOOLS_HTML_C_amp "amp"
+#define OOO_STRING_SVTOOLS_HTML_C_quot "quot"
+#define OOO_STRING_SVTOOLS_HTML_C_Aacute "Aacute"
+#define OOO_STRING_SVTOOLS_HTML_C_Agrave "Agrave"
+#define OOO_STRING_SVTOOLS_HTML_C_Acirc "Acirc"
+#define OOO_STRING_SVTOOLS_HTML_C_Atilde "Atilde"
+#define OOO_STRING_SVTOOLS_HTML_C_Aring "Aring"
+#define OOO_STRING_SVTOOLS_HTML_C_Auml "Auml"
+#define OOO_STRING_SVTOOLS_HTML_C_AElig "AElig"
+#define OOO_STRING_SVTOOLS_HTML_C_Ccedil "Ccedil"
+#define OOO_STRING_SVTOOLS_HTML_C_Eacute "Eacute"
+#define OOO_STRING_SVTOOLS_HTML_C_Egrave "Egrave"
+#define OOO_STRING_SVTOOLS_HTML_C_Ecirc "Ecirc"
+#define OOO_STRING_SVTOOLS_HTML_C_Euml "Euml"
+#define OOO_STRING_SVTOOLS_HTML_C_Iacute "Iacute"
+#define OOO_STRING_SVTOOLS_HTML_C_Igrave "Igrave"
+#define OOO_STRING_SVTOOLS_HTML_C_Icirc "Icirc"
+#define OOO_STRING_SVTOOLS_HTML_C_Iuml "Iuml"
+#define OOO_STRING_SVTOOLS_HTML_C_ETH "ETH"
+#define OOO_STRING_SVTOOLS_HTML_C_Ntilde "Ntilde"
+#define OOO_STRING_SVTOOLS_HTML_C_Oacute "Oacute"
+#define OOO_STRING_SVTOOLS_HTML_C_Ograve "Ograve"
+#define OOO_STRING_SVTOOLS_HTML_C_Ocirc "Ocirc"
+#define OOO_STRING_SVTOOLS_HTML_C_Otilde "Otilde"
+#define OOO_STRING_SVTOOLS_HTML_C_Ouml "Ouml"
+#define OOO_STRING_SVTOOLS_HTML_C_Oslash "Oslash"
+#define OOO_STRING_SVTOOLS_HTML_C_Uacute "Uacute"
+#define OOO_STRING_SVTOOLS_HTML_C_Ugrave "Ugrave"
+#define OOO_STRING_SVTOOLS_HTML_C_Ucirc "Ucirc"
+#define OOO_STRING_SVTOOLS_HTML_C_Uuml "Uuml"
+#define OOO_STRING_SVTOOLS_HTML_C_Yacute "Yacute"
+#define OOO_STRING_SVTOOLS_HTML_C_THORN "THORN"
+#define OOO_STRING_SVTOOLS_HTML_C_szlig "szlig"
+#define OOO_STRING_SVTOOLS_HTML_S_aacute "aacute"
+#define OOO_STRING_SVTOOLS_HTML_S_agrave "agrave"
+#define OOO_STRING_SVTOOLS_HTML_S_acirc "acirc"
+#define OOO_STRING_SVTOOLS_HTML_S_atilde "atilde"
+#define OOO_STRING_SVTOOLS_HTML_S_aring "aring"
+#define OOO_STRING_SVTOOLS_HTML_S_auml "auml"
+#define OOO_STRING_SVTOOLS_HTML_S_aelig "aelig"
+#define OOO_STRING_SVTOOLS_HTML_S_ccedil "ccedil"
+#define OOO_STRING_SVTOOLS_HTML_S_eacute "eacute"
+#define OOO_STRING_SVTOOLS_HTML_S_egrave "egrave"
+#define OOO_STRING_SVTOOLS_HTML_S_ecirc "ecirc"
+#define OOO_STRING_SVTOOLS_HTML_S_euml "euml"
+#define OOO_STRING_SVTOOLS_HTML_S_iacute "iacute"
+#define OOO_STRING_SVTOOLS_HTML_S_igrave "igrave"
+#define OOO_STRING_SVTOOLS_HTML_S_icirc "icirc"
+#define OOO_STRING_SVTOOLS_HTML_S_iuml "iuml"
+#define OOO_STRING_SVTOOLS_HTML_S_eth "eth"
+#define OOO_STRING_SVTOOLS_HTML_S_ntilde "ntilde"
+#define OOO_STRING_SVTOOLS_HTML_S_oacute "oacute"
+#define OOO_STRING_SVTOOLS_HTML_S_ograve "ograve"
+#define OOO_STRING_SVTOOLS_HTML_S_ocirc "ocirc"
+#define OOO_STRING_SVTOOLS_HTML_S_otilde "otilde"
+#define OOO_STRING_SVTOOLS_HTML_S_ouml "ouml"
+#define OOO_STRING_SVTOOLS_HTML_S_oslash "oslash"
+#define OOO_STRING_SVTOOLS_HTML_S_uacute "uacute"
+#define OOO_STRING_SVTOOLS_HTML_S_ugrave "ugrave"
+#define OOO_STRING_SVTOOLS_HTML_S_ucirc "ucirc"
+#define OOO_STRING_SVTOOLS_HTML_S_uuml "uuml"
+#define OOO_STRING_SVTOOLS_HTML_S_yacute "yacute"
+#define OOO_STRING_SVTOOLS_HTML_S_thorn "thorn"
+#define OOO_STRING_SVTOOLS_HTML_S_yuml "yuml"
+#define OOO_STRING_SVTOOLS_HTML_S_acute "acute"
+#define OOO_STRING_SVTOOLS_HTML_S_brvbar "brvbar"
+#define OOO_STRING_SVTOOLS_HTML_S_cedil "cedil"
+#define OOO_STRING_SVTOOLS_HTML_S_cent "cent"
+#define OOO_STRING_SVTOOLS_HTML_S_copy "copy"
+#define OOO_STRING_SVTOOLS_HTML_S_curren "curren"
+#define OOO_STRING_SVTOOLS_HTML_S_deg "deg"
+#define OOO_STRING_SVTOOLS_HTML_S_divide "divide"
+#define OOO_STRING_SVTOOLS_HTML_S_frac12 "frac12"
+#define OOO_STRING_SVTOOLS_HTML_S_frac14 "frac14"
+#define OOO_STRING_SVTOOLS_HTML_S_frac34 "frac34"
+#define OOO_STRING_SVTOOLS_HTML_S_iexcl "iexcl"
+#define OOO_STRING_SVTOOLS_HTML_S_iquest "iquest"
+#define OOO_STRING_SVTOOLS_HTML_S_laquo "laquo"
+#define OOO_STRING_SVTOOLS_HTML_S_macr "macr"
+#define OOO_STRING_SVTOOLS_HTML_S_micro "micro"
+#define OOO_STRING_SVTOOLS_HTML_S_middot "middot"
+#define OOO_STRING_SVTOOLS_HTML_S_nbsp "nbsp"
+#define OOO_STRING_SVTOOLS_HTML_S_not "not"
+#define OOO_STRING_SVTOOLS_HTML_S_ordf "ordf"
+#define OOO_STRING_SVTOOLS_HTML_S_ordm "ordm"
+#define OOO_STRING_SVTOOLS_HTML_S_para "para"
+#define OOO_STRING_SVTOOLS_HTML_S_plusmn "plusmn"
+#define OOO_STRING_SVTOOLS_HTML_S_pound "pound"
+#define OOO_STRING_SVTOOLS_HTML_S_raquo "raquo"
+#define OOO_STRING_SVTOOLS_HTML_S_reg "reg"
+#define OOO_STRING_SVTOOLS_HTML_S_sect "sect"
+#define OOO_STRING_SVTOOLS_HTML_S_shy "shy"
+#define OOO_STRING_SVTOOLS_HTML_S_sup1 "sup1"
+#define OOO_STRING_SVTOOLS_HTML_S_sup2 "sup2"
+#define OOO_STRING_SVTOOLS_HTML_S_sup3 "sup3"
+#define OOO_STRING_SVTOOLS_HTML_S_times "times"
+#define OOO_STRING_SVTOOLS_HTML_S_uml "uml"
+#define OOO_STRING_SVTOOLS_HTML_S_yen "yen"
+
+// Netscape kennt noch ein paar in Grossbuchstaben ...
+#define OOO_STRING_SVTOOLS_HTML_C_LT "LT"
+#define OOO_STRING_SVTOOLS_HTML_C_GT "GT"
+#define OOO_STRING_SVTOOLS_HTML_C_AMP "AMP"
+#define OOO_STRING_SVTOOLS_HTML_C_QUOT "QUOT"
+#define OOO_STRING_SVTOOLS_HTML_S_COPY "COPY"
+#define OOO_STRING_SVTOOLS_HTML_S_REG "REG"
+
+// HTML4
+#define OOO_STRING_SVTOOLS_HTML_S_alefsym "alefsym"
+#define OOO_STRING_SVTOOLS_HTML_S_Alpha "Alpha"
+#define OOO_STRING_SVTOOLS_HTML_S_alpha "alpha"
+#define OOO_STRING_SVTOOLS_HTML_S_and "and"
+#define OOO_STRING_SVTOOLS_HTML_S_ang "ang"
+#define OOO_STRING_SVTOOLS_HTML_S_asymp "asymp"
+#define OOO_STRING_SVTOOLS_HTML_S_bdquo "bdquo"
+#define OOO_STRING_SVTOOLS_HTML_S_Beta "Beta"
+#define OOO_STRING_SVTOOLS_HTML_S_beta "beta"
+#define OOO_STRING_SVTOOLS_HTML_S_bull "bull"
+#define OOO_STRING_SVTOOLS_HTML_S_cap "cap"
+#define OOO_STRING_SVTOOLS_HTML_S_chi "chi"
+#define OOO_STRING_SVTOOLS_HTML_S_Chi "Chi"
+#define OOO_STRING_SVTOOLS_HTML_S_circ "circ"
+#define OOO_STRING_SVTOOLS_HTML_S_clubs "clubs"
+#define OOO_STRING_SVTOOLS_HTML_S_cong "cong"
+#define OOO_STRING_SVTOOLS_HTML_S_crarr "crarr"
+#define OOO_STRING_SVTOOLS_HTML_S_cup "cup"
+#define OOO_STRING_SVTOOLS_HTML_S_dagger "dagger"
+#define OOO_STRING_SVTOOLS_HTML_S_Dagger "Dagger"
+#define OOO_STRING_SVTOOLS_HTML_S_darr "darr"
+#define OOO_STRING_SVTOOLS_HTML_S_dArr "dArr"
+#define OOO_STRING_SVTOOLS_HTML_S_Delta "Delta"
+#define OOO_STRING_SVTOOLS_HTML_S_delta "delta"
+#define OOO_STRING_SVTOOLS_HTML_S_diams "diams"
+#define OOO_STRING_SVTOOLS_HTML_S_empty "empty"
+#define OOO_STRING_SVTOOLS_HTML_S_emsp "emsp"
+#define OOO_STRING_SVTOOLS_HTML_S_ensp "ensp"
+#define OOO_STRING_SVTOOLS_HTML_S_Epsilon "Epsilon"
+#define OOO_STRING_SVTOOLS_HTML_S_epsilon "epsilon"
+#define OOO_STRING_SVTOOLS_HTML_S_equiv "equiv"
+#define OOO_STRING_SVTOOLS_HTML_S_Eta "Eta"
+#define OOO_STRING_SVTOOLS_HTML_S_eta "eta"
+#define OOO_STRING_SVTOOLS_HTML_S_euro "euro"
+#define OOO_STRING_SVTOOLS_HTML_S_exist "exist"
+#define OOO_STRING_SVTOOLS_HTML_S_notexist "not exist"
+#define OOO_STRING_SVTOOLS_HTML_S_fnof "fnof"
+#define OOO_STRING_SVTOOLS_HTML_S_forall "forall"
+#define OOO_STRING_SVTOOLS_HTML_S_frasl "frasl"
+#define OOO_STRING_SVTOOLS_HTML_S_Gamma "Gamma"
+#define OOO_STRING_SVTOOLS_HTML_S_gamma "gamma"
+#define OOO_STRING_SVTOOLS_HTML_S_ge "ge"
+#define OOO_STRING_SVTOOLS_HTML_S_harr "harr"
+#define OOO_STRING_SVTOOLS_HTML_S_hArr "hArr"
+#define OOO_STRING_SVTOOLS_HTML_S_hearts "hearts"
+#define OOO_STRING_SVTOOLS_HTML_S_hellip "hellip"
+#define OOO_STRING_SVTOOLS_HTML_S_image "image"
+#define OOO_STRING_SVTOOLS_HTML_S_infin "infin"
+#define OOO_STRING_SVTOOLS_HTML_S_int "int"
+#define OOO_STRING_SVTOOLS_HTML_S_Iota "Iota"
+#define OOO_STRING_SVTOOLS_HTML_S_iota "iota"
+#define OOO_STRING_SVTOOLS_HTML_S_isin "isin"
+#define OOO_STRING_SVTOOLS_HTML_S_Kappa "Kappa"
+#define OOO_STRING_SVTOOLS_HTML_S_kappa "kappa"
+#define OOO_STRING_SVTOOLS_HTML_S_Lambda "Lambda"
+#define OOO_STRING_SVTOOLS_HTML_S_lambda "lambda"
+#define OOO_STRING_SVTOOLS_HTML_S_lang "lang"
+#define OOO_STRING_SVTOOLS_HTML_S_larr "larr"
+#define OOO_STRING_SVTOOLS_HTML_S_lArr "lArr"
+#define OOO_STRING_SVTOOLS_HTML_S_lceil "lceil"
+#define OOO_STRING_SVTOOLS_HTML_S_ldquo "ldquo"
+#define OOO_STRING_SVTOOLS_HTML_S_le "le"
+#define OOO_STRING_SVTOOLS_HTML_S_lfloor "lfloor"
+#define OOO_STRING_SVTOOLS_HTML_S_lowast "lowast"
+#define OOO_STRING_SVTOOLS_HTML_S_loz "loz"
+#define OOO_STRING_SVTOOLS_HTML_S_lrm "lrm"
+#define OOO_STRING_SVTOOLS_HTML_S_lsaquo "lsaquo"
+#define OOO_STRING_SVTOOLS_HTML_S_lsquo "lsquo"
+#define OOO_STRING_SVTOOLS_HTML_S_mdash "mdash"
+#define OOO_STRING_SVTOOLS_HTML_S_minus "minus"
+#define OOO_STRING_SVTOOLS_HTML_S_Mu "Mu"
+#define OOO_STRING_SVTOOLS_HTML_S_mu "mu"
+#define OOO_STRING_SVTOOLS_HTML_S_nabla "nabla"
+#define OOO_STRING_SVTOOLS_HTML_S_ndash "ndash"
+#define OOO_STRING_SVTOOLS_HTML_S_ne "ne"
+#define OOO_STRING_SVTOOLS_HTML_S_ni "ni"
+#define OOO_STRING_SVTOOLS_HTML_S_notin "notin"
+#define OOO_STRING_SVTOOLS_HTML_S_nsub "nsub"
+#define OOO_STRING_SVTOOLS_HTML_S_Nu "Nu"
+#define OOO_STRING_SVTOOLS_HTML_S_nu "nu"
+#define OOO_STRING_SVTOOLS_HTML_S_OElig "OElig"
+#define OOO_STRING_SVTOOLS_HTML_S_oelig "oelig"
+#define OOO_STRING_SVTOOLS_HTML_S_oline "oline"
+#define OOO_STRING_SVTOOLS_HTML_S_Omega "Omega"
+#define OOO_STRING_SVTOOLS_HTML_S_omega "omega"
+#define OOO_STRING_SVTOOLS_HTML_S_Omicron "Omicron"
+#define OOO_STRING_SVTOOLS_HTML_S_omicron "omicron"
+#define OOO_STRING_SVTOOLS_HTML_S_oplus "oplus"
+#define OOO_STRING_SVTOOLS_HTML_S_or "or"
+#define OOO_STRING_SVTOOLS_HTML_S_otimes "otimes"
+#define OOO_STRING_SVTOOLS_HTML_S_part "part"
+#define OOO_STRING_SVTOOLS_HTML_S_permil "permil"
+#define OOO_STRING_SVTOOLS_HTML_S_perp "perp"
+#define OOO_STRING_SVTOOLS_HTML_S_Phi "Phi"
+#define OOO_STRING_SVTOOLS_HTML_S_phi "phi"
+#define OOO_STRING_SVTOOLS_HTML_S_Pi "Pi"
+#define OOO_STRING_SVTOOLS_HTML_S_pi "pi"
+#define OOO_STRING_SVTOOLS_HTML_S_piv "piv"
+#define OOO_STRING_SVTOOLS_HTML_S_prime "prime"
+#define OOO_STRING_SVTOOLS_HTML_S_Prime "Prime"
+#define OOO_STRING_SVTOOLS_HTML_S_prod "prod"
+#define OOO_STRING_SVTOOLS_HTML_S_prop "prop"
+#define OOO_STRING_SVTOOLS_HTML_S_Psi "Psi"
+#define OOO_STRING_SVTOOLS_HTML_S_psi "psi"
+#define OOO_STRING_SVTOOLS_HTML_S_radic "radic"
+#define OOO_STRING_SVTOOLS_HTML_S_rang "rang"
+#define OOO_STRING_SVTOOLS_HTML_S_rarr "rarr"
+#define OOO_STRING_SVTOOLS_HTML_S_rArr "rArr"
+#define OOO_STRING_SVTOOLS_HTML_S_rceil "rceil"
+#define OOO_STRING_SVTOOLS_HTML_S_rdquo "rdquo"
+#define OOO_STRING_SVTOOLS_HTML_S_real "real"
+#define OOO_STRING_SVTOOLS_HTML_S_rfloor "rfloor"
+#define OOO_STRING_SVTOOLS_HTML_S_Rho "Rho"
+#define OOO_STRING_SVTOOLS_HTML_S_rho "rho"
+#define OOO_STRING_SVTOOLS_HTML_S_rlm "rlm"
+#define OOO_STRING_SVTOOLS_HTML_S_rsaquo "rsaquo"
+#define OOO_STRING_SVTOOLS_HTML_S_rsquo "rsquo"
+#define OOO_STRING_SVTOOLS_HTML_S_sbquo "sbquo"
+#define OOO_STRING_SVTOOLS_HTML_S_Scaron "Scaron"
+#define OOO_STRING_SVTOOLS_HTML_S_scaron "scaron"
+#define OOO_STRING_SVTOOLS_HTML_S_sdot "sdot"
+#define OOO_STRING_SVTOOLS_HTML_S_Sigma "Sigma"
+#define OOO_STRING_SVTOOLS_HTML_S_sigma "sigma"
+#define OOO_STRING_SVTOOLS_HTML_S_sigmaf "sigmaf"
+#define OOO_STRING_SVTOOLS_HTML_S_sim "sim"
+#define OOO_STRING_SVTOOLS_HTML_S_spades "spades"
+#define OOO_STRING_SVTOOLS_HTML_S_sub "sub"
+#define OOO_STRING_SVTOOLS_HTML_S_sube "sube"
+#define OOO_STRING_SVTOOLS_HTML_S_sum "sum"
+#define OOO_STRING_SVTOOLS_HTML_S_sup "sup"
+#define OOO_STRING_SVTOOLS_HTML_S_supe "supe"
+#define OOO_STRING_SVTOOLS_HTML_S_Tau "Tau"
+#define OOO_STRING_SVTOOLS_HTML_S_tau "tau"
+#define OOO_STRING_SVTOOLS_HTML_S_there4 "there4"
+#define OOO_STRING_SVTOOLS_HTML_S_Theta "Theta"
+#define OOO_STRING_SVTOOLS_HTML_S_theta "theta"
+#define OOO_STRING_SVTOOLS_HTML_S_thetasym "thetasym"
+#define OOO_STRING_SVTOOLS_HTML_S_thinsp "thinsp"
+#define OOO_STRING_SVTOOLS_HTML_S_tilde "tilde"
+#define OOO_STRING_SVTOOLS_HTML_S_trade "trade"
+#define OOO_STRING_SVTOOLS_HTML_S_uarr "uarr"
+#define OOO_STRING_SVTOOLS_HTML_S_uArr "uArr"
+#define OOO_STRING_SVTOOLS_HTML_S_upsih "upsih"
+#define OOO_STRING_SVTOOLS_HTML_S_Upsilon "Upsilon"
+#define OOO_STRING_SVTOOLS_HTML_S_upsilon "upsilon"
+#define OOO_STRING_SVTOOLS_HTML_S_weierp "weierp"
+#define OOO_STRING_SVTOOLS_HTML_S_Xi "Xi"
+#define OOO_STRING_SVTOOLS_HTML_S_xi "xi"
+#define OOO_STRING_SVTOOLS_HTML_S_Yuml "Yuml"
+#define OOO_STRING_SVTOOLS_HTML_S_Zeta "Zeta"
+#define OOO_STRING_SVTOOLS_HTML_S_zeta "zeta"
+#define OOO_STRING_SVTOOLS_HTML_S_zwj "zwj"
+#define OOO_STRING_SVTOOLS_HTML_S_zwnj "zwnj"
+
+// HTML Attribut-Token (=Optionen)
+
+// Attribute ohne Wert
+#define OOO_STRING_SVTOOLS_HTML_O_box "BOX"
+#define OOO_STRING_SVTOOLS_HTML_O_checked "CHECKED"
+#define OOO_STRING_SVTOOLS_HTML_O_compact "COMPACT"
+#define OOO_STRING_SVTOOLS_HTML_O_continue "CONTINUE"
+#define OOO_STRING_SVTOOLS_HTML_O_controls "CONTROLS"
+#define OOO_STRING_SVTOOLS_HTML_O_declare "DECLARE"
+#define OOO_STRING_SVTOOLS_HTML_O_disabled "DISABLED"
+#define OOO_STRING_SVTOOLS_HTML_O_folded "FOLDED"
+#define OOO_STRING_SVTOOLS_HTML_O_ismap "ISMAP"
+#define OOO_STRING_SVTOOLS_HTML_O_mayscript "MAYSCRIPT"
+#define OOO_STRING_SVTOOLS_HTML_O_multiple "MULTIPLE"
+#define OOO_STRING_SVTOOLS_HTML_O_noflow "NOFLOW"
+#define OOO_STRING_SVTOOLS_HTML_O_nohref "NOHREF"
+#define OOO_STRING_SVTOOLS_HTML_O_noresize "NORESIZE"
+#define OOO_STRING_SVTOOLS_HTML_O_noshade "NOSHADE"
+#define OOO_STRING_SVTOOLS_HTML_O_nowrap "NOWRAP"
+#define OOO_STRING_SVTOOLS_HTML_O_plain "PLAIN"
+#define OOO_STRING_SVTOOLS_HTML_O_sdfixed "SDFIXED"
+#define OOO_STRING_SVTOOLS_HTML_O_selected "SELECTED"
+#define OOO_STRING_SVTOOLS_HTML_O_shapes "SHAPES"
+
+// Attribute mit einem String als Wert
+#define OOO_STRING_SVTOOLS_HTML_O_above "ABOVE"
+#define OOO_STRING_SVTOOLS_HTML_O_accesskey "ACCESSKEY"
+#define OOO_STRING_SVTOOLS_HTML_O_accept "ACCEPT"
+#define OOO_STRING_SVTOOLS_HTML_O_add_date "ADD_DATE"
+#define OOO_STRING_SVTOOLS_HTML_O_alt "ALT"
+#define OOO_STRING_SVTOOLS_HTML_O_axes "AXES"
+#define OOO_STRING_SVTOOLS_HTML_O_axis "AXIS"
+#define OOO_STRING_SVTOOLS_HTML_O_below "BELOW"
+#define OOO_STRING_SVTOOLS_HTML_O_char "CHAR"
+#define OOO_STRING_SVTOOLS_HTML_O_class "CLASS"
+#define OOO_STRING_SVTOOLS_HTML_O_clip "CLIP"
+#define OOO_STRING_SVTOOLS_HTML_O_code "CODE"
+#define OOO_STRING_SVTOOLS_HTML_O_codetype "CODETYPE"
+#define OOO_STRING_SVTOOLS_HTML_O_colspec "COLSPEC"
+#define OOO_STRING_SVTOOLS_HTML_O_content "CONTENT"
+#define OOO_STRING_SVTOOLS_HTML_O_coords "COORDS"
+#define OOO_STRING_SVTOOLS_HTML_O_dp "DP"
+#define OOO_STRING_SVTOOLS_HTML_O_enctype "ENCTYPE"
+#define OOO_STRING_SVTOOLS_HTML_O_error "ERROR"
+#define OOO_STRING_SVTOOLS_HTML_O_face "FACE"
+#define OOO_STRING_SVTOOLS_HTML_O_frameborder "FRAMEBORDER"
+#define OOO_STRING_SVTOOLS_HTML_O_httpequiv "HTTP-EQUIV"
+#define OOO_STRING_SVTOOLS_HTML_O_language "LANGUAGE"
+#define OOO_STRING_SVTOOLS_HTML_O_last_modified "LAST_MODIFIED"
+#define OOO_STRING_SVTOOLS_HTML_O_last_visit "LAST_VISIT"
+#define OOO_STRING_SVTOOLS_HTML_O_md "MD"
+#define OOO_STRING_SVTOOLS_HTML_O_n "N"
+#define OOO_STRING_SVTOOLS_HTML_O_name "NAME"
+#define OOO_STRING_SVTOOLS_HTML_O_notation "NOTATION"
+#define OOO_STRING_SVTOOLS_HTML_O_prompt "PROMPT"
+#define OOO_STRING_SVTOOLS_HTML_O_shape "SHAPE"
+#define OOO_STRING_SVTOOLS_HTML_O_standby "STANDBY"
+#define OOO_STRING_SVTOOLS_HTML_O_style "STYLE"
+#define OOO_STRING_SVTOOLS_HTML_O_title "TITLE"
+#define OOO_STRING_SVTOOLS_HTML_O_value "VALUE"
+#define OOO_STRING_SVTOOLS_HTML_O_SDval "SDVAL"
+#define OOO_STRING_SVTOOLS_HTML_O_SDnum "SDNUM"
+#define OOO_STRING_SVTOOLS_HTML_O_sdlibrary "SDLIBRARY"
+#define OOO_STRING_SVTOOLS_HTML_O_sdmodule "SDMODULE"
+#define OOO_STRING_SVTOOLS_HTML_O_sdevent "SDEVENT-"
+#define OOO_STRING_SVTOOLS_HTML_O_sdaddparam "SDADDPARAM-"
+
+// Attribute mit einem SGML-Identifier als Wert
+#define OOO_STRING_SVTOOLS_HTML_O_from "FROM"
+#define OOO_STRING_SVTOOLS_HTML_O_id "ID"
+#define OOO_STRING_SVTOOLS_HTML_O_target "TARGET"
+#define OOO_STRING_SVTOOLS_HTML_O_to "TO"
+#define OOO_STRING_SVTOOLS_HTML_O_until "UNTIL"
+
+// Attribute mit einem URI als Wert
+#define OOO_STRING_SVTOOLS_HTML_O_action "ACTION"
+#define OOO_STRING_SVTOOLS_HTML_O_archive "ARCHIVE"
+#define OOO_STRING_SVTOOLS_HTML_O_background "BACKGROUND"
+#define OOO_STRING_SVTOOLS_HTML_O_classid "CLASSID"
+#define OOO_STRING_SVTOOLS_HTML_O_codebase "CODEBASE"
+#define OOO_STRING_SVTOOLS_HTML_O_data "DATA"
+#define OOO_STRING_SVTOOLS_HTML_O_dynsrc "DYNSRC"
+#define OOO_STRING_SVTOOLS_HTML_O_dynsync "DYNSYNC"
+#define OOO_STRING_SVTOOLS_HTML_O_imagemap "IMAGEMAP"
+#define OOO_STRING_SVTOOLS_HTML_O_href "HREF"
+#define OOO_STRING_SVTOOLS_HTML_O_lowsrc "LOWSRC"
+#define OOO_STRING_SVTOOLS_HTML_O_script "SCRIPT"
+#define OOO_STRING_SVTOOLS_HTML_O_src "SRC"
+#define OOO_STRING_SVTOOLS_HTML_O_usemap "USEMAP"
+
+// Attribute mit Entity-Namen als Wert
+#define OOO_STRING_SVTOOLS_HTML_O_dingbat "DINGBAT"
+#define OOO_STRING_SVTOOLS_HTML_O_sym "SYM"
+
+// Attribute mit einer Farbe als Wert (alle Netscape)
+#define OOO_STRING_SVTOOLS_HTML_O_alink "ALINK"
+#define OOO_STRING_SVTOOLS_HTML_O_bgcolor "BGCOLOR"
+#define OOO_STRING_SVTOOLS_HTML_O_bordercolor "BORDERCOLOR"
+#define OOO_STRING_SVTOOLS_HTML_O_bordercolorlight "BORDERCOLORLIGHT"
+#define OOO_STRING_SVTOOLS_HTML_O_bordercolordark "BORDERCOLORDARK"
+#define OOO_STRING_SVTOOLS_HTML_O_color "COLOR"
+#define OOO_STRING_SVTOOLS_HTML_O_link "LINK"
+#define OOO_STRING_SVTOOLS_HTML_O_text "TEXT"
+#define OOO_STRING_SVTOOLS_HTML_O_vlink "VLINK"
+
+// Attribute mit einem numerischen Wert
+#define OOO_STRING_SVTOOLS_HTML_O_border "BORDER"
+#define OOO_STRING_SVTOOLS_HTML_O_cellspacing "CELLSPACING"
+#define OOO_STRING_SVTOOLS_HTML_O_cellpadding "CELLPADDING"
+#define OOO_STRING_SVTOOLS_HTML_O_charoff "CHAROFF"
+#define OOO_STRING_SVTOOLS_HTML_O_colspan "COLSPAN"
+#define OOO_STRING_SVTOOLS_HTML_O_framespacing "FRAMESPACING"
+#define OOO_STRING_SVTOOLS_HTML_O_gutter "GUTTER"
+#define OOO_STRING_SVTOOLS_HTML_O_indent "INDENT"
+#define OOO_STRING_SVTOOLS_HTML_O_height "HEIGHT"
+#define OOO_STRING_SVTOOLS_HTML_O_hspace "HSPACE"
+#define OOO_STRING_SVTOOLS_HTML_O_left "LEFT"
+#define OOO_STRING_SVTOOLS_HTML_O_leftmargin "LEFTMARGIN"
+#define OOO_STRING_SVTOOLS_HTML_O_loop "LOOP"
+#define OOO_STRING_SVTOOLS_HTML_O_marginheight "MARGINHEIGHT"
+#define OOO_STRING_SVTOOLS_HTML_O_marginwidth "MARGINWIDTH"
+#define OOO_STRING_SVTOOLS_HTML_O_max "MAX"
+#define OOO_STRING_SVTOOLS_HTML_O_maxlength "MAXLENGTH"
+#define OOO_STRING_SVTOOLS_HTML_O_min "MIN"
+#define OOO_STRING_SVTOOLS_HTML_O_pagex "PAGEX"
+#define OOO_STRING_SVTOOLS_HTML_O_pagey "PAGEY"
+#define OOO_STRING_SVTOOLS_HTML_O_pointsize "POINT-SIZE"
+#define OOO_STRING_SVTOOLS_HTML_O_rowspan "ROWSPAN"
+#define OOO_STRING_SVTOOLS_HTML_O_scrollamount "SCROLLAMOUNT"
+#define OOO_STRING_SVTOOLS_HTML_O_scrolldelay "SCROLLDELAY"
+#define OOO_STRING_SVTOOLS_HTML_O_seqnum "SEQNUM"
+#define OOO_STRING_SVTOOLS_HTML_O_skip "SKIP"
+#define OOO_STRING_SVTOOLS_HTML_O_span "SPAN"
+#define OOO_STRING_SVTOOLS_HTML_O_tabindex "TABINDEX"
+#define OOO_STRING_SVTOOLS_HTML_O_top "TOP"
+#define OOO_STRING_SVTOOLS_HTML_O_topmargin "TOPMARGIN"
+#define OOO_STRING_SVTOOLS_HTML_O_vspace "VSPACE"
+#define OOO_STRING_SVTOOLS_HTML_O_weight "WEIGHT"
+#define OOO_STRING_SVTOOLS_HTML_O_width "WIDTH"
+#define OOO_STRING_SVTOOLS_HTML_O_x "X"
+#define OOO_STRING_SVTOOLS_HTML_O_y "Y"
+#define OOO_STRING_SVTOOLS_HTML_O_zindex "Z-INDEX"
+
+// Attribute mit Enum-Werten
+#define OOO_STRING_SVTOOLS_HTML_O_behavior "BEHAVIOR"
+#define OOO_STRING_SVTOOLS_HTML_O_bgproperties "BGPROPERTIES"
+#define OOO_STRING_SVTOOLS_HTML_O_clear "CLEAR"
+#define OOO_STRING_SVTOOLS_HTML_O_dir "DIR"
+#define OOO_STRING_SVTOOLS_HTML_O_direction "DIRECTION"
+#define OOO_STRING_SVTOOLS_HTML_O_format "FORMAT"
+#define OOO_STRING_SVTOOLS_HTML_O_frame "FRAME"
+#define OOO_STRING_SVTOOLS_HTML_O_lang "LANG"
+#define OOO_STRING_SVTOOLS_HTML_O_method "METHOD"
+#define OOO_STRING_SVTOOLS_HTML_O_palette "PALETTE"
+#define OOO_STRING_SVTOOLS_HTML_O_rel "REL"
+#define OOO_STRING_SVTOOLS_HTML_O_rev "REV"
+#define OOO_STRING_SVTOOLS_HTML_O_rules "RULES"
+#define OOO_STRING_SVTOOLS_HTML_O_scrolling "SCROLLING"
+#define OOO_STRING_SVTOOLS_HTML_O_sdreadonly "READONLY"
+#define OOO_STRING_SVTOOLS_HTML_O_subtype "SUBTYPE"
+#define OOO_STRING_SVTOOLS_HTML_O_type "TYPE"
+#define OOO_STRING_SVTOOLS_HTML_O_valign "VALIGN"
+#define OOO_STRING_SVTOOLS_HTML_O_valuetype "VALUETYPE"
+#define OOO_STRING_SVTOOLS_HTML_O_visibility "VISIBILITY"
+#define OOO_STRING_SVTOOLS_HTML_O_wrap "WRAP"
+
+// Attribute mit Script-Code als Wert
+#define OOO_STRING_SVTOOLS_HTML_O_onblur "ONBLUR"
+#define OOO_STRING_SVTOOLS_HTML_O_onchange "ONCHANGE"
+#define OOO_STRING_SVTOOLS_HTML_O_onclick "ONCLICK"
+#define OOO_STRING_SVTOOLS_HTML_O_onfocus "ONFOCUS"
+#define OOO_STRING_SVTOOLS_HTML_O_onload "ONLOAD"
+#define OOO_STRING_SVTOOLS_HTML_O_onmouseover "ONMOUSEOVER"
+#define OOO_STRING_SVTOOLS_HTML_O_onreset "ONRESET"
+#define OOO_STRING_SVTOOLS_HTML_O_onselect "ONSELECT"
+#define OOO_STRING_SVTOOLS_HTML_O_onsubmit "ONSUBMIT"
+#define OOO_STRING_SVTOOLS_HTML_O_onunload "ONUNLOAD"
+#define OOO_STRING_SVTOOLS_HTML_O_onabort "ONABORT"
+#define OOO_STRING_SVTOOLS_HTML_O_onerror "ONERROR"
+#define OOO_STRING_SVTOOLS_HTML_O_onmouseout "ONMOUSEOUT"
+#define OOO_STRING_SVTOOLS_HTML_O_SDonblur "SDONBLUR"
+#define OOO_STRING_SVTOOLS_HTML_O_SDonchange "SDONCHANGE"
+#define OOO_STRING_SVTOOLS_HTML_O_SDonclick "SDONCLICK"
+#define OOO_STRING_SVTOOLS_HTML_O_SDonfocus "SDONFOCUS"
+#define OOO_STRING_SVTOOLS_HTML_O_SDonload "SDONLOAD"
+#define OOO_STRING_SVTOOLS_HTML_O_SDonmouseover "SDONMOUSEOVER"
+#define OOO_STRING_SVTOOLS_HTML_O_SDonreset "SDONRESET"
+#define OOO_STRING_SVTOOLS_HTML_O_SDonselect "SDONSELECT"
+#define OOO_STRING_SVTOOLS_HTML_O_SDonsubmit "SDONSUBMIT"
+#define OOO_STRING_SVTOOLS_HTML_O_SDonunload "SDONUNLOAD"
+#define OOO_STRING_SVTOOLS_HTML_O_SDonabort "SDONABORT"
+#define OOO_STRING_SVTOOLS_HTML_O_SDonerror "SDONERROR"
+#define OOO_STRING_SVTOOLS_HTML_O_SDonmouseout "SDONMOUSEOUT"
+
+// Attribute mit Kontext-abhaengigen Werten
+#define OOO_STRING_SVTOOLS_HTML_O_align "ALIGN"
+#define OOO_STRING_SVTOOLS_HTML_O_cols "COLS"
+#define OOO_STRING_SVTOOLS_HTML_O_rows "ROWS"
+#define OOO_STRING_SVTOOLS_HTML_O_start "START"
+#define OOO_STRING_SVTOOLS_HTML_O_size "SIZE"
+#define OOO_STRING_SVTOOLS_HTML_O_units "UNITS"
+
+// Werte von <INPUT TYPE=...>
+#define OOO_STRING_SVTOOLS_HTML_IT_text "TEXT"
+#define OOO_STRING_SVTOOLS_HTML_IT_password "PASSWORD"
+#define OOO_STRING_SVTOOLS_HTML_IT_checkbox "CHECKBOX"
+#define OOO_STRING_SVTOOLS_HTML_IT_radio "RADIO"
+#define OOO_STRING_SVTOOLS_HTML_IT_range "RANGE"
+#define OOO_STRING_SVTOOLS_HTML_IT_scribble "SCRIBBLE"
+#define OOO_STRING_SVTOOLS_HTML_IT_file "FILE"
+#define OOO_STRING_SVTOOLS_HTML_IT_hidden "HIDDEN"
+#define OOO_STRING_SVTOOLS_HTML_IT_submit "SUBMIT"
+#define OOO_STRING_SVTOOLS_HTML_IT_image "IMAGE"
+#define OOO_STRING_SVTOOLS_HTML_IT_reset "RESET"
+#define OOO_STRING_SVTOOLS_HTML_IT_button "BUTTON"
+
+// Werte von <TABLE FRAME=...>
+#define OOO_STRING_SVTOOLS_HTML_TF_void "VOID"
+#define OOO_STRING_SVTOOLS_HTML_TF_above "ABOVE"
+#define OOO_STRING_SVTOOLS_HTML_TF_below "BELOW"
+#define OOO_STRING_SVTOOLS_HTML_TF_hsides "HSIDES"
+#define OOO_STRING_SVTOOLS_HTML_TF_lhs "LHS"
+#define OOO_STRING_SVTOOLS_HTML_TF_rhs "RHS"
+#define OOO_STRING_SVTOOLS_HTML_TF_vsides "VSIDES"
+#define OOO_STRING_SVTOOLS_HTML_TF_box "BOX"
+#define OOO_STRING_SVTOOLS_HTML_TF_border "BORDER"
+
+// Werte von <TABLE RULES=...>
+#define OOO_STRING_SVTOOLS_HTML_TR_none "NONE"
+#define OOO_STRING_SVTOOLS_HTML_TR_groups "GROUPS"
+#define OOO_STRING_SVTOOLS_HTML_TR_rows "ROWS"
+#define OOO_STRING_SVTOOLS_HTML_TR_cols "COLS"
+#define OOO_STRING_SVTOOLS_HTML_TR_all "ALL"
+
+// Werte von <P, H?, TR, TH, TD ALIGN=...>
+#define OOO_STRING_SVTOOLS_HTML_AL_left "LEFT"
+#define OOO_STRING_SVTOOLS_HTML_AL_center "CENTER"
+#define OOO_STRING_SVTOOLS_HTML_AL_middle "MIDDLE"
+#define OOO_STRING_SVTOOLS_HTML_AL_right "RIGHT"
+#define OOO_STRING_SVTOOLS_HTML_AL_justify "JUSTIFY"
+#define OOO_STRING_SVTOOLS_HTML_AL_char "CHAR"
+#define OOO_STRING_SVTOOLS_HTML_AL_all "ALL"
+#define OOO_STRING_SVTOOLS_HTML_AL_none "NONE"
+
+// Werte von <TR VALIGN=...>, <IMG ALIGN=...>
+#define OOO_STRING_SVTOOLS_HTML_VA_top "TOP"
+#define OOO_STRING_SVTOOLS_HTML_VA_middle "MIDDLE"
+#define OOO_STRING_SVTOOLS_HTML_VA_bottom "BOTTOM"
+#define OOO_STRING_SVTOOLS_HTML_VA_baseline "BASELINE"
+#define OOO_STRING_SVTOOLS_HTML_VA_texttop "TEXTTOP"
+#define OOO_STRING_SVTOOLS_HTML_VA_absmiddle "ABSMIDDLE"
+#define OOO_STRING_SVTOOLS_HTML_VA_absbottom "ABSBOTTOM"
+
+// Werte von <AREA SHAPE=...>
+#define OOO_STRING_SVTOOLS_HTML_SH_rect "RECT"
+#define OOO_STRING_SVTOOLS_HTML_SH_rectangle "RECTANGLE"
+#define OOO_STRING_SVTOOLS_HTML_SH_circ "CIRC"
+#define OOO_STRING_SVTOOLS_HTML_SH_circle "CIRCLE"
+#define OOO_STRING_SVTOOLS_HTML_SH_poly "POLY"
+#define OOO_STRING_SVTOOLS_HTML_SH_polygon "POLYGON"
+#define OOO_STRING_SVTOOLS_HTML_SH_default "DEFAULT"
+
+#define OOO_STRING_SVTOOLS_HTML_LG_starbasic "STARBASIC"
+#define OOO_STRING_SVTOOLS_HTML_LG_javascript "JAVASCRIPT"
+#define OOO_STRING_SVTOOLS_HTML_LG_javascript11 "JAVASCRIPT1.1"
+#define OOO_STRING_SVTOOLS_HTML_LG_livescript "LIVESCRIPT"
+
+// ein par Werte fuer unser StarBASIC-Support
+#define OOO_STRING_SVTOOLS_HTML_SB_library "$LIBRARY:"
+#define OOO_STRING_SVTOOLS_HTML_SB_module "$MODULE:"
+
+// Werte von <FORM METHOD=...>
+#define OOO_STRING_SVTOOLS_HTML_METHOD_get "GET"
+#define OOO_STRING_SVTOOLS_HTML_METHOD_post "POST"
+
+// Werte von <META CONTENT/HTTP-EQUIV=...>
+#define OOO_STRING_SVTOOLS_HTML_META_refresh "REFRESH"
+#define OOO_STRING_SVTOOLS_HTML_META_generator "GENERATOR"
+#define OOO_STRING_SVTOOLS_HTML_META_author "AUTHOR"
+#define OOO_STRING_SVTOOLS_HTML_META_classification "CLASSIFICATION"
+#define OOO_STRING_SVTOOLS_HTML_META_description "DESCRIPTION"
+#define OOO_STRING_SVTOOLS_HTML_META_keywords "KEYWORDS"
+#define OOO_STRING_SVTOOLS_HTML_META_changed "CHANGED"
+#define OOO_STRING_SVTOOLS_HTML_META_changedby "CHANGEDBY"
+#define OOO_STRING_SVTOOLS_HTML_META_created "CREATED"
+#define OOO_STRING_SVTOOLS_HTML_META_content_type "CONTENT-TYPE"
+#define OOO_STRING_SVTOOLS_HTML_META_content_script_type "CONTENT-SCRIPT-TYPE"
+#define OOO_STRING_SVTOOLS_HTML_META_sdendnote "SDENDNOTE"
+#define OOO_STRING_SVTOOLS_HTML_META_sdfootnote "SDFOOTNOTE"
+
+// Werte von <UL TYPE=...>
+#define OOO_STRING_SVTOOLS_HTML_ULTYPE_disc "DISC"
+#define OOO_STRING_SVTOOLS_HTML_ULTYPE_square "SQUARE"
+#define OOO_STRING_SVTOOLS_HTML_ULTYPE_circle "CIRCLE"
+
+// Werte von <FRAMESET SCROLLING=...>
+#define OOO_STRING_SVTOOLS_HTML_SCROLL_yes "YES"
+#define OOO_STRING_SVTOOLS_HTML_SCROLL_no "NO"
+#define OOO_STRING_SVTOOLS_HTML_SCROLL_auto "AUTO"
+
+// Werte von <MULTICOL TYPE=...>
+#define OOO_STRING_SVTOOLS_HTML_MCTYPE_horizontal "HORIZONTAL"
+#define OOO_STRING_SVTOOLS_HTML_MCTYPE_vertical "VERTICAL"
+#define OOO_STRING_SVTOOLS_HTML_MCTYPE_box "BOX"
+
+// Werte von <MARQUEE BEHAVIOUR=...>
+#define OOO_STRING_SVTOOLS_HTML_BEHAV_scroll "SCROLL"
+#define OOO_STRING_SVTOOLS_HTML_BEHAV_slide "SLIDE"
+#define OOO_STRING_SVTOOLS_HTML_BEHAV_alternate "ALTERNATE"
+
+// Werte von <MARQUEE LOOP=...>
+#define OOO_STRING_SVTOOLS_HTML_LOOP_infinite "INFINITE"
+#define OOO_STRING_SVTOOLS_HTML_SPTYPE_block "BLOCK"
+#define OOO_STRING_SVTOOLS_HTML_SPTYPE_horizontal "HORIZONTAL"
+#define OOO_STRING_SVTOOLS_HTML_SPTYPE_vertical "VERTICAL"
+
+// interne Grafik-Namen
+#define OOO_STRING_SVTOOLS_HTML_private_image "private:image/"
+#define OOO_STRING_SVTOOLS_HTML_internal_gopher "internal-gopher-"
+#define OOO_STRING_SVTOOLS_HTML_internal_icon "internal-icon-"
+#define OOO_STRING_SVTOOLS_HTML_INT_GOPHER_binary "binary"
+#define OOO_STRING_SVTOOLS_HTML_INT_GOPHER_image "image"
+#define OOO_STRING_SVTOOLS_HTML_INT_GOPHER_index "index"
+#define OOO_STRING_SVTOOLS_HTML_INT_GOPHER_menu "menu"
+#define OOO_STRING_SVTOOLS_HTML_INT_GOPHER_movie "movie"
+#define OOO_STRING_SVTOOLS_HTML_INT_GOPHER_sound "sound"
+#define OOO_STRING_SVTOOLS_HTML_INT_GOPHER_telnet "telnet"
+#define OOO_STRING_SVTOOLS_HTML_INT_GOPHER_text "text"
+#define OOO_STRING_SVTOOLS_HTML_INT_GOPHER_unknown "unknown"
+#define OOO_STRING_SVTOOLS_HTML_INT_ICON_baddata "baddata"
+#define OOO_STRING_SVTOOLS_HTML_INT_ICON_delayed "delayed"
+#define OOO_STRING_SVTOOLS_HTML_INT_ICON_embed "embed"
+#define OOO_STRING_SVTOOLS_HTML_INT_ICON_insecure "insecure"
+#define OOO_STRING_SVTOOLS_HTML_INT_ICON_notfound "notfound"
+#define OOO_STRING_SVTOOLS_HTML_sdendnote "sdendnote"
+#define OOO_STRING_SVTOOLS_HTML_sdendnote_anc "sdendnoteanc"
+#define OOO_STRING_SVTOOLS_HTML_sdendnote_sym "sdendnotesym"
+#define OOO_STRING_SVTOOLS_HTML_sdfootnote "sdfootnote"
+#define OOO_STRING_SVTOOLS_HTML_sdfootnote_anc "sdfootnoteanc"
+#define OOO_STRING_SVTOOLS_HTML_sdfootnote_sym "sdfootnotesym"
+#define OOO_STRING_SVTOOLS_HTML_FTN_anchor "anc"
+#define OOO_STRING_SVTOOLS_HTML_FTN_symbol "sym"
+#define OOO_STRING_SVTOOLS_HTML_WW_off "OFF"
+#define OOO_STRING_SVTOOLS_HTML_WW_hard "HARD"
+#define OOO_STRING_SVTOOLS_HTML_WW_soft "SOFT"
+#define OOO_STRING_SVTOOLS_HTML_WW_virtual "VIRTUAL"
+#define OOO_STRING_SVTOOLS_HTML_WW_physical "PHYSICAL"
+#define OOO_STRING_SVTOOLS_HTML_on "on"
+#define OOO_STRING_SVTOOLS_HTML_ET_url "application/x-www-form-urlencoded"
+#define OOO_STRING_SVTOOLS_HTML_ET_multipart "multipart/form-data"
+#define OOO_STRING_SVTOOLS_HTML_ET_text "text/plain"
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/htmlout.hxx b/include/svtools/htmlout.hxx
new file mode 100644
index 000000000000..33c76fed1876
--- /dev/null
+++ b/include/svtools/htmlout.hxx
@@ -0,0 +1,118 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _HTMLOUT_HXX
+#define _HTMLOUT_HXX
+
+#include "svtools/svtdllapi.h"
+#include <tools/solar.h>
+#include <rtl/textenc.h>
+#include <rtl/string.hxx>
+#include <svl/macitem.hxx>
+
+class Color;
+class ImageMap;
+class String;
+class SvStream;
+class SvxMacroTableDtor;
+class SvNumberFormatter;
+
+struct HTMLOutEvent
+{
+ const sal_Char *pBasicName;
+ const sal_Char *pJavaName;
+ sal_uInt16 nEvent;
+};
+
+struct SVT_DLLPUBLIC HTMLOutContext
+{
+ rtl_TextEncoding m_eDestEnc;
+ rtl_TextToUnicodeConverter m_hConv;
+ rtl_TextToUnicodeContext m_hContext;
+
+ HTMLOutContext( rtl_TextEncoding eDestEnc );
+ ~HTMLOutContext();
+};
+
+struct HTMLOutFuncs
+{
+#if defined(UNX)
+ static const sal_Char sNewLine; // nur \012 oder \015
+#else
+ static const sal_Char sNewLine[]; // \015\012
+#endif
+
+ SVT_DLLPUBLIC static OString ConvertStringToHTML( const String& sSrc,
+ rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
+ String *pNonConvertableChars = 0 );
+
+ SVT_DLLPUBLIC static SvStream& Out_AsciiTag( SvStream&, const sal_Char* pStr,
+ sal_Bool bOn = sal_True,
+ rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252);
+ SVT_DLLPUBLIC static SvStream& Out_Char( SvStream&, sal_Unicode cChar,
+ HTMLOutContext& rContext,
+ String *pNonConvertableChars = 0 );
+ SVT_DLLPUBLIC static SvStream& Out_String( SvStream&, const String&,
+ rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
+ String *pNonConvertableChars = 0 );
+ SVT_DLLPUBLIC static SvStream& Out_Hex( SvStream&, sal_uLong nHex, sal_uInt8 nLen,
+ rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252 );
+ SVT_DLLPUBLIC static SvStream& Out_Color( SvStream&, const Color&,
+ rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252 );
+ SVT_DLLPUBLIC static SvStream& Out_ImageMap( SvStream&, const String&, const ImageMap&, const String&,
+ const HTMLOutEvent *pEventTable,
+ sal_Bool bOutStarBasic,
+ const sal_Char *pDelim = 0,
+ const sal_Char *pIndentArea = 0,
+ const sal_Char *pIndentMap = 0,
+ rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
+ String *pNonConvertableChars = 0 );
+ SVT_DLLPUBLIC static SvStream& FlushToAscii( SvStream&, HTMLOutContext& rContext );
+
+ SVT_DLLPUBLIC static SvStream& OutScript( SvStream& rStrm,
+ const String& rBaseURL,
+ const String& rSource,
+ const String& rLanguage,
+ ScriptType eScriptType,
+ const String& rSrc,
+ const String *pSBLibrary = 0,
+ const String *pSBModule = 0,
+ rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
+ String *pNonConvertableChars = 0 );
+
+ // der 3. Parameter ist ein Array von HTMLOutEvents, das mit einem
+ // nur aus 0 bestehen Eintrag terminiert ist.
+ SVT_DLLPUBLIC static SvStream& Out_Events( SvStream&, const SvxMacroTableDtor&,
+ const HTMLOutEvent*, sal_Bool bOutStarBasic,
+ rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
+ String *pNonConvertableChars = 0 );
+
+ // <TD SDVAL="..." SDNUM="...">
+ SVT_DLLPUBLIC static OString CreateTableDataOptionsValNum(
+ sal_Bool bValue, double fVal, sal_uLong nFormat,
+ SvNumberFormatter& rFormatter,
+ rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
+ String *pNonConvertableChars = 0);
+
+ SVT_DLLPUBLIC static sal_Bool PrivateURLToInternalImg( String& rURL );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/htmltokn.h b/include/svtools/htmltokn.h
new file mode 100644
index 000000000000..97e73cb4090a
--- /dev/null
+++ b/include/svtools/htmltokn.h
@@ -0,0 +1,561 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _HTMLTOKN_H
+#define _HTMLTOKN_H
+
+#include "svtools/svtdllapi.h"
+#include <sal/types.h>
+#include <tools/solar.h>
+
+class String;
+
+// suche das Char zu dem CharNamen
+sal_Unicode GetHTMLCharName( const String& rName );
+
+// suche die TokenID zu dem Token
+SVT_DLLPUBLIC int GetHTMLToken( const String& rName );
+
+// suche die TokenId zu einemm Attribut-Token
+int GetHTMLOption( const String& rName );
+
+// suche die 24-bit-Farbe zu einem Farbnamen (nicht gefunden = ULONG_MAX)
+SVT_DLLPUBLIC sal_uInt32 GetHTMLColor( const String& rName );
+
+// beginnen immer ab 256, groesser als ein char
+const int HTML_TOKEN_START = 0x100;
+const int HTML_TOKEN_ONOFF = 0x200;
+const int HTML_TOKEN_MICROSOFT = 0x1000;
+
+enum HTML_TOKEN_IDS
+{
+ HTML_TEXTTOKEN = HTML_TOKEN_START,
+ HTML_SINGLECHAR,
+ HTML_NEWPARA,
+ HTML_TABCHAR,
+ HTML_RAWDATA,
+ HTML_LINEFEEDCHAR,
+
+ // diese werden nur eingeschaltet
+ HTML_AREA, // Netscape 2.0
+ HTML_BASE, // HTML 3.0
+ HTML_COMMENT,
+ HTML_DOCTYPE,
+ HTML_EMBED, // Netscape 2.0 </EMBED> ignorieren
+ HTML_FIGUREOVERLAY, // HTML 3.0
+ HTML_HORZRULE, // </HR> ignorieren
+ HTML_HORZTAB, // HTML 3.0
+ HTML_IMAGE, // </IMG> ignorieren
+ HTML_INPUT, // </INPUT> ignorieren
+ HTML_ISINDEX, // HTML 3.0
+ HTML_LINEBREAK, // </BR> -> <BR>
+ HTML_LINK, // HTML 3.0
+ HTML_META, // HTML 3.0 </META> ignorieren
+ HTML_NEXTID, // HTML 3.0
+ HTML_OF, // HTML 3.0
+ HTML_OPTION, // </OPTION> ignorieren
+ HTML_PARAM, // HotJava
+ HTML_RANGE, // HTML 3.0
+ HTML_SPACER, // Netscape 3.0b5 // </SPACER> ignorieren
+ HTML_WBR, // Netscape
+
+ // Tokens, die ueber HTML-Charakter erkannt werden
+ HTML_NONBREAKSPACE,
+ HTML_SOFTHYPH,
+
+ // diese werden wieder abgeschaltet,
+ // der off-Wert liegt immer dahinter (+1) !!
+ HTML_ABBREVIATION_ON = HTML_TOKEN_ONOFF, // HTML 3.0
+ HTML_ABBREVIATION_OFF, // HTML 3.0
+ HTML_ABOVE_ON, // HTML 3.0
+ HTML_ABOVE_OFF, // HTML 3.0
+ HTML_ACRONYM_ON, // HTML 3.0
+ HTML_ACRONYM_OFF, // HTML 3.0
+ HTML_ADDRESS_ON,
+ HTML_ADDRESS_OFF,
+ HTML_ANCHOR_ON,
+ HTML_ANCHOR_OFF,
+ HTML_APPLET_ON, // HotJava
+ HTML_APPLET_OFF, // HotJava
+ HTML_ARRAY_ON, // HTML 3.0
+ HTML_ARRAY_OFF, // HTML 3.0
+ HTML_AUTHOR_ON, // HTML 3.0
+ HTML_AUTHOR_OFF, // HTML 3.0
+ HTML_BANNER_ON, // HTML 3.0
+ HTML_BANNER_OFF, // HTML 3.0
+ HTML_BAR_ON, // HTML 3.0
+ HTML_BAR_OFF, // HTML 3.0
+ HTML_BASEFONT_ON, // Netscape
+ HTML_BASEFONT_OFF, // Netscape
+ HTML_BELOW_ON, // HTML 3.0
+ HTML_BELOW_OFF, // HTML 3.0
+ HTML_BIGPRINT_ON, // HTML 3.0
+ HTML_BIGPRINT_OFF, // HTML 3.0
+ HTML_BLINK_ON, // Netscape
+ HTML_BLINK_OFF, // Netscape
+ HTML_BLOCKQUOTE30_ON, // HTML 3.0
+ HTML_BLOCKQUOTE30_OFF, // HTML 3.0
+ HTML_BLOCKQUOTE_ON,
+ HTML_BLOCKQUOTE_OFF,
+ HTML_BODY_ON,
+ HTML_BODY_OFF,
+ HTML_BOLDTEXT_ON, // HTML 3.0
+ HTML_BOLDTEXT_OFF, // HTML 3.0
+ HTML_BOLD_ON,
+ HTML_BOLD_OFF,
+ HTML_BOX_ON, // HTML 3.0
+ HTML_BOX_OFF, // HTML 3.0
+ HTML_CAPTION_ON, // HTML 3.0
+ HTML_CAPTION_OFF, // HTML 3.0
+ HTML_CENTER_ON, // Netscape
+ HTML_CENTER_OFF, // Netscape
+ HTML_CITIATION_ON,
+ HTML_CITIATION_OFF,
+ HTML_CODE_ON,
+ HTML_CODE_OFF,
+ HTML_COL_ON, // HTML3 Table Model Draft
+ HTML_COL_OFF, // HTML3 Table Model Draft
+ HTML_COLGROUP_ON, // HTML3 Table Model Draft
+ HTML_COLGROUP_OFF, // HTML3 Table Model Draft
+ HTML_CREDIT_ON, // HTML 3.0
+ HTML_CREDIT_OFF, // HTML 3.0
+ HTML_DD_ON,
+ HTML_DD_OFF,
+ HTML_DEFLIST_ON,
+ HTML_DEFLIST_OFF,
+ HTML_DELETEDTEXT_ON, // HTML 3.0
+ HTML_DELETEDTEXT_OFF, // HTML 3.0
+ HTML_DIRLIST_ON,
+ HTML_DIRLIST_OFF,
+ HTML_DIVISION_ON, // HTML 3.0
+ HTML_DIVISION_OFF, // HTML 3.0
+ HTML_DOT_ON, // HTML 3.0
+ HTML_DOT_OFF, // HTML 3.0
+ HTML_DOUBLEDOT_ON, // HTML 3.0
+ HTML_DOUBLEDOT_OFF, // HTML 3.0
+ HTML_DT_ON,
+ HTML_DT_OFF,
+ HTML_EMPHASIS_ON,
+ HTML_EMPHASIS_OFF,
+ HTML_FIGURE_ON, // HTML 3.0
+ HTML_FIGURE_OFF, // HTML 3.0
+ HTML_FONT_ON, // Netscape
+ HTML_FONT_OFF, // Netscape
+ HTML_FOOTNOTE_ON, // HTML 3.0
+ HTML_FOOTNOTE_OFF, // HTML 3.0
+ HTML_FORM_ON,
+ HTML_FORM_OFF,
+ HTML_FRAME_ON, // Netscape 2.0
+ HTML_FRAME_OFF, // Netscape 2.0
+ HTML_FRAMESET_ON, // Netscape 2.0
+ HTML_FRAMESET_OFF, // Netscape 2.0
+ HTML_HAT_ON, // HTML 3.0
+ HTML_HAT_OFF, // HTML 3.0
+ HTML_HEAD1_ON,
+ HTML_HEAD1_OFF,
+ HTML_HEAD2_ON,
+ HTML_HEAD2_OFF,
+ HTML_HEAD3_ON,
+ HTML_HEAD3_OFF,
+ HTML_HEAD4_ON,
+ HTML_HEAD4_OFF,
+ HTML_HEAD5_ON,
+ HTML_HEAD5_OFF,
+ HTML_HEAD6_ON,
+ HTML_HEAD6_OFF,
+ HTML_HEAD_ON,
+ HTML_HEAD_OFF,
+ HTML_HTML_ON,
+ HTML_HTML_OFF,
+ HTML_IFRAME_ON, // IE 3.0b2
+ HTML_IFRAME_OFF, // IE 3.0b2
+ HTML_ILAYER_ON,
+ HTML_ILAYER_OFF,
+ HTML_INSERTEDTEXT_ON, // HTML 3.0
+ HTML_INSERTEDTEXT_OFF, // HTML 3.0
+ HTML_ITALIC_ON,
+ HTML_ITALIC_OFF,
+ HTML_ITEM_ON, // HTML 3.0
+ HTML_ITEM_OFF, // HTML 3.0
+ HTML_KEYBOARD_ON,
+ HTML_KEYBOARD_OFF,
+ HTML_LAYER_ON,
+ HTML_LAYER_OFF,
+ HTML_LANGUAGE_ON, // HTML 3.0
+ HTML_LANGUAGE_OFF, // HTML 3.0
+ HTML_LISTHEADER_ON, // HTML 3.0
+ HTML_LISTHEADER_OFF, // HTML 3.0
+ HTML_LI_ON,
+ HTML_LI_OFF,
+ HTML_MAP_ON, // Netscape 2.0
+ HTML_MAP_OFF, // Netscape 2.0
+ HTML_MATH_ON, // HTML 3.0
+ HTML_MATH_OFF, // HTML 3.0
+ HTML_MENULIST_ON,
+ HTML_MENULIST_OFF,
+ HTML_MULTICOL_ON, // Netscape 3.0b5
+ HTML_MULTICOL_OFF, // Netscape 3.0b5
+ HTML_NOBR_ON, // Netscape
+ HTML_NOBR_OFF, // Netscape
+ HTML_NOEMBED_ON, // Netscape 2.0
+ HTML_NOEMBED_OFF, // Netscape 2.0
+ HTML_NOFRAMES_ON, // Netscape 2.0
+ HTML_NOFRAMES_OFF, // Netscape 2.0
+ HTML_NOSCRIPT_ON, // Netscape 2.0
+ HTML_NOSCRIPT_OFF, // Netscape 3.0
+ HTML_NOTE_ON, // HTML 3.0
+ HTML_NOTE_OFF, // HTML 3.0
+ HTML_OBJECT_ON, // HotJava
+ HTML_OBJECT_OFF, // HotJava
+ HTML_ORDERLIST_ON,
+ HTML_ORDERLIST_OFF,
+ HTML_PARABREAK_ON,
+ HTML_PARABREAK_OFF,
+ HTML_PERSON_ON, // HTML 3.0
+ HTML_PERSON_OFF, // HTML 3.0
+ HTML_PLAINTEXT_ON, // HTML 3.0
+ HTML_PLAINTEXT_OFF, // HTML 3.0
+ HTML_PREFORMTXT_ON,
+ HTML_PREFORMTXT_OFF,
+ HTML_ROOT_ON, // HTML 3.0
+ HTML_ROOT_OFF, // HTML 3.0
+ HTML_ROW_ON, // HTML 3.0
+ HTML_ROW_OFF, // HTML 3.0
+ HTML_SAMPLE_ON,
+ HTML_SAMPLE_OFF,
+ HTML_SCRIPT_ON, // HTML 3.2
+ HTML_SCRIPT_OFF, // HTML 3.2
+ HTML_SELECT_ON,
+ HTML_SELECT_OFF,
+ HTML_SHORTQUOTE_ON, // HTML 3.0
+ HTML_SHORTQUOTE_OFF, // HTML 3.0
+ HTML_SMALLPRINT_ON, // HTML 3.0
+ HTML_SMALLPRINT_OFF, // HTML 3.0
+ HTML_SPAN_ON, // Style Sheets
+ HTML_SPAN_OFF, // Style Sheets
+ HTML_SQUAREROOT_ON, // HTML 3.0
+ HTML_SQUAREROOT_OFF, // HTML 3.0
+ HTML_STRIKETHROUGH_ON, // HTML 3.0
+ HTML_STRIKETHROUGH_OFF, // HTML 3.0
+ HTML_STRONG_ON,
+ HTML_STRONG_OFF,
+ HTML_STYLE_ON, // HTML 3.0
+ HTML_STYLE_OFF, // HTML 3.0
+ HTML_SUBSCRIPT_ON, // HTML 3.0
+ HTML_SUBSCRIPT_OFF, // HTML 3.0
+ HTML_SUPERSCRIPT_ON, // HTML 3.0
+ HTML_SUPERSCRIPT_OFF, // HTML 3.0
+ HTML_TABLE_ON, // HTML 3.0
+ HTML_TABLE_OFF, // HTML 3.0
+ HTML_TABLEDATA_ON, // HTML 3.0
+ HTML_TABLEDATA_OFF, // HTML 3.0
+ HTML_TABLEHEADER_ON, // HTML 3.0
+ HTML_TABLEHEADER_OFF, // HTML 3.0
+ HTML_TABLEROW_ON, // HTML 3.0
+ HTML_TABLEROW_OFF, // HTML 3.0
+ HTML_TBODY_ON, // HTML3 Table Model Draft
+ HTML_TBODY_OFF, // HTML3 Table Model Draft
+ HTML_TELETYPE_ON,
+ HTML_TELETYPE_OFF,
+ HTML_TEXTAREA_ON,
+ HTML_TEXTAREA_OFF,
+ HTML_TEXTFLOW_ON, // HTML 3.2
+ HTML_TEXTFLOW_OFF, // HTML 3.2
+ HTML_TEXT_ON, // HTML 3.0
+ HTML_TEXT_OFF, // HTML 3.0
+ HTML_TFOOT_ON, // HTML3 Table Model Draft
+ HTML_TFOOT_OFF, // HTML3 Table Model Draft
+ HTML_THEAD_ON, // HTML3 Table Model Draft
+ HTML_THEAD_OFF, // HTML3 Table Model Draft
+ HTML_TILDE_ON, // HTML 3.0
+ HTML_TILDE_OFF, // HTML 3.0
+ HTML_TITLE_ON,
+ HTML_TITLE_OFF,
+ HTML_UNDERLINE_ON,
+ HTML_UNDERLINE_OFF,
+ HTML_UNORDERLIST_ON,
+ HTML_UNORDERLIST_OFF,
+ HTML_VARIABLE_ON,
+ HTML_VARIABLE_OFF,
+ HTML_VECTOR_ON, // HTML 3.0
+ HTML_VECTOR_OFF, // HTML 3.0
+
+ // obsolete features
+ HTML_XMP_ON,
+ HTML_XMP_OFF,
+ HTML_LISTING_ON,
+ HTML_LISTING_OFF,
+
+ // proposed features
+ HTML_DEFINSTANCE_ON,
+ HTML_DEFINSTANCE_OFF,
+ HTML_STRIKE_ON,
+ HTML_STRIKE_OFF,
+
+ HTML_UNKNOWNCONTROL_ON,
+ HTML_UNKNOWNCONTROL_OFF,
+
+ HTML_BGSOUND = HTML_TOKEN_MICROSOFT|HTML_TOKEN_START,
+
+ HTML_COMMENT2_ON = HTML_TOKEN_MICROSOFT|HTML_TOKEN_ONOFF, // HTML 2.0 ?
+ HTML_COMMENT2_OFF, // HTML 2.0 ?
+ HTML_MARQUEE_ON,
+ HTML_MARQUEE_OFF,
+ HTML_PLAINTEXT2_ON, // HTML 2.0 ?
+ HTML_PLAINTEXT2_OFF, // HTML 2.0 ?
+
+ HTML_SDFIELD_ON,
+ HTML_SDFIELD_OFF
+};
+
+// HTML Attribut-Token (=Optionen)
+
+// beginnen immer ab 256, groesser als ein char
+const int HTML_OPTION_START = 0x100;
+
+enum HTML_OPTION_IDS
+{
+HTML_OPTION_BOOL_START = HTML_OPTION_START,
+
+// Attribute ohne Wert
+ HTML_O_BOX = HTML_OPTION_BOOL_START,
+ HTML_O_CHECKED,
+ HTML_O_COMPACT,
+ HTML_O_CONTINUE,
+ HTML_O_CONTROLS, // IExplorer 2.0
+ HTML_O_DECLARE, // IExplorer 3.0b5
+ HTML_O_DISABLED,
+ HTML_O_FOLDED, // Netscape internal
+ HTML_O_ISMAP,
+ HTML_O_MAYSCRIPT, // Netcape 3.0
+ HTML_O_MULTIPLE,
+ HTML_O_NOFLOW,
+ HTML_O_NOHREF, // Netscape
+ HTML_O_NORESIZE, // Netscape 2.0
+ HTML_O_NOSHADE, // Netscape
+ HTML_O_NOWRAP,
+ HTML_O_PLAIN,
+ HTML_O_SDFIXED,
+ HTML_O_SELECTED,
+ HTML_O_SHAPES, // IExplorer 3.0b5
+HTML_OPTION_BOOL_END,
+
+// Attribute mit einem String als Wert
+HTML_OPTION_STRING_START = HTML_OPTION_BOOL_END,
+ HTML_O_ABOVE = HTML_OPTION_STRING_START,
+ HTML_O_ACCEPT,
+ HTML_O_ACCESSKEY,
+ HTML_O_ADD_DATE, // Netscape internal
+ HTML_O_ALT,
+ HTML_O_AXES,
+ HTML_O_AXIS,
+ HTML_O_BELOW,
+ HTML_O_CHAR, // HTML3 Table Model Draft
+ HTML_O_CLASS,
+ HTML_O_CLIP,
+ HTML_O_CODE, // HotJava
+ HTML_O_CODETYPE,
+ HTML_O_COLSPEC,
+ HTML_O_CONTENT,
+ HTML_O_COORDS, // Netscape 2.0
+ HTML_O_DP,
+ HTML_O_ENCTYPE,
+ HTML_O_ERROR,
+ HTML_O_FACE, // IExplorer 2.0
+ HTML_O_FRAMEBORDER, // IExplorer 3.0
+ HTML_O_HTTPEQUIV,
+ HTML_O_LANGUAGE, // JavaScript
+ HTML_O_LAST_MODIFIED, // Netscape internal
+ HTML_O_LAST_VISIT, // Netscape internal
+ HTML_O_MD,
+ HTML_O_N,
+ HTML_O_NAME,
+ HTML_O_NOTATION,
+ HTML_O_PROMPT,
+ HTML_O_SHAPE,
+ HTML_O_STANDBY,
+ HTML_O_STYLE, // Style Sheets
+ HTML_O_TITLE,
+ HTML_O_VALUE,
+ HTML_O_SDVAL, // StarDiv NumberValue
+ HTML_O_SDNUM, // StarDiv NumberFormat
+ HTML_O_SDLIBRARY,
+ HTML_O_SDMODULE,
+HTML_OPTION_STRING_END,
+
+// Attribute mit einem SGML-Identifier als Wert
+HTML_OPTION_SGMLID_START = HTML_OPTION_STRING_END,
+ HTML_O_FROM = HTML_OPTION_SGMLID_START,
+ HTML_O_ID,
+ HTML_O_TARGET, // Netscape 2.0
+ HTML_O_TO,
+ HTML_O_UNTIL,
+HTML_OPTION_SGMLID_END,
+
+// Attribute mit einem URI als Wert
+HTML_OPTION_URI_START = HTML_OPTION_SGMLID_END,
+ HTML_O_ACTION = HTML_OPTION_URI_START,
+ HTML_O_ARCHIVE,
+ HTML_O_BACKGROUND,
+ HTML_O_CLASSID,
+ HTML_O_CODEBASE, // HotJava
+ HTML_O_DATA,
+ HTML_O_DYNSRC, // IExplorer 3.0
+ HTML_O_DYNSYNC, // IExplorer 2.0
+ HTML_O_IMAGEMAP,
+ HTML_O_HREF,
+ HTML_O_LOWSRC, // Netscape 3.0
+ HTML_O_SCRIPT,
+ HTML_O_SRC,
+ HTML_O_USEMAP, // Netscape 2.0
+HTML_OPTION_URI_END,
+
+// Attribute mit Entity-Namen als Wert
+HTML_OPTION_ENTITY_START = HTML_OPTION_URI_END,
+ HTML_O_DINGBAT = HTML_OPTION_ENTITY_START,
+ HTML_O_SYM,
+HTML_OPTION_ENTITY_END,
+
+// Attribute mit einer Farbe als Wert (alle Netscape)
+HTML_OPTION_COLOR_START = HTML_OPTION_ENTITY_END,
+ HTML_O_ALINK = HTML_OPTION_COLOR_START,
+ HTML_O_BGCOLOR,
+ HTML_O_BORDERCOLOR, // IExplorer 2.0
+ HTML_O_BORDERCOLORLIGHT, // IExplorer 2.0
+ HTML_O_BORDERCOLORDARK, // IExplorer 2.0
+ HTML_O_COLOR,
+ HTML_O_LINK,
+ HTML_O_TEXT,
+ HTML_O_VLINK,
+HTML_OPTION_COLOR_END,
+
+// Attribute mit einem numerischen Wert
+HTML_OPTION_NUMBER_START = HTML_OPTION_COLOR_END,
+ HTML_O_BORDER = HTML_OPTION_NUMBER_START,
+ HTML_O_CELLSPACING, // HTML3 Table Model Draft
+ HTML_O_CELLPADDING, // HTML3 Table Model Draft
+ HTML_O_CHAROFF, // HTML3 Table Model Draft
+ HTML_O_COLSPAN,
+ HTML_O_FRAMESPACING, // IExplorer 3.0
+ HTML_O_GUTTER, // Netscape 3.0b5
+ HTML_O_INDENT,
+ HTML_O_HEIGHT,
+ HTML_O_HSPACE, // Netscape
+ HTML_O_LEFT,
+ HTML_O_LEFTMARGIN, // IExplorer 2.0
+ HTML_O_LOOP, // IExplorer 2.0
+ HTML_O_MARGINWIDTH, // Netscape 2.0
+ HTML_O_MARGINHEIGHT, // Netscape 2.0
+ HTML_O_MAX,
+ HTML_O_MAXLENGTH,
+ HTML_O_MIN,
+ HTML_O_PAGEX,
+ HTML_O_PAGEY,
+ HTML_O_POINTSIZE,
+ HTML_O_ROWSPAN,
+ HTML_O_SCROLLAMOUNT, // IExplorer 2.0
+ HTML_O_SCROLLDELAY, // IExplorer 2.0
+ HTML_O_SEQNUM,
+ HTML_O_SKIP,
+ HTML_O_SPAN, // HTML3 Table Model Draft
+ HTML_O_TABINDEX,
+ HTML_O_TOP,
+ HTML_O_TOPMARGIN, // IExplorer 2.0
+ HTML_O_VSPACE, // Netscape
+ HTML_O_WEIGHT,
+ HTML_O_WIDTH,
+ HTML_O_X,
+ HTML_O_Y,
+ HTML_O_ZINDEX,
+HTML_OPTION_NUMBER_END,
+
+// Attribute mit Enum-Werten
+HTML_OPTION_ENUM_START = HTML_OPTION_NUMBER_END,
+ HTML_O_BEHAVIOR = HTML_OPTION_ENUM_START, // IExplorer 2.0
+ HTML_O_BGPROPERTIES, // IExplorer 2.0
+ HTML_O_CLEAR,
+ HTML_O_DIR,
+ HTML_O_DIRECTION, // IExplorer 2.0
+ HTML_O_FORMAT,
+ HTML_O_FRAME, // HTML3 Table Model Draft
+ HTML_O_LANG,
+ HTML_O_METHOD,
+ HTML_O_PALETTE,
+ HTML_O_REL,
+ HTML_O_REV,
+ HTML_O_RULES, // HTML3 Table Model Draft
+ HTML_O_SCROLLING, // Netscape 2.0
+ HTML_O_SDREADONLY,
+ HTML_O_SUBTYPE,
+ HTML_O_TYPE,
+ HTML_O_VALIGN,
+ HTML_O_VALUETYPE,
+ HTML_O_VISIBILITY,
+ HTML_O_WRAP,
+HTML_OPTION_ENUM_END,
+
+// Attribute mit Script-Code als Wert
+HTML_OPTION_SCRIPT_START = HTML_OPTION_ENUM_END,
+ HTML_O_ONABORT = HTML_OPTION_SCRIPT_START, // JavaScript
+ HTML_O_ONBLUR, // JavaScript
+ HTML_O_ONCHANGE, // JavaScript
+ HTML_O_ONCLICK, // JavaScript
+ HTML_O_ONERROR, // JavaScript
+ HTML_O_ONFOCUS, // JavaScript
+ HTML_O_ONLOAD, // JavaScript
+ HTML_O_ONMOUSEOUT, // JavaScript
+ HTML_O_ONMOUSEOVER, // JavaScript
+ HTML_O_ONRESET, // JavaScript
+ HTML_O_ONSELECT, // JavaScript
+ HTML_O_ONSUBMIT, // JavaScript
+ HTML_O_ONUNLOAD, // JavaScript
+
+ HTML_O_SDONABORT, // StarBasic
+ HTML_O_SDONBLUR, // StarBasic
+ HTML_O_SDONCHANGE, // StarBasic
+ HTML_O_SDONCLICK, // StarBasic
+ HTML_O_SDONERROR, // StarBasic
+ HTML_O_SDONFOCUS, // StarBasic
+ HTML_O_SDONLOAD, // StarBasic
+ HTML_O_SDONMOUSEOUT, // StarBasic
+ HTML_O_SDONMOUSEOVER, // StarBasic
+ HTML_O_SDONRESET, // StarBasic
+ HTML_O_SDONSELECT, // StarBasic
+ HTML_O_SDONSUBMIT, // StarBasic
+ HTML_O_SDONUNLOAD, // StarBasic
+HTML_OPTION_SCRIPT_END,
+
+// Attribute mit Kontext-abhaengigen Werten
+HTML_OPTION_CONTEXT_START = HTML_OPTION_SCRIPT_END,
+ HTML_O_ALIGN = HTML_OPTION_CONTEXT_START,
+ HTML_O_COLS, // Netscape 2.0 vs HTML 2.0
+ HTML_O_ROWS, // Netscape 2.0 vs HTML 2.0
+ HTML_O_SIZE,
+ HTML_O_START,
+ HTML_O_UNITS,
+HTML_OPTION_CONTEXT_END,
+
+// eine unbekannte Option
+HTML_O_UNKNOWN = HTML_OPTION_CONTEXT_END,
+HTML_OPTION_END
+};
+
+#endif // _HTMLTOKN_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/hyperlabel.hxx b/include/svtools/hyperlabel.hxx
new file mode 100644
index 000000000000..745c50798f1d
--- /dev/null
+++ b/include/svtools/hyperlabel.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef SVTOOLS_HYPERLABEL_HXX
+#define SVTOOLS_HYPERLABEL_HXX
+
+#include <vcl/event.hxx>
+
+
+#include <vcl/fixed.hxx>
+
+#define LABELBASEMAPHEIGHT 8
+
+
+//.........................................................................
+namespace svt
+{
+//.........................................................................
+
+ class HyperLabelImpl;
+
+ class HyperLabel : public FixedText
+ {
+ protected:
+ HyperLabelImpl* m_pImpl;
+ Link maClickHdl;
+
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void GetFocus();
+ virtual void LoseFocus();
+
+ void DeactivateHyperMode(Font aFont, const Color aColor);
+ void ActivateHyperMode(Font aFont, const Color aColor);
+
+ protected:
+ void implInit();
+
+ public:
+ HyperLabel( Window* _pParent, WinBits _nWinStyle = 0 );
+ ~HyperLabel( );
+
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ void SetID( sal_Int16 _ID );
+ sal_Int16 GetID() const;
+
+ void SetIndex( sal_Int32 _Index );
+ sal_Int32 GetIndex() const;
+
+ void SetLabel( const OUString& _rText );
+
+ void ToggleBackgroundColor( const Color& _rGBColor );
+ void SetInteractive( sal_Bool _bInteractive );
+
+ void SetClickHdl( const Link& rLink ) { maClickHdl = rLink; }
+ const Link& GetClickHdl() const { return maClickHdl; }
+
+ Size CalcMinimumSize( long nMaxWidth = 0 ) const;
+
+ private:
+
+ DECL_LINK(ImplClickHdl, HyperLabel*);
+
+ private:
+ using FixedText::CalcMinimumSize;
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/imagemgr.hrc b/include/svtools/imagemgr.hrc
new file mode 100644
index 000000000000..1d86788e69fe
--- /dev/null
+++ b/include/svtools/imagemgr.hrc
@@ -0,0 +1,147 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVTOOLS_IMAGEMGR_HRC
+#define _SVTOOLS_IMAGEMGR_HRC
+
+#define IMAGELIST_START 3076 // must match to old Id's in SFX!
+
+#define IMG_IMPRESS (IMAGELIST_START + 47)
+#define IMG_BITMAP (IMAGELIST_START + 49)
+#define IMG_CALC (IMAGELIST_START + 50)
+#define IMG_CALCTEMPLATE (IMAGELIST_START + 51)
+#define IMG_DATABASE (IMAGELIST_START + 53)
+#define IMG_IMPRESSTEMPLATE (IMAGELIST_START + 54)
+#define IMG_GIF (IMAGELIST_START + 61)
+#define IMG_HTML (IMAGELIST_START + 63)
+#define IMG_JPG (IMAGELIST_START + 64)
+#define IMG_MATH (IMAGELIST_START + 68)
+#define IMG_MATHTEMPLATE (IMAGELIST_START + 69)
+#define IMG_FILE (IMAGELIST_START + 74)
+#define IMG_PCD (IMAGELIST_START + 76)
+#define IMG_PCT (IMAGELIST_START + 77)
+#define IMG_PCX (IMAGELIST_START + 78)
+#define IMG_SIM (IMAGELIST_START + 79)
+#define IMG_TEXTFILE (IMAGELIST_START + 80)
+#define IMG_TIFF (IMAGELIST_START + 82)
+#define IMG_WMF (IMAGELIST_START + 84)
+#define IMG_WRITER (IMAGELIST_START + 86)
+#define IMG_WRITERTEMPLATE (IMAGELIST_START + 87)
+#define IMG_FIXEDDEV (IMAGELIST_START + 88)
+#define IMG_REMOVEABLEDEV (IMAGELIST_START + 89)
+#define IMG_CDROMDEV (IMAGELIST_START + 90)
+#define IMG_NETWORKDEV (IMAGELIST_START + 91)
+#define IMG_TABLE (IMAGELIST_START + 112)
+#define IMG_FOLDER (IMAGELIST_START + 113)
+#define IMG_DXF (IMAGELIST_START + 141)
+#define IMG_MET (IMAGELIST_START + 142)
+#define IMG_PNG (IMAGELIST_START + 143)
+#define IMG_SGF (IMAGELIST_START + 144)
+#define IMG_SGV (IMAGELIST_START + 145)
+#define IMG_SVM (IMAGELIST_START + 146)
+#define IMG_GLOBAL_DOC (IMAGELIST_START + 150)
+#define IMG_DRAW (IMAGELIST_START + 151)
+#define IMG_DRAWTEMPLATE (IMAGELIST_START + 152)
+#define IMG_OO_DATABASE_DOC (IMAGELIST_START + 169)
+#define IMG_OO_DRAW_DOC (IMAGELIST_START + 170)
+#define IMG_OO_MATH_DOC (IMAGELIST_START + 171)
+#define IMG_OO_GLOBAL_DOC (IMAGELIST_START + 172)
+#define IMG_OO_IMPRESS_DOC (IMAGELIST_START + 173)
+#define IMG_OO_CALC_DOC (IMAGELIST_START + 174)
+#define IMG_OO_WRITER_DOC (IMAGELIST_START + 175)
+#define IMG_OO_DRAW_TEMPLATE (IMAGELIST_START + 176)
+#define IMG_OO_IMPRESS_TEMPLATE (IMAGELIST_START + 177)
+#define IMG_OO_CALC_TEMPLATE (IMAGELIST_START + 178)
+#define IMG_OO_WRITER_TEMPLATE (IMAGELIST_START + 179)
+#define IMG_EXTENSION (IMAGELIST_START + 180)
+
+#define RID_DESCRIPTION_START 256
+
+#define STR_DESCRIPTION_SOURCEFILE (RID_DESCRIPTION_START + 0)
+#define STR_DESCRIPTION_BOOKMARKFILE (RID_DESCRIPTION_START + 1)
+#define STR_DESCRIPTION_GRAPHIC_DOC (RID_DESCRIPTION_START + 2)
+#define STR_DESCRIPTION_CFGFILE (RID_DESCRIPTION_START + 3)
+#define STR_DESCRIPTION_APPLICATION (RID_DESCRIPTION_START + 4)
+#define STR_DESCRIPTION_DATABASE_TABLE (RID_DESCRIPTION_START + 5)
+#define STR_DESCRIPTION_SYSFILE (RID_DESCRIPTION_START + 6)
+#define STR_DESCRIPTION_WORD_DOC (RID_DESCRIPTION_START + 7)
+#define STR_DESCRIPTION_HELP_DOC (RID_DESCRIPTION_START + 8)
+#define STR_DESCRIPTION_HTMLFILE (RID_DESCRIPTION_START + 9)
+#define STR_DESCRIPTION_ARCHIVFILE (RID_DESCRIPTION_START + 10)
+#define STR_DESCRIPTION_LOGFILE (RID_DESCRIPTION_START + 11)
+#define STR_DESCRIPTION_SMATH_DOC (RID_DESCRIPTION_START + 12)
+#define STR_DESCRIPTION_SCHART_DOC (RID_DESCRIPTION_START + 13)
+#define STR_DESCRIPTION_SDRAW_DOC (RID_DESCRIPTION_START + 14)
+#define STR_DESCRIPTION_SCALC_DOC (RID_DESCRIPTION_START + 15)
+#define STR_DESCRIPTION_SIMPRESS_DOC (RID_DESCRIPTION_START + 16)
+#define STR_DESCRIPTION_SWRITER_DOC (RID_DESCRIPTION_START + 17)
+#define STR_DESCRIPTION_GLOBALDOC (RID_DESCRIPTION_START + 18)
+#define STR_DESCRIPTION_SIMAGE_DOC (RID_DESCRIPTION_START + 19)
+#define STR_DESCRIPTION_TEXTFILE (RID_DESCRIPTION_START + 20)
+#define STR_DESCRIPTION_LINK (RID_DESCRIPTION_START + 21)
+#define STR_DESCRIPTION_SOFFICE_TEMPLATE_DOC (RID_DESCRIPTION_START + 22)
+#define STR_DESCRIPTION_EXCEL_DOC (RID_DESCRIPTION_START + 23)
+#define STR_DESCRIPTION_EXCEL_TEMPLATE_DOC (RID_DESCRIPTION_START + 24)
+#define STR_DESCRIPTION_BATCHFILE (RID_DESCRIPTION_START + 25)
+#define STR_DESCRIPTION_FILE (RID_DESCRIPTION_START + 26)
+#define STR_DESCRIPTION_FOLDER (RID_DESCRIPTION_START + 27)
+#define STR_DESCRIPTION_FACTORY_WRITER (RID_DESCRIPTION_START + 28)
+#define STR_DESCRIPTION_FACTORY_CALC (RID_DESCRIPTION_START + 29)
+#define STR_DESCRIPTION_FACTORY_IMPRESS (RID_DESCRIPTION_START + 30)
+#define STR_DESCRIPTION_FACTORY_DRAW (RID_DESCRIPTION_START + 31)
+#define STR_DESCRIPTION_FACTORY_WRITERWEB (RID_DESCRIPTION_START + 32)
+#define STR_DESCRIPTION_FACTORY_GLOBALDOC (RID_DESCRIPTION_START + 33)
+#define STR_DESCRIPTION_FACTORY_MATH (RID_DESCRIPTION_START + 34)
+#define STR_DESCRIPTION_CALC_TEMPLATE (RID_DESCRIPTION_START + 35)
+#define STR_DESCRIPTION_DRAW_TEMPLATE (RID_DESCRIPTION_START + 36)
+#define STR_DESCRIPTION_IMPRESS_TEMPLATE (RID_DESCRIPTION_START + 37)
+#define STR_DESCRIPTION_WRITER_TEMPLATE (RID_DESCRIPTION_START + 38)
+#define STR_DESCRIPTION_LOCALE_VOLUME (RID_DESCRIPTION_START + 39)
+#define STR_DESCRIPTION_FLOPPY_VOLUME (RID_DESCRIPTION_START + 40)
+#define STR_DESCRIPTION_CDROM_VOLUME (RID_DESCRIPTION_START + 41)
+#define STR_DESCRIPTION_REMOTE_VOLUME (RID_DESCRIPTION_START + 42)
+#define STR_DESCRIPTION_POWERPOINT (RID_DESCRIPTION_START + 43)
+#define STR_DESCRIPTION_POWERPOINT_TEMPLATE (RID_DESCRIPTION_START + 44)
+#define STR_DESCRIPTION_POWERPOINT_SHOW (RID_DESCRIPTION_START + 45)
+#define STR_DESCRIPTION_SXMATH_DOC (RID_DESCRIPTION_START + 46)
+#define STR_DESCRIPTION_SXCHART_DOC (RID_DESCRIPTION_START + 47)
+#define STR_DESCRIPTION_SXDRAW_DOC (RID_DESCRIPTION_START + 48)
+#define STR_DESCRIPTION_SXCALC_DOC (RID_DESCRIPTION_START + 49)
+#define STR_DESCRIPTION_SXIMPRESS_DOC (RID_DESCRIPTION_START + 50)
+#define STR_DESCRIPTION_SXWRITER_DOC (RID_DESCRIPTION_START + 51)
+#define STR_DESCRIPTION_SXGLOBAL_DOC (RID_DESCRIPTION_START + 52)
+#define STR_DESCRIPTION_MATHML_DOC (RID_DESCRIPTION_START + 53)
+#define STR_DESCRIPTION_SDATABASE_DOC (RID_DESCRIPTION_START + 54)
+#define STR_DESCRIPTION_OO_DATABASE_DOC (RID_DESCRIPTION_START + 55)
+#define STR_DESCRIPTION_OO_DRAW_DOC (RID_DESCRIPTION_START + 56)
+#define STR_DESCRIPTION_OO_MATH_DOC (RID_DESCRIPTION_START + 57)
+#define STR_DESCRIPTION_OO_GLOBAL_DOC (RID_DESCRIPTION_START + 58)
+#define STR_DESCRIPTION_OO_IMPRESS_DOC (RID_DESCRIPTION_START + 59)
+#define STR_DESCRIPTION_OO_CALC_DOC (RID_DESCRIPTION_START + 60)
+#define STR_DESCRIPTION_OO_WRITER_DOC (RID_DESCRIPTION_START + 61)
+#define STR_DESCRIPTION_OO_DRAW_TEMPLATE (RID_DESCRIPTION_START + 62)
+#define STR_DESCRIPTION_OO_IMPRESS_TEMPLATE (RID_DESCRIPTION_START + 63)
+#define STR_DESCRIPTION_OO_CALC_TEMPLATE (RID_DESCRIPTION_START + 64)
+#define STR_DESCRIPTION_OO_WRITER_TEMPLATE (RID_DESCRIPTION_START + 65)
+#define STR_DESCRIPTION_FACTORY_DATABASE (RID_DESCRIPTION_START + 66)
+#define STR_DESCRIPTION_EXTENSION (RID_DESCRIPTION_START + 67)
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/imagemgr.hxx b/include/svtools/imagemgr.hxx
new file mode 100644
index 000000000000..860190f835a3
--- /dev/null
+++ b/include/svtools/imagemgr.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVTOOLS_IMAGEMGR_HXX
+#define _SVTOOLS_IMAGEMGR_HXX
+
+#include "svtools/svtdllapi.h"
+#include "sal/types.h"
+
+class Image;
+class String;
+class INetURLObject;
+
+namespace svtools {
+
+struct VolumeInfo
+{
+ sal_Bool m_bIsVolume;
+ sal_Bool m_bIsRemote;
+ sal_Bool m_bIsRemoveable;
+ sal_Bool m_bIsFloppy;
+ sal_Bool m_bIsCompactDisc;
+
+ VolumeInfo() :
+ m_bIsVolume ( sal_False ),
+ m_bIsRemote ( sal_False ),
+ m_bIsRemoveable ( sal_False ),
+ m_bIsFloppy ( sal_False ),
+ m_bIsCompactDisc( sal_False ) {}
+
+ VolumeInfo( sal_Bool _bIsVolume,
+ sal_Bool _bIsRemote,
+ sal_Bool _bIsRemoveable,
+ sal_Bool _bIsFloppy,
+ sal_Bool _bIsCompactDisc ) :
+ m_bIsVolume ( _bIsVolume ),
+ m_bIsRemote ( _bIsRemote ),
+ m_bIsRemoveable ( _bIsRemoveable ),
+ m_bIsFloppy ( _bIsFloppy ),
+ m_bIsCompactDisc( _bIsCompactDisc ) {}
+};
+
+}
+
+class SvFileInformationManager
+{
+private:
+ SVT_DLLPRIVATE static String GetDescription_Impl( const INetURLObject& rObject, sal_Bool bDetectFolder );
+
+public:
+ SVT_DLLPUBLIC static Image GetImage( const INetURLObject& rURL, sal_Bool bBig = sal_False );
+ SVT_DLLPUBLIC static Image GetFileImage( const INetURLObject& rURL, sal_Bool bBig = sal_False );
+ SVT_DLLPUBLIC static Image GetImageNoDefault( const INetURLObject& rURL, sal_Bool bBig = sal_False );
+ SVT_DLLPUBLIC static Image GetFolderImage( const svtools::VolumeInfo& rInfo, sal_Bool bBig = sal_False );
+
+ SVT_DLLPUBLIC static String GetDescription( const INetURLObject& rObject );
+ SVT_DLLPUBLIC static String GetFileDescription( const INetURLObject& rObject );
+ SVT_DLLPUBLIC static String GetFolderDescription( const svtools::VolumeInfo& rInfo );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/imageresourceaccess.hxx b/include/svtools/imageresourceaccess.hxx
new file mode 100644
index 000000000000..b8282da72167
--- /dev/null
+++ b/include/svtools/imageresourceaccess.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVTOOLS_INC_IMAGERESOURCEACCESS_HXX
+#define SVTOOLS_INC_IMAGERESOURCEACCESS_HXX
+
+#include "svtools/svtdllapi.h"
+
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+class SvStream;
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ //====================================================================
+ //= GraphicAccess
+ //====================================================================
+ /** helper class for obtaining streams (which also can be used with the ImageProducer)
+ from a resource
+ */
+ class GraphicAccess
+ {
+ private:
+ GraphicAccess(); // never implemented
+
+ public:
+ /** determines whether the given URL denotes an image within a resource
+ ( or an image specified by a vnd.sun.star.GraphicObject scheme URL )
+ */
+ SVT_DLLPUBLIC static bool isSupportedURL( const OUString& _rURL );
+
+ /** for a given URL of an image within a resource ( or an image specified by a vnd.sun.star.GraphicObject scheme URL ), this method retrieves
+ an SvStream for this image.
+
+ This method works for arbitrary URLs denoting an image, since the
+ <type scope="com::sun::star::graphics">GraphicsProvider</type> service is used
+ to resolve the URL. However, obtaining the stream is expensive (since
+ the image must be copied), so you are strongly encouraged to only use it
+ when you know that the image is small enough.
+ */
+ SVT_DLLPUBLIC static SvStream* getImageStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext,
+ const OUString& _rImageResourceURL
+ );
+
+ /** for a given URL of an image within a resource ( or an image specified by a vnd.sun.star.GraphicObject scheme URL ), this method retrieves
+ an <type scope="com::sun::star::io">XInputStream</type> for this image.
+ */
+ SVT_DLLPUBLIC static ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ getImageXStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext,
+ const OUString& _rImageResourceURL
+ );
+ };
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // DBA14_SVTOOLS_INC_IMAGERESOURCEACCESS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/imap.hxx b/include/svtools/imap.hxx
new file mode 100644
index 000000000000..790cdebef60f
--- /dev/null
+++ b/include/svtools/imap.hxx
@@ -0,0 +1,151 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _IMAP_HXX
+#define _IMAP_HXX
+
+#include "svtools/svtdllapi.h"
+#include <tools/string.hxx>
+#include <tools/stream.hxx>
+#include <vector>
+
+class Point;
+class Rectangle;
+class Size;
+class Fraction;
+class IMapObject;
+
+typedef ::std::vector< IMapObject* > IMapObjectList_impl;
+
+class SVT_DLLPUBLIC ImageMap
+{
+private:
+
+ IMapObjectList_impl maList;
+ String aName;
+
+protected:
+
+ // Binaer laden/speichern
+ void ImpWriteImageMap( SvStream& rOStm, const String& ) const ;
+ void ImpReadImageMap( SvStream& rIStm, size_t nCount, const String& );
+
+ // Im-/Export
+ void ImpWriteCERN( SvStream& rOStm, const String& rBaseURL ) const;
+ void ImpWriteNCSA( SvStream& rOStm, const String& rBaseURL ) const;
+ sal_uLong ImpReadCERN( SvStream& rOStm, const String& rBaseURL );
+ sal_uLong ImpReadNCSA( SvStream& rOStm, const String& rBaseURL );
+
+ void ImpReadCERNLine( const OString& rLine, const String& rBaseURL );
+ Point ImpReadCERNCoords( const char** ppStr );
+ long ImpReadCERNRadius( const char** ppStr );
+ String ImpReadCERNURL( const char** ppStr, const String& rBaseURL );
+
+ void ImpReadNCSALine( const OString& rLine, const String& rBaseURL );
+ String ImpReadNCSAURL( const char** ppStr, const String& rBaseURL );
+ Point ImpReadNCSACoords( const char** ppStr );
+
+ sal_uLong ImpDetectFormat( SvStream& rIStm );
+
+public:
+
+ TYPEINFO();
+
+ ImageMap() {};
+ ImageMap( const String& rName );
+ ImageMap( const ImageMap& rImageMap );
+
+ // Der Dtor gibt den intern belegten
+ // Speicher wieder frei;
+ // alle IMapObjekte werden im Dtor zerstoert;
+ virtual ~ImageMap();
+
+ // Zuweisungsoperator
+ ImageMap& operator=( const ImageMap& rImageMap );
+
+ // Vergleichsoperator (es wird alles auf Gleichheit geprueft)
+ sal_Bool operator==( const ImageMap& rImageMap );
+ sal_Bool operator!=( const ImageMap& rImageMap );
+
+ // In die Map wird ein neues IMap-Obkekt ans Ende eingefuegt
+ void InsertIMapObject( const IMapObject& rIMapObject );
+
+ // Zugriff auf einzelne IMapObjekte; die Objekte
+ // duerfen von aussen _nicht_ zerstoert werden
+ IMapObject* GetIMapObject( size_t nPos ) const
+ {
+ return ( nPos < maList.size() ) ? maList[ nPos ] : NULL;
+ }
+
+ // Gibt das Objekt zurueck, das zuerst getroffen wurde oder NULL;
+ // Groessen- und Positionsangaben sind in 1/100mm;
+ // rTotalSize ist die Originalgroesse des Bildes;
+ // rDisplaySize die aktuelle Darstellungsgroesse;
+ // rRelPoint bezieht sich auf die Darstellungsgroesse
+ // und die linke oebere Ecke des Bildes
+ IMapObject* GetHitIMapObject( const Size& rOriginalSize,
+ const Size& rDisplaySize,
+ const Point& rRelHitPoint,
+ sal_uLong nFlags = 0 );
+
+ // Gibt die Gesamtanzahl der IMap-Objekte zurueck
+ size_t GetIMapObjectCount() const { return maList.size(); }
+
+ // Loescht alle internen Objekte
+ void ClearImageMap();
+
+ // liefert die aktuelle Versionsnummer
+ sal_uInt16 GetVersion() const;
+
+ // liefert / setzt den Namen der ImageMap
+ const String& GetName() const { return aName; }
+ void SetName( const String& rName ) { aName = rName; }
+
+ // skaliert alle Objekte der ImageMap entpr. dem uebergebenen Faktor
+ void Scale( const Fraction& rFractX, const Fraction& rFracY );
+
+ // Im-/Export
+ void Write ( SvStream& rOStm, const String& rBaseURL ) const;
+ void Read( SvStream& rIStm, const String& rBaseURL );
+
+ void Write( SvStream& rOStm, sal_uLong nFormat, const String& rBaseURL ) const;
+ sal_uLong Read( SvStream& rIStm, sal_uLong nFormat, const String& rBaseURL );
+};
+
+class IMapCompat
+{
+ SvStream* pRWStm;
+ sal_uLong nCompatPos;
+ sal_uLong nTotalSize;
+ sal_uInt16 nStmMode;
+
+ IMapCompat() {}
+ IMapCompat( const IMapCompat& ) {}
+ IMapCompat& operator=( const IMapCompat& ) { return *this; }
+ sal_Bool operator==( const IMapCompat& ) { return sal_False; }
+
+public:
+
+ IMapCompat( SvStream& rStm, const sal_uInt16 nStreamMode );
+ ~IMapCompat();
+};
+
+#endif // _IMAP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/imapcirc.hxx b/include/svtools/imapcirc.hxx
new file mode 100644
index 000000000000..057561adad98
--- /dev/null
+++ b/include/svtools/imapcirc.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _GOODIES_IMAPCIRC_HXX
+#define _GOODIES_IMAPCIRC_HXX
+
+#include "svtools/svtdllapi.h"
+#include <tools/gen.hxx>
+#include <svtools/imapobj.hxx>
+
+class Fraction;
+
+class SVT_DLLPUBLIC IMapCircleObject : public IMapObject
+{
+ Point aCenter;
+ sal_Int32 nRadius;
+
+ void ImpConstruct( const Point& rCenter, sal_uLong nRad, sal_Bool bPixel );
+
+protected:
+
+ // Binaer-Im-/Export
+ virtual void WriteIMapObject( SvStream& rOStm ) const;
+ virtual void ReadIMapObject( SvStream& rIStm );
+
+public:
+
+ IMapCircleObject() {};
+ IMapCircleObject( const Point& rCenter, sal_uLong nRad,
+ const String& rURL,
+ const String& rAltText,
+ const String& rDesc,
+ const String& rTarget,
+ const String& rName,
+ sal_Bool bActive = sal_True,
+ sal_Bool bPixelCoords = sal_True );
+ virtual ~IMapCircleObject() {};
+
+ virtual sal_uInt16 GetType() const;
+ virtual sal_Bool IsHit( const Point& rPoint ) const;
+
+ Point GetCenter( sal_Bool bPixelCoords = sal_True ) const;
+ sal_uLong GetRadius( sal_Bool bPixelCoords = sal_True ) const;
+
+ // liefert das BoundRect des Kreis-Objektes in 1/100mm
+ virtual Rectangle GetBoundRect() const;
+
+ void Scale( const Fraction& rFractX, const Fraction& rFracY );
+
+ using IMapObject::IsEqual;
+ sal_Bool IsEqual( const IMapCircleObject& rEqObj );
+
+ // Im-/Export
+ void WriteCERN( SvStream& rOStm, const String& rBaseURL ) const;
+ void WriteNCSA( SvStream& rOStm, const String& rBaseURL ) const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/imapobj.hxx b/include/svtools/imapobj.hxx
new file mode 100644
index 000000000000..e90902bec0f0
--- /dev/null
+++ b/include/svtools/imapobj.hxx
@@ -0,0 +1,145 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _GOODIES_IMAPOBJ_HXX
+#define _GOODIES_IMAPOBJ_HXX
+
+#include "svtools/svtdllapi.h"
+#include <tools/string.hxx>
+#include <svl/macitem.hxx>
+#include <rtl/strbuf.hxx>
+
+class Point;
+class Rectangle;
+class SvStream;
+
+#define IMAP_OBJ_NONE ((sal_uInt16)0x0000)
+#define IMAP_OBJ_RECTANGLE ((sal_uInt16)0x0001)
+#define IMAP_OBJ_CIRCLE ((sal_uInt16)0x0002)
+#define IMAP_OBJ_POLYGON ((sal_uInt16)0x0003)
+#define IMAP_OBJ_VERSION ((sal_uInt16)0x0005)
+
+#define IMAGE_MAP_VERSION ((sal_uInt16)0x0001)
+
+#define IMAPMAGIC "SDIMAP"
+
+#define IMAP_MIRROR_HORZ 0x00000001L
+#define IMAP_MIRROR_VERT 0x00000002L
+
+#define IMAP_FORMAT_BIN 0x00000001L
+#define IMAP_FORMAT_CERN 0x00000002L
+#define IMAP_FORMAT_NCSA 0x00000004L
+#define IMAP_FORMAT_DETECT 0xffffffffL
+
+#define IMAP_ERR_OK 0x00000000L
+#define IMAP_ERR_FORMAT 0x00000001L
+
+class SVT_DLLPUBLIC IMapObject
+{
+ friend class ImageMap;
+
+ String aURL;
+ String aAltText;
+ String aDesc;
+ String aTarget;
+ String aName;
+ SvxMacroTableDtor aEventList;
+ sal_Bool bActive;
+
+protected:
+ sal_uInt16 nReadVersion;
+
+ // Binaer-Im-/Export
+ virtual void WriteIMapObject( SvStream& rOStm ) const = 0;
+ virtual void ReadIMapObject( SvStream& rIStm ) = 0;
+
+ // Hilfsmethoden
+ void AppendCERNCoords(OStringBuffer& rBuf, const Point& rPoint100) const;
+ void AppendCERNURL(OStringBuffer& rBuf, const String& rBaseURL) const;
+ void AppendNCSACoords(OStringBuffer& rBuf, const Point& rPoint100) const;
+ void AppendNCSAURL(OStringBuffer&rBuf, const String& rBaseURL) const;
+
+public:
+
+ static rtl_TextEncoding nActualTextEncoding;
+
+ IMapObject();
+ IMapObject( const String& rURL,
+ const String& rAltText,
+ const String& rDesc,
+ const String& rTarget,
+ const String& rName,
+ sal_Bool bActive );
+ virtual ~IMapObject() {};
+
+ virtual sal_uInt16 GetVersion() const;
+ virtual sal_uInt16 GetType() const = 0;
+ virtual sal_Bool IsHit( const Point& rPoint ) const = 0;
+
+ void Write ( SvStream& rOStm, const String& rBaseURL ) const;
+ void Read( SvStream& rIStm, const String& rBaseURL );
+
+ virtual Rectangle GetBoundRect() const = 0;
+
+ const String& GetURL() const { return aURL; }
+ void SetURL( const String& rURL ) { aURL = rURL; }
+
+ const String& GetAltText() const { return aAltText; }
+ void SetAltText( const String& rAltText) { aAltText = rAltText; }
+
+ const String& GetDesc() const { return aDesc; }
+ void SetDesc( const String& rDesc ) { aDesc = rDesc; }
+
+ const String& GetTarget() const { return aTarget; }
+ void SetTarget( const String& rTarget ) { aTarget = rTarget; }
+
+ const String& GetName() const { return aName; }
+ void SetName( const String& rName ) { aName = rName; }
+
+ sal_Bool IsActive() const { return bActive; }
+ void SetActive( sal_Bool bSetActive = sal_True ) { bActive = bSetActive; }
+
+ sal_Bool IsEqual( const IMapObject& rEqObj );
+
+ // IMap-Events
+ inline const SvxMacroTableDtor& GetMacroTable() const { return aEventList;}
+ inline void SetMacroTable( const SvxMacroTableDtor& rTbl ) { aEventList = rTbl; }
+
+ inline const SvxMacro& GetEvent( sal_uInt16 nEvent ) const;
+ inline sal_Bool HasEvent( sal_uInt16 nEvent ) const;
+ void SetEvent( sal_uInt16 nEvent, const SvxMacro& );
+ inline sal_Bool DelEvent( sal_uInt16 nEvent );
+};
+
+inline sal_Bool IMapObject::HasEvent( sal_uInt16 nEvent ) const
+{
+ return aEventList.IsKeyValid( nEvent );
+}
+inline const SvxMacro& IMapObject::GetEvent( sal_uInt16 nEvent ) const
+{
+ return *(aEventList.Get( nEvent ));
+}
+inline sal_Bool IMapObject::DelEvent( sal_uInt16 nEvent )
+{
+ return aEventList.Erase( nEvent );
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/imappoly.hxx b/include/svtools/imappoly.hxx
new file mode 100644
index 000000000000..b4a0eafdb07d
--- /dev/null
+++ b/include/svtools/imappoly.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _GOODIES_IMAPPOLY_HXX
+#define _GOODIES_IMAPPOLY_HXX
+
+#include "svtools/svtdllapi.h"
+#include <svtools/imapobj.hxx>
+#include <tools/poly.hxx>
+
+class Fraction;
+
+class SVT_DLLPUBLIC IMapPolygonObject : public IMapObject
+{
+ Polygon aPoly;
+ Rectangle aEllipse;
+ sal_Bool bEllipse;
+
+ SVT_DLLPRIVATE void ImpConstruct( const Polygon& rPoly, sal_Bool bPixel );
+
+protected:
+
+ // Binaer-Im-/Export
+ virtual void WriteIMapObject( SvStream& rOStm ) const;
+ virtual void ReadIMapObject( SvStream& rIStm );
+
+ sal_Bool ReadPreProLine( SvStream& rIStm, String& rStr );
+
+public:
+ IMapPolygonObject() {};
+ IMapPolygonObject( const Polygon& rPoly,
+ const String& rURL,
+ const String& rAltText,
+ const String& rDesc,
+ const String& rTarget,
+ const String& rName,
+ sal_Bool bActive = sal_True,
+ sal_Bool bPixelCoords = sal_True );
+ virtual ~IMapPolygonObject() {};
+
+ virtual sal_uInt16 GetType() const;
+ virtual sal_Bool IsHit( const Point& rPoint ) const;
+
+ Polygon GetPolygon( sal_Bool bPixelCoords = sal_True ) const;
+
+ // liefert das BoundRect des Polygon-Objektes in 1/100mm
+ virtual Rectangle GetBoundRect() const { return aPoly.GetBoundRect(); }
+
+ sal_Bool HasExtraEllipse() const { return bEllipse; }
+ const Rectangle& GetExtraEllipse() const { return aEllipse; }
+ void SetExtraEllipse( const Rectangle& rEllipse );
+
+ void Scale( const Fraction& rFractX, const Fraction& rFracY );
+
+ using IMapObject::IsEqual;
+ sal_Bool IsEqual( const IMapPolygonObject& rEqObj );
+
+ // Im-/Export
+ void WriteCERN( SvStream& rOStm, const String& rBaseURL ) const;
+ void WriteNCSA( SvStream& rOStm, const String& rBaseURL ) const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/imaprect.hxx b/include/svtools/imaprect.hxx
new file mode 100644
index 000000000000..b7d6ab54288a
--- /dev/null
+++ b/include/svtools/imaprect.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _GOODIES_IMAPRECT_HXX
+#define _GOODIES_IMAPRECT_HXX
+
+#include "svtools/svtdllapi.h"
+#include <svtools/imapobj.hxx>
+#include <tools/gen.hxx>
+
+class Fraction;
+
+class SVT_DLLPUBLIC IMapRectangleObject : public IMapObject
+{
+ Rectangle aRect;
+
+ SVT_DLLPRIVATE void ImpConstruct( const Rectangle& rRect, sal_Bool bPixel );
+
+protected:
+
+ // Binaer-Im-/Export
+ virtual void WriteIMapObject( SvStream& rOStm ) const;
+ virtual void ReadIMapObject( SvStream& rIStm );
+
+public:
+
+ IMapRectangleObject() {};
+ IMapRectangleObject( const Rectangle& rRect,
+ const String& rURL,
+ const String& rAltText,
+ const String& rDesc,
+ const String& rTarget,
+ const String& rName,
+ sal_Bool bActive = sal_True,
+ sal_Bool bPixelCoords = sal_True );
+ virtual ~IMapRectangleObject() {};
+
+ virtual sal_uInt16 GetType() const;
+ virtual sal_Bool IsHit( const Point& rPoint ) const;
+
+ Rectangle GetRectangle( sal_Bool bPixelCoords = sal_True ) const;
+
+ // liefert das BoundRect des Rechteck-Objektes in 1/100mm
+ virtual Rectangle GetBoundRect() const { return aRect; }
+
+ void Scale( const Fraction& rFractX, const Fraction& rFracY );
+
+ using IMapObject::IsEqual;
+ sal_Bool IsEqual( const IMapRectangleObject& rEqObj );
+
+ // Im-/Export
+ void WriteCERN( SvStream& rOStm, const String& rBaseURL ) const;
+ void WriteNCSA( SvStream& rOStm, const String& rBaseURL ) const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/imgdef.hxx b/include/svtools/imgdef.hxx
new file mode 100644
index 000000000000..e243d9fd4231
--- /dev/null
+++ b/include/svtools/imgdef.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVTOOLS_IMGDEF_HXX
+#define _SVTOOLS_IMGDEF_HXX
+
+enum SfxSymbolsSize
+{
+ SFX_SYMBOLS_SIZE_SMALL,
+ SFX_SYMBOLS_SIZE_LARGE,
+ SFX_SYMBOLS_SIZE_AUTO
+};
+
+#define SFX_TOOLBOX_CHANGESYMBOLSET 0x0001
+#define SFX_TOOLBOX_CHANGEOUTSTYLE 0x0002
+#define SFX_TOOLBOX_CHANGEBUTTONTYPE 0x0004
+
+#endif // _SVTOOLS_IMGDEF_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/indexentryres.hxx b/include/svtools/indexentryres.hxx
new file mode 100644
index 000000000000..9e2a54a8ef0b
--- /dev/null
+++ b/include/svtools/indexentryres.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVTOOLS_INDEXENTRYRESOURCE_HXX
+#define SVTOOLS_INDEXENTRYRESOURCE_HXX
+
+#include "svtools/svtdllapi.h"
+#include <rtl/ustring.hxx>
+
+class IndexEntryResourceData;
+
+class SVT_DLLPUBLIC IndexEntryResource
+{
+ private:
+ IndexEntryResourceData *mp_Data;
+
+ public:
+ IndexEntryResource ();
+ ~IndexEntryResource ();
+ const OUString& GetTranslation (const OUString& r_Algorithm);
+};
+
+#endif /* SVTOOLS_INDEXENTRYRESOURCE_HXX */
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/inetimg.hxx b/include/svtools/inetimg.hxx
new file mode 100644
index 000000000000..f28ac2cdedfe
--- /dev/null
+++ b/include/svtools/inetimg.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _INETIMG_HXX
+#define _INETIMG_HXX
+
+#include <tools/string.hxx>
+#include <tools/gen.hxx>
+
+class SvData;
+class SotDataObject;
+
+//=========================================================================
+
+class INetImage
+{
+ String aImageURL;
+ String aTargetURL;
+ String aTargetFrame;
+ String aAlternateText;
+ Size aSizePixel;
+
+protected:
+ String CopyExchange() const;
+ void PasteExchange( const String& rString );
+
+ void SetImageURL( const String& rS ) { aImageURL = rS; }
+ void SetTargetURL( const String& rS ) { aTargetURL = rS; }
+ void SetTargetFrame( const String& rS ) { aTargetFrame = rS; }
+ void SetAlternateText( const String& rS ){ aAlternateText = rS; }
+ void SetSizePixel( const Size& rSize ) { aSizePixel = rSize; }
+
+public:
+ INetImage(
+ const String& rImageURL,
+ const String& rTargetURL,
+ const String& rTargetFrame,
+ const String& rAlternateText,
+ const Size& rSizePixel )
+ : aImageURL( rImageURL ),
+ aTargetURL( rTargetURL ),
+ aTargetFrame( rTargetFrame ),
+ aAlternateText( rAlternateText ),
+ aSizePixel( rSizePixel )
+ {}
+ INetImage()
+ {}
+
+ const String& GetImageURL() const { return aImageURL; }
+ const String& GetTargetURL() const { return aTargetURL; }
+ const String& GetTargetFrame() const { return aTargetFrame; }
+ const String& GetAlternateText() const { return aAlternateText; }
+ const Size& GetSizePixel() const { return aSizePixel; }
+
+ // Im-/Export
+ sal_Bool Write( SvStream& rOStm, sal_uLong nFormat ) const;
+ sal_Bool Read( SvStream& rIStm, sal_uLong nFormat );
+};
+
+#endif // #ifndef _INETIMG_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/inettbc.hxx b/include/svtools/inettbc.hxx
new file mode 100644
index 000000000000..a8e85eaf7647
--- /dev/null
+++ b/include/svtools/inettbc.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVTOOLS_INETTBC_HXX
+#define _SVTOOLS_INETTBC_HXX
+
+#include "rtl/ref.hxx"
+#include "svtools/svtdllapi.h"
+#include <tools/string.hxx>
+#include <tools/urlobj.hxx>
+
+#include <vcl/combobox.hxx>
+
+class IUrlFilter;
+class SvtMatchContext_Impl;
+class SvtURLBox_Impl;
+class SVT_DLLPUBLIC SvtURLBox : public ComboBox
+{
+friend class SvtMatchContext_Impl;
+friend class SvtURLBox_Impl;
+ Link aOpenHdl;
+ String aBaseURL;
+ String aPlaceHolder;
+ rtl::Reference< SvtMatchContext_Impl > pCtx;
+ SvtURLBox_Impl* pImp;
+ INetProtocol eSmartProtocol;
+ sal_Bool bAutoCompleteMode : 1;
+ sal_Bool bOnlyDirectories : 1;
+ sal_Bool bCtrlClick : 1;
+ sal_Bool bHistoryDisabled : 1;
+ sal_Bool bNoSelection : 1;
+ sal_Bool bIsAutoCompleteEnabled : 1;
+
+ SVT_DLLPRIVATE sal_Bool ProcessKey( const KeyCode& rCode );
+ SVT_DLLPRIVATE void TryAutoComplete();
+ SVT_DLLPRIVATE void UpdatePicklistForSmartProtocol_Impl();
+ DECL_DLLPRIVATE_LINK( AutoCompleteHdl_Impl, void* );
+ SVT_DLLPRIVATE void Init(bool bSetDefaultHelpID);
+
+protected:
+ virtual long Notify( NotifyEvent& rNEvt );
+ virtual void Select();
+ virtual void Modify();
+ virtual long PreNotify( NotifyEvent& rNEvt );
+
+public:
+ SvtURLBox( Window* pParent, INetProtocol eSmart = INET_PROT_NOT_VALID, bool bSetDefaultHelpID = true );
+ SvtURLBox( Window* pParent, WinBits _nStyle, INetProtocol eSmart = INET_PROT_NOT_VALID, bool bSetDefaultHelpID = true );
+ SvtURLBox( Window* pParent, const ResId& _rResId, INetProtocol eSmart = INET_PROT_NOT_VALID, bool bSetDefaultHelpID = true );
+ ~SvtURLBox();
+
+ void SetBaseURL( const String& rURL );
+ const String& GetBaseURL() const { return aBaseURL; }
+ void SetOpenHdl( const Link& rLink ) { aOpenHdl = rLink; }
+ const Link& GetOpenHdl() const { return aOpenHdl; }
+ void SetOnlyDirectories( sal_Bool bDir = sal_True );
+ void SetNoURLSelection( sal_Bool bSet = sal_True );
+ INetProtocol GetSmartProtocol() const { return eSmartProtocol; }
+ void SetSmartProtocol( INetProtocol eProt );
+ sal_Bool IsCtrlOpen()
+ { return bCtrlClick; }
+ String GetURL();
+ void DisableHistory();
+
+ void UpdatePickList( );
+
+ static String ParseSmart( String aText, String aBaseURL, String aWorkDir );
+
+ void SetFilter(const String& _sFilter);
+ void SetUrlFilter( const IUrlFilter* _pFilter );
+
+ inline void EnableAutocompletion( sal_Bool _bEnable = sal_True )
+ { bIsAutoCompleteEnabled = _bEnable; }
+ void SetPlaceHolder( const String& sPlaceHolder ) { aPlaceHolder = sPlaceHolder; }
+ String GetPlaceHolder() { return aPlaceHolder; }
+ bool MatchesPlaceHolder( const String& sToMatch ) { return ( ( aPlaceHolder.Len() > 0 ) && ( aPlaceHolder == sToMatch ) ); }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/insdlg.hxx b/include/svtools/insdlg.hxx
new file mode 100644
index 000000000000..241f3cd128d2
--- /dev/null
+++ b/include/svtools/insdlg.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVTOOLS_INSDLG_HXX
+#define _SVTOOLS_INSDLG_HXX
+
+#include "svtools/svtdllapi.h"
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include <com/sun/star/embed/XStorage.hpp>
+#include <tools/globname.hxx>
+#include <sot/formats.hxx>
+
+#include <vector>
+#include <svtools/transfer.hxx>
+
+class SvObjectServer
+{
+private:
+ SvGlobalName aClassName;
+ String aHumanName;
+
+public:
+ SvObjectServer( const SvGlobalName & rClassP, const String & rHumanP ) :
+ aClassName( rClassP ),
+ aHumanName( rHumanP ) {}
+
+ const SvGlobalName & GetClassName() const { return aClassName; }
+ const String & GetHumanName() const { return aHumanName; }
+};
+
+typedef ::std::vector< SvObjectServer > SvObjectServerList_impl;
+
+class SVT_DLLPUBLIC SvObjectServerList
+{
+private:
+ SvObjectServerList_impl aObjectServerList;
+
+public:
+ const SvObjectServer * Get( const String & rHumanName ) const;
+ const SvObjectServer * Get( const SvGlobalName & ) const;
+ void Remove( const SvGlobalName & );
+ void FillInsertObjects();
+ size_t Count() const
+ {
+ return aObjectServerList.size();
+ }
+
+ const SvObjectServer operator[]( size_t n ) const
+ {
+ return aObjectServerList[ n ];
+ }
+};
+
+class SVT_DLLPUBLIC SvPasteObjectHelper
+{
+public:
+ static String GetSotFormatUIName( SotFormatStringId nId );
+ static sal_Bool GetEmbeddedName(const TransferableDataHelper& rData, String& _rName, String& _rSource, SotFormatStringId& _nFormat);
+};
+
+#endif // _SVTOOLS_INSDLG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/itemdel.hxx b/include/svtools/itemdel.hxx
new file mode 100644
index 000000000000..acb2637e04cb
--- /dev/null
+++ b/include/svtools/itemdel.hxx
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVTOOLS_ITEMDEL_HXX
+#define _SVTOOLS_ITEMDEL_HXX
+
+#include "svtools/svtdllapi.h"
+
+class SfxPoolItem;
+
+SVT_DLLPUBLIC SfxPoolItem* DeleteItemOnIdle( SfxPoolItem* pItem );
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/ivctrl.hxx b/include/svtools/ivctrl.hxx
new file mode 100644
index 000000000000..3c5aafc57848
--- /dev/null
+++ b/include/svtools/ivctrl.hxx
@@ -0,0 +1,353 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _ICNVW_HXX
+#define _ICNVW_HXX
+
+#include "svtools/svtdllapi.h"
+#include <tools/string.hxx>
+#include <vcl/ctrl.hxx>
+#include <tools/link.hxx>
+#include <tools/contnr.hxx>
+#include <vcl/image.hxx>
+#include <vcl/seleng.hxx>
+
+class ResId;
+class Point;
+class SvxIconChoiceCtrl_Impl;
+class Image;
+
+#define ICNVIEW_FLAG_POS_LOCKED 0x0001
+#define ICNVIEW_FLAG_SELECTED 0x0002
+#define ICNVIEW_FLAG_FOCUSED 0x0004
+#define ICNVIEW_FLAG_IN_USE 0x0008
+#define ICNVIEW_FLAG_CURSORED 0x0010 // Rahmen um Image
+#define ICNVIEW_FLAG_POS_MOVED 0x0020 // per D&D verschoben aber nicht gelockt
+#define ICNVIEW_FLAG_DROP_TARGET 0x0040 // im QueryDrop gesetzt
+#define ICNVIEW_FLAG_BLOCK_EMPHASIS 0x0080 // Emphasis nicht painten
+#define ICNVIEW_FLAG_USER1 0x0100
+#define ICNVIEW_FLAG_USER2 0x0200
+#define ICNVIEW_FLAG_PRED_SET 0x0400 // Predecessor wurde umgesetzt
+
+enum SvxIconChoiceCtrlTextMode
+{
+ IcnShowTextFull = 1, // BoundRect nach unten aufplustern
+ IcnShowTextShort, // Abkuerzung mit "..."
+ IcnShowTextSmart, // Text komplett anzeigen, wenn moeglich (n.i.)
+ IcnShowTextDontKnow // Einstellung der View
+};
+
+enum SvxIconChoiceCtrlPositionMode
+{
+ IcnViewPositionModeFree = 0, // freies pixelgenaues Positionieren
+ IcnViewPositionModeAutoArrange = 1, // automatisches Ausrichten
+ IcnViewPositionModeAutoAdjust = 2, // automatisches Anordnen
+ IcnViewPositionModeLast = IcnViewPositionModeAutoAdjust
+};
+
+class SvxIconChoiceCtrlEntry
+{
+ Image aImage;
+
+ OUString aText;
+ String aQuickHelpText;
+ void* pUserData;
+
+ friend class SvxIconChoiceCtrl_Impl;
+ friend class IcnCursor_Impl;
+ friend class EntryList_Impl;
+ friend class IcnGridMap_Impl;
+
+ Rectangle aRect; // Bounding-Rect des Entries
+ Rectangle aGridRect; // nur gesetzt im Grid-Modus
+ sal_uLong nPos;
+
+ // die Eintragsposition in der Eintragsliste entspricht der beim Insert vorgegebenen
+ // [Sortier-]Reihenfolge (->Reihenfolge der Anker in der Ankerliste!). Im AutoArrange-Modus
+ // kann die sichtbare Reihenfolge aber anders sein. Die Eintraege werden deshalb dann
+ // verkettet
+ SvxIconChoiceCtrlEntry* pblink; // backward (linker Nachbar)
+ SvxIconChoiceCtrlEntry* pflink; // forward (rechter Nachbar)
+
+ SvxIconChoiceCtrlTextMode eTextMode;
+ sal_uInt16 nX,nY; // fuer Tastatursteuerung
+ sal_uInt16 nFlags;
+
+ void ClearFlags( sal_uInt16 nMask ) { nFlags &= (~nMask); }
+ void SetFlags( sal_uInt16 nMask ) { nFlags |= nMask; }
+ void AssignFlags( sal_uInt16 _nFlags ) { nFlags = _nFlags; }
+
+ // setzt den linken Nachbarn (A <-> B ==> A <-> this <-> B)
+ void SetBacklink( SvxIconChoiceCtrlEntry* pA )
+ {
+ pA->pflink->pblink = this; // X <- B
+ this->pflink = pA->pflink; // X -> B
+ this->pblink = pA; // A <- X
+ pA->pflink = this; // A -> X
+ }
+ // loest eine Verbindung (A <-> this <-> B ==> A <-> B)
+ void Unlink()
+ {
+ this->pblink->pflink = this->pflink;
+ this->pflink->pblink = this->pblink;
+ this->pflink = 0;
+ this->pblink = 0;
+ }
+
+public:
+ SvxIconChoiceCtrlEntry( const String& rText, const Image& rImage, sal_uInt16 nFlags = 0 );
+ ~SvxIconChoiceCtrlEntry () {}
+
+ void SetImage ( const Image& rImage ) { aImage = rImage; }
+ Image GetImage () const { return aImage; }
+ void SetText ( const OUString& rText ) { aText = rText; }
+ OUString GetText () const { return aText; }
+ String SVT_DLLPUBLIC GetDisplayText() const;
+ void SetQuickHelpText( const String& rText ) { aQuickHelpText = rText; }
+ String GetQuickHelpText() const { return aQuickHelpText; }
+ void SetUserData ( void* _pUserData ) { pUserData = _pUserData; }
+ void* GetUserData () { return pUserData; }
+
+ const Rectangle & GetBoundRect() const { return aRect; }
+
+ void SetFocus ( sal_Bool bSet )
+ { nFlags = ( bSet ? nFlags | ICNVIEW_FLAG_FOCUSED : nFlags & ~ICNVIEW_FLAG_FOCUSED ); }
+
+ SvxIconChoiceCtrlTextMode GetTextMode() const { return eTextMode; }
+ sal_uInt16 GetFlags() const { return nFlags; }
+ sal_Bool IsSelected() const { return (sal_Bool)((nFlags & ICNVIEW_FLAG_SELECTED) !=0); }
+ sal_Bool IsFocused() const { return (sal_Bool)((nFlags & ICNVIEW_FLAG_FOCUSED) !=0); }
+ sal_Bool IsInUse() const { return (sal_Bool)((nFlags & ICNVIEW_FLAG_IN_USE) !=0); }
+ sal_Bool IsCursored() const { return (sal_Bool)((nFlags & ICNVIEW_FLAG_CURSORED) !=0); }
+ sal_Bool IsDropTarget() const { return (sal_Bool)((nFlags & ICNVIEW_FLAG_DROP_TARGET) !=0); }
+ sal_Bool IsBlockingEmphasis() const { return (sal_Bool)((nFlags & ICNVIEW_FLAG_BLOCK_EMPHASIS) !=0); }
+ sal_Bool IsPosLocked() const { return (sal_Bool)((nFlags & ICNVIEW_FLAG_POS_LOCKED) !=0); }
+
+ // Nur bei AutoArrange gesetzt. Den Kopf der Liste gibts per SvxIconChoiceCtrl::GetPredecessorHead
+ SvxIconChoiceCtrlEntry* GetSuccessor() const { return pflink; }
+ SvxIconChoiceCtrlEntry* GetPredecessor() const { return pblink; }
+
+// sal_Unicode GetMnemonicChar() const;
+};
+
+enum SvxIconChoiceCtrlColumnAlign
+{
+ IcnViewAlignLeft = 1,
+ IcnViewAlignRight,
+ IcnViewAlignCenter
+};
+
+class SvxIconChoiceCtrlColumnInfo
+{
+ OUString aColText;
+ Image aColImage;
+ long nWidth;
+ SvxIconChoiceCtrlColumnAlign eAlignment;
+ sal_uInt16 nSubItem;
+
+public:
+ SvxIconChoiceCtrlColumnInfo( sal_uInt16 nSub, long nWd,
+ SvxIconChoiceCtrlColumnAlign eAlign ) :
+ nWidth( nWd ), eAlignment( eAlign ), nSubItem( nSub ) {}
+ SvxIconChoiceCtrlColumnInfo( const SvxIconChoiceCtrlColumnInfo& );
+
+ void SetText( const OUString& rText ) { aColText = rText; }
+ void SetImage( const Image& rImg ) { aColImage = rImg; }
+ void SetWidth( long nWd ) { nWidth = nWd; }
+ void SetAlignment( SvxIconChoiceCtrlColumnAlign eAlign ) { eAlignment = eAlign; }
+ void SetSubItem( sal_uInt16 nSub) { nSubItem = nSub; }
+
+ const OUString& GetText() const { return aColText; }
+ const Image& GetImage() const { return aColImage; }
+ long GetWidth() const { return nWidth; }
+ SvxIconChoiceCtrlColumnAlign GetAlignment() const { return eAlignment; }
+ sal_uInt16 GetSubItem() const { return nSubItem; }
+};
+
+//###################################################################################################################################
+/*
+ Window-Bits:
+ WB_ICON // Text unter dem Icon
+ WB_SMALL_ICON // Text rechts neben Icon, beliebige Positionierung
+ WB_DETAILS // Text rechts neben Icon, eingeschraenkte Posit.
+ WB_BORDER
+ WB_NOHIDESELECTION // Selektion inaktiv zeichnen, wenn kein Fokus
+ WB_NOHSCROLL
+ WB_NOVSCROLL
+ WB_NOSELECTION
+ WB_SMART_ARRANGE // im Arrange die Vis-Area beibehalten
+ WB_ALIGN_TOP // Anordnung zeilenweise von links nach rechts
+ WB_ALIGN_LEFT // Anordnung spaltenweise von oben nach unten
+ WB_NODRAGSELECTION // Keine Selektion per Tracking-Rect
+ WB_NOCOLUMNHEADER // keine Headerbar in Detailsview (Headerbar not implemented)
+ WB_NOPOINTERFOCUS // Kein GrabFocus im MouseButtonDown
+ WB_HIGHLIGHTFRAME // der unter der Maus befindliche Eintrag wird hervorgehoben
+ WB_NOASYNCSELECTHDL // Selektionshandler synchron aufrufen, d.h. Events nicht sammeln
+*/
+
+#define WB_ICON WB_RECTSTYLE
+#define WB_SMALLICON WB_SMALLSTYLE
+#define WB_DETAILS WB_VCENTER
+#define WB_NOHSCROLL WB_SPIN
+#define WB_NOVSCROLL WB_DRAG
+#define WB_NOSELECTION WB_REPEAT
+#define WB_NODRAGSELECTION WB_PATHELLIPSIS
+#define WB_SMART_ARRANGE WB_PASSWORD
+#define WB_ALIGN_TOP WB_TOP
+#define WB_ALIGN_LEFT WB_LEFT
+#define WB_NOCOLUMNHEADER WB_CENTER
+#define WB_HIGHLIGHTFRAME WB_INFO
+#define WB_NOASYNCSELECTHDL WB_NOLABEL
+
+class MnemonicGenerator;
+
+class SVT_DLLPUBLIC SvtIconChoiceCtrl : public Control
+{
+ friend class SvxIconChoiceCtrl_Impl;
+
+ Link _aClickIconHdl;
+ Link _aDocRectChangedHdl;
+ Link _aVisRectChangedHdl;
+ KeyEvent* _pCurKeyEvent;
+ SvxIconChoiceCtrl_Impl* _pImp;
+ sal_Bool _bAutoFontColor;
+
+protected:
+
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual sal_Bool EditedEntry( SvxIconChoiceCtrlEntry*, const OUString& rNewText, sal_Bool bCancelled );
+ virtual void DocumentRectChanged();
+ virtual void VisibleRectChanged();
+ virtual sal_Bool EditingEntry( SvxIconChoiceCtrlEntry* pEntry );
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual void Paint( const Rectangle& rRect );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void Resize();
+ virtual void GetFocus();
+ virtual void LoseFocus();
+ virtual void ClickIcon();
+ virtual void StateChanged( StateChangedType nType );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+ virtual void DrawEntryImage(
+ SvxIconChoiceCtrlEntry* pEntry,
+ const Point& rPos,
+ OutputDevice& rDev );
+
+ virtual String GetEntryText(
+ SvxIconChoiceCtrlEntry* pEntry,
+ sal_Bool bInplaceEdit );
+
+ virtual void FillLayoutData() const;
+
+ void CallImplEventListeners(sal_uLong nEvent, void* pData);
+
+public:
+
+ SvtIconChoiceCtrl( Window* pParent, WinBits nWinStyle = WB_ICON | WB_BORDER );
+ virtual ~SvtIconChoiceCtrl();
+
+ void SetStyle( WinBits nWinStyle );
+ WinBits GetStyle() const;
+
+ sal_Bool SetChoiceWithCursor ( sal_Bool bDo = sal_True );
+
+ void SetFont( const Font& rFont );
+ void SetPointFont( const Font& rFont );
+
+ void SetClickHdl( const Link& rLink ) { _aClickIconHdl = rLink; }
+ const Link& GetClickHdl() const { return _aClickIconHdl; }
+
+ using OutputDevice::SetBackground;
+ void SetBackground( const Wallpaper& rWallpaper );
+
+ void ArrangeIcons();
+
+
+ SvxIconChoiceCtrlEntry* InsertEntry( const String& rText,
+ const Image& rImage,
+ sal_uLong nPos = LIST_APPEND,
+ const Point* pPos = 0,
+ sal_uInt16 nFlags = 0
+ );
+
+ /** creates automatic mnemonics for all icon texts in the control
+ */
+ void CreateAutoMnemonics( void );
+
+ /** creates automatic mnemonics for all icon texts in the control
+
+ @param _rUsedMnemonics
+ a <type>MnemonicGenerator</type> at which some other mnemonics are already registered.
+ This can be used if the control needs to share the "mnemonic space" with other elements,
+ such as a menu bar.
+ */
+ void CreateAutoMnemonics( MnemonicGenerator& _rUsedMnemonics );
+
+ sal_Bool DoKeyInput( const KeyEvent& rKEvt );
+
+ sal_Bool IsEntryEditing() const;
+
+ sal_uLong GetEntryCount() const;
+ SvxIconChoiceCtrlEntry* GetEntry( sal_uLong nPos ) const;
+ sal_uLong GetEntryListPos( SvxIconChoiceCtrlEntry* pEntry ) const;
+ using Window::SetCursor;
+ void SetCursor( SvxIconChoiceCtrlEntry* pEntry );
+ SvxIconChoiceCtrlEntry* GetCursor() const;
+
+ // Neu-Berechnung gecachter View-Daten und Invalidierung im Fenster
+ void InvalidateEntry( SvxIconChoiceCtrlEntry* pEntry );
+
+ // bHit==sal_False: Eintrag gilt als getroffen, wenn Position im BoundRect liegt
+ // ==sal_True : Bitmap oder Text muss getroffen sein
+ SvxIconChoiceCtrlEntry* GetEntry( const Point& rPosPixel, sal_Bool bHit = sal_False ) const;
+
+ // in dem sal_uLong wird die Position in der Liste des gefunden Eintrags zurueckgegeben
+ SvxIconChoiceCtrlEntry* GetSelectedEntry( sal_uLong& rPos ) const;
+
+ void SetEntryTextMode( SvxIconChoiceCtrlTextMode eMode, SvxIconChoiceCtrlEntry* pEntry = 0 );
+
+ virtual sal_Bool HasBackground() const;
+ virtual sal_Bool HasFont() const;
+ virtual sal_Bool HasFontTextColor() const;
+ virtual sal_Bool HasFontFillColor() const;
+
+ void SetFontColorToBackground ( sal_Bool bDo = sal_True ) { _bAutoFontColor = bDo; }
+ sal_Bool AutoFontColor () { return _bAutoFontColor; }
+
+ Point GetPixelPos( const Point& rPosLogic ) const;
+ void SetSelectionMode( SelectionMode eMode );
+
+ Rectangle GetBoundingBox( SvxIconChoiceCtrlEntry* pEntry ) const;
+ Rectangle GetEntryCharacterBounds( const sal_Int32 _nEntryPos, const sal_Int32 _nCharacterIndex ) const;
+
+ void SetNoSelection();
+
+ // ACCESSIBILITY ==========================================================
+
+ /** Creates and returns the accessible object of the Box. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > CreateAccessible();
+};
+
+#endif // _ICNVW_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/javacontext.hxx b/include/svtools/javacontext.hxx
new file mode 100644
index 000000000000..2c81cbf43d42
--- /dev/null
+++ b/include/svtools/javacontext.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVTOOLS_JAVACONTEXT_HXX_
+#define _SVTOOLS_JAVACONTEXT_HXX_
+
+#include "svtools/svtdllapi.h"
+#include <osl/mutex.hxx>
+
+#include <com/sun/star/task/XInteractionHandler.hpp>
+#include <com/sun/star/task/XInteractionRequest.hpp>
+#include <com/sun/star/uno/XCurrentContext.hpp>
+
+
+namespace svt
+{
+// We cannot derive from cppu::WeakImplHelper because we would export the inline
+//generated class. This conflicts with other libraries if they use the same inline
+//class.
+ class SVT_DLLPUBLIC JavaContext :
+ public com::sun::star::uno::XCurrentContext
+ {
+
+ public:
+ /** The parameter bShowErrorsOnce controls whether a message box is
+ only displayed once for a reocurring Java error. That is only
+ the first time JavaInteractionHandler.handle is called with a
+ particular Request then the message box is shown. Afterwards
+ nothing happens.
+ */
+ JavaContext( const com::sun::star::uno::Reference<
+ com::sun::star::uno::XCurrentContext> & ctx,
+ bool bReportErrorOnce = true );
+ virtual ~JavaContext();
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type& aType )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL acquire() throw ();
+
+ virtual void SAL_CALL release() throw ();
+
+ // XCurrentContext
+ virtual com::sun::star::uno::Any SAL_CALL getValueByName( const OUString& Name )
+ throw (com::sun::star::uno::RuntimeException);
+
+ private:
+ SVT_DLLPRIVATE JavaContext(); //not implemented
+ SVT_DLLPRIVATE JavaContext(JavaContext&); //not implemented
+ SVT_DLLPRIVATE JavaContext& operator = (JavaContext&); //not implemented
+
+ oslInterlockedCount m_aRefCount;
+
+ com::sun::star::uno::Reference<
+ com::sun::star::uno::XCurrentContext > m_xNextContext;
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionHandler> m_xHandler;
+ bool m_bShowErrorsOnce;
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/javainteractionhandler.hxx b/include/svtools/javainteractionhandler.hxx
new file mode 100644
index 000000000000..fed409f41ec5
--- /dev/null
+++ b/include/svtools/javainteractionhandler.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVTOOLS_JAVAINTERACTION_HXX_
+#define _SVTOOLS_JAVAINTERACTION_HXX_
+
+#include "svtools/svtdllapi.h"
+#include <osl/mutex.hxx>
+#include <sal/types.h>
+
+#include <com/sun/star/task/XInteractionRequest.hpp>
+#include <svtools/javacontext.hxx>
+
+#define JAVA_INTERACTION_HANDLER_NAME "java-vm.interaction-handler"
+
+namespace svt
+{
+// We cannot derive from cppu::WeakImplHelper because we would export the inline
+//generated class. This conflicts with other libraries if they use the same inline
+//class.
+
+class SVT_DLLPUBLIC JavaInteractionHandler:
+ public com::sun::star::task::XInteractionHandler
+{
+public:
+ JavaInteractionHandler(bool bReportErrorOnce = true);
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type& aType )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL acquire() throw();
+
+ virtual void SAL_CALL release() throw();
+
+ // XCurrentContext
+ virtual void SAL_CALL handle( const com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionRequest >& Request )
+ throw (com::sun::star::uno::RuntimeException);
+
+private:
+ oslInterlockedCount m_aRefCount;
+ SVT_DLLPRIVATE JavaInteractionHandler(JavaInteractionHandler const&); //not implemented
+ SVT_DLLPRIVATE JavaInteractionHandler& operator = (JavaInteractionHandler const &); //not implemented
+ SVT_DLLPRIVATE virtual ~JavaInteractionHandler();
+ bool m_bShowErrorsOnce;
+ bool m_bJavaDisabled_Handled;
+ bool m_bInvalidSettings_Handled;
+ bool m_bJavaNotFound_Handled;
+ bool m_bVMCreationFailure_Handled;
+ bool m_bRestartRequired_Handled;
+ sal_uInt16 m_nResult_JavaDisabled;
+};
+}
+
+#endif // _DESKTOP_JAVAINTERACTION_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/langhelp.hxx b/include/svtools/langhelp.hxx
new file mode 100644
index 000000000000..1231e6b0e380
--- /dev/null
+++ b/include/svtools/langhelp.hxx
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ */
+
+#ifndef _SVTOOLS_LANGHELP_HXX_
+#define _SVTOOLS_LANGHELP_HXX_
+
+#include <svtools/svtdllapi.h>
+
+#include <rtl/ustring.hxx>
+
+/** Localize a URI to one of the foundation's webservices
+
+ @param io_rURI
+ URI to localize - depending on your UI locale, a country local
+ part is appended to the URI (like "en", or "fr", or "es")
+ */
+SVT_DLLPUBLIC void localizeWebserviceURI( OUString& io_rURI );
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/langtab.hxx b/include/svtools/langtab.hxx
new file mode 100644
index 000000000000..1ef5875d2948
--- /dev/null
+++ b/include/svtools/langtab.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVTOOLS_LANGTAB_HXX_
+#define _SVTOOLS_LANGTAB_HXX_
+
+
+#include <tools/resary.hxx>
+#include <i18nlangtag/lang.h>
+#include <svtools/svtdllapi.h>
+
+//========================================================================
+// class SvtLanguageTable
+//========================================================================
+
+class SVT_DLLPUBLIC SvtLanguageTable : public ResStringArray
+{
+public:
+ SvtLanguageTable();
+ ~SvtLanguageTable();
+
+ /**
+ @param bUserInterfaceSelection
+ If TRUE, don't replace an UI-only locale. Only use for
+ Tools->Options->LanguageSettings->UserInterface listbox.
+ If FALSE, do replace.
+ */
+ const OUString GetString( const LanguageType eType, bool bUserInterfaceSelection = false ) const;
+ LanguageType GetType( const String& rStr ) const;
+
+ sal_uInt32 GetEntryCount() const;
+ LanguageType GetTypeAtIndex( sal_uInt32 nIndex ) const;
+ static String GetLanguageString( const LanguageType eType );
+};
+
+// Add LRE or RLE embedding characters to the string based on the
+// String content (see #i78466#, #i32179#)
+SVT_DLLPUBLIC const String ApplyLreOrRleEmbedding( const String &rText );
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/localresaccess.hxx b/include/svtools/localresaccess.hxx
new file mode 100644
index 000000000000..8e80f9462cf2
--- /dev/null
+++ b/include/svtools/localresaccess.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVTOOLS_LOCALRESACCESS_HXX_
+#define _SVTOOLS_LOCALRESACCESS_HXX_
+
+#include <tools/rc.hxx>
+#include <tools/rcid.h>
+#include <osl/diagnose.h>
+
+//.........................................................................
+namespace svt
+{
+//.........................................................................
+
+ //=========================================================================
+ //= OLocalResourceAccess
+ //=========================================================================
+ /** helper class for acessing local resources
+ */
+ class OLocalResourceAccess : public Resource
+ {
+ protected:
+ ResMgr* m_pManager;
+
+ public:
+ OLocalResourceAccess( const ResId& _rId )
+ :Resource( _rId.SetAutoRelease( sal_False ) )
+ ,m_pManager( _rId.GetResMgr() )
+ {
+ }
+
+ OLocalResourceAccess(const ResId& _rId, RESOURCE_TYPE _rType)
+ :Resource(_rId.SetRT(_rType).SetAutoRelease(sal_False))
+ ,m_pManager(_rId.GetResMgr())
+ {
+ OSL_ENSURE( m_pManager != NULL, "OLocalResourceAccess::OLocalResourceAccess: invalid resource manager!" );
+ }
+
+ ~OLocalResourceAccess()
+ {
+ if ( m_pManager )
+ m_pManager->Increment( m_pManager->GetRemainSize() );
+ FreeResource();
+ }
+
+ inline sal_Bool IsAvailableRes( const ResId& _rId ) const
+ {
+ return Resource::IsAvailableRes( _rId );
+ }
+ };
+
+//.........................................................................
+} // namespace svt
+//.........................................................................
+
+#endif // _SVTOOLS_LOCALRESACCESS_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/menuoptions.hxx b/include/svtools/menuoptions.hxx
new file mode 100644
index 000000000000..527319c52380
--- /dev/null
+++ b/include/svtools/menuoptions.hxx
@@ -0,0 +1,128 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVTOOLS_MENUOPTIONS_HXX
+#define INCLUDED_SVTOOLS_MENUOPTIONS_HXX
+
+#include "svtools/svtdllapi.h"
+#include <sal/types.h>
+#include <osl/mutex.hxx>
+#include <unotools/options.hxx>
+
+/*-************************************************************************************************************//**
+ @short forward declaration to our private date container implementation
+ @descr We use these class as internal member to support small memory requirements.
+ You can create the container if it is neccessary. The class which use these mechanism
+ is faster and smaller then a complete implementation!
+*//*-*************************************************************************************************************/
+
+class Link;
+class SvtMenuOptions_Impl;
+
+/*-************************************************************************************************************//**
+ @short collect information about menu features
+ @descr -
+
+ @implements -
+ @base -
+
+ @devstatus ready to use
+*//*-*************************************************************************************************************/
+
+class SVT_DLLPUBLIC SAL_WARN_UNUSED SvtMenuOptions: public utl::detail::Options
+{
+ public:
+
+ /*-****************************************************************************************************//**
+ @short standard constructor and destructor
+ @descr This will initialize an instance with default values.
+ We implement these class with a refcount mechanism! Every instance of this class increase it
+ at create and decrease it at delete time - but all instances use the same data container!
+ He is implemented as a static member ...
+
+ @seealso member m_nRefCount
+ @seealso member m_pDataContainer
+
+ @param -
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ SvtMenuOptions();
+ virtual ~SvtMenuOptions();
+
+ void AddListenerLink( const Link& rLink );
+ void RemoveListenerLink( const Link& rLink );
+
+ /*-****************************************************************************************************//**
+ @short interface methods to get and set value of config key "org.openoffice.Office.Common/View/Menu/..."
+ @descr These options describe internal states to enable/disable features of installed office.
+
+ IsEntryHidingEnabled()
+ SetEntryHidingState() => Activate this field for viewing all deactivated menu entries.
+ Menu commands that are normally not necessary are hidden by default.
+ Default=false
+
+ IsFollowMouseEnabled()
+ SetFollowMouseState() => Automatic selection while moving the mouse on a menu.
+ Default=true
+
+ @seealso configuration package "org.openoffice.Office.Common/View/Menu"
+ *//*-*****************************************************************************************************/
+
+ sal_Bool IsEntryHidingEnabled() const;
+ sal_Int16 GetMenuIconsState() const;
+ void SetMenuIconsState( sal_Int16 bState );
+
+ private:
+
+ /*-****************************************************************************************************//**
+ @short return a reference to a static mutex
+ @descr These class is partially threadsafe (for de-/initialization only).
+ All access methods are'nt safe!
+ We create a static mutex only for one ime and use at different times.
+
+ @seealso -
+
+ @param -
+ @return A reference to a static mutex member.
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ SVT_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex();
+
+ private:
+
+ /*Attention
+
+ Don't initialize these static member in these header!
+ a) Double dfined symbols will be detected ...
+ b) and unresolved externals exist at linking time.
+ Do it in your source only.
+ */
+
+ static SvtMenuOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements!
+ static sal_Int32 m_nRefCount ; /// internal ref count mechanism
+
+}; // class SvtMenuOptions
+
+#endif // #ifndef INCLUDED_SVTOOLS_MENUOPTIONS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/miscopt.hxx b/include/svtools/miscopt.hxx
new file mode 100644
index 000000000000..85c5b604e689
--- /dev/null
+++ b/include/svtools/miscopt.hxx
@@ -0,0 +1,150 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVTOOLS_MISCOPT_HXX
+#define INCLUDED_SVTOOLS_MISCOPT_HXX
+
+#include "svtools/svtdllapi.h"
+#include <sal/types.h>
+#include <osl/mutex.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <rtl/ustring.hxx>
+#include <unotools/options.hxx>
+
+/*-************************************************************************************************************//**
+ @short forward declaration to our private date container implementation
+ @descr We use these class as internal member to support small memory requirements.
+ You can create the container if it is neccessary. The class which use these mechanism
+ is faster and smaller then a complete implementation!
+*//*-*************************************************************************************************************/
+
+class SvtMiscOptions_Impl;
+class Link;
+
+/*-************************************************************************************************************//**
+ @short collect information about misc group
+ @descr -
+
+ @implements -
+ @base -
+
+ @ATTENTION This class is partially threadsafe.
+
+ @devstatus ready to use
+*//*-*************************************************************************************************************/
+
+class SVT_DLLPUBLIC SvtMiscOptions: public utl::detail::Options
+{
+ public:
+ /*-****************************************************************************************************//**
+ @short standard constructor and destructor
+ @descr This will initialize an instance with default values.
+ We implement these class with a refcount mechanism! Every instance of this class increase it
+ at create and decrease it at delete time - but all instances use the same data container!
+ He is implemented as a static member ...
+
+ @seealso member m_nRefCount
+ @seealso member m_pDataContainer
+
+ @param -
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ SvtMiscOptions();
+ virtual ~SvtMiscOptions();
+
+ void AddListenerLink( const Link& rLink );
+ void RemoveListenerLink( const Link& rLink );
+
+ sal_Bool UseSystemFileDialog() const;
+ void SetUseSystemFileDialog( sal_Bool bSet );
+ sal_Bool IsUseSystemFileDialogReadOnly() const;
+
+ sal_Bool DisableUICustomization() const;
+
+ sal_Bool IsPluginsEnabled() const;
+
+ sal_Int16 GetSymbolsSize() const;
+ void SetSymbolsSize( sal_Int16 eSet );
+ sal_Int16 GetCurrentSymbolsSize() const;
+ bool AreCurrentSymbolsLarge() const;
+
+ sal_Int16 GetSymbolsStyle() const;
+ void SetSymbolsStyle( sal_Int16 eSet );
+ sal_Int16 GetCurrentSymbolsStyle() const;
+
+ sal_Int16 GetToolboxStyle() const;
+ void SetToolboxStyle( sal_Int16 nStyle );
+
+ sal_Bool IsModifyByPrinting() const;
+ void SetModifyByPrinting(sal_Bool bSet );
+
+ sal_Bool UseSystemPrintDialog() const;
+ void SetUseSystemPrintDialog( sal_Bool bSet );
+
+ sal_Bool ShowLinkWarningDialog() const;
+ void SetShowLinkWarningDialog( sal_Bool bSet );
+ sal_Bool IsShowLinkWarningDialogReadOnly() const;
+
+ void SetSaveAlwaysAllowed( sal_Bool bSet );
+ sal_Bool IsSaveAlwaysAllowed() const;
+
+ void SetExperimentalMode( sal_Bool bSet );
+ sal_Bool IsExperimentalMode() const;
+
+ void SetMacroRecorderMode( sal_Bool bSet );
+ sal_Bool IsMacroRecorderMode() const;
+
+ private:
+
+ /*-****************************************************************************************************//**
+ @short return a reference to a static mutex
+ @descr These class is partially threadsafe (for de-/initialization only).
+ All access methods are'nt safe!
+ We create a static mutex only for one ime and use at different times.
+
+ @seealso -
+
+ @param -
+ @return A reference to a static mutex member.
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ SVT_DLLPRIVATE static ::osl::Mutex& GetInitMutex();
+
+ private:
+
+ /*Attention
+
+ Don't initialize these static member in these header!
+ a) Double dfined symbols will be detected ...
+ b) and unresolved externals exist at linking time.
+ Do it in your source only.
+ */
+
+ static SvtMiscOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements!
+ static sal_Int32 m_nRefCount ; /// internal ref count mechanism
+
+}; // class SvtMiscOptions
+
+#endif // #ifndef INCLUDED_SVTOOLS_MISCOPT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/optionsdrawinglayer.hxx b/include/svtools/optionsdrawinglayer.hxx
new file mode 100644
index 000000000000..f2d493be21de
--- /dev/null
+++ b/include/svtools/optionsdrawinglayer.hxx
@@ -0,0 +1,198 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVTOOLS_OPTIONSDRAWINGLAYER_HXX
+#define INCLUDED_SVTOOLS_OPTIONSDRAWINGLAYER_HXX
+
+#include "svtools/svtdllapi.h"
+#include <sal/types.h>
+#include <osl/mutex.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/color.hxx>
+
+//_________________________________________________________________________________________________________________
+// forward declarations
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @short forward declaration to our private date container implementation
+ @descr We use these class as internal member to support small memory requirements.
+ You can create the container if it is neccessary. The class which use these mechanism
+ is faster and smaller then a complete implementation!
+*//*-*************************************************************************************************************/
+
+class SvtOptionsDrawinglayer_Impl;
+
+/*-************************************************************************************************************//**
+ @short collect information about startup features
+ @descr -
+
+ @implements -
+ @base -
+
+ @devstatus ready to use
+*//*-*************************************************************************************************************/
+
+class SVT_DLLPUBLIC SvtOptionsDrawinglayer
+{
+ //-------------------------------------------------------------------------------------------------------------
+ // public methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ public:
+
+ //---------------------------------------------------------------------------------------------------------
+ // constructor / destructor
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short standard constructor and destructor
+ @descr This will initialize an instance with default values.
+ We implement these class with a refcount mechanism! Every instance of this class increase it
+ at create and decrease it at delete time - but all instances use the same data container!
+ He is implemented as a static member ...
+
+ @seealso member m_nRefCount
+ @seealso member m_pDataContainer
+
+ @param -
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ SvtOptionsDrawinglayer();
+ ~SvtOptionsDrawinglayer();
+
+ //---------------------------------------------------------------------------------------------------------
+ // interface
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short interface methods to get and set value of config key "org.openoffice.Office.Common/Drawinglayer/..."
+ @descr These options describe internal states to enable/disable features of installed office.
+
+ IsOverlayBuffer()
+ SetOverlayBuffer() => Activate this field for letting Overlay use a buffer
+
+ IsPaintBuffer()
+ SetPaintBuffer() => Activate this field for letting Paint use a prerender buffer
+
+ GetStripeColorA()
+ SetStripeColorA() => Set first of two colors which overlay uses to draw stripes
+
+ GetStripeColorB()
+ SetStripeColorB() => Set second of two colors which overlay uses to draw stripes
+
+ GetStripeLength()
+ SetStripeLength() => Set length of a single stripe in pixels
+
+ @seealso configuration package "org.openoffice.Office.Common/Drawinglayer"
+ *//*-*****************************************************************************************************/
+
+ sal_Bool IsOverlayBuffer() const;
+ sal_Bool IsPaintBuffer() const;
+ Color GetStripeColorA() const;
+ Color GetStripeColorB() const;
+ sal_uInt16 GetStripeLength() const;
+
+ // #i73602#
+ sal_Bool IsOverlayBuffer_Calc() const;
+ sal_Bool IsOverlayBuffer_Writer() const;
+ sal_Bool IsOverlayBuffer_DrawImpress() const;
+
+ // #i74769#, #i75172#
+ sal_Bool IsPaintBuffer_Calc() const;
+ sal_Bool IsPaintBuffer_Writer() const;
+ sal_Bool IsPaintBuffer_DrawImpress() const;
+
+ // #i4219#
+ sal_uInt32 GetMaximumPaperWidth() const;
+ sal_uInt32 GetMaximumPaperHeight() const;
+ sal_uInt32 GetMaximumPaperLeftMargin() const;
+ sal_uInt32 GetMaximumPaperRightMargin() const;
+ sal_uInt32 GetMaximumPaperTopMargin() const;
+ sal_uInt32 GetMaximumPaperBottomMargin() const;
+
+ // #i95644# helper to check if AA is allowed on this system. Currently, for WIN its disabled
+ // and OutDevSupport_TransparentRect is checked (this hits XRenderExtension, e.g.
+ // currently for SunRay as long as not supported there)
+ sal_Bool IsAAPossibleOnThisSystem() const;
+
+ // primitives
+ sal_Bool IsAntiAliasing() const;
+ sal_Bool IsSnapHorVerLinesToDiscrete() const;
+ sal_Bool IsSolidDragCreate() const;
+ sal_Bool IsRenderDecoratedTextDirect() const;
+ sal_Bool IsRenderSimpleTextDirect() const;
+ sal_uInt32 GetQuadratic3DRenderLimit() const;
+ sal_uInt32 GetQuadraticFormControlRenderLimit() const;
+
+ void SetAntiAliasing( sal_Bool bState );
+
+ // #i97672# selection settings
+ sal_Bool IsTransparentSelection() const;
+ sal_uInt16 GetTransparentSelectionPercent() const;
+ sal_uInt16 GetSelectionMaximumLuminancePercent() const;
+
+ void SetTransparentSelection( sal_Bool bState );
+ void SetTransparentSelectionPercent( sal_uInt16 nPercent );
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ private:
+
+ /*-****************************************************************************************************//**
+ @short return a reference to a static mutex
+ @descr These class use his own static mutex to be threadsafe.
+ We create a static mutex only for one ime and use at different times.
+
+ @seealso -
+
+ @param -
+ @return A reference to a static mutex member.
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+ SVT_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex();
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private member
+ //-------------------------------------------------------------------------------------------------------------
+
+ private:
+
+ /*Attention
+
+ Don't initialize these static member in these header!
+ a) Double dfined symbols will be detected ...
+ b) and unresolved externals exist at linking time.
+ Do it in your source only.
+ */
+
+ static SvtOptionsDrawinglayer_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements!
+ static sal_Int32 m_nRefCount ; /// internal ref count mechanism
+
+}; // class SvtOptionsDrawinglayer
+
+#endif // #ifndef INCLUDED_SVTOOLS_OPTIONSDRAWINGLAYER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/parhtml.hxx b/include/svtools/parhtml.hxx
new file mode 100644
index 000000000000..9011dad9a266
--- /dev/null
+++ b/include/svtools/parhtml.hxx
@@ -0,0 +1,289 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _PARHTML_HXX
+#define _PARHTML_HXX
+
+#include "svtools/svtdllapi.h"
+#include <tools/solar.h>
+#include <tools/string.hxx>
+#include <svtools/svparser.hxx>
+
+#include <boost/ptr_container/ptr_vector.hpp>
+
+namespace com { namespace sun { namespace star {
+ namespace document {
+ class XDocumentProperties;
+ }
+} } }
+
+class Color;
+class SvNumberFormatter;
+class SvKeyValueIterator;
+
+#define HTMLFONTSZ1_DFLT 7
+#define HTMLFONTSZ2_DFLT 10
+#define HTMLFONTSZ3_DFLT 12
+#define HTMLFONTSZ4_DFLT 14
+#define HTMLFONTSZ5_DFLT 18
+#define HTMLFONTSZ6_DFLT 24
+#define HTMLFONTSZ7_DFLT 36
+
+enum HTMLTableFrame { HTML_TF_VOID, HTML_TF_ABOVE, HTML_TF_BELOW,
+ HTML_TF_HSIDES, HTML_TF_LHS, HTML_TF_RHS, HTML_TF_VSIDES, HTML_TF_BOX };
+
+enum HTMLTableRules { HTML_TR_NONE, HTML_TR_GROUPS, HTML_TR_ROWS,
+ HTML_TR_COLS, HTML_TR_ALL };
+
+enum HTMLInputType
+{
+ HTML_IT_TEXT = 0x01,
+ HTML_IT_PASSWORD = 0x02,
+ HTML_IT_CHECKBOX = 0x03,
+ HTML_IT_RADIO = 0x04,
+ HTML_IT_RANGE = 0x05,
+ HTML_IT_SCRIBBLE = 0x06,
+ HTML_IT_FILE = 0x07,
+ HTML_IT_HIDDEN = 0x08,
+ HTML_IT_SUBMIT = 0x09,
+ HTML_IT_IMAGE = 0x0a,
+ HTML_IT_RESET = 0x0b,
+ HTML_IT_BUTTON = 0x0c
+};
+
+enum HTMLScriptLanguage
+{
+ HTML_SL_STARBASIC,
+ HTML_SL_JAVASCRIPT,
+ HTML_SL_UNKNOWN
+};
+
+struct HTMLOptionEnum
+{
+ const sal_Char *pName; // Wert einer HTML-Option
+ sal_uInt16 nValue; // und der dazugehoerige Wert eines Enums
+};
+
+// Repraesentation einer HTML-Option (=Atrribut in einem Start-Tag)
+// Die Werte der Optionen werden immer als String gespeichert.
+// Die Methoden GetNumber, ... duerfen nur aufgerufen werden, wenn
+// die Option auch numerisch, ... ist.
+
+class SVT_DLLPUBLIC HTMLOption
+{
+ String aValue; // der Wert der Option (immer als String)
+ String aToken; // der Name der Option als String
+ sal_uInt16 nToken; // und das entsprechende Token
+
+public:
+
+ HTMLOption( sal_uInt16 nTyp, const String& rToken, const String& rValue );
+
+ // der Name der Option ...
+ sal_uInt16 GetToken() const { return nToken; } // ... als Enum
+ const String& GetTokenString() const { return aToken; } // ... als String
+
+ // der Wert der Option ...
+ const String& GetString() const { return aValue; } // ... als String
+
+ sal_uInt32 GetNumber() const; // ... als Zahl
+ sal_Int32 GetSNumber() const; // ... als Zahl
+ void GetNumbers( std::vector<sal_uInt32> &rNumbers, // ... als Zahlen
+ bool bSpaceDelim=false ) const;
+ void GetColor( Color& ) const; // ... als Farbe
+
+ // ... als Enum pOptEnums ist ein HTMLOptionEnum-Array
+ sal_uInt16 GetEnum( const HTMLOptionEnum *pOptEnums,
+ sal_uInt16 nDflt=0 ) const;
+ bool GetEnum( sal_uInt16 &rEnum, const HTMLOptionEnum *pOptEnums ) const;
+
+ // ... und als ein par spezielle Enums
+ HTMLInputType GetInputType() const; // <INPUT TYPE=...>
+ HTMLTableFrame GetTableFrame() const; // <TABLE FRAME=...>
+ HTMLTableRules GetTableRules() const; // <TABLE RULES=...>
+ //SvxAdjust GetAdjust() const; // <P,TH,TD ALIGN=>
+};
+
+typedef ::boost::ptr_vector<HTMLOption> HTMLOptions;
+
+class SVT_DLLPUBLIC HTMLParser : public SvParser
+{
+private:
+ mutable HTMLOptions maOptions; // die Optionen des Start-Tags
+
+ bool bNewDoc : 1; // neues Doc lesen ?
+ bool bIsInHeader : 1; // scanne Header-Bereich
+ bool bIsInBody : 1; // scanne Body-Bereich
+ bool bReadListing : 1; // Lese Listings
+ bool bReadXMP : 1; // Lese XMP
+ bool bReadPRE : 1; // Lese preformatted Text
+ bool bReadTextArea : 1; // Lese TEXTAREA
+ bool bReadScript : 1; // Lesen von <SCRIPT>
+ bool bReadStyle : 1; // Lesen von <STYLE>
+ bool bEndTokenFound : 1; // </SCRIPT> oder </STYLE> gefunden
+
+ bool bPre_IgnoreNewPara : 1; // Flags fuers lesen von PRE-Absaetzen
+ bool bReadNextChar : 1; // true: NextChar nochmals lesen (JavaScript!)
+ bool bReadComment : 1; // true: NextChar nochmals lesen (JavaScript!)
+
+ sal_uInt32 nPre_LinePos; // Pos in der Line im PRE-Tag
+
+ String aEndToken;
+
+protected:
+ String sSaveToken; // das gelesene Tag als String
+
+ int ScanText( const sal_Unicode cBreak = 0U );
+
+ int _GetNextRawToken();
+
+ // scanne das naechste Token,
+ virtual int _GetNextToken();
+
+ virtual ~HTMLParser();
+
+ void FinishHeader( bool bBody ) { bIsInHeader = false; bIsInBody = bBody; }
+
+public:
+ HTMLParser( SvStream& rIn, bool bReadNewDoc = true );
+
+ virtual SvParserState CallParser(); // Aufruf des Parsers
+
+ bool IsNewDoc() const { return bNewDoc; }
+ bool IsInHeader() const { return bIsInHeader; }
+ bool IsInBody() const { return bIsInBody; }
+ bool IsValidSyntax() const { return true; }
+ bool IsReadListing() const { return bReadListing; }
+ bool IsReadXMP() const { return bReadXMP; }
+ bool IsReadPRE() const { return bReadPRE; }
+ bool IsReadScript() const { return bReadScript; }
+ bool IsReadStyle() const { return bReadStyle; }
+
+ void SetReadNextChar() { bReadNextChar = true; }
+
+ // PRE-/LISTING oder XMP-Modus starten/beenden oder Tags entsprechend
+ // filtern
+ inline void StartPRE( bool bRestart=false );
+ void FinishPRE() { bReadPRE = false; }
+ int FilterPRE( int nToken );
+
+ inline void StartListing( bool bRestart=false );
+ void FinishListing() { bReadListing = false; }
+ int FilterListing( int nToken );
+
+ inline void StartXMP( bool bRestart=false );
+ void FinishXMP() { bReadXMP = false; }
+ int FilterXMP( int nToken );
+
+ void FinishTextArea() { bReadTextArea = false; }
+
+ // PRE-/LSITING- und XMP-Modus beenden
+ void FinishPREListingXMP() { bReadPRE = bReadListing = bReadXMP = false; }
+
+ // Das aktuelle Token dem aktuellen Modus (PRE, XMP, ...) entsprechend
+ // Filtern und die Flags setzen. Wird von Continue aufgerufen, bevor
+ // NextToken gerufen wird. Wer eigene Schleifen implementiert bzw.
+ // selbst NextToken aufruft, sollte diese Methode vorher rufen.
+ int FilterToken( int nToken );
+
+ // Scannen eines Scripts beenden (sollte nur unmittelbar nach dem
+ // Lesen eines <SCRIPT> aufgerufen werden
+ void EndScanScript() { bReadScript = false; }
+
+ void ReadRawData( const sal_Char *pEndToken ) { aEndToken.AssignAscii(pEndToken); }
+
+ // Token ohne \-Sequenzen
+ void UnescapeToken();
+
+ // Ermitteln der Optionen. pNoConvertToken ist das optionale Token
+ // einer Option, fuer die CR/LFs nicht aus dem Wert der Option
+ // geloescht werden.
+ const HTMLOptions& GetOptions( sal_uInt16 *pNoConvertToken=0 ) const;
+
+ // fuers asynchrone lesen aus dem SvStream
+ 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( 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
+ // SVPAR_CS_DONTKNOW uebergeben wird muss der String mit zwei(!)
+ // 0-Bytes an einer geraden(!) Position terminiert sein.
+ static bool IsHTMLFormat( const sal_Char* pHeader,
+ bool bSwitchToUCS2 = false,
+ rtl_TextEncoding eEnc=RTL_TEXTENCODING_DONTKNOW );
+
+ bool ParseScriptOptions( String& rLangString, const String&, HTMLScriptLanguage& rLang,
+ String& rSrc, String& rLibrary, String& rModule );
+
+ // Einen Kommentar um den Inhalt von <SCRIPT> oder <STYLE> entfernen
+ // Bei 'bFull' wird ggf. die gesammte Zeile hinter einem "<!--"
+ // entfernt (fuer JavaSript)
+ static void RemoveSGMLComment( String &rString, sal_Bool bFull );
+
+ static bool InternalImgToPrivateURL( String& rURL );
+ static rtl_TextEncoding GetEncodingByHttpHeader( SvKeyValueIterator *pHTTPHeader );
+ bool SetEncodingByHTTPHeader( SvKeyValueIterator *pHTTPHeader );
+};
+
+inline void HTMLParser::StartPRE( bool bRestart )
+{
+ bReadPRE = true;
+ bPre_IgnoreNewPara = !bRestart;
+ nPre_LinePos = 0UL;
+}
+
+inline void HTMLParser::StartListing( bool bRestart )
+{
+ bReadListing = true;
+ bPre_IgnoreNewPara = !bRestart;
+ nPre_LinePos = 0UL;
+}
+
+inline void HTMLParser::StartXMP( bool bRestart )
+{
+ bReadXMP = true;
+ bPre_IgnoreNewPara = !bRestart;
+ nPre_LinePos = 0UL;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/parrtf.hxx b/include/svtools/parrtf.hxx
new file mode 100644
index 000000000000..73e1bdd42c6a
--- /dev/null
+++ b/include/svtools/parrtf.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _PARRTF_HXX
+#define _PARRTF_HXX
+
+#include "svtools/svtdllapi.h"
+#include <svtools/svparser.hxx>
+#include <stack>
+
+struct RtfParserState_Impl
+{
+ rtl_TextEncoding eCodeSet;
+ sal_uInt8 nUCharOverread;
+
+ RtfParserState_Impl( sal_uInt8 nUOverread, rtl_TextEncoding eCdSt )
+ : eCodeSet( eCdSt ), nUCharOverread( nUOverread )
+ {}
+};
+
+typedef std::stack< RtfParserState_Impl > RtfParserStates_Impl;
+
+class SVT_DLLPUBLIC SvRTFParser : public SvParser
+{
+ RtfParserStates_Impl aParserStates;
+
+ int nOpenBrakets;
+ rtl_TextEncoding eCodeSet, eUNICodeSet;
+ sal_uInt8 nUCharOverread;
+
+private:
+ static short _inSkipGroup;
+
+protected:
+ sal_Unicode GetHexValue();
+ void ScanText( const sal_Unicode = 0 );
+ void SkipGroup();
+
+ // scanne das naechste Token,
+ virtual int _GetNextToken();
+
+ virtual void ReadUnknownData();
+ virtual void ReadBitmapData();
+ virtual void ReadOLEData();
+
+ virtual ~SvRTFParser();
+
+ rtl_TextEncoding GetCodeSet() const { return eCodeSet; }
+ void SetEncoding( rtl_TextEncoding eEnc );
+
+ rtl_TextEncoding GetUNICodeSet() const { return eUNICodeSet; }
+ void SetUNICodeSet( rtl_TextEncoding eSet ) { eUNICodeSet = eSet; }
+
+public:
+ SvRTFParser( SvStream& rIn, sal_uInt8 nStackSize = 3 );
+
+ virtual SvParserState CallParser(); // Aufruf des Parsers
+
+ int GetOpenBrakets() const { return nOpenBrakets; }
+
+ // fuers asynchrone lesen aus dem SvStream
+// virtual void SaveState( int nToken );
+// virtual void RestoreState();
+ virtual void Continue( int nToken );
+};
+
+#endif //_PARRTF_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/place.hxx b/include/svtools/place.hxx
new file mode 100644
index 000000000000..f6ca8cd7f7b0
--- /dev/null
+++ b/include/svtools/place.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef __SVTOOLS_PLACE_HXX__
+#define __SVTOOLS_PLACE_HXX__
+
+#include <tools/urlobj.hxx>
+
+class Place
+{
+private:
+ OUString msName;
+ INetURLObject maUrl;
+
+ bool mbEditable;
+
+public:
+
+ Place( OUString sName, OUString sUrl, bool bEditable = false ) :
+ msName( sName ),
+ maUrl( sUrl ),
+ mbEditable( bEditable ) {};
+
+ void SetName(const OUString& aName ) { msName = aName; }
+ void SetUrl(const OUString& aUrl ) { maUrl.SetURL( aUrl ); }
+
+ OUString& GetName( ) { return msName; }
+ OUString GetUrl( ) { return maUrl.GetMainURL( INetURLObject::NO_DECODE ); }
+ INetURLObject& GetUrlObject( ) { return maUrl; }
+ bool IsLocal( ) { return maUrl.GetProtocol() == INET_PROT_FILE; }
+ bool IsEditable( ) { return mbEditable; }
+};
+
+#endif // __SVTOOLS_PLACE_HXX__
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/popupmenucontrollerbase.hxx b/include/svtools/popupmenucontrollerbase.hxx
new file mode 100644
index 000000000000..daddbed7e9fd
--- /dev/null
+++ b/include/svtools/popupmenucontrollerbase.hxx
@@ -0,0 +1,131 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __SVTOOLS_POPUPMENUCONTROLLERBASE_HXX_
+#define __SVTOOLS_POPUPMENUCONTROLLERBASE_HXX_
+
+#include "svtools/svtdllapi.h"
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XStatusListener.hpp>
+#include <com/sun/star/frame/XPopupMenuController.hpp>
+#include <com/sun/star/uri/XUriReferenceFactory.hpp>
+#include <com/sun/star/uri/XUriReference.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+
+#include <toolkit/awt/vclxmenu.hxx>
+#include <cppuhelper/compbase7.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <cppuhelper/weak.hxx>
+#include <rtl/ustring.hxx>
+
+namespace svt
+{
+ struct PopupMenuControllerBaseDispatchInfo;
+
+ typedef ::cppu::WeakComponentImplHelper7<
+ com::sun::star::lang::XServiceInfo ,
+ com::sun::star::frame::XPopupMenuController ,
+ com::sun::star::lang::XInitialization ,
+ com::sun::star::frame::XStatusListener ,
+ com::sun::star::awt::XMenuListener ,
+ com::sun::star::frame::XDispatchProvider ,
+ com::sun::star::frame::XDispatch > PopupMenuControllerBaseType;
+
+ class SVT_DLLPUBLIC PopupMenuControllerBase : protected ::comphelper::OBaseMutex, // Struct for right initalization of mutex member! Must be first of baseclasses.
+ public PopupMenuControllerBaseType
+ {
+ public:
+ PopupMenuControllerBase( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
+ virtual ~PopupMenuControllerBase();
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException) = 0;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException) = 0;
+
+ // XPopupMenuController
+ virtual void SAL_CALL setPopupMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& PopupMenu ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updatePopupMenu() 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);
+
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) = 0;
+
+ // XMenuListener
+ virtual void SAL_CALL highlight( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deactivate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XDispatchProvider
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL queryDispatch( const ::com::sun::star::util::URL& aURL, const OUString& sTarget, sal_Int32 nFlags ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL queryDispatches( const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& lDescriptor ) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XDispatch
+ virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& seqProperties ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL removeStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException );
+
+ void dispatchCommand( const OUString& sCommandURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs );
+
+ protected:
+ void throwIfDisposed() throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** helper method to cause statusChanged is called once for the given command url */
+ void SAL_CALL updateCommand( const OUString& rCommandURL );
+
+ /** this function is called upon disposing the component
+ */
+ virtual void SAL_CALL disposing();
+
+ virtual void resetPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu );
+ virtual void impl_setPopupMenu();
+ virtual void impl_select(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL);
+ OUString determineBaseURL( const OUString& aURL );
+
+ DECL_STATIC_LINK( PopupMenuControllerBase, ExecuteHdl_Impl, PopupMenuControllerBaseDispatchInfo* );
+
+
+ bool m_bInitialized;
+ OUString m_aCommandURL;
+ OUString m_aBaseURL;
+ OUString m_aModuleName;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > m_xDispatch;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > m_xPopupMenu;
+ };
+}
+
+#endif // __SVTOOLS_POPUPMENUCONTROLLERBASE_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/popupwindowcontroller.hxx b/include/svtools/popupwindowcontroller.hxx
new file mode 100644
index 000000000000..ec2719cebd5c
--- /dev/null
+++ b/include/svtools/popupwindowcontroller.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __SVTOOLS_POPUPWINDOWCONTROLLER_HXX_
+#define __SVTOOLS_POPUPWINDOWCONTROLLER_HXX_
+
+#include "svtools/svtdllapi.h"
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+#include "svtools/toolboxcontroller.hxx"
+#include "boost/scoped_ptr.hpp"
+
+class Window;
+
+namespace svt
+{
+class PopupWindowControllerImpl;
+
+class SVT_DLLPUBLIC PopupWindowController : public svt::ToolboxController, public ::com::sun::star::lang::XServiceInfo
+{
+public:
+ PopupWindowController( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame,
+ const OUString& aCommandURL );
+ ~PopupWindowController();
+
+ virtual ::Window* createPopupWindow( ::Window* pParent ) = 0;
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw ();
+ virtual void SAL_CALL release() throw ();
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ) = 0;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ) = 0;
+
+ // 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);
+
+ // XComponent
+ virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
+
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XToolbarController
+ virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& Parent ) throw (::com::sun::star::uno::RuntimeException);
+private:
+ boost::scoped_ptr< PopupWindowControllerImpl > mpImpl;
+};
+
+} // namespace svt
+
+#endif // __SVTOOLS_POPUPWINDOWCONTROLLER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/printoptions.hxx b/include/svtools/printoptions.hxx
new file mode 100644
index 000000000000..e3e70e7750e6
--- /dev/null
+++ b/include/svtools/printoptions.hxx
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVTOOLS_PRINTOPTIONS_HXX
+#define INCLUDED_SVTOOLS_PRINTOPTIONS_HXX
+
+#include "svtools/svtdllapi.h"
+#include <sal/types.h>
+#include <osl/mutex.hxx>
+#include <rtl/ustring.hxx>
+#include <unotools/options.hxx>
+
+class SvtPrintOptions_Impl;
+
+// -----------------------
+// - SvtBasePrintOptions -
+// -----------------------
+
+class PrinterOptions;
+
+class SVT_DLLPUBLIC SvtBasePrintOptions: public utl::detail::Options
+{
+protected:
+
+ SvtPrintOptions_Impl* m_pDataContainer;
+
+ void SetDataContainer( SvtPrintOptions_Impl* pDataContainer ) { m_pDataContainer = pDataContainer; }
+
+public:
+
+ static ::osl::Mutex& GetOwnStaticMutex();
+
+public:
+
+ SvtBasePrintOptions();
+ virtual ~SvtBasePrintOptions();
+
+ sal_Bool IsReduceTransparency() const;
+ sal_Int16 GetReducedTransparencyMode() const;
+ sal_Bool IsReduceGradients() const;
+ sal_Int16 GetReducedGradientMode() const;
+ sal_Int16 GetReducedGradientStepCount() const;
+ sal_Bool IsReduceBitmaps() const;
+ sal_Int16 GetReducedBitmapMode() const;
+ sal_Int16 GetReducedBitmapResolution() const;
+ sal_Bool IsReducedBitmapIncludesTransparency() const;
+ sal_Bool IsConvertToGreyscales() const;
+ sal_Bool IsPDFAsStandardPrintJobFormat() const;
+
+ void SetReduceTransparency( sal_Bool bState );
+ void SetReducedTransparencyMode( sal_Int16 nMode );
+ void SetReduceGradients( sal_Bool bState );
+ void SetReducedGradientMode( sal_Int16 nMode );
+ void SetReducedGradientStepCount( sal_Int16 nStepCount );
+ void SetReduceBitmaps( sal_Bool bState );
+ void SetReducedBitmapMode( sal_Int16 bState );
+ void SetReducedBitmapResolution( sal_Int16 nResolution );
+ void SetReducedBitmapIncludesTransparency( sal_Bool bState );
+ void SetConvertToGreyscales( sal_Bool bState );
+ void SetPDFAsStandardPrintJobFormat( sal_Bool bState );
+
+public:
+
+ void GetPrinterOptions( PrinterOptions& rOptions ) const;
+ void SetPrinterOptions( const PrinterOptions& rOptions );
+};
+
+// ---------------------
+// - SvtPrinterOptions -
+// ---------------------
+
+class SVT_DLLPUBLIC SvtPrinterOptions : public SvtBasePrintOptions
+{
+private:
+
+ static SvtPrintOptions_Impl* m_pStaticDataContainer; /// impl. data container as dynamic pointer for smaller memory requirements!
+ static sal_Int32 m_nRefCount; /// internal ref count mechanism
+
+public:
+
+ SvtPrinterOptions();
+ virtual ~SvtPrinterOptions();
+};
+
+// -----------------------
+// - SvtPrintFileOptions -
+// -----------------------
+
+class SVT_DLLPUBLIC SvtPrintFileOptions : public SvtBasePrintOptions
+{
+private:
+
+ static SvtPrintOptions_Impl* m_pStaticDataContainer; /// impl. data container as dynamic pointer for smaller memory requirements!
+ static sal_Int32 m_nRefCount; /// internal ref count mechanism
+
+public:
+
+ SvtPrintFileOptions();
+ virtual ~SvtPrintFileOptions();
+};
+
+#endif // INCLUDED_SVTOOLS_PRINTOPTIONS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/prnsetup.hxx b/include/svtools/prnsetup.hxx
new file mode 100644
index 000000000000..9999fdb8846b
--- /dev/null
+++ b/include/svtools/prnsetup.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SV_PRNSETUP_HXX_
+#define _SV_PRNSETUP_HXX_
+
+#include "svtools/svtdllapi.h"
+
+#include <vcl/dialog.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <vcl/group.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/timer.hxx>
+#include <svtools/stdctrl.hxx>
+
+class Printer;
+class QueueInfo;
+
+// ----------------------
+// - PrinterSetupDialog -
+// ----------------------
+
+class SVT_DLLPUBLIC PrinterSetupDialog : public ModalDialog
+{
+private:
+ ListBox* m_pLbName;
+ PushButton* m_pBtnProperties;
+ PushButton* m_pBtnOptions;
+ FixedText* m_pFiStatus;
+ FixedText* m_pFiType;
+ FixedText* m_pFiLocation;
+ FixedText* m_pFiComment;
+ AutoTimer maStatusTimer;
+ Printer* mpPrinter;
+ Printer* mpTempPrinter;
+
+ SVT_DLLPRIVATE void ImplSetInfo();
+
+ DECL_DLLPRIVATE_LINK( ImplPropertiesHdl, void* );
+ DECL_DLLPRIVATE_LINK( ImplOptionsHdl, void* );
+ DECL_DLLPRIVATE_LINK( ImplChangePrinterHdl, void* );
+ DECL_DLLPRIVATE_LINK( ImplStatusHdl, void* );
+
+public:
+ PrinterSetupDialog( Window* pWindow );
+ ~PrinterSetupDialog();
+
+ void SetPrinter( Printer* pNewPrinter ) { mpPrinter = pNewPrinter; }
+ Printer* GetPrinter() const { return mpPrinter; }
+
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ virtual long Notify( NotifyEvent& rNEvt );
+
+ virtual short Execute();
+
+ void SetOptionsHdl( const Link& rLink );
+};
+
+// --------------------------------------
+// - Hilfsfunktionen fuer Print-Dialoge -
+// --------------------------------------
+
+#define IMPL_PRINTDLG_STATUS_UPDATE 15000
+
+void ImplFillPrnDlgListBox( const Printer* pPrinter,
+ ListBox* pBox, PushButton* pPropBtn );
+void ImplFreePrnDlgListBox( ListBox* pBox, sal_Bool bClear = sal_True );
+Printer* ImplPrnDlgListBoxSelect( ListBox* pBox, PushButton* pPropBtn,
+ Printer* pPrinter, Printer* pTempPrinter );
+Printer* ImplPrnDlgUpdatePrinter( Printer* pPrinter, Printer* pTempPrinter );
+void ImplPrnDlgUpdateQueueInfo( ListBox* pBox, QueueInfo& rInfo );
+XubString ImplPrnDlgGetStatusText( const QueueInfo& rInfo );
+
+#endif // _SV_PRNSETUP_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/restartdialog.hxx b/include/svtools/restartdialog.hxx
new file mode 100644
index 000000000000..993b0998aa0b
--- /dev/null
+++ b/include/svtools/restartdialog.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SVTOOLS_RESTARTDIALOG_HXX
+#define INCLUDED_SVTOOLS_RESTARTDIALOG_HXX
+
+#include "sal/config.h"
+
+#include "com/sun/star/uno/Reference.hxx"
+#include "svtools/svtdllapi.h"
+
+class Window;
+namespace com { namespace sun { namespace star { namespace uno {
+ class XComponentContext;
+} } } }
+
+namespace svtools {
+
+enum RestartReason {
+ RESTART_REASON_JAVA,
+ // "For the selected Java runtime environment to work properly,
+ // %PRODUCTNAME must be restarted."
+ RESTART_REASON_PDF_AS_STANDARD_JOB_FORMAT,
+ // For the modified default print job format to take effect,
+ // %PRODUCTNAME must be restarted.
+ RESTART_REASON_BIBLIOGRAPHY_INSTALL
+ // "For the bibliography to work properly,
+ // %PRODUCTNAME must be restarted."
+};
+
+// Must be called with the solar mutex locked:
+SVT_DLLPUBLIC void executeRestartDialog(
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ const & context,
+ Window * parent, RestartReason reason);
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/roadmap.hxx b/include/svtools/roadmap.hxx
new file mode 100644
index 000000000000..d36a1a3165bb
--- /dev/null
+++ b/include/svtools/roadmap.hxx
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVTOOLS_ROADMAP_HXX
+#define _SVTOOLS_ROADMAP_HXX
+
+#include "svtools/svtdllapi.h"
+#include <vcl/ctrl.hxx>
+#include <vcl/imgctrl.hxx>
+
+#include "svtools/hyperlabel.hxx"
+
+
+
+
+class Bitmap;
+//.........................................................................
+namespace svt
+{
+//.........................................................................
+
+ struct RoadmapTypes
+ {
+ public:
+ typedef sal_Int16 ItemId;
+ typedef sal_Int32 ItemIndex;
+ };
+
+ class RoadmapImpl;
+ class RoadmapItem;
+
+ //=====================================================================
+ //= Roadmap
+ //=====================================================================
+ class SVT_DLLPUBLIC ORoadmap : public Control, public RoadmapTypes
+ {
+ protected:
+ RoadmapImpl* m_pImpl;
+ // Window overridables
+ void Paint( const Rectangle& _rRect );
+ void implInit();
+
+ public:
+ ORoadmap( Window* _pParent, WinBits _nWinStyle = 0 );
+ ~ORoadmap( );
+
+ void SetRoadmapBitmap( const BitmapEx& maBitmap, sal_Bool _bInvalidate = sal_True );
+
+ void EnableRoadmapItem( ItemId _nItemId, sal_Bool _bEnable, ItemIndex _nStartIndex = 0 );
+
+ void ChangeRoadmapItemLabel( ItemId _nID, const OUString& sLabel, ItemIndex _nStartIndex = 0 );
+ void ChangeRoadmapItemID( ItemId _nID, ItemId _NewID, ItemIndex _nStartIndex = 0 );
+
+ void SetRoadmapInteractive( sal_Bool _bInteractive );
+ sal_Bool IsRoadmapInteractive();
+
+ void SetRoadmapComplete( sal_Bool _bComplete );
+ sal_Bool IsRoadmapComplete() const;
+
+ ItemIndex GetItemCount() const;
+ ItemId GetItemID( ItemIndex _nIndex ) const;
+
+ void InsertRoadmapItem( ItemIndex _Index, const OUString& _RoadmapItem, ItemId _nUniqueId, sal_Bool _bEnabled = sal_True );
+ void ReplaceRoadmapItem( ItemIndex _Index, const OUString& _RoadmapItem, ItemId _nUniqueId, sal_Bool _bEnabled );
+ void DeleteRoadmapItem( ItemIndex _nIndex );
+
+ ItemId GetCurrentRoadmapItemID() const;
+ sal_Bool SelectRoadmapItemByID( ItemId _nItemID );
+
+ void SetItemSelectHdl( const Link& _rHdl );
+ Link GetItemSelectHdl( ) const;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ virtual void GetFocus();
+
+
+ protected:
+ long PreNotify( NotifyEvent& rNEvt );
+
+ protected:
+ /// called when an item has been selected by any means
+ virtual void Select();
+
+ private:
+ DECL_LINK(ImplClickHdl, HyperLabel*);
+
+ RoadmapItem* GetByIndex( ItemIndex _nItemIndex );
+ const RoadmapItem* GetByIndex( ItemIndex _nItemIndex ) const;
+
+ RoadmapItem* GetByID( ItemId _nID, ItemIndex _nStartIndex = 0 );
+ const RoadmapItem* GetByID( ItemId _nID, ItemIndex _nStartIndex = 0 ) const;
+ RoadmapItem* GetPreviousHyperLabel( ItemIndex _Index);
+
+ void DrawHeadline();
+ void DeselectOldRoadmapItems();
+ ItemId GetNextAvailableItemId( ItemIndex _NewIndex );
+ ItemId GetPreviousAvailableItemId( ItemIndex _NewIndex );
+ RoadmapItem* GetByPointer(Window* pWindow);
+ RoadmapItem* InsertHyperLabel( ItemIndex _Index, const OUString& _aStr, ItemId _RMID, sal_Bool _bEnabled = sal_True );
+ void UpdatefollowingHyperLabels( ItemIndex _Index );
+ };
+
+//.........................................................................
+} // namespace svt
+//.........................................................................
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/roadmapwizard.hxx b/include/svtools/roadmapwizard.hxx
new file mode 100644
index 000000000000..aae7ebfc5d7b
--- /dev/null
+++ b/include/svtools/roadmapwizard.hxx
@@ -0,0 +1,246 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVTOOLS_INC_ROADMAPWIZARD_HXX
+#define SVTOOLS_INC_ROADMAPWIZARD_HXX
+
+#include "svtools/svtdllapi.h"
+#include <svtools/wizardmachine.hxx>
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ struct RoadmapWizardImpl;
+ class RoadmapWizard;
+
+ struct RoadmapWizardTypes
+ {
+ public:
+ typedef sal_Int16 PathId;
+ typedef ::std::vector< WizardTypes::WizardState > WizardPath;
+ typedef TabPage* (* RoadmapPageFactory)( RoadmapWizard& );
+ };
+
+ //====================================================================
+ //= RoadmapWizard
+ //====================================================================
+ /** is - no, not a wizard for a raodmap, but the base class for wizards
+ <em>supporting</em> a roadmap.
+
+ The basic new concept introduced is a <em>path</em>:<br/>
+ A <em>path</em> is a sequence of states, which are to be executed in a linear order.
+ Elements in the path can be skipped, depending on choices the user makes.
+
+ In the most simple wizards, you will have only one path consisting of <code>n</code> elements,
+ which are to be visited successively.
+
+ In a slightly more complex wizard, you will have one linear path, were certain
+ steps might be skipped due to user input. For instance, the user may decide to not specify
+ certain aspects of the to-be-created object (e.g. by unchecking a check box),
+ and the wizard then will simply disable the step which corresponds to this step.
+
+ In a yet more advanced wizards, you will have several paths of length <code>n1</code> and
+ <code>n2</code>, which share at least the first <code>k</code> states (where <code>k</code>
+ is at least 1), and an arbitrary number of other states.
+ */
+ class SVT_DLLPUBLIC RoadmapWizard : public OWizardMachine, public RoadmapWizardTypes
+ {
+ private:
+ RoadmapWizardImpl* m_pImpl;
+
+ public:
+ RoadmapWizard(
+ Window* _pParent,
+ const ResId& _rRes,
+ sal_uInt32 _nButtonFlags = WZB_NEXT | WZB_PREVIOUS | WZB_FINISH | WZB_CANCEL | WZB_HELP
+ );
+ RoadmapWizard(
+ Window* _pParent,
+ const WinBits i_nStyle,
+ sal_uInt32 _nButtonFlags = WZB_NEXT | WZB_PREVIOUS | WZB_FINISH | WZB_CANCEL | WZB_HELP
+ );
+ ~RoadmapWizard( );
+
+ void SetRoadmapHelpId( const OString& _rId );
+
+ void SetRoadmapInteractive( sal_Bool _bInteractive );
+ virtual void Resize();
+ virtual void StateChanged( StateChangedType nStateChange );
+
+ // returns whether a given state is enabled
+ bool isStateEnabled( WizardState _nState ) const;
+
+ // WizardDialog overridables
+ virtual bool canAdvance() const;
+ virtual void updateTravelUI();
+
+protected:
+ /** declares a valid path in the wizard
+
+ The very first path which is declared is automatically activated.
+
+ Note that all paths which are declared must have the very first state in
+ common. Also note that due to a restriction of the very base class (<type>WizardDialog</type>),
+ this common first state must be 0.
+
+ You cannot declare new paths once the wizard started, so it's recommended that
+ you do all declarations within your derivee's constructor.
+
+ @see activatePath
+
+ @param _nId
+ the unique id you wish to give this path. This id can later on be used
+ to refer to the path which you just declared
+
+ @param _nFirstState
+ the first state in this path. Must not be WZS_INVALID_STATE.<br/>
+ Declare an arbitrary number of states after this one, and terminate the sequence
+ with a WZS_INVALID_STATE.
+ */
+ void declarePath( PathId _nPathId, WizardState _nFirstState, ... );
+ void declarePath( PathId _nPathId, const WizardPath& _lWizardStates);
+
+ /** provides basic information about a state
+
+ The given display name is used in the default implementation of getStateDisplayName,
+ and the given factory is used in the default implementation of createPage.
+ */
+ void describeState( WizardState _nState, const String& _rStateDisplayName, RoadmapPageFactory _pPageFactory );
+
+ /** activates a path which has previously been declared with <member>declarePath</member>
+
+ You can only activate paths which share the first <code>k</code> states with the path
+ which is previously active (if any), where <code>k</code> is the index of the
+ current state within the current path.
+
+ <example>
+ Say you have paths, <code>(0,1,2,5)</code> and <code>(0,1,4,5)</code>. This means that after
+ step <code>1</code>, you either continue with state <code>2</code> or state <code>4</code>,
+ and after this, you finish in state <code>5</code>.<br/>
+ Now if the first path is active, and your current state is <code>1</code>, then you can
+ easily switch to the second path, since both paths start with <code>(0,1)</code>.<br/>
+ However, if your current state is <code>2</code>, then you can not switch to the second
+ path anymore.
+ </example>
+
+ @param _nPathId
+ the id of the path. The path must have been declared (under this id) with
+ <member>declarePath</member> before it can be activated.
+
+ @param _bDecideForIt
+ If <TRUE/>, the path will be completely activated, even if it is a conflicting path
+ (i.e. there is another path which shares the first <code>k</code> states with
+ the to-be-activated path.)<br/>
+ If <FALSE/>, then the new path is checked for conflicts with other paths. If such
+ conflicts exists, the path is not completely activated, but only up to the point
+ where it does <em>not</em> conflict.<br/>
+ With the paths in the example above, if you activate the second path (when both are
+ already declared), then only steps <code>0</code> and <code>1</code> are activated,
+ since they are common to both paths.
+ */
+ void activatePath( PathId _nPathId, bool _bDecideForIt = false );
+
+ /** determine the next state to travel from the given one
+
+ This method (which is declared in <type>OWizardMachine</type> and overwritten here)
+ ensures that traveling happens along the active path.
+
+ @see activatePath
+ */
+ virtual WizardState determineNextState( WizardState _nCurrentState ) const;
+
+ /** en- or disables a state
+
+ In the wizard's roadmap, states to travel to can be freely chosen. To prevent
+ users from selecting a state which is currently not available, you can declare this
+ state as being disabled.
+
+ A situation where you need this may be when you have a checkbox which, when checked
+ by the user, enables a page with additional settings. As long as this checkbox is
+ not checked, the respective state would be disabled.
+
+ Note that in theory, you can declare multiple paths, instead of disabling states.
+ For instance, if you have a path where one state can be potentially disabled, then
+ you could declare a second path, which does not contain this state. However, the
+ disadvantage is that then, not the complete path would be visible in the roadmap,
+ but only all steps up to the point where the both paths diverge.<br/>
+ Another disadvantage is that the number of needed paths grows exponentially with
+ the number of states which can be potentially disabled.
+
+ @see declarePath
+ */
+ void enableState( WizardState _nState, bool _bEnable = true );
+
+ /** returns true if and only if the given state is known in at least one declared path
+ */
+ bool knowsState( WizardState _nState ) const;
+
+ // OWizardMachine overriables
+ virtual void enterState( WizardState _nState );
+
+ /** returns a human readable name for a given state
+
+ There is a default implementation for this method, which returns the display name
+ as given in a call to describeState. If there is no description for the given state,
+ this is worth an assertion in a non-product build, and then an empty string is
+ returned.
+ */
+ virtual String getStateDisplayName( WizardState _nState ) const;
+
+ /** creates a page for a given state
+
+ This member is inherited from OWizardMachine, and default-implemented in this class
+ for all states which have been described using describeState.
+ */
+ virtual TabPage* createPage( WizardState _nState );
+
+ /** asks for a new label of the wizard page
+
+ */
+ void updateRoadmapItemLabel( WizardState _nState );
+
+ protected:
+#ifdef DBG_UTIL
+ const sal_Char* checkInvariants() const;
+ friend const char* CheckInvariants( const void* pVoid );
+#endif
+
+ private:
+ SVT_DLLPRIVATE void ResizeFixedLine();
+
+ DECL_DLLPRIVATE_LINK( OnRoadmapItemSelected, void* );
+
+ /** updates the roadmap control to show the given path, as far as possible
+ (modulo conflicts with other paths)
+ */
+ SVT_DLLPRIVATE void implUpdateRoadmap( );
+
+ private:
+ SVT_DLLPRIVATE void impl_construct();
+ };
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // OOO_SVTOOLS_INC_ROADMAPWIZARD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/rtfkeywd.hxx b/include/svtools/rtfkeywd.hxx
new file mode 100644
index 000000000000..cf4e908a696c
--- /dev/null
+++ b/include/svtools/rtfkeywd.hxx
@@ -0,0 +1,1212 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _RTFKEYWD_HXX
+#define _RTFKEYWD_HXX
+
+#include "sal/config.h"
+
+#define OOO_STRING_SVTOOLS_RTF_HEXCHAR "\\'"
+#define OOO_STRING_SVTOOLS_RTF_IGNORE "\\*"
+#define OOO_STRING_SVTOOLS_RTF_OPTHYPH "\\-"
+#define OOO_STRING_SVTOOLS_RTF_SUBENTRY "\\:"
+#define OOO_STRING_SVTOOLS_RTF_ABSH "\\absh"
+#define OOO_STRING_SVTOOLS_RTF_ABSW "\\absw"
+#define OOO_STRING_SVTOOLS_RTF_ALT "\\alt"
+#define OOO_STRING_SVTOOLS_RTF_ANNOTATION "\\annotation"
+#define OOO_STRING_SVTOOLS_RTF_ANSI "\\ansi"
+#define OOO_STRING_SVTOOLS_RTF_ATNDATE "\\atndate"
+#define OOO_STRING_SVTOOLS_RTF_ATNID "\\atnid"
+#define OOO_STRING_SVTOOLS_RTF_AUTHOR "\\author"
+#define OOO_STRING_SVTOOLS_RTF_B "\\b"
+#define OOO_STRING_SVTOOLS_RTF_BGBDIAG "\\bgbdiag"
+#define OOO_STRING_SVTOOLS_RTF_BGCROSS "\\bgcross"
+#define OOO_STRING_SVTOOLS_RTF_BGDCROSS "\\bgdcross"
+#define OOO_STRING_SVTOOLS_RTF_BGDKBDIAG "\\bgdkbdiag"
+#define OOO_STRING_SVTOOLS_RTF_BGDKCROSS "\\bgdkcross"
+#define OOO_STRING_SVTOOLS_RTF_BGDKDCROSS "\\bgdkdcross"
+#define OOO_STRING_SVTOOLS_RTF_BGDKFDIAG "\\bgdkfdiag"
+#define OOO_STRING_SVTOOLS_RTF_BGDKHORIZ "\\bgdkhoriz"
+#define OOO_STRING_SVTOOLS_RTF_BGDKVERT "\\bgdkvert"
+#define OOO_STRING_SVTOOLS_RTF_BGFDIAG "\\bgfdiag"
+#define OOO_STRING_SVTOOLS_RTF_BGHORIZ "\\bghoriz"
+#define OOO_STRING_SVTOOLS_RTF_BGVERT "\\bgvert"
+#define OOO_STRING_SVTOOLS_RTF_BIN "\\bin"
+#define OOO_STRING_SVTOOLS_RTF_BINFSXN "\\binfsxn"
+#define OOO_STRING_SVTOOLS_RTF_BINSXN "\\binsxn"
+#define OOO_STRING_SVTOOLS_RTF_BKMKCOLF "\\bkmkcolf"
+#define OOO_STRING_SVTOOLS_RTF_BKMKCOLL "\\bkmkcoll"
+#define OOO_STRING_SVTOOLS_RTF_BKMKEND "\\bkmkend"
+#define OOO_STRING_SVTOOLS_RTF_BKMKSTART "\\bkmkstart"
+#define OOO_STRING_SVTOOLS_RTF_BLUE "\\blue"
+#define OOO_STRING_SVTOOLS_RTF_BOX "\\box"
+#define OOO_STRING_SVTOOLS_RTF_BRDRB "\\brdrb"
+#define OOO_STRING_SVTOOLS_RTF_BRDRBAR "\\brdrbar"
+#define OOO_STRING_SVTOOLS_RTF_BRDRBTW "\\brdrbtw"
+#define OOO_STRING_SVTOOLS_RTF_BRDRCF "\\brdrcf"
+#define OOO_STRING_SVTOOLS_RTF_BRDRDB "\\brdrdb"
+#define OOO_STRING_SVTOOLS_RTF_BRDRDOT "\\brdrdot"
+#define OOO_STRING_SVTOOLS_RTF_BRDRDASH "\\brdrdash"
+#define OOO_STRING_SVTOOLS_RTF_BRDRDASHSM "\\brdrdashsm"
+#define OOO_STRING_SVTOOLS_RTF_BRDRHAIR "\\brdrhair"
+#define OOO_STRING_SVTOOLS_RTF_BRDRL "\\brdrl"
+#define OOO_STRING_SVTOOLS_RTF_BRDRR "\\brdrr"
+#define OOO_STRING_SVTOOLS_RTF_BRDRS "\\brdrs"
+#define OOO_STRING_SVTOOLS_RTF_BRDRSH "\\brdrsh"
+#define OOO_STRING_SVTOOLS_RTF_BRDRT "\\brdrt"
+#define OOO_STRING_SVTOOLS_RTF_BRDRTH "\\brdrth"
+#define OOO_STRING_SVTOOLS_RTF_BRDRW "\\brdrw"
+#define OOO_STRING_SVTOOLS_RTF_BRSP "\\brsp"
+#define OOO_STRING_SVTOOLS_RTF_BULLET "\\bullet"
+#define OOO_STRING_SVTOOLS_RTF_BUPTIM "\\buptim"
+#define OOO_STRING_SVTOOLS_RTF_BXE "\\bxe"
+#define OOO_STRING_SVTOOLS_RTF_CAPS "\\caps"
+#define OOO_STRING_SVTOOLS_RTF_CB "\\cb"
+#define OOO_STRING_SVTOOLS_RTF_CBPAT "\\cbpat"
+#define OOO_STRING_SVTOOLS_RTF_CELL "\\cell"
+#define OOO_STRING_SVTOOLS_RTF_CELLX "\\cellx"
+#define OOO_STRING_SVTOOLS_RTF_CF "\\cf"
+#define OOO_STRING_SVTOOLS_RTF_CFPAT "\\cfpat"
+#define OOO_STRING_SVTOOLS_RTF_CHATN "\\chatn"
+#define OOO_STRING_SVTOOLS_RTF_CHDATE "\\chdate"
+#define OOO_STRING_SVTOOLS_RTF_CHDPA "\\chdpa"
+#define OOO_STRING_SVTOOLS_RTF_CHDPL "\\chdpl"
+#define OOO_STRING_SVTOOLS_RTF_CHFTN "\\chftn"
+#define OOO_STRING_SVTOOLS_RTF_CHFTNSEP "\\chftnsep"
+#define OOO_STRING_SVTOOLS_RTF_CHFTNSEPC "\\chftnsepc"
+#define OOO_STRING_SVTOOLS_RTF_CHPGN "\\chpgn"
+#define OOO_STRING_SVTOOLS_RTF_CHTIME "\\chtime"
+#define OOO_STRING_SVTOOLS_RTF_CLBGBDIAG "\\clbgbdiag"
+#define OOO_STRING_SVTOOLS_RTF_CLBGCROSS "\\clbgcross"
+#define OOO_STRING_SVTOOLS_RTF_CLBGDCROSS "\\clbgdcross"
+#define OOO_STRING_SVTOOLS_RTF_CLBGDKBDIAG "\\clbgdkbdiag"
+#define OOO_STRING_SVTOOLS_RTF_CLBGDKCROSS "\\clbgdkcross"
+#define OOO_STRING_SVTOOLS_RTF_CLBGDKDCROSS "\\clbgdkdcross"
+#define OOO_STRING_SVTOOLS_RTF_CLBGDKFDIAG "\\clbgdkfdiag"
+#define OOO_STRING_SVTOOLS_RTF_CLBGDKHOR "\\clbgdkhor"
+#define OOO_STRING_SVTOOLS_RTF_CLBGDKVERT "\\clbgdkvert"
+#define OOO_STRING_SVTOOLS_RTF_CLBGFDIAG "\\clbgfdiag"
+#define OOO_STRING_SVTOOLS_RTF_CLBGHORIZ "\\clbghoriz"
+#define OOO_STRING_SVTOOLS_RTF_CLBGVERT "\\clbgvert"
+#define OOO_STRING_SVTOOLS_RTF_CLBRDRB "\\clbrdrb"
+#define OOO_STRING_SVTOOLS_RTF_CLBRDRL "\\clbrdrl"
+#define OOO_STRING_SVTOOLS_RTF_CLBRDRR "\\clbrdrr"
+#define OOO_STRING_SVTOOLS_RTF_CLBRDRT "\\clbrdrt"
+#define OOO_STRING_SVTOOLS_RTF_CLCBPAT "\\clcbpat"
+#define OOO_STRING_SVTOOLS_RTF_CLCFPAT "\\clcfpat"
+#define OOO_STRING_SVTOOLS_RTF_CLMGF "\\clmgf"
+#define OOO_STRING_SVTOOLS_RTF_CLMRG "\\clmrg"
+#define OOO_STRING_SVTOOLS_RTF_CLSHDNG "\\clshdng"
+#define OOO_STRING_SVTOOLS_RTF_COLNO "\\colno"
+#define OOO_STRING_SVTOOLS_RTF_COLORTBL "\\colortbl"
+#define OOO_STRING_SVTOOLS_RTF_COLS "\\cols"
+#define OOO_STRING_SVTOOLS_RTF_COLSR "\\colsr"
+#define OOO_STRING_SVTOOLS_RTF_COLSX "\\colsx"
+#define OOO_STRING_SVTOOLS_RTF_COLUMN "\\column"
+#define OOO_STRING_SVTOOLS_RTF_COLW "\\colw"
+#define OOO_STRING_SVTOOLS_RTF_COMMENT "\\comment"
+#define OOO_STRING_SVTOOLS_RTF_CONTEXTUALSPACE "\\contextualspace"
+#define OOO_STRING_SVTOOLS_RTF_CREATIM "\\creatim"
+#define OOO_STRING_SVTOOLS_RTF_CTRL "\\ctrl"
+#define OOO_STRING_SVTOOLS_RTF_DEFF "\\deff"
+#define OOO_STRING_SVTOOLS_RTF_DEFFORMAT "\\defformat"
+#define OOO_STRING_SVTOOLS_RTF_DEFLANG "\\deflang"
+#define OOO_STRING_SVTOOLS_RTF_DEFTAB "\\deftab"
+#define OOO_STRING_SVTOOLS_RTF_DELETED "\\deleted"
+#define OOO_STRING_SVTOOLS_RTF_DFRMTXTX "\\dfrmtxtx"
+#define OOO_STRING_SVTOOLS_RTF_DFRMTXTY "\\dfrmtxty"
+#define OOO_STRING_SVTOOLS_RTF_DIBITMAP "\\dibitmap"
+#define OOO_STRING_SVTOOLS_RTF_DN "\\dn"
+#define OOO_STRING_SVTOOLS_RTF_DOCCOMM "\\doccomm"
+#define OOO_STRING_SVTOOLS_RTF_DOCTEMP "\\doctemp"
+#define OOO_STRING_SVTOOLS_RTF_DROPCAPLI "\\dropcapli"
+#define OOO_STRING_SVTOOLS_RTF_DROPCAPT "\\dropcapt"
+#define OOO_STRING_SVTOOLS_RTF_ABSNOOVRLP "\\absnoovrlp"
+#define OOO_STRING_SVTOOLS_RTF_DXFRTEXT "\\dxfrtext"
+#define OOO_STRING_SVTOOLS_RTF_DY "\\dy"
+#define OOO_STRING_SVTOOLS_RTF_EDMINS "\\edmins"
+#define OOO_STRING_SVTOOLS_RTF_EMDASH "\\emdash"
+#define OOO_STRING_SVTOOLS_RTF_ENDASH "\\endash"
+#define OOO_STRING_SVTOOLS_RTF_ENDDOC "\\enddoc"
+#define OOO_STRING_SVTOOLS_RTF_ENDNHERE "\\endnhere"
+#define OOO_STRING_SVTOOLS_RTF_ENDNOTES "\\endnotes"
+#define OOO_STRING_SVTOOLS_RTF_EXPND "\\expnd"
+#define OOO_STRING_SVTOOLS_RTF_EXPNDTW "\\expndtw"
+#define OOO_STRING_SVTOOLS_RTF_F "\\f"
+#define OOO_STRING_SVTOOLS_RTF_FACINGP "\\facingp"
+#define OOO_STRING_SVTOOLS_RTF_FACPGSXN "\\facpgsxn"
+#define OOO_STRING_SVTOOLS_RTF_FALT "\\falt"
+#define OOO_STRING_SVTOOLS_RTF_FCHARSET "\\fcharset"
+#define OOO_STRING_SVTOOLS_RTF_FDECOR "\\fdecor"
+#define OOO_STRING_SVTOOLS_RTF_FI "\\fi"
+#define OOO_STRING_SVTOOLS_RTF_FIELD "\\field"
+#define OOO_STRING_SVTOOLS_RTF_FLDDIRTY "\\flddirty"
+#define OOO_STRING_SVTOOLS_RTF_FLDEDIT "\\fldedit"
+#define OOO_STRING_SVTOOLS_RTF_FLDINST "\\fldinst"
+#define OOO_STRING_SVTOOLS_RTF_FLDLOCK "\\fldlock"
+#define OOO_STRING_SVTOOLS_RTF_FLDPRIV "\\fldpriv"
+#define OOO_STRING_SVTOOLS_RTF_FLDRSLT "\\fldrslt"
+#define OOO_STRING_SVTOOLS_RTF_FMODERN "\\fmodern"
+#define OOO_STRING_SVTOOLS_RTF_FN "\\fn"
+#define OOO_STRING_SVTOOLS_RTF_FNIL "\\fnil"
+#define OOO_STRING_SVTOOLS_RTF_FONTTBL "\\fonttbl"
+#define OOO_STRING_SVTOOLS_RTF_FOOTER "\\footer"
+#define OOO_STRING_SVTOOLS_RTF_FOOTERF "\\footerf"
+#define OOO_STRING_SVTOOLS_RTF_FOOTERL "\\footerl"
+#define OOO_STRING_SVTOOLS_RTF_FOOTERR "\\footerr"
+#define OOO_STRING_SVTOOLS_RTF_FOOTERY "\\footery"
+#define OOO_STRING_SVTOOLS_RTF_FOOTNOTE "\\footnote"
+#define OOO_STRING_SVTOOLS_RTF_FPRQ "\\fprq"
+#define OOO_STRING_SVTOOLS_RTF_FRACWIDTH "\\fracwidth"
+#define OOO_STRING_SVTOOLS_RTF_FROMAN "\\froman"
+#define OOO_STRING_SVTOOLS_RTF_FS "\\fs"
+#define OOO_STRING_SVTOOLS_RTF_FSCRIPT "\\fscript"
+#define OOO_STRING_SVTOOLS_RTF_FSWISS "\\fswiss"
+#define OOO_STRING_SVTOOLS_RTF_FTECH "\\ftech"
+#define OOO_STRING_SVTOOLS_RTF_FTNBJ "\\ftnbj"
+#define OOO_STRING_SVTOOLS_RTF_FTNCN "\\ftncn"
+#define OOO_STRING_SVTOOLS_RTF_FTNRESTART "\\ftnrestart"
+#define OOO_STRING_SVTOOLS_RTF_FTNSEP "\\ftnsep"
+#define OOO_STRING_SVTOOLS_RTF_FTNSEPC "\\ftnsepc"
+#define OOO_STRING_SVTOOLS_RTF_FTNSTART "\\ftnstart"
+#define OOO_STRING_SVTOOLS_RTF_FTNTJ "\\ftntj"
+#define OOO_STRING_SVTOOLS_RTF_GREEN "\\green"
+#define OOO_STRING_SVTOOLS_RTF_GUTTER "\\gutter"
+#define OOO_STRING_SVTOOLS_RTF_GUTTERSXN "\\guttersxn"
+#define OOO_STRING_SVTOOLS_RTF_HEADER "\\header"
+#define OOO_STRING_SVTOOLS_RTF_HEADERF "\\headerf"
+#define OOO_STRING_SVTOOLS_RTF_HEADERL "\\headerl"
+#define OOO_STRING_SVTOOLS_RTF_HEADERR "\\headerr"
+#define OOO_STRING_SVTOOLS_RTF_HEADERY "\\headery"
+#define OOO_STRING_SVTOOLS_RTF_HR "\\hr"
+#define OOO_STRING_SVTOOLS_RTF_HYPHHOTZ "\\hyphhotz"
+#define OOO_STRING_SVTOOLS_RTF_I "\\i"
+#define OOO_STRING_SVTOOLS_RTF_ID "\\id"
+#define OOO_STRING_SVTOOLS_RTF_INFO "\\info"
+#define OOO_STRING_SVTOOLS_RTF_INTBL "\\intbl"
+#define OOO_STRING_SVTOOLS_RTF_IXE "\\ixe"
+#define OOO_STRING_SVTOOLS_RTF_KEEP "\\keep"
+#define OOO_STRING_SVTOOLS_RTF_KEEPN "\\keepn"
+#define OOO_STRING_SVTOOLS_RTF_KERNING "\\kerning"
+#define OOO_STRING_SVTOOLS_RTF_KEYCODE "\\keycode"
+#define OOO_STRING_SVTOOLS_RTF_KEYWORDS "\\keywords"
+#define OOO_STRING_SVTOOLS_RTF_LANDSCAPE "\\landscape"
+#define OOO_STRING_SVTOOLS_RTF_LANG "\\lang"
+#define OOO_STRING_SVTOOLS_RTF_LDBLQUOTE "\\ldblquote"
+#define OOO_STRING_SVTOOLS_RTF_LEVEL "\\level"
+#define OOO_STRING_SVTOOLS_RTF_LI "\\li"
+#define OOO_STRING_SVTOOLS_RTF_LIN "\\lin"
+#define OOO_STRING_SVTOOLS_RTF_LINE "\\line"
+#define OOO_STRING_SVTOOLS_RTF_LINEBETCOL "\\linebetcol"
+#define OOO_STRING_SVTOOLS_RTF_LINECONT "\\linecont"
+#define OOO_STRING_SVTOOLS_RTF_LINEMOD "\\linemod"
+#define OOO_STRING_SVTOOLS_RTF_LINEPPAGE "\\lineppage"
+#define OOO_STRING_SVTOOLS_RTF_LINERESTART "\\linerestart"
+#define OOO_STRING_SVTOOLS_RTF_LINESTART "\\linestart"
+#define OOO_STRING_SVTOOLS_RTF_LINESTARTS "\\linestarts"
+#define OOO_STRING_SVTOOLS_RTF_LINEX "\\linex"
+#define OOO_STRING_SVTOOLS_RTF_LNDSCPSXN "\\lndscpsxn"
+#define OOO_STRING_SVTOOLS_RTF_LQUOTE "\\lquote"
+#define OOO_STRING_SVTOOLS_RTF_MAC "\\mac"
+#define OOO_STRING_SVTOOLS_RTF_MACPICT "\\macpict"
+#define OOO_STRING_SVTOOLS_RTF_MAKEBACKUP "\\makebackup"
+#define OOO_STRING_SVTOOLS_RTF_MARGB "\\margb"
+#define OOO_STRING_SVTOOLS_RTF_MARGBSXN "\\margbsxn"
+#define OOO_STRING_SVTOOLS_RTF_MARGL "\\margl"
+#define OOO_STRING_SVTOOLS_RTF_MARGLSXN "\\marglsxn"
+#define OOO_STRING_SVTOOLS_RTF_MARGMIRROR "\\margmirror"
+#define OOO_STRING_SVTOOLS_RTF_MARGR "\\margr"
+#define OOO_STRING_SVTOOLS_RTF_MARGRSXN "\\margrsxn"
+#define OOO_STRING_SVTOOLS_RTF_MARGT "\\margt"
+#define OOO_STRING_SVTOOLS_RTF_MARGTSXN "\\margtsxn"
+#define OOO_STRING_SVTOOLS_RTF_MIN "\\min"
+#define OOO_STRING_SVTOOLS_RTF_MO "\\mo"
+#define OOO_STRING_SVTOOLS_RTF_NEXTCSET "\\nextcset"
+#define OOO_STRING_SVTOOLS_RTF_NEXTFILE "\\nextfile"
+#define OOO_STRING_SVTOOLS_RTF_NOFCHARS "\\nofchars"
+#define OOO_STRING_SVTOOLS_RTF_NOFPAGES "\\nofpages"
+#define OOO_STRING_SVTOOLS_RTF_NOFWORDS "\\nofwords"
+#define OOO_STRING_SVTOOLS_RTF_NOLINE "\\noline"
+#define OOO_STRING_SVTOOLS_RTF_NOSUPERSUB "\\nosupersub"
+#define OOO_STRING_SVTOOLS_RTF_NOWRAP "\\nowrap"
+#define OOO_STRING_SVTOOLS_RTF_OPERATOR "\\operator"
+#define OOO_STRING_SVTOOLS_RTF_OUTL "\\outl"
+#define OOO_STRING_SVTOOLS_RTF_PAGE "\\page"
+#define OOO_STRING_SVTOOLS_RTF_PAGEBB "\\pagebb"
+#define OOO_STRING_SVTOOLS_RTF_PAPERH "\\paperh"
+#define OOO_STRING_SVTOOLS_RTF_PAPERW "\\paperw"
+#define OOO_STRING_SVTOOLS_RTF_PAR "\\par"
+#define OOO_STRING_SVTOOLS_RTF_PARD "\\pard"
+#define OOO_STRING_SVTOOLS_RTF_PC "\\pc"
+#define OOO_STRING_SVTOOLS_RTF_PCA "\\pca"
+#define OOO_STRING_SVTOOLS_RTF_PGHSXN "\\pghsxn"
+#define OOO_STRING_SVTOOLS_RTF_PGNCONT "\\pgncont"
+#define OOO_STRING_SVTOOLS_RTF_PGNDEC "\\pgndec"
+#define OOO_STRING_SVTOOLS_RTF_PGNLCLTR "\\pgnlcltr"
+#define OOO_STRING_SVTOOLS_RTF_PGNLCRM "\\pgnlcrm"
+#define OOO_STRING_SVTOOLS_RTF_PGNRESTART "\\pgnrestart"
+#define OOO_STRING_SVTOOLS_RTF_PGNSTART "\\pgnstart"
+#define OOO_STRING_SVTOOLS_RTF_PGNSTARTS "\\pgnstarts"
+#define OOO_STRING_SVTOOLS_RTF_PGNUCLTR "\\pgnucltr"
+#define OOO_STRING_SVTOOLS_RTF_PGNUCRM "\\pgnucrm"
+#define OOO_STRING_SVTOOLS_RTF_PGNX "\\pgnx"
+#define OOO_STRING_SVTOOLS_RTF_PGNY "\\pgny"
+#define OOO_STRING_SVTOOLS_RTF_PGWSXN "\\pgwsxn"
+#define OOO_STRING_SVTOOLS_RTF_PHCOL "\\phcol"
+#define OOO_STRING_SVTOOLS_RTF_PHMRG "\\phmrg"
+#define OOO_STRING_SVTOOLS_RTF_PHPG "\\phpg"
+#define OOO_STRING_SVTOOLS_RTF_PICCROPB "\\piccropb"
+#define OOO_STRING_SVTOOLS_RTF_PICCROPL "\\piccropl"
+#define OOO_STRING_SVTOOLS_RTF_PICCROPR "\\piccropr"
+#define OOO_STRING_SVTOOLS_RTF_PICCROPT "\\piccropt"
+#define OOO_STRING_SVTOOLS_RTF_PICH "\\pich"
+#define OOO_STRING_SVTOOLS_RTF_PICHGOAL "\\pichgoal"
+#define OOO_STRING_SVTOOLS_RTF_PICSCALED "\\picscaled"
+#define OOO_STRING_SVTOOLS_RTF_PICSCALEX "\\picscalex"
+#define OOO_STRING_SVTOOLS_RTF_PICSCALEY "\\picscaley"
+#define OOO_STRING_SVTOOLS_RTF_PICT "\\pict"
+#define OOO_STRING_SVTOOLS_RTF_PICW "\\picw"
+#define OOO_STRING_SVTOOLS_RTF_PICWGOAL "\\picwgoal"
+#define OOO_STRING_SVTOOLS_RTF_PLAIN "\\plain"
+#define OOO_STRING_SVTOOLS_RTF_PMMETAFILE "\\pmmetafile"
+#define OOO_STRING_SVTOOLS_RTF_POSNEGX "\\posnegx"
+#define OOO_STRING_SVTOOLS_RTF_POSNEGY "\\posnegy"
+#define OOO_STRING_SVTOOLS_RTF_POSX "\\posx"
+#define OOO_STRING_SVTOOLS_RTF_POSXC "\\posxc"
+#define OOO_STRING_SVTOOLS_RTF_POSXI "\\posxi"
+#define OOO_STRING_SVTOOLS_RTF_POSXL "\\posxl"
+#define OOO_STRING_SVTOOLS_RTF_POSXO "\\posxo"
+#define OOO_STRING_SVTOOLS_RTF_POSXR "\\posxr"
+#define OOO_STRING_SVTOOLS_RTF_POSY "\\posy"
+#define OOO_STRING_SVTOOLS_RTF_POSYB "\\posyb"
+#define OOO_STRING_SVTOOLS_RTF_POSYC "\\posyc"
+#define OOO_STRING_SVTOOLS_RTF_POSYIL "\\posyil"
+#define OOO_STRING_SVTOOLS_RTF_POSYT "\\posyt"
+#define OOO_STRING_SVTOOLS_RTF_PRINTIM "\\printim"
+#define OOO_STRING_SVTOOLS_RTF_PSOVER "\\psover"
+#define OOO_STRING_SVTOOLS_RTF_PVMRG "\\pvmrg"
+#define OOO_STRING_SVTOOLS_RTF_PVPARA "\\pvpara"
+#define OOO_STRING_SVTOOLS_RTF_PVPG "\\pvpg"
+#define OOO_STRING_SVTOOLS_RTF_QC "\\qc"
+#define OOO_STRING_SVTOOLS_RTF_QJ "\\qj"
+#define OOO_STRING_SVTOOLS_RTF_QL "\\ql"
+#define OOO_STRING_SVTOOLS_RTF_QR "\\qr"
+#define OOO_STRING_SVTOOLS_RTF_RDBLQUOTE "\\rdblquote"
+#define OOO_STRING_SVTOOLS_RTF_RED "\\red"
+#define OOO_STRING_SVTOOLS_RTF_REVBAR "\\revbar"
+#define OOO_STRING_SVTOOLS_RTF_REVISED "\\revised"
+#define OOO_STRING_SVTOOLS_RTF_REVISIONS "\\revisions"
+#define OOO_STRING_SVTOOLS_RTF_REVPROP "\\revprop"
+#define OOO_STRING_SVTOOLS_RTF_REVTIM "\\revtim"
+#define OOO_STRING_SVTOOLS_RTF_RI "\\ri"
+#define OOO_STRING_SVTOOLS_RTF_RIN "\\rin"
+#define OOO_STRING_SVTOOLS_RTF_ROW "\\row"
+#define OOO_STRING_SVTOOLS_RTF_RQUOTE "\\rquote"
+#define OOO_STRING_SVTOOLS_RTF_RTF "\\rtf"
+#define OOO_STRING_SVTOOLS_RTF_RXE "\\rxe"
+#define OOO_STRING_SVTOOLS_RTF_S "\\s"
+#define OOO_STRING_SVTOOLS_RTF_SA "\\sa"
+#define OOO_STRING_SVTOOLS_RTF_SB "\\sb"
+#define OOO_STRING_SVTOOLS_RTF_SBASEDON "\\sbasedon"
+#define OOO_STRING_SVTOOLS_RTF_SBKCOL "\\sbkcol"
+#define OOO_STRING_SVTOOLS_RTF_SBKEVEN "\\sbkeven"
+#define OOO_STRING_SVTOOLS_RTF_SBKNONE "\\sbknone"
+#define OOO_STRING_SVTOOLS_RTF_SBKODD "\\sbkodd"
+#define OOO_STRING_SVTOOLS_RTF_SBKPAGE "\\sbkpage"
+#define OOO_STRING_SVTOOLS_RTF_SBYS "\\sbys"
+#define OOO_STRING_SVTOOLS_RTF_SCAPS "\\scaps"
+#define OOO_STRING_SVTOOLS_RTF_SECT "\\sect"
+#define OOO_STRING_SVTOOLS_RTF_SECTD "\\sectd"
+#define OOO_STRING_SVTOOLS_RTF_SHAD "\\shad"
+#define OOO_STRING_SVTOOLS_RTF_SHADING "\\shading"
+#define OOO_STRING_SVTOOLS_RTF_SHIFT "\\shift"
+#define OOO_STRING_SVTOOLS_RTF_SL "\\sl"
+#define OOO_STRING_SVTOOLS_RTF_SNEXT "\\snext"
+#define OOO_STRING_SVTOOLS_RTF_STRIKE "\\strike"
+#define OOO_STRING_SVTOOLS_RTF_STYLESHEET "\\stylesheet"
+#define OOO_STRING_SVTOOLS_RTF_SUB "\\sub"
+#define OOO_STRING_SVTOOLS_RTF_SUBJECT "\\subject"
+#define OOO_STRING_SVTOOLS_RTF_SUPER "\\super"
+#define OOO_STRING_SVTOOLS_RTF_TAB "\\tab"
+#define OOO_STRING_SVTOOLS_RTF_TB "\\tb"
+#define OOO_STRING_SVTOOLS_RTF_TC "\\tc"
+#define OOO_STRING_SVTOOLS_RTF_TCF "\\tcf"
+#define OOO_STRING_SVTOOLS_RTF_TCL "\\tcl"
+#define OOO_STRING_SVTOOLS_RTF_TEMPLATE "\\template"
+#define OOO_STRING_SVTOOLS_RTF_TITLE "\\title"
+#define OOO_STRING_SVTOOLS_RTF_TITLEPG "\\titlepg"
+#define OOO_STRING_SVTOOLS_RTF_TLDOT "\\tldot"
+#define OOO_STRING_SVTOOLS_RTF_TLEQ "\\tleq"
+#define OOO_STRING_SVTOOLS_RTF_TLHYPH "\\tlhyph"
+#define OOO_STRING_SVTOOLS_RTF_TLTH "\\tlth"
+#define OOO_STRING_SVTOOLS_RTF_TLUL "\\tlul"
+#define OOO_STRING_SVTOOLS_RTF_TQC "\\tqc"
+#define OOO_STRING_SVTOOLS_RTF_TQDEC "\\tqdec"
+#define OOO_STRING_SVTOOLS_RTF_TQR "\\tqr"
+#define OOO_STRING_SVTOOLS_RTF_TQL "\\tql"
+#define OOO_STRING_SVTOOLS_RTF_TRGAPH "\\trgaph"
+#define OOO_STRING_SVTOOLS_RTF_TRLEFT "\\trleft"
+#define OOO_STRING_SVTOOLS_RTF_TROWD "\\trowd"
+#define OOO_STRING_SVTOOLS_RTF_TRQC "\\trqc"
+#define OOO_STRING_SVTOOLS_RTF_TRQL "\\trql"
+#define OOO_STRING_SVTOOLS_RTF_TRQR "\\trqr"
+#define OOO_STRING_SVTOOLS_RTF_TRRH "\\trrh"
+#define OOO_STRING_SVTOOLS_RTF_TX "\\tx"
+#define OOO_STRING_SVTOOLS_RTF_TXE "\\txe"
+#define OOO_STRING_SVTOOLS_RTF_UL "\\ul"
+#define OOO_STRING_SVTOOLS_RTF_ULD "\\uld"
+#define OOO_STRING_SVTOOLS_RTF_ULDB "\\uldb"
+#define OOO_STRING_SVTOOLS_RTF_ULNONE "\\ulnone"
+#define OOO_STRING_SVTOOLS_RTF_ULW "\\ulw"
+#define OOO_STRING_SVTOOLS_RTF_UP "\\up"
+#define OOO_STRING_SVTOOLS_RTF_V "\\v"
+#define OOO_STRING_SVTOOLS_RTF_VERN "\\vern"
+#define OOO_STRING_SVTOOLS_RTF_VERSION "\\version"
+#define OOO_STRING_SVTOOLS_RTF_VERTALB "\\vertalb"
+#define OOO_STRING_SVTOOLS_RTF_VERTALC "\\vertalc"
+#define OOO_STRING_SVTOOLS_RTF_VERTALJ "\\vertalj"
+#define OOO_STRING_SVTOOLS_RTF_VERTALT "\\vertalt"
+#define OOO_STRING_SVTOOLS_RTF_WBITMAP "\\wbitmap"
+#define OOO_STRING_SVTOOLS_RTF_WBMBITSPIXEL "\\wbmbitspixel"
+#define OOO_STRING_SVTOOLS_RTF_WBMPLANES "\\wbmplanes"
+#define OOO_STRING_SVTOOLS_RTF_WBMWIDTHBYTES "\\wbmwidthbytes"
+#define OOO_STRING_SVTOOLS_RTF_WIDOWCTRL "\\widowctrl"
+#define OOO_STRING_SVTOOLS_RTF_WMETAFILE "\\wmetafile"
+#define OOO_STRING_SVTOOLS_RTF_XE "\\xe"
+#define OOO_STRING_SVTOOLS_RTF_YR "\\yr"
+#define OOO_STRING_SVTOOLS_RTF_NOBRKHYPH "\\_"
+#define OOO_STRING_SVTOOLS_RTF_FORMULA "\\|"
+#define OOO_STRING_SVTOOLS_RTF_NOBREAK "\\~"
+#define OOO_STRING_SVTOOLS_RTF_AB "\\ab"
+#define OOO_STRING_SVTOOLS_RTF_ACAPS "\\acaps"
+#define OOO_STRING_SVTOOLS_RTF_ACF "\\acf"
+#define OOO_STRING_SVTOOLS_RTF_ADDITIVE "\\additive"
+#define OOO_STRING_SVTOOLS_RTF_ADN "\\adn"
+#define OOO_STRING_SVTOOLS_RTF_AENDDOC "\\aenddoc"
+#define OOO_STRING_SVTOOLS_RTF_AENDNOTES "\\aendnotes"
+#define OOO_STRING_SVTOOLS_RTF_AEXPND "\\aexpnd"
+#define OOO_STRING_SVTOOLS_RTF_AF "\\af"
+#define OOO_STRING_SVTOOLS_RTF_AFS "\\afs"
+#define OOO_STRING_SVTOOLS_RTF_AFTNBJ "\\aftnbj"
+#define OOO_STRING_SVTOOLS_RTF_AFTNCN "\\aftncn"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNALC "\\aftnnalc"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNAR "\\aftnnar"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNAUC "\\aftnnauc"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNCHI "\\aftnnchi"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNRLC "\\aftnnrlc"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNRUC "\\aftnnruc"
+#define OOO_STRING_SVTOOLS_RTF_AFTNRESTART "\\aftnrestart"
+#define OOO_STRING_SVTOOLS_RTF_AFTNRSTCONT "\\aftnrstcont"
+#define OOO_STRING_SVTOOLS_RTF_AFTNSEP "\\aftnsep"
+#define OOO_STRING_SVTOOLS_RTF_AFTNSEPC "\\aftnsepc"
+#define OOO_STRING_SVTOOLS_RTF_AFTNSTART "\\aftnstart"
+#define OOO_STRING_SVTOOLS_RTF_AFTNTJ "\\aftntj"
+#define OOO_STRING_SVTOOLS_RTF_AI "\\ai"
+#define OOO_STRING_SVTOOLS_RTF_ALANG "\\alang"
+#define OOO_STRING_SVTOOLS_RTF_ALLPROT "\\allprot"
+#define OOO_STRING_SVTOOLS_RTF_ANNOTPROT "\\annotprot"
+#define OOO_STRING_SVTOOLS_RTF_AOUTL "\\aoutl"
+#define OOO_STRING_SVTOOLS_RTF_ASCAPS "\\ascaps"
+#define OOO_STRING_SVTOOLS_RTF_ASHAD "\\ashad"
+#define OOO_STRING_SVTOOLS_RTF_ASTRIKE "\\astrike"
+#define OOO_STRING_SVTOOLS_RTF_ATNAUTHOR "\\atnauthor"
+#define OOO_STRING_SVTOOLS_RTF_ATNICN "\\atnicn"
+#define OOO_STRING_SVTOOLS_RTF_ATNREF "\\atnref"
+#define OOO_STRING_SVTOOLS_RTF_ATNTIME "\\atntime"
+#define OOO_STRING_SVTOOLS_RTF_ATRFEND "\\atrfend"
+#define OOO_STRING_SVTOOLS_RTF_ATRFSTART "\\atrfstart"
+#define OOO_STRING_SVTOOLS_RTF_AUL "\\aul"
+#define OOO_STRING_SVTOOLS_RTF_AULD "\\auld"
+#define OOO_STRING_SVTOOLS_RTF_AULDB "\\auldb"
+#define OOO_STRING_SVTOOLS_RTF_AULNONE "\\aulnone"
+#define OOO_STRING_SVTOOLS_RTF_AULW "\\aulw"
+#define OOO_STRING_SVTOOLS_RTF_AUP "\\aup"
+#define OOO_STRING_SVTOOLS_RTF_BKMKPUB "\\bkmkpub"
+#define OOO_STRING_SVTOOLS_RTF_BRDRDASH "\\brdrdash"
+#define OOO_STRING_SVTOOLS_RTF_BRKFRM "\\brkfrm"
+#define OOO_STRING_SVTOOLS_RTF_CCHS "\\cchs"
+#define OOO_STRING_SVTOOLS_RTF_CPG "\\cpg"
+#define OOO_STRING_SVTOOLS_RTF_CS "\\cs"
+#define OOO_STRING_SVTOOLS_RTF_CVMME "\\cvmme"
+#define OOO_STRING_SVTOOLS_RTF_DATAFIELD "\\datafield"
+#define OOO_STRING_SVTOOLS_RTF_DO "\\do"
+#define OOO_STRING_SVTOOLS_RTF_DOBXCOLUMN "\\dobxcolumn"
+#define OOO_STRING_SVTOOLS_RTF_DOBXMARGIN "\\dobxmargin"
+#define OOO_STRING_SVTOOLS_RTF_DOBXPAGE "\\dobxpage"
+#define OOO_STRING_SVTOOLS_RTF_DOBYMARGIN "\\dobymargin"
+#define OOO_STRING_SVTOOLS_RTF_DOBYPAGE "\\dobypage"
+#define OOO_STRING_SVTOOLS_RTF_DOBYPARA "\\dobypara"
+#define OOO_STRING_SVTOOLS_RTF_DODHGT "\\dodhgt"
+#define OOO_STRING_SVTOOLS_RTF_DOLOCK "\\dolock"
+#define OOO_STRING_SVTOOLS_RTF_DPAENDHOL "\\dpaendhol"
+#define OOO_STRING_SVTOOLS_RTF_DPAENDL "\\dpaendl"
+#define OOO_STRING_SVTOOLS_RTF_DPAENDSOL "\\dpaendsol"
+#define OOO_STRING_SVTOOLS_RTF_DPAENDW "\\dpaendw"
+#define OOO_STRING_SVTOOLS_RTF_DPARC "\\dparc"
+#define OOO_STRING_SVTOOLS_RTF_DPARCFLIPX "\\dparcflipx"
+#define OOO_STRING_SVTOOLS_RTF_DPARCFLIPY "\\dparcflipy"
+#define OOO_STRING_SVTOOLS_RTF_DPASTARTHOL "\\dpastarthol"
+#define OOO_STRING_SVTOOLS_RTF_DPASTARTL "\\dpastartl"
+#define OOO_STRING_SVTOOLS_RTF_DPASTARTSOL "\\dpastartsol"
+#define OOO_STRING_SVTOOLS_RTF_DPASTARTW "\\dpastartw"
+#define OOO_STRING_SVTOOLS_RTF_DPCALLOUT "\\dpcallout"
+#define OOO_STRING_SVTOOLS_RTF_DPCOA "\\dpcoa"
+#define OOO_STRING_SVTOOLS_RTF_DPCOACCENT "\\dpcoaccent"
+#define OOO_STRING_SVTOOLS_RTF_DPCOBESTFIT "\\dpcobestfit"
+#define OOO_STRING_SVTOOLS_RTF_DPCOBORDER "\\dpcoborder"
+#define OOO_STRING_SVTOOLS_RTF_DPCODABS "\\dpcodabs"
+#define OOO_STRING_SVTOOLS_RTF_DPCODBOTTOM "\\dpcodbottom"
+#define OOO_STRING_SVTOOLS_RTF_DPCODCENTER "\\dpcodcenter"
+#define OOO_STRING_SVTOOLS_RTF_DPCODTOP "\\dpcodtop"
+#define OOO_STRING_SVTOOLS_RTF_DPCOLENGTH "\\dpcolength"
+#define OOO_STRING_SVTOOLS_RTF_DPCOMINUSX "\\dpcominusx"
+#define OOO_STRING_SVTOOLS_RTF_DPCOMINUSY "\\dpcominusy"
+#define OOO_STRING_SVTOOLS_RTF_DPCOOFFSET "\\dpcooffset"
+#define OOO_STRING_SVTOOLS_RTF_DPCOSMARTA "\\dpcosmarta"
+#define OOO_STRING_SVTOOLS_RTF_DPCOTDOUBLE "\\dpcotdouble"
+#define OOO_STRING_SVTOOLS_RTF_DPCOTRIGHT "\\dpcotright"
+#define OOO_STRING_SVTOOLS_RTF_DPCOTSINGLE "\\dpcotsingle"
+#define OOO_STRING_SVTOOLS_RTF_DPCOTTRIPLE "\\dpcottriple"
+#define OOO_STRING_SVTOOLS_RTF_DPCOUNT "\\dpcount"
+#define OOO_STRING_SVTOOLS_RTF_DPELLIPSE "\\dpellipse"
+#define OOO_STRING_SVTOOLS_RTF_DPENDGROUP "\\dpendgroup"
+#define OOO_STRING_SVTOOLS_RTF_DPFILLBGCB "\\dpfillbgcb"
+#define OOO_STRING_SVTOOLS_RTF_DPFILLBGCG "\\dpfillbgcg"
+#define OOO_STRING_SVTOOLS_RTF_DPFILLBGCR "\\dpfillbgcr"
+#define OOO_STRING_SVTOOLS_RTF_DPFILLBGGRAY "\\dpfillbggray"
+#define OOO_STRING_SVTOOLS_RTF_DPFILLBGPAL "\\dpfillbgpal"
+#define OOO_STRING_SVTOOLS_RTF_DPFILLFGCB "\\dpfillfgcb"
+#define OOO_STRING_SVTOOLS_RTF_DPFILLFGCG "\\dpfillfgcg"
+#define OOO_STRING_SVTOOLS_RTF_DPFILLFGCR "\\dpfillfgcr"
+#define OOO_STRING_SVTOOLS_RTF_DPFILLFGGRAY "\\dpfillfggray"
+#define OOO_STRING_SVTOOLS_RTF_DPFILLFGPAL "\\dpfillfgpal"
+#define OOO_STRING_SVTOOLS_RTF_DPFILLPAT "\\dpfillpat"
+#define OOO_STRING_SVTOOLS_RTF_DPGROUP "\\dpgroup"
+#define OOO_STRING_SVTOOLS_RTF_DPLINE "\\dpline"
+#define OOO_STRING_SVTOOLS_RTF_DPLINECOB "\\dplinecob"
+#define OOO_STRING_SVTOOLS_RTF_DPLINECOG "\\dplinecog"
+#define OOO_STRING_SVTOOLS_RTF_DPLINECOR "\\dplinecor"
+#define OOO_STRING_SVTOOLS_RTF_DPLINEDADO "\\dplinedado"
+#define OOO_STRING_SVTOOLS_RTF_DPLINEDADODO "\\dplinedadodo"
+#define OOO_STRING_SVTOOLS_RTF_DPLINEDASH "\\dplinedash"
+#define OOO_STRING_SVTOOLS_RTF_DPLINEDOT "\\dplinedot"
+#define OOO_STRING_SVTOOLS_RTF_DPLINEGRAY "\\dplinegray"
+#define OOO_STRING_SVTOOLS_RTF_DPLINEHOLLOW "\\dplinehollow"
+#define OOO_STRING_SVTOOLS_RTF_DPLINEPAL "\\dplinepal"
+#define OOO_STRING_SVTOOLS_RTF_DPLINESOLID "\\dplinesolid"
+#define OOO_STRING_SVTOOLS_RTF_DPLINEW "\\dplinew"
+#define OOO_STRING_SVTOOLS_RTF_DPPOLYCOUNT "\\dppolycount"
+#define OOO_STRING_SVTOOLS_RTF_DPPOLYGON "\\dppolygon"
+#define OOO_STRING_SVTOOLS_RTF_DPPOLYLINE "\\dppolyline"
+#define OOO_STRING_SVTOOLS_RTF_DPPTX "\\dpptx"
+#define OOO_STRING_SVTOOLS_RTF_DPPTY "\\dppty"
+#define OOO_STRING_SVTOOLS_RTF_DPRECT "\\dprect"
+#define OOO_STRING_SVTOOLS_RTF_DPROUNDR "\\dproundr"
+#define OOO_STRING_SVTOOLS_RTF_DPSHADOW "\\dpshadow"
+#define OOO_STRING_SVTOOLS_RTF_DPSHADX "\\dpshadx"
+#define OOO_STRING_SVTOOLS_RTF_DPSHADY "\\dpshady"
+#define OOO_STRING_SVTOOLS_RTF_DPTXBX "\\dptxbx"
+#define OOO_STRING_SVTOOLS_RTF_DPTXBXMAR "\\dptxbxmar"
+#define OOO_STRING_SVTOOLS_RTF_DPTXBXTEXT "\\dptxbxtext"
+#define OOO_STRING_SVTOOLS_RTF_DPX "\\dpx"
+#define OOO_STRING_SVTOOLS_RTF_DPXSIZE "\\dpxsize"
+#define OOO_STRING_SVTOOLS_RTF_DPY "\\dpy"
+#define OOO_STRING_SVTOOLS_RTF_DPYSIZE "\\dpysize"
+#define OOO_STRING_SVTOOLS_RTF_DS "\\ds"
+#define OOO_STRING_SVTOOLS_RTF_EMSPACE "\\emspace"
+#define OOO_STRING_SVTOOLS_RTF_ENSPACE "\\enspace"
+#define OOO_STRING_SVTOOLS_RTF_FBIDI "\\fbidi"
+#define OOO_STRING_SVTOOLS_RTF_FET "\\fet"
+#define OOO_STRING_SVTOOLS_RTF_FID "\\fid"
+#define OOO_STRING_SVTOOLS_RTF_FILE "\\file"
+#define OOO_STRING_SVTOOLS_RTF_FILETBL "\\filetbl"
+#define OOO_STRING_SVTOOLS_RTF_FLDALT "\\fldalt"
+#define OOO_STRING_SVTOOLS_RTF_FNETWORK "\\fnetwork"
+#define OOO_STRING_SVTOOLS_RTF_FONTEMB "\\fontemb"
+#define OOO_STRING_SVTOOLS_RTF_FONTFILE "\\fontfile"
+#define OOO_STRING_SVTOOLS_RTF_FORMDISP "\\formdisp"
+#define OOO_STRING_SVTOOLS_RTF_FORMPROT "\\formprot"
+#define OOO_STRING_SVTOOLS_RTF_FORMSHADE "\\formshade"
+#define OOO_STRING_SVTOOLS_RTF_FOSNUM "\\fosnum"
+#define OOO_STRING_SVTOOLS_RTF_FRELATIVE "\\frelative"
+#define OOO_STRING_SVTOOLS_RTF_FTNALT "\\ftnalt"
+#define OOO_STRING_SVTOOLS_RTF_FTNIL "\\ftnil"
+#define OOO_STRING_SVTOOLS_RTF_FTNNALC "\\ftnnalc"
+#define OOO_STRING_SVTOOLS_RTF_FTNNAR "\\ftnnar"
+#define OOO_STRING_SVTOOLS_RTF_FTNNAUC "\\ftnnauc"
+#define OOO_STRING_SVTOOLS_RTF_FTNNCHI "\\ftnnchi"
+#define OOO_STRING_SVTOOLS_RTF_FTNNRLC "\\ftnnrlc"
+#define OOO_STRING_SVTOOLS_RTF_FTNNRUC "\\ftnnruc"
+#define OOO_STRING_SVTOOLS_RTF_FTNRSTCONT "\\ftnrstcont"
+#define OOO_STRING_SVTOOLS_RTF_FTNRSTPG "\\ftnrstpg"
+#define OOO_STRING_SVTOOLS_RTF_FTTRUETYPE "\\fttruetype"
+#define OOO_STRING_SVTOOLS_RTF_FVALIDDOS "\\fvaliddos"
+#define OOO_STRING_SVTOOLS_RTF_FVALIDHPFS "\\fvalidhpfs"
+#define OOO_STRING_SVTOOLS_RTF_FVALIDMAC "\\fvalidmac"
+#define OOO_STRING_SVTOOLS_RTF_FVALIDNTFS "\\fvalidntfs"
+#define OOO_STRING_SVTOOLS_RTF_HYPHAUTO "\\hyphauto"
+#define OOO_STRING_SVTOOLS_RTF_HYPHCAPS "\\hyphcaps"
+#define OOO_STRING_SVTOOLS_RTF_HYPHCONSEC "\\hyphconsec"
+#define OOO_STRING_SVTOOLS_RTF_HYPHPAR "\\hyphpar"
+#define OOO_STRING_SVTOOLS_RTF_LINKSELF "\\linkself"
+#define OOO_STRING_SVTOOLS_RTF_LINKSTYLES "\\linkstyles"
+#define OOO_STRING_SVTOOLS_RTF_LTRCH "\\ltrch"
+#define OOO_STRING_SVTOOLS_RTF_LTRDOC "\\ltrdoc"
+#define OOO_STRING_SVTOOLS_RTF_LTRMARK "\\ltrmark"
+#define OOO_STRING_SVTOOLS_RTF_LTRPAR "\\ltrpar"
+#define OOO_STRING_SVTOOLS_RTF_LTRROW "\\ltrrow"
+#define OOO_STRING_SVTOOLS_RTF_LTRSECT "\\ltrsect"
+#define OOO_STRING_SVTOOLS_RTF_NOCOLBAL "\\nocolbal"
+#define OOO_STRING_SVTOOLS_RTF_NOEXTRASPRL "\\noextrasprl"
+#define OOO_STRING_SVTOOLS_RTF_NOTABIND "\\notabind"
+#define OOO_STRING_SVTOOLS_RTF_NOWIDCTLPAR "\\nowidctlpar"
+#define OOO_STRING_SVTOOLS_RTF_OBJALIAS "\\objalias"
+#define OOO_STRING_SVTOOLS_RTF_OBJALIGN "\\objalign"
+#define OOO_STRING_SVTOOLS_RTF_OBJAUTLINK "\\objautlink"
+#define OOO_STRING_SVTOOLS_RTF_OBJCLASS "\\objclass"
+#define OOO_STRING_SVTOOLS_RTF_OBJCROPB "\\objcropb"
+#define OOO_STRING_SVTOOLS_RTF_OBJCROPL "\\objcropl"
+#define OOO_STRING_SVTOOLS_RTF_OBJCROPR "\\objcropr"
+#define OOO_STRING_SVTOOLS_RTF_OBJCROPT "\\objcropt"
+#define OOO_STRING_SVTOOLS_RTF_OBJDATA "\\objdata"
+#define OOO_STRING_SVTOOLS_RTF_OBJECT "\\object"
+#define OOO_STRING_SVTOOLS_RTF_OBJEMB "\\objemb"
+#define OOO_STRING_SVTOOLS_RTF_OBJH "\\objh"
+#define OOO_STRING_SVTOOLS_RTF_OBJICEMB "\\objicemb"
+#define OOO_STRING_SVTOOLS_RTF_OBJLINK "\\objlink"
+#define OOO_STRING_SVTOOLS_RTF_OBJLOCK "\\objlock"
+#define OOO_STRING_SVTOOLS_RTF_OBJNAME "\\objname"
+#define OOO_STRING_SVTOOLS_RTF_OBJPUB "\\objpub"
+#define OOO_STRING_SVTOOLS_RTF_OBJSCALEX "\\objscalex"
+#define OOO_STRING_SVTOOLS_RTF_OBJSCALEY "\\objscaley"
+#define OOO_STRING_SVTOOLS_RTF_OBJSECT "\\objsect"
+#define OOO_STRING_SVTOOLS_RTF_OBJSETSIZE "\\objsetsize"
+#define OOO_STRING_SVTOOLS_RTF_OBJSUB "\\objsub"
+#define OOO_STRING_SVTOOLS_RTF_OBJTIME "\\objtime"
+#define OOO_STRING_SVTOOLS_RTF_OBJTRANSY "\\objtransy"
+#define OOO_STRING_SVTOOLS_RTF_OBJUPDATE "\\objupdate"
+#define OOO_STRING_SVTOOLS_RTF_OBJW "\\objw"
+#define OOO_STRING_SVTOOLS_RTF_OTBLRUL "\\otblrul"
+#define OOO_STRING_SVTOOLS_RTF_PGNHN "\\pgnhn"
+#define OOO_STRING_SVTOOLS_RTF_PGNHNSC "\\pgnhnsc"
+#define OOO_STRING_SVTOOLS_RTF_PGNHNSH "\\pgnhnsh"
+#define OOO_STRING_SVTOOLS_RTF_PGNHNSM "\\pgnhnsm"
+#define OOO_STRING_SVTOOLS_RTF_PGNHNSN "\\pgnhnsn"
+#define OOO_STRING_SVTOOLS_RTF_PGNHNSP "\\pgnhnsp"
+#define OOO_STRING_SVTOOLS_RTF_PICBMP "\\picbmp"
+#define OOO_STRING_SVTOOLS_RTF_PICBPP "\\picbpp"
+#define OOO_STRING_SVTOOLS_RTF_PN "\\pn"
+#define OOO_STRING_SVTOOLS_RTF_PNACROSS "\\pnacross"
+#define OOO_STRING_SVTOOLS_RTF_PNB "\\pnb"
+#define OOO_STRING_SVTOOLS_RTF_PNCAPS "\\pncaps"
+#define OOO_STRING_SVTOOLS_RTF_PNCARD "\\pncard"
+#define OOO_STRING_SVTOOLS_RTF_PNCF "\\pncf"
+#define OOO_STRING_SVTOOLS_RTF_PNDEC "\\pndec"
+#define OOO_STRING_SVTOOLS_RTF_PNF "\\pnf"
+#define OOO_STRING_SVTOOLS_RTF_PNFS "\\pnfs"
+#define OOO_STRING_SVTOOLS_RTF_PNHANG "\\pnhang"
+#define OOO_STRING_SVTOOLS_RTF_PNI "\\pni"
+#define OOO_STRING_SVTOOLS_RTF_PNINDENT "\\pnindent"
+#define OOO_STRING_SVTOOLS_RTF_PNLCLTR "\\pnlcltr"
+#define OOO_STRING_SVTOOLS_RTF_PNLCRM "\\pnlcrm"
+#define OOO_STRING_SVTOOLS_RTF_PNLVL "\\pnlvl"
+#define OOO_STRING_SVTOOLS_RTF_PNLVLBLT "\\pnlvlblt"
+#define OOO_STRING_SVTOOLS_RTF_PNLVLBODY "\\pnlvlbody"
+#define OOO_STRING_SVTOOLS_RTF_PNLVLCONT "\\pnlvlcont"
+#define OOO_STRING_SVTOOLS_RTF_PNNUMONCE "\\pnnumonce"
+#define OOO_STRING_SVTOOLS_RTF_PNORD "\\pnord"
+#define OOO_STRING_SVTOOLS_RTF_PNORDT "\\pnordt"
+#define OOO_STRING_SVTOOLS_RTF_PNPREV "\\pnprev"
+#define OOO_STRING_SVTOOLS_RTF_PNQC "\\pnqc"
+#define OOO_STRING_SVTOOLS_RTF_PNQL "\\pnql"
+#define OOO_STRING_SVTOOLS_RTF_PNQR "\\pnqr"
+#define OOO_STRING_SVTOOLS_RTF_PNRESTART "\\pnrestart"
+#define OOO_STRING_SVTOOLS_RTF_PNSCAPS "\\pnscaps"
+#define OOO_STRING_SVTOOLS_RTF_PNSECLVL "\\pnseclvl"
+#define OOO_STRING_SVTOOLS_RTF_PNSP "\\pnsp"
+#define OOO_STRING_SVTOOLS_RTF_PNSTART "\\pnstart"
+#define OOO_STRING_SVTOOLS_RTF_PNSTRIKE "\\pnstrike"
+#define OOO_STRING_SVTOOLS_RTF_PNTEXT "\\pntext"
+#define OOO_STRING_SVTOOLS_RTF_PNTXTA "\\pntxta"
+#define OOO_STRING_SVTOOLS_RTF_PNTXTB "\\pntxtb"
+#define OOO_STRING_SVTOOLS_RTF_PNUCLTR "\\pnucltr"
+#define OOO_STRING_SVTOOLS_RTF_PNUCRM "\\pnucrm"
+#define OOO_STRING_SVTOOLS_RTF_PNUL "\\pnul"
+#define OOO_STRING_SVTOOLS_RTF_PNULD "\\pnuld"
+#define OOO_STRING_SVTOOLS_RTF_PNULDB "\\pnuldb"
+#define OOO_STRING_SVTOOLS_RTF_PNULNONE "\\pnulnone"
+#define OOO_STRING_SVTOOLS_RTF_PNULW "\\pnulw"
+#define OOO_STRING_SVTOOLS_RTF_PRCOLBL "\\prcolbl"
+#define OOO_STRING_SVTOOLS_RTF_PRINTDATA "\\printdata"
+#define OOO_STRING_SVTOOLS_RTF_PSZ "\\psz"
+#define OOO_STRING_SVTOOLS_RTF_PUBAUTO "\\pubauto"
+#define OOO_STRING_SVTOOLS_RTF_RESULT "\\result"
+#define OOO_STRING_SVTOOLS_RTF_REVAUTH "\\revauth"
+#define OOO_STRING_SVTOOLS_RTF_REVDTTM "\\revdttm"
+#define OOO_STRING_SVTOOLS_RTF_REVPROT "\\revprot"
+#define OOO_STRING_SVTOOLS_RTF_REVTBL "\\revtbl"
+#define OOO_STRING_SVTOOLS_RTF_RSLTBMP "\\rsltbmp"
+#define OOO_STRING_SVTOOLS_RTF_RSLTMERGE "\\rsltmerge"
+#define OOO_STRING_SVTOOLS_RTF_RSLTPICT "\\rsltpict"
+#define OOO_STRING_SVTOOLS_RTF_RSLTRTF "\\rsltrtf"
+#define OOO_STRING_SVTOOLS_RTF_RSLTTXT "\\rslttxt"
+#define OOO_STRING_SVTOOLS_RTF_RTLCH "\\rtlch"
+#define OOO_STRING_SVTOOLS_RTF_RTLDOC "\\rtldoc"
+#define OOO_STRING_SVTOOLS_RTF_RTLMARK "\\rtlmark"
+#define OOO_STRING_SVTOOLS_RTF_RTLPAR "\\rtlpar"
+#define OOO_STRING_SVTOOLS_RTF_RTLROW "\\rtlrow"
+#define OOO_STRING_SVTOOLS_RTF_RTLSECT "\\rtlsect"
+#define OOO_STRING_SVTOOLS_RTF_SEC "\\sec"
+#define OOO_STRING_SVTOOLS_RTF_SECTNUM "\\sectnum"
+#define OOO_STRING_SVTOOLS_RTF_SECTUNLOCKED "\\sectunlocked"
+#define OOO_STRING_SVTOOLS_RTF_SLMULT "\\slmult"
+#define OOO_STRING_SVTOOLS_RTF_SOFTCOL "\\softcol"
+#define OOO_STRING_SVTOOLS_RTF_SOFTLHEIGHT "\\softlheight"
+#define OOO_STRING_SVTOOLS_RTF_SOFTLINE "\\softline"
+#define OOO_STRING_SVTOOLS_RTF_SOFTPAGE "\\softpage"
+#define OOO_STRING_SVTOOLS_RTF_SPRSSPBF "\\sprsspbf"
+#define OOO_STRING_SVTOOLS_RTF_SPRSTSP "\\sprstsp"
+#define OOO_STRING_SVTOOLS_RTF_SUBDOCUMENT "\\subdocument"
+#define OOO_STRING_SVTOOLS_RTF_SWPBDR "\\swpbdr"
+#define OOO_STRING_SVTOOLS_RTF_TCN "\\tcn"
+#define OOO_STRING_SVTOOLS_RTF_TRANSMF "\\transmf"
+#define OOO_STRING_SVTOOLS_RTF_TRBRDRB "\\trbrdrb"
+#define OOO_STRING_SVTOOLS_RTF_TRBRDRH "\\trbrdrh"
+#define OOO_STRING_SVTOOLS_RTF_TRBRDRL "\\trbrdrl"
+#define OOO_STRING_SVTOOLS_RTF_TRBRDRR "\\trbrdrr"
+#define OOO_STRING_SVTOOLS_RTF_TRBRDRT "\\trbrdrt"
+#define OOO_STRING_SVTOOLS_RTF_TRBRDRV "\\trbrdrv"
+#define OOO_STRING_SVTOOLS_RTF_TRHDR "\\trhdr"
+#define OOO_STRING_SVTOOLS_RTF_TRKEEP "\\trkeep"
+#define OOO_STRING_SVTOOLS_RTF_TRPADDB "\\trpaddb"
+#define OOO_STRING_SVTOOLS_RTF_TRPADDL "\\trpaddl"
+#define OOO_STRING_SVTOOLS_RTF_TRPADDR "\\trpaddr"
+#define OOO_STRING_SVTOOLS_RTF_TRPADDT "\\trpaddt"
+#define OOO_STRING_SVTOOLS_RTF_TRPADDFB "\\trpaddfb"
+#define OOO_STRING_SVTOOLS_RTF_TRPADDFL "\\trpaddfl"
+#define OOO_STRING_SVTOOLS_RTF_TRPADDFR "\\trpaddfr"
+#define OOO_STRING_SVTOOLS_RTF_TRPADDFT "\\trpaddft"
+#define OOO_STRING_SVTOOLS_RTF_WRAPTRSP "\\wraptrsp"
+#define OOO_STRING_SVTOOLS_RTF_XEF "\\xef"
+#define OOO_STRING_SVTOOLS_RTF_ZWJ "\\zwj"
+#define OOO_STRING_SVTOOLS_RTF_ZWNJ "\\zwnj"
+
+// neue Tokens zur 1.5
+#define OOO_STRING_SVTOOLS_RTF_ABSLOCK "\\abslock"
+#define OOO_STRING_SVTOOLS_RTF_ADJUSTRIGHT "\\adjustright"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNCHOSUNG "\\aftnnchosung"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNCNUM "\\aftnncnum"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNDBAR "\\aftnndbar"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNDBNUM "\\aftnndbnum"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNDBNUMD "\\aftnndbnumd"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNDBNUMK "\\aftnndbnumk"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNDBNUMT "\\aftnndbnumt"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNGANADA "\\aftnnganada"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNGBNUM "\\aftnngbnum"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNGBNUMD "\\aftnngbnumd"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNGBNUMK "\\aftnngbnumk"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNGBNUML "\\aftnngbnuml"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNZODIAC "\\aftnnzodiac"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNZODIACD "\\aftnnzodiacd"
+#define OOO_STRING_SVTOOLS_RTF_AFTNNZODIACL "\\aftnnzodiacl"
+#define OOO_STRING_SVTOOLS_RTF_ANIMTEXT "\\animtext"
+#define OOO_STRING_SVTOOLS_RTF_ANSICPG "\\ansicpg"
+#define OOO_STRING_SVTOOLS_RTF_BACKGROUND "\\background"
+#define OOO_STRING_SVTOOLS_RTF_BDBFHDR "\\bdbfhdr"
+#define OOO_STRING_SVTOOLS_RTF_BLIPTAG "\\bliptag"
+#define OOO_STRING_SVTOOLS_RTF_BLIPUID "\\blipuid"
+#define OOO_STRING_SVTOOLS_RTF_BLIPUPI "\\blipupi"
+#define OOO_STRING_SVTOOLS_RTF_BRDRART "\\brdrart"
+#define OOO_STRING_SVTOOLS_RTF_BRDRDASHD "\\brdrdashd"
+#define OOO_STRING_SVTOOLS_RTF_BRDRDASHDD "\\brdrdashdd"
+#define OOO_STRING_SVTOOLS_RTF_BRDRDASHDOTSTR "\\brdrdashdotstr"
+#define OOO_STRING_SVTOOLS_RTF_BRDRDASHSM "\\brdrdashsm"
+#define OOO_STRING_SVTOOLS_RTF_BRDREMBOSS "\\brdremboss"
+#define OOO_STRING_SVTOOLS_RTF_BRDRENGRAVE "\\brdrengrave"
+#define OOO_STRING_SVTOOLS_RTF_BRDROUTSET "\\brdroutset"
+#define OOO_STRING_SVTOOLS_RTF_BRDRINSET "\\brdrinset"
+#define OOO_STRING_SVTOOLS_RTF_BRDRNONE "\\brdrnone"
+#define OOO_STRING_SVTOOLS_RTF_BRDRFRAME "\\brdrframe"
+#define OOO_STRING_SVTOOLS_RTF_BRDRTHTNLG "\\brdrthtnlg"
+#define OOO_STRING_SVTOOLS_RTF_BRDRTHTNMG "\\brdrthtnmg"
+#define OOO_STRING_SVTOOLS_RTF_BRDRTHTNSG "\\brdrthtnsg"
+#define OOO_STRING_SVTOOLS_RTF_BRDRTNTHLG "\\brdrtnthlg"
+#define OOO_STRING_SVTOOLS_RTF_BRDRTNTHMG "\\brdrtnthmg"
+#define OOO_STRING_SVTOOLS_RTF_BRDRTNTHSG "\\brdrtnthsg"
+#define OOO_STRING_SVTOOLS_RTF_BRDRTNTHTNLG "\\brdrtnthtnlg"
+#define OOO_STRING_SVTOOLS_RTF_BRDRTNTHTNMG "\\brdrtnthtnmg"
+#define OOO_STRING_SVTOOLS_RTF_BRDRTNTHTNSG "\\brdrtnthtnsg"
+#define OOO_STRING_SVTOOLS_RTF_BRDRTRIPLE "\\brdrtriple"
+#define OOO_STRING_SVTOOLS_RTF_BRDRWAVY "\\brdrwavy"
+#define OOO_STRING_SVTOOLS_RTF_BRDRWAVYDB "\\brdrwavydb"
+#define OOO_STRING_SVTOOLS_RTF_CATEGORY "\\category"
+#define OOO_STRING_SVTOOLS_RTF_CGRID "\\cgrid"
+#define OOO_STRING_SVTOOLS_RTF_CHARSCALEX "\\charscalex"
+#define OOO_STRING_SVTOOLS_RTF_CHBGBDIAG "\\chbgbdiag"
+#define OOO_STRING_SVTOOLS_RTF_CHBGCROSS "\\chbgcross"
+#define OOO_STRING_SVTOOLS_RTF_CHBGDCROSS "\\chbgdcross"
+#define OOO_STRING_SVTOOLS_RTF_CHBGDKBDIAG "\\chbgdkbdiag"
+#define OOO_STRING_SVTOOLS_RTF_CHBGDKCROSS "\\chbgdkcross"
+#define OOO_STRING_SVTOOLS_RTF_CHBGDKDCROSS "\\chbgdkdcross"
+#define OOO_STRING_SVTOOLS_RTF_CHBGDKFDIAG "\\chbgdkfdiag"
+#define OOO_STRING_SVTOOLS_RTF_CHBGDKHORIZ "\\chbgdkhoriz"
+#define OOO_STRING_SVTOOLS_RTF_CHBGDKVERT "\\chbgdkvert"
+#define OOO_STRING_SVTOOLS_RTF_CHBGFDIAG "\\chbgfdiag"
+#define OOO_STRING_SVTOOLS_RTF_CHBGHORIZ "\\chbghoriz"
+#define OOO_STRING_SVTOOLS_RTF_CHBGVERT "\\chbgvert"
+#define OOO_STRING_SVTOOLS_RTF_CHBRDR "\\chbrdr"
+#define OOO_STRING_SVTOOLS_RTF_CHCBPAT "\\chcbpat"
+#define OOO_STRING_SVTOOLS_RTF_CHCFPAT "\\chcfpat"
+#define OOO_STRING_SVTOOLS_RTF_CHSHDNG "\\chshdng"
+#define OOO_STRING_SVTOOLS_RTF_CLPADL "\\clpadl"
+#define OOO_STRING_SVTOOLS_RTF_CLPADT "\\clpadt"
+#define OOO_STRING_SVTOOLS_RTF_CLPADB "\\clpadb"
+#define OOO_STRING_SVTOOLS_RTF_CLPADR "\\clpadr"
+#define OOO_STRING_SVTOOLS_RTF_CLPADFL "\\clpadfl"
+#define OOO_STRING_SVTOOLS_RTF_CLPADFT "\\clpadft"
+#define OOO_STRING_SVTOOLS_RTF_CLPADFB "\\clpadfb"
+#define OOO_STRING_SVTOOLS_RTF_CLPADFR "\\clpadfr"
+#define OOO_STRING_SVTOOLS_RTF_CLTXLRTB "\\cltxlrtb"
+#define OOO_STRING_SVTOOLS_RTF_CLTXTBRL "\\cltxtbrl"
+#define OOO_STRING_SVTOOLS_RTF_CLVERTALB "\\clvertalb"
+#define OOO_STRING_SVTOOLS_RTF_CLVERTALC "\\clvertalc"
+#define OOO_STRING_SVTOOLS_RTF_CLVERTALT "\\clvertalt"
+#define OOO_STRING_SVTOOLS_RTF_CLVMGF "\\clvmgf"
+#define OOO_STRING_SVTOOLS_RTF_CLVMRG "\\clvmrg"
+#define OOO_STRING_SVTOOLS_RTF_CLTXTBRLV "\\cltxtbrlv"
+#define OOO_STRING_SVTOOLS_RTF_CLTXBTLR "\\cltxbtlr"
+#define OOO_STRING_SVTOOLS_RTF_CLTXLRTBV "\\cltxlrtbv"
+#define OOO_STRING_SVTOOLS_RTF_COMPANY "\\company"
+#define OOO_STRING_SVTOOLS_RTF_CRAUTH "\\crauth"
+#define OOO_STRING_SVTOOLS_RTF_CRDATE "\\crdate"
+#define OOO_STRING_SVTOOLS_RTF_DATE "\\date"
+#define OOO_STRING_SVTOOLS_RTF_DEFLANGFE "\\deflangfe"
+#define OOO_STRING_SVTOOLS_RTF_DFRAUTH "\\dfrauth"
+#define OOO_STRING_SVTOOLS_RTF_DFRDATE "\\dfrdate"
+#define OOO_STRING_SVTOOLS_RTF_DFRSTART "\\dfrstart"
+#define OOO_STRING_SVTOOLS_RTF_DFRSTOP "\\dfrstop"
+#define OOO_STRING_SVTOOLS_RTF_DFRXST "\\dfrxst"
+#define OOO_STRING_SVTOOLS_RTF_DGMARGIN "\\dgmargin"
+#define OOO_STRING_SVTOOLS_RTF_DNTBLNSBDB "\\dntblnsbdb"
+#define OOO_STRING_SVTOOLS_RTF_DOCTYPE "\\doctype"
+#define OOO_STRING_SVTOOLS_RTF_DOCVAR "\\docvar"
+#define OOO_STRING_SVTOOLS_RTF_DPCODESCENT "\\dpcodescent"
+#define OOO_STRING_SVTOOLS_RTF_EMBO "\\embo"
+#define OOO_STRING_SVTOOLS_RTF_EMFBLIP "\\emfblip"
+#define OOO_STRING_SVTOOLS_RTF_EXPSHRTN "\\expshrtn"
+#define OOO_STRING_SVTOOLS_RTF_FAAUTO "\\faauto"
+#define OOO_STRING_SVTOOLS_RTF_FBIAS "\\fbias"
+#define OOO_STRING_SVTOOLS_RTF_FFDEFRES "\\ffdefres"
+#define OOO_STRING_SVTOOLS_RTF_FFDEFTEXT "\\ffdeftext"
+#define OOO_STRING_SVTOOLS_RTF_FFENTRYMCR "\\ffentrymcr"
+#define OOO_STRING_SVTOOLS_RTF_FFEXITMCR "\\ffexitmcr"
+#define OOO_STRING_SVTOOLS_RTF_FFFORMAT "\\ffformat"
+#define OOO_STRING_SVTOOLS_RTF_FFHASLISTBOX "\\ffhaslistbox"
+#define OOO_STRING_SVTOOLS_RTF_FFHELPTEXT "\\ffhelptext"
+#define OOO_STRING_SVTOOLS_RTF_FFHPS "\\ffhps"
+#define OOO_STRING_SVTOOLS_RTF_FFL "\\ffl"
+#define OOO_STRING_SVTOOLS_RTF_FFMAXLEN "\\ffmaxlen"
+#define OOO_STRING_SVTOOLS_RTF_FFNAME "\\ffname"
+#define OOO_STRING_SVTOOLS_RTF_FFOWNHELP "\\ffownhelp"
+#define OOO_STRING_SVTOOLS_RTF_FFOWNSTAT "\\ffownstat"
+#define OOO_STRING_SVTOOLS_RTF_FFPROT "\\ffprot"
+#define OOO_STRING_SVTOOLS_RTF_FFRECALC "\\ffrecalc"
+#define OOO_STRING_SVTOOLS_RTF_FFRES "\\ffres"
+#define OOO_STRING_SVTOOLS_RTF_FFSIZE "\\ffsize"
+#define OOO_STRING_SVTOOLS_RTF_FFSTATTEXT "\\ffstattext"
+#define OOO_STRING_SVTOOLS_RTF_FFTYPE "\\fftype"
+#define OOO_STRING_SVTOOLS_RTF_FFTYPETXT "\\fftypetxt"
+#define OOO_STRING_SVTOOLS_RTF_FLDTYPE "\\fldtype"
+#define OOO_STRING_SVTOOLS_RTF_FNAME "\\fname"
+#define OOO_STRING_SVTOOLS_RTF_FORMFIELD "\\formfield"
+#define OOO_STRING_SVTOOLS_RTF_FROMTEXT "\\fromtext"
+#define OOO_STRING_SVTOOLS_RTF_FTNNCHOSUNG "\\ftnnchosung"
+#define OOO_STRING_SVTOOLS_RTF_FTNNCNUM "\\ftnncnum"
+#define OOO_STRING_SVTOOLS_RTF_FTNNDBAR "\\ftnndbar"
+#define OOO_STRING_SVTOOLS_RTF_FTNNDBNUM "\\ftnndbnum"
+#define OOO_STRING_SVTOOLS_RTF_FTNNDBNUMD "\\ftnndbnumd"
+#define OOO_STRING_SVTOOLS_RTF_FTNNDBNUMK "\\ftnndbnumk"
+#define OOO_STRING_SVTOOLS_RTF_FTNNDBNUMT "\\ftnndbnumt"
+#define OOO_STRING_SVTOOLS_RTF_FTNNGANADA "\\ftnnganada"
+#define OOO_STRING_SVTOOLS_RTF_FTNNGBNUM "\\ftnngbnum"
+#define OOO_STRING_SVTOOLS_RTF_FTNNGBNUMD "\\ftnngbnumd"
+#define OOO_STRING_SVTOOLS_RTF_FTNNGBNUMK "\\ftnngbnumk"
+#define OOO_STRING_SVTOOLS_RTF_FTNNGBNUML "\\ftnngbnuml"
+#define OOO_STRING_SVTOOLS_RTF_FTNNZODIAC "\\ftnnzodiac"
+#define OOO_STRING_SVTOOLS_RTF_FTNNZODIACD "\\ftnnzodiacd"
+#define OOO_STRING_SVTOOLS_RTF_FTNNZODIACL "\\ftnnzodiacl"
+#define OOO_STRING_SVTOOLS_RTF_G "\\g"
+#define OOO_STRING_SVTOOLS_RTF_GCW "\\gcw"
+#define OOO_STRING_SVTOOLS_RTF_GRIDTBL "\\gridtbl"
+#define OOO_STRING_SVTOOLS_RTF_HIGHLIGHT "\\highlight"
+#define OOO_STRING_SVTOOLS_RTF_HLFR "\\hlfr"
+#define OOO_STRING_SVTOOLS_RTF_HLINKBASE "\\hlinkbase"
+#define OOO_STRING_SVTOOLS_RTF_HLLOC "\\hlloc"
+#define OOO_STRING_SVTOOLS_RTF_HLSRC "\\hlsrc"
+#define OOO_STRING_SVTOOLS_RTF_ILVL "\\ilvl"
+#define OOO_STRING_SVTOOLS_RTF_IMPR "\\impr"
+#define OOO_STRING_SVTOOLS_RTF_JPEGBLIP "\\jpegblip"
+#define OOO_STRING_SVTOOLS_RTF_LEVELFOLLOW "\\levelfollow"
+#define OOO_STRING_SVTOOLS_RTF_LEVELINDENT "\\levelindent"
+#define OOO_STRING_SVTOOLS_RTF_LEVELJC "\\leveljc"
+#define OOO_STRING_SVTOOLS_RTF_LEVELLEGAL "\\levellegal"
+#define OOO_STRING_SVTOOLS_RTF_LEVELNFC "\\levelnfc"
+#define OOO_STRING_SVTOOLS_RTF_LEVELNORESTART "\\levelnorestart"
+#define OOO_STRING_SVTOOLS_RTF_LEVELNUMBERS "\\levelnumbers"
+#define OOO_STRING_SVTOOLS_RTF_LEVELOLD "\\levelold"
+#define OOO_STRING_SVTOOLS_RTF_LEVELPREV "\\levelprev"
+#define OOO_STRING_SVTOOLS_RTF_LEVELPREVSPACE "\\levelprevspace"
+#define OOO_STRING_SVTOOLS_RTF_LEVELSPACE "\\levelspace"
+#define OOO_STRING_SVTOOLS_RTF_LEVELSTARTAT "\\levelstartat"
+#define OOO_STRING_SVTOOLS_RTF_LEVELTEXT "\\leveltext"
+#define OOO_STRING_SVTOOLS_RTF_LINKVAL "\\linkval"
+#define OOO_STRING_SVTOOLS_RTF_LIST "\\list"
+#define OOO_STRING_SVTOOLS_RTF_LISTID "\\listid"
+#define OOO_STRING_SVTOOLS_RTF_LISTLEVEL "\\listlevel"
+#define OOO_STRING_SVTOOLS_RTF_LISTNAME "\\listname"
+#define OOO_STRING_SVTOOLS_RTF_LISTOVERRIDE "\\listoverride"
+#define OOO_STRING_SVTOOLS_RTF_LISTOVERRIDECOUNT "\\listoverridecount"
+#define OOO_STRING_SVTOOLS_RTF_LISTOVERRIDEFORMAT "\\listoverrideformat"
+#define OOO_STRING_SVTOOLS_RTF_LISTOVERRIDESTART "\\listoverridestart"
+#define OOO_STRING_SVTOOLS_RTF_LISTOVERRIDETABLE "\\listoverridetable"
+#define OOO_STRING_SVTOOLS_RTF_LISTRESTARTHDN "\\listrestarthdn"
+#define OOO_STRING_SVTOOLS_RTF_LISTSIMPLE "\\listsimple"
+#define OOO_STRING_SVTOOLS_RTF_LISTTABLE "\\listtable"
+#define OOO_STRING_SVTOOLS_RTF_LISTTEMPLATEID "\\listtemplateid"
+#define OOO_STRING_SVTOOLS_RTF_LISTTEXT "\\listtext"
+#define OOO_STRING_SVTOOLS_RTF_LS "\\ls"
+#define OOO_STRING_SVTOOLS_RTF_LYTEXCTTP "\\lytexcttp"
+#define OOO_STRING_SVTOOLS_RTF_LYTPRTMET "\\lytprtmet"
+#define OOO_STRING_SVTOOLS_RTF_MANAGER "\\manager"
+#define OOO_STRING_SVTOOLS_RTF_MSMCAP "\\msmcap"
+#define OOO_STRING_SVTOOLS_RTF_NOFCHARSWS "\\nofcharsws"
+#define OOO_STRING_SVTOOLS_RTF_NOLEAD "\\nolead"
+#define OOO_STRING_SVTOOLS_RTF_NONSHPPICT "\\nonshppict"
+#define OOO_STRING_SVTOOLS_RTF_NOSECTEXPAND "\\nosectexpand"
+#define OOO_STRING_SVTOOLS_RTF_NOSNAPLINEGRID "\\nosnaplinegrid"
+#define OOO_STRING_SVTOOLS_RTF_NOSPACEFORUL "\\nospaceforul"
+#define OOO_STRING_SVTOOLS_RTF_NOULTRLSPC "\\noultrlspc"
+#define OOO_STRING_SVTOOLS_RTF_NOXLATTOYEN "\\noxlattoyen"
+#define OOO_STRING_SVTOOLS_RTF_OBJATTPH "\\objattph"
+#define OOO_STRING_SVTOOLS_RTF_OBJHTML "\\objhtml"
+#define OOO_STRING_SVTOOLS_RTF_OBJOCX "\\objocx"
+#define OOO_STRING_SVTOOLS_RTF_OLDLINEWRAP "\\oldlinewrap"
+#define OOO_STRING_SVTOOLS_RTF_OUTLINELEVEL "\\outlinelevel"
+#define OOO_STRING_SVTOOLS_RTF_OVERLAY "\\overlay"
+#define OOO_STRING_SVTOOLS_RTF_PANOSE "\\panose"
+#define OOO_STRING_SVTOOLS_RTF_PGBRDRB "\\pgbrdrb"
+#define OOO_STRING_SVTOOLS_RTF_PGBRDRFOOT "\\pgbrdrfoot"
+#define OOO_STRING_SVTOOLS_RTF_PGBRDRHEAD "\\pgbrdrhead"
+#define OOO_STRING_SVTOOLS_RTF_PGBRDRL "\\pgbrdrl"
+#define OOO_STRING_SVTOOLS_RTF_PGBRDROPT "\\pgbrdropt"
+#define OOO_STRING_SVTOOLS_RTF_PGBRDRR "\\pgbrdrr"
+#define OOO_STRING_SVTOOLS_RTF_PGBRDRSNAP "\\pgbrdrsnap"
+#define OOO_STRING_SVTOOLS_RTF_PGBRDRT "\\pgbrdrt"
+#define OOO_STRING_SVTOOLS_RTF_PGNCHOSUNG "\\pgnchosung"
+#define OOO_STRING_SVTOOLS_RTF_PGNCNUM "\\pgncnum"
+#define OOO_STRING_SVTOOLS_RTF_PGNDBNUMK "\\pgndbnumk"
+#define OOO_STRING_SVTOOLS_RTF_PGNDBNUMT "\\pgndbnumt"
+#define OOO_STRING_SVTOOLS_RTF_PGNGANADA "\\pgnganada"
+#define OOO_STRING_SVTOOLS_RTF_PGNGBNUM "\\pgngbnum"
+#define OOO_STRING_SVTOOLS_RTF_PGNGBNUMD "\\pgngbnumd"
+#define OOO_STRING_SVTOOLS_RTF_PGNGBNUMK "\\pgngbnumk"
+#define OOO_STRING_SVTOOLS_RTF_PGNGBNUML "\\pgngbnuml"
+#define OOO_STRING_SVTOOLS_RTF_PGNZODIAC "\\pgnzodiac"
+#define OOO_STRING_SVTOOLS_RTF_PGNZODIACD "\\pgnzodiacd"
+#define OOO_STRING_SVTOOLS_RTF_PGNZODIACL "\\pgnzodiacl"
+#define OOO_STRING_SVTOOLS_RTF_PICPROP "\\picprop"
+#define OOO_STRING_SVTOOLS_RTF_PNAIUEO "\\pnaiueo"
+#define OOO_STRING_SVTOOLS_RTF_PNAIUEOD "\\pnaiueod"
+#define OOO_STRING_SVTOOLS_RTF_PNCHOSUNG "\\pnchosung"
+#define OOO_STRING_SVTOOLS_RTF_PNDBNUMD "\\pndbnumd"
+#define OOO_STRING_SVTOOLS_RTF_PNDBNUMK "\\pndbnumk"
+#define OOO_STRING_SVTOOLS_RTF_PNDBNUML "\\pndbnuml"
+#define OOO_STRING_SVTOOLS_RTF_PNDBNUMT "\\pndbnumt"
+#define OOO_STRING_SVTOOLS_RTF_PNGANADA "\\pnganada"
+#define OOO_STRING_SVTOOLS_RTF_PNGBLIP "\\pngblip"
+#define OOO_STRING_SVTOOLS_RTF_PNGBNUM "\\pngbnum"
+#define OOO_STRING_SVTOOLS_RTF_PNGBNUMD "\\pngbnumd"
+#define OOO_STRING_SVTOOLS_RTF_PNGBNUMK "\\pngbnumk"
+#define OOO_STRING_SVTOOLS_RTF_PNGBNUML "\\pngbnuml"
+#define OOO_STRING_SVTOOLS_RTF_PNRAUTH "\\pnrauth"
+#define OOO_STRING_SVTOOLS_RTF_PNRDATE "\\pnrdate"
+#define OOO_STRING_SVTOOLS_RTF_PNRNFC "\\pnrnfc"
+#define OOO_STRING_SVTOOLS_RTF_PNRNOT "\\pnrnot"
+#define OOO_STRING_SVTOOLS_RTF_PNRPNBR "\\pnrpnbr"
+#define OOO_STRING_SVTOOLS_RTF_PNRRGB "\\pnrrgb"
+#define OOO_STRING_SVTOOLS_RTF_PNRSTART "\\pnrstart"
+#define OOO_STRING_SVTOOLS_RTF_PNRSTOP "\\pnrstop"
+#define OOO_STRING_SVTOOLS_RTF_PNRXST "\\pnrxst"
+#define OOO_STRING_SVTOOLS_RTF_PNZODIAC "\\pnzodiac"
+#define OOO_STRING_SVTOOLS_RTF_PNZODIACD "\\pnzodiacd"
+#define OOO_STRING_SVTOOLS_RTF_PNZODIACL "\\pnzodiacl"
+#define OOO_STRING_SVTOOLS_RTF_LFOLEVEL "\\lfolevel"
+#define OOO_STRING_SVTOOLS_RTF_POSYIN "\\posyin"
+#define OOO_STRING_SVTOOLS_RTF_POSYOUT "\\posyout"
+#define OOO_STRING_SVTOOLS_RTF_PRIVATE "\\private"
+#define OOO_STRING_SVTOOLS_RTF_PROPNAME "\\propname"
+#define OOO_STRING_SVTOOLS_RTF_PROPTYPE "\\proptype"
+#define OOO_STRING_SVTOOLS_RTF_REVAUTHDEL "\\revauthdel"
+#define OOO_STRING_SVTOOLS_RTF_REVDTTMDEL "\\revdttmdel"
+#define OOO_STRING_SVTOOLS_RTF_SAUTOUPD "\\sautoupd"
+#define OOO_STRING_SVTOOLS_RTF_SECTDEFAULTCL "\\sectdefaultcl"
+#define OOO_STRING_SVTOOLS_RTF_SECTEXPAND "\\sectexpand"
+#define OOO_STRING_SVTOOLS_RTF_SECTLINEGRID "\\sectlinegrid"
+#define OOO_STRING_SVTOOLS_RTF_SECTSPECIFYCL "\\sectspecifycl"
+#define OOO_STRING_SVTOOLS_RTF_SECTSPECIFYL "\\sectspecifyl"
+#define OOO_STRING_SVTOOLS_RTF_SHIDDEN "\\shidden"
+#define OOO_STRING_SVTOOLS_RTF_SHPBOTTOM "\\shpbottom"
+#define OOO_STRING_SVTOOLS_RTF_SHPBXCOLUMN "\\shpbxcolumn"
+#define OOO_STRING_SVTOOLS_RTF_SHPBXMARGIN "\\shpbxmargin"
+#define OOO_STRING_SVTOOLS_RTF_SHPBXPAGE "\\shpbxpage"
+#define OOO_STRING_SVTOOLS_RTF_SHPBXIGNORE "\\shpbxignore"
+#define OOO_STRING_SVTOOLS_RTF_SHPBYMARGIN "\\shpbymargin"
+#define OOO_STRING_SVTOOLS_RTF_SHPBYPAGE "\\shpbypage"
+#define OOO_STRING_SVTOOLS_RTF_SHPBYPARA "\\shpbypara"
+#define OOO_STRING_SVTOOLS_RTF_SHPBYIGNORE "\\shpbyignore"
+#define OOO_STRING_SVTOOLS_RTF_SHPFBLWTXT "\\shpfblwtxt"
+#define OOO_STRING_SVTOOLS_RTF_SHPFHDR "\\shpfhdr"
+#define OOO_STRING_SVTOOLS_RTF_SHPGRP "\\shpgrp"
+#define OOO_STRING_SVTOOLS_RTF_SHPINST "\\shpinst"
+#define OOO_STRING_SVTOOLS_RTF_SHPLEFT "\\shpleft"
+#define OOO_STRING_SVTOOLS_RTF_SHPLID "\\shplid"
+#define OOO_STRING_SVTOOLS_RTF_SHPLOCKANCHOR "\\shplockanchor"
+#define OOO_STRING_SVTOOLS_RTF_SHPPICT "\\shppict"
+#define OOO_STRING_SVTOOLS_RTF_SHPRIGHT "\\shpright"
+#define OOO_STRING_SVTOOLS_RTF_SHPRSLT "\\shprslt"
+#define OOO_STRING_SVTOOLS_RTF_SHPTOP "\\shptop"
+#define OOO_STRING_SVTOOLS_RTF_SHPTXT "\\shptxt"
+#define OOO_STRING_SVTOOLS_RTF_SHPWRK "\\shpwrk"
+#define OOO_STRING_SVTOOLS_RTF_SHPWR "\\shpwr"
+#define OOO_STRING_SVTOOLS_RTF_SHPZ "\\shpz"
+#define OOO_STRING_SVTOOLS_RTF_SP "\\sp"
+#define OOO_STRING_SVTOOLS_RTF_SPRSBSP "\\sprsbsp"
+#define OOO_STRING_SVTOOLS_RTF_SPRSLNSP "\\sprslnsp"
+#define OOO_STRING_SVTOOLS_RTF_SPRSTSM "\\sprstsm"
+#define OOO_STRING_SVTOOLS_RTF_STATICVAL "\\staticval"
+#define OOO_STRING_SVTOOLS_RTF_STEXTFLOW "\\stextflow"
+#define OOO_STRING_SVTOOLS_RTF_STRIKED "\\striked"
+#define OOO_STRING_SVTOOLS_RTF_SUBFONTBYSIZE "\\subfontbysize"
+#define OOO_STRING_SVTOOLS_RTF_TCELLD "\\tcelld"
+#define OOO_STRING_SVTOOLS_RTF_TIME "\\time"
+#define OOO_STRING_SVTOOLS_RTF_TRUNCATEFONTHEIGHT "\\truncatefontheight"
+#define OOO_STRING_SVTOOLS_RTF_UC "\\uc"
+#define OOO_STRING_SVTOOLS_RTF_UD "\\ud"
+#define OOO_STRING_SVTOOLS_RTF_ULDASH "\\uldash"
+#define OOO_STRING_SVTOOLS_RTF_ULDASHD "\\uldashd"
+#define OOO_STRING_SVTOOLS_RTF_ULDASHDD "\\uldashdd"
+#define OOO_STRING_SVTOOLS_RTF_ULTH "\\ulth"
+#define OOO_STRING_SVTOOLS_RTF_ULWAVE "\\ulwave"
+#define OOO_STRING_SVTOOLS_RTF_ULC "\\ulc"
+#define OOO_STRING_SVTOOLS_RTF_U "\\u"
+#define OOO_STRING_SVTOOLS_RTF_UPR "\\upr"
+#define OOO_STRING_SVTOOLS_RTF_USERPROPS "\\userprops"
+#define OOO_STRING_SVTOOLS_RTF_VIEWKIND "\\viewkind"
+#define OOO_STRING_SVTOOLS_RTF_VIEWSCALE "\\viewscale"
+#define OOO_STRING_SVTOOLS_RTF_VIEWZK "\\viewzk"
+#define OOO_STRING_SVTOOLS_RTF_WIDCTLPAR "\\widctlpar"
+#define OOO_STRING_SVTOOLS_RTF_WINDOWCAPTION "\\windowcaption"
+#define OOO_STRING_SVTOOLS_RTF_WPEQN "\\wpeqn"
+#define OOO_STRING_SVTOOLS_RTF_WPJST "\\wpjst"
+#define OOO_STRING_SVTOOLS_RTF_WPSP "\\wpsp"
+#define OOO_STRING_SVTOOLS_RTF_YXE "\\yxe"
+#define OOO_STRING_SVTOOLS_RTF_FRMTXLRTB "\\frmtxlrtb"
+#define OOO_STRING_SVTOOLS_RTF_FRMTXTBRL "\\frmtxtbrl"
+#define OOO_STRING_SVTOOLS_RTF_FRMTXBTLR "\\frmtxbtlr"
+#define OOO_STRING_SVTOOLS_RTF_FRMTXLRTBV "\\frmtxlrtbv"
+#define OOO_STRING_SVTOOLS_RTF_FRMTXTBRLV "\\frmtxtbrlv"
+
+// MS-2000 Tokens
+#define OOO_STRING_SVTOOLS_RTF_ULTHD "\\ulthd"
+#define OOO_STRING_SVTOOLS_RTF_ULTHDASH "\\ulthdash"
+#define OOO_STRING_SVTOOLS_RTF_ULLDASH "\\ulldash"
+#define OOO_STRING_SVTOOLS_RTF_ULTHLDASH "\\ulthldash"
+#define OOO_STRING_SVTOOLS_RTF_ULTHDASHD "\\ulthdashd"
+#define OOO_STRING_SVTOOLS_RTF_ULTHDASHDD "\\ulthdashdd"
+#define OOO_STRING_SVTOOLS_RTF_ULHWAVE "\\ulhwave"
+#define OOO_STRING_SVTOOLS_RTF_ULULDBWAVE "\\ululdbwave"
+#define OOO_STRING_SVTOOLS_RTF_LOCH "\\loch"
+#define OOO_STRING_SVTOOLS_RTF_HICH "\\hich"
+#define OOO_STRING_SVTOOLS_RTF_DBCH "\\dbch"
+#define OOO_STRING_SVTOOLS_RTF_LANGFE "\\langfe"
+#define OOO_STRING_SVTOOLS_RTF_ADEFLANG "\\adeflang"
+#define OOO_STRING_SVTOOLS_RTF_ADEFF "\\adeff"
+#define OOO_STRING_SVTOOLS_RTF_ACCNONE "\\accnone"
+#define OOO_STRING_SVTOOLS_RTF_ACCDOT "\\accdot"
+#define OOO_STRING_SVTOOLS_RTF_ACCCOMMA "\\acccomma"
+#define OOO_STRING_SVTOOLS_RTF_TWOINONE "\\twoinone"
+#define OOO_STRING_SVTOOLS_RTF_HORZVERT "\\horzvert"
+#define OOO_STRING_SVTOOLS_RTF_FAHANG "\\fahang"
+#define OOO_STRING_SVTOOLS_RTF_FAVAR "\\favar"
+#define OOO_STRING_SVTOOLS_RTF_FACENTER "\\facenter"
+#define OOO_STRING_SVTOOLS_RTF_FAROMAN "\\faroman"
+#define OOO_STRING_SVTOOLS_RTF_FAFIXED "\\fafixed"
+#define OOO_STRING_SVTOOLS_RTF_NOCWRAP "\\nocwrap"
+#define OOO_STRING_SVTOOLS_RTF_NOOVERFLOW "\\nooverflow"
+#define OOO_STRING_SVTOOLS_RTF_ASPALPHA "\\aspalpha"
+
+// SWG spezifische Attribute
+#define OOO_STRING_SVTOOLS_RTF_GRFALIGNV "\\grfalignv"
+#define OOO_STRING_SVTOOLS_RTF_GRFALIGNH "\\grfalignh"
+#define OOO_STRING_SVTOOLS_RTF_GRFMIRROR "\\grfmirror"
+#define OOO_STRING_SVTOOLS_RTF_HEADERYB "\\headeryb"
+#define OOO_STRING_SVTOOLS_RTF_HEADERXL "\\headerxl"
+#define OOO_STRING_SVTOOLS_RTF_HEADERXR "\\headerxr"
+#define OOO_STRING_SVTOOLS_RTF_FOOTERYT "\\footeryt"
+#define OOO_STRING_SVTOOLS_RTF_FOOTERXL "\\footerxl"
+#define OOO_STRING_SVTOOLS_RTF_FOOTERXR "\\footerxr"
+#define OOO_STRING_SVTOOLS_RTF_HEADERYH "\\headeryh"
+#define OOO_STRING_SVTOOLS_RTF_FOOTERYH "\\footeryh"
+#define OOO_STRING_SVTOOLS_RTF_BALANCEDCOLUMN "\\swcolmnblnc"
+#define OOO_STRING_SVTOOLS_RTF_UPDNPROP "\\updnprop"
+#define OOO_STRING_SVTOOLS_RTF_PRTDATA "\\prtdata"
+#define OOO_STRING_SVTOOLS_RTF_BKMKKEY "\\bkmkkey"
+
+// Attribute fuer die freifliegenden Rahmen
+#define OOO_STRING_SVTOOLS_RTF_FLYPRINT "\\flyprint"
+#define OOO_STRING_SVTOOLS_RTF_FLYOPAQUE "\\flyopaque"
+#define OOO_STRING_SVTOOLS_RTF_FLYPRTCTD "\\flyprtctd"
+#define OOO_STRING_SVTOOLS_RTF_FLYMAINCNT "\\flymaincnt"
+#define OOO_STRING_SVTOOLS_RTF_FLYVERT "\\flyvert"
+#define OOO_STRING_SVTOOLS_RTF_FLYHORZ "\\flyhorz"
+#define OOO_STRING_SVTOOLS_RTF_DFRMTXTL "\\dfrmtxtl"
+#define OOO_STRING_SVTOOLS_RTF_DFRMTXTR "\\dfrmtxtr"
+#define OOO_STRING_SVTOOLS_RTF_DFRMTXTU "\\dfrmtxtu"
+#define OOO_STRING_SVTOOLS_RTF_DFRMTXTW "\\dfrmtxtw"
+#define OOO_STRING_SVTOOLS_RTF_FLYANCHOR "\\flyanchor"
+#define OOO_STRING_SVTOOLS_RTF_FLYCNTNT "\\flycntnt"
+#define OOO_STRING_SVTOOLS_RTF_FLYCOLUMN "\\flycolumn"
+#define OOO_STRING_SVTOOLS_RTF_FLYPAGE "\\flypage"
+#define OOO_STRING_SVTOOLS_RTF_FLYINPARA "\\flyinpara"
+#define OOO_STRING_SVTOOLS_RTF_BRDBOX "\\brdbox"
+#define OOO_STRING_SVTOOLS_RTF_BRDLNCOL "\\brdlncol"
+#define OOO_STRING_SVTOOLS_RTF_BRDLNIN "\\brdlnin"
+#define OOO_STRING_SVTOOLS_RTF_BRDLNOUT "\\brdlnout"
+#define OOO_STRING_SVTOOLS_RTF_BRDLNDIST "\\brdlndist"
+#define OOO_STRING_SVTOOLS_RTF_SHADOW "\\shadow"
+#define OOO_STRING_SVTOOLS_RTF_SHDWDIST "\\shdwdist"
+#define OOO_STRING_SVTOOLS_RTF_SHDWSTYLE "\\shdwstyle"
+#define OOO_STRING_SVTOOLS_RTF_SHDWCOL "\\shdwcol"
+#define OOO_STRING_SVTOOLS_RTF_SHDWFCOL "\\shdwfcol"
+#define OOO_STRING_SVTOOLS_RTF_PGDSCTBL "\\pgdsctbl"
+#define OOO_STRING_SVTOOLS_RTF_PGDSC "\\pgdsc"
+#define OOO_STRING_SVTOOLS_RTF_PGDSCUSE "\\pgdscuse"
+#define OOO_STRING_SVTOOLS_RTF_PGDSCNXT "\\pgdscnxt"
+#define OOO_STRING_SVTOOLS_RTF_HYPHEN "\\hyphen"
+#define OOO_STRING_SVTOOLS_RTF_HYPHLEAD "\\hyphlead"
+#define OOO_STRING_SVTOOLS_RTF_HYPHTRAIL "\\hyphtrail"
+#define OOO_STRING_SVTOOLS_RTF_HYPHMAX "\\hyphmax"
+#define OOO_STRING_SVTOOLS_RTF_TLSWG "\\tlswg"
+#define OOO_STRING_SVTOOLS_RTF_PGBRK "\\pgbrk"
+#define OOO_STRING_SVTOOLS_RTF_PGDSCNO "\\pgdscno"
+#define OOO_STRING_SVTOOLS_RTF_SOUTLVL "\\soutlvl"
+#define OOO_STRING_SVTOOLS_RTF_SHP "\\shp"
+#define OOO_STRING_SVTOOLS_RTF_SN "\\sn"
+#define OOO_STRING_SVTOOLS_RTF_SV "\\sv"
+#define OOO_STRING_SVTOOLS_RTF_SP "\\sp"
+
+// Support for overline attributes
+#define OOO_STRING_SVTOOLS_RTF_OL "\\ol"
+#define OOO_STRING_SVTOOLS_RTF_OLD "\\old"
+#define OOO_STRING_SVTOOLS_RTF_OLDB "\\oldb"
+#define OOO_STRING_SVTOOLS_RTF_OLNONE "\\olnone"
+#define OOO_STRING_SVTOOLS_RTF_OLW "\\olw"
+#define OOO_STRING_SVTOOLS_RTF_OLDASH "\\oldash"
+#define OOO_STRING_SVTOOLS_RTF_OLDASHD "\\oldashd"
+#define OOO_STRING_SVTOOLS_RTF_OLDASHDD "\\oldashdd"
+#define OOO_STRING_SVTOOLS_RTF_OLTH "\\olth"
+#define OOO_STRING_SVTOOLS_RTF_OLWAVE "\\olwave"
+#define OOO_STRING_SVTOOLS_RTF_OLC "\\olc"
+#define OOO_STRING_SVTOOLS_RTF_OLTHD "\\olthd"
+#define OOO_STRING_SVTOOLS_RTF_OLTHDASH "\\olthdash"
+#define OOO_STRING_SVTOOLS_RTF_OLLDASH "\\olldash"
+#define OOO_STRING_SVTOOLS_RTF_OLTHLDASH "\\olthldash"
+#define OOO_STRING_SVTOOLS_RTF_OLTHDASHD "\\olthdashd"
+#define OOO_STRING_SVTOOLS_RTF_OLTHDASHDD "\\olthdashdd"
+#define OOO_STRING_SVTOOLS_RTF_OLHWAVE "\\olhwave"
+#define OOO_STRING_SVTOOLS_RTF_OLOLDBWAVE "\\ololdbwave"
+
+// Support for nested tables
+#define OOO_STRING_SVTOOLS_RTF_ITAP "\\itap"
+#define OOO_STRING_SVTOOLS_RTF_NESTCELL "\\nestcell"
+#define OOO_STRING_SVTOOLS_RTF_NESTTABLEPROPRS "\\nesttableprops"
+#define OOO_STRING_SVTOOLS_RTF_NESTROW "\\nestrow"
+#define OOO_STRING_SVTOOLS_RTF_NONESTTABLES "\\nonesttables"
+
+// Math
+#define LO_STRING_SVTOOLS_RTF_MACC "\\macc"
+#define LO_STRING_SVTOOLS_RTF_MACCPR "\\maccPr"
+#define LO_STRING_SVTOOLS_RTF_MBAR "\\mbar"
+#define LO_STRING_SVTOOLS_RTF_MBARPR "\\mbarPr"
+#define LO_STRING_SVTOOLS_RTF_MBEGCHR "\\mbegChr"
+#define LO_STRING_SVTOOLS_RTF_MBORDERBOX "\\mborderBox"
+#define LO_STRING_SVTOOLS_RTF_MBORDERBOXPR "\\mborderBoxPr"
+#define LO_STRING_SVTOOLS_RTF_MCHR "\\mchr"
+#define LO_STRING_SVTOOLS_RTF_MDEGHIDE "\\mdegHide"
+#define LO_STRING_SVTOOLS_RTF_MDEG "\\mdeg"
+#define LO_STRING_SVTOOLS_RTF_MDEN "\\mden"
+#define LO_STRING_SVTOOLS_RTF_MD "\\md"
+#define LO_STRING_SVTOOLS_RTF_MDPR "\\mdPr"
+#define LO_STRING_SVTOOLS_RTF_ME "\\me"
+#define LO_STRING_SVTOOLS_RTF_MENDCHR "\\mendChr"
+#define LO_STRING_SVTOOLS_RTF_MEQARR "\\meqArr"
+#define LO_STRING_SVTOOLS_RTF_MF "\\mf"
+#define LO_STRING_SVTOOLS_RTF_MFNAME "\\mfName"
+#define LO_STRING_SVTOOLS_RTF_MFPR "\\mfPr"
+#define LO_STRING_SVTOOLS_RTF_MFUNC "\\mfunc"
+#define LO_STRING_SVTOOLS_RTF_MGROUPCHR "\\mgroupChr"
+#define LO_STRING_SVTOOLS_RTF_MGROUPCHRPR "\\mgroupChrPr"
+#define LO_STRING_SVTOOLS_RTF_MHIDEBOT "\\mhideBot"
+#define LO_STRING_SVTOOLS_RTF_MHIDELEFT "\\mhideLeft"
+#define LO_STRING_SVTOOLS_RTF_MHIDERIGHT "\\mhideRight"
+#define LO_STRING_SVTOOLS_RTF_MHIDETOP "\\mhideTop"
+#define LO_STRING_SVTOOLS_RTF_MLIMLOW "\\mlimLow"
+#define LO_STRING_SVTOOLS_RTF_MLIM "\\mlim"
+#define LO_STRING_SVTOOLS_RTF_MLIMUPP "\\mlimUpp"
+#define LO_STRING_SVTOOLS_RTF_MM "\\mm"
+#define LO_STRING_SVTOOLS_RTF_MMR "\\mmr"
+#define LO_STRING_SVTOOLS_RTF_MNARY "\\mnary"
+#define LO_STRING_SVTOOLS_RTF_MNARYPR "\\mnaryPr"
+#define LO_STRING_SVTOOLS_RTF_MNUM "\\mnum"
+#define LO_STRING_SVTOOLS_RTF_MOMATH "\\moMath"
+#define LO_STRING_SVTOOLS_RTF_MPOS "\\mpos"
+#define LO_STRING_SVTOOLS_RTF_MRAD "\\mrad"
+#define LO_STRING_SVTOOLS_RTF_MRADPR "\\mradPr"
+#define LO_STRING_SVTOOLS_RTF_MR "\\mr"
+#define LO_STRING_SVTOOLS_RTF_MSEPCHR "\\msepChr"
+#define LO_STRING_SVTOOLS_RTF_MSPRE "\\msPre"
+#define LO_STRING_SVTOOLS_RTF_MSSUB "\\msSub"
+#define LO_STRING_SVTOOLS_RTF_MSSUBSUP "\\msSubSup"
+#define LO_STRING_SVTOOLS_RTF_MSSUP "\\msSup"
+#define LO_STRING_SVTOOLS_RTF_MSTRIKEH "\\mstrikeH"
+#define LO_STRING_SVTOOLS_RTF_MSUBHIDE "\\msubHide"
+#define LO_STRING_SVTOOLS_RTF_MSUB "\\msub"
+#define LO_STRING_SVTOOLS_RTF_MSUPHIDE "\\msupHide"
+#define LO_STRING_SVTOOLS_RTF_MSUP "\\msup"
+#define LO_STRING_SVTOOLS_RTF_MTYPE "\\mtype"
+#define LO_STRING_SVTOOLS_RTF_MVERTJC "\\mvertJc"
+#define LO_STRING_SVTOOLS_RTF_MMATH "\\mmath"
+#define LO_STRING_SVTOOLS_RTF_MMATHPICT "\\mmathPict"
+#define LO_STRING_SVTOOLS_RTF_MNOR "\\mnor"
+#define LO_STRING_SVTOOLS_RTF_LISTPICTURE "\\listpicture"
+#define LO_STRING_SVTOOLS_RTF_LEVELPICTURE "\\levelpicture"
+
+#endif // _RTFKEYWD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/rtfout.hxx b/include/svtools/rtfout.hxx
new file mode 100644
index 000000000000..9910d8e8115d
--- /dev/null
+++ b/include/svtools/rtfout.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _RTFOUT_HXX
+#define _RTFOUT_HXX
+
+#include "svtools/svtdllapi.h"
+#include <tools/solar.h>
+
+#include <rtl/textenc.h>
+
+class String;
+class SvStream;
+
+class SVT_DLLPUBLIC RTFOutFuncs
+{
+public:
+#if defined(UNX)
+ static const sal_Char sNewLine; // nur \012 oder \015
+#else
+ static const sal_Char sNewLine[]; // \015\012
+#endif
+
+ static SvStream& Out_Char( SvStream&, sal_Unicode cChar,
+ int *pUCMode,
+ rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
+ sal_Bool bWriteHelpFile = sal_False );
+ static SvStream& Out_String( SvStream&, const String&,
+ rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
+ sal_Bool bWriteHelpFile = sal_False );
+ static SvStream& Out_Fontname( SvStream&, const String&,
+ rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
+ sal_Bool bWriteHelpFile = sal_False );
+
+ static SvStream& Out_Hex( SvStream&, sal_uLong nHex, sal_uInt8 nLen );
+};
+
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/rtftoken.h b/include/svtools/rtftoken.h
new file mode 100644
index 000000000000..9a1e3dff167c
--- /dev/null
+++ b/include/svtools/rtftoken.h
@@ -0,0 +1,1265 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _RTFTOKEN_H
+#define _RTFTOKEN_H
+
+class String;
+
+// suche die TokenID zu dem Token
+int GetRTFToken( const String& rSearch );
+
+enum RTF_TOKEN_RANGES {
+ RTF_NOGROUP = 0x0100,
+ RTF_DOCFMT = 0x0200,
+ RTF_SECTFMT = 0x0300,
+ RTF_PARFMT = 0x0400,
+ RTF_TABSTOPDEF = 0x0500,
+ RTF_BRDRDEF = 0x0600,
+ RTF_CHRFMT = 0x0700,
+ RTF_SPECCHAR = 0x0800,
+ RTF_APOCTL = 0x0900,
+ RTF_SHADINGDEF = 0x0A00,
+ // free = 0x0B00,
+ RTF_DRAWOBJECTS = 0x0C00,
+ RTF_OBJECTS = 0x0D00,
+ RTF_NUMBULLETS = 0x0E00,
+
+ // !!! kann hinein verodert werden (Border/Background) !!!!
+ RTF_TABLEDEF = 0x1000,
+
+ // !!! kann hinein verodert werden (Border/Tab) !!!!
+ RTF_SWGDEFS = 0x4000
+};
+
+enum RTF_TOKEN_IDS {
+
+ RTF_TEXTTOKEN = RTF_NOGROUP,
+ RTF_SINGLECHAR,
+ RTF_UNKNOWNCONTROL,
+ RTF_UNKNOWNDATA,
+
+ RTF_RTF,
+ RTF_ANSITYPE,
+ RTF_MACTYPE,
+ RTF_PCTYPE,
+ RTF_PCATYPE,
+ RTF_NEXTTYPE,
+
+ RTF_STYLESHEET,
+ RTF_SBASEDON,
+ RTF_SNEXT,
+ RTF_SHIDDEN,
+ RTF_SAUTOUPD,
+
+ RTF_KEYCODE,
+ RTF_FNKEY,
+ RTF_ALTKEY,
+ RTF_SHIFTKEY,
+ RTF_CTRLKEY,
+
+ RTF_FONTTBL,
+ RTF_DEFF,
+ RTF_FNIL,
+ RTF_FROMAN,
+ RTF_FSWISS,
+ RTF_FMODERN,
+ RTF_FSCRIPT,
+ RTF_FDECOR,
+ RTF_FTECH,
+
+ RTF_COLORTBL,
+ RTF_RED,
+ RTF_GREEN,
+ RTF_BLUE,
+
+ RTF_INFO,
+ RTF_TITLE,
+ RTF_SUBJECT,
+ RTF_AUTHOR,
+ RTF_OPERATOR,
+ RTF_KEYWORDS,
+ RTF_COMMENT,
+ RTF_VERSION,
+ RTF_DOCCOMM,
+ RTF_VERN,
+ RTF_CREATIM,
+ RTF_REVTIM,
+ RTF_PRINTIM,
+ RTF_BUPTIM,
+ RTF_EDMINS,
+ RTF_NOFPAGES,
+ RTF_NOFWORDS,
+ RTF_NOFCHARS,
+ RTF_ID,
+ RTF_YR,
+ RTF_MO,
+ RTF_DY,
+ RTF_HR,
+ RTF_MIN,
+ RTF_USERPROPS,
+ RTF_CATEGORY,
+ RTF_COMPANY,
+ RTF_MANAGER,
+ RTF_PROPNAME,
+ RTF_LINKVAL,
+ RTF_NOFCHARSWS,
+ RTF_HLINKBASE,
+ RTF_STATICVAL,
+ RTF_PROPTYPE,
+
+ RTF_ANNOTATION,
+ RTF_ATNID,
+
+ RTF_FOOTNOTE,
+
+ RTF_XE,
+ RTF_BXE,
+ RTF_IXE,
+ RTF_RXE,
+ RTF_TXE,
+ RTF_YXE,
+
+ RTF_TC,
+ RTF_TCF,
+ RTF_TCL,
+
+ RTF_BKMKSTART,
+ RTF_BKMKEND,
+
+ RTF_PICT, // Bitmaps
+ RTF_PICW,
+ RTF_PICH,
+ RTF_WBMBITSPIXEL,
+ RTF_WBMPLANES,
+ RTF_WBMWIDTHBYTES,
+ RTF_PICWGOAL,
+ RTF_PICHGOAL,
+ RTF_BIN,
+ RTF_PICSCALEX,
+ RTF_PICSCALEY,
+ RTF_PICSCALED,
+ RTF_WBITMAP,
+ RTF_WMETAFILE,
+ RTF_MACPICT,
+ RTF_OSMETAFILE,
+ RTF_DIBITMAP,
+ RTF_PICCROPT,
+ RTF_PICCROPB,
+ RTF_PICCROPL,
+ RTF_PICCROPR,
+ RTF_PICDATA,
+ RTF_PICBMP,
+ RTF_PICBPP,
+ RTF_PICPROP,
+ RTF_SHPPICT,
+ RTF_EMFBLIP,
+ RTF_PNGBLIP,
+ RTF_JPEGBLIP,
+ RTF_NONSHPPICT,
+ RTF_BLIPTAG,
+ RTF_BLIPUID,
+ RTF_BLIPUPI,
+
+ RTF_FIELD, // Felder
+ RTF_FLDDIRTY,
+ RTF_FLDEDIT,
+ RTF_FLDLOCK,
+ RTF_FLDPRIV,
+ RTF_FLDINST,
+ RTF_FLDRSLT,
+ RTF_FLDTYPE,
+ RTF_TIME,
+ RTF_DATE,
+ RTF_WPEQN,
+
+ RTF_NOLINE,
+ RTF_REVISED,
+
+ RTF_BKMKCOLF,
+ RTF_BKMKCOLL,
+ RTF_PSOVER,
+ RTF_DOCTEMP,
+ RTF_DELETED,
+
+ RTF_FCHARSET,
+ RTF_FALT,
+ RTF_FPRQ,
+ RTF_PANOSE,
+ RTF_FNAME,
+ RTF_FBIAS,
+
+ RTF_ADDITIVE,
+ RTF_BKMKPUB,
+ RTF_CPG,
+ RTF_DATAFIELD,
+
+ RTF_FBIDI,
+ RTF_FID,
+ RTF_FILE,
+ RTF_FILETBL,
+ RTF_FNETWORK,
+ RTF_FONTEMB,
+ RTF_FONTFILE,
+ RTF_FOSNUM,
+ RTF_FRELATIVE,
+ RTF_FTNIL,
+ RTF_FTTRUETYPE,
+ RTF_FVALIDDOS,
+ RTF_FVALIDHPFS,
+ RTF_FVALIDMAC,
+ RTF_FVALIDNTFS,
+ RTF_LINKSELF,
+ RTF_PUBAUTO,
+ RTF_REVTBL,
+ RTF_RTLMARK,
+ RTF_SEC,
+ RTF_TCN,
+ RTF_XEF,
+
+ RTF_UD, // Unicode
+ RTF_UPR,
+ RTF_U,
+ RTF_UC,
+ RTF_ANSICPG,
+
+ RTF_FFEXITMCR, // Form Fields
+ RTF_FFENTRYMCR,
+ RTF_FFDEFTEXT,
+ RTF_FFFORMAT,
+ RTF_FFSTATTEXT,
+ RTF_FORMFIELD,
+ RTF_FFNAME,
+ RTF_FFHELPTEXT,
+ RTF_FFL,
+ RTF_FFOWNHELP,
+ RTF_FFOWNSTAT,
+ RTF_FFMAXLEN,
+ RTF_FFHASLISTBOX,
+ RTF_FFHPS,
+ RTF_FFPROT,
+ RTF_FFTYPE,
+ RTF_FFTYPETXT,
+ RTF_FFSIZE,
+ RTF_FFRECALC,
+ RTF_FFRES,
+ RTF_FFDEFRES,
+
+ RTF_HIGHLIGHT,
+
+/* */
+
+ RTF_DEFTAB = RTF_DOCFMT,
+ RTF_HYPHHOTZ,
+ RTF_LINESTART,
+ RTF_FRACWIDTH,
+ RTF_NEXTFILE,
+ RTF_TEMPLATE,
+ RTF_MAKEBACKUP,
+ RTF_DEFFORMAT,
+ RTF_DEFLANG,
+ RTF_FTNSEP,
+ RTF_FTNSEPC,
+ RTF_FTNCN,
+ RTF_ENDNOTES,
+ RTF_ENDDOC,
+ RTF_FTNTJ,
+ RTF_FTNBJ,
+ RTF_FTNSTART,
+ RTF_FTNRESTART,
+ RTF_PAPERW,
+ RTF_PAPERH,
+ RTF_MARGL,
+ RTF_MARGR,
+ RTF_MARGT,
+ RTF_MARGB,
+ RTF_FACINGP,
+ RTF_GUTTER,
+ RTF_MARGMIRROR,
+ RTF_LANDSCAPE,
+ RTF_PGNSTART,
+ RTF_WIDOWCTRL,
+ RTF_REVISIONS,
+ RTF_REVPROP,
+ RTF_REVBAR,
+
+ RTF_AENDDOC,
+ RTF_AENDNOTES,
+ RTF_AFTNBJ,
+ RTF_AFTNCN,
+ RTF_AFTNNALC,
+ RTF_AFTNNAR,
+ RTF_AFTNNAUC,
+ RTF_AFTNNCHI,
+ RTF_AFTNNRLC,
+ RTF_AFTNNRUC,
+ RTF_AFTNRESTART,
+ RTF_AFTNRSTCONT,
+ RTF_AFTNSEP,
+ RTF_AFTNSEPC,
+ RTF_AFTNSTART,
+ RTF_AFTNTJ,
+ RTF_ALLPROT,
+ RTF_ANNOTPROT,
+ RTF_ATNAUTHOR,
+ RTF_ATNICN,
+ RTF_ATNREF,
+ RTF_ATNTIME,
+ RTF_ATRFEND,
+ RTF_ATRFSTART,
+ RTF_BRKFRM,
+ RTF_CVMME,
+ RTF_FET,
+ RTF_FLDALT,
+ RTF_FORMDISP,
+ RTF_FORMPROT,
+ RTF_FORMSHADE,
+ RTF_FTNALT,
+ RTF_FTNNALC,
+ RTF_FTNNAR,
+ RTF_FTNNAUC,
+ RTF_FTNNCHI,
+ RTF_FTNNRLC,
+ RTF_FTNNRUC,
+ RTF_FTNRSTCONT,
+ RTF_FTNRSTPG,
+ RTF_HYPHAUTO,
+ RTF_HYPHCAPS,
+ RTF_HYPHCONSEC,
+ RTF_LINKSTYLES,
+ RTF_LTRDOC,
+ RTF_NOCOLBAL,
+ RTF_NOEXTRASPRL,
+ RTF_NOTABIND,
+ RTF_OTBLRUL,
+ RTF_PRCOLBL,
+ RTF_PRINTDATA,
+ RTF_PSZ,
+ RTF_REVPROT,
+ RTF_RTLDOC,
+ RTF_SPRSSPBF,
+ RTF_SPRSTSP,
+ RTF_SWPBDR,
+ RTF_TRANSMF,
+ RTF_WRAPTRSP,
+
+ RTF_PRIVATE,
+ RTF_NOULTRLSPC,
+ RTF_MSMCAP,
+ RTF_NOLEAD,
+ RTF_NOSPACEFORUL,
+ RTF_LYTEXCTTP,
+ RTF_LYTPRTMET,
+ RTF_DNTBLNSBDB,
+ RTF_FROMTEXT,
+ RTF_EXPSHRTN,
+ RTF_PGBRDRT,
+ RTF_SPRSBSP,
+ RTF_PGBRDRR,
+ RTF_PGBRDRSNAP,
+ RTF_BDBFHDR,
+ RTF_SUBFONTBYSIZE,
+ RTF_TRUNCATEFONTHEIGHT,
+ RTF_SPRSLNSP,
+ RTF_SPRSTSM,
+ RTF_PGBRDRL,
+ RTF_WPJST,
+ RTF_PGBRDRB,
+ RTF_WPSP,
+ RTF_NOXLATTOYEN,
+ RTF_OLDLINEWRAP,
+ RTF_PGBRDRFOOT,
+ RTF_PGBRDRHEAD,
+ RTF_DEFLANGFE,
+ RTF_DOCTYPE,
+ RTF_PGBRDROPT,
+ RTF_VIEWKIND,
+ RTF_VIEWSCALE,
+ RTF_WINDOWCAPTION,
+ RTF_BRDRART,
+ RTF_VIEWZK,
+ RTF_DOCVAR,
+
+ RTF_DGMARGIN,
+ RTF_AFTNNCHOSUNG,
+ RTF_AFTNNCNUM,
+ RTF_AFTNNDBAR,
+ RTF_AFTNNDBNUM,
+ RTF_AFTNNDBNUMD,
+ RTF_AFTNNDBNUMK,
+ RTF_AFTNNDBNUMT,
+ RTF_AFTNNGANADA,
+ RTF_AFTNNGBNUM,
+ RTF_AFTNNGBNUMD,
+ RTF_AFTNNGBNUMK,
+ RTF_AFTNNGBNUML,
+ RTF_AFTNNZODIAC,
+ RTF_AFTNNZODIACD,
+ RTF_AFTNNZODIACL,
+ RTF_FTNNCHOSUNG,
+ RTF_FTNNCNUM,
+ RTF_FTNNDBAR,
+ RTF_FTNNDBNUM,
+ RTF_FTNNDBNUMD,
+ RTF_FTNNDBNUMK,
+ RTF_FTNNDBNUMT,
+ RTF_FTNNGANADA,
+ RTF_FTNNGBNUM,
+ RTF_FTNNGBNUMD,
+ RTF_FTNNGBNUMK,
+ RTF_FTNNGBNUML,
+ RTF_FTNNZODIAC,
+ RTF_FTNNZODIACD,
+ RTF_FTNNZODIACL,
+
+ RTF_ADEFLANG,
+ RTF_ADEFF,
+
+/* */
+
+ RTF_SECTD = RTF_SECTFMT,
+ RTF_ENDNHERE,
+ RTF_BINFSXN,
+ RTF_BINSXN,
+ RTF_SBKNONE,
+ RTF_SBKCOL,
+ RTF_SBKPAGE,
+ RTF_SBKEVEN,
+ RTF_SBKODD,
+ RTF_COLS,
+ RTF_COLSX,
+ RTF_COLNO,
+ RTF_COLSR,
+ RTF_COLW,
+ RTF_LINEBETCOL,
+ RTF_LINEMOD,
+ RTF_LINEX,
+ RTF_LINESTARTS,
+ RTF_LINERESTART,
+ RTF_LINEPAGE,
+ RTF_LINECONT,
+ RTF_PGWSXN,
+ RTF_PGHSXN,
+ RTF_MARGLSXN,
+ RTF_MARGRSXN,
+ RTF_MARGTSXN,
+ RTF_MARGBSXN,
+ RTF_GUTTERSXN,
+ RTF_LNDSCPSXN,
+ RTF_FACPGSXN,
+ RTF_TITLEPG,
+ RTF_HEADERY,
+ RTF_FOOTERY,
+ RTF_PGNSTARTS,
+ RTF_PGNCONT,
+ RTF_PGNRESTART,
+ RTF_PGNX,
+ RTF_PGNY,
+ RTF_PGNDEC,
+ RTF_PGNUCRM,
+ RTF_PGNLCRM,
+ RTF_PGNUCLTR,
+ RTF_PGNLCLTR,
+ RTF_VERTALT,
+ RTF_VERTALB,
+ RTF_VERTALC,
+ RTF_VERTALJ,
+
+ RTF_FOOTER,
+ RTF_FOOTERL,
+ RTF_FOOTERR,
+ RTF_FOOTERF,
+ RTF_HEADER,
+ RTF_HEADERL,
+ RTF_HEADERR,
+ RTF_HEADERF,
+ RTF_DS,
+ RTF_LTRSECT,
+ RTF_PGNHN,
+ RTF_PGNHNSC,
+ RTF_PGNHNSH,
+ RTF_PGNHNSM,
+ RTF_PGNHNSN,
+ RTF_PGNHNSP,
+ RTF_RTLSECT,
+ RTF_SECTUNLOCKED,
+ RTF_STEXTFLOW,
+ RTF_PGNCHOSUNG,
+ RTF_PGNCNUM,
+ RTF_PGNDBNUMK,
+ RTF_PGNDBNUMT,
+ RTF_PGNGANADA,
+ RTF_PGNGBNUM,
+ RTF_PGNGBNUMD,
+ RTF_PGNGBNUMK,
+ RTF_PGNGBNUML,
+ RTF_PGNZODIAC,
+ RTF_PGNZODIACD,
+ RTF_PGNZODIACL,
+ RTF_SECTDEFAULTCL,
+ RTF_SECTEXPAND,
+ RTF_SECTLINEGRID,
+ RTF_SECTSPECIFYCL,
+ RTF_SECTSPECIFYL,
+
+ // Swg-Header/Footer-Tokens
+ RTF_HEADER_YB = (RTF_SECTFMT|RTF_SWGDEFS),
+ RTF_HEADER_XL,
+ RTF_HEADER_XR,
+ RTF_FOOTER_YT,
+ RTF_FOOTER_XL,
+ RTF_FOOTER_XR,
+ RTF_HEADER_YH,
+ RTF_FOOTER_YH,
+ RTF_BALANCED_COLUMN,
+
+
+/* */
+
+ RTF_PARD = RTF_PARFMT,
+ RTF_S,
+ RTF_INTBL,
+ RTF_KEEP,
+ RTF_KEEPN,
+ RTF_LEVEL,
+ RTF_PAGEBB,
+ RTF_SBYS,
+ RTF_QL,
+ RTF_QR,
+ RTF_QJ,
+ RTF_QC,
+ RTF_FI,
+ RTF_LI,
+ RTF_LIN,
+ RTF_RI,
+ RTF_RIN,
+ RTF_SB,
+ RTF_SA,
+ RTF_SL,
+ RTF_HYPHPAR,
+ RTF_LTRPAR,
+ RTF_NOWIDCTLPAR,
+ RTF_RTLPAR,
+ RTF_SLMULT,
+ RTF_SUBDOCUMENT,
+
+ RTF_WIDCTLPAR,
+
+ RTF_LISTTEXT,
+ RTF_POSYIN,
+ RTF_PNRNOT,
+ RTF_BRDRDASHDOTSTR,
+ RTF_POSYOUT,
+ RTF_BRDRDASHD,
+ RTF_BRDRDASHDD,
+ RTF_BRDRENGRAVE,
+ RTF_BRDRTHTNLG,
+ RTF_BRDREMBOSS,
+ RTF_BRDRTNTHTNLG,
+ RTF_BRDRDASHSM,
+ RTF_BRDRTHTNMG,
+ RTF_OVERLAY,
+ RTF_BRDRTNTHSG,
+ RTF_BRDRTNTHMG,
+ RTF_BRDRTHTNSG,
+ RTF_BRDRTNTHLG,
+ RTF_BRDRTRIPLE,
+ RTF_BRDRTNTHTNSG,
+ RTF_BRDRTNTHTNMG,
+ RTF_BRDRWAVYDB,
+ RTF_BRDRWAVY,
+ RTF_ILVL,
+ RTF_DFRSTOP,
+ RTF_DFRXST,
+ RTF_PNRAUTH,
+ RTF_DFRSTART,
+ RTF_OUTLINELEVEL,
+ RTF_DFRAUTH,
+ RTF_DFRDATE,
+ RTF_PNRRGB,
+ RTF_PNRPNBR,
+ RTF_PNRSTART,
+ RTF_PNRXST,
+ RTF_PNRSTOP,
+ RTF_PNRDATE,
+ RTF_PNRNFC,
+ RTF_NOSNAPLINEGRID,
+ RTF_FAAUTO,
+ RTF_FAHANG,
+ RTF_FAVAR,
+ RTF_FACENTER,
+ RTF_FAROMAN,
+ RTF_FAFIXED,
+ RTF_ADJUSTRIGHT,
+ RTF_LS,
+ RTF_NOCWRAP,
+ RTF_NOOVERFLOW,
+ RTF_ASPALPHA,
+
+
+/* */
+
+ RTF_TX = RTF_TABSTOPDEF,
+ RTF_TB,
+ RTF_TQL,
+ RTF_TQR,
+ RTF_TQC,
+ RTF_TQDEC,
+ RTF_TLDOT,
+ RTF_TLHYPH,
+ RTF_TLUL,
+ RTF_TLTH,
+ RTF_TLEQ,
+
+ // Swg-TabStop-Tokens
+ RTF_TLSWG = (RTF_TABSTOPDEF|RTF_SWGDEFS),
+
+/* */
+
+ RTF_BRDRT = RTF_BRDRDEF,
+ RTF_BRDRB,
+ RTF_BRDRL,
+ RTF_BRDRR,
+ RTF_BRDRBTW,
+ RTF_BRDRBAR,
+ RTF_BOX,
+ RTF_BRSP,
+ RTF_BRDRW,
+ RTF_BRDRCF,
+ RTF_BRDRS,
+ RTF_BRDRTH,
+ RTF_BRDRSH,
+ RTF_BRDRDB,
+ RTF_BRDRDOT,
+ RTF_BRDRHAIR,
+ RTF_BRDRDASH,
+ RTF_BRDRINSET,
+ RTF_BRDROUTSET,
+ RTF_BRDRFRAME,
+
+ // Swg-Border-Tokens
+ RTF_BRDBOX = (RTF_BRDRDEF|RTF_SWGDEFS),
+ RTF_BRDLINE_COL,
+ RTF_BRDLINE_IN,
+ RTF_BRDLINE_OUT,
+ RTF_BRDLINE_DIST,
+
+/* */
+
+ RTF_PLAIN = RTF_CHRFMT,
+ RTF_B,
+ RTF_CAPS,
+ RTF_DN,
+ RTF_SUB,
+ RTF_NOSUPERSUB,
+ RTF_EXPND,
+ RTF_EXPNDTW,
+ RTF_KERNING,
+ RTF_F,
+ RTF_FS,
+ RTF_I,
+ RTF_OUTL,
+ RTF_SCAPS,
+ RTF_SHAD,
+ RTF_STRIKE,
+ RTF_UL,
+ RTF_ULD,
+ RTF_ULDB,
+ RTF_ULNONE,
+ RTF_ULW,
+ RTF_OL,
+ RTF_OLD,
+ RTF_OLDB,
+ RTF_OLNONE,
+ RTF_OLW,
+ RTF_UP,
+ RTF_SUPER,
+ RTF_V,
+ RTF_CF,
+ RTF_CB,
+ RTF_LANG,
+ RTF_CCHS,
+ RTF_CS,
+ RTF_LTRCH,
+ RTF_REVAUTH,
+ RTF_REVDTTM,
+ RTF_RTLCH,
+
+ RTF_CHBGFDIAG,
+ RTF_CHBGDKVERT,
+ RTF_CHBGDKHORIZ,
+ RTF_CHBRDR,
+ RTF_CHBGVERT,
+ RTF_CHBGHORIZ,
+ RTF_CHBGDKFDIAG,
+ RTF_CHBGDCROSS,
+ RTF_CHBGCROSS,
+ RTF_CHBGBDIAG,
+ RTF_CHBGDKDCROSS,
+ RTF_CHBGDKCROSS,
+ RTF_CHBGDKBDIAG,
+ RTF_ULDASHD,
+ RTF_ULDASH,
+ RTF_ULDASHDD,
+ RTF_ULWAVE,
+ RTF_ULC,
+ RTF_ULTH,
+ RTF_OLDASHD,
+ RTF_OLDASH,
+ RTF_OLDASHDD,
+ RTF_OLWAVE,
+ RTF_OLC,
+ RTF_OLTH,
+ RTF_EMBO,
+ RTF_IMPR,
+ RTF_STRIKED,
+ RTF_CRDATE,
+ RTF_CRAUTH,
+ RTF_CHARSCALEX,
+ RTF_CHCBPAT,
+ RTF_CHCFPAT,
+ RTF_CHSHDNG,
+ RTF_REVAUTHDEL,
+ RTF_REVDTTMDEL,
+ RTF_CGRID,
+ RTF_GCW,
+ RTF_NOSECTEXPAND,
+ RTF_GRIDTBL,
+ RTF_G,
+ RTF_ANIMTEXT,
+ RTF_ULTHD,
+ RTF_ULTHDASH,
+ RTF_ULLDASH,
+ RTF_ULTHLDASH,
+ RTF_ULTHDASHD,
+ RTF_ULTHDASHDD,
+ RTF_ULHWAVE,
+ RTF_ULULDBWAVE,
+ RTF_OLTHD,
+ RTF_OLTHDASH,
+ RTF_OLLDASH,
+ RTF_OLTHLDASH,
+ RTF_OLTHDASHD,
+ RTF_OLTHDASHDD,
+ RTF_OLHWAVE,
+ RTF_OLOLDBWAVE,
+
+ // association control words
+ RTF_AB,
+ RTF_ACAPS,
+ RTF_ACF,
+ RTF_ADN,
+ RTF_AEXPND,
+ RTF_AF,
+ RTF_AFS,
+ RTF_AI,
+ RTF_ALANG,
+ RTF_AOUTL,
+ RTF_ASCAPS,
+ RTF_ASHAD,
+ RTF_ASTRIKE,
+ RTF_AUL,
+ RTF_AULD,
+ RTF_AULDB,
+ RTF_AULNONE,
+ RTF_AULW,
+ RTF_AUP,
+
+ RTF_LOCH,
+ RTF_HICH,
+ RTF_DBCH,
+ RTF_LANGFE,
+ RTF_ACCNONE,
+ RTF_ACCDOT,
+ RTF_ACCCOMMA,
+ RTF_TWOINONE,
+ RTF_HORZVERT,
+
+ // Swg-Border-Tokens
+ RTF_SWG_ESCPROP = (RTF_CHRFMT|RTF_SWGDEFS),
+ RTF_HYPHEN,
+ RTF_HYPHLEAD,
+ RTF_HYPHTRAIL,
+ RTF_HYPHMAX,
+
+
+/* */
+
+ RTF_CHDATE = RTF_SPECCHAR,
+ RTF_CHDATEL,
+ RTF_CHDATEA,
+ RTF_CHTIME,
+ RTF_CHPGN,
+ RTF_CHFTN,
+ RTF_CHATN,
+ RTF_CHFTNSEP,
+ RTF_CHFTNSEPC,
+ RTF_CELL,
+ RTF_ROW,
+ RTF_PAR,
+ RTF_SECT,
+ RTF_PAGE,
+ RTF_COLUM,
+ RTF_LINE,
+ RTF_TAB,
+ RTF_EMDASH,
+ RTF_ENDASH,
+ RTF_BULLET,
+ RTF_LQUOTE,
+ RTF_RQUOTE,
+ RTF_LDBLQUOTE,
+ RTF_RDBLQUOTE,
+ RTF_FORMULA,
+ RTF_NONBREAKINGSPACE,
+ RTF_OPTIONALHYPHEN,
+ RTF_NONBREAKINGHYPHEN,
+ RTF_SUBENTRYINDEX,
+ RTF_IGNOREFLAG,
+ RTF_HEX,
+ RTF_EMSPACE,
+ RTF_ENSPACE,
+ RTF_LTRMARK,
+ RTF_SECTNUM,
+ RTF_SOFTCOL,
+ RTF_SOFTLHEIGHT,
+ RTF_SOFTLINE,
+ RTF_SOFTPAGE,
+ RTF_ZWJ,
+ RTF_ZWNJ,
+
+/* */
+
+ RTF_ABSW = RTF_APOCTL,
+ RTF_ABSH,
+ RTF_NOWRAP,
+ RTF_DXFRTEXT,
+ RTF_DFRMTXTX,
+ RTF_DFRMTXTY,
+ RTF_DROPCAPLI,
+ RTF_DROPCAPT,
+ RTF_ABSNOOVRLP,
+ RTF_PHMRG,
+ RTF_PHPG,
+ RTF_PHCOL,
+ RTF_POSX,
+ RTF_POSNEGX,
+ RTF_POSXC,
+ RTF_POSXI,
+ RTF_POSXO,
+ RTF_POSXL,
+ RTF_POSXR,
+ RTF_PVMRG,
+ RTF_PVPG,
+ RTF_PVPARA,
+ RTF_POSY,
+ RTF_POSNEGY,
+ RTF_POSYT,
+ RTF_POSYIL,
+ RTF_POSYB,
+ RTF_POSYC,
+ RTF_ABSLOCK,
+ RTF_FRMTXLRTB,
+ RTF_FRMTXTBRL,
+ RTF_FRMTXBTLR,
+ RTF_FRMTXLRTBV,
+ RTF_FRMTXTBRLV,
+
+ // Swg-Frame-Tokens
+ RTF_FLYPRINT = (RTF_APOCTL|RTF_SWGDEFS),
+ RTF_FLYOPAQUE,
+ RTF_FLYPRTCTD,
+ RTF_FLYMAINCNT,
+ RTF_FLYVERT,
+ RTF_FLYHORZ,
+ RTF_FLYOUTLEFT,
+ RTF_FLYOUTRIGHT,
+ RTF_FLYOUTUPPER,
+ RTF_FLYOUTLOWER,
+ RTF_FLYANCHOR,
+ RTF_FLY_CNTNT,
+ RTF_FLY_COLUMN,
+ RTF_FLY_PAGE,
+ RTF_FLY_INPARA,
+
+
+/* */
+
+ RTF_SHADING = RTF_SHADINGDEF,
+ RTF_CFPAT,
+ RTF_CBPAT,
+ RTF_BGHORIZ,
+ RTF_BGVERT,
+ RTF_BGFDIAG,
+ RTF_BGBDIAG,
+ RTF_BGCROSS,
+ RTF_BGDCROSS,
+ RTF_BGDKHORIZ,
+ RTF_BGDKVERT,
+ RTF_BGDKFDIAG,
+ RTF_BGDKBDIAG,
+ RTF_BGDKCROSS,
+ RTF_BGDKDCROSS,
+
+/* */
+
+ RTF_TROWD = RTF_TABLEDEF,
+ RTF_TRGAPH,
+ RTF_TRLEFT,
+ RTF_TRRH,
+
+ RTF_TRQL,
+ RTF_TRQR,
+ RTF_TRQC,
+
+ RTF_CLMGF,
+ RTF_CLMRG,
+ RTF_CELLX,
+ RTF_LTRROW,
+ RTF_RTLROW,
+ RTF_TRBRDRB,
+ RTF_TRBRDRH,
+ RTF_TRBRDRL,
+ RTF_TRBRDRR,
+ RTF_TRBRDRT,
+ RTF_TRBRDRV,
+ RTF_TRHDR,
+ RTF_TRKEEP,
+ RTF_TRPADDB,
+ RTF_TRPADDL,
+ RTF_TRPADDR,
+ RTF_TRPADDT,
+ RTF_TRPADDFB,
+ RTF_TRPADDFL,
+ RTF_TRPADDFR,
+ RTF_TRPADDFT,
+ RTF_TCELLD,
+ RTF_CLTXTBRL,
+ RTF_CLTXLRTB,
+ RTF_CLVERTALB,
+ RTF_CLVERTALT,
+ RTF_CLVERTALC,
+ RTF_CLVMGF,
+ RTF_CLVMRG,
+ RTF_CLTXTBRLV,
+ RTF_CLTXBTLR,
+ RTF_CLTXLRTBV,
+ RTF_CLPADL,
+ RTF_CLPADT,
+ RTF_CLPADB,
+ RTF_CLPADR,
+ RTF_CLPADFL,
+ RTF_CLPADFT,
+ RTF_CLPADFB,
+ RTF_CLPADFR,
+
+
+ RTF_CLBRDRT = (RTF_BRDRDEF|RTF_TABLEDEF),
+ RTF_CLBRDRL,
+ RTF_CLBRDRB,
+ RTF_CLBRDRR,
+
+ RTF_CLCFPAT = (RTF_SHADINGDEF|RTF_TABLEDEF),
+ RTF_CLCBPAT,
+ RTF_CLSHDNG,
+ RTF_CLBGHORIZ,
+ RTF_CLBGVERT,
+ RTF_CLBGFDIAG,
+ RTF_CLBGBDIAG,
+ RTF_CLBGCROSS,
+ RTF_CLBGDCROSS,
+ RTF_CLBGDKHOR,
+ RTF_CLBGDKVERT,
+ RTF_CLBGDKFDIAG,
+ RTF_CLBGDKBDIAG,
+ RTF_CLBGDKCROSS,
+ RTF_CLBGDKDCROSS,
+
+/* */
+
+
+/* */
+
+ RTF_DO = RTF_DRAWOBJECTS,
+ RTF_DOBXCOLUMN,
+ RTF_DOBXMARGIN,
+ RTF_DOBXPAGE,
+ RTF_DOBYMARGIN,
+ RTF_DOBYPAGE,
+ RTF_DOBYPARA,
+ RTF_DODHGT,
+ RTF_DOLOCK,
+ RTF_DPAENDHOL,
+ RTF_DPAENDL,
+ RTF_DPAENDSOL,
+ RTF_DPAENDW,
+ RTF_DPARC,
+ RTF_DPARCFLIPX,
+ RTF_DPARCFLIPY,
+ RTF_DPASTARTHOL,
+ RTF_DPASTARTL,
+ RTF_DPASTARTSOL,
+ RTF_DPASTARTW,
+ RTF_DPCALLOUT,
+ RTF_DPCOA,
+ RTF_DPCOACCENT,
+ RTF_DPCOBESTFIT,
+ RTF_DPCOBORDER,
+ RTF_DPCODABS,
+ RTF_DPCODBOTTOM,
+ RTF_DPCODCENTER,
+ RTF_DPCODTOP,
+ RTF_DPCOLENGTH,
+ RTF_DPCOMINUSX,
+ RTF_DPCOMINUSY,
+ RTF_DPCOOFFSET,
+ RTF_DPCOSMARTA,
+ RTF_DPCOTDOUBLE,
+ RTF_DPCOTRIGHT,
+ RTF_DPCOTSINGLE,
+ RTF_DPCOTTRIPLE,
+ RTF_DPCOUNT,
+ RTF_DPELLIPSE,
+ RTF_DPENDGROUP,
+ RTF_DPFILLBGCB,
+ RTF_DPFILLBGCG,
+ RTF_DPFILLBGCR,
+ RTF_DPFILLBGGRAY,
+ RTF_DPFILLBGPAL,
+ RTF_DPFILLFGCB,
+ RTF_DPFILLFGCG,
+ RTF_DPFILLFGCR,
+ RTF_DPFILLFGGRAY,
+ RTF_DPFILLFGPAL,
+ RTF_DPFILLPAT,
+ RTF_DPGROUP,
+ RTF_DPLINE,
+ RTF_DPLINECOB,
+ RTF_DPLINECOG,
+ RTF_DPLINECOR,
+ RTF_DPLINEDADO,
+ RTF_DPLINEDADODO,
+ RTF_DPLINEDASH,
+ RTF_DPLINEDOT,
+ RTF_DPLINEGRAY,
+ RTF_DPLINEHOLLOW,
+ RTF_DPLINEPAL,
+ RTF_DPLINESOLID,
+ RTF_DPLINEW,
+ RTF_DPPOLYCOUNT,
+ RTF_DPPOLYGON,
+ RTF_DPPOLYLINE,
+ RTF_DPPTX,
+ RTF_DPPTY,
+ RTF_DPRECT,
+ RTF_DPROUNDR,
+ RTF_DPSHADOW,
+ RTF_DPSHADX,
+ RTF_DPSHADY,
+ RTF_DPTXBX,
+ RTF_DPTXBXMAR,
+ RTF_DPTXBXTEXT,
+ RTF_DPX,
+ RTF_DPXSIZE,
+ RTF_DPY,
+ RTF_DPYSIZE,
+
+ RTF_DPCODESCENT,
+ RTF_BACKGROUND,
+ RTF_SHPBYPAGE,
+ RTF_SHPBYPARA,
+ RTF_SHPBYMARGIN,
+ RTF_SHPBXCOLUMN,
+ RTF_SHPBXMARGIN,
+ RTF_SHPBXPAGE,
+ RTF_SHPLOCKANCHOR,
+ RTF_SHPWR,
+ RTF_HLLOC,
+ RTF_HLSRC,
+ RTF_SHPWRK,
+ RTF_SHPTOP,
+ RTF_SHPRSLT,
+ RTF_HLFR,
+ RTF_SHPTXT,
+ RTF_SHPFHDR,
+ RTF_SHPGRP,
+ RTF_SHPRIGHT,
+ RTF_SHPFBLWTXT,
+ RTF_SHPZ,
+ RTF_SHPBOTTOM,
+ RTF_SHPLEFT,
+ RTF_SHPLID,
+
+/* */
+
+ RTF_OBJALIAS = RTF_OBJECTS,
+ RTF_OBJALIGN,
+ RTF_OBJAUTLINK,
+ RTF_OBJCLASS,
+ RTF_OBJCROPB,
+ RTF_OBJCROPL,
+ RTF_OBJCROPR,
+ RTF_OBJCROPT,
+ RTF_OBJDATA,
+ RTF_OBJECT,
+ RTF_OBJEMB,
+ RTF_OBJH,
+ RTF_OBJICEMB,
+ RTF_OBJLINK,
+ RTF_OBJLOCK,
+ RTF_OBJNAME,
+ RTF_OBJPUB,
+ RTF_OBJSCALEX,
+ RTF_OBJSCALEY,
+ RTF_OBJSECT,
+ RTF_OBJSETSIZE,
+ RTF_OBJSUB,
+ RTF_OBJTIME,
+ RTF_OBJTRANSY,
+ RTF_OBJUPDATE,
+ RTF_OBJW,
+ RTF_RESULT,
+ RTF_RSLTBMP,
+ RTF_RSLTMERGE,
+ RTF_RSLTPICT,
+ RTF_RSLTRTF,
+ RTF_RSLTTXT,
+ RTF_OBJOCX,
+ RTF_OBJHTML,
+ RTF_OBJATTPH,
+
+/* */
+
+ RTF_PN = RTF_NUMBULLETS,
+ RTF_PNACROSS,
+ RTF_PNB,
+ RTF_PNCAPS,
+ RTF_PNCARD,
+ RTF_PNCF,
+ RTF_PNDEC,
+ RTF_PNF,
+ RTF_PNFS,
+ RTF_PNHANG,
+ RTF_PNI,
+ RTF_PNINDENT,
+ RTF_PNLCLTR,
+ RTF_PNLCRM,
+ RTF_PNLVL,
+ RTF_PNLVLBLT,
+ RTF_PNLVLBODY,
+ RTF_PNLVLCONT,
+ RTF_PNNUMONCE,
+ RTF_PNORD,
+ RTF_PNORDT,
+ RTF_PNPREV,
+ RTF_PNQC,
+ RTF_PNQL,
+ RTF_PNQR,
+ RTF_PNRESTART,
+ RTF_PNSCAPS,
+ RTF_PNSECLVL,
+ RTF_PNSP,
+ RTF_PNSTART,
+ RTF_PNSTRIKE,
+ RTF_PNTEXT,
+ RTF_PNTXTA,
+ RTF_PNTXTB,
+ RTF_PNUCLTR,
+ RTF_PNUCRM,
+ RTF_PNUL,
+ RTF_PNULD,
+ RTF_PNULDB,
+ RTF_PNULNONE,
+ RTF_PNULW,
+ RTF_LIST,
+ RTF_LISTLEVEL,
+ RTF_LISTOVERRIDE,
+ RTF_LISTOVERRIDETABLE,
+ RTF_LISTTABLE,
+ RTF_LISTNAME,
+ RTF_LEVELNUMBERS,
+ RTF_LEVELNORESTART,
+ RTF_LEVELNFC,
+ RTF_LEVELOLD,
+ RTF_LISTOVERRIDECOUNT,
+ RTF_LISTTEMPLATEID,
+ RTF_LEVELINDENT,
+ RTF_LEVELFOLLOW,
+ RTF_LEVELLEGAL,
+ RTF_LEVELJC,
+ RTF_LISTOVERRIDESTART,
+ RTF_LISTID,
+ RTF_LISTRESTARTHDN,
+ RTF_LEVELTEXT,
+ RTF_LISTOVERRIDEFORMAT,
+ RTF_LEVELPREVSPACE,
+ RTF_LEVELPREV,
+ RTF_LEVELSPACE,
+ RTF_LISTSIMPLE,
+ RTF_LEVELSTARTAT,
+ RTF_PNAIUEO,
+ RTF_PNAIUEOD,
+ RTF_PNCHOSUNG,
+ RTF_PNDBNUMD,
+ RTF_PNDBNUMK,
+ RTF_PNDBNUML,
+ RTF_PNDBNUMT,
+ RTF_PNGANADA,
+ RTF_PNGBNUM,
+ RTF_PNGBNUMD,
+ RTF_PNGBNUMK,
+ RTF_PNGBNUML,
+ RTF_PNZODIAC,
+ RTF_PNZODIACD,
+ RTF_PNZODIACL,
+ RTF_LFOLEVEL,
+
+/* */
+
+ RTF_GRF_ALIGNV= RTF_SWGDEFS,
+ RTF_GRF_ALIGNH,
+ RTF_GRF_MIRROR,
+ RTF_SWG_PRTDATA,
+ RTF_BKMK_KEY,
+ RTF_SHADOW,
+ RTF_SHDW_DIST,
+ RTF_SHDW_STYLE,
+ RTF_SHDW_COL,
+ RTF_SHDW_FCOL,
+ RTF_PGDSCTBL,
+ RTF_PGDSC,
+ RTF_PGDSCUSE,
+ RTF_PGDSCNXT,
+ RTF_PGDSCNO,
+ RTF_PGBRK,
+ RTF_SOUTLVL,
+
+// shapes
+ RTF_SHP, RTF_SN, RTF_SV, RTF_SP
+/*
+ RTF_SHPLEFT,
+ RTF_SHPTOP,
+ RTF_SHPBOTTOM,
+ RTF_SHPRIGHT
+*/
+
+};
+
+#endif // _RTFTOKEN_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/ruler.hxx b/include/svtools/ruler.hxx
new file mode 100644
index 000000000000..a06109bca6a0
--- /dev/null
+++ b/include/svtools/ruler.hxx
@@ -0,0 +1,802 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _RULER_HXX
+#define _RULER_HXX
+
+#include "svtools/svtdllapi.h"
+#include <tools/link.hxx>
+#include <vcl/window.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/field.hxx>
+
+class MouseEvent;
+class TrackingEvent;
+class DataChangedEvent;
+
+/*************************************************************************
+
+Description
+============
+
+class Ruler
+
+This class is used for displaying a ruler, but it can also be used
+for setting or moving tabs and margins.
+
+--------------------------------------------------------------------------
+
+WinBits
+
+WB_HORZ ruler is displayed horizontally
+WB_VERT ruler is displayed vertically
+WB_3DLOOK 3D look
+WB_BORDER border at the bottom/right margin
+WB_EXTRAFIELD Field in the upper left corner for
+ displaying and selecting tabs, origin of coordinates, ...
+WB_RIGHT_ALIGNED Marks the vertical ruler as right aligned
+
+--------------------------------------------------------------------------
+
+All ruler parameters are set in pixel units. This way double conversions
+and rounding errors are avoided and the ruler displays the margins
+at their actual position in the document. Because of this, the application can,
+for example in tables, do its own roundings and the positions on the ruler will
+still match those in the document. However, for the ruler to know how the
+document is displayed on the screen, some additional values have to be configured
+
+SetWinPos() sets the offset of the ruler's edit window. In doing so,
+the width of the window can also be configured. If there is a 0 among the
+values passed to the function, the position/width is automatically set to
+the width of the ruler.
+
+SetPagePos() sets the offset of the page relative to the edit window and the
+width of the page. If there is a 0 among the values passed to the function,
+the position/width is automatically set as if the page filled the whole edit window.
+
+SetBorderPos() sets the offset of the border. The position is relative to
+the upper/left margin of the window. This is needed when there are a horizontal
+and a vertical ruler visible at the same time. Example:
+ aHRuler.SetBorderPos( aVRuler.GetSizePixel().Width()-1 );
+
+SetNullOffset() sets the origin relative to the page.
+
+All the other values (margins, indentation, tabs, ...) refer to the origin,
+which is set with SetNullOffset().
+
+The values are computed as described below:
+
+- WinPos (if both windows have the same parent)
+
+ Point aHRulerPos = aHRuler.GetPosPixel();
+ Point aEditWinPos = aEditWin.GetPosPixel();
+ aHRuler.SetWinPos( aEditWinPos().X() - aHRulerPos.X() );
+
+- PagePos
+
+ Point aPagePos = aEditWin.LogicToPixel( aEditWin.GetPagePos() );
+ aHRuler.SetPagePos( aPagePos().X() );
+
+- All other values
+
+ Add the logical values, recompute as position and subtract the
+ previously saved pixel positions (of PagePos and Null Offset).
+
+--------------------------------------------------------------------------
+
+SetUnit() and SetZoom() configure which unit is used to display
+the values on the ruler. The following units are accepted:
+
+ FUNIT_MM
+ FUNIT_CM (Default)
+ FUNIT_M
+ FUNIT_KM
+ FUNIT_INCH
+ FUNIT_FOOT
+ FUNIT_MILE
+ FUNIT_POINT
+ FUNIT_PICA
+
+--------------------------------------------------------------------------
+
+SetMargin1() sets the upper/left margin and SetMargin2() sets the
+bottom/right margin. If these methods are called without arguments,
+no margins are displayed. Otherwise, the following arguments can be passed:
+
+ long nPos - offset in pixels relative to the origin
+ sal_uInt16 nStyle - bit style:
+ RULER_MARGIN_SIZEABLE
+ margin size can be changed
+
+ The following bits can be set in addition
+ to these styles:
+ RULER_STYLE_INVISIBLE
+
+
+SetBorders() sets an array of margins. To do this, an array of type RulerBorder
+has to be passed. In the array, the following values have to be initialized:
+
+ long nPos - offset in pixels relative to the origin
+ long nWidth - column spacing in pixels (can also be 0, for example,
+ for table columns)
+ sal_uInt16 nStyle - bit style:
+ RULER_BORDER_SIZEABLE
+ Column spacing can be changed. This flag should
+ only be set if the size of the spacing is changed,
+ not that of a cell.
+ RULER_BORDER_MOVEABLE
+ Column spacing/border can be moved. Whenever
+ table borders are to be moved, this flag should
+ be set instead of SIZEABLE (SIZEABLE indicates
+ that the size of a spacing, not that of a single
+ cell can be changed).
+ RULER_BORDER_VARIABLE
+ Not all of the column spacings are equal
+ RULER_BORDER_TABLE
+ Table border. Whenever this style ist set, the column
+ width must be 0.
+ RULER_BORDER_SNAP
+ Auxiliary line. Whenever this style is set, the
+ column width must be 0.
+ RULER_BORDER_MARGIN
+ Margin. Whenever this style is set, the column
+ width must be 0.
+
+ The following bits can be set in addition
+ to these styles:
+ RULER_STYLE_INVISIBLE
+
+SetIndents() sets an array of indents. This method may only be used for horizontal
+rulers. A Ruler Indent must be passed as an argument, with the following values
+initialized:
+
+ long nPos - offset relative to the origin in pixels
+ sal_uInt16 nStyle - bit style:
+ RULER_INDENT_TOP (indent of the first line)
+ RULER_INDENT_BOTTOM (left/right indent)
+ RULER_INDENT_BORDER (Vertical line that shows the border distance)
+ The following bits can be set in addition
+ to these styles:
+ RULER_STYLE_DONTKNOW (for old position or for
+ ambiguity)
+ RULER_STYLE_INVISIBLE
+
+SetTabs() sets an array of tabs. This method may only be used for horizontal rulers.
+An array of type RulerTab must be passed as an argument, with the following values
+initialized:
+
+ long nPos - offset relative to the origin in pixels
+ sal_uInt16 nStyle - bit style:
+ RULER_TAB_DEFAULT (can't be selected)
+ RULER_TAB_LEFT
+ RULER_TAB_CENTER
+ RULER_TAB_RIGHT
+ RULER_TAB_DECIMAL
+ The following bits can be set in addition
+ to these styles:
+ RULER_STYLE_DONTKNOW (for old position of for
+ ambiguity)
+ RULER_STYLE_INVISIBLE
+
+SetLines() displays position lines in the ruler. An array of type RulerLine must be passed, with
+the following values initialized:
+
+ long nPos - offset relative to the origin in pixels
+ sal_uInt16 nStyle - bit style (has to be 0 currently)
+
+--------------------------------------------------------------------------
+
+If the user should also be able to change the margins tabs, borders, ...
+in the ruler, a bit more effort is necessary. In this case, the StartDrag(),
+Drag() and EndDrag() methods have to be overridden. For the StartDrag() method
+it is possible to prevent dragging by returning FALSE. In the drag handler,
+the drag position must be queried and the values must be moved to the new
+position. This is done by calling the particular Set methods. While in the
+drag handler, the values are just cached and only afterward the ruler is redrawn.
+All the handlers can also be set as links with the particular Set..Hdl() methods.
+
+ - StartDrag()
+ Is called when dragging is started. If FALSE is returned, the dragging.
+ won't be executed. If TRUE is returned, the dragging will be permitted.
+ If the handler isn't overridden, FALSE will be returned.
+
+ - EndDrag()
+ Is called at the end of dragging.
+
+ - Drag()
+ Is called when dragging takes place.
+
+ - Click()
+ This handler is called when no element has been clicked on.
+ The position can be queried with GetClickPos(). This way it is possible
+ to, for example, ser tabs in the ruler. After calling the click handler,
+ the drag, if any, is immediately triggered. This makes it possible to
+ set a new tab in the click handler and then immediately move it.
+
+ - DoubleClick()
+ This handler is called when a double-click has been performed outside
+ the special panel. The methods GetClickType(), GetClickAryPos() and
+ GetClickPos() can be used to query what has been clicked on.
+ This way you can, for example, show the tab dialog when a double-click
+ is performed on a tab.
+
+In the drag handler it is possible to query what has been dragged and where
+it has been dragged. There are the following query methods:
+
+ - GetDragType()
+ Returns what has been dragged.
+ RULER_TYPE_MARGIN1
+ RULER_TYPE_MARGIN2
+ RULER_TYPE_BORDER
+ RULER_TYPE_INDENT
+ RULER_TYPE_TAB
+
+ - GetDragPos()
+ Returns the pixel position to which the user has moved the mouse
+ relative to the set zero-offset.
+
+ - GetDragAryPos()
+ Liefert den Index im Array zurueck, wenn ein Border, Indent oder ein
+ Tab gedragt wird. Achtung: Es wird die Array-Position waehrend des
+ gesammten Drag-Vorgangs von dem Item im Array was vor dem Drag gesetzt
+ war zurueckgeben. Dadurch ist es zum Beispiel auch moeglich, einen
+ Tab nicht mehr anzuzeigen, wenn die Maus nach unten/rechts aus dem
+ Lineal gezogen wird.
+
+ - GetDragSize()
+ Wenn Borders gedragt werden, kann hierueber abgefragt werden, ob
+ die Groesse bzw. welche Seite oder die Position geaendert werden soll.
+ RULER_DRAGSIZE_MOVE oder 0 - Move
+ RULER_DRAGSIZE_1 - Linke/obere Kante
+ RULER_DRAGSIZE_2 - Rechte/untere Kante
+
+ - IsDragDelete()
+ Mit dieser Methode kann abgefragt werden, ob beim Draggen die
+ Maus unten/rechts aus dem Fenster gezogen wurde. Damit kann
+ zum Beispiel festgestellt werden, ob der Benutzer einen Tab
+ loeschen will.
+
+ - IsDragCanceled()
+ Mit dieser Methode kann im EndDrag-Handler abgefragt werden,
+ ob die Aktion abgebrochen wurde, indem der Anwender die
+ Maus oben/links vom Fenster losgelassen hat oder ESC gedrueckt
+ hat. In diesem Fall werden die Werte nicht uebernommen. Wird
+ waehrend des Draggings die Maus oben/links aus dem Fenster
+ gezogen, werden automatisch die alten Werte dargestellt, ohne das
+ der Drag-Handler gerufen wird.
+ Falls der Benutzer jedoch den Wert auf die alte Position
+ zurueckgeschoben hat, liefert die Methode trotzdem sal_False. Falls
+ dies vermieden werden soll, muss sich die Applikation im StartDrag-
+ Handler den alten Wert merken und im EndDrag-Handler den Wert
+ vergleichen.
+
+ - GetDragScroll()
+ Mit dieser Methode kann abgefragt werden, ob gescrollt werden
+ soll. Es wird einer der folgenden Werte zurueckgegeben:
+ RULER_SCROLL_NO - Drag-Position befindet sich
+ an keinem Rand und somit
+ muss nicht gescrollt werden.
+ RULER_SCROLL_1 - Drag-Position befindet sich
+ am linken/oberen Rand und
+ somit sollte das Programm evt.
+ ein Srcoll ausloesen.
+ RULER_SCROLL_2 - Drag-Position befindet sich
+ am rechten/unteren Rand und
+ somit sollte das Programm evt.
+ ein Srcoll ausloesen.
+
+ - GetDragModifier()
+ Liefert die Modifier-Tasten zurueck, die beim Starten des Drag-
+ Vorgangs gedrueckt waren. Siehe MouseEvent.
+
+ - GetClickPos()
+ Liefert die Pixel-Position bezogen auf den eingestellten Null-Offset
+ zurueck, wo der Anwender die Maus gedrueckt hat.
+
+ - GetClickType()
+ Liefert zurueck, was per DoubleClick betaetigt wird:
+ RULER_TYPE_DONTKNOW (kein Element im Linealbereich)
+ RULER_TYPE_OUTSIDE (ausserhalb des Linealbereichs)
+ RULER_TYPE_MARGIN1 (nur Margin1-Kante)
+ RULER_TYPE_MARGIN2 (nur Margin2-Kante)
+ RULER_TYPE_BORDER (Border: GetClickAryPos())
+ RULER_TYPE_INDENT (Einzug: GetClickAryPos())
+ RULER_TYPE_TAB (Tab: GetClickAryPos())
+
+ - GetClickAryPos()
+ Liefert den Index im Array zurueck, wenn ein Border, Indent oder ein
+ Tab per DoubleClick betaetigt wird.
+
+ - GetType()
+ Mit dieser Methode kann man einen HitTest durchfuehren, um
+ gegebenenfalls ueber das Abfangen des MouseButtonDown-Handlers
+ auch ueber die rechte Maustaste etwas auf ein Item anzuwenden. Als
+ Paramter ueber gibt man die Fensterposition und gegebenenfalls
+ einen Pointer auf einen sal_uInt16, um die Array-Position eines
+ Tabs, Indent oder Borders mitzubekommen. Als Type werden folgende
+ Werte zurueckgegeben:
+ RULER_TYPE_DONTKNOW (kein Element im Linealbereich)
+ RULER_TYPE_OUTSIDE (ausserhalb des Linealbereichs)
+ RULER_TYPE_MARGIN1 (nur Margin1-Kante)
+ RULER_TYPE_MARGIN2 (nur Margin2-Kante)
+ RULER_TYPE_BORDER (Border: GetClickAryPos())
+ RULER_TYPE_INDENT (Einzug: GetClickAryPos())
+ RULER_TYPE_TAB (Tab: GetClickAryPos())
+
+Wenn der Drag-Vorgang abgebrochen werden soll, kann der Drag-Vorgang
+mit CancelDrag() abgebrochen werden. Folgende Methoden gibt es fuer die
+Drag-Steuerung:
+
+ - IsDrag()
+ Liefert sal_True zurueck, wenn sich das Lineal im Drag-Vorgang befindet.
+
+ - CancelDrag()
+ Bricht den Drag-Vorgang ab, falls einer durchgefuehrt wird. Dabei
+ werden die alten Werte wieder hergestellt und der Drag und der
+ EndDrag-Handler gerufen.
+
+Um vom Dokument ein Drag auszuloesen, gibt es folgende Methoden:
+
+ - StartDocDrag()
+ Dieser Methode werden der MouseEvent vom Dokumentfenster und
+ was gedragt werden soll uebergeben. Wenn als DragType
+ RULER_TYPE_DONTKNOW uebergeben wird, bestimmt das Lineal, was
+ verschoben werden soll. Bei den anderen, wird der Drag nur dann
+ gestartet, wenn auch an der uebergebenen Position ein entsprechendes
+ Element gefunden wurde. Dies ist zun Beispiel dann notwendig, wenn
+ zum Beispiel Einzuege und Spalten an der gleichen X-Position liegen.
+ Der Rueckgabewert gibt an, ob der Drag ausgeloest wurde. Wenn ein
+ Drag ausgeloest wird, uebernimmt das Lineal die normale Drag-Steuerung
+ und verhaelt sich dann so, wie als wenn direkt in das Lineal geklickt
+ wurde. So captured das Lineal die Mouse und uebernimmt auch die
+ Steuerung des Cancel (ueber Tastatur, oder wenn die Mouse ueber
+ oder links vom Lineal ruasgeschoben wird). Auch alle Handler werden
+ gerufen (inkl. des StartDrag-Handlers). Wenn ein MouseEvent mit
+ Click-Count 2 uebergeben wird auch der DoubleClick-Handler
+ entsprechend gerufen.
+
+--------------------------------------------------------------------------
+
+Fuer das Extra-Feld kann der Inhalt bestimmt werden und es gibt Handler,
+womit man bestimmte Aktionen abfangen kann.
+
+ - ExtraDown()
+ Dieser Handler wird gerufen, wenn im Extra-Feld die Maus
+ gedrueckt wird.
+
+ - SetExtraType()
+ Mit dieser Methode kann festgelegt werden, was im ExtraFeld
+ dargestellt werden soll.
+ - ExtraType Was im Extrafeld dargestellt werden soll
+ RULER_EXTRA_DONTKNOW (Nichts)
+ RULER_EXTRA_NULLOFFSET (Koordinaaten-Kreuz)
+ RULER_EXTRA_TAB (Tab)
+ - sal_uInt16 nStyle Bitfeld als Style:
+ RULER_STYLE_HIGHLIGHT (selektiert)
+ RULER_TAB_... (ein Tab-Style)
+
+ - GetExtraClick()
+ Liefert die Anzahl der Mausclicks zurueck. Dadurch ist es zum
+ Beispiel auch moeglich, auch durch einen DoubleClick im Extrafeld
+ eine Aktion auszuloesen.
+
+ - GetExtraModifier()
+ Liefert die Modifier-Tasten zurueck, die beim Klicken in das Extra-
+ Feld gedrueckt waren. Siehe MouseEvent.
+
+--------------------------------------------------------------------------
+
+Weitere Hilfsfunktionen:
+
+- static Ruler::DrawTab()
+ Mit dieser Methode kann ein Tab auf einem OutputDevice ausgegeben
+ werden. Dadurch ist es moeglich, auch in Dialogen die Tabs so
+ anzuzeigen, wie Sie im Lineal gemalt werden.
+
+ Diese Methode gibt den Tab zentriert an der uebergebenen Position
+ aus. Die Groesse der Tabs kann ueber die Defines RULER_TAB_WIDTH und
+ RULER_TAB_HEIGHT bestimmt werden.
+
+--------------------------------------------------------------------------
+
+Tips zur Benutzung des Lineals:
+
+- Bei dem Lineal muss weder im Drag-Modus noch sonst das Setzen der Werte
+ in SetUpdateMode() geklammert werden. Denn das Lineal sorgt von sich
+ aus dafuer, das wenn mehrere Werte gesetzt werden, diese automatisch
+ zusammengefast werden und flackerfrei ausgegeben werden.
+
+- Initial sollten beim Lineal zuerst die Groessen, Positionen und Werte
+ gesetzt werden, bevor es angezeigt wird. Dies ist deshalb wichtig, da
+ ansonsten viele Werte unnoetig berechnet werden.
+
+- Wenn das Dokumentfenster, in dem sich das Lineal befindet aktiv bzw.
+ deaktiv wird, sollten die Methoden Activate() und Deactivate() vom
+ Lineal gerufen werden. Denn je nach Einstellungen und System wird die
+ Anzeige entsprechend umgeschaltet.
+
+- Zum Beispiel sollte beim Drag von Tabs und Einzuegen nach Moeglichkeit die
+ alten Positionen noch mit angezeigt werden. Dazu sollte zusaetzlich beim
+ Setzen der Tabs und Einzuege als erstes im Array die alten Positionen
+ eingetragen werden und mit dem Style RULER_STYLE_DONTKNOW verknuepft
+ werden. Danach sollte im Array die restlichen Werte eingetragen werden.
+
+- Bei mehreren markierten Absaetzen und Tabellen-Zellen, sollten die Tabs
+ und Einzuege in grau von der ersten Zelle, bzw. vom ersten Absatz
+ angezeigt werden. Dies kann man auch ueber den Style RULER_STYLE_DONTKNOW
+ erreichen.
+
+- Die Bemassungspfeile sollten immer dann angezeigt, wenn beim Drag die
+ Alt-Taste (WW-Like) gedrueckt wird. Vielleicht sollte diese Einstellung
+ auch immer vornehmbar sein und vielleicht beim Drag immer die
+ Bemassungspfeile dargestellt werden. Bei allen Einstellung sollten die
+ Werte immer auf ein vielfaches eines Wertes gerundet werden, da die
+ Bildschirmausloesung sehr ungenau ist.
+
+- DoppelKlicks sollten folgendermassen behandelt werden (GetClickType()):
+ - RULER_TYPE_DONTKNOW
+ RULER_TYPE_MARGIN1
+ RULER_TYPE_MARGIN2
+ Wenn die Bedingunden GetClickPos() <= GetMargin1() oder
+ GetClickPos() >= GetMargin2() oder der Type gleich
+ RULER_TYPE_MARGIN1 oder RULER_TYPE_MARGIN2 ist, sollte
+ ein SeitenDialog angezeigt werden, wo der Focus auf dem
+ entsprechenden Rand steht
+ - RULER_TYPE_BORDER
+ Es sollte ein Spalten- oder Tabellen-Dialog angezeigt werden,
+ wo der Focus auf der entsprechenden Spalte steht, die mit
+ GetClickAryPos() abgefragt werden kann.
+ - RULER_TYPE_INDENT
+ Es sollte der Dialog angezeigt werden, wo die Einzuege eingestellt
+ werden koennen. Dabei sollte der Focus auf dem Einzug stehen, der
+ mit GetClickAryPos() ermittelt werden kann.
+ - RULER_TYPE_TAB
+ Es sollte ein TabDialog angezeigt werden, wo der Tab selektiert
+ sein sollte, der ueber GetClickAryPos() abgefragt werden kann.
+
+*************************************************************************/
+
+// -----------
+// - WinBits -
+// -----------
+
+#define WB_EXTRAFIELD ((WinBits)0x00004000)
+#define WB_RIGHT_ALIGNED ((WinBits)0x00008000)
+#define WB_STDRULER WB_HORZ
+
+// ---------------
+// - Ruler-Types -
+// ---------------
+
+struct ImplRulerHitTest;
+
+// --------------
+// - Ruler-Type -
+// --------------
+
+enum RulerType { RULER_TYPE_DONTKNOW, RULER_TYPE_OUTSIDE,
+ RULER_TYPE_MARGIN1, RULER_TYPE_MARGIN2,
+ RULER_TYPE_BORDER, RULER_TYPE_INDENT, RULER_TYPE_TAB };
+
+enum RulerExtra { RULER_EXTRA_DONTKNOW,
+ RULER_EXTRA_NULLOFFSET, RULER_EXTRA_TAB };
+
+#define RULER_STYLE_HIGHLIGHT ((sal_uInt16)0x8000)
+#define RULER_STYLE_DONTKNOW ((sal_uInt16)0x4000)
+#define RULER_STYLE_INVISIBLE ((sal_uInt16)0x2000)
+
+#define RULER_DRAGSIZE_MOVE 0
+#define RULER_DRAGSIZE_1 1
+#define RULER_DRAGSIZE_2 2
+
+#define RULER_MOUSE_BORDERMOVE 5
+#define RULER_MOUSE_BORDERWIDTH 5
+#define RULER_MOUSE_MARGINWIDTH 3
+
+#define RULER_SCROLL_NO 0
+#define RULER_SCROLL_1 1
+#define RULER_SCROLL_2 2
+
+// ---------------
+// - RulerMargin -
+// ---------------
+
+#define RULER_MARGIN_SIZEABLE ((sal_uInt16)0x0001)
+
+// ---------------
+// - RulerBorder -
+// ---------------
+
+#define RULER_BORDER_SIZEABLE ((sal_uInt16)0x0001)
+#define RULER_BORDER_MOVEABLE ((sal_uInt16)0x0002)
+#define RULER_BORDER_VARIABLE ((sal_uInt16)0x0004)
+#define RULER_BORDER_TABLE ((sal_uInt16)0x0008)
+#define RULER_BORDER_SNAP ((sal_uInt16)0x0010)
+#define RULER_BORDER_MARGIN ((sal_uInt16)0x0020)
+
+struct RulerBorder
+{
+ long nPos;
+ long nWidth;
+ sal_uInt16 nStyle;
+ //minimum/maximum position, supported for table borders/rows
+ long nMinPos;
+ long nMaxPos;
+};
+
+// ---------------
+// - RulerIndent -
+// ---------------
+
+#define RULER_INDENT_TOP ((sal_uInt16)0x0000)
+#define RULER_INDENT_BOTTOM ((sal_uInt16)0x0001)
+#define RULER_INDENT_BORDER ((sal_uInt16)0x0002)
+#define RULER_INDENT_STYLE ((sal_uInt16)0x000F)
+
+struct RulerIndent
+{
+ long nPos;
+ sal_uInt16 nStyle;
+};
+
+// ------------
+// - RulerTab -
+// ------------
+
+#define RULER_TAB_LEFT ((sal_uInt16)0x0000)
+#define RULER_TAB_RIGHT ((sal_uInt16)0x0001)
+#define RULER_TAB_DECIMAL ((sal_uInt16)0x0002)
+#define RULER_TAB_CENTER ((sal_uInt16)0x0003)
+#define RULER_TAB_DEFAULT ((sal_uInt16)0x0004)
+#define RULER_TAB_STYLE ((sal_uInt16)0x000F)
+#define RULER_TAB_RTL ((sal_uInt16)0x0010)
+
+struct RulerTab
+{
+ long nPos;
+ sal_uInt16 nStyle;
+};
+
+#define RULER_TAB_WIDTH 7
+#define RULER_TAB_HEIGHT 6
+
+// -------------
+// - RulerLine -
+// -------------
+
+struct RulerLine
+{
+ long nPos;
+ sal_uInt16 nStyle;
+};
+
+class ImplRulerData;
+// ---------
+// - Ruler -
+// ---------
+
+class SVT_DLLPUBLIC Ruler : public Window
+{
+private:
+ VirtualDevice maVirDev;
+ MapMode maMapMode;
+ long mnBorderOff;
+ long mnWinOff;
+ long mnWinWidth;
+ long mnWidth;
+ long mnHeight;
+ long mnVirOff;
+ long mnVirWidth;
+ long mnVirHeight;
+ long mnBorderWidth;
+ long mnStartDragPos;
+ long mnDragPos;
+ sal_uLong mnUpdateEvtId;
+ ImplRulerData* mpSaveData;
+ ImplRulerData* mpData;
+ ImplRulerData* mpDragData;
+ Rectangle maExtraRect;
+ WinBits mnWinStyle;
+ sal_uInt16 mnUnitIndex;
+ sal_uInt16 mnDragAryPos;
+ sal_uInt16 mnDragSize;
+ sal_uInt16 mnDragScroll;
+ sal_uInt16 mnDragModifier;
+ sal_uInt16 mnExtraStyle;
+ sal_uInt16 mnExtraClicks;
+ sal_uInt16 mnExtraModifier;
+ long mnCharWidth;
+ long mnLineHeight;
+
+ RulerExtra meExtraType;
+ RulerType meDragType;
+ MapUnit meSourceUnit;
+ FieldUnit meUnit;
+ Fraction maZoom;
+ sal_Bool mbCalc;
+ sal_Bool mbFormat;
+ sal_Bool mbDrag;
+ sal_Bool mbDragDelete;
+ sal_Bool mbDragCanceled;
+ sal_Bool mbAutoWinWidth;
+ sal_Bool mbActive;
+ sal_uInt8 mnUpdateFlags;
+ Link maStartDragHdl;
+ Link maDragHdl;
+ Link maEndDragHdl;
+ Link maClickHdl;
+ Link maDoubleClickHdl;
+ Link maExtraDownHdl;
+
+#ifdef _SV_RULER_CXX
+ SVT_DLLPRIVATE void ImplVDrawLine( long nX1, long nY1, long nX2, long nY2 );
+ SVT_DLLPRIVATE void ImplVDrawRect( long nX1, long nY1, long nX2, long nY2 );
+ SVT_DLLPRIVATE void ImplVDrawText( long nX, long nY, const String& rText, long nMin = LONG_MIN, long nMax = LONG_MAX );
+
+ SVT_DLLPRIVATE void ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter );
+ SVT_DLLPRIVATE void ImplDrawBorders( long nMin, long nMax, long nVirTop, long nVirBottom );
+ SVT_DLLPRIVATE void ImplDrawIndent( const Polygon& rPoly, sal_uInt16 nStyle );
+ SVT_DLLPRIVATE void ImplDrawIndents( long nMin, long nMax, long nVirTop, long nVirBottom );
+ SVT_DLLPRIVATE void ImplDrawTab( OutputDevice* pDevice, const Point& rPos, sal_uInt16 nStyle );
+ SVT_DLLPRIVATE void ImplDrawTabs( long nMin, long nMax, long nVirTop, long nVirBottom );
+ using Window::ImplInit;
+ SVT_DLLPRIVATE void ImplInit( WinBits nWinBits );
+ SVT_DLLPRIVATE void ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground );
+ SVT_DLLPRIVATE void ImplCalc();
+ SVT_DLLPRIVATE void ImplFormat();
+ SVT_DLLPRIVATE void ImplInitExtraField( sal_Bool bUpdate );
+ SVT_DLLPRIVATE void ImplInvertLines( sal_Bool bErase = sal_False );
+ SVT_DLLPRIVATE void ImplDraw();
+ SVT_DLLPRIVATE void ImplDrawExtra( sal_Bool bPaint = sal_False );
+ SVT_DLLPRIVATE void ImplUpdate( sal_Bool bMustCalc = sal_False );
+ using Window::ImplHitTest;
+ SVT_DLLPRIVATE sal_Bool ImplHitTest( const Point& rPos,
+ ImplRulerHitTest* pHitTest,
+ sal_Bool bRequiredStyle = sal_False,
+ sal_uInt16 nRequiredStyle = 0 ) const;
+ SVT_DLLPRIVATE sal_Bool ImplDocHitTest( const Point& rPos, RulerType eDragType, ImplRulerHitTest* pHitTest ) const;
+ SVT_DLLPRIVATE sal_Bool ImplStartDrag( ImplRulerHitTest* pHitTest, sal_uInt16 nModifier );
+ SVT_DLLPRIVATE void ImplDrag( const Point& rPos );
+ SVT_DLLPRIVATE void ImplEndDrag();
+ DECL_DLLPRIVATE_LINK( ImplUpdateHdl, void* );
+#endif
+
+ // Forbidden and not implemented.
+ Ruler (const Ruler &);
+ Ruler & operator= (const Ruler &);
+
+protected:
+ long GetRulerVirHeight() const;
+
+public:
+ Ruler( Window* pParent, WinBits nWinStyle = WB_STDRULER );
+ virtual ~Ruler();
+
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void Tracking( const TrackingEvent& rTEvt );
+ virtual void Paint( const Rectangle& rRect );
+ virtual void Resize();
+ virtual void StateChanged( StateChangedType nStateChange );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ virtual long StartDrag();
+ virtual void Drag();
+ virtual void EndDrag();
+ virtual void Click();
+ virtual void DoubleClick();
+ virtual void ExtraDown();
+
+ void Activate();
+ void Deactivate();
+ sal_Bool IsActive() const { return mbActive; }
+
+ void SetWinPos( long nOff = 0, long nWidth = 0 );
+ long GetWinOffset() const { return mnWinOff; }
+ long GetWinWidth() const { return mnWinWidth; }
+ void SetPagePos( long nOff = 0, long nWidth = 0 );
+ long GetPageOffset() const;
+ long GetPageWidth() const;
+ void SetBorderPos( long nOff = 0 );
+ long GetBorderOffset() const { return mnBorderOff; }
+ Rectangle GetExtraRect() const { return maExtraRect; }
+
+ void SetUnit( FieldUnit eNewUnit );
+ FieldUnit GetUnit() const { return meUnit; }
+ void SetZoom( const Fraction& rNewZoom );
+ Fraction GetZoom() const { return maZoom; }
+
+ void SetSourceUnit( MapUnit eNewUnit ) { meSourceUnit = eNewUnit; }
+ MapUnit GetSourceUnit() const { return meSourceUnit; }
+
+ void SetExtraType( RulerExtra eNewExtraType, sal_uInt16 nStyle = 0 );
+ RulerExtra GetExtraType() const { return meExtraType; }
+ sal_uInt16 GetExtraStyle() const { return mnExtraStyle; }
+ sal_uInt16 GetExtraClicks() const { return mnExtraClicks; }
+ sal_uInt16 GetExtraModifier() const { return mnExtraModifier; }
+
+ sal_Bool StartDocDrag( const MouseEvent& rMEvt,
+ RulerType eDragType = RULER_TYPE_DONTKNOW );
+ RulerType GetDragType() const { return meDragType; }
+ long GetDragPos() const { return mnDragPos; }
+ sal_uInt16 GetDragAryPos() const { return mnDragAryPos; }
+ sal_uInt16 GetDragSize() const { return mnDragSize; }
+ sal_Bool IsDragDelete() const { return mbDragDelete; }
+ sal_Bool IsDragCanceled() const { return mbDragCanceled; }
+ sal_uInt16 GetDragScroll() const { return mnDragScroll; }
+ sal_uInt16 GetDragModifier() const { return mnDragModifier; }
+ sal_Bool IsDrag() const { return mbDrag; }
+ void CancelDrag();
+ long GetClickPos() const { return mnDragPos; }
+ RulerType GetClickType() const { return meDragType; }
+ sal_uInt16 GetClickAryPos() const { return mnDragAryPos; }
+ using Window::GetType;
+ RulerType GetType( const Point& rPos,
+ sal_uInt16* pAryPos = NULL ) const;
+
+ void SetNullOffset( long nPos );
+ long GetNullOffset() const;
+ void SetMargin1() { SetMargin1( 0, RULER_STYLE_INVISIBLE ); }
+ void SetMargin1( long nPos, sal_uInt16 nMarginStyle = RULER_MARGIN_SIZEABLE );
+ long GetMargin1() const;
+ void SetMargin2() { SetMargin2( 0, RULER_STYLE_INVISIBLE ); }
+ void SetMargin2( long nPos, sal_uInt16 nMarginStyle = RULER_MARGIN_SIZEABLE );
+ long GetMargin2() const;
+
+ void SetLines( sal_uInt16 n = 0, const RulerLine* pLineAry = NULL );
+
+ void SetBorders( sal_uInt16 n = 0, const RulerBorder* pBrdAry = NULL );
+
+ void SetIndents( sal_uInt16 n = 0, const RulerIndent* pIndentAry = NULL );
+
+ void SetTabs( sal_uInt16 n = 0, const RulerTab* pTabAry = NULL );
+ sal_uInt16 GetTabCount() const;
+ const RulerTab* GetTabs() const;
+
+ static void DrawTab( OutputDevice* pDevice,
+ const Point& rPos, sal_uInt16 nStyle );
+
+ void SetStyle( WinBits nStyle );
+ WinBits GetStyle() const { return mnWinStyle; }
+
+ void SetStartDragHdl( const Link& rLink ) { maStartDragHdl = rLink; }
+ const Link& GetStartDragHdl() const { return maStartDragHdl; }
+ void SetDragHdl( const Link& rLink ) { maDragHdl = rLink; }
+ const Link& GetDragHdl() const { return maDragHdl; }
+ void SetEndDragHdl( const Link& rLink ) { maEndDragHdl = rLink; }
+ const Link& GetEndDragHdl() const { return maEndDragHdl; }
+ void SetClickHdl( const Link& rLink ) { maClickHdl = rLink; }
+ const Link& GetClickHdl() const { return maClickHdl; }
+ void SetDoubleClickHdl( const Link& rLink ) { maDoubleClickHdl = rLink; }
+ const Link& GetDoubleClickHdl() const { return maDoubleClickHdl; }
+ void SetExtraDownHdl( const Link& rLink ) { maExtraDownHdl = rLink; }
+ const Link& GetExtraDownHdl() const { return maExtraDownHdl; }
+
+ //set text direction right-to-left
+ void SetTextRTL(sal_Bool bRTL);
+
+ void SetCharWidth( long nWidth ) { mnCharWidth = nWidth ; }
+ void SetLineHeight( long nHeight ) { mnLineHeight = nHeight ; }
+
+ void DrawTicks();
+};
+
+#endif // _RULER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/sampletext.hxx b/include/svtools/sampletext.hxx
new file mode 100644
index 000000000000..9d491cf449bd
--- /dev/null
+++ b/include/svtools/sampletext.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ */
+#ifndef INCLUDED_SVTOOLS_SAMPLETEXT_HXX
+#define INCLUDED_SVTOOLS_SAMPLETEXT_HXX
+
+#include "svtools/svtdllapi.h"
+#include <rtl/ustring.hxx>
+#include <unicode/uscript.h>
+#include <i18nlangtag/lang.h>
+#include <com/sun/star/i18n/ScriptType.hpp>
+#include <vcl/fontcapabilities.hxx>
+
+class OutputDevice;
+class Font;
+
+SVT_DLLPUBLIC UScriptCode otCoverageToScript(vcl::UnicodeCoverage::UnicodeCoverageEnum eOTCoverage);
+
+SVT_DLLPUBLIC bool isSymbolFont(const Font &rFont);
+SVT_DLLPUBLIC bool isOpenSymbolFont(const Font &rFont);
+
+SVT_DLLPUBLIC bool canRenderNameOfSelectedFont(OutputDevice &rDevice);
+
+//These ones are typically for use in the font dropdown box beside the
+//fontname, so say things roughly like "Script/Alphabet/Name-Of-Major-Language"
+SVT_DLLPUBLIC OUString makeShortRepresentativeSymbolTextForSelectedFont(OutputDevice &rDevice);
+SVT_DLLPUBLIC OUString makeShortRepresentativeTextForSelectedFont(OutputDevice &rDevice);
+SVT_DLLPUBLIC OUString makeShortRepresentativeTextForScript(UScriptCode eScript);
+//For the cases where the font doesn't fully support a script, but has partial support
+//for a useful subset
+SVT_DLLPUBLIC OUString makeShortMinimalTextForScript(UScriptCode eScript);
+
+//These ones are typically for use in the font preview window in format character
+SVT_DLLPUBLIC OUString makeRepresentativeTextForFont(sal_Int16 nScriptType, const Font &rFont);
+SVT_DLLPUBLIC OUString makeRepresentativeTextForLanguage(LanguageType eLang);
+SVT_DLLPUBLIC OUString makeRepresentativeTextForScript(UScriptCode eScript);
+SVT_DLLPUBLIC OUString makeMinimalTextForScript(UScriptCode eScript);
+
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/scriptedtext.hxx b/include/svtools/scriptedtext.hxx
new file mode 100644
index 000000000000..7e3928640dfe
--- /dev/null
+++ b/include/svtools/scriptedtext.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVTOOLS_SCRIPTEDTEXT_HXX
+#define _SVTOOLS_SCRIPTEDTEXT_HXX
+
+#include "svtools/svtdllapi.h"
+#include <com/sun/star/i18n/XBreakIterator.hpp>
+
+
+class OutputDevice;
+class Font;
+class SvtScriptedTextHelper_Impl;
+class Size;
+class Point;
+
+
+//_____________________________________________________________________________
+
+/**
+This class provides drawing text with different script types on any output devices.
+*/
+class SVT_DLLPUBLIC SvtScriptedTextHelper
+{
+private:
+ SvtScriptedTextHelper_Impl* mpImpl; /// Implementation of class functionality.
+
+ /** Assignment operator not implemented to prevent usage. */
+ SvtScriptedTextHelper& operator=( const SvtScriptedTextHelper& );
+
+public:
+ /** Constructor sets an output device and no fonts.
+ @param _rOutDevice
+ A reference to an output device. */
+ SvtScriptedTextHelper( OutputDevice& _rOutDevice );
+
+ /** Copy constructor. */
+ SvtScriptedTextHelper(
+ const SvtScriptedTextHelper& _rCopy );
+
+ /** Destructor. */
+ virtual ~SvtScriptedTextHelper();
+
+ /** Sets new fonts and recalculates the text width.
+ @param _pLatinFont
+ The font for latin characters.
+ @param _pAsianFont
+ The font for asian characters.
+ @param _pCmplxFont
+ The font for complex text layout. */
+ void SetFonts( Font* _pLatinFont, Font* _pAsianFont, Font* _pCmplxFont );
+
+ /** Sets the default font of the current output device to all script types. */
+ void SetDefaultFont();
+
+ /** Sets a new text and calculates all script breaks and the text width.
+ @param _rText
+ The new text.
+ @param _xBreakIter
+ The break iterator for iterating through the script portions. */
+ void SetText(
+ const OUString& _rText,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator >& _xBreakIter );
+
+ /** Returns a size struct containing the width and height of the text in the current output device.
+ @return A size struct with the text dimensions. */
+ const Size& GetTextSize() const;
+
+ /** Draws the text in the current output device.
+ @param _rPos
+ The position of the top left edge of the text. */
+ void DrawText( const Point& _rPos );
+};
+
+//_____________________________________________________________________________
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/scrwin.hxx b/include/svtools/scrwin.hxx
new file mode 100644
index 000000000000..f9af5b9aa620
--- /dev/null
+++ b/include/svtools/scrwin.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SCRWIN_HXX
+#define _SCRWIN_HXX
+
+#include "svtools/svtdllapi.h"
+
+#include <vcl/scrbar.hxx>
+
+class DataChangedEvent;
+
+// -------------------------
+// - ScrollableWindow-Type -
+// -------------------------
+
+typedef sal_uInt16 ScrollableWindowFlags;
+
+#define SCRWIN_THUMBDRAGGING 1
+#define SCRWIN_VCENTER 2
+#define SCRWIN_HCENTER 4
+#define SCRWIN_DEFAULT (SCRWIN_THUMBDRAGGING | SCRWIN_VCENTER | SCRWIN_HCENTER)
+
+// --------------------
+// - ScrollableWindow -
+// --------------------
+
+class SVT_DLLPUBLIC ScrollableWindow: public Window
+{
+private:
+ Point aPixOffset; // offset to virtual window (pixel)
+ Size aTotPixSz; // total size of virtual window (pixel)
+ long nLinePixH; // size of a line/column (pixel)
+ long nColumnPixW;
+
+ ScrollBar aVScroll; // the scrollbars
+ ScrollBar aHScroll;
+ ScrollBarBox aCornerWin; // window in the bottom right corner
+ sal_Bool bScrolling:1, // user controlled scrolling
+ bHandleDragging:1, // scroll window while dragging
+ bHCenter:1,
+ bVCenter:1;
+
+#ifdef _SVT_SCRWIN_CXX
+ SVT_DLLPRIVATE void ImpInitialize( ScrollableWindowFlags nFlags );
+ DECL_DLLPRIVATE_LINK( ScrollHdl, ScrollBar * );
+ DECL_DLLPRIVATE_LINK( EndScrollHdl, ScrollBar * );
+#endif
+
+public:
+ ScrollableWindow( Window* pParent, WinBits nBits = 0,
+ ScrollableWindowFlags = SCRWIN_DEFAULT );
+
+ virtual void Resize();
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual void DataChanged( const DataChangedEvent& rDEvt );
+
+ virtual void StartScroll();
+ virtual void EndScroll( long nDeltaX, long nDeltaY );
+
+ using OutputDevice::SetMapMode;
+ virtual void SetMapMode( const MapMode& rNewMapMode );
+ virtual MapMode GetMapMode() const;
+
+ void SetTotalSize( const Size& rNewSize );
+ Size GetTotalSize() { return PixelToLogic( aTotPixSz ); }
+
+ using Window::Scroll;
+ virtual void Scroll( long nDeltaX, long nDeltaY, sal_uInt16 nFlags = 0 );
+
+private:
+ SVT_DLLPRIVATE Size GetOutputSizePixel() const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/sfxecode.hxx b/include/svtools/sfxecode.hxx
new file mode 100644
index 000000000000..e5b4026a0ec0
--- /dev/null
+++ b/include/svtools/sfxecode.hxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SFXECODE_HXX
+#define _SFXECODE_HXX
+
+#include <tools/errcode.hxx>
+
+#define ERRCODE_SFX_NOSTDTEMPLATE (ERRCODE_AREA_SFX|ERRCODE_CLASS_PATH|1)
+#define ERRCODE_SFX_NOTATEMPLATE (ERRCODE_AREA_SFX|ERRCODE_CLASS_FORMAT|2)
+#define ERRCODE_SFX_GENERAL (ERRCODE_AREA_SFX|ERRCODE_CLASS_GENERAL|3)
+#define ERRCODE_SFX_DOLOADFAILED (ERRCODE_AREA_SFX|ERRCODE_CLASS_READ|4)
+#define ERRCODE_SFX_DOSAVECOMPLETEDFAILED (ERRCODE_AREA_SFX|ERRCODE_CLASS_WRITE|5)
+#define ERRCODE_SFX_COMMITFAILED (ERRCODE_AREA_SFX|ERRCODE_CLASS_WRITE|6)
+#define ERRCODE_SFX_HANDSOFFFAILED (ERRCODE_AREA_SFX|ERRCODE_CLASS_GENERAL|7)
+#define ERRCODE_SFX_DOINITNEWFAILED (ERRCODE_AREA_SFX|ERRCODE_CLASS_CREATE|8)
+#define ERRCODE_SFX_CANTREADDOCINFO (ERRCODE_AREA_SFX|ERRCODE_CLASS_FORMAT|9)
+#define ERRCODE_SFX_ALREADYOPEN (ERRCODE_AREA_SFX|ERRCODE_CLASS_ALREADYEXISTS|10)
+#define ERRCODE_SFX_WRONGPASSWORD (ERRCODE_AREA_SFX|ERRCODE_CLASS_READ|11)
+#define ERRCODE_SFX_DOCUMENTREADONLY (ERRCODE_AREA_SFX|ERRCODE_CLASS_WRITE|12)
+#define ERRCODE_SFX_OLEGENERAL (ERRCODE_AREA_SFX|ERRCODE_CLASS_NONE|14)
+#define ERRCODE_SFXMSG_STYLEREPLACE (ERRCODE_WARNING_MASK|ERRCODE_AREA_SFX|ERRCODE_CLASS_NONE|13)
+#define ERRCODE_SFX_TEMPLATENOTFOUND (ERRCODE_AREA_SFX|ERRCODE_CLASS_NOTEXISTS|15)
+#define ERRCODE_SFX_ISRELATIVE (ERRCODE_WARNING_MASK|ERRCODE_AREA_SFX|ERRCODE_CLASS_NOTEXISTS|16)
+#define ERRCODE_SFX_FORCEDOCLOAD (ERRCODE_WARNING_MASK|ERRCODE_AREA_SFX|ERRCODE_CLASS_NONE|17)
+
+#define ERRCODE_SFX_CANTFINDORIGINAL (ERRCODE_AREA_SFX|ERRCODE_CLASS_GENERAL|19)
+#define ERRCODE_SFX_RESTART (ERRCODE_AREA_SFX|ERRCODE_CLASS_GENERAL|20)
+#define ERRCODE_SFX_CANTCREATECONTENT (ERRCODE_AREA_SFX|ERRCODE_CLASS_CREATE|21)
+#define ERRCODE_SFX_CANTCREATELINK (ERRCODE_AREA_SFX|ERRCODE_CLASS_CREATE|22)
+#define ERRCODE_SFX_WRONGBMKFORMAT (ERRCODE_AREA_SFX|ERRCODE_CLASS_FORMAT|23)
+#define ERRCODE_SFX_WRONGICONFILE (ERRCODE_AREA_SFX|ERRCODE_CLASS_FORMAT|24)
+#define ERRCODE_SFX_CANTDELICONFILE (ERRCODE_AREA_SFX|ERRCODE_CLASS_ACCESS|25)
+#define ERRCODE_SFX_CANTWRITEICONFILE (ERRCODE_AREA_SFX|ERRCODE_CLASS_ACCESS|26)
+#define ERRCODE_SFX_CANTRENAMECONTENT (ERRCODE_AREA_SFX|ERRCODE_CLASS_ACCESS|27)
+#define ERRCODE_SFX_INVALIDBMKPATH (ERRCODE_AREA_SFX|ERRCODE_CLASS_PATH|28)
+#define ERRCODE_SFX_CANTWRITEURLCFGFILE (ERRCODE_AREA_SFX|ERRCODE_CLASS_ACCESS|29)
+#define ERRCODE_SFX_WRONGURLCFGFORMAT (ERRCODE_AREA_SFX|ERRCODE_CLASS_FORMAT|30)
+#define ERRCODE_SFX_NODOCUMENT (ERRCODE_AREA_SFX|ERRCODE_CLASS_NOTEXISTS|31)
+#define ERRCODE_SFX_INVALIDLINK (ERRCODE_AREA_SFX|ERRCODE_CLASS_NOTEXISTS|32)
+#define ERRCODE_SFX_INVALIDTRASHPATH (ERRCODE_AREA_SFX|ERRCODE_CLASS_PATH|33)
+#define ERRCODE_SFX_NOTRESTORABLE (ERRCODE_AREA_SFX|ERRCODE_CLASS_CREATE|34)
+#define ERRCODE_SFX_NOTRASH (ERRCODE_AREA_SFX|ERRCODE_CLASS_NOTEXISTS|35)
+#define ERRCODE_SFX_INVALIDSYNTAX (ERRCODE_AREA_SFX|ERRCODE_CLASS_PATH|36)
+#define ERRCODE_SFX_CANTCREATEFOLDER (ERRCODE_AREA_SFX|ERRCODE_CLASS_CREATE|37)
+#define ERRCODE_SFX_CANTRENAMEFOLDER (ERRCODE_AREA_SFX|ERRCODE_CLASS_PATH|38)
+#define ERRCODE_SFX_WRONG_CDF_FORMAT (ERRCODE_AREA_SFX| ERRCODE_CLASS_READ | 39)
+#define ERRCODE_SFX_EMPTY_SERVER (ERRCODE_AREA_SFX|ERRCODE_CLASS_NONE|40)
+#define ERRCODE_SFX_NO_ABOBOX (ERRCODE_AREA_SFX| ERRCODE_CLASS_READ | 41)
+#define ERRCODE_SFX_CANTGETPASSWD (ERRCODE_AREA_SFX| ERRCODE_CLASS_READ | 42)
+#define ERRCODE_SFX_TARGETFILECORRUPTED (ERRCODE_AREA_SFX| ERRCODE_CLASS_READ | 43)
+#define ERRCODE_SFX_NOMOREDOCUMENTSALLOWED (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 44)
+#define ERRCODE_SFX_NOFILTER (ERRCODE_AREA_SFX|ERRCODE_CLASS_NOTEXISTS|45)
+#define ERRCODE_SFX_FORCEQUIET (ERRCODE_WARNING_MASK|ERRCODE_AREA_SFX|ERRCODE_CLASS_NONE|47)
+#define ERRCODE_SFX_CONSULTUSER (ERRCODE_WARNING_MASK|ERRCODE_AREA_SFX|ERRCODE_CLASS_NONE|48)
+#define ERRCODE_SFX_NEVERCHECKCONTENT (ERRCODE_AREA_SFX|ERRCODE_CLASS_NONE|49)
+#define ERRCODE_SFX_CANTCREATEBACKUP (ERRCODE_AREA_SFX | ERRCODE_CLASS_CREATE | 50)
+#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)
+#define ERRCODE_SFX_INCOMPLETE_ENCRYPTION (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 55)
+#define ERRCODE_SFX_DOCUMENT_MACRO_DISABLED_MAC (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 56)
+#define ERRCODE_SFX_FORMAT_ROWCOL (ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 57)
+#define ERRCODE_SFX_VBASIC_CANTSAVE_STORAGE (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 58)
+
+
+//Dies und das
+#define ERRCTX_ERROR 21
+#define ERRCTX_WARNING 22
+
+//Documentkontexte
+#define ERRCTX_SFX_LOADTEMPLATE 1
+#define ERRCTX_SFX_SAVEDOC 2
+#define ERRCTX_SFX_SAVEASDOC 3
+#define ERRCTX_SFX_DOCINFO 4
+#define ERRCTX_SFX_DOCTEMPLATE 5
+#define ERRCTX_SFX_MOVEORCOPYCONTENTS 6
+
+//Appkontexte
+#define ERRCTX_SFX_DOCMANAGER 50
+#define ERRCTX_SFX_OPENDOC 51
+#define ERRCTX_SFX_NEWDOCDIRECT 52
+#define ERRCTX_SFX_NEWDOC 53
+
+//Organizerkontexte
+#define ERRCTX_SFX_CREATEOBJSH 70
+
+//BASIC-Kontexte
+#define ERRCTX_SFX_LOADBASIC 80
+
+//Addressbook contexts
+#define ERRCTX_SFX_SEARCHADDRESS 90
+
+#endif // #ifndef _SFXECODE_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/slidesorterbaropt.hxx b/include/svtools/slidesorterbaropt.hxx
new file mode 100644
index 000000000000..cb2d996fb03b
--- /dev/null
+++ b/include/svtools/slidesorterbaropt.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVTOOLS_SLIDESORTERBAROPT_HXX
+#define INCLUDED_SVTOOLS_SLIDESORTERBAROPT_HXX
+
+#include "svtools/svtdllapi.h"
+#include <sal/types.h>
+#include <osl/mutex.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <rtl/ustring.hxx>
+#include <unotools/options.hxx>
+
+/** forward declaration to our private date container implementation
+
+ We use these class as internal member to support small memory requirements.
+ You can create the container if it is neccessary. The class which use these mechanism
+ is faster and smaller then a complete implementation!
+*/
+class SvtSlideSorterBarOptions_Impl;
+
+/** collect information about sidebar group
+
+ \attention This class is partially threadsafe.
+*/
+class SVT_DLLPUBLIC SvtSlideSorterBarOptions: public utl::detail::Options
+{
+ public:
+ /** standard constructor and destructor
+
+ This will initialize an instance with default values.
+ We implement these class with a refcount mechanism! Every instance of this class increase it
+ at create and decrease it at delete time - but all instances use the same data container!
+ He is implemented as a static member ...
+
+ \sa member m_nRefCount
+ \sa member m_pDataContainer
+ */
+ SvtSlideSorterBarOptions();
+ virtual ~SvtSlideSorterBarOptions();
+
+ bool GetVisibleImpressView() const;
+ void SetVisibleImpressView( bool bVisible );
+ bool GetVisibleOutlineView() const;
+ void SetVisibleOutlineView( bool bVisible );
+ bool GetVisibleNotesView() const;
+ void SetVisibleNotesView( bool bVisible );
+ bool GetVisibleHandoutView() const;
+ void SetVisibleHandoutView( bool bVisible );
+ bool GetVisibleSlideSorterView() const;
+ void SetVisibleSlideSorterView( bool bVisible );
+ bool GetVisibleDrawView() const;
+ void SetVisibleDrawView( bool bVisible );
+
+
+ private:
+ /** return a reference to a static mutex
+
+ These class is partially threadsafe (for de-/initialization only).
+ All access methods are'nt safe!
+ We create a static mutex only for one ime and use at different times.
+
+ \return A reference to a static mutex member.*/
+ SVT_DLLPRIVATE static ::osl::Mutex& GetInitMutex();
+
+ private:
+
+ /**
+ \attention
+ Don't initialize these static member in these header!
+ \li Double defined symbols will be detected ...
+ \li and unresolved externals exist at linking time.
+ Do it in your source only.
+ */
+ static SvtSlideSorterBarOptions_Impl* m_pDataContainer ; ///< impl. data container as dynamic pointer for smaller memory requirements!
+ static sal_Int32 m_nRefCount ; ///< internal ref count mechanism
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/soerr.hxx b/include/svtools/soerr.hxx
new file mode 100644
index 000000000000..e6d366327744
--- /dev/null
+++ b/include/svtools/soerr.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SOERR_HXX
+#define _SOERR_HXX
+
+#include <tools/errcode.hxx>
+
+// Fehler Codes
+#define RID_SO_ERROR_HANDLER 32000
+
+#define SO_ERR() (ERRCODE_AREA_SO | ERRCODE_CLASS_SO)
+#define SO_WRN() (ERRCODE_AREA_SO | ERRCODE_CLASS_SO | ERRCODE_WARNING_MASK)
+
+#define ERRCODE_SO_GENERALERROR (SO_ERR() | 1)
+#define ERRCODE_SO_CANT_BINDTOSOURCE (SO_ERR() | 2)
+#define ERRCODE_SO_NOCACHE_UPDATED (SO_ERR() | 3)
+#define ERRCODE_SO_SOMECACHES_NOTUPDATED (SO_WRN() | 4)
+#define ERRCODE_SO_MK_UNAVAILABLE (SO_ERR() | 5)
+#define ERRCODE_SO_E_CLASSDIFF (SO_ERR() | 6)
+#define ERRCODE_SO_MK_NO_OBJECT (SO_ERR() | 7)
+#define ERRCODE_SO_MK_EXCEEDED_DEADLINE (SO_ERR() | 8)
+#define ERRCODE_SO_MK_CONNECT_MANUALLY (SO_ERR() | 9)
+#define ERRCODE_SO_MK_INTERMEDIATE_INTERFACE_NOT_SUPPORTED (SO_ERR() | 10)
+#define ERRCODE_SO_NO_INTERFACE (SO_ERR() | 11)
+#define ERRCODE_SO_OUT_OF_MEMORY (SO_ERR() | 12)
+#define ERRCODE_SO_MK_SYNTAX (SO_ERR() | 13)
+#define ERRCODE_SO_MK_REDUCED_TO_SELF (SO_WRN() | 14)
+#define ERRCODE_SO_MK_NO_INVERSE (SO_ERR() | 15)
+#define ERRCODE_SO_MK_NO_PREFIX (SO_ERR() | 16)
+#define ERRCODE_SO_MK_HIM (SO_WRN() | 17)
+#define ERRCODE_SO_MK_US (SO_WRN() | 18)
+#define ERRCODE_SO_MK_ME (SO_WRN() | 19)
+#define ERRCODE_SO_MK_NOT_BINDABLE (SO_ERR() | 20)
+#define ERRCODE_SO_NOT_IMPLEMENTED (SO_ERR() | 21)
+#define ERRCODE_SO_MK_NO_STORAGE (SO_ERR() | 22)
+#define ERRCODE_SO_FALSE (SO_WRN() | 23)
+#define ERRCODE_SO_MK_NEED_GENERIC (SO_ERR() | 24)
+#define ERRCODE_SO_PENDING (SO_ERR() | 25)
+#define ERRCODE_SO_NOT_INPLACEACTIVE (SO_ERR() | 26)
+#define ERRCODE_SO_LINDEX (SO_ERR() | 27)
+#define ERRCODE_SO_CANNOT_DOVERB_NOW (SO_WRN() | 28)
+#define ERRCODE_SO_OLEOBJ_INVALIDHWND (SO_WRN() | 29)
+#define ERRCODE_SO_NOVERBS (SO_ERR() | 30)
+#define ERRCODE_SO_INVALIDVERB (SO_WRN() | 31)
+#define ERRCODE_SO_MK_CONNECT (SO_ERR() | 32)
+#define ERRCODE_SO_NOTIMPL (SO_ERR() | 33)
+#define ERRCODE_SO_MK_CANTOPENFILE (SO_ERR() | 34)
+
+// Fehler Contexte
+#define RID_SO_ERRCTX 32001
+
+#define ERRCTX_SO_DOVERB 1
+
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/sores.hxx b/include/svtools/sores.hxx
new file mode 100644
index 000000000000..4264f2197f62
--- /dev/null
+++ b/include/svtools/sores.hxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+// Strings
+#define STR_ERROR_OBJNOCREATE 32014
+#define STR_ERROR_OBJNOCREATE_FROM_FILE 32015
+#define STR_ERROR_OBJNOCREATE_PLUGIN 32018
+#define STR_FURTHER_OBJECT 32026
+#define STR_UNKNOWN_SOURCE 32027
+
+#define BMP_PLUGIN 32000
+#define BMP_OLEOBJ 32001
+#define MB_PLUGIN 32000
+#define MI_PLUGIN 32000
+#define MI_PLUGIN_DEACTIVATE 1
+
+// Sot Format Strings
+#define STR_FORMAT_START 32100
+#define STR_FORMAT_STRING (STR_FORMAT_START + 1)
+#define STR_FORMAT_BITMAP (STR_FORMAT_START + 2)
+#define STR_FORMAT_GDIMETAFILE (STR_FORMAT_START + 3)
+#define STR_FORMAT_RTF (STR_FORMAT_START + 7)
+#define STR_FORMAT_ID_DRAWING (STR_FORMAT_START + 8)
+#define STR_FORMAT_ID_SVXB (STR_FORMAT_START + 9)
+#define STR_FORMAT_ID_INTERNALLINK_STATE (STR_FORMAT_START + 13)
+#define STR_FORMAT_ID_SOLK (STR_FORMAT_START + 14)
+#define STR_FORMAT_ID_NETSCAPE_BOOKMARK (STR_FORMAT_START + 15)
+#define STR_FORMAT_ID_STARSERVER (STR_FORMAT_START + 19)
+#define STR_FORMAT_ID_STAROBJECT (STR_FORMAT_START + 20)
+#define STR_FORMAT_ID_APPLETOBJECT (STR_FORMAT_START + 21)
+#define STR_FORMAT_ID_PLUGIN_OBJECT (STR_FORMAT_START + 22)
+#define STR_FORMAT_ID_STARWRITER_30 (STR_FORMAT_START + 23)
+#define STR_FORMAT_ID_STARWRITER_40 (STR_FORMAT_START + 24)
+#define STR_FORMAT_ID_STARWRITER_50 (STR_FORMAT_START + 25)
+#define STR_FORMAT_ID_STARWRITERWEB_40 (STR_FORMAT_START + 26)
+#define STR_FORMAT_ID_STARWRITERWEB_50 (STR_FORMAT_START + 27)
+#define STR_FORMAT_ID_STARWRITERGLOB_40 (STR_FORMAT_START + 28)
+#define STR_FORMAT_ID_STARWRITERGLOB_50 (STR_FORMAT_START + 29)
+#define STR_FORMAT_ID_STARDRAW (STR_FORMAT_START + 30)
+#define STR_FORMAT_ID_STARDRAW_40 (STR_FORMAT_START + 31)
+#define STR_FORMAT_ID_STARIMPRESS_50 (STR_FORMAT_START + 32)
+#define STR_FORMAT_ID_STARDRAW_50 (STR_FORMAT_START + 33)
+#define STR_FORMAT_ID_STARCALC (STR_FORMAT_START + 34)
+#define STR_FORMAT_ID_STARCALC_40 (STR_FORMAT_START + 35)
+#define STR_FORMAT_ID_STARCALC_50 (STR_FORMAT_START + 36)
+#define STR_FORMAT_ID_STARCHART (STR_FORMAT_START + 37)
+#define STR_FORMAT_ID_STARCHART_40 (STR_FORMAT_START + 38)
+#define STR_FORMAT_ID_STARCHART_50 (STR_FORMAT_START + 39)
+#define STR_FORMAT_ID_STARIMAGE (STR_FORMAT_START + 40)
+#define STR_FORMAT_ID_STARIMAGE_40 (STR_FORMAT_START + 41)
+#define STR_FORMAT_ID_STARIMAGE_50 (STR_FORMAT_START + 42)
+#define STR_FORMAT_ID_STARMATH (STR_FORMAT_START + 43)
+#define STR_FORMAT_ID_STARMATH_40 (STR_FORMAT_START + 44)
+#define STR_FORMAT_ID_STARMATH_50 (STR_FORMAT_START + 45)
+#define STR_FORMAT_ID_STAROBJECT_PAINTDOC (STR_FORMAT_START + 46)
+#define STR_FORMAT_ID_HTML (STR_FORMAT_START + 48)
+#define STR_FORMAT_ID_HTML_SIMPLE (STR_FORMAT_START + 49)
+#define STR_FORMAT_ID_BIFF_5 (STR_FORMAT_START + 52)
+#define STR_FORMAT_ID_BIFF_8 (STR_FORMAT_START + 53)
+#define STR_FORMAT_ID_SYLK (STR_FORMAT_START + 54)
+#define STR_FORMAT_ID_LINK (STR_FORMAT_START + 56)
+#define STR_FORMAT_ID_DIF (STR_FORMAT_START + 57)
+#define STR_FORMAT_ID_MSWORD_DOC (STR_FORMAT_START + 60)
+#define STR_FORMAT_ID_STAR_FRAMESET_DOC (STR_FORMAT_START + 61)
+#define STR_FORMAT_ID_OFFICE_DOC (STR_FORMAT_START + 62)
+#define STR_FORMAT_ID_NOTES_DOCINFO (STR_FORMAT_START + 63)
+#define STR_FORMAT_ID_SFX_DOC (STR_FORMAT_START + 66)
+#define STR_FORMAT_ID_FILEGRPDESCRIPTOR (STR_FORMAT_START + 86)
+#define STR_FORMAT_ID_STARCHARTDOCUMENT_50 (STR_FORMAT_START + 102)
+#define STR_FORMAT_ID_GRAPHOBJ (STR_FORMAT_START + 103)
+#define STR_FORMAT_ID_STARWRITER_60 (STR_FORMAT_START + 104)
+#define STR_FORMAT_ID_STARWRITERWEB_60 (STR_FORMAT_START + 105)
+#define STR_FORMAT_ID_STARWRITERGLOB_60 (STR_FORMAT_START + 106)
+#define STR_FORMAT_ID_STARDRAW_60 (STR_FORMAT_START + 107)
+#define STR_FORMAT_ID_STARIMPRESS_60 (STR_FORMAT_START + 108)
+#define STR_FORMAT_ID_STARCALC_60 (STR_FORMAT_START + 109)
+#define STR_FORMAT_ID_STARCHART_60 (STR_FORMAT_START + 110)
+#define STR_FORMAT_ID_STARMATH_60 (STR_FORMAT_START + 111)
+#define STR_FORMAT_ID_WMF (STR_FORMAT_START + 112)
+#define STR_FORMAT_ID_DBACCESS_QUERY (STR_FORMAT_START + 113)
+#define STR_FORMAT_ID_DBACCESS_TABLE (STR_FORMAT_START + 114)
+#define STR_FORMAT_ID_DBACCESS_COMMAND (STR_FORMAT_START + 115)
+#define STR_FORMAT_ID_DIALOG_60 (STR_FORMAT_START + 116)
+#define STR_FORMAT_ID_HTML_NO_COMMENT (STR_FORMAT_START + 119)
+#define STR_FORMAT_END (STR_FORMAT_ID_HTML_NO_COMMENT)
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/statusbarcontroller.hxx b/include/svtools/statusbarcontroller.hxx
new file mode 100644
index 000000000000..eba45e543525
--- /dev/null
+++ b/include/svtools/statusbarcontroller.hxx
@@ -0,0 +1,141 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVTOOLS_STATUSBARCONTROLLER_HXX
+#define _SVTOOLS_STATUSBARCONTROLLER_HXX
+
+#include "svtools/svtdllapi.h"
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/util/XUpdatable.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XStatusListener.hpp>
+#include <com/sun/star/frame/XStatusbarController.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <com/sun/star/frame/XLayoutManager.hpp>
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <comphelper/broadcasthelper.hxx>
+
+#include <boost/unordered_map.hpp>
+
+#include <tools/gen.hxx>
+
+namespace svt
+{
+
+class SVT_DLLPUBLIC StatusbarController : public ::com::sun::star::frame::XStatusListener,
+ public ::com::sun::star::frame::XStatusbarController,
+ public ::com::sun::star::lang::XInitialization,
+ public ::com::sun::star::util::XUpdatable,
+ public ::com::sun::star::lang::XComponent,
+ public ::comphelper::OBaseMutex,
+ public ::cppu::OWeakObject
+{
+ public:
+ StatusbarController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame,
+ const OUString& aCommandURL,
+ unsigned short nID );
+ StatusbarController();
+ virtual ~StatusbarController();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > getFrameInterface() const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > getURLTransformer() const;
+
+ ::Rectangle getControlRect() const;
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw ();
+ virtual void SAL_CALL release() throw ();
+
+ // 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);
+
+ // XUpdatable
+ virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XStatusbarController
+ virtual ::sal_Bool SAL_CALL mouseButtonDown( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL mouseMove( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL mouseButtonUp( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL command( const ::com::sun::star::awt::Point& aPos,
+ ::sal_Int32 nCommand,
+ ::sal_Bool bMouseEvent,
+ const ::com::sun::star::uno::Any& aData ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL paint( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics,
+ const ::com::sun::star::awt::Rectangle& rOutputRectangle,
+ ::sal_Int32 nItemId, ::sal_Int32 nStyle ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException);
+
+ protected:
+ struct Listener
+ {
+ Listener( const ::com::sun::star::util::URL& rURL, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& rDispatch ) :
+ aURL( rURL ), xDispatch( rDispatch ) {}
+
+ ::com::sun::star::util::URL aURL;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch;
+ };
+
+ typedef ::boost::unordered_map< OUString,
+ com::sun::star::uno::Reference< com::sun::star::frame::XDispatch >,
+ OUStringHash,
+ ::std::equal_to< OUString > > URLToDispatchMap;
+
+ // methods to support status forwarder, known by the old sfx2 toolbox controller implementation
+ void addStatusListener( const OUString& aCommandURL );
+ void bindListener();
+
+ // execute methods
+ // execute bound status bar controller command/execute various commands
+ void execute( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs );
+ void execute( const OUString& aCommand, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs );
+
+ sal_Bool m_bInitialized : 1,
+ m_bDisposed : 1;
+ unsigned short m_nID;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xParentWindow;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
+ OUString m_aCommandURL;
+ URLToDispatchMap m_aListenerMap;
+ ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener
+ mutable ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer;
+};
+
+}
+
+#endif // _SVTOOLS_TOOLBOXCONTROLLER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/stdctrl.hxx b/include/svtools/stdctrl.hxx
new file mode 100644
index 000000000000..77ca119ab363
--- /dev/null
+++ b/include/svtools/stdctrl.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _STDCTRL_HXX
+#define _STDCTRL_HXX
+
+#include "svtools/svtdllapi.h"
+
+#include <vcl/edit.hxx>
+#include <vcl/fixed.hxx>
+
+// -------------
+// - FixedInfo -
+// -------------
+
+class SVT_DLLPUBLIC FixedInfo : public FixedText
+{
+public:
+ FixedInfo( Window* pParent, WinBits nWinStyle = WB_LEFT );
+ FixedInfo( Window* pParent, const ResId& rResId );
+};
+
+#endif // _STDCTRL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/stdmenu.hxx b/include/svtools/stdmenu.hxx
new file mode 100644
index 000000000000..4c968db36842
--- /dev/null
+++ b/include/svtools/stdmenu.hxx
@@ -0,0 +1,161 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _STDMENU_HXX
+#define _STDMENU_HXX
+
+#include "svtools/svtdllapi.h"
+#include <tools/link.hxx>
+#include <vcl/menu.hxx>
+
+class FontList;
+class FontInfo;
+
+/*************************************************************************
+
+Beschreibung
+============
+
+class FontNameMenu
+
+Beschreibung
+
+Erlaubt die Auswahl von Fonts. Das Menu wird ueber Fill mit den FontNamen
+gefuellt. Fill sortiert automatisch die FontNamen (inkl. aller Umlaute und
+sprachabhaengig). Mit SetCurName()/GetCurName() kann der aktuelle Fontname
+gesetzt/abgefragt werden. Wenn SetCurName() mit einem leeren String
+aufgerufen wird, wird kein Eintrag als aktueller angezeigt (fuer DontKnow).
+Vor dem Selectaufruf wird der ausgewaehlte Name automatisch als aktueller
+gesetzt und wuerde beim naechsten Aufruf auch als aktueller Name angezeigt
+werden. Deshalb sollte vor PopupMenu::Execute() gegebenenfalls mit
+SetCurName() der aktuelle Fontname gesetzt werden.
+
+Da die Id's und der interne Aufbau des Menus nicht bekannt ist, muss ein
+Select-Handler gesetzt werden, um die Auswahl eines Namens mitzubekommen.
+
+In dieses Menu koennen keine weiteren Items eingefuegt werden.
+
+Spaeter soll auch das Menu die gleichen Bitmaps anzeigen, wie die
+FontNameBox. Auf den Systemen, wo Menues nicht automatisch scrollen,
+wird spaeter wohl ein A-Z Menu ziwschengeschaltet. Da ein Menu bei vielen
+installierten Fonts bisher schon immer lange gebraucht hat, sollte dieses
+Menu schon jetzt nur einmal erzeugt werden (da sonst das Kontextmenu bis
+zu 10-Sekunden fuer die Erzeugung brauchen koennte).
+
+Querverweise
+
+FontList; FontSizeMenu; FontNameBox
+
+--------------------------------------------------------------------------
+
+class FontSizeMenu
+
+Beschreibung
+
+Erlaubt die Auswahl von Fontgroessen. Ueber Fill wird das FontSizeMenu
+gefuellt und ueber GetCurHeight() kann die ausgewaehlte Fontgroesse
+abgefragt werden. Mit SetCurHeight()/GetCurHeight() kann die aktuelle
+Fontgroesse gesetzt/abgefragt werden. Wenn SetCurHeight() mit 0 aufgerufen
+wird, wird kein Eintrag als aktueller angezeigt (fuer DontKnow). Vor dem
+Selectaufruf wird die ausgewaehlte Groesse automatisch als aktuelle gesetzt
+und wuerde beim naechsten Aufruf auch als aktuelle Groesse angezeigt werden.
+Deshalb sollte vor PopupMenu::Execute() gegebenenfalls mit SetCurHeight()
+die aktuelle Groesse gesetzt werden. Da die Groessen vom ausgewaehlten Font
+abhaengen, sollte nach einer Aenderung des Fontnamen das Menu mit Fill mit
+den Groessen des Fonts neu gefuellt werden.
+
+Da die Id's und der interne Aufbau des Menus nicht bekannt ist, muss ein
+Select-Handler gesetzt werden, um die Auswahl einer Groesse mitzubekommen.
+
+Alle Groessen werden in 10tel Point angegeben.
+
+In dieses Menu koennen keine weiteren Items eingefuegt werden.
+
+Spaeter soll das Menu je nach System die Groessen anders darstelllen. Zum
+Beispiel koennte der Mac spaeter vielleicht einmal die Groessen als Outline
+darstellen, die als Bitmap-Fonts vorhanden sind.
+
+Querverweise
+
+FontList; FontNameMenu; FontSizeBox
+
+*************************************************************************/
+
+// ----------------
+// - FontNameMenu -
+// ----------------
+
+class SVT_DLLPUBLIC FontNameMenu : public PopupMenu
+{
+private:
+ OUString maCurName;
+ Link maSelectHdl;
+ Link maHighlightHdl;
+
+public:
+ FontNameMenu();
+ virtual ~FontNameMenu();
+
+ virtual void Select();
+ virtual void Highlight();
+
+ void Fill( const FontList* pList );
+
+ void SetCurName( const OUString& rName );
+ const OUString& GetCurName() const { return maCurName; }
+
+ void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; }
+ const Link& GetSelectHdl() const { return maSelectHdl; }
+ void SetHighlightHdl( const Link& rLink ) { maHighlightHdl = rLink; }
+ const Link& GetHighlightHdl() const { return maHighlightHdl; }
+};
+
+// ----------------
+// - FontSizeMenu -
+// ----------------
+
+class SVT_DLLPUBLIC FontSizeMenu : public PopupMenu
+{
+private:
+ long* mpHeightAry;
+ long mnCurHeight;
+ Link maSelectHdl;
+ Link maHighlightHdl;
+
+public:
+ FontSizeMenu();
+ ~FontSizeMenu();
+
+ virtual void Select();
+ virtual void Highlight();
+
+ void Fill( const FontInfo& rInfo, const FontList* pList );
+
+ void SetCurHeight( long nHeight );
+ long GetCurHeight() const { return mnCurHeight; }
+
+ void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; }
+ const Link& GetSelectHdl() const { return maSelectHdl; }
+ void SetHighlightHdl( const Link& rLink ) { maHighlightHdl = rLink; }
+ const Link& GetHighlightHdl() const { return maHighlightHdl; }
+};
+
+#endif // _STDMENU_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/stringtransfer.hxx b/include/svtools/stringtransfer.hxx
new file mode 100644
index 000000000000..c496b34b1361
--- /dev/null
+++ b/include/svtools/stringtransfer.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVTOOLS_STRINGTRANSFER_HXX_
+#define _SVTOOLS_STRINGTRANSFER_HXX_
+
+#include "svtools/svtdllapi.h"
+#include <svtools/transfer.hxx>
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ //====================================================================
+ //= OStringTransferable
+ //====================================================================
+ class SVT_DLLPUBLIC OStringTransferable : public TransferableHelper
+ {
+ protected:
+ OUString m_sContent;
+
+ public:
+ OStringTransferable(const OUString& _rContent);
+
+ protected:
+ // TransferableHelper overridables
+ virtual void AddSupportedFormats();
+ virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& _rFlavor );
+ };
+
+ //====================================================================
+ //= OStringTransfer
+ //====================================================================
+ class OStringTransfer
+ {
+ public:
+ /** copies the string given into the system clipboard
+ <p>Beware: In opposite to the old DragServer::CopyString, this method does not <em>add</em> the string
+ to the clipboard, instead the old clipboard content is <em>replaced</em>!</p>
+ */
+ SVT_DLLPUBLIC static void CopyString( const OUString& _rContent, Window* _pWindow = NULL );
+
+ /** extracts a string from the system clipboard given
+ @return <TRUE/> if the extraction was successful, i.e. if the clipboard contained a string content
+ */
+ SVT_DLLPUBLIC static sal_Bool PasteString( OUString& _rContent, Window* _pWindow = NULL );
+
+ /** starts dragging a simple string
+ */
+ SVT_DLLPUBLIC static void StartStringDrag( const OUString& _rContent, Window* _pWindow, sal_Int8 _nDragSourceActions );
+ };
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // _SVTOOLS_STRINGTRANSFER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/svlbitm.hxx b/include/svtools/svlbitm.hxx
new file mode 100644
index 000000000000..14784835fa6b
--- /dev/null
+++ b/include/svtools/svlbitm.hxx
@@ -0,0 +1,257 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef _SVLBOXITM_HXX
+#define _SVLBOXITM_HXX
+
+#include "svtools/svtdllapi.h"
+
+#include <tools/link.hxx>
+
+#include <vcl/image.hxx>
+#include <svtools/treelistbox.hxx>
+
+class SvTreeListEntry;
+
+
+#define SV_BMP_UNCHECKED 0
+#define SV_BMP_CHECKED 1
+#define SV_BMP_TRISTATE 2
+#define SV_BMP_HIUNCHECKED 3
+#define SV_BMP_HICHECKED 4
+#define SV_BMP_HITRISTATE 5
+#define SV_BMP_STATICIMAGE 6
+
+struct SvLBoxButtonData_Impl;
+
+class SVT_DLLPUBLIC SvLBoxButtonData
+{
+private:
+ Link aLink;
+ long nWidth;
+ long nHeight;
+ SvLBoxButtonData_Impl* pImpl;
+ sal_Bool bDataOk;
+ SvButtonState eState;
+
+ SVT_DLLPRIVATE void SetWidthAndHeight();
+ SVT_DLLPRIVATE void InitData( sal_Bool bImagesFromDefault,
+ bool _bRadioBtn, const Control* pControlForSettings = NULL );
+public:
+ // include creating default images (CheckBox or RadioButton)
+ SvLBoxButtonData( const Control* pControlForSettings );
+ SvLBoxButtonData( const Control* pControlForSettings, bool _bRadioBtn );
+
+ ~SvLBoxButtonData();
+
+ sal_uInt16 GetIndex( sal_uInt16 nItemState );
+ long Width();
+ long Height();
+ void SetLink( const Link& rLink) { aLink=rLink; }
+ const Link& GetLink() const { return aLink; }
+ sal_Bool IsRadio();
+ // weil Buttons nicht von LinkHdl abgeleitet sind
+ void CallLink();
+
+ void StoreButtonState( SvTreeListEntry* pEntry, sal_uInt16 nItemFlags );
+ SvButtonState ConvertToButtonState( sal_uInt16 nItemFlags ) const;
+
+ SvButtonState GetActButtonState() const
+ {
+ return eState;
+ }
+
+ SvTreeListEntry* GetActEntry() const;
+
+ Image aBmps[24]; // Indizes siehe Konstanten BMP_ ....
+
+ void SetDefaultImages( const Control* pControlForSettings = NULL );
+ // set images acording to the color scheeme of the Control
+ // pControlForSettings == NULL: settings are taken from Application
+ sal_Bool HasDefaultImages( void ) const;
+};
+
+// **********************************************************************
+
+class SVT_DLLPUBLIC SvLBoxString : public SvLBoxItem
+{
+protected:
+ OUString maText;
+public:
+ SvLBoxString(SvTreeListEntry*, sal_uInt16 nFlags, const OUString& rStr);
+ SvLBoxString();
+ virtual ~SvLBoxString();
+ virtual sal_uInt16 GetType() const;
+ virtual void InitViewData(SvTreeListBox*, SvTreeListEntry*, SvViewDataItem*);
+ OUString GetText() const { return maText; }
+ void SetText( const OUString& rText ) { maText = rText; }
+
+ virtual void Paint(
+ const Point& rPos, SvTreeListBox& rOutDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry);
+
+ virtual SvLBoxItem* Create() const;
+ virtual void Clone( SvLBoxItem* pSource );
+};
+
+class SvLBoxBmp : public SvLBoxItem
+{
+ Image aBmp;
+public:
+ SvLBoxBmp();
+ virtual ~SvLBoxBmp();
+ virtual sal_uInt16 GetType() const;
+ virtual void InitViewData( SvTreeListBox*,SvTreeListEntry*,SvViewDataItem* );
+ virtual void Paint(
+ const Point& rPos, SvTreeListBox& rOutDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry);
+ virtual SvLBoxItem* Create() const;
+ virtual void Clone( SvLBoxItem* pSource );
+};
+
+
+#define SV_ITEMSTATE_UNCHECKED 0x0001
+#define SV_ITEMSTATE_CHECKED 0x0002
+#define SV_ITEMSTATE_TRISTATE 0x0004
+#define SV_ITEMSTATE_HILIGHTED 0x0008
+#define SV_STATE_MASK 0xFFF8 // zum Loeschen von UNCHECKED,CHECKED,TRISTATE
+
+class SVT_DLLPUBLIC SvLBoxButton : public SvLBoxItem
+{
+ SvLBoxButtonData* pData;
+ SvLBoxButtonKind eKind;
+ sal_uInt16 nItemFlags;
+ sal_uInt16 nBaseOffs;
+
+ void ImplAdjustBoxSize( Size& io_rCtrlSize, ControlType i_eType, Window* pParent );
+public:
+ // An SvLBoxButton can be of three different kinds: an
+ // enabled checkbox (the normal kind), a disabled checkbox
+ // (which cannot be modified via UI), or a static image
+ // (see SV_BMP_STATICIMAGE; nFlags are effectively ignored
+ // for that kind).
+ SvLBoxButton( SvTreeListEntry* pEntry,
+ SvLBoxButtonKind eTheKind, sal_uInt16 nFlags,
+ SvLBoxButtonData* pBData );
+ SvLBoxButton();
+ virtual ~SvLBoxButton();
+ virtual void InitViewData( SvTreeListBox*,SvTreeListEntry*,SvViewDataItem* );
+ virtual sal_uInt16 GetType() const;
+ virtual sal_Bool ClickHdl(SvTreeListBox* pView, SvTreeListEntry* );
+ virtual void Paint(
+ const Point& rPos, SvTreeListBox& rOutDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry);
+ virtual SvLBoxItem* Create() const;
+ virtual void Clone( SvLBoxItem* pSource );
+ sal_uInt16 GetButtonFlags() const { return nItemFlags; }
+ sal_Bool IsStateChecked() const { return (sal_Bool)(nItemFlags & SV_ITEMSTATE_CHECKED)!=0; }
+ sal_Bool IsStateUnchecked() const { return (sal_Bool)(nItemFlags & SV_ITEMSTATE_UNCHECKED)!=0; }
+ sal_Bool IsStateTristate() const { return (sal_Bool)(nItemFlags & SV_ITEMSTATE_TRISTATE)!=0; }
+ sal_Bool IsStateHilighted() const { return (sal_Bool)(nItemFlags & SV_ITEMSTATE_HILIGHTED)!=0; }
+ void SetStateChecked();
+ void SetStateUnchecked();
+ void SetStateTristate();
+ void SetStateHilighted( sal_Bool bHilight );
+
+ SvLBoxButtonKind GetKind() const { return eKind; }
+
+ void SetBaseOffs( sal_uInt16 nOffs ) { nBaseOffs = nOffs; }
+ sal_uInt16 GetBaseOffs() const { return nBaseOffs; }
+
+ // Check whether this button can be modified via UI
+ bool CheckModification() const;
+};
+
+inline void SvLBoxButton::SetStateChecked()
+{
+ nItemFlags &= SV_STATE_MASK;
+ nItemFlags |= SV_ITEMSTATE_CHECKED;
+}
+inline void SvLBoxButton::SetStateUnchecked()
+{
+ nItemFlags &= SV_STATE_MASK;
+ nItemFlags |= SV_ITEMSTATE_UNCHECKED;
+}
+inline void SvLBoxButton::SetStateTristate()
+{
+ nItemFlags &= SV_STATE_MASK;
+ nItemFlags |= SV_ITEMSTATE_TRISTATE;
+}
+inline void SvLBoxButton::SetStateHilighted( sal_Bool bHilight )
+{
+ if ( bHilight )
+ nItemFlags |= SV_ITEMSTATE_HILIGHTED;
+ else
+ nItemFlags &= ~SV_ITEMSTATE_HILIGHTED;
+}
+
+
+struct SvLBoxContextBmp_Impl;
+class SVT_DLLPUBLIC SvLBoxContextBmp : public SvLBoxItem
+{
+ SvLBoxContextBmp_Impl* m_pImpl;
+public:
+ SvLBoxContextBmp(
+ SvTreeListEntry* pEntry, sal_uInt16 nItemFlags, Image aBmp1, Image aBmp2, bool bExpanded);
+ SvLBoxContextBmp();
+
+ virtual ~SvLBoxContextBmp();
+ virtual sal_uInt16 GetType() const;
+ virtual void InitViewData( SvTreeListBox*,SvTreeListEntry*,SvViewDataItem* );
+ virtual void Paint(
+ const Point& rPos, SvTreeListBox& rOutDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry);
+ virtual SvLBoxItem* Create() const;
+ virtual void Clone( SvLBoxItem* pSource );
+
+
+ sal_Bool SetModeImages( const Image& _rBitmap1, const Image& _rBitmap2 );
+ void GetModeImages( Image& _rBitmap1, Image& _rBitmap2 ) const;
+
+ inline void SetBitmap1( const Image& _rImage );
+ inline void SetBitmap2( const Image& _rImage );
+ inline const Image& GetBitmap1( ) const;
+ inline const Image& GetBitmap2( ) const;
+
+private:
+ Image& implGetImageStore( sal_Bool _bFirst );
+};
+
+inline void SvLBoxContextBmp::SetBitmap1( const Image& _rImage )
+{
+ implGetImageStore( sal_True ) = _rImage;
+}
+
+inline void SvLBoxContextBmp::SetBitmap2( const Image& _rImage )
+{
+ implGetImageStore( sal_False ) = _rImage;
+}
+
+inline const Image& SvLBoxContextBmp::GetBitmap1( ) const
+{
+ Image& rImage = const_cast< SvLBoxContextBmp* >( this )->implGetImageStore( sal_True );
+ return rImage;
+}
+
+inline const Image& SvLBoxContextBmp::GetBitmap2( ) const
+{
+ Image& rImage = const_cast< SvLBoxContextBmp* >( this )->implGetImageStore( sal_False );
+ return rImage;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/svmedit.hxx b/include/svtools/svmedit.hxx
new file mode 100644
index 000000000000..c0672a520824
--- /dev/null
+++ b/include/svtools/svmedit.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVEDIT_HXX
+#define _SVEDIT_HXX
+
+#include <vcl/svapp.hxx>
+#include <vcl/vclmedit.hxx>
+
+#include <comphelper/syntaxhighlight.hxx>
+#include <svtools/svtdllapi.h>
+#include <svtools/colorcfg.hxx>
+
+
+
+class SVT_DLLPUBLIC MultiLineEdit : public VclMultiLineEdit
+{
+public:
+ MultiLineEdit( Window* pParent, WinBits nWinStyle = WB_LEFT | WB_BORDER );
+ MultiLineEdit( Window* pParent, const ResId& rResId );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >
+ GetComponentInterface(sal_Bool bCreate = sal_True);
+};
+
+
+#endif //_SVEDIT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/svmedit2.hxx b/include/svtools/svmedit2.hxx
new file mode 100644
index 000000000000..68b754163e19
--- /dev/null
+++ b/include/svtools/svmedit2.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVTOOLS_SVMEDIT2_HXX
+#define _SVTOOLS_SVMEDIT2_HXX
+
+#include "svtools/svtdllapi.h"
+#include <svtools/svmedit.hxx>
+
+class TextAttrib;
+
+class SVT_DLLPUBLIC ExtMultiLineEdit : public MultiLineEdit
+{
+public:
+ ExtMultiLineEdit( Window* pParent, WinBits nWinStyle = WB_LEFT | WB_BORDER );
+ ExtMultiLineEdit( Window* pParent, const ResId& rResId );
+ ~ExtMultiLineEdit();
+
+ // methods of TextView
+ void InsertText( const String& rNew, sal_Bool bSelect = sal_False );
+ void SetAutoScroll( sal_Bool bAutoScroll );
+
+ // methods of TextEngine
+ void SetAttrib( const TextAttrib& rAttr, sal_uLong nPara, sal_uInt16 nStart, sal_uInt16 nEnd );
+ void SetLeftMargin( sal_uInt16 nLeftMargin );
+ sal_uLong GetParagraphCount() const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/svparser.hxx b/include/svtools/svparser.hxx
new file mode 100644
index 000000000000..bd2ee966469a
--- /dev/null
+++ b/include/svtools/svparser.hxx
@@ -0,0 +1,278 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVPARSER_HXX
+#define _SVPARSER_HXX
+
+#include "svtools/svtdllapi.h"
+#include <tools/link.hxx>
+#include <tools/string.hxx>
+#include <tools/ref.hxx>
+#include <rtl/textenc.h>
+#include <boost/ptr_container/ptr_vector.hpp>
+#include <boost/utility.hpp>
+#include <vector>
+
+struct SvParser_Impl;
+class SvStream;
+
+enum SvParserState
+{
+ SVPAR_ACCEPTED = 0,
+ SVPAR_NOTSTARTED,
+ SVPAR_WORKING,
+ SVPAR_PENDING,
+ SVPAR_WAITFORDATA,
+ SVPAR_ERROR
+};
+
+class SVT_DLLPUBLIC SvParser : public SvRefBase
+{
+ DECL_STATIC_LINK( SvParser, NewDataRead, void* );
+
+protected:
+ SvStream& rInput;
+ String aToken; // gescanntes Token
+ sal_uLong nlLineNr; // akt. Zeilen Nummer
+ sal_uLong nlLinePos; // akt. Spalten Nummer
+
+ SvParser_Impl *pImplData; // interne Daten
+ long nTokenValue; // zusaetzlicher Wert (RTF)
+ sal_Bool bTokenHasValue; // indicates whether nTokenValue is valid
+ SvParserState eState; // Status auch in abgl. Klassen
+
+ rtl_TextEncoding eSrcEnc; // Source encoding
+
+ sal_uLong nNextChPos;
+ sal_Unicode nNextCh; // Akt. Zeichen fuer die "lex"
+
+
+ sal_Bool bDownloadingFile : 1;// sal_True: Es wird gerade ein externes
+ // File geladen. d.h. alle
+ // DataAvailable Links muessen
+ // ignoriert werden.
+ // Wenn keibes der folgenden
+ // Flags gesetzt ist, wird der
+ // Stream als ANSI gelesen,
+ // aber als CharSet DONTKNOW
+ // zurueckgegeben.
+ sal_Bool bUCS2BSrcEnc : 1; // oder als big-endian UCS2
+ sal_Bool bSwitchToUCS2 : 1; // Umschalten des ist erlaubt
+
+ sal_Bool bRTF_InTextRead : 1; // only for RTF-Parser!!!
+
+ struct TokenStackType
+ {
+ String sToken;
+ long nTokenValue;
+ sal_Bool bTokenHasValue;
+ int nTokenId;
+
+ inline TokenStackType() { nTokenId = 0; }
+ inline ~TokenStackType() { }
+ };
+
+ // Methoden fuer Token-Stack
+ int SkipToken( short nCnt = -1 ); // n Tokens zurueck "skippen"
+ TokenStackType* GetStackPtr( short nCnt );
+ inline sal_uInt8 GetStackPos() const;
+
+ // scanne das naechste Token:
+ // Tokenstack abarbeiten und ggfs. _GetNextToken() rufen. Diese
+ // ist fuers erkennen von neuen Token verantwortlich
+ int GetNextToken();
+ virtual int _GetNextToken() = 0;
+
+ // wird fuer jedes Token gerufen, das in CallParser erkannt wird
+ virtual void NextToken( int nToken );
+
+ // zu Zeiten der SvRefBase-Ableitung darf nicht jeder loeschen
+ virtual ~SvParser();
+
+ void ClearTxtConvContext();
+
+private:
+ TokenStackType* pTokenStack;
+ TokenStackType *pTokenStackPos;
+ sal_uInt8 nTokenStackSize, nTokenStackPos;
+
+public:
+ // Konstruktor
+ SvParser( SvStream& rIn, sal_uInt8 nStackSize = 3 );
+
+ virtual SvParserState CallParser() = 0; // Aufruf des Parsers
+
+ inline SvParserState GetStatus() const { return eState; } // StatusInfo
+
+ inline sal_uLong GetLineNr() const { return nlLineNr; }
+ inline sal_uLong GetLinePos() const { return nlLinePos; }
+ inline sal_uLong IncLineNr() { return ++nlLineNr; }
+ inline sal_uLong IncLinePos() { return ++nlLinePos; }
+ inline sal_uLong SetLineNr( sal_uLong nlNum ); // inline unten
+ inline sal_uLong SetLinePos( sal_uLong nlPos ); // inline unten
+
+ sal_Unicode GetNextChar();
+ void RereadLookahead();
+
+ inline int IsParserWorking() const { return SVPAR_WORKING == eState; }
+
+ Link GetAsynchCallLink() const
+ { return STATIC_LINK( this, SvParser, NewDataRead ); }
+
+ long CallAsyncCallLink() { return NewDataRead( this, 0 ); }
+
+ // fuers asynchrone lesen aus dem SvStream
+ /*virtual*/ void SaveState( int nToken );
+ /*virtual*/ void RestoreState();
+ virtual void Continue( int nToken );
+
+ inline void SetDownloadingFile( sal_Bool bSet ) { bDownloadingFile = bSet; }
+ inline sal_Bool IsDownloadingFile() const { return bDownloadingFile; }
+
+ // Set/get source encoding. The UCS2BEncoding flag is valid if source
+ // encoding is UCS2. It specifies a big endian encoding.
+ void SetSrcEncoding( rtl_TextEncoding eSrcEnc );
+ rtl_TextEncoding GetSrcEncoding() const { return eSrcEnc; }
+
+ void SetSrcUCS2BEncoding( sal_Bool bSet ) { bUCS2BSrcEnc = bSet; }
+ sal_Bool IsSrcUCS2BEncoding() const { return bUCS2BSrcEnc; }
+
+ // Darf der Zeichensatz auf UCS/2 umgeschaltet werden, wenn
+ // in den ersten beiden Zeichen im Stream eine BOM steht?
+ void SetSwitchToUCS2( sal_Bool bSet ) { bSwitchToUCS2 = bSet; }
+ sal_Bool IsSwitchToUCS2() const { return bSwitchToUCS2; }
+
+ // Aus wie vielen Bytes betseht ein Zeichen
+ inline sal_uInt16 GetCharSize() const;
+
+ int GetSaveToken() const;
+
+ // Aufbau einer Which-Map 'rWhichMap' aus einem Array von
+ // 'pWhichIds' von Which-Ids. Es hat die Lange 'nWhichIds'.
+ // Die Which-Map wird nicht geloescht.
+ static void BuildWhichTbl( std::vector<sal_uInt16> &rWhichMap,
+ sal_uInt16 *pWhichIds,
+ sal_uInt16 nWhichIds );
+};
+
+
+#ifndef GOODIES_DECL_SVPARSER_DEFINED
+#define GOODIES_DECL_SVPARSER_DEFINED
+SV_DECL_REF(SvParser)
+#endif
+SV_IMPL_REF(SvParser)
+
+
+
+inline sal_uLong SvParser::SetLineNr( sal_uLong nlNum )
+{ sal_uLong nlOld = nlLineNr; nlLineNr = nlNum; return nlOld; }
+
+inline sal_uLong SvParser::SetLinePos( sal_uLong nlPos )
+{ sal_uLong nlOld = nlLinePos; nlLinePos = nlPos; return nlOld; }
+
+inline sal_uInt8 SvParser::GetStackPos() const
+{ return nTokenStackPos; }
+
+inline sal_uInt16 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.
+ *
+ *======================================================================*/
+
+typedef boost::ptr_vector<SvKeyValue> SvKeyValueList_Impl;
+
+class SVT_DLLPUBLIC SvKeyValueIterator : public SvRefBase,
+ private boost::noncopyable
+{
+ /** Representation.
+ */
+ SvKeyValueList_Impl* m_pList;
+ sal_uInt16 m_nPos;
+
+public:
+ /** Construction/Destruction.
+ */
+ SvKeyValueIterator (void);
+ virtual ~SvKeyValueIterator (void);
+
+ /** Operation.
+ */
+ virtual sal_Bool GetFirst (SvKeyValue &rKeyVal);
+ virtual sal_Bool GetNext (SvKeyValue &rKeyVal);
+ virtual void Append (const SvKeyValue &rKeyVal);
+};
+
+SV_IMPL_REF(SvKeyValueIterator);
+
+#endif //_SVPARSER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/svtabbx.hxx b/include/svtools/svtabbx.hxx
new file mode 100644
index 000000000000..7bcd0591b2d1
--- /dev/null
+++ b/include/svtools/svtabbx.hxx
@@ -0,0 +1,255 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVTABBX_HXX
+#define _SVTABBX_HXX
+
+#include "svtools/svtdllapi.h"
+#include <svtools/treelistbox.hxx>
+#include <svtools/accessibletableprovider.hxx>
+
+#include <vector>
+
+enum SvTabJustify
+{
+ AdjustRight = SV_LBOXTAB_ADJUST_RIGHT,
+ AdjustLeft = SV_LBOXTAB_ADJUST_LEFT,
+ AdjustCenter = SV_LBOXTAB_ADJUST_CENTER,
+ AdjustNumeric = SV_LBOXTAB_ADJUST_NUMERIC
+};
+
+struct TabListBoxEventData
+{
+ SvTreeListEntry* m_pEntry;
+ sal_uInt16 m_nColumn;
+ String m_sOldText;
+
+ TabListBoxEventData( SvTreeListEntry* pEntry, sal_uInt16 nColumn, const String& rOldText ) :
+ m_pEntry( pEntry ), m_nColumn( nColumn ), m_sOldText( rOldText ) {}
+};
+
+class SVT_DLLPUBLIC SvTabListBox : public SvTreeListBox
+{
+private:
+ SvLBoxTab* pTabList;
+ sal_uInt16 nTabCount;
+ XubString aCurEntry;
+
+protected:
+ SvTreeListEntry* pViewParent;
+
+ static const sal_Unicode* GetToken( const sal_Unicode* pPtr, sal_uInt16& rLen );
+
+ virtual void SetTabs();
+ virtual void InitEntry(SvTreeListEntry*, const OUString&, const Image&, const Image&, SvLBoxButtonKind);
+
+ String GetTabEntryText( sal_uLong nPos, sal_uInt16 nCol ) const;
+ SvTreeListEntry* GetEntryOnPos( sal_uLong _nEntryPos ) const;
+ SvTreeListEntry* GetChildOnPos( SvTreeListEntry* _pParent, sal_uLong _nEntryPos, sal_uLong& _rPos ) const;
+
+public:
+ SvTabListBox( Window* pParent, WinBits = WB_BORDER );
+ SvTabListBox( Window* pParent, const ResId& );
+ ~SvTabListBox();
+ void SetTabs( long* pTabs, MapUnit = MAP_APPFONT );
+ sal_uInt16 TabCount() const { return (sal_uInt16)nTabCount; }
+ using SvTreeListBox::GetTab;
+ long GetTab( sal_uInt16 nTab ) const;
+ void SetTab( sal_uInt16 nTab, long nValue, MapUnit = MAP_APPFONT );
+ long GetLogicTab( sal_uInt16 nTab );
+
+ virtual SvTreeListEntry* InsertEntry( const XubString& rText, SvTreeListEntry* pParent = 0,
+ sal_Bool bChildrenOnDemand = sal_False,
+ sal_uLong nPos=LIST_APPEND, void* pUserData = 0,
+ SvLBoxButtonKind eButtonKind = SvLBoxButtonKind_enabledCheckbox );
+
+ virtual SvTreeListEntry* InsertEntry( const XubString& rText,
+ const Image& rExpandedEntryBmp,
+ const Image& rCollapsedEntryBmp,
+ SvTreeListEntry* pParent = 0,
+ sal_Bool bChildrenOnDemand = sal_False,
+ sal_uLong nPos = LIST_APPEND, void* pUserData = 0,
+ SvLBoxButtonKind eButtonKind = SvLBoxButtonKind_enabledCheckbox );
+
+ virtual SvTreeListEntry* InsertEntryToColumn( const XubString&, sal_uLong nPos = LIST_APPEND,
+ sal_uInt16 nCol = 0xffff, void* pUserData = NULL );
+ virtual SvTreeListEntry* InsertEntryToColumn( const XubString&, SvTreeListEntry* pParent,
+ sal_uLong nPos, sal_uInt16 nCol, void* pUserData = NULL );
+ virtual SvTreeListEntry* InsertEntryToColumn( const XubString&, const Image& rExpandedEntryBmp,
+ const Image& rCollapsedEntryBmp, SvTreeListEntry* pParent = NULL,
+ sal_uLong nPos = LIST_APPEND, sal_uInt16 nCol = 0xffff, void* pUserData = NULL );
+
+ virtual String GetEntryText( SvTreeListEntry* pEntry ) const;
+ String GetEntryText( SvTreeListEntry*, sal_uInt16 nCol ) const;
+ String GetEntryText( sal_uLong nPos, sal_uInt16 nCol = 0xffff ) const;
+ using SvTreeListBox::SetEntryText;
+ void SetEntryText( const XubString&, sal_uLong, sal_uInt16 nCol=0xffff );
+ void SetEntryText(const XubString&,SvTreeListEntry*,sal_uInt16 nCol=0xffff);
+ String GetCellText( sal_uLong nPos, sal_uInt16 nCol ) const;
+ sal_uLong GetEntryPos( const XubString&, sal_uInt16 nCol = 0xffff );
+ sal_uLong GetEntryPos( const SvTreeListEntry* pEntry ) const;
+
+ virtual void Resize();
+ void SetTabJustify( sal_uInt16 nTab, SvTabJustify );
+};
+
+inline long SvTabListBox::GetTab( sal_uInt16 nTab ) const
+{
+ DBG_ASSERT( nTab < nTabCount, "GetTabPos:Invalid Tab" );
+ return pTabList[nTab].GetPos();
+}
+
+// class SvHeaderTabListBox ---------------------------------------------------
+
+class HeaderBar;
+namespace svt {
+ class AccessibleTabListBox;
+ class IAccessibleTabListBox;
+ struct SvHeaderTabListBoxImpl;
+}
+
+class SVT_DLLPUBLIC SvHeaderTabListBox : public SvTabListBox, public svt::IAccessibleTableProvider
+{
+private:
+ typedef ::std::vector< css::uno::Reference< css::accessibility::XAccessible > > AccessibleChildren;
+
+ sal_Bool m_bFirstPaint;
+ ::svt::SvHeaderTabListBoxImpl* m_pImpl;
+ ::svt::IAccessibleTabListBox* m_pAccessible;
+ AccessibleChildren m_aAccessibleChildren;
+
+ DECL_DLLPRIVATE_LINK( ScrollHdl_Impl, void* );
+ DECL_DLLPRIVATE_LINK( CreateAccessibleHdl_Impl, void* );
+
+ void RecalculateAccessibleChildren();
+
+public:
+ SvHeaderTabListBox( Window* pParent, WinBits nBits );
+ SvHeaderTabListBox( Window* pParent, const ResId& );
+ ~SvHeaderTabListBox();
+
+ virtual void Paint( const Rectangle& );
+
+ void InitHeaderBar( HeaderBar* pHeaderBar );
+ sal_Bool IsItemChecked( SvTreeListEntry* pEntry, sal_uInt16 nCol ) const;
+
+ virtual SvTreeListEntry* InsertEntryToColumn( const XubString&, sal_uLong nPos = LIST_APPEND,
+ sal_uInt16 nCol = 0xffff, void* pUserData = NULL );
+ virtual SvTreeListEntry* InsertEntryToColumn( const XubString&, SvTreeListEntry* pParent,
+ sal_uLong nPos, sal_uInt16 nCol, void* pUserData = NULL );
+ virtual SvTreeListEntry* InsertEntryToColumn( const XubString&, const Image& rExpandedEntryBmp,
+ const Image& rCollapsedEntryBmp, SvTreeListEntry* pParent = NULL,
+ sal_uLong nPos = LIST_APPEND, sal_uInt16 nCol = 0xffff, void* pUserData = NULL );
+ virtual sal_uLong Insert( SvTreeListEntry* pEnt,SvTreeListEntry* pPar,sal_uLong nPos=LIST_APPEND);
+ virtual sal_uLong Insert( SvTreeListEntry* pEntry, sal_uLong nRootPos = LIST_APPEND );
+ void RemoveEntry( SvTreeListEntry* _pEntry );
+ void Clear();
+
+ // Accessible -------------------------------------------------------------
+
+ inline void DisableTransientChildren() { SetChildrenNotTransient(); }
+ inline sal_Bool IsTransientChildrenDisabled() const { return !AreChildrenTransient(); }
+
+ sal_Bool IsCellCheckBox( long _nRow, sal_uInt16 _nColumn, TriState& _rState );
+
+ /** @return The count of the rows. */
+ virtual long GetRowCount() const;
+ /** @return The count of the columns. */
+ virtual sal_uInt16 GetColumnCount() const;
+
+ /** @return The position of the current row. */
+ virtual sal_Int32 GetCurrRow() const;
+ /** @return The position of the current column. */
+ virtual sal_uInt16 GetCurrColumn() const;
+
+ /** @return The description of a row.
+ @param _nRow The row which description is in demand. */
+ virtual OUString GetRowDescription( sal_Int32 _nRow ) const;
+ /** @return The description of a column.
+ @param _nColumn The column which description is in demand. */
+ virtual OUString GetColumnDescription( sal_uInt16 _nColumn ) const;
+
+ /** @return <TRUE/>, if the object has a row header. */
+ virtual sal_Bool HasRowHeader() const; //GetColumnId
+ /** @return <TRUE/>, if the object can focus a cell. */
+ virtual sal_Bool IsCellFocusable() const;
+ virtual sal_Bool GoToCell( sal_Int32 _nRow, sal_uInt16 _nColumn );
+
+ virtual void SetNoSelection();
+ using SvListView::SelectAll;
+ virtual void SelectAll();
+ virtual void SelectAll( sal_Bool bSelect, sal_Bool bPaint = sal_True );
+ virtual void SelectRow( long _nRow, sal_Bool _bSelect = sal_True, sal_Bool bExpand = sal_True );
+ virtual void SelectColumn( sal_uInt16 _nColumn, sal_Bool _bSelect = sal_True );
+ virtual sal_Int32 GetSelectedRowCount() const;
+ virtual sal_Int32 GetSelectedColumnCount() const;
+ /** @return <TRUE/>, if the row is selected. */
+ virtual bool IsRowSelected( long _nRow ) const;
+ virtual sal_Bool IsColumnSelected( long _nColumn ) const;
+ virtual void GetAllSelectedRows( css::uno::Sequence< sal_Int32 >& _rRows ) const;
+ virtual void GetAllSelectedColumns( css::uno::Sequence< sal_Int32 >& _rColumns ) const;
+
+ /** @return <TRUE/>, if the cell is visible. */
+ virtual sal_Bool IsCellVisible( sal_Int32 _nRow, sal_uInt16 _nColumn ) const;
+ virtual String GetAccessibleCellText( long _nRow, sal_uInt16 _nColumnPos ) const;
+
+ virtual Rectangle calcHeaderRect( sal_Bool _bIsColumnBar, sal_Bool _bOnScreen = sal_True );
+ virtual Rectangle calcTableRect( sal_Bool _bOnScreen = sal_True );
+ virtual Rectangle GetFieldRectPixelAbs( sal_Int32 _nRow, sal_uInt16 _nColumn, sal_Bool _bIsHeader, sal_Bool _bOnScreen = sal_True );
+
+ virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleCell( sal_Int32 _nRow, sal_uInt16 _nColumn );
+ virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleRowHeader( sal_Int32 _nRow );
+ virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleColumnHeader( sal_uInt16 _nColumnPos );
+
+ virtual sal_Int32 GetAccessibleControlCount() const;
+ virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleControl( sal_Int32 _nIndex );
+ virtual sal_Bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint );
+
+ virtual sal_Bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_uInt16& _rnColPos, const Point& _rPoint );
+ virtual sal_Bool ConvertPointToRowHeader( sal_Int32& _rnRow, const Point& _rPoint );
+ virtual sal_Bool ConvertPointToColumnHeader( sal_uInt16& _rnColPos, const Point& _rPoint );
+
+ virtual OUString GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos = -1 ) const;
+ virtual OUString GetAccessibleObjectDescription( ::svt::AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos = -1 ) const;
+ virtual Window* GetWindowInstance();
+
+ using SvTreeListBox::FillAccessibleStateSet;
+ virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& _rStateSet, ::svt::AccessibleBrowseBoxObjType _eType ) const;
+ virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumn ) const;
+ virtual void GrabTableFocus();
+
+ // OutputDevice
+ virtual sal_Bool GetGlyphBoundRects( const Point& rOrigin, const String& rStr, int nIndex, int nLen, int nBase, MetricVector& rVector );
+
+ // Window
+ virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const;
+ virtual void GrabFocus();
+ virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible( sal_Bool bCreate = sal_True );
+ virtual Window* GetAccessibleParentWindow() const;
+
+ /** Creates and returns the accessible object of the whole BrowseBox. */
+ virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible();
+
+ virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex);
+ virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint);
+};
+
+#endif // #ifndef _SVTABBX_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/svtdllapi.h b/include/svtools/svtdllapi.h
new file mode 100644
index 000000000000..d8c01a464f45
--- /dev/null
+++ b/include/svtools/svtdllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVTDLLAPI_H
+#define INCLUDED_SVTDLLAPI_H
+
+#include "sal/types.h"
+
+#if defined(SVT_DLLIMPLEMENTATION)
+#define SVT_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define SVT_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define SVT_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif /* INCLUDED_SVTDLLAPI_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/svtools.hrc b/include/svtools/svtools.hrc
new file mode 100644
index 000000000000..ea04f469df35
--- /dev/null
+++ b/include/svtools/svtools.hrc
@@ -0,0 +1,324 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVTOOLS_HRC
+#define _SVTOOLS_HRC
+
+#include <svl/solar.hrc>
+
+#define RID_SVTOOLS_BITMAP_START (RID_SVTOOLS_START + 0)
+#define RID_SVTOOLS_IMAGELIST_START (RID_SVTOOLS_START + 0)
+
+//.............................................................................
+// various unsorted stuff
+
+#define DLG_SVT_QUERYDELETE (RID_SVTOOLS_START+6)
+
+#define STR_SVT_AUTOMATIC_COLOR (RID_SVTOOLS_START+16)
+
+#define STR_SVT_FILEVIEW_COLUMN_TITLE (RID_SVTOOLS_START + 20)
+#define STR_SVT_FILEVIEW_COLUMN_SIZE (RID_SVTOOLS_START + 21)
+#define STR_SVT_FILEVIEW_COLUMN_DATE (RID_SVTOOLS_START + 22)
+#define STR_SVT_FILEVIEW_ERR_MAKEFOLDER (RID_SVTOOLS_START + 24)
+#define STR_SVT_BYTES (RID_SVTOOLS_START + 25)
+#define STR_SVT_KB (RID_SVTOOLS_START + 26)
+#define STR_SVT_MB (RID_SVTOOLS_START + 27)
+#define STR_SVT_GB (RID_SVTOOLS_START + 28)
+#define STR_SVT_FILEVIEW_COLUMN_TYPE (RID_SVTOOLS_START + 29)
+#define STR_FILTERNAME_ALL (RID_SVTOOLS_START + 30)
+#define RID_FILEVIEW_CONTEXTMENU (RID_SVTOOLS_START + 31)
+#define STR_SVT_1BIT_THRESHOLD (RID_SVTOOLS_START + 32)
+#define STR_SVT_1BIT_DITHERED (RID_SVTOOLS_START + 33)
+#define STR_SVT_4BIT_GRAYSCALE (RID_SVTOOLS_START + 34)
+#define STR_SVT_4BIT_COLOR_PALETTE (RID_SVTOOLS_START + 35)
+#define STR_SVT_8BIT_GRAYSCALE (RID_SVTOOLS_START + 36)
+#define STR_SVT_8BIT_COLOR_PALETTE (RID_SVTOOLS_START + 37)
+#define STR_SVT_24BIT_TRUE_COLOR (RID_SVTOOLS_START + 38)
+#define STR_SVT_ESTIMATED_SIZE_PIX_1 (RID_SVTOOLS_START + 39)
+#define STR_SVT_ESTIMATED_SIZE_PIX_2 (RID_SVTOOLS_START + 40)
+#define STR_SVT_ESTIMATED_SIZE_VEC (RID_SVTOOLS_START + 41)
+
+// doc template dialog
+#define DLG_DOCTEMPLATE (RID_SVTOOLS_START+50)
+#define CTRL_FILEVIEW (RID_SVTOOLS_START+51)
+#define STR_SVT_NEWDOC (RID_SVTOOLS_START+52)
+#define STR_SVT_MYDOCS (RID_SVTOOLS_START+53)
+#define STR_SVT_TEMPLATES (RID_SVTOOLS_START+54)
+#define STR_SVT_SAMPLES (RID_SVTOOLS_START+55)
+#define TB_SVT_FILEVIEW (RID_SVTOOLS_START+56)
+#define TB_SVT_FRAMEWIN (RID_SVTOOLS_START+57)
+#define STRARY_SVT_DOCINFO (RID_SVTOOLS_START+58)
+#define STR_SVT_NEWDOC_HELP (RID_SVTOOLS_START+63)
+#define STR_SVT_MYDOCS_HELP (RID_SVTOOLS_START+64)
+#define STR_SVT_TEMPLATES_HELP (RID_SVTOOLS_START+65)
+#define STR_SVT_SAMPLES_HELP (RID_SVTOOLS_START+66)
+
+#define STR_BASICKEY_FORMAT_ON (RID_SVTOOLS_START+103)
+#define STR_BASICKEY_FORMAT_OFF (RID_SVTOOLS_START+104)
+#define STR_BASICKEY_FORMAT_YES (RID_SVTOOLS_START+105)
+#define STR_BASICKEY_FORMAT_NO (RID_SVTOOLS_START+106)
+#define STR_BASICKEY_FORMAT_TRUE (RID_SVTOOLS_START+107)
+#define STR_BASICKEY_FORMAT_FALSE (RID_SVTOOLS_START+108)
+#define STR_UNDO (RID_SVTOOLS_START+110)
+#define STR_REDO (RID_SVTOOLS_START+111)
+#define STR_REPEAT (RID_SVTOOLS_START+112)
+
+#define STR_BASICKEY_FORMAT_CURRENCY (RID_SVTOOLS_START+130)
+
+#define STR_SVT_PRNDLG_START (RID_SVTOOLS_START+141)
+
+#define STR_SVT_PRNDLG_READY (STR_SVT_PRNDLG_START+2)
+#define STR_SVT_PRNDLG_PAUSED (STR_SVT_PRNDLG_START+3)
+#define STR_SVT_PRNDLG_PENDING (STR_SVT_PRNDLG_START+4)
+#define STR_SVT_PRNDLG_BUSY (STR_SVT_PRNDLG_START+5)
+#define STR_SVT_PRNDLG_INITIALIZING (STR_SVT_PRNDLG_START+6)
+#define STR_SVT_PRNDLG_WAITING (STR_SVT_PRNDLG_START+7)
+#define STR_SVT_PRNDLG_WARMING_UP (STR_SVT_PRNDLG_START+8)
+#define STR_SVT_PRNDLG_PROCESSING (STR_SVT_PRNDLG_START+9)
+#define STR_SVT_PRNDLG_PRINTING (STR_SVT_PRNDLG_START+10)
+#define STR_SVT_PRNDLG_OFFLINE (STR_SVT_PRNDLG_START+11)
+#define STR_SVT_PRNDLG_ERROR (STR_SVT_PRNDLG_START+12)
+#define STR_SVT_PRNDLG_SERVER_UNKNOWN (STR_SVT_PRNDLG_START+13)
+#define STR_SVT_PRNDLG_PAPER_JAM (STR_SVT_PRNDLG_START+14)
+#define STR_SVT_PRNDLG_PAPER_OUT (STR_SVT_PRNDLG_START+15)
+#define STR_SVT_PRNDLG_MANUAL_FEED (STR_SVT_PRNDLG_START+16)
+#define STR_SVT_PRNDLG_PAPER_PROBLEM (STR_SVT_PRNDLG_START+17)
+#define STR_SVT_PRNDLG_IO_ACTIVE (STR_SVT_PRNDLG_START+18)
+#define STR_SVT_PRNDLG_OUTPUT_BIN_FULL (STR_SVT_PRNDLG_START+19)
+#define STR_SVT_PRNDLG_TONER_LOW (STR_SVT_PRNDLG_START+20)
+#define STR_SVT_PRNDLG_NO_TONER (STR_SVT_PRNDLG_START+21)
+#define STR_SVT_PRNDLG_PAGE_PUNT (STR_SVT_PRNDLG_START+22)
+#define STR_SVT_PRNDLG_USER_INTERVENTION (STR_SVT_PRNDLG_START+23)
+#define STR_SVT_PRNDLG_OUT_OF_MEMORY (STR_SVT_PRNDLG_START+24)
+#define STR_SVT_PRNDLG_DOOR_OPEN (STR_SVT_PRNDLG_START+25)
+#define STR_SVT_PRNDLG_POWER_SAVE (STR_SVT_PRNDLG_START+26)
+#define STR_SVT_PRNDLG_DEFPRINTER (STR_SVT_PRNDLG_START+27)
+#define STR_SVT_PRNDLG_JOBCOUNT (STR_SVT_PRNDLG_START+28)
+#define STR_SVT_PRNDLG_END (RID_IMG_PRNDLG_NOCOLLATE)
+
+#define STR_SVT_CALENDAR_START (STR_SVT_PRNDLG_END+1)
+#define STR_SVT_CALENDAR_DAY (STR_SVT_CALENDAR_START+0)
+#define STR_SVT_CALENDAR_WEEK (STR_SVT_CALENDAR_START+1)
+#define STR_SVT_CALENDAR_TODAY (STR_SVT_CALENDAR_START+2)
+#define STR_SVT_CALENDAR_NONE (STR_SVT_CALENDAR_START+3)
+#define STR_SVT_CALENDAR_END (STR_SVT_CALENDAR_NONE)
+
+#define STR_SVT_PVER_START (STR_SVT_CALENDAR_END+1)
+#define STR_SVT_PVER_OEM_PROFESSIONAL (STR_SVT_PVER_START+16)
+#define STR_SVT_PVER_END (STR_SVT_PVER_OEM_PROFESSIONAL)
+
+#define STR_SVT_STYLE_START (STR_SVT_PVER_END+1)
+#define STR_SVT_STYLE_LIGHT (STR_SVT_STYLE_START+0)
+#define STR_SVT_STYLE_LIGHT_ITALIC (STR_SVT_STYLE_START+1)
+#define STR_SVT_STYLE_NORMAL (STR_SVT_STYLE_START+2)
+#define STR_SVT_STYLE_NORMAL_ITALIC (STR_SVT_STYLE_START+3)
+#define STR_SVT_STYLE_BOLD (STR_SVT_STYLE_START+4)
+#define STR_SVT_STYLE_BOLD_ITALIC (STR_SVT_STYLE_START+5)
+#define STR_SVT_STYLE_BLACK (STR_SVT_STYLE_START+6)
+#define STR_SVT_STYLE_BLACK_ITALIC (STR_SVT_STYLE_START+7)
+#define STR_SVT_STYLE_END (STR_SVT_STYLE_BLACK_ITALIC)
+
+#define STR_SVT_FONTMAP_START (STR_SVT_STYLE_END+1)
+#define STR_SVT_FONTMAP_BOTH (STR_SVT_FONTMAP_START+0)
+#define STR_SVT_FONTMAP_PRINTERONLY (STR_SVT_FONTMAP_START+1)
+#define STR_SVT_FONTMAP_SCREENONLY (STR_SVT_FONTMAP_START+2)
+#define STR_SVT_FONTMAP_SIZENOTAVAILABLE (STR_SVT_FONTMAP_START+3)
+#define STR_SVT_FONTMAP_STYLENOTAVAILABLE (STR_SVT_FONTMAP_START+4)
+#define STR_SVT_FONTMAP_NOTAVAILABLE (STR_SVT_FONTMAP_START+5)
+#define STR_SVT_FONTMAP_END (STR_SVT_FONTMAP_NOTAVAILABLE)
+
+#define STR_SVT_ERRORCONTEXT_START (STR_SVT_FONTMAP_END+1)
+#define STR_ERR_HDLMESS (STR_SVT_ERRORCONTEXT_START+0)
+#define RID_ERRHDL_CLASS (STR_SVT_ERRORCONTEXT_START+1)
+#define RID_ERRCTX (STR_SVT_ERRORCONTEXT_START+2)
+#define RID_ERRHDL (STR_SVT_ERRORCONTEXT_START+3)
+#define STR_SVT_ERRORCONTEXT_END (RID_ERRHDL)
+
+#define STR_WIZARDDIALOG_START (STR_SVT_ERRORCONTEXT_END + 1)
+#define STR_WIZDLG_FINISH (STR_WIZARDDIALOG_START + 0)
+#define STR_WIZDLG_NEXT (STR_WIZARDDIALOG_START + 1)
+#define STR_WIZDLG_PREVIOUS (STR_WIZARDDIALOG_START + 2)
+#define STR_WIZDLG_ROADMAP_TITLE (STR_WIZARDDIALOG_START + 3)
+#define STR_WIZARDDIALOG_END (STR_WIZDLG_ROADMAP_TITLE)
+
+#define STR_SVT_COLLATE_START (STR_WIZARDDIALOG_END+1)
+#define STR_SVT_COLLATE_NORMAL (STR_SVT_COLLATE_START+0)
+#define STR_SVT_COLLATE_DICTIONARY (STR_SVT_COLLATE_START+1)
+#define STR_SVT_COLLATE_PINYIN (STR_SVT_COLLATE_START+2)
+#define STR_SVT_COLLATE_STROKE (STR_SVT_COLLATE_START+3)
+#define STR_SVT_COLLATE_RADICAL (STR_SVT_COLLATE_START+4)
+#define STR_SVT_COLLATE_CHARSET (STR_SVT_COLLATE_START+5)
+#define STR_SVT_COLLATE_ZHUYIN (STR_SVT_COLLATE_START+6)
+#define STR_SVT_COLLATE_ALPHANUMERIC (STR_SVT_COLLATE_START+7)
+#define STR_SVT_COLLATE_UNICODE (STR_SVT_COLLATE_START+8)
+#define STR_SVT_COLLATE_PHONEBOOK (STR_SVT_COLLATE_START+9)
+#define STR_SVT_COLLATE_PHONETIC_F (STR_SVT_COLLATE_START+10)
+#define STR_SVT_COLLATE_PHONETIC_L (STR_SVT_COLLATE_START+11)
+#define STR_SVT_COLLATE_END (STR_SVT_COLLATE_PHONETIC_L)
+
+// String-Ids for accessibility
+#define STR_SVT_ACC_BEGIN (STR_SVT_COLLATE_END+1)
+#define STR_SVT_TOOL_PANEL_BUTTON_FWD (STR_SVT_ACC_BEGIN+0)
+#define STR_SVT_TOOL_PANEL_BUTTON_BACK (STR_SVT_ACC_BEGIN+1)
+#define STR_SVT_ACC_DESC_TABLISTBOX (STR_SVT_ACC_BEGIN+2)
+#define STR_SVT_ACC_DESC_FILEVIEW (STR_SVT_ACC_BEGIN+3)
+#define STR_SVT_ACC_DESC_FOLDER (STR_SVT_ACC_BEGIN+4)
+#define STR_SVT_ACC_DESC_FILE (STR_SVT_ACC_BEGIN+5)
+#define STR_SVT_ACC_EMPTY_FIELD (STR_SVT_ACC_BEGIN+6)
+//IAccessible2 implementation
+#define STR_SVT_ACC_RULER_HORZ_NAME (STR_SVT_ACC_BEGIN+9)
+#define STR_SVT_ACC_END (STR_SVT_ACC_RULER_HORZ_NAME)
+
+#define STR_SVT_INDEXENTRY_START (STR_SVT_ACC_END + 1)
+#define STR_SVT_INDEXENTRY_ALPHANUMERIC (STR_SVT_INDEXENTRY_START+0)
+#define STR_SVT_INDEXENTRY_DICTIONARY (STR_SVT_INDEXENTRY_START+1)
+#define STR_SVT_INDEXENTRY_PINYIN (STR_SVT_INDEXENTRY_START+2)
+#define STR_SVT_INDEXENTRY_RADICAL (STR_SVT_INDEXENTRY_START+3)
+#define STR_SVT_INDEXENTRY_STROKE (STR_SVT_INDEXENTRY_START+4)
+#define STR_SVT_INDEXENTRY_ZHUYIN (STR_SVT_INDEXENTRY_START+5)
+#define STR_SVT_INDEXENTRY_PHONETIC_FS (STR_SVT_INDEXENTRY_START+6)
+#define STR_SVT_INDEXENTRY_PHONETIC_FC (STR_SVT_INDEXENTRY_START+7)
+#define STR_SVT_INDEXENTRY_PHONETIC_LS (STR_SVT_INDEXENTRY_START+8)
+#define STR_SVT_INDEXENTRY_PHONETIC_LC (STR_SVT_INDEXENTRY_START+9)
+#define STR_SVT_INDEXENTRY_END (STR_SVT_INDEXENTRY_PHONETIC_LC)
+
+//String - Ids for Java errors, messages
+//These strings come from project desktop
+//There was no time for translation, therefore the defines needed to
+//remain the same.
+#define STR_SVT_JAVAERROR_START (STR_SVT_INDEXENTRY_END + 1)
+#define STR_QUESTION_JAVADISABLED (STR_SVT_JAVAERROR_START+0)
+#define STR_ERROR_JVMCREATIONFAILED (STR_SVT_JAVAERROR_START+1)
+#define STR_WARNING_JAVANOTFOUND (STR_SVT_JAVAERROR_START+2)
+#define STR_WARNING_INVALIDJAVASETTINGS (STR_SVT_JAVAERROR_START+3)
+// STR_SVT_JAVAERROR_START + 4 unused
+#define STR_SVT_JAVAERROR_END (STR_SVT_JAVAERROR_START+4)
+
+// String array to match UI language names to LanguageType values and vice versa
+#define STR_ARR_SVT_LANGUAGE_TABLE_START (STR_SVT_JAVAERROR_END + 1)
+#define STR_ARR_SVT_LANGUAGE_TABLE (STR_ARR_SVT_LANGUAGE_TABLE_START + 0)
+//due to some horror wizards/com/sun/star/wizards/letter/LocaleCodes.java needs to be kept
+//manually in sync with STR_ARR_SVT_LANGUAGE_TABLE
+#define STR_ARR_SVT_LANGUAGE_TABLE_END (STR_ARR_SVT_LANGUAGE_TABLE)
+
+#define STR_SVT_ADDRESSTEMPLATE_START (STR_ARR_SVT_LANGUAGE_TABLE_END+1)
+#define STR_NO_FIELD_SELECTION (STR_SVT_ADDRESSTEMPLATE_START+0)
+#define STR_FIELD_COMPANY (STR_SVT_ADDRESSTEMPLATE_START+1)
+#define STR_FIELD_DEPARTMENT (STR_SVT_ADDRESSTEMPLATE_START+2)
+#define STR_FIELD_FIRSTNAME (STR_SVT_ADDRESSTEMPLATE_START+3)
+#define STR_FIELD_LASTNAME (STR_SVT_ADDRESSTEMPLATE_START+4)
+#define STR_FIELD_STREET (STR_SVT_ADDRESSTEMPLATE_START+5)
+#define STR_FIELD_COUNTRY (STR_SVT_ADDRESSTEMPLATE_START+6)
+#define STR_FIELD_ZIPCODE (STR_SVT_ADDRESSTEMPLATE_START+7)
+#define STR_FIELD_CITY (STR_SVT_ADDRESSTEMPLATE_START+8)
+#define STR_FIELD_TITLE (STR_SVT_ADDRESSTEMPLATE_START+9)
+#define STR_FIELD_POSITION (STR_SVT_ADDRESSTEMPLATE_START+10)
+#define STR_FIELD_ADDRFORM (STR_SVT_ADDRESSTEMPLATE_START+11)
+#define STR_FIELD_INITIALS (STR_SVT_ADDRESSTEMPLATE_START+12)
+#define STR_FIELD_SALUTATION (STR_SVT_ADDRESSTEMPLATE_START+13)
+#define STR_FIELD_HOMETEL (STR_SVT_ADDRESSTEMPLATE_START+14)
+#define STR_FIELD_WORKTEL (STR_SVT_ADDRESSTEMPLATE_START+15)
+#define STR_FIELD_FAX (STR_SVT_ADDRESSTEMPLATE_START+16)
+#define STR_FIELD_EMAIL (STR_SVT_ADDRESSTEMPLATE_START+17)
+#define STR_FIELD_URL (STR_SVT_ADDRESSTEMPLATE_START+18)
+#define STR_FIELD_NOTE (STR_SVT_ADDRESSTEMPLATE_START+19)
+#define STR_FIELD_USER1 (STR_SVT_ADDRESSTEMPLATE_START+20)
+#define STR_FIELD_USER2 (STR_SVT_ADDRESSTEMPLATE_START+21)
+#define STR_FIELD_USER3 (STR_SVT_ADDRESSTEMPLATE_START+22)
+#define STR_FIELD_USER4 (STR_SVT_ADDRESSTEMPLATE_START+23)
+#define STR_FIELD_ID (STR_SVT_ADDRESSTEMPLATE_START+24)
+#define STR_FIELD_STATE (STR_SVT_ADDRESSTEMPLATE_START+25)
+#define STR_FIELD_OFFICETEL (STR_SVT_ADDRESSTEMPLATE_START+26)
+#define STR_FIELD_PAGER (STR_SVT_ADDRESSTEMPLATE_START+27)
+#define STR_FIELD_MOBILE (STR_SVT_ADDRESSTEMPLATE_START+28)
+#define STR_FIELD_TELOTHER (STR_SVT_ADDRESSTEMPLATE_START+29)
+#define STR_FIELD_CALENDAR (STR_SVT_ADDRESSTEMPLATE_START+30)
+#define STR_FIELD_INVITE (STR_SVT_ADDRESSTEMPLATE_START+31)
+#define STR_LOGICAL_FIELD_NAMES (STR_SVT_ADDRESSTEMPLATE_START+32)
+#define STR_SVT_ADDRESSTEMPLATE_END (STR_LOGICAL_FIELD_NAMES)
+
+
+
+//.............................................................................
+// dialogs
+
+#define DLG_LOGIN (RID_SVTOOLS_START+113)
+#define DLG_ADDRESSBOOKSOURCE (RID_SVTOOLS_START+114)
+
+//.............................................................................
+// bitmaps
+
+#define BMP_HELP_AGENT_IMAGE (RID_SVTOOLS_BITMAP_START + 1)
+#define BMP_HELP_AGENT_CLOSER (RID_SVTOOLS_BITMAP_START + 2)
+#define BMP_PLUGIN (RID_SVTOOLS_BITMAP_START + 3)
+#define BMP_LIST_ADD (RID_SVTOOLS_BITMAP_START + 4)
+
+//.............................................................................
+// image lists
+
+#define RID_SVTOOLS_IMAGELIST_BIG (RID_SVTOOLS_IMAGELIST_START + 1)
+#define RID_SVTOOLS_IMAGELIST_SMALL (RID_SVTOOLS_IMAGELIST_START + 2)
+#define RID_SVTOOLS_IMAGELIST_EDITBROWSEBOX (RID_SVTOOLS_IMAGELIST_START + 3)
+
+// Java message boxes
+//These strings come from project desktop
+//There was no time for translation, therefore the defines needed to
+//remain the same.
+#define QBX_JAVADISABLED (RID_SVTOOLS_START+20)
+#define ERRORBOX_JVMCREATIONFAILED (RID_SVTOOLS_START+21)
+#define WARNINGBOX_JAVANOTFOUND (RID_SVTOOLS_START+22)
+#define WARNINGBOX_INVALIDJAVASETTINGS (RID_SVTOOLS_START+23)
+// RID_SVTOOLS_START + 24 unused
+#define WARNINGBOX_INVALIDJAVASETTINGS_MAC (RID_SVTOOLS_START+25)
+#define ERRORBOX_JVMCREATIONFAILED_MAC (RID_SVTOOLS_START+26)
+
+//.............................................................................
+// images
+#define RID_IMG_TREENODE_COLLAPSED (RID_SVTOOLS_START + 0)
+#define RID_IMG_TREENODE_EXPANDED (RID_SVTOOLS_START + 1)
+
+#define IMG_TRIANGLE_RIGHT (RID_SVTOOLS_START + 18)
+#define IMG_TRIANGLE_DOWN (RID_SVTOOLS_START + 20)
+
+#define IMG_SVT_FOLDER (RID_SVTOOLS_START + 42)
+
+#define IMG_SVT_NEWDOC (RID_SVTOOLS_START + 52)
+#define IMG_SVT_MYDOCS (RID_SVTOOLS_START + 53)
+#define IMG_SVT_TEMPLATES (RID_SVTOOLS_START + 54)
+#define IMG_SVT_SAMPLES (RID_SVTOOLS_START + 55)
+
+#define IMG_SVT_DOCTEMPLATE_BACK_SMALL (RID_SVTOOLS_START + 70)
+#define IMG_SVT_DOCTEMPLATE_BACK_LARGE (RID_SVTOOLS_START + 71)
+#define IMG_SVT_DOCTEMPLATE_PREV_SMALL (RID_SVTOOLS_START + 72)
+#define IMG_SVT_DOCTEMPLATE_PREV_LARGE (RID_SVTOOLS_START + 73)
+#define IMG_SVT_DOCTEMPLATE_PRINT_SMALL (RID_SVTOOLS_START + 74)
+#define IMG_SVT_DOCTEMPLATE_PRINT_LARGE (RID_SVTOOLS_START + 75)
+#define IMG_SVT_DOCTEMPLATE_DOCINFO_SMALL (RID_SVTOOLS_START + 76)
+#define IMG_SVT_DOCTEMPLATE_DOCINFO_LARGE (RID_SVTOOLS_START + 77)
+#define IMG_SVT_DOCTEMPLATE_PREVIEW_SMALL (RID_SVTOOLS_START + 78)
+#define IMG_SVT_DOCTEMPLATE_PREVIEW_LARGE (RID_SVTOOLS_START + 79)
+
+#define RID_IMG_PRNDLG_NOCOLLATE (STR_SVT_PRNDLG_START + 30)
+
+// IAccessible2 implementation in 2009
+#define STR_PARAGRAPH_START (STR_SVT_PRNDLG_START + 50)
+#define STR_PARAGRAPH (STR_PARAGRAPH_START + 0)
+
+#endif // #ifndef _SVTOOLS_HRC
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/svtresid.hxx b/include/svtools/svtresid.hxx
new file mode 100644
index 000000000000..0340a1bd7c5d
--- /dev/null
+++ b/include/svtools/svtresid.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVTOOLS_SVTRESID_HXX
+#define _SVTOOLS_SVTRESID_HXX
+
+#include "svtools/svtdllapi.h"
+#include <tools/resid.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+
+class SVT_DLLPUBLIC SvtResId: public ResId
+{
+public:
+ SvtResId(sal_uInt16 nId);
+ static void DeleteResMgr();
+};
+
+#define SVT_RESSTR(i) SvtResId(i).toString()
+
+#endif // _SVTOOLS_SVTRESID_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/svxbox.hxx b/include/svtools/svxbox.hxx
new file mode 100644
index 000000000000..4ccc566fd74d
--- /dev/null
+++ b/include/svtools/svxbox.hxx
@@ -0,0 +1,178 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_BOX_HXX
+#define _SVX_BOX_HXX
+
+#include <tools/string.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/combobox.hxx>
+#include <svtools/svtdllapi.h>
+
+// forward ---------------------------------------------------------------
+
+class SvxBoxEntry;
+
+typedef std::vector<SvxBoxEntry*> SvxEntryLst;
+
+// class SvxBoxEntry -----------------------------------------------------
+
+class SVT_DLLPUBLIC SvxBoxEntry
+{
+ friend class SvxListBox;
+ friend class SvxComboBox;
+
+public:
+ SvxBoxEntry( const String& aName, sal_uInt16 nId=0 );
+ SvxBoxEntry( const SvxBoxEntry& rOrg );
+ SvxBoxEntry();
+
+ String aName;
+ sal_uInt16 nId;
+
+private:
+ sal_Bool bModified;
+ sal_Bool bNew;
+};
+
+// class SvxListBox ------------------------------------------------------
+
+class SVT_DLLPUBLIC SvxListBox : public ListBox
+{
+ using ListBox::InsertEntry;
+ using ListBox::RemoveEntry;
+ using ListBox::GetEntryPos;
+ using ListBox::IsEntrySelected;
+ using ListBox::SelectEntry;
+
+public:
+ SvxListBox( Window* pParent, WinBits nBits = WB_BORDER );
+ SvxListBox( Window* pParent, const ResId& rId );
+ ~SvxListBox();
+
+ void InsertNewEntry( const SvxBoxEntry& rEntry );
+ void InsertEntry( const SvxBoxEntry& rEntry,
+ sal_uInt16 nId = LISTBOX_ENTRY_NOTFOUND );
+
+ void RemoveEntry( sal_uInt16 nPos );
+ void RemoveEntry( const SvxBoxEntry& rEntry );
+
+ void Clear();
+
+ sal_uInt16 GetEntryPos( const SvxBoxEntry& rEntry ) const;
+ const SvxBoxEntry& GetSvxBoxEntry( sal_uInt16 nIdx ) const;
+
+ inline sal_Bool IsEntrySelected( const SvxBoxEntry& rEntry ) const;
+ const SvxBoxEntry& GetSelectSvxBoxEntry( sal_uInt16 nIdx = 0 ) const;
+ inline void SelectEntry( const SvxBoxEntry& rEntry,
+ sal_Bool bSelect = sal_True );
+
+ void ModifyEntry( sal_uInt16 nPos, const String& aName );
+ sal_uInt16 GetModifiedCount() const;
+ const SvxBoxEntry& GetModifiedEntry( sal_uInt16 nPos ) const;
+
+ sal_uInt16 GetRemovedCount() const;
+ const SvxBoxEntry& GetRemovedEntry( sal_uInt16 nPos ) const;
+
+ sal_uInt16 GetNewCount() const;
+ const SvxBoxEntry& GetNewEntry( sal_uInt16 nPos ) const;
+
+private:
+ SvxEntryLst aEntryLst;
+ SvxEntryLst aDelEntryLst;
+ SvxBoxEntry aDefault;
+
+ void InitListBox();
+ void InsertSorted( SvxBoxEntry* pEntry );
+};
+
+// inlines ---------------------------------------------------------------
+
+inline sal_Bool SvxListBox::IsEntrySelected( const SvxBoxEntry& aEntry ) const
+ { return ListBox::IsEntrySelected( aEntry.aName ); }
+
+inline void SvxListBox::SelectEntry( const SvxBoxEntry& aEntry, sal_Bool bSelect )
+ { ListBox::SelectEntry( aEntry.aName, bSelect ); }
+
+// enum SvxComboBoxStyle -------------------------------------------------
+
+enum SvxComboBoxStyle
+{
+ SVX_CBS_UPPER = 0x01,
+ SVX_CBS_LOWER = 0x02,
+ SVX_CBS_ALL = 0x04,
+ SVX_CBS_FILENAME = 0x08,
+ SVX_CBS_SW_FILENAME = SVX_CBS_FILENAME
+};
+
+// class SvxComboBox -----------------------------------------------------
+
+class SVT_DLLPUBLIC SvxComboBox : public ComboBox
+{
+ using ComboBox::InsertEntry;
+ using ComboBox::RemoveEntry;
+ using ComboBox::GetEntryPos;
+ using Window::SetStyle;
+
+public:
+ SvxComboBox( Window* pParent,
+ WinBits nBits = WB_BORDER, sal_uInt16 nStyleBits = SVX_CBS_ALL );
+ SvxComboBox( Window* pParent, const ResId& rId, sal_uInt16 nStyleBits = SVX_CBS_ALL );
+ ~SvxComboBox();
+
+ void InsertNewEntry( const SvxBoxEntry& );
+ void InsertEntry( const SvxBoxEntry& );
+
+ void RemoveEntry( sal_uInt16 nPos );
+ void RemoveEntry( const SvxBoxEntry& rEntry );
+
+ void Clear();
+
+ sal_uInt16 GetEntryPos( const SvxBoxEntry& rEntry ) const;
+ const SvxBoxEntry& GetEntry( sal_uInt16 nIdx ) const;
+
+ void ModifyEntry( sal_uInt16 nPos, const String& aName );
+ sal_uInt16 GetModifiedCount() const;
+ const SvxBoxEntry& GetModifiedEntry( sal_uInt16 nPos ) const;
+
+ sal_uInt16 GetRemovedCount() const;
+ const SvxBoxEntry& GetRemovedEntry( sal_uInt16 nPos ) const;
+
+ sal_uInt16 GetNewCount() const;
+ const SvxBoxEntry& GetNewEntry( sal_uInt16 nPos ) const;
+
+ sal_uInt16 GetStyle() const { return nStyle; }
+ void SetStyle( const sal_uInt16 nSt ) { nStyle = nSt; }
+
+ OUString GetText() const;
+
+private:
+ SvxEntryLst aEntryLst;
+ SvxEntryLst aDelEntryLst;
+ SvxBoxEntry aDefault;
+ sal_uInt16 nStyle;
+
+ virtual void KeyInput( const KeyEvent& rKEvt );
+
+ void InitComboBox();
+ void InsertSorted( SvxBoxEntry* pEntry );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/tabbar.hxx b/include/svtools/tabbar.hxx
new file mode 100644
index 000000000000..265723ecf8b8
--- /dev/null
+++ b/include/svtools/tabbar.hxx
@@ -0,0 +1,557 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _TABBAR_HXX
+#define _TABBAR_HXX
+
+#include "svtools/svtdllapi.h"
+#include <tools/link.hxx>
+#include <vcl/window.hxx>
+#include <vector>
+
+class MouseEvent;
+class TrackingEvent;
+class DataChangedEvent;
+class ImplTabButton;
+class ImplTabSizer;
+class TabBarEdit;
+
+struct ImplTabBarItem;
+typedef ::std::vector< ImplTabBarItem* > ImplTabBarList;
+
+// -----------------
+// - Dokumentation -
+// -----------------
+
+/*
+
+Erlaubte StyleBits
+------------------
+
+WB_SCROLL - Die Tabs koennen ueber ein Extra-Feld gescrollt werden
+WB_MINSCROLL - Die Tabs koennen ueber 2 zusaetzliche Buttons gescrollt werden
+WB_RANGESELECT - Zusammenhaengende Bereiche koennen selektiert werden
+WB_MULTISELECT - Einzelne Tabs koennen selektiert werden
+WB_BORDER - Oben und unten wird ein Strich gezeichnet
+WB_TOPBORDER - Oben wird ein Border gezeichnet
+WB_3DTAB - Die Tabs und der Border werden in 3D gezeichnet
+WB_DRAG - Vom TabBar wird ein StartDrag-Handler gerufen, wenn
+ Drag and Drop gestartet werden soll. Es wird ausserdem
+ im TabBar mit EnableDrop() Drag and Drop eingeschaltet.
+WB_SIZEABLE - Vom TabBar wird ein Split-Handler gerufen, wenn der Anwender
+ den TabBar in der Breite aendern will
+WB_STDTABBAR - WB_BORDER
+
+Wenn man den TabBar zum Beispiel als Property-Bar benutzen moechte, sollten
+die WinBits WB_TOPBORDER und WB_3DTAB anstatt WB_BORDER gesetzt werden.
+
+
+Erlaubte PageBits
+-----------------
+
+TPB_SPECIAL - Andere Darstellung des TabTextes, zum Beispiel fuer
+ Szenario-Seiten.
+
+
+Handler
+-------
+
+Select - Wird gerufen, wenn eine Tab selektiert oder
+ deselektiert wird
+DoubleClick - Wird gerufen, wenn ein DoubleClick im TabBar ausgeloest
+ wurde. Innerhalb des Handlers liefert GetCurPageId() die
+ angeklickte Tab zurueck oder 0, wenn keine Tab angeklickt
+ wurde
+ActivatePage - Wird gerufen, wenn eine andere Seite aktiviert wird.
+ GetCurPageId() gibt die aktivierte Seite zurueck.
+DeactivatePage - Wird gerufen, wenn eine Seite deaktiviert wird. Wenn
+ eine andere Seite aktiviert werden darf, muss sal_True
+ zurueckgegeben werden, wenn eine andere Seite von
+ der Aktivierung ausgeschlossen werden soll, muss
+ sal_False zurueckgegeben werden. GetCurPageId() gibt die
+ zu deaktivierende Seite zurueck.
+
+
+
+Drag and Drop
+-------------
+
+Fuer Drag and Drop muss das WinBit WB_DRAG gesetzt werden. Ausserdem
+muss der Command-, QueryDrop-Handler und der Drop-Handler ueberlagert
+werden. Dabei muss in den Handlern folgendes implementiert werden:
+
+Command - Wenn in diesem Handler das Dragging gestartet werden
+ soll, muss StartDrag() gerufen werden. Diese Methode
+ selektiert dann den entsprechenden Eintrag oder gibt
+ sal_False zurueck, wenn das Dragging nicht durchgefuhert
+ werden kann.
+
+QueryDrop - Dieser Handler wird von StarView immer dann gerufen, wenn
+ bei einem Drag-Vorgang die Maus ueber das Fenster gezogen
+ wird (siehe dazu auch SV-Doku). In diesem Handler muss
+ festgestellt werden, ob ein Drop moeglich ist. Die
+ Drop-Position kann im TabBar mit ShowDropPos() angezeigt
+ werden. Beim Aufruf muss die Position vom Event uebergeben
+ werden. Wenn sich die Position am linken oder rechten
+ Rand befindet, wird automatisch im TabBar gescrollt.
+ Diese Methode gibt auch die entsprechende Drop-Position
+ zurueck, die auch fuer ein Drop gebraucht wird. Wenn das
+ Fenster beim Drag verlassen wird, kann mit HideDropPos()
+ die DropPosition wieder weggenommen werden. Es ist dadurch
+ auch moeglich, ein von ausserhalb des TabBars ausgeloestes
+ Drag zu verarbeiten.
+
+Drop - Im Drop-Handler muessen dann die Pages verschoben werden,
+ oder die neuen Pages eingefuegt werden. Die entsprechende
+ Drop-Postion kann mit ShowDropPos() ermittelt werden.
+
+Folgende Methoden werden fuer Drag and Drop gebraucht und muessen von
+den Handlern gerufen werden:
+
+StartDrag - Muss aus dem Commnad-Handler gerufen werden. Als Parameter
+ muss der CommandEvent uebergeben werden und eine Referenz
+ auf eine Region. Diese Region muss dann bei ExecuteDrag()
+ uebergeben werden, wenn der Rueckgabewert sagt, das
+ ExecuteDrag durchgefuehrt werden soll. Falls der Eintrag
+ nicht selektiert ist, wird er vorher als aktueller
+ Eintrag gesetzt. Es ist daher darauf zu achten, das aus
+ dieser Methode heraus der Select-Handler gerufen werden
+ kann.
+
+ShowDropPos - Diese Methode muss vom QueryDrop-Handler gerufen werden,
+ damit der TabBar anzeigt, wo die Tabs eingefuegt werden.
+ Diese Methode kann auch im Drop-Handler benutzt werden,
+ um die Position zu ermitteln wo die Tabs eingefuegt werden
+ sollen. In der Methode muss die Position vom Event
+ uebergeben werden. Diese Methode gibt die Position zurueck,
+ wo die Tabs eingefuegt werden sollen.
+
+HideDropPos - Diese Methode nimmt die vorher mit ShowDropPos() angezeigte
+ DropPosition wieder zurueck. Diese Methode sollte dann
+ gerufen werden, wenn bei QueryDrop() das Fenster verlassen
+ wird oder der Dragvorgang beendet wurde.
+
+Folgende Methoden koennen eingesetzt werden, wenn bei D&D die Seiten
+umgeschaltet werden sollen:
+
+SwitchPage - Diese Methode muss vom QueryDrop-Handler gerufen werden,
+ wenn die Seite ueber der sich der Mousepointer befindet,
+ umgeschaltet werden soll. Diese Methode sollte jedesmal
+ gerufen werden, wenn der QueryDrop-Handler gerufen wird.
+ Das umschalten der Seite passiert zeitverzoegert (500 ms)
+ und wird automatisch von dieser Methode verwaltet.
+ In der Methode muss die Position vom Event uebergeben
+ werden. Diese Methode gibt sal_True zurueck, wenn die Page
+ umgeschaltet wurde.
+
+EndSwitchPage - Diese Methode setzt die Daten fuer das umschalten der
+ Seiten zurueck. Diese Methode sollte dann gerufen werden,
+ wenn bei QueryDrop() das Fenster verlassen wird oder
+ der Dragvorgang beendet wurde.
+
+IsInSwitching - Mit dieser Methode kann im ActivatePage()/DeactivatePage()
+ abgefragt werden, ob dies durch SwitchPage() veranlasst
+ wurde. So kann dann beispielsweise in DeactivatePage()
+ das Umschalten ohne eine Fehlerbox verhindert werden.
+
+
+Fenster-Resize
+--------------
+
+Wenn das Fenster vom Anwender in der Breite geaendert werden kann, dann
+muss das WinBit WB_SIZEABLE gesetzt werden. In diesem Fall muss noch
+folgender Handler ueberlagert werden:
+
+Split - Wenn dieser Handler gerufen wird, sollte das Fenster
+ auf die Breite angepasst werden, die von GetSplitSize()
+ zurueckgegeben wird. Dabei wird keine minimale und
+ maximale Breite beruecksichtig. Eine minimale Breite
+ kann mit GetMinSize() abgefragt werden und die maximale
+ Breite muss von der Anwendung selber berechnet werden.
+ Da nur Online-Resize unterstuetzt wird, muss das Fenster
+ innerhalb dieses Handlers in der Breite geaendert
+ werden und eventuell abhaengige Fenster ebenfalls. Fuer
+ diesen Handler kann auch mit SetSplitHdl() ein
+ Link gesetzt werden.
+
+Folgende Methoden liefern beim Splitten weitere Informationen:
+
+GetSplitSize() - Liefert die Breite des TabBars zurueck, auf die der
+ Anwender das Fenster resizen will. Dabei wird keine
+ minimale oder maximale Breite beruecksichtigt. Es wird
+ jedoch nie eine Breite < 5 zurueckgeliefert. Diese Methode
+ liefert nur solange richtige Werte, wie Splitten aktiv
+ ist.
+
+GetMinSize() - Mit dieser Methode kann eine minimale Fensterbreite
+ abgefragt werden, so das min. etwas eines Tabs sichtbar
+ ist. Jedoch kann der TabBar immer noch schmaler gesetzt
+ werden, als die Breite, die diese Methode zurueckliefert.
+ Diese Methode kann auch aufgerufen werden, wenn kein
+ Splitten aktiv ist.
+
+
+Edit-Modus
+----------
+
+Der Tabbar bietet auch Moeglichkeiten, das der Anwender in den Tabreitern
+die Namen aendern kann.
+
+EnableEditMode - Damit kann eingestellt werden, das bei Alt+LeftClick
+ StartEditMode() automatisch vom TabBar gerufen wird.
+ Im StartRenaming()-Handler kann dann das Umbenennen
+ noch abgelehnt werden.
+StartEditMode - Mit dieser Methode wird der EditModus auf einem
+ Tab gestartet. sal_False wird zurueckgegeben, wenn
+ der Editmodus schon aktiv ist, mit StartRenaming()
+ der Modus abgelehnt wurde oder kein Platz zum
+ Editieren vorhanden ist.
+EndEditMode - Mit dieser Methode wird der EditModus beendet.
+SetEditText - Mit dieser Methode kann der Text im AllowRenaming()-
+ Handler noch durch einen anderen Text ersetzt werden.
+GetEditText - Mit dieser Methode kann im AllowRenaming()-Handler
+ der Text abgefragt werden, den der Anwender eingegeben
+ hat.
+IsInEditMode - Mit dieser Methode kann abgefragt werden, ob der
+ Editmodus aktiv ist.
+IsEditModeCanceled - Mit dieser Methode kann im EndRenaming()-
+ Handler abgefragt werden, ob die Umbenenung
+ abgebrochen wurde.
+GetEditPageId - Mit dieser Methode wird in den Renaming-Handlern
+ abgefragt, welcher Tab umbenannt wird/wurde.
+
+StartRenaming() - Dieser Handler wird gerufen, wenn ueber StartEditMode()
+ der Editmodus gestartet wurde. Mit GetEditPageId()
+ kann abgefragt werden, welcher Tab umbenannt werden
+ soll. sal_False sollte zurueckgegeben werden, wenn
+ der Editmodus nicht gestartet werden soll.
+AllowRenaming() - Dieser Handler wird gerufen, wenn der Editmodus
+ beendet wird (nicht bei Cancel). In diesem Handler
+ kann dann getestet werden, ob der Text OK ist.
+ Mit GetEditPageId() kann abgefragt werden, welcher Tab
+ umbenannt wurde.
+ Es sollte einer der folgenden Werte zurueckgegeben
+ werden:
+ TAB_RENAMING_YES
+ Der Tab wird umbenannt.
+ TAB_RENAMING_NO
+ Der Tab wird nicht umbenannt, der Editmodus bleibt
+ jedoch aktiv, so das der Anwender den Namen
+ entsprechent anpassen kann.
+ TAB_RENAMING_CANCEL
+ Der Editmodus wird abgebrochen und der alte
+ Text wieder hergestellt.
+EndRenaming() - Dieser Handler wird gerufen, wenn der Editmodus
+ beendet wurde. Mit GetEditPageId() kann abgefragt
+ werden, welcher Tab umbenannt wurde. Mit
+ IsEditModeCanceled() kann abgefragt werden, ob der
+ Modus abgebrochen wurde und der Name dadurch nicht
+ geaendert wurde.
+
+
+Maximale Pagebreite
+-------------------
+
+Die Pagebreite der Tabs kann begrenzt werden, damit ein einfacheres
+Navigieren ueber diese moeglich ist. Wenn der Text dann nicht komplett
+angezeigt werden kann, wird er mit ... abgekuerzt und in der Tip-
+oder der aktiven Hilfe (wenn kein Hilfetext gesetzt ist) wird dann der
+ganze Text angezeigt. Mit EnableAutoMaxPageWidth() kann eingestellt
+werden, ob die maximale Pagebreite sich nach der gerade sichtbaren
+Breite richten soll (ist der default). Ansonsten kann auch die
+maximale Pagebreite mit SetMaxPageWidth() (in Pixeln) gesetzt werden
+(die AutoMaxPageWidth wird dann ignoriert).
+
+
+KontextMenu
+-----------
+
+Wenn ein kontextsensitives PopupMenu anzeigt werden soll, muss der
+Command-Handler ueberlagert werden. Mit GetPageId() und bei
+Uebergabe der Mausposition kann ermittelt werden, ob der Mausclick
+ueber einem bzw. ueber welchem Item durchgefuehrt wurde.
+*/
+
+// -----------
+// - WinBits -
+// -----------
+
+#define WB_RANGESELECT ((WinBits)0x00200000)
+#define WB_MULTISELECT ((WinBits)0x00400000)
+#define WB_TOPBORDER ((WinBits)0x04000000)
+#define WB_3DTAB ((WinBits)0x08000000)
+#define WB_MINSCROLL ((WinBits)0x20000000)
+#define WB_INSERTTAB ((WinBits)0x40000000)
+#define WB_STDTABBAR WB_BORDER
+
+// ------------------
+// - TabBarPageBits -
+// ------------------
+
+typedef sal_uInt16 TabBarPageBits;
+
+// -------------------------
+// - Bits fuer TabBarPages -
+// -------------------------
+
+#define TPB_SPECIAL ((TabBarPageBits)0x0001)
+
+// ----------------
+// - TabBar-Types -
+// ----------------
+
+#define TABBAR_RENAMING_YES ((long)sal_True)
+#define TABBAR_RENAMING_NO ((long)sal_False)
+#define TABBAR_RENAMING_CANCEL ((long)2)
+
+// ----------
+// - TabBar -
+// ----------
+struct TabBar_Impl;
+struct ImplTabBarItem;
+
+class SVT_DLLPUBLIC TabBar : public Window
+{
+ friend class ImplTabButton;
+ friend class ImplTabSizer;
+
+private:
+ ImplTabBarList* mpItemList;
+ ImplTabButton* mpFirstBtn;
+ ImplTabButton* mpPrevBtn;
+ ImplTabButton* mpNextBtn;
+ ImplTabButton* mpLastBtn;
+ TabBar_Impl* mpImpl;
+ TabBarEdit* mpEdit;
+ OUString maEditText;
+ Color maSelColor;
+ Color maSelTextColor;
+ Size maWinSize;
+ long mnMaxPageWidth;
+ long mnCurMaxWidth;
+ long mnOffX;
+ long mnOffY;
+ long mnLastOffX;
+ long mnSplitSize;
+ sal_uLong mnSwitchTime;
+ WinBits mnWinStyle;
+ sal_uInt16 mnCurPageId;
+ sal_uInt16 mnFirstPos;
+ sal_uInt16 mnDropPos;
+ sal_uInt16 mnSwitchId;
+ sal_uInt16 mnEditId;
+ sal_Bool mbFormat;
+ sal_Bool mbFirstFormat;
+ sal_Bool mbSizeFormat;
+ sal_Bool mbAutoMaxWidth;
+ sal_Bool mbInSwitching;
+ sal_Bool mbAutoEditMode;
+ sal_Bool mbEditCanceled;
+ sal_Bool mbDropPos;
+ sal_Bool mbInSelect;
+ sal_Bool mbSelColor;
+ sal_Bool mbSelTextColor;
+ bool mbMirrored;
+ bool mbHasInsertTab; // if true, the tab bar has an extra tab at the end.
+ Link maSelectHdl;
+ Link maDoubleClickHdl;
+ Link maSplitHdl;
+ Link maActivatePageHdl;
+ Link maDeactivatePageHdl;
+ Link maStartRenamingHdl;
+ Link maAllowRenamingHdl;
+ Link maEndRenamingHdl;
+ size_t maCurrentItemList;
+
+ using Window::ImplInit;
+ SVT_DLLPRIVATE void ImplInit( WinBits nWinStyle );
+ SVT_DLLPRIVATE void ImplInitSettings( sal_Bool bFont, sal_Bool bBackground );
+ SVT_DLLPRIVATE void ImplGetColors( Color& rFaceColor, Color& rFaceTextColor,
+ Color& rSelectColor, Color& rSelectTextColor );
+ SVT_DLLPRIVATE void ImplShowPage( sal_uInt16 nPos );
+ SVT_DLLPRIVATE sal_Bool ImplCalcWidth();
+ SVT_DLLPRIVATE void ImplFormat();
+ SVT_DLLPRIVATE sal_uInt16 ImplGetLastFirstPos();
+ SVT_DLLPRIVATE void ImplInitControls();
+ SVT_DLLPRIVATE void ImplEnableControls();
+ SVT_DLLPRIVATE void ImplSelect();
+ SVT_DLLPRIVATE void ImplActivatePage();
+ SVT_DLLPRIVATE long ImplDeactivatePage();
+ SVT_DLLPRIVATE void ImplPrePaint();
+ SVT_DLLPRIVATE ImplTabBarItem* ImplGetLastTabBarItem( sal_uInt16 nItemCount );
+ SVT_DLLPRIVATE Rectangle ImplGetInsertTabRect(ImplTabBarItem* pItem) const;
+ DECL_DLLPRIVATE_LINK( ImplClickHdl, ImplTabButton* );
+
+ ImplTabBarItem* seek( size_t i );
+ ImplTabBarItem* prev();
+ ImplTabBarItem* next();
+
+public:
+ static const sal_uInt16 APPEND;
+ static const sal_uInt16 PAGE_NOT_FOUND;
+ static const sal_uInt16 INSERT_TAB_POS;
+
+ TabBar( Window* pParent, WinBits nWinStyle = WB_STDTABBAR );
+ virtual ~TabBar();
+
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void Paint( const Rectangle& rRect );
+ virtual void Resize();
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+ virtual void StateChanged( StateChangedType nStateChange );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ virtual void Select();
+ virtual void DoubleClick();
+ virtual void Split();
+ virtual void ActivatePage();
+ virtual long DeactivatePage();
+ virtual long StartRenaming();
+ virtual long AllowRenaming();
+ virtual void EndRenaming();
+ virtual void Mirror();
+
+ void InsertPage( sal_uInt16 nPageId, const OUString& rText,
+ TabBarPageBits nBits = 0,
+ sal_uInt16 nPos = TabBar::APPEND );
+ void RemovePage( sal_uInt16 nPageId );
+ void MovePage( sal_uInt16 nPageId, sal_uInt16 nNewPos );
+
+ Color GetTabBgColor( sal_uInt16 nPageId ) const;
+ void SetTabBgColor( sal_uInt16 nPageId, const Color& aTabBgColor );
+ sal_Bool IsDefaultTabBgColor( sal_uInt16 nPageId );
+
+ void Clear();
+
+ sal_Bool IsPageEnabled( sal_uInt16 nPageId ) const;
+
+ void SetPageBits( sal_uInt16 nPageId, TabBarPageBits nBits = 0 );
+ TabBarPageBits GetPageBits( sal_uInt16 nPageId ) const;
+
+ sal_uInt16 GetPageCount() const;
+ sal_uInt16 GetPageId( sal_uInt16 nPos ) const;
+ sal_uInt16 GetPagePos( sal_uInt16 nPageId ) const;
+ sal_uInt16 GetPageId( const Point& rPos, bool bCheckInsTab = false ) const;
+ Rectangle GetPageRect( sal_uInt16 nPageId ) const;
+ // returns the rectangle in which page tabs are drawn
+ Rectangle GetPageArea() const;
+
+ void SetCurPageId( sal_uInt16 nPageId );
+ sal_uInt16 GetCurPageId() const { return mnCurPageId; }
+
+ void SetFirstPageId( sal_uInt16 nPageId );
+ sal_uInt16 GetFirstPageId() const { return GetPageId( mnFirstPos ); }
+ void MakeVisible( sal_uInt16 nPageId );
+
+ void SelectPage( sal_uInt16 nPageId, sal_Bool bSelect = sal_True );
+ sal_uInt16 GetSelectPageCount() const;
+ sal_Bool IsPageSelected( sal_uInt16 nPageId ) const;
+
+ void EnableAutoMaxPageWidth( sal_Bool bEnable = sal_True ) { mbAutoMaxWidth = bEnable; }
+ sal_Bool IsAutoMaxPageWidthEnabled() const { return mbAutoMaxWidth; }
+ void SetMaxPageWidth( long nMaxWidth );
+ long GetMaxPageWidth() const { return mnMaxPageWidth; }
+ void ResetMaxPageWidth() { SetMaxPageWidth( 0 ); }
+ sal_Bool IsMaxPageWidth() const { return mnMaxPageWidth != 0; }
+
+ void EnableEditMode( sal_Bool bEnable = sal_True ) { mbAutoEditMode = bEnable; }
+ sal_Bool IsEditModeEnabled() const { return mbAutoEditMode; }
+ sal_Bool StartEditMode( sal_uInt16 nPageId );
+ void EndEditMode( sal_Bool bCancel = sal_False );
+ void SetEditText( const OUString& rText ) { maEditText = rText; }
+ const OUString& GetEditText() const { return maEditText; }
+ sal_Bool IsInEditMode() const { return (mpEdit != NULL); }
+ sal_Bool IsEditModeCanceled() const { return mbEditCanceled; }
+ sal_uInt16 GetEditPageId() const { return mnEditId; }
+
+ /** Mirrors the entire control including position of buttons and splitter.
+ Mirroring is done relative to the current direction of the GUI.
+ @param bMirrored sal_True = the control will draw itself RTL in LTR GUI,
+ and vice versa; sal_False = the control behaves according to the
+ current direction of the GUI. */
+ void SetMirrored(bool bMirrored = true);
+ /** Returns sal_True, if the control is set to mirrored mode (see SetMirrored()). */
+ bool IsMirrored() const { return mbMirrored; }
+
+ /** Sets the control to LTR or RTL mode regardless of the GUI direction.
+ @param bRTL sal_False = the control will draw from left to right;
+ sal_True = the control will draw from right to left. */
+ void SetEffectiveRTL( bool bRTL );
+ /** Returns true, if the control draws from right to left (see SetEffectiveRTL()). */
+ bool IsEffectiveRTL() const;
+
+ sal_Bool StartDrag( const CommandEvent& rCEvt, Region& rRegion );
+ sal_uInt16 ShowDropPos( const Point& rPos );
+ void HideDropPos();
+ sal_Bool SwitchPage( const Point& rPos );
+ void EndSwitchPage();
+ sal_Bool IsInSwitching() { return mbInSwitching; }
+
+ const Color& GetSelectColor() const { return maSelColor; }
+ sal_Bool IsSelectColor() const { return mbSelColor; }
+ const Color& GetSelectTextColor() const { return maSelTextColor; }
+ sal_Bool IsSelectTextColor() const { return mbSelTextColor; }
+
+ void SetPageText( sal_uInt16 nPageId, const OUString& rText );
+ OUString GetPageText( sal_uInt16 nPageId ) const;
+ XubString GetHelpText( sal_uInt16 nPageId ) const;
+ OString GetHelpId( sal_uInt16 nPageId ) const;
+
+ long GetSplitSize() const { return mnSplitSize; }
+
+ void SetHelpText( const XubString& rText )
+ { Window::SetHelpText( rText ); }
+ XubString GetHelpText() const
+ { return Window::GetHelpText(); };
+ void SetHelpId( const OString& rId )
+ { Window::SetHelpId( rId ); }
+ const OString& GetHelpId() const
+ { return Window::GetHelpId(); }
+
+ void SetStyle( WinBits nStyle );
+ WinBits GetStyle() const { return mnWinStyle; }
+
+ Size CalcWindowSizePixel() const;
+
+ void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; }
+ const Link& GetSelectHdl() const { return maSelectHdl; }
+ void SetDoubleClickHdl( const Link& rLink ) { maDoubleClickHdl = rLink; }
+ const Link& GetDoubleClickHdl() const { return maDoubleClickHdl; }
+ void SetSplitHdl( const Link& rLink ) { maSplitHdl = rLink; }
+ const Link& GetSplitHdl() const { return maSplitHdl; }
+ void SetActivatePageHdl( const Link& rLink ) { maActivatePageHdl = rLink; }
+ const Link& GetActivatePageHdl() const { return maActivatePageHdl; }
+ void SetDeactivatePageHdl( const Link& rLink ) { maDeactivatePageHdl = rLink; }
+ const Link& GetDeactivatePageHdl() const { return maDeactivatePageHdl; }
+ void SetStartRenamingHdl( const Link& rLink ) { maStartRenamingHdl = rLink; }
+ const Link& GetStartRenamingHdl() const { return maStartRenamingHdl; }
+ void SetAllowRenamingHdl( const Link& rLink ) { maAllowRenamingHdl = rLink; }
+ const Link& GetAllowRenamingHdl() const { return maAllowRenamingHdl; }
+ void SetEndRenamingHdl( const Link& rLink ) { maEndRenamingHdl = rLink; }
+ const Link& GetEndRenamingHdl() const { return maEndRenamingHdl; }
+
+ // accessibility
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
+};
+
+#endif // _TABBAR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/table/defaultinputhandler.hxx b/include/svtools/table/defaultinputhandler.hxx
new file mode 100644
index 000000000000..021b523f1bda
--- /dev/null
+++ b/include/svtools/table/defaultinputhandler.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVTOOLS_INC_TABLE_DEFAULTINPUTHANDLER_HXX
+#define SVTOOLS_INC_TABLE_DEFAULTINPUTHANDLER_HXX
+
+#include "svtools/table/tableinputhandler.hxx"
+#include "svtools/table/tabletypes.hxx"
+
+#include <boost/scoped_ptr.hpp>
+
+//......................................................................................................................
+namespace svt { namespace table
+{
+//......................................................................................................................
+
+ struct DefaultInputHandler_Impl;
+
+ //==================================================================================================================
+ //= DefaultInputHandler
+ //==================================================================================================================
+ class DefaultInputHandler : public ITableInputHandler
+ {
+ private:
+ ::boost::scoped_ptr< DefaultInputHandler_Impl > m_pImpl;
+
+ public:
+ DefaultInputHandler();
+ ~DefaultInputHandler();
+
+ virtual bool MouseMove ( ITableControl& _rControl, const MouseEvent& rMEvt );
+ virtual bool MouseButtonDown ( ITableControl& _rControl, const MouseEvent& rMEvt );
+ virtual bool MouseButtonUp ( ITableControl& _rControl, const MouseEvent& rMEvt );
+ virtual bool KeyInput ( ITableControl& _rControl, const KeyEvent& rKEvt );
+ virtual bool GetFocus ( ITableControl& _rControl );
+ virtual bool LoseFocus ( ITableControl& _rControl );
+ virtual bool RequestHelp ( ITableControl& _rControl, const HelpEvent& rHEvt );
+ virtual bool Command ( ITableControl& _rControl, const CommandEvent& rCEvt );
+ virtual bool PreNotify ( ITableControl& _rControl, NotifyEvent& rNEvt );
+ virtual bool Notify ( ITableControl& _rControl, NotifyEvent& rNEvt );
+ };
+
+//......................................................................................................................
+} } // namespace svt::table
+//......................................................................................................................
+
+#endif // SVTOOLS_INC_TABLE_DEFAULTINPUTHANDLER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/table/gridtablerenderer.hxx b/include/svtools/table/gridtablerenderer.hxx
new file mode 100644
index 000000000000..21a096268fe1
--- /dev/null
+++ b/include/svtools/table/gridtablerenderer.hxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVTOOLS_INC_TABLE_GRIDTABLERENDERER_HXX
+#define SVTOOLS_INC_TABLE_GRIDTABLERENDERER_HXX
+
+#include <svtools/table/tablemodel.hxx>
+
+#include <boost/scoped_ptr.hpp>
+
+//........................................................................
+namespace svt { namespace table
+{
+//........................................................................
+
+ struct GridTableRenderer_Impl;
+
+ //====================================================================
+ //= GridTableRenderer
+ //====================================================================
+ /** a default implementation for the ->ITableRenderer interface
+
+ This class is able to paint a table grid, table headers, and cell
+ backgrounds according to the selected/active state of cells.
+ */
+ class GridTableRenderer : public ITableRenderer
+ {
+ private:
+ ::boost::scoped_ptr< GridTableRenderer_Impl > m_pImpl;
+
+ public:
+ /** creates a table renderer associated with the given model
+
+ @param _rModel
+ the model which should be rendered. The caller is responsible
+ for lifetime control, that is, the model instance must live
+ at least as long as the renderer instance lives
+ */
+ GridTableRenderer( ITableModel& _rModel );
+ ~GridTableRenderer();
+
+ /** determines whether or not to paint grid lines
+ */
+ bool useGridLines() const;
+
+ /** controls whether or not to paint grid lines
+ */
+ void useGridLines( bool const i_use );
+
+ public:
+ // ITableRenderer overridables
+ virtual void PaintHeaderArea(
+ OutputDevice& _rDevice, const Rectangle& _rArea,
+ bool _bIsColHeaderArea, bool _bIsRowHeaderArea,
+ const StyleSettings& _rStyle );
+ virtual void PaintColumnHeader( ColPos _nCol, bool _bActive, bool _bSelected,
+ OutputDevice& _rDevice, const Rectangle& _rArea,
+ const StyleSettings& _rStyle );
+ virtual void PrepareRow( RowPos _nRow, bool i_hasControlFocus, bool _bSelected,
+ OutputDevice& _rDevice, const Rectangle& _rRowArea,
+ const StyleSettings& _rStyle );
+ virtual void PaintRowHeader(
+ bool i_hasControlFocus, bool _bSelected,
+ OutputDevice& _rDevice, const Rectangle& _rArea,
+ const StyleSettings& _rStyle );
+ virtual void PaintCell( ColPos const i_col,
+ bool i_hasControlFocus, bool _bSelected,
+ OutputDevice& _rDevice, const Rectangle& _rArea,
+ const StyleSettings& _rStyle );
+ virtual void ShowCellCursor( Window& _rView, const Rectangle& _rCursorRect);
+ virtual void HideCellCursor( Window& _rView, const Rectangle& _rCursorRect);
+ virtual bool FitsIntoCell(
+ ::com::sun::star::uno::Any const & i_cellContent,
+ ColPos const i_colPos, RowPos const i_rowPos,
+ bool const i_active, bool const i_selected,
+ OutputDevice& i_targetDevice, Rectangle const & i_targetArea
+ ) const;
+ virtual bool GetFormattedCellString(
+ ::com::sun::star::uno::Any const & i_cellValue,
+ ColPos const i_colPos, RowPos const i_rowPos,
+ OUString & o_cellString
+ ) const;
+
+ private:
+ struct CellRenderContext;
+
+ void impl_paintCellContent(
+ CellRenderContext const & i_context
+ );
+ void impl_paintCellImage(
+ CellRenderContext const & i_context,
+ Image const & i_image
+ );
+ void impl_paintCellText(
+ CellRenderContext const & i_context,
+ OUString const & i_text
+ );
+ };
+//........................................................................
+} } // namespace svt::table
+//........................................................................
+
+#endif // SVTOOLS_INC_TABLE_GRIDTABLERENDERER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/table/tablecontrol.hxx b/include/svtools/table/tablecontrol.hxx
new file mode 100644
index 000000000000..a170a38a4648
--- /dev/null
+++ b/include/svtools/table/tablecontrol.hxx
@@ -0,0 +1,218 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVTOOLS_INC_TABLE_TABLECONTROL_HXX
+#define SVTOOLS_INC_TABLE_TABLECONTROL_HXX
+
+#include "svtools/svtdllapi.h"
+#include "svtools/table/tablemodel.hxx"
+#include "svtools/accessibletable.hxx"
+#include "svtools/accessiblefactory.hxx"
+
+#include <vcl/ctrl.hxx>
+#include <vcl/seleng.hxx>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/scoped_ptr.hpp>
+
+//........................................................................
+
+namespace svt { namespace table
+{
+//........................................................................
+
+ class TableControl_Impl;
+
+ //====================================================================
+ //= TableControl
+ //====================================================================
+ /** a basic control which manages table-like data, i.e. a number of cells
+ organized in <code>m</code> rows and <code>n</code> columns.
+
+ The control itself does not do any assumptions about the concrete data
+ it displays, this is encapsulated in an instance supporting the
+ ->ITableModel interface.
+
+ Also, the control does not do any assumptions about how the model's
+ content is rendered. This is the responsibility of a component
+ supporting the ->ITableRenderer interface (the renderer is obtained from
+ the model).
+
+ The control supports the concept of a <em>current</em> (or <em>active</em>
+ cell).
+ The control supports accessibility, this is encapsulated in IAccessibleTable
+ */
+ class SVT_DLLPUBLIC TableControl : public Control, public IAccessibleTable
+ {
+ private:
+ ::boost::shared_ptr< TableControl_Impl > m_pImpl;
+
+
+ public:
+ TableControl( Window* _pParent, WinBits _nStyle );
+ ~TableControl();
+
+ /// sets a new table model
+ void SetModel( PTableModel _pModel );
+ /// retrieves the current table model
+ PTableModel GetModel() const;
+
+ /** retrieves the current row
+
+ The current row is the one which contains the active cell.
+
+ @return
+ the row index of the active cell, or ->ROW_INVALID
+ if there is no active cell, e.g. because the table does
+ not contain any rows or columns.
+ */
+ sal_Int32 GetCurrentRow() const;
+
+ ITableControl&
+ getTableControlInterface();
+
+ /** retrieves the current column
+
+ The current col is the one which contains the active cell.
+
+ @return
+ the column index of the active cell, or ->COL_INVALID
+ if there is no active cell, e.g. because the table does
+ not contain any rows or columns.
+ */
+ sal_Int32 GetCurrentColumn() const;
+
+ /** activates the cell at the given position
+
+ @return
+ <sal_True/> if the move was successful, <FALSE/> otherwise. Usual
+ failure conditions include some other instance vetoing the move,
+ or impossibility to execute the move at all (for instance because
+ of invalid coordinates).
+ */
+ bool GoTo( ColPos _nColumnPos, RowPos _nRow);
+
+ /** moves the active cell to the given column, by keeping the active row
+
+ @return
+ <sal_True/> if the move was successful, <FALSE/> otherwise. Usual
+ failure conditions include some other instance vetoing the move,
+ or impossibility to execute the move at all (for instance because
+ of invalid coordinates).
+ */
+ inline bool GoToColumn( ColPos _nColumn )
+ {
+ return GoTo( _nColumn, GetCurrentRow() );
+ }
+
+ /** moves the active cell to the given row, by keeping the active column
+
+ @return
+ <sal_True/> if the move was successful, <FALSE/> otherwise. Usual
+ failure conditions include some other instance vetoing the move,
+ or impossibility to execute the move at all (for instance because
+ of invalid coordinates).
+ */
+ bool GoToRow( RowPos _nRow )
+ {
+ return GoTo( GetCurrentColumn(), _nRow );
+ }
+
+ SVT_DLLPRIVATE virtual void Resize();
+ virtual void Select();
+
+ /**after removing a row, updates the vector which contains the selected rows
+ if the row, which should be removed, is selected, it will be erased from the vector
+ */
+ SelectionEngine* getSelEngine();
+ Window& getDataWindow();
+
+ // Window overridables
+ virtual void GetFocus();
+ virtual void LoseFocus();
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void StateChanged( StateChangedType i_nStateChange );
+
+ /** Creates and returns the accessible object of the whole GridControl. */
+ SVT_DLLPRIVATE virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible();
+ SVT_DLLPRIVATE virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleControl( sal_Int32 _nIndex );
+ SVT_DLLPRIVATE virtual OUString GetAccessibleObjectName(AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const;
+ SVT_DLLPRIVATE virtual sal_Bool GoToCell( sal_Int32 _nColumnPos, sal_Int32 _nRow );
+ SVT_DLLPRIVATE virtual OUString GetAccessibleObjectDescription(AccessibleTableControlObjType eObjType, sal_Int32 _nPosition = -1) const;
+ SVT_DLLPRIVATE virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& rStateSet, AccessibleTableControlObjType eObjType ) const;
+
+ // temporary methods
+ // Those do not really belong into the public API - they're intended for firing A11Y-related events. However,
+ // firing those events should be an implementation internal to the TableControl resp. TableControl_Impl,
+ // instead of something triggered externally.
+ void commitCellEventIfAccessibleAlive( sal_Int16 const i_eventID, const css::uno::Any& i_newValue, const css::uno::Any& i_oldValue );
+ void commitTableEventIfAccessibleAlive( sal_Int16 const i_eventID, const css::uno::Any& i_newValue, const css::uno::Any& i_oldValue );
+
+ // .............................................................................................................
+ // IAccessibleTable
+ virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const;
+ virtual void GrabFocus();
+ virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible( sal_Bool bCreate = sal_True );
+ virtual Window* GetAccessibleParentWindow() const;
+ virtual Window* GetWindowInstance();
+ virtual sal_Int32 GetAccessibleControlCount() const;
+ virtual sal_Bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint );
+ virtual long GetRowCount() const;
+ virtual long GetColumnCount() const;
+ virtual sal_Bool HasRowHeader() const;
+ virtual sal_Bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint );
+ virtual Rectangle calcHeaderRect( sal_Bool _bIsColumnBar, sal_Bool _bOnScreen = sal_True );
+ virtual Rectangle calcHeaderCellRect( sal_Bool _bIsColumnBar, sal_Int32 nPos);
+ virtual Rectangle calcTableRect( sal_Bool _bOnScreen = sal_True );
+ virtual Rectangle calcCellRect( sal_Int32 _nRowPos, sal_Int32 _nColPos );
+ virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex);
+ virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint);
+ virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const;
+ virtual OUString GetRowDescription( sal_Int32 _nRow ) const;
+ virtual OUString GetRowName(sal_Int32 _nIndex) const;
+ virtual OUString GetColumnDescription( sal_uInt16 _nColumnPos ) const;
+ virtual OUString GetColumnName( sal_Int32 _nIndex ) const;
+ virtual css::uno::Any GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const;
+ virtual sal_Bool HasRowHeader();
+ virtual sal_Bool HasColHeader();
+ virtual OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) const;
+
+ virtual sal_Int32 GetSelectedRowCount() const;
+ virtual sal_Int32 GetSelectedRowIndex( sal_Int32 const i_selectionIndex ) const;
+ virtual bool IsRowSelected( sal_Int32 const i_rowIndex ) const;
+ virtual void SelectRow( sal_Int32 const i_rowIndex, bool const i_select );
+ virtual void SelectAllRows( bool const i_select );
+ // .............................................................................................................
+
+ private:
+ DECL_DLLPRIVATE_LINK( ImplSelectHdl, void* );
+
+ private:
+ TableControl(); // never implemented
+ TableControl( const TableControl& ); // never implemented
+ TableControl& operator=( const TableControl& ); // never implemented
+ };
+
+//........................................................................
+} } // namespace svt::table
+//........................................................................
+
+#endif // SVTOOLS_INC_TABLE_TABLECONTROL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/table/tablecontrolinterface.hxx b/include/svtools/table/tablecontrolinterface.hxx
new file mode 100644
index 000000000000..a95cc282985c
--- /dev/null
+++ b/include/svtools/table/tablecontrolinterface.hxx
@@ -0,0 +1,257 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVTOOLS_INC_TABLE_ABSTRACTTABLECONTROL_HXX
+#define SVTOOLS_INC_TABLE_ABSTRACTTABLECONTROL_HXX
+
+#include <sal/types.h>
+#include <vcl/event.hxx>
+#include <vcl/seleng.hxx>
+
+#include "svtools/table/tabletypes.hxx"
+#include "svtools/table/tablemodel.hxx"
+
+class Pointer;
+
+//......................................................................................................................
+namespace svt { namespace table
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= TableControlAction
+ //==================================================================================================================
+ enum TableControlAction
+ {
+ /// moves the cursor in the table control one row up, if possible, by keeping the current column
+ cursorUp,
+ /// moves the cursor in the table control one row down, if possible, by keeping the current column
+ cursorDown,
+ /// moves the cursor in the table control one column to the left, if possible, by keeping the current row
+ cursorLeft,
+ /// moves the cursor in the table control one column to the right, if possible, by keeping the current row
+ cursorRight,
+ /// moves the cursor to the beginning of the current line
+ cursorToLineStart,
+ /// moves the cursor to the end of the current line
+ cursorToLineEnd,
+ /// moves the cursor to the first row, keeping the current column
+ cursorToFirstLine,
+ /// moves the cursor to the last row, keeping the current column
+ cursorToLastLine,
+ /// moves the cursor one page up, keeping the current column
+ cursorPageUp,
+ /// moves the cursor one page down, keeping the current column
+ cursorPageDown,
+ /// moves the cursor to the top-most, left-most cell
+ cursorTopLeft,
+ /// moves the cursor to the bottom-most, right-most cell
+ cursorBottomRight,
+ /// selects the row, where the actual cursor is
+ cursorSelectRow,
+ /// selects the rows, above the actual cursor is
+ cursorSelectRowUp,
+ /// selects the row, beneath the actual cursor is
+ cursorSelectRowDown,
+ /// selects the row, from the actual cursor till top
+ cursorSelectRowAreaTop,
+ /// selects the row, from the actual cursor till bottom
+ cursorSelectRowAreaBottom,
+
+ /// invalid and final enumeration value, not to be actually used
+ invalidTableControlAction
+ };
+
+ //==================================================================================================================
+ //= TableCellArea
+ //==================================================================================================================
+ enum TableCellArea
+ {
+ CellContent,
+ ColumnDivider
+ };
+
+ //==================================================================================================================
+ //= TableCell
+ //==================================================================================================================
+ struct TableCell
+ {
+ ColPos nColumn;
+ RowPos nRow;
+ TableCellArea eArea;
+
+ TableCell()
+ :nColumn( COL_INVALID )
+ ,nRow( ROW_INVALID )
+ ,eArea( CellContent )
+ {
+ }
+
+ TableCell( ColPos const i_column, RowPos const i_row )
+ :nColumn( i_column )
+ ,nRow( i_row )
+ ,eArea( CellContent )
+ {
+ }
+ };
+
+ //==================================================================================================================
+ //= ColumnMetrics
+ //==================================================================================================================
+ struct ColumnMetrics
+ {
+ /** the start of the column, in pixels. Might be negative, in case the column is scrolled out of the visible
+ area. Note: see below.
+ */
+ long nStartPixel;
+
+ /** the end of the column, in pixels, plus 1. Effectively, this is the accumulated width of a all columns
+ up to the current one.
+
+ Huh? Earlier you said that the nStartPixel of columns
+ scrolled out (to the left) of the visible area is
+ negative. Also, where is the promise that there is no gap
+ between columns? The above claim would be true only if the
+ first column always started at zero, and there is never a
+ gap. So these doc comments are inconsistent. How
+ surprising.
+ */
+ long nEndPixel;
+
+ ColumnMetrics()
+ :nStartPixel(0)
+ ,nEndPixel(0)
+ {
+ }
+
+ ColumnMetrics( long const i_start, long const i_end )
+ :nStartPixel( i_start )
+ ,nEndPixel( i_end )
+ {
+ }
+ };
+
+ //==================================================================================================================
+ //= TableArea
+ //==================================================================================================================
+ enum TableArea
+ {
+ TableAreaColumnHeaders,
+ TableAreaRowHeaders,
+ TableAreaDataArea,
+ TableAreaAll
+ };
+
+ //==================================================================================================================
+ //= ITableControl
+ //==================================================================================================================
+ /** defines a callback interface to be implemented by a concrete table control
+ */
+ class SAL_NO_VTABLE ITableControl
+ {
+ public:
+ /** hides the cell cursor
+
+ The method cares for successive calls, that is, for every call to
+ ->hideCursor(), you need one call to ->showCursor. Only if the number
+ of both calls matches, the cursor is really shown.
+
+ @see showCursor
+ */
+ virtual void hideCursor() = 0;
+
+ /** shows the cell cursor
+
+ @see hideCursor
+ */
+ virtual void showCursor() = 0;
+
+ /** dispatches an action to the table control
+
+ @return
+ <TRUE/> if the action could be dispatched successfully, <FALSE/> otherwise. Usual
+ failure conditions include some other instance vetoing the action, or impossibility
+ to execute the action at all (for instance moving up one row when already positioned
+ on the very first row).
+
+ @see TableControlAction
+ */
+ virtual bool dispatchAction( TableControlAction _eAction ) = 0;
+
+ /** returns selection engine*/
+ virtual SelectionEngine* getSelEngine() = 0;
+
+ /** returns the table model
+
+ The returned model is guaranteed to not be <NULL/>.
+ */
+ virtual PTableModel getModel() const = 0;
+
+ /// returns the index of the currently active column
+ virtual ColPos getCurrentColumn() const = 0;
+
+ /// returns the index of the currently active row
+ virtual RowPos getCurrentRow() const = 0;
+
+ /// activates the given cell
+ virtual bool activateCell( ColPos const i_col, RowPos const i_row ) = 0;
+
+ /// retrieves the size of the table window, in pixels
+ virtual ::Size getTableSizePixel() const = 0;
+
+ /// sets a new mouse pointer for the table window
+ virtual void setPointer( Pointer const & i_pointer ) = 0;
+
+ /// captures the mouse to the table window
+ virtual void captureMouse() = 0;
+
+ /// releases the mouse, after it had previously been captured
+ virtual void releaseMouse() = 0;
+
+ /// invalidates the table window
+ virtual void invalidate( TableArea const i_what ) = 0;
+
+ /// calculates a width, given in pixels, into a AppFont-based width
+ virtual long pixelWidthToAppFont( long const i_pixels ) const = 0;
+
+ /// shows a trackign rectangle
+ virtual void showTracking( Rectangle const & i_location, sal_uInt16 const i_flags ) = 0;
+
+ /// hides a prviously shown tracking rectangle
+ virtual void hideTracking() = 0;
+
+ /// does a hit test for the given pixel coordinates
+ virtual TableCell hitTest( const Point& rPoint ) const = 0;
+
+ /// retrieves the metrics for a given column
+ virtual ColumnMetrics getColumnMetrics( ColPos const i_column ) const = 0;
+
+ /// determines whether a given row is selected
+ virtual bool isRowSelected( RowPos _nRow ) const = 0;
+
+ virtual ~ITableControl() {};
+ };
+
+//......................................................................................................................
+} } // namespace svt::table
+//......................................................................................................................
+
+#endif // SVTOOLS_INC_TABLE_ABSTRACTTABLECONTROL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/table/tableinputhandler.hxx b/include/svtools/table/tableinputhandler.hxx
new file mode 100644
index 000000000000..2158d573bb2d
--- /dev/null
+++ b/include/svtools/table/tableinputhandler.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVTOOLS_INC_TABLE_TABLEINPUTHANDLER_HXX
+#define SVTOOLS_INC_TABLE_TABLEINPUTHANDLER_HXX
+
+#include <boost/shared_ptr.hpp>
+
+class MouseEvent;
+class KeyEvent;
+class HelpEvent;
+class CommandEvent;
+class NotifyEvent;
+
+//........................................................................
+namespace svt { namespace table
+{
+//........................................................................
+
+ class ITableControl;
+
+ //====================================================================
+ //= ITableInputHandler
+ //====================================================================
+ /** interface for components handling input in a ->TableControl
+ */
+ class ITableInputHandler
+ {
+ public:
+ // all those methods have the same semantics as the equal-named methods of ->Window,
+ // with the additional option to return a boolean value indicating whether
+ // the event should be further processed by the ->Window implementations (<FALSE/>),
+ // or whether it has been sufficiently handled by the ->ITableInputHandler instance
+ // (<FALSE/>).
+
+ virtual bool MouseMove ( ITableControl& _rControl, const MouseEvent& rMEvt ) = 0;
+ virtual bool MouseButtonDown ( ITableControl& _rControl, const MouseEvent& rMEvt ) = 0;
+ virtual bool MouseButtonUp ( ITableControl& _rControl, const MouseEvent& rMEvt ) = 0;
+ virtual bool KeyInput ( ITableControl& _rControl, const KeyEvent& rKEvt ) = 0;
+ virtual bool GetFocus ( ITableControl& _rControl ) = 0;
+ virtual bool LoseFocus ( ITableControl& _rControl ) = 0;
+ virtual bool RequestHelp ( ITableControl& _rControl, const HelpEvent& rHEvt ) = 0;
+ virtual bool Command ( ITableControl& _rControl, const CommandEvent& rCEvt ) = 0;
+ virtual bool PreNotify ( ITableControl& _rControl, NotifyEvent& rNEvt ) = 0;
+ virtual bool Notify ( ITableControl& _rControl, NotifyEvent& rNEvt ) = 0;
+
+ virtual ~ITableInputHandler() { }
+ };
+ typedef ::boost::shared_ptr< ITableInputHandler > PTableInputHandler;
+
+//........................................................................
+} } // namespace svt::table
+//........................................................................
+
+#endif // SVTOOLS_INC_TABLE_TABLEINPUTHANDLER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/table/tablemodel.hxx b/include/svtools/table/tablemodel.hxx
new file mode 100644
index 000000000000..cae54efb0ef0
--- /dev/null
+++ b/include/svtools/table/tablemodel.hxx
@@ -0,0 +1,539 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVTOOLS_INC_TABLE_TABLEMODEL_HXX
+#define SVTOOLS_INC_TABLE_TABLEMODEL_HXX
+
+#include "svtools/svtdllapi.h"
+#include "svtools/table/tabletypes.hxx"
+#include "svtools/table/tablerenderer.hxx"
+#include "svtools/table/tableinputhandler.hxx"
+#include "svtools/table/tablesort.hxx"
+
+#include <com/sun/star/util/Color.hpp>
+#include <com/sun/star/style/VerticalAlignment.hpp>
+#include <com/sun/star/style/HorizontalAlignment.hpp>
+
+#include <rtl/ref.hxx>
+#include <sal/types.h>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/optional.hpp>
+#include <boost/enable_shared_from_this.hpp>
+
+//........................................................................
+namespace svt { namespace table
+{
+//........................................................................
+
+
+ //====================================================================
+ //= ScrollbarVisibility
+ //====================================================================
+ enum ScrollbarVisibility
+ {
+ /** enumeration value denoting that a scrollbar should never be visible, even
+ if needed normally
+ */
+ ScrollbarShowNever,
+ /** enumeration value denoting that a scrollbar should be visible when needed only
+ */
+ ScrollbarShowSmart,
+ /** enumeration value denoting that a scrollbar should always be visible, even
+ if not needed normally
+ */
+ ScrollbarShowAlways
+ };
+
+ //====================================================================
+ //= ITableModelListener
+ //====================================================================
+ typedef sal_Int32 ColumnAttributeGroup;
+ #define COL_ATTRS_NONE (0x00000000)
+ /// denotes column attributes related to the width of the column
+ #define COL_ATTRS_WIDTH (0x00000001)
+ /// denotes column attributes related to the appearance of the column, i.e. those relevant for rendering
+ #define COL_ATTRS_APPEARANCE (0x00000002)
+ /// denotes the entirety of column attributes
+ #define COL_ATTRS_ALL (0x7FFFFFFF)
+
+ //====================================================================
+ //= ITableModelListener
+ //====================================================================
+ /** declares an interface to be implemented by components interested in
+ changes in an ->ITableModel
+ */
+ class SAL_NO_VTABLE ITableModelListener : public ::boost::enable_shared_from_this< ITableModelListener >
+ {
+ public:
+ /** notifies the listener that one or more rows have been inserted into
+ the table
+
+ @param first
+ the index of the first newly inserted row
+ @param last
+ the index of the last newly inserted row. Must not be smaller
+ than ->first
+ */
+ virtual void rowsInserted( RowPos first, RowPos last ) = 0;
+
+ /** notifies the listener that one or more rows have been removed from
+ the table
+
+ @param first
+ the old index of the first removed row. If this is <code>-1</code>, then all
+ rows have been removed from the model.
+ @param last
+ the old index of the last removed row. Must not be smaller
+ than ->first
+ */
+ virtual void rowsRemoved( RowPos first, RowPos last ) = 0;
+
+ /** notifies the listener that one or more columns have been inserted into
+ the table
+
+ @param first
+ the index of the first newly inserted row
+ @param last
+ the index of the last newly inserted row. Must not be smaller
+ than ->first
+ */
+ virtual void columnInserted( ColPos const i_colIndex ) = 0;
+
+ /** notifies the listener that one or more columns have been removed from
+ the table
+
+ @param i_colIndex
+ the old index of the removed column
+ */
+ virtual void columnRemoved( ColPos const i_colIndex ) = 0;
+
+ /** notifies the listener that all columns have been removed form the model
+ */
+ virtual void allColumnsRemoved() = 0;
+
+ /** notifies the listener that a rectangular cell range in the table
+ has been updated
+
+ Listeners are required to discard any possibly cached information
+ they have about the cells in question, in particular any possibly
+ cached cell values.
+ */
+ virtual void cellsUpdated( ColPos const i_firstCol, ColPos i_lastCol, RowPos const i_firstRow, RowPos const i_lastRow ) = 0;
+
+ /** notifies the listener that attributes of a given column changed
+
+ @param i_column
+ the position of the column whose attributes changed
+ @param i_attributeGroup
+ a combination of one or more <code>COL_ATTRS_*</code> flags, denoting the attribute group(s)
+ in which changes occurred.
+ */
+ virtual void columnChanged( ColPos const i_column, ColumnAttributeGroup const i_attributeGroup ) = 0;
+
+ /** notifies the listener that the metrics of the table changed.
+
+ Metrics here include the column header height, the row header width, the row height, and the presence
+ of both the row and column header.
+ */
+ virtual void tableMetricsChanged() = 0;
+
+ /// deletes the listener instance
+ virtual ~ITableModelListener(){};
+ };
+ typedef ::boost::shared_ptr< ITableModelListener > PTableModelListener;
+
+ //====================================================================
+ //= IColumnModel
+ //====================================================================
+ /** interface to be implemented by table column models
+ */
+ class SAL_NO_VTABLE IColumnModel
+ {
+ public:
+ /** retrieves the ID of the column
+
+ The semantics of a column id is not defined. It's up to the
+ implementor of the ->IColumnModel, respectively the ->ITableModel
+ which provides the column models, to define such a semantics.
+
+ @return
+ the ID of the column. May be 0 if the table which the column
+ belongs to does not need and support column ids.
+
+ @see setID
+ */
+ virtual ::com::sun::star::uno::Any
+ getID() const = 0;
+
+ /** sets a new column ID
+
+ @return
+ <TRUE/> if setting the new ID was successful. A possible error
+ conditions is if you try to set an ID which is already used
+ by another column within the same table.
+
+ @see getID
+ */
+ virtual void setID( const ::com::sun::star::uno::Any& _nID ) = 0;
+
+ /** returns the name of the column
+
+ Column names should be human-readable, but not necessarily unique
+ within a given table.
+
+ @see setName
+ */
+ virtual String getName() const = 0;
+
+ /** sets a new name for the column
+
+ @see getName
+ */
+ virtual void setName( const String& _rName ) = 0;
+
+ /** retrieves the help text to be displayed for the column.
+ */
+ virtual String getHelpText() const = 0;
+
+ /** sets a new the help text to be displayed for the column.
+ */
+ virtual void setHelpText( const String& i_helpText ) = 0;
+
+ /** determines whether the column can be interactively resized
+
+ @see getMinWidth
+ @see getMaxWidth
+ @see getWidth
+ */
+ virtual bool isResizable() const = 0;
+
+ /** declares the column as resizable or fixed in width
+
+ @see getMinWidth
+ @see getMaxWidth
+ @see getWidth
+ */
+ virtual void setResizable( bool _bResizable ) = 0;
+
+ /** denotes the relative flexibility of the column
+
+ This flexibility is taken into account when a table control auto-resizes its columns, because the available
+ space changed. In this case, the columns grow or shrink according to their flexibility.
+
+ A value of 0 means the column is not auto-resized at all.
+ */
+ virtual sal_Int32 getFlexibility() const = 0;
+
+ /** sets a new flexibility value for the column
+
+ @see getFlexibility
+ */
+ virtual void setFlexibility( sal_Int32 const i_flexibility ) = 0;
+
+ /** returns the width of the column, in app-font unitss
+
+ The returned value must be a positive ->TableMetrics value.
+
+ @see setWidth
+ @see getMinWidth
+ @see getMaxWidth
+ */
+ virtual TableMetrics getWidth() const = 0;
+
+ /** sets a new width for the column
+
+ @param _nWidth
+ the new width, app-font units
+
+ @see getWidth
+ */
+ virtual void setWidth( TableMetrics _nWidth ) = 0;
+
+ /** returns the minimum width of the column, in app-font units, or 0 if the column
+ does not have a minimal width
+
+ @see setMinWidth
+ @see getMaxWidth
+ @see getWidth
+ */
+ virtual TableMetrics getMinWidth() const = 0;
+
+ /** sets the minimum width of the column, in app-font units
+
+ @see getMinWidth
+ @see setMaxWidth
+ @see setWidth
+ */
+ virtual void setMinWidth( TableMetrics _nMinWidth ) = 0;
+
+ /** returns the maximum width of the column, in app-font units, or 0 if the column
+ does not have a minimal width
+
+ @see setMaxWidth
+ @see getMinWidth
+ @see getWidth
+ */
+ virtual TableMetrics getMaxWidth() const = 0;
+
+ /** sets the maximum width of the column, in app-font units
+
+ @see getMaxWidth
+ @see setMinWidth
+ @see setWidth
+ */
+ virtual void setMaxWidth( TableMetrics _nMaxWidth ) = 0;
+
+ /** retrieves the horizontal alignment to be used for content in this cell
+ */
+ virtual ::com::sun::star::style::HorizontalAlignment getHorizontalAlign() = 0;
+
+ /** sets a new the horizontal alignment to be used for content in this cell
+ */
+ virtual void setHorizontalAlign(::com::sun::star::style::HorizontalAlignment _xAlign) = 0;
+
+ /// deletes the column model instance
+ virtual ~IColumnModel() { }
+ };
+ typedef ::boost::shared_ptr< IColumnModel > PColumnModel;
+
+ //====================================================================
+ //= ITableModel
+ //====================================================================
+ /** declares the interface to implement by an abtract table model
+ */
+ class SAL_NO_VTABLE SVT_DLLPUBLIC ITableModel
+ {
+ public:
+ /** returns the number of columns in the table
+ */
+ virtual TableSize getColumnCount() const = 0;
+
+ /** returns the number of rows in the table
+ */
+ virtual TableSize getRowCount() const = 0;
+
+ /** determines whether the table has column headers
+
+ If this method returns <TRUE/>, the renderer returned by
+ ->getRenderer must be able to render column headers.
+
+ @see IColumnRenderer
+ */
+ virtual bool hasColumnHeaders() const = 0;
+
+ /** determines whether the table has row headers
+
+ If this method returns <TRUE/>, the renderer returned by
+ ->getRenderer must be able to render row headers.
+
+ @see IColumnRenderer
+ */
+ virtual bool hasRowHeaders() const = 0;
+
+ /** determines whether the given cell is editable
+
+ @see ICellEditor
+ @todo
+ */
+ virtual bool isCellEditable( ColPos col, RowPos row ) const = 0;
+
+ /** returns a model for a certain column
+
+ @param column
+ the index of the column in question. Must be greater than or
+ equal 0, and smaller than the return value of ->getColumnCount()
+
+ @return
+ the model of the column in question. Must not be <NULL/>
+ */
+ virtual PColumnModel getColumnModel( ColPos column ) = 0;
+
+ /** returns a renderer which is able to paint the table represented
+ by this table model
+
+ @return the renderer to use. Must not be <NULL/>
+ */
+ virtual PTableRenderer getRenderer() const = 0;
+
+ /** returns the component handling input in a view associated with the model
+ */
+ virtual PTableInputHandler getInputHandler() const = 0;
+
+ /** determines the height of rows in the table.
+
+ @return
+ the logical height of rows in the table, in app-font units. The height must be
+ greater 0.
+ */
+ virtual TableMetrics getRowHeight() const = 0;
+
+ /** determines the height of the column header row
+
+ This method is not to be called if ->hasColumnHeaders()
+ returned <FALSE/>.
+
+ @return
+ the logical height of the column header row, in app-font units.
+ Must be greater than 0.
+ */
+ virtual TableMetrics getColumnHeaderHeight() const = 0;
+
+ /** determines the width of the row header column
+
+ This method is not to be called if ->hasRowHeaders()
+ returned <FALSE/>.
+
+ @return
+ the logical width of the row header column, in app-font units.
+ Must be greater than 0.
+ */
+ virtual TableMetrics getRowHeaderWidth() const = 0;
+
+ /** returns the visibilit mode of the vertical scrollbar
+ */
+ virtual ScrollbarVisibility getVerticalScrollbarVisibility() const = 0;
+
+ /** returns the visibilit mode of the horizontal scrollbar
+ */
+ virtual ScrollbarVisibility getHorizontalScrollbarVisibility() const = 0;
+
+ /** adds a listener to be notified of changes in the table model
+ */
+ virtual void addTableModelListener( const PTableModelListener& i_listener ) = 0;
+
+ /** remove a listener to be notified of changes in the table model
+ */
+ virtual void removeTableModelListener( const PTableModelListener& i_listener ) = 0;
+
+ /** retrieves the content of the given cell
+ */
+ virtual void getCellContent( ColPos const i_col, RowPos const i_row, ::com::sun::star::uno::Any& o_cellContent ) = 0;
+
+ /** returns an object which should be displayed as tooltip for the given cell
+
+ At the moment, only string-convertible values are supported here. In the future, one might imagine displaying
+ scaled-down versions of a graphic in a cell, and a larger version of that very graphic as tooltip.
+
+ If no tooltip object is provided, then the cell content is used, and displayed as tooltip for the cell
+ if and only if it doesn't fit into the cell's space itself.
+
+ @param i_col
+ The column index of the cell in question. COL_ROW_HEADERS is a valid argument here.
+ @param i_row
+ The row index of the cell in question.
+ @param o_cellToolTip
+ takes the tooltip object upon return.
+ */
+ virtual void getCellToolTip( ColPos const i_col, RowPos const i_row, ::com::sun::star::uno::Any & o_cellToolTip ) = 0;
+
+ /** retrieves title of a given row
+ */
+ virtual ::com::sun::star::uno::Any getRowHeading( RowPos const i_rowPos ) const = 0;
+
+ /** returns the color to be used for rendering the grid lines.
+
+ If this value is not set, a default color from the style settings will be used.
+ */
+ virtual ::boost::optional< ::Color > getLineColor() const = 0;
+
+ /** returns the color to be used for rendering the header background.
+
+ If this value is not set, a default color from the style settings will be used.
+ */
+ virtual ::boost::optional< ::Color > getHeaderBackgroundColor() const = 0;
+
+ /** returns the color to be used for rendering the header text.
+
+ If this value is not set, a default color from the style settings will be used.
+ */
+ virtual ::boost::optional< ::Color > getHeaderTextColor() const = 0;
+
+ /** returns the color to be used for the background of selected cells, when the control has the focus
+
+ If this value is not set, a default color from the style settings will be used.
+ */
+ virtual ::boost::optional< ::Color > getActiveSelectionBackColor() const = 0;
+
+ /** returns the color to be used for the background of selected cells, when the control does not have the focus
+
+ If this value is not set, a default color from the style settings will be used.
+ */
+ virtual ::boost::optional< ::Color > getInactiveSelectionBackColor() const = 0;
+
+ /** returns the color to be used for the text of selected cells, when the control has the focus
+
+ If this value is not set, a default color from the style settings will be used.
+ */
+ virtual ::boost::optional< ::Color > getActiveSelectionTextColor() const = 0;
+
+ /** returns the color to be used for the text of selected cells, when the control does not have the focus
+
+ If this value is not set, a default color from the style settings will be used.
+ */
+ virtual ::boost::optional< ::Color > getInactiveSelectionTextColor() const = 0;
+
+ /** returns the color to be used for rendering cell texts.
+
+ If this value is not set, a default color from the style settings will be used.
+ */
+ virtual ::boost::optional< ::Color > getTextColor() const = 0;
+
+ /** returns the color to be used for text lines (underline, strikethrough) when rendering cell text.
+
+ If this value is not set, a default color from the style settings will be used.
+ */
+ virtual ::boost::optional< ::Color > getTextLineColor() const = 0;
+
+ /** returns the colors to be used for the row backgrounds.
+
+ If this value is not set, every second row will have a background color derived from the style settings's
+ selection color, the other rows will not have a special background at all.
+
+ If this value is an empty sequence, the rows will not have a special background at all, instead the
+ normal background of the complete control will be used.
+
+ If value is a non-empty sequence, then rows will have the background colors as specified in the sequence,
+ in alternating order.
+ */
+ virtual ::boost::optional< ::std::vector< ::Color > >
+ getRowBackgroundColors() const = 0;
+
+ /** determines the vertical alignment of content within a cell
+ */
+ virtual ::com::sun::star::style::VerticalAlignment getVerticalAlign() const = 0;
+
+ /** returns an adapter to the sorting functionality of the model
+
+ It is legitimate to return <NULL/> here, in this case, the table model does not support sorting.
+ */
+ virtual ITableDataSort* getSortAdapter() = 0;
+
+ /// destroys the table model instance
+ virtual ~ITableModel() { }
+ };
+ typedef ::boost::shared_ptr< ITableModel > PTableModel;
+
+//........................................................................
+} } // namespace svt::table
+//........................................................................
+
+#endif // SVTOOLS_INC_TABLE_TABLEMODEL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/table/tablerenderer.hxx b/include/svtools/table/tablerenderer.hxx
new file mode 100644
index 000000000000..05ee87571c4c
--- /dev/null
+++ b/include/svtools/table/tablerenderer.hxx
@@ -0,0 +1,285 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVTOOLS_INC_TABLE_TABLERENDERER_HXX
+#define SVTOOLS_INC_TABLE_TABLERENDERER_HXX
+
+#include <svtools/table/tabletypes.hxx>
+
+#include <vcl/outdev.hxx>
+
+#include <boost/shared_ptr.hpp>
+
+//........................................................................
+namespace svt { namespace table
+{
+//........................................................................
+
+ //====================================================================
+ //= ITableRenderer
+ //====================================================================
+ /** interface to implement by components rendering a ->TableControl
+ */
+ class SAL_NO_VTABLE ITableRenderer
+ {
+ public:
+
+ /** paints a (part of) header area
+
+ There are two header areas in a table control:
+ <ul><li>The row containing all column headers, i.e. <em>above</em> all rows containing the data</li>
+ <li>The column containing all row headers. i.e. <em>left of</em> all columns containing the data</li>
+ </ul>
+
+ A header area is more than the union of the single column/row headers.
+
+ First, there might be less columns than fit into the view - in this case, right
+ beside the right-most column, there's still room which belongs to the column header
+ area, but is not occupied by any particular column header.<br/>
+ An equivalent statement holds for the row header area, if there are less rows than
+ fit into the view.
+
+ Second, if the table control has both a row header and a column header,
+ the intersection between those both belongs to both the column header area and the
+ row header area, but not to any particular column or row header.
+
+ There are two flags specifying whether the to-be-painted area is part of the column
+ and/or row header area.
+ <ul><li>If both are <TRUE/>, the intersection of both areas is to be painted.</li>
+ <li>If ->_bIsColHeaderArea is <TRUE/> and ->_bIsRowHeaderArea is <FALSE/>,
+ then ->_rArea denotes the column header area <em>excluding</em> the
+ intersection between row and column header area.</li>
+ <li>Equivalently for ->_bIsColHeaderArea being <FALSE/> and ->_bIsRowHeaderArea
+ being <TRUE/></li>
+ </ul>
+ Note that it's not possible for both ->_bIsColHeaderArea and ->_bIsRowHeaderArea
+ to be <FALSE/> at the same time.
+
+ @param _rDevice
+ the device to paint onto
+ @param _rArea
+ the area to paint into
+ @param _bIsColHeaderArea
+ <TRUE/> if and only if ->_rArea is part of the column header area.
+ @param _bIsRowHeaderArea
+ <TRUE/> if and only if ->_rArea is part of the row header area.
+ @param _rStyle
+ the style to be used for drawing
+ */
+ virtual void PaintHeaderArea(
+ OutputDevice& _rDevice, const Rectangle& _rArea,
+ bool _bIsColHeaderArea, bool _bIsRowHeaderArea,
+ const StyleSettings& _rStyle ) = 0;
+
+ /** paints the header for a given column
+
+ @param _nCol
+ the index of the column to paint
+ @param _bActive
+ <TRUE/> if and only if the column whose column is to be painted
+ contains the active cell.
+ @param _bSelected
+ <TRUE/> if and only if the column whose column is to be painted
+ is selected currently.
+ @param _rDevice
+ denotes the device to paint onto
+ @param _rArea
+ the are into which the column header should be painted
+ @param _rStyle
+ the style to be used for drawing
+ */
+ virtual void PaintColumnHeader( ColPos _nCol, bool _bActive, bool _bSelected,
+ OutputDevice& _rDevice, const Rectangle& _rArea,
+ const StyleSettings& _rStyle ) = 0;
+
+ /** prepares a row for painting
+
+ Painting a table means painting rows as necessary, in an increasing
+ order. The assumption is that retrieving data for two different rows
+ is (potentially) more expensive than retrieving data for two different
+ columns. Thus, the renderer will get the chance to "seek" to a certain
+ row, and then has to render all cells in this row, before another
+ row is going to be painted.
+
+ @param _nRow
+ the row which is going to be painted. The renderer should
+ at least remember this row, since subsequent calls to
+ ->PaintRowHeader(), ->PaintCell(), and ->FinishRow() will
+ not pass this parameter again.
+
+ However, the renderer is also allowed to render any
+ cell-independent content of this row.
+
+ @param i_hasControlFocus
+ <TRUE/> if and only if the table control currently has the focus
+ @param _bSelected
+ <TRUE/> if and only if the row to be prepared is
+ selected currently.
+ @param _rDevice
+ denotes the device to paint onto
+ @param _rRowArea
+ the are into which the row should be painted. This excludes
+ the row header area, if applicable.
+ @param _rStyle
+ the style to be used for drawing
+ */
+ virtual void PrepareRow( RowPos _nRow, bool i_hasControlFocus, bool _bSelected,
+ OutputDevice& _rDevice, const Rectangle& _rRowArea,
+ const StyleSettings& _rStyle ) = 0;
+
+ /** paints the header of a row
+
+ The row to be painted is denoted by the most recent call to
+ ->PrepareRow.
+
+ @param i_hasControlFocus
+ <TRUE/> if and only if the table control currently has the focus
+ <br/>
+ Note that this flag is equal to the respective flag in the
+ previous ->PrepareRow call, it's passed here for convinience
+ only.
+ @param _bSelected
+ <TRUE/> if and only if the row whose header cell is to be
+ painted is selected currently.
+ <br/>
+ Note that this flag is equal to the respective flag in the
+ previous ->PrepareRow call, it's passed here for convinience
+ only.
+ @param _rDevice
+ denotes the device to paint onto
+ @param _rArea
+ the are into which the row header should be painted
+ @param _rStyle
+ the style to be used for drawing
+ */
+ virtual void PaintRowHeader( bool i_hasControlFocus, bool _bSelected,
+ OutputDevice& _rDevice, Rectangle const & _rArea,
+ StyleSettings const & _rStyle ) = 0;
+
+ /** paints a certain cell
+
+ The row to be painted is denoted by the most recent call to
+ ->PrepareRow.
+
+ @param _bSelected
+ <TRUE/> if and only if the cell to be painted is
+ selected currently. This is the case if either
+ the row or the column of the cell is currently selected.
+ <br/>
+ Note that this flag is equal to the respective flag in the
+ previous ->PrepareRow call, it's passed here for convinience
+ only.
+ @param i_hasControlFocus
+ <TRUE/> if and only if the table control currently has the focus
+ <br/>
+ Note that this flag is equal to the respective flag in the
+ previous ->PrepareRow call, it's passed here for convinience
+ only.
+ @param _rDevice
+ denotes the device to paint onto
+ @param _rArea
+ the are into which the cell should be painted
+ @param _rStyle
+ the style to be used for drawing
+ */
+ virtual void PaintCell( ColPos const i_col,
+ bool i_hasControlFocus, bool _bSelected,
+ OutputDevice& _rDevice, const Rectangle& _rArea,
+ const StyleSettings& _rStyle ) = 0;
+
+ /** draws a cell cursor in the given rectangle
+
+ The cell cursor is used to indicate the active/current cell
+ of a table control.
+ */
+ virtual void ShowCellCursor( Window& _rView, const Rectangle& _rCursorRect) = 0;
+
+ /** hides the cell cursor previously drawn into the given rectangle
+
+ The cell cursor is used to indicate the active/current cell
+ of a table control.
+ */
+ virtual void HideCellCursor( Window& _rView, const Rectangle& _rCursorRect) = 0;
+
+ /** checks whether a given cell content fits into a given target area on a given device.
+
+ @param i_colPos
+ denotes the column which the cell content would be painted into. Your renderer implementation
+ would only need this parameter if rendering is done differently for different columns.
+
+ @param i_rowPos
+ denotes the row which the cell content would be painted into. Your renderer implementation
+ would only need this parameter if rendering is done differently for different rows.
+
+ @param i_active
+ is <TRUE/> if and only if the renderer should assume the cell content would be painted for the active
+ cell.
+
+ @param i_selected
+ is <TRUE/> if and only if the renderer should assume the cell content would be painted for a selected
+ cell.
+
+ @param i_targetDevice
+ denotes the target device for the assumed rendering operation
+
+ @param i_targetArea
+ denotes the area within the target device for the assumed rendering operation.
+
+ @return
+ <TRUE/> if and only if the given cell content could be rendered into the given device and the
+ given area.
+ */
+ virtual bool FitsIntoCell(
+ ::com::sun::star::uno::Any const & i_cellContent,
+ ColPos const i_colPos, RowPos const i_rowPos,
+ bool const i_active, bool const i_selected,
+ OutputDevice& i_targetDevice, Rectangle const & i_targetArea
+ ) const = 0;
+
+ /** attempts to format the content of the given cell as string
+
+ @param i_cellValue
+ the value for which an attempt for a string conversion should be made
+ @param i_colPos
+ the column position of the cell in question
+ @param i_rowPos
+ the row position of the cell in question
+ @param o_cellString
+ the cell content, formatted as string
+ @return
+ <TRUE/> if and only if the content could be formatted as string
+ */
+ virtual bool GetFormattedCellString(
+ ::com::sun::star::uno::Any const & i_cellValue,
+ ColPos const i_colPos, RowPos const i_rowPos,
+ OUString & o_cellString
+ ) const = 0;
+
+ /// deletes the renderer instance
+ virtual ~ITableRenderer() { }
+ };
+ typedef ::boost::shared_ptr< ITableRenderer > PTableRenderer;
+
+//........................................................................
+} } // namespace svt::table
+//........................................................................
+
+#endif // SVTOOLS_INC_TABLE_TABLERENDERER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/table/tablesort.hxx b/include/svtools/table/tablesort.hxx
new file mode 100644
index 000000000000..072e088cb3ee
--- /dev/null
+++ b/include/svtools/table/tablesort.hxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVTOOLS_TABLESORT_HXX
+#define SVTOOLS_TABLESORT_HXX
+
+#include "svtools/table/tabletypes.hxx"
+
+//......................................................................................................................
+namespace svt { namespace table
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= ColumnSortDirection
+ //==================================================================================================================
+ enum ColumnSortDirection
+ {
+ ColumnSortAscending,
+ ColumnSortDescending
+ };
+
+ //==================================================================================================================
+ //= ColumnSort
+ //==================================================================================================================
+ struct ColumnSort
+ {
+ ColPos nColumnPos;
+ ColumnSortDirection eSortDirection;
+
+ ColumnSort()
+ :nColumnPos( COL_INVALID )
+ ,eSortDirection( ColumnSortAscending )
+ {
+ }
+
+ ColumnSort( ColPos const i_columnPos, ColumnSortDirection const i_sortDirection )
+ :nColumnPos( i_columnPos )
+ ,eSortDirection( i_sortDirection )
+ {
+ }
+ };
+
+ //==================================================================================================================
+ //= ITableDataSort
+ //==================================================================================================================
+ /** provides sorting functionality for the datta underlying an ITableModel
+ */
+ class SAL_NO_VTABLE ITableDataSort
+ {
+ public:
+ /** sorts the rows in the model by the given column's data, in the given direction.
+ */
+ virtual void sortByColumn( ColPos const i_column, ColumnSortDirection const i_sortDirection ) = 0;
+
+ /** retrieves the current sort order of the data
+
+ If the <code>nColumnIndex</code> member of the returned srtructure is <code>COL_INVALID</code>, then
+ the data is currently not sorted.
+ */
+ virtual ColumnSort getCurrentSortOrder() const = 0;
+
+ protected:
+ ~ITableDataSort() {}
+ };
+
+//......................................................................................................................
+} } // namespace svt::table
+//......................................................................................................................
+
+#endif // SVTOOLS_TABLESORT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/table/tabletypes.hxx b/include/svtools/table/tabletypes.hxx
new file mode 100644
index 000000000000..f0333a9a49d7
--- /dev/null
+++ b/include/svtools/table/tabletypes.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVTOOLS_INC_TABLE_TABLETYPES_HXX
+#define SVTOOLS_INC_TABLE_TABLETYPES_HXX
+
+#include <sal/types.h>
+
+//........................................................................
+namespace svt { namespace table
+{
+//........................................................................
+ /// a value denoting the size of a table
+ typedef sal_Int32 TableSize;
+
+ /// a value denoting a column position within a table
+ typedef sal_Int32 ColPos;
+ /// a value denoting a row position within a table
+ typedef sal_Int32 RowPos;
+
+ /** a value denoting an arbitrary coordinate value of a position within
+ a table
+
+ Values of this type are guaranteed to be large enough to hold column
+ positions as well as row positions.
+ */
+ typedef sal_Int32 AnyPos;
+
+ typedef sal_Int32 TableMetrics;
+
+/// denotes the column containing the row headers
+#define COL_ROW_HEADERS ((::svt::table::ColPos)-1)
+/// denotes the row containing the column headers
+#define ROW_COL_HEADERS ((::svt::table::RowPos)-1)
+
+/// denotes an invalid column index
+#define COL_INVALID ((::svt::table::ColPos)-2)
+/// denotes an invalid row index
+#define ROW_INVALID ((::svt::table::RowPos)-2)
+
+
+//........................................................................
+} } // namespace svt::table
+//........................................................................
+
+#endif // SVTOOLS_INC_TABLE_TABLETYPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/templatefoldercache.hxx b/include/svtools/templatefoldercache.hxx
new file mode 100644
index 000000000000..9000c3e8d7db
--- /dev/null
+++ b/include/svtools/templatefoldercache.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SFX2_TEMPLATEFOLDERCACHE_HXX
+#define SFX2_TEMPLATEFOLDERCACHE_HXX
+
+#include "svtools/svtdllapi.h"
+#include <sal/types.h>
+
+//.........................................................................
+namespace svt
+{
+//.........................................................................
+
+ //=====================================================================
+ //= TemplateFolderCache
+ //=====================================================================
+ class TemplateFolderCacheImpl;
+ /** allows to cache the state of the template directories of OOo
+ <p>Usually, this class is used together with an instance of a the
+ <service scope="com.sun.star.frame">DocumentTemplates</service> service. It allows to scan the template folders
+ of the Office, and updates the configuration so that it reflects the most recent state of the folders.<br/>
+ As this is an expensive, the TemplateFolderCache has been introduced. It caches the state of the template
+ folders, and allows to determine if the DocumentTemplates service needs to be invoked to do the (much more expensive)
+ update.</p>
+ @example C++
+ <listing>
+ TemplateFolderCache aTemplateFolders;
+ if ( aTemplateFolders.needsUpdate() )
+ {
+ // store the current state
+ aCache.storeState();
+
+ // create the DocumentTemplates instance
+ Reference< XDocumentTemplates > xTemplates = ...;
+
+ // update the templates configuration
+ xTemplates->update();
+ }
+
+ // do anything which relies on a up-to-date template configuration
+ </listing>
+ */
+ class SVT_DLLPUBLIC TemplateFolderCache
+ {
+ private:
+ TemplateFolderCacheImpl* m_pImpl;
+
+ public:
+ /** ctor.
+ @param _bAutoStoreState
+ Set this to <TRUE/> if you want the instance to automatically store the state of the template folders upon
+ destruction.<br/>
+ If set to <FALSE/>, you would epplicitly need to call <method>storeState</method> to do this.<br/>
+ If the current state is not known (e.g. because you did not call needsUpdate, which retrieves it),
+ it is not retrieved in the dtor, regardless of the <arg>_bAutoStoreState</arg> flag.
+ */
+ TemplateFolderCache( sal_Bool _bAutoStoreState = sal_False );
+ ~TemplateFolderCache( );
+
+ /** determines whether or not the template configuration needs to be updated
+ @param _bForceCheck
+ set this to <TRUE/> if you want the object to rescan the template folders in every case. The default (<FALSE/>)
+ means that once the information has been retrieved in a first call, every second call returns the same result
+ as the first one, even if in the meantime the template folders changed.
+ @return
+ <TRUE/> if the template configuration needs to be updated
+ */
+ sal_Bool needsUpdate( sal_Bool _bForceCheck = sal_False );
+
+ /** stores the current state of the template folders in the cache
+ @param _bForceRetrieval
+ if set to <TRUE/>, the current state of the template folders is retrieved again, even if it is already known.
+ Usually, you set this to <FALSE/>: After calling <method>needsUpdate</method>, the state is know and does not
+ need to be read again.
+ */
+ void storeState( sal_Bool _bForceRetrieval = sal_False );
+ };
+
+//.........................................................................
+} // namespace svt
+//.........................................................................
+
+#endif // SFX2_TEMPLATEFOLDERCACHE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/templdlg.hxx b/include/svtools/templdlg.hxx
new file mode 100644
index 000000000000..d8eeaa884845
--- /dev/null
+++ b/include/svtools/templdlg.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVTOOLS_TEMPLDLG_HXX
+#define _SVTOOLS_TEMPLDLG_HXX
+
+#include "svtools/svtdllapi.h"
+
+#include <vcl/button.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/fixedhyper.hxx>
+
+struct SvtTmplDlg_Impl;
+
+// class SvtDocumentTemplateDialog ---------------------------------------
+
+class SvtTemplateWindow;
+
+class SVT_DLLPUBLIC SvtDocumentTemplateDialog : public ModalDialog
+{
+private:
+ FixedHyperlink aMoreTemplatesLink;
+ FixedLine aLine;
+ PushButton aManageBtn;
+ PushButton aPackageBtn;
+ PushButton aEditBtn;
+ OKButton aOKBtn;
+ CancelButton aCancelBtn;
+ HelpButton aHelpBtn;
+
+ SvtTmplDlg_Impl* pImpl;
+
+ DECL_DLLPRIVATE_LINK( SelectHdl_Impl, void* );
+ DECL_DLLPRIVATE_LINK( DoubleClickHdl_Impl, void* );
+ DECL_DLLPRIVATE_LINK( NewFolderHdl_Impl, void* );
+ DECL_DLLPRIVATE_LINK( SendFocusHdl_Impl, void* );
+ DECL_DLLPRIVATE_LINK( OKHdl_Impl, PushButton* );
+ DECL_DLLPRIVATE_LINK( OrganizerHdl_Impl, void* );
+ DECL_DLLPRIVATE_LINK( PackageHdl_Impl, void* );
+ DECL_DLLPRIVATE_LINK( UpdateHdl_Impl, Timer* );
+ DECL_DLLPRIVATE_LINK( OpenLinkHdl_Impl, void* );
+
+public:
+ SvtDocumentTemplateDialog( Window* pParent );
+
+ /** ctor for calling the dialog for <em>selection</em> only, not for <em>opening</em> a document
+ <p>If you use this ctor, the dialog will behave differently in the following areas:
+ <ul><li>The <em>Edit</em> button will be hidden.</li>
+ <li>Upon pressing em>Open</em>, the selected file will not be opened. Instead, it's
+ URL is available (see <method>GetSelectedFileURL</method>).</li>
+ </ul>
+
+ */
+ ~SvtDocumentTemplateDialog();
+
+ void SelectTemplateFolder();
+
+private:
+ SVT_DLLPRIVATE void InitImpl( );
+ SVT_DLLPRIVATE sal_Bool CanEnableEditBtn() const;
+};
+
+#endif // _SVTOOLS_TEMPLDLG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/textwindowpeer.hxx b/include/svtools/textwindowpeer.hxx
new file mode 100644
index 000000000000..21de95eaa89c
--- /dev/null
+++ b/include/svtools/textwindowpeer.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVTOOLS_TEXTWINDOWPEER_HXX
+#define INCLUDED_SVTOOLS_TEXTWINDOWPEER_HXX
+
+#include "svtools/svtdllapi.h"
+#include <toolkit/awt/vclxwindow.hxx>
+
+#include <memory>
+
+class TextEngine;
+class TextView;
+
+namespace svt
+{
+ class AccessibleFactoryAccess ;
+
+class TextWindowPeer: public ::VCLXWindow
+{
+public:
+ SVT_DLLPUBLIC TextWindowPeer(::TextView & rView, bool bCompoundControlChild = false);
+
+ virtual ~TextWindowPeer();
+
+private:
+ // VCLXWindow inherits funny copy constructor and assignment operator from
+ // ::cppu::OWeakObject, so override them here:
+
+ TextWindowPeer(TextWindowPeer &); // not implemented
+
+ void operator =(TextWindowPeer); // not implemented
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleContext >
+ CreateAccessibleContext();
+
+ ::TextEngine & m_rEngine;
+ ::TextView & m_rView;
+ bool m_bCompoundControlChild;
+
+ ::std::auto_ptr< ::svt::AccessibleFactoryAccess > m_pFactoryAccess;
+};
+
+}
+
+#endif // INCLUDED_SVTOOLS_TEXTWINDOWPEER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/toolbarmenu.hxx b/include/svtools/toolbarmenu.hxx
new file mode 100644
index 000000000000..247483440947
--- /dev/null
+++ b/include/svtools/toolbarmenu.hxx
@@ -0,0 +1,140 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVTOOLS_TOOLBARMENU_HXX_
+#define _SVTOOLS_TOOLBARMENU_HXX_
+
+#include "svtools/svtdllapi.h"
+
+#include <com/sun/star/frame/FeatureStateEvent.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+
+#include <vector>
+
+#include <rtl/ref.hxx>
+
+#include <vcl/ctrl.hxx>
+#include <vcl/menu.hxx>
+#include <vcl/dockwin.hxx>
+
+class ValueSet;
+
+namespace svtools {
+
+class ToolbarMenuEntry;
+struct ToolbarMenu_Impl;
+
+class SVT_DLLPUBLIC ToolbarMenu : public DockingWindow
+{
+ friend class ToolbarMenuStatusListener;
+ friend struct ToolbarMenu_Impl;
+public:
+ ToolbarMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ Window* pParentWindow,
+ WinBits nBits );
+
+ ToolbarMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ Window* pParentWindow,
+ const ResId& rResId );
+
+ ~ToolbarMenu();
+
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void KeyInput( const KeyEvent& rKEvent );
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual void Paint( const Rectangle& rRect );
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+ virtual void GetFocus();
+ virtual void LoseFocus();
+
+ void appendEntry( int nEntryId, const String& rStr, MenuItemBits nItemBits = 0 );
+ void appendEntry( int nEntryId, const String& rStr, const Image& rImage, MenuItemBits nItemBits = 0 );
+ void appendEntry( int nEntryId, Control* pControl, MenuItemBits nItemBits = 0 );
+ void appendSeparator();
+
+ /** creates an empty ValueSet that is initialized and can be inserted with appendEntry. */
+ ValueSet* createEmptyValueSetControl();
+
+ void checkEntry( int nEntryId, bool bCheck = true );
+
+ void enableEntry( int nEntryId, bool bEnable = true );
+
+ void setEntryText( int nEntryId, const String& rStr );
+
+ void setEntryImage( int nEntryId, const Image& rImage );
+
+ const Size& getMenuSize() const;
+
+ void SetSelectHdl( const Link& rLink );
+
+ int getSelectedEntryId() const;
+ int getHighlightedEntryId() const;
+
+ void highlightFirstEntry();
+
+protected:
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
+
+ // todo: move to new base class that will replace SfxPopupWindow
+ void AddStatusListener( const OUString& rCommandURL );
+
+ bool IsInPopupMode();
+ void EndPopupMode();
+
+ // XStatusListener (subclasses must override this one to get the status updates
+ virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
+
+ void StateChanged( StateChangedType nType );
+ void DataChanged( const DataChangedEvent& rDCEvt );
+
+private:
+ DECL_LINK( HighlightHdl, Control * );
+
+ void initStatusListener();
+
+ void implInit( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
+ void initWindow();
+
+ Size implCalcSize();
+
+ void appendEntry( ToolbarMenuEntry* pEntry );
+
+ void implPaint( ToolbarMenuEntry* pThisOnly = NULL, bool bHighlight = false );
+
+ void implHighlightEntry( int nHighlightEntry, bool bHighlight );
+ void implHighlightEntry( const MouseEvent& rMEvt, bool bMBDown );
+
+ void implChangeHighlightEntry( int nEntry );
+ void implSelectEntry( int nSelectedEntry );
+
+ ToolbarMenuEntry* implCursorUpDown( bool bUp, bool bHomeEnd );
+ ToolbarMenuEntry* implGetEntry( int nEntry ) const;
+ ToolbarMenuEntry* implSearchEntry( int nEntryId ) const;
+
+ ToolbarMenu_Impl* mpImpl;
+};
+
+} // namespace svtools
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/toolboxcontroller.hxx b/include/svtools/toolboxcontroller.hxx
new file mode 100644
index 000000000000..6bccf935be9c
--- /dev/null
+++ b/include/svtools/toolboxcontroller.hxx
@@ -0,0 +1,162 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVTOOLS_TOOLBOXCONTROLLER_HXX
+#define _SVTOOLS_TOOLBOXCONTROLLER_HXX
+
+#include "svtools/svtdllapi.h"
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XStatusListener.hpp>
+#include <com/sun/star/frame/XToolbarController.hpp>
+#include <com/sun/star/frame/XLayoutManager.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/util/XUpdatable.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <comphelper/proparrhlp.hxx>
+#include <comphelper/property.hxx>
+#include <comphelper/propertycontainer.hxx>
+#include <cppuhelper/propshlp.hxx>
+
+#include <boost/unordered_map.hpp>
+
+class ToolBox;
+
+namespace svt
+{
+struct ToolboxController_Impl;
+
+class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusListener,
+ public ::com::sun::star::frame::XToolbarController,
+ public ::com::sun::star::lang::XInitialization,
+ public ::com::sun::star::util::XUpdatable,
+ public ::com::sun::star::lang::XComponent,
+ public ::comphelper::OMutexAndBroadcastHelper,//shizhoubo
+ public ::comphelper::OPropertyContainer,//shizhoubo
+ public ::comphelper::OPropertyArrayUsageHelper< ToolboxController >,//shizhoubo
+ public ::cppu::OWeakObject
+{
+ private:
+ sal_Bool m_bSupportVisible; //shizhoubo
+ public:
+ ToolboxController( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame,
+ const OUString& aCommandURL );
+ ToolboxController();
+ virtual ~ToolboxController();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > getFrameInterface() const;
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& getContext() const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager > getLayoutManager() const;
+
+ void updateStatus( const OUString aCommandURL );
+ void updateStatus();
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw ();
+ virtual void SAL_CALL release() throw ();
+
+ // 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);
+
+ // XUpdatable
+ virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ using cppu::OPropertySetHelper::disposing;
+ virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) = 0;
+
+ // XToolbarController
+ virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& Parent ) throw (::com::sun::star::uno::RuntimeException);
+ // OPropertySetHelper //shizhoubo
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const com::sun::star::uno::Any& rValue ) throw(com::sun::star::uno::Exception);
+ virtual sal_Bool SAL_CALL convertFastPropertyValue( com::sun::star::uno::Any& rConvertedValue, com::sun::star::uno::Any& rOldValue, sal_Int32 nHandle, const com::sun::star::uno::Any& rValue) throw(com::sun::star::lang::IllegalArgumentException);
+ // XPropertySet //shizhoubo
+ virtual ::com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+ // OPropertyArrayUsageHelper //shizhoubo
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
+
+
+ const OUString& getCommandURL() const { return m_aCommandURL; }
+ const OUString& getModuleName() const;
+
+ void dispatchCommand( const OUString& sCommandURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs );
+
+ void enable( bool bEnable );
+
+ protected:
+ bool getToolboxId( sal_uInt16& rItemId, ToolBox** ppToolBox );
+ void setSupportVisibleProperty(sal_Bool bValue); //shizhoubo
+ struct Listener
+ {
+ Listener( const ::com::sun::star::util::URL& rURL, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& rDispatch ) :
+ aURL( rURL ), xDispatch( rDispatch ) {}
+
+ ::com::sun::star::util::URL aURL;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch;
+ };
+
+ typedef ::boost::unordered_map< OUString,
+ com::sun::star::uno::Reference< com::sun::star::frame::XDispatch >,
+ OUStringHash,
+ ::std::equal_to< OUString > > URLToDispatchMap;
+
+ // methods to support status forwarder, known by the old sfx2 toolbox controller implementation
+ void addStatusListener( const OUString& aCommandURL );
+ void removeStatusListener( const OUString& aCommandURL );
+ void bindListener();
+ void unbindListener();
+ sal_Bool isBound() const;
+ sal_Bool hasBigImages() const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > getURLTransformer() const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > getParent() const;
+
+ sal_Bool m_bInitialized : 1,
+ m_bDisposed : 1;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
+ ToolboxController_Impl* m_pImpl;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+ OUString m_aCommandURL;
+ URLToDispatchMap m_aListenerMap;
+ ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener
+};
+
+}
+
+#endif // _SVTOOLS_TOOLBOXCONTROLLER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/toolpanel/decklayouter.hxx b/include/svtools/toolpanel/decklayouter.hxx
new file mode 100644
index 000000000000..08022018ed38
--- /dev/null
+++ b/include/svtools/toolpanel/decklayouter.hxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVT_DECKLAYOUTER_HXX
+#define SVT_DECKLAYOUTER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <rtl/ref.hxx>
+
+#include <boost/optional.hpp>
+
+namespace com { namespace sun { namespace star { namespace accessibility {
+ class XAccessible;
+} } } }
+class Rectangle;
+class Point;
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ //====================================================================
+ //= IDeckLayouter
+ //====================================================================
+ class IDeckLayouter : public ::rtl::IReference
+ {
+ public:
+ /** re-arranges the elements of the tool deck, taking into account the
+ available space for the complete deck.
+
+ @param i_rDeckPlayground
+ the playground for the complete tool panel deck
+ @return
+ the content area for a single tool panel
+ */
+ virtual ::Rectangle Layout( const ::Rectangle& i_rDeckPlayground ) = 0;
+
+ /** destroys the instance
+
+ Since the layouter is ref-counted, but might keep references to non-ref-counted objects
+ (in particular, the ToolPanelDeck, which is a VCL-Window, and thus cannot be ref-counted),
+ Destroy is the definitive way to dispose the instance. Technically, it's still alive afterwards,
+ but non-functional.
+ */
+ virtual void Destroy() = 0;
+
+ /** assuming that a layouter neesds to provide some kind of panel selector control, this method
+ requests to set the focus to this control.
+ */
+ virtual void SetFocusToPanelSelector() = 0;
+
+ /** returns the number of components in the XAccessible hierarchy which are needed to represent all elements
+ the layouter is responsible form.
+
+ Note that the implementation must guarantee that the count is fixed over the life time of the layouter.
+ */
+ virtual size_t GetAccessibleChildCount() const = 0;
+
+ /** retrieves the XAccessible implementation for the <code>i_nChildIndex</code>'th child in the XAccessible
+ hierarchy.
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ GetAccessibleChild(
+ const size_t i_nChildIndex,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible
+ ) = 0;
+
+ virtual ~IDeckLayouter()
+ {
+ }
+ };
+
+ typedef ::rtl::Reference< IDeckLayouter > PDeckLayouter;
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // SVT_DECKLAYOUTER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/toolpanel/drawerlayouter.hxx b/include/svtools/toolpanel/drawerlayouter.hxx
new file mode 100644
index 000000000000..0ee0560a8873
--- /dev/null
+++ b/include/svtools/toolpanel/drawerlayouter.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVT_DRAWERLAYOUTER_HXX
+#define SVT_DRAWERLAYOUTER_HXX
+
+#include "svtools/svtdllapi.h"
+#include "svtools/toolpanel/refbase.hxx"
+#include "svtools/toolpanel/toolpaneldeck.hxx"
+#include "svtools/toolpanel/decklayouter.hxx"
+
+#include <boost/shared_ptr.hpp>
+
+//......................................................................................................................
+namespace svt
+{
+//......................................................................................................................
+
+ class ToolPanelViewShell;
+ class ToolPanelDrawer;
+ typedef ::boost::shared_ptr< ToolPanelDrawer > PToolPanelDrawer;
+
+ //==================================================================================================================
+ //= ToolPanelDrawer
+ //==================================================================================================================
+ /** a class which implements a tool panel selector in the form of the classical drawers
+ */
+ class SVT_DLLPUBLIC DrawerDeckLayouter :public RefBase
+ ,public IDeckLayouter
+ ,public IToolPanelDeckListener
+ {
+ public:
+ DrawerDeckLayouter(
+ ::Window& i_rParentWindow,
+ IToolPanelDeck& i_rPanels
+ );
+ ~DrawerDeckLayouter();
+
+ // IReference
+ DECLARE_IREFERENCE()
+
+ // IDeckLayouter
+ virtual Rectangle Layout( const Rectangle& i_rDeckPlayground );
+ virtual void Destroy();
+ virtual void SetFocusToPanelSelector();
+ virtual size_t GetAccessibleChildCount() const;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ GetAccessibleChild(
+ const size_t i_nChildIndex,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible
+ );
+
+ // IToolPanelDeckListener
+ virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition );
+ virtual void PanelRemoved( const size_t i_nPosition );
+ virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive );
+ virtual void LayouterChanged( const PDeckLayouter& i_rNewLayouter );
+ virtual void Dying();
+
+ private:
+ // triggers a re-arrance of the panel deck elements
+ void impl_triggerRearrange() const;
+ size_t impl_getPanelPositionFromWindow( const Window* i_pDrawerWindow ) const;
+ void impl_removeDrawer( const size_t i_nPosition );
+
+ DECL_LINK( OnWindowEvent, VclSimpleEvent* );
+
+private:
+ Window& m_rParentWindow;
+ IToolPanelDeck& m_rPanelDeck;
+ ::std::vector< PToolPanelDrawer > m_aDrawers;
+ ::boost::optional< size_t > m_aLastKnownActivePanel;
+ };
+
+//......................................................................................................................
+} // namespace svt
+//......................................................................................................................
+
+#endif // SVT_DRAWERLAYOUTER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/toolpanel/paneltabbar.hxx b/include/svtools/toolpanel/paneltabbar.hxx
new file mode 100644
index 000000000000..0b534f88ed9b
--- /dev/null
+++ b/include/svtools/toolpanel/paneltabbar.hxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVT_PANELTABBAR_HXX
+#define SVT_PANELTABBAR_HXX
+
+#include "svtools/svtdllapi.h"
+#include "svtools/toolpanel/tabalignment.hxx"
+#include "svtools/toolpanel/tabitemcontent.hxx"
+
+#include <vcl/ctrl.hxx>
+
+#include <memory>
+#include <boost/optional.hpp>
+
+class PushButton;
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ class PanelTabBar_Impl;
+ class IToolPanelDeck;
+
+ //====================================================================
+ //= PanelTabBar
+ //====================================================================
+ /** a tab bar for selecting panels
+
+ At the moment, this control aligns the tabs vertically, this might be extended to also support a horizontal
+ layout in the future.
+ */
+ class SVT_DLLPUBLIC PanelTabBar : public Control
+ {
+ public:
+ PanelTabBar( Window& i_rParentWindow, IToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent );
+ ~PanelTabBar();
+
+ // attribute access
+ TabItemContent GetTabItemContent() const;
+ void SetTabItemContent( const TabItemContent& i_eItemContent );
+
+ ::boost::optional< size_t > GetFocusedPanelItem() const;
+ void FocusPanelItem( const size_t i_nItemPos );
+ Rectangle GetItemScreenRect( const size_t i_nItemPos ) const;
+ bool IsVertical() const;
+ IToolPanelDeck& GetPanelDeck() const;
+ PushButton& GetScrollButton( const bool i_bForward );
+
+ // Window overridables
+ virtual Size GetOptimalSize() const;
+
+ protected:
+ // Window overridables
+ virtual void Paint( const Rectangle& i_rRect );
+ virtual void Resize();
+ virtual void MouseMove( const MouseEvent& i_rMouseEvent );
+ virtual void MouseButtonDown( const MouseEvent& i_rMouseEvent );
+ virtual void MouseButtonUp( const MouseEvent& i_rMouseEvent );
+ virtual void RequestHelp( const HelpEvent& i_rHelpEvent );
+ virtual void GetFocus();
+ virtual void LoseFocus();
+ virtual void KeyInput( const KeyEvent& i_rKeyEvent );
+ virtual void DataChanged( const DataChangedEvent& i_rDataChanedEvent );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >
+ GetComponentInterface( sal_Bool i_bCreate );
+
+ private:
+ ::std::auto_ptr< PanelTabBar_Impl > m_pImpl;
+ };
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // SVT_PANELTABBAR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/toolpanel/refbase.hxx b/include/svtools/toolpanel/refbase.hxx
new file mode 100644
index 000000000000..18f86edbfbab
--- /dev/null
+++ b/include/svtools/toolpanel/refbase.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVT_REFBASE_HXX
+#define SVT_REFBASE_HXX
+
+#include "svtools/svtdllapi.h"
+
+#include <rtl/ref.hxx>
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ //====================================================================
+ //= RefBase
+ //====================================================================
+ class SVT_DLLPUBLIC RefBase : public ::rtl::IReference
+ {
+ protected:
+ RefBase()
+ :m_refCount( 0 )
+ {
+ }
+
+ virtual ~RefBase()
+ {
+ }
+
+ virtual oslInterlockedCount SAL_CALL acquire();
+ virtual oslInterlockedCount SAL_CALL release();
+
+ private:
+ oslInterlockedCount m_refCount;
+ };
+
+#define DECLARE_IREFERENCE() \
+ virtual oslInterlockedCount SAL_CALL acquire(); \
+ virtual oslInterlockedCount SAL_CALL release();
+
+
+#define IMPLEMENT_IREFERENCE( classname ) \
+ oslInterlockedCount classname::acquire() \
+ { \
+ return RefBase::acquire(); \
+ } \
+ oslInterlockedCount classname::release() \
+ { \
+ return RefBase::release(); \
+ }
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // SVT_REFBASE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/toolpanel/tabalignment.hxx b/include/svtools/toolpanel/tabalignment.hxx
new file mode 100644
index 000000000000..e626d03dc267
--- /dev/null
+++ b/include/svtools/toolpanel/tabalignment.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVT_TABALIGNMENT_HXX
+#define SVT_TABALIGNMENT_HXX
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ enum TabAlignment
+ {
+ TABS_LEFT,
+ TABS_RIGHT,
+ TABS_TOP,
+ TABS_BOTTOM
+ };
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // SVT_TABALIGNMENT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/toolpanel/tabitemcontent.hxx b/include/svtools/toolpanel/tabitemcontent.hxx
new file mode 100644
index 000000000000..07c7eeedc9fd
--- /dev/null
+++ b/include/svtools/toolpanel/tabitemcontent.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVT_TABITEMCONTENT_HXX
+#define SVT_TABITEMCONTENT_HXX
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ enum TabItemContent
+ {
+ TABITEM_IMAGE_AND_TEXT,
+ TABITEM_IMAGE_ONLY,
+ TABITEM_TEXT_ONLY,
+
+ TABITEM_AUTO
+ };
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // SVT_TABITEMCONTENT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/toolpanel/tablayouter.hxx b/include/svtools/toolpanel/tablayouter.hxx
new file mode 100644
index 000000000000..cf76879a4566
--- /dev/null
+++ b/include/svtools/toolpanel/tablayouter.hxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVT_TABLAYOUTER_HXX
+#define SVT_TABLAYOUTER_HXX
+
+#include "svtools/svtdllapi.h"
+#include "svtools/toolpanel/decklayouter.hxx"
+#include "svtools/toolpanel/tabalignment.hxx"
+#include "svtools/toolpanel/tabitemcontent.hxx"
+#include "svtools/toolpanel/refbase.hxx"
+
+#include <memory>
+
+#include <boost/noncopyable.hpp>
+
+class Window;
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ class IToolPanelDeck;
+
+ struct TabDeckLayouter_Data;
+
+ //====================================================================
+ //= TabDeckLayouter
+ //====================================================================
+ class SVT_DLLPUBLIC TabDeckLayouter :public RefBase
+ ,public IDeckLayouter
+ ,public ::boost::noncopyable
+ {
+ public:
+ /** creates a new layouter
+ @param i_rParent
+ is the parent window for any VCL windows the layouter needs to create.
+ @param i_rPanels
+ is the panel deck which the layouter is responsible for.
+ @param i_eAlignment
+ specifies the alignment of the panel selector
+ @param TabItemContent
+ specifies the content to show on the tab items
+ */
+ TabDeckLayouter(
+ Window& i_rParent,
+ IToolPanelDeck& i_rPanels,
+ const TabAlignment i_eAlignment,
+ const TabItemContent i_eItemContent
+ );
+ ~TabDeckLayouter();
+
+ // attribute access
+ TabItemContent GetTabItemContent() const;
+ void SetTabItemContent( const TabItemContent& i_eItemContent );
+ TabAlignment GetTabAlignment() const;
+
+ // IDeckLayouter
+ virtual Rectangle Layout( const Rectangle& i_rDeckPlayground );
+ virtual void Destroy();
+ virtual void SetFocusToPanelSelector();
+ virtual size_t GetAccessibleChildCount() const;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ GetAccessibleChild(
+ const size_t i_nChildIndex,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible
+ );
+
+ // IReference
+ DECLARE_IREFERENCE()
+
+ private:
+ ::std::auto_ptr< TabDeckLayouter_Data > m_pData;
+ };
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // SVT_TABLAYOUTER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/toolpanel/toolpanel.hxx b/include/svtools/toolpanel/toolpanel.hxx
new file mode 100644
index 000000000000..4c2d0f736ba0
--- /dev/null
+++ b/include/svtools/toolpanel/toolpanel.hxx
@@ -0,0 +1,138 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVT_TOOLPANEL_HXX
+#define SVT_TOOLPANEL_HXX
+
+#include "svtools/svtdllapi.h"
+#include "svtools/toolpanel/refbase.hxx"
+
+#include <rtl/ustring.hxx>
+#include <vcl/image.hxx>
+
+#include <boost/noncopyable.hpp>
+
+class Rectangle;
+class Window;
+namespace com { namespace sun { namespace star { namespace accessibility {
+ class XAccessible;
+} } } }
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ //====================================================================
+ //= IToolPanel
+ //====================================================================
+ /** abstract interface for a single tool panel
+ */
+ class SVT_DLLPUBLIC IToolPanel : public ::rtl::IReference
+ {
+ public:
+ /// retrieves the display name of the panel
+ virtual OUString GetDisplayName() const = 0;
+
+ /// retrieves the image associated with the panel, if any
+ virtual Image GetImage() const = 0;
+
+ /// retrieves the help ID associated with the panel, if any.
+ virtual OString GetHelpID() const = 0;
+
+ /** activates the panel
+
+ Usually, this means the panel's Window is created (if not previosly done so) and shown.
+
+ @param i_rParentWindow
+ the parent window to anchor the panel window at. Subsequent calls to the Activate
+ method will always get the same parent window. The complete area of this window is
+ available, and should be used, for the panel window.
+ */
+ virtual void Activate( Window& i_rParentWindow ) = 0;
+
+ /** deactivates the panel
+
+ There are different ways how an implementation could deactivate a panel. The easiest way
+ would be to simply hide the associated Window. Alternatively, you could completely destroy it,
+ or decide to cache it by re-parenting it to another (temporary, invisible) window.
+ */
+ virtual void Deactivate() = 0;
+
+ /** sets a new size for the panel's Window
+
+ The panel window is always expected to be positioned at (0,0), relative to the parent window
+ which was passed to the Activate member. Resizing the panel window is necessary when the size of
+ this parent window changes. Effectively, this method is a means of convenience, to relief panel
+ implementations from reacting on size changes of their parent window themselves.
+ */
+ virtual void SetSizePixel( const Size& i_rPanelWindowSize ) = 0;
+
+ /// sets the focus to the panel window
+ virtual void GrabFocus() = 0;
+
+ /** release any resources associated with the panel.
+
+ In particular, implementations should ultimately destroy the VCL window which implements the panel
+ window. No subsequent calls to any other method will happen after Destroy has been called.
+ */
+ virtual void Dispose() = 0;
+
+ /** creates an XAccessible for the tool panel
+
+ Implementations are allowed to create a new instance each time this method is called, the caller
+ is responsible for caching the XAccessible implementation, if this is desired.
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ CreatePanelAccessible(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible
+ ) = 0;
+
+ virtual ~IToolPanel()
+ {
+ }
+ };
+
+ typedef ::rtl::Reference< IToolPanel > PToolPanel;
+
+ //====================================================================
+ //= ToolPanelBase
+ //====================================================================
+ /** base class for tool panel implementations, adding ref count implementation to the IToolPanel interface,
+ but still being abstract
+ */
+ class SVT_DLLPUBLIC ToolPanelBase :public IToolPanel
+ ,public RefBase
+ ,public ::boost::noncopyable
+ {
+ protected:
+ ToolPanelBase();
+ ~ToolPanelBase();
+
+ public:
+ DECLARE_IREFERENCE()
+ };
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // SVT_TOOLPANEL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/toolpanel/toolpaneldeck.hxx b/include/svtools/toolpanel/toolpaneldeck.hxx
new file mode 100644
index 000000000000..d293aca8d017
--- /dev/null
+++ b/include/svtools/toolpanel/toolpaneldeck.hxx
@@ -0,0 +1,194 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVT_TOOLPANELDECK_HXX
+#define SVT_TOOLPANELDECK_HXX
+
+#include "svtools/svtdllapi.h"
+#include "svtools/toolpanel/toolpanel.hxx"
+#include "svtools/toolpanel/decklayouter.hxx"
+
+#include <vcl/ctrl.hxx>
+
+#include <boost/optional.hpp>
+#include <memory>
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ class ToolPanelCollection;
+ class ToolPanelDeck_Impl;
+
+ //====================================================================
+ //= IToolPanelDeckListener
+ //====================================================================
+ class SAL_NO_VTABLE IToolPanelDeckListener
+ {
+ public:
+ /** called when a panel has been inserted into the deck
+ */
+ virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ) = 0;
+
+ /** called when a panel has been removed from the deck
+ */
+ virtual void PanelRemoved( const size_t i_nPosition ) = 0;
+
+ /** called when the active panel of the deck changed
+ */
+ virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) = 0;
+
+ /** called when a new layouter has been set at a tool panel deck.
+
+ The method is called after the old layouter has been disposed (i.e. its Destroy method has been
+ invoked), and after the complete deck has been re-layouter.
+ */
+ virtual void LayouterChanged( const PDeckLayouter& i_rNewLayouter ) = 0;
+
+ /** called when the tool panel deck which the listener registered at is dying. The listener is required to
+ release all references to the deck then.
+ */
+ virtual void Dying() = 0;
+
+ protected:
+ ~IToolPanelDeckListener() {}
+ };
+
+ //====================================================================
+ //= IToolPanelDeck
+ //====================================================================
+ class SVT_DLLPUBLIC IToolPanelDeck
+ {
+ public:
+ /** returns the number of panels in the container
+ */
+ virtual size_t GetPanelCount() const = 0;
+
+ /** retrieves the panel with the given index. Invalid indexes will be reported via an assertion in the
+ non-product version, and silently ignored in the product version, with a NULL panel being returned.
+ */
+ virtual PToolPanel GetPanel( const size_t i_nPos ) const = 0;
+
+ /** returns the number of the currently active panel.
+ */
+ virtual ::boost::optional< size_t >
+ GetActivePanel() const = 0;
+
+ /** activates the panel with the given number. If the given number is larger or equal to the number of panels
+ in the deck, this will be reported via an assertion in non-product builds, and otherwise ignored.
+ @param i_rPanel
+ the number of the panel to activate. If this is not set, the currently active panel is de-activated,
+ and no new panel is activated at all. Whether or not this makes sense for your application is at
+ your own discretion.
+ */
+ virtual void ActivatePanel( const ::boost::optional< size_t >& i_rPanel ) = 0;
+
+ /** inserts a new panel into the container. NULL panels are not allowed, as are positions greater than the
+ current panel count. Violations of this will be reported via an assertion in the non-product version, and
+ silently ignored in the product version.
+ */
+ virtual size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition ) = 0;
+
+ /** removes a panel specified by its position.
+
+ Note: It is the responsibility of the caller to ensure that the panel is destroyed appropriately. That is,
+ the tool panel deck will <em>not</em> invoke <member>IToolPanel::Dispose</member> on the removed panel.
+ The advantage is that the panel might be re-used later, with the disadvantage that the owner of the panel
+ deck must know whether Dispose must be invoked after removal, or whether the panel will properly
+ dispose itself when its ref count drops to 0.
+ */
+ virtual PToolPanel RemovePanel( const size_t i_nPosition ) = 0;
+
+ /** adds a new listener to be notified when the container content changes. The caller is responsible
+ for life time control, i.e. removing the listener before it actually dies.
+ */
+ virtual void AddListener( IToolPanelDeckListener& i_rListener ) = 0;
+
+ /** removes a container listener previously added via addListener.
+ */
+ virtual void RemoveListener( IToolPanelDeckListener& i_rListener ) = 0;
+
+ protected:
+ ~IToolPanelDeck() {}
+ };
+
+ //====================================================================
+ //= ToolPanelDeck
+ //====================================================================
+ class SVT_DLLPUBLIC ToolPanelDeck :public Control
+ ,public IToolPanelDeck
+ {
+ public:
+ ToolPanelDeck( Window& i_rParent, const WinBits i_nStyle = WB_DIALOGCONTROL );
+ ~ToolPanelDeck();
+
+ // attributes
+ PDeckLayouter GetLayouter() const;
+ void SetLayouter( const PDeckLayouter& i_pNewLayouter );
+
+ /** returns the window which acts as anchor for the panel windows.
+
+ This is a single dedicated window, which is passed to the IToolPanel::ActivatePanel method
+ whenever a panel is activated, to act as parent window for the panel's VCL-Window.
+ */
+ ::Window& GetPanelWindowAnchor();
+ const ::Window& GetPanelWindowAnchor() const;
+
+ /** sets the window which should act as parent in the A11Y object hierarchy.
+
+ Calling this method has no effect if CreateAccessible had always been called.
+ */
+ void SetAccessibleParentWindow( ::Window* i_pAccessibleParent );
+ ::Window* GetAccessibleParentWindow() const;
+
+ // IToolPanelDeck
+ virtual size_t GetPanelCount() const;
+ virtual PToolPanel GetPanel( const size_t i_nPos ) const;
+ virtual ::boost::optional< size_t >
+ GetActivePanel() const;
+ virtual void ActivatePanel( const ::boost::optional< size_t >& i_rPanel );
+ virtual size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition );
+ virtual PToolPanel RemovePanel( const size_t i_nPosition );
+ virtual void AddListener( IToolPanelDeckListener& i_rListener );
+ virtual void RemoveListener( IToolPanelDeckListener& i_rListener );
+
+ protected:
+ // Window overridables
+ virtual void Resize();
+ virtual long Notify( NotifyEvent& i_rNotifyEvent );
+ virtual void GetFocus();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >
+ GetComponentInterface( sal_Bool i_bCreate );
+
+ private:
+ ::std::auto_ptr< ToolPanelDeck_Impl > m_pImpl;
+
+ private:
+ using Window::GetAccessibleParentWindow;
+ };
+
+//........................................................................
+} // namespace svt
+//........................................................................
+
+#endif // SVT_TOOLPANELDECK_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/toolpanelopt.hxx b/include/svtools/toolpanelopt.hxx
new file mode 100644
index 000000000000..9ca4f6fe239a
--- /dev/null
+++ b/include/svtools/toolpanelopt.hxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVTOOLS_TOOLPANELOPT_HXX
+#define INCLUDED_SVTOOLS_TOOLPANELOPT_HXX
+
+#include "svtools/svtdllapi.h"
+#include <sal/types.h>
+#include <osl/mutex.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <rtl/ustring.hxx>
+#include <unotools/options.hxx>
+
+/** forward declaration to our private date container implementation
+
+ We use these class as internal member to support small memory requirements.
+ You can create the container if it is neccessary. The class which use these mechanism
+ is faster and smaller then a complete implementation!
+*/
+class SvtToolPanelOptions_Impl;
+class Link;
+
+/** collect information about sidebar group
+
+ \attention This class is partially threadsafe.
+*/
+class SVT_DLLPUBLIC SvtToolPanelOptions: public utl::detail::Options
+{
+ public:
+ /** standard constructor and destructor
+
+ This will initialize an instance with default values.
+ We implement these class with a refcount mechanism! Every instance of this class increase it
+ at create and decrease it at delete time - but all instances use the same data container!
+ He is implemented as a static member ...
+
+ \sa member m_nRefCount
+ \sa member m_pDataContainer
+ */
+ SvtToolPanelOptions();
+ virtual ~SvtToolPanelOptions();
+
+ bool GetVisibleImpressView() const;
+ void SetVisibleImpressView( bool bVisible );
+ bool GetVisibleOutlineView() const;
+ void SetVisibleOutlineView( bool bVisible );
+ bool GetVisibleNotesView() const;
+ void SetVisibleNotesView( bool bVisible );
+ bool GetVisibleHandoutView() const;
+ void SetVisibleHandoutView( bool bVisible );
+ bool GetVisibleSlideSorterView() const;
+ void SetVisibleSlideSorterView( bool bVisible );
+ bool GetVisibleDrawView() const;
+ void SetVisibleDrawView( bool bVisible );
+
+
+ private:
+ /** return a reference to a static mutex
+
+ These class is partially threadsafe (for de-/initialization only).
+ All access methods are'nt safe!
+ We create a static mutex only for one ime and use at different times.
+
+ \return A reference to a static mutex member.*/
+ SVT_DLLPRIVATE static ::osl::Mutex& GetInitMutex();
+
+ private:
+
+ /**
+ \attention
+ Don't initialize these static member in these header!
+ \li Double defined symbols will be detected ...
+ \li and unresolved externals exist at linking time.
+ Do it in your source only.
+ */
+ static SvtToolPanelOptions_Impl* m_pDataContainer; ///< impl. data container as dynamic pointer for smaller memory requirements!
+ static sal_Int32 m_nRefCount; ///< internal ref count mechanism
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/transfer.hxx b/include/svtools/transfer.hxx
new file mode 100644
index 000000000000..5d63d166bfa5
--- /dev/null
+++ b/include/svtools/transfer.hxx
@@ -0,0 +1,521 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _TRANSFER_HXX
+#define _TRANSFER_HXX
+
+#include "svtools/svtdllapi.h"
+#include <tools/globname.hxx>
+#include <tools/gen.hxx>
+#include <sot/formats.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase4.hxx>
+#include <com/sun/star/frame/XTerminateListener.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/datatransfer/XTransferable.hpp>
+#include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp>
+#include <com/sun/star/datatransfer/dnd/DNDConstants.hpp>
+#include <com/sun/star/datatransfer/dnd/XDragGestureRecognizer.hpp>
+#include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
+#include <com/sun/star/datatransfer/dnd/DropTargetDragEvent.hpp>
+#include <com/sun/star/datatransfer/dnd/DropTargetDropEvent.hpp>
+#include <com/sun/star/datatransfer/dnd/XDragSourceListener.hpp>
+#include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp>
+#include <com/sun/star/embed/Aspects.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+
+class Bitmap;
+class GDIMetaFile;
+class Graphic;
+class ImageMap;
+class SotStorageStreamRef;
+class INetBookmark;
+class INetImage;
+class FileList;
+class Window;
+class Link;
+
+// Drag&Drop defines
+
+#define DND_ACTION_NONE ::com::sun::star::datatransfer::dnd::DNDConstants::ACTION_NONE
+#define DND_ACTION_COPY ::com::sun::star::datatransfer::dnd::DNDConstants::ACTION_COPY
+#define DND_ACTION_MOVE ::com::sun::star::datatransfer::dnd::DNDConstants::ACTION_MOVE
+#define DND_ACTION_COPYMOVE ::com::sun::star::datatransfer::dnd::DNDConstants::ACTION_COPY_OR_MOVE
+#define DND_ACTION_LINK ::com::sun::star::datatransfer::dnd::DNDConstants::ACTION_LINK
+
+#define DND_POINTER_NONE 0
+#define DND_IMAGE_NONE 0
+
+struct TransferableObjectDescriptor
+{
+ SvGlobalName maClassName;
+ sal_uInt16 mnViewAspect;
+ Point maDragStartPos;
+ Size maSize;
+ sal_uInt32 mnOle2Misc;
+ OUString maTypeName;
+ OUString maDisplayName;
+ sal_Bool mbCanLink;
+
+ TransferableObjectDescriptor()
+ : mnViewAspect(::com::sun::star::embed::Aspects::MSOLE_CONTENT)
+ , mnOle2Misc(0)
+ , mbCanLink(false)
+ {}
+
+ SVT_DLLPUBLIC friend SvStream& operator>>( SvStream& rIStm, TransferableObjectDescriptor& rObjDesc );
+ SVT_DLLPUBLIC friend SvStream& operator<<( SvStream& rOStm, const TransferableObjectDescriptor& rObjDesc );
+};
+
+struct AcceptDropEvent
+{
+ sal_Int8 mnAction;
+ Point maPosPixel;
+ const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent maDragEvent;
+ sal_Bool mbLeaving;
+ sal_Bool mbDefault;
+
+ AcceptDropEvent() :
+ mnAction( DND_ACTION_NONE ),
+ mbLeaving( sal_False ),
+ mbDefault( sal_False ) {}
+
+ AcceptDropEvent( sal_Int8 nAction,
+ const Point& rPosPixel,
+ const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& rDragEvent,
+ sal_Bool bLeaving = sal_False ) :
+ mnAction( nAction ),
+ maPosPixel( rPosPixel ),
+ maDragEvent( rDragEvent ),
+ mbLeaving( bLeaving ),
+ mbDefault( sal_False ) {}
+};
+
+struct ExecuteDropEvent
+{
+ sal_Int8 mnAction;
+ Point maPosPixel;
+ const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent maDropEvent;
+ sal_Bool mbDefault;
+
+ ExecuteDropEvent() :
+ mnAction( DND_ACTION_NONE ),
+ mbDefault( sal_False ) {}
+
+ ExecuteDropEvent( sal_Int8 nAction,
+ const Point& rPosPixel,
+ const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& rDropEvent ) :
+ mnAction( nAction ),
+ maPosPixel( rPosPixel ),
+ maDropEvent( rDropEvent ),
+ mbDefault( sal_False ) {}
+};
+
+class SVT_DLLPUBLIC TransferableHelper : public ::cppu::WeakImplHelper4< ::com::sun::star::datatransfer::XTransferable,
+ ::com::sun::star::datatransfer::clipboard::XClipboardOwner,
+ ::com::sun::star::datatransfer::dnd::XDragSourceListener,
+ ::com::sun::star::lang::XUnoTunnel >
+{
+private:
+
+ // nested class to implement the XTerminateListener interface
+ class TerminateListener : public ::cppu::WeakImplHelper1< ::com::sun::star::frame::XTerminateListener >
+ {
+ private:
+
+ TransferableHelper& mrParent;
+
+ private:
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XTerminateListener
+ virtual void SAL_CALL queryTermination( const ::com::sun::star::lang::EventObject& aEvent ) throw( ::com::sun::star::frame::TerminationVetoException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL notifyTermination( const ::com::sun::star::lang::EventObject& aEvent ) throw( ::com::sun::star::uno::RuntimeException );
+
+ public:
+
+ TerminateListener( TransferableHelper& rDropTargetHelper );
+ virtual ~TerminateListener();
+ };
+
+ friend class TransferableHelper::TerminateListener;
+
+private:
+
+ ::com::sun::star::uno::Any maAny;
+ OUString maLastFormat;
+ mutable ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > mxClipboard;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XTerminateListener > mxTerminateListener;
+ DataFlavorExVector* mpFormats;
+ TransferableObjectDescriptor* mpObjDesc;
+
+protected:
+ inline const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >&
+ getOwnClipboard() const { return mxClipboard; }
+
+private:
+
+ // XTransferable
+ virtual ::com::sun::star::uno::Any SAL_CALL getTransferData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) throw(::com::sun::star::datatransfer::UnsupportedFlavorException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isDataFlavorSupported( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XDragSourceListener
+ virtual void SAL_CALL dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSourceDropEvent& dsde ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL dragEnter( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& dsde ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL dragExit( const ::com::sun::star::datatransfer::dnd::DragSourceEvent& dse ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL dragOver( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& dsde ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL dropActionChanged( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& dsde ) throw(::com::sun::star::uno::RuntimeException);
+
+private:
+
+ // XClipboardOwner
+ virtual void SAL_CALL lostOwnership( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& xClipboard, const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTrans ) throw(::com::sun::star::uno::RuntimeException);
+
+protected:
+ // derivees need to access lostOwnership in case hey override it
+ // on windows, changing the access rights to a method gives unresolved externals, so we introduce
+ // this impl-method here 'til the next incompatible update
+ inline void implCallOwnLostOwnership(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& _rxClipboard,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& _rxTrans
+ )
+ {
+ TransferableHelper::lostOwnership( _rxClipboard, _rxTrans );
+ }
+
+
+private:
+
+ SVT_DLLPRIVATE void ImplFlush();
+
+protected:
+
+ virtual ~TransferableHelper();
+
+ void AddFormat( SotFormatStringId nFormat );
+ void AddFormat( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+ void RemoveFormat( SotFormatStringId nFormat );
+ void RemoveFormat( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+ sal_Bool HasFormat( SotFormatStringId nFormat );
+ inline sal_Bool HasFormat( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) { return isDataFlavorSupported( rFlavor ); }
+ void ClearFormats();
+
+ sal_Bool SetAny( const ::com::sun::star::uno::Any& rAny, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+ sal_Bool SetString( const OUString& rString, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+ sal_Bool SetBitmap( const Bitmap& rBitmap, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+ sal_Bool SetGDIMetaFile( const GDIMetaFile& rMtf, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+ sal_Bool SetGraphic( const Graphic& rGraphic, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+ sal_Bool SetImageMap( const ImageMap& rIMap, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+ sal_Bool SetTransferableObjectDescriptor( const TransferableObjectDescriptor& rDesc, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+ sal_Bool SetINetBookmark( const INetBookmark& rBmk, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+ sal_Bool SetINetImage( const INetImage& rINtImg, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+ sal_Bool SetObject( void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+
+protected:
+
+ virtual void AddSupportedFormats() = 0;
+ virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) = 0;
+ virtual sal_Bool WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+ virtual void DragFinished( sal_Int8 nDropAction );
+ virtual void ObjectReleased();
+
+public:
+
+ TransferableHelper();
+
+ void PrepareOLE( const TransferableObjectDescriptor& rObjDesc );
+
+ void CopyToClipboard( Window *pWindow ) const;
+ void CopyToSelection( Window *pWindow ) const;
+ void StartDrag( Window* pWindow, sal_Int8 nDragSourceActions,
+ sal_Int32 nDragPointer = DND_POINTER_NONE,
+ sal_Int32 nDragImage = DND_IMAGE_NONE );
+
+ static void ClearSelection( Window *pWindow );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > GetSystemClipboard();
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
+
+public:
+
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException );
+};
+
+struct TransferableDataHelper_Impl;
+
+class SVT_DLLPUBLIC TransferableDataHelper
+{
+ friend class DropTargetHelper;
+
+private:
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > mxTransfer;
+ ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > mxClipboard;
+ DataFlavorExVector* mpFormats;
+ TransferableObjectDescriptor* mpObjDesc;
+ TransferableDataHelper_Impl* mpImpl;
+
+protected:
+ void InitFormats();
+
+public:
+
+ static void FillDataFlavorExVector( const ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor >& rDataFlavorSeq,
+ DataFlavorExVector& rDataFlavorExVector );
+
+ TransferableDataHelper();
+ TransferableDataHelper( const TransferableDataHelper& rDataHelper );
+ TransferableDataHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& rxTransferable );
+ ~TransferableDataHelper();
+
+ TransferableDataHelper& operator=( const TransferableDataHelper& rDataHelper );
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& GetTransferable() const { return mxTransfer; }
+ ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > GetXTransferable() const;
+
+ sal_Bool HasFormat( SotFormatStringId nFormat ) const;
+ sal_Bool HasFormat( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) const;
+
+ sal_uInt32 GetFormatCount() const;
+
+ SotFormatStringId GetFormat( sal_uInt32 nFormat ) const;
+ ::com::sun::star::datatransfer::DataFlavor GetFormatDataFlavor( sal_uInt32 nFormat ) const;
+
+ DataFlavorExVector& GetDataFlavorExVector() const {return *mpFormats; }
+
+ sal_Bool StartClipboardListening( );
+ void StopClipboardListening( );
+
+ void Rebind( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& _rxNewData );
+
+public:
+
+ ::com::sun::star::uno::Any GetAny( SotFormatStringId nFormat ) const;
+ ::com::sun::star::uno::Any GetAny( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) const;
+
+ sal_Bool GetString( SotFormatStringId nFormat, String& rStr );
+ sal_Bool GetString( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, String& rStr );
+
+ sal_Bool GetString( SotFormatStringId nFormat, OUString& rStr );
+ sal_Bool GetString( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, OUString& rStr );
+
+ sal_Bool GetBitmap( SotFormatStringId nFormat, Bitmap& rBmp );
+ sal_Bool GetBitmap( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, Bitmap& rBmp );
+
+ sal_Bool GetGDIMetaFile( SotFormatStringId nFormat, GDIMetaFile& rMtf );
+ sal_Bool GetGDIMetaFile( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, GDIMetaFile& rMtf );
+
+ sal_Bool GetGraphic( SotFormatStringId nFormat, Graphic& rGraphic );
+ sal_Bool GetGraphic( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, Graphic& rGraphic );
+
+ sal_Bool GetImageMap( SotFormatStringId nFormat, ImageMap& rIMap );
+ sal_Bool GetImageMap( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, ImageMap& rImap );
+
+ sal_Bool GetTransferableObjectDescriptor( SotFormatStringId nFormat, TransferableObjectDescriptor& rDesc );
+ sal_Bool GetTransferableObjectDescriptor( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, TransferableObjectDescriptor& rDesc );
+
+ sal_Bool GetINetBookmark( SotFormatStringId nFormat, INetBookmark& rBmk );
+ sal_Bool GetINetBookmark( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, INetBookmark& rBmk );
+
+ sal_Bool GetINetImage( SotFormatStringId nFormat, INetImage& rINtImg );
+ sal_Bool GetINetImage( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, INetImage& rINtImg );
+
+ sal_Bool GetFileList( SotFormatStringId nFormat, FileList& rFileList );
+ sal_Bool GetFileList( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, FileList& rFileList );
+
+ sal_Bool GetSequence( SotFormatStringId nFormat, ::com::sun::star::uno::Sequence< sal_Int8 >& rSeq );
+ sal_Bool GetSequence( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, ::com::sun::star::uno::Sequence< sal_Int8 >& rSeq );
+
+ sal_Bool GetSotStorageStream( SotFormatStringId nFormat, SotStorageStreamRef& rStreamRef );
+ sal_Bool GetSotStorageStream( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, SotStorageStreamRef& rStreamRef );
+
+ sal_Bool GetInputStream( SotFormatStringId nFormat, ::com::sun::star::uno::Reference < com::sun::star::io::XInputStream >& xStream );
+ sal_Bool GetInputStream( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, ::com::sun::star::uno::Reference < com::sun::star::io::XInputStream >& xStream );
+
+ sal_Bool GetInterface( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rIf );
+
+public:
+
+ static TransferableDataHelper CreateFromSystemClipboard( Window * pWindow );
+ static TransferableDataHelper CreateFromSelection( Window * pWindow );
+ static sal_Bool IsEqual( const ::com::sun::star::datatransfer::DataFlavor& rInternalFlavor,
+ const ::com::sun::star::datatransfer::DataFlavor& rRequestFlavor,
+ sal_Bool bCompareParameters = sal_False );
+};
+
+class SVT_DLLPUBLIC DragSourceHelper
+{
+private:
+
+ // nested class to implement the XDragGestureListener interface
+ class DragGestureListener : public ::cppu::WeakImplHelper1< ::com::sun::star::datatransfer::dnd::XDragGestureListener >
+ {
+ private:
+
+ DragSourceHelper& mrParent;
+
+ private:
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XDragGestureListener
+ virtual void SAL_CALL dragGestureRecognized( const ::com::sun::star::datatransfer::dnd::DragGestureEvent& rDGE ) throw( ::com::sun::star::uno::RuntimeException );
+
+ public:
+
+ DragGestureListener( DragSourceHelper& rDragSourceHelper );
+ ~DragGestureListener();
+ };
+
+ friend class DragSourceHelper::DragGestureListener;
+
+private:
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragGestureRecognizer > mxDragGestureRecognizer;
+ ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragGestureListener > mxDragGestureListener;
+
+ // not available
+ DragSourceHelper();
+ DragSourceHelper& operator=( const DragSourceHelper& rDragSourceHelper );
+ sal_Bool operator==( const DragSourceHelper& rDragSourceHelper ) const;
+
+public:
+
+ // to be overridden by the application
+ virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
+
+ DragSourceHelper( Window* pWindow );
+ virtual ~DragSourceHelper();
+};
+
+class SVT_DLLPUBLIC DropTargetHelper
+{
+private:
+
+ // nested class to implement the XDropTargetListener interface
+ class DropTargetListener : public ::cppu::WeakImplHelper1< ::com::sun::star::datatransfer::dnd::XDropTargetListener >
+ {
+ private:
+
+ DropTargetHelper& mrParent;
+ AcceptDropEvent* mpLastDragOverEvent;
+
+ private:
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XDropTargetListener
+ virtual void SAL_CALL drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& dtde ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent& dtdee ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent& dte ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& dtde ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL dropActionChanged( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& dtde ) throw(::com::sun::star::uno::RuntimeException);
+
+ public:
+
+ DropTargetListener( DropTargetHelper& rDropTargetHelper );
+ ~DropTargetListener();
+ };
+
+ friend class DropTargetHelper::DropTargetListener;
+
+private:
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTarget > mxDropTarget;
+ ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener > mxDropTargetListener;
+ DataFlavorExVector* mpFormats;
+
+ // not available
+ DropTargetHelper();
+ DropTargetHelper& operator=( const DropTargetHelper& rDropTargetHelper );
+ sal_Bool operator==( const DropTargetHelper& rDropTargetHelper ) const;
+
+ void ImplConstruct();
+
+ // called by our own implementation of XDropTargetListener (DropTargetListener instance)
+ void ImplBeginDrag( const ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor >& rSupportedDataFlavors );
+ void ImplEndDrag();
+
+public:
+
+ // to be overridden by the application
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
+
+ DropTargetHelper( Window* pWindow );
+ DropTargetHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTarget >& rxDropTarget );
+
+ virtual ~DropTargetHelper();
+
+ // typically called by the application in ::AcceptDrop and ::ExecuteDrop and (see above)
+ sal_Bool IsDropFormatSupported( SotFormatStringId nFormat );
+ sal_Bool IsDropFormatSupported( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+
+ DataFlavorExVector& GetDataFlavorExVector() const {return *mpFormats; }
+
+};
+
+struct TransferDataContainer_Impl;
+
+class SVT_DLLPUBLIC TransferDataContainer : public TransferableHelper
+{
+ TransferDataContainer_Impl* pImpl;
+
+protected:
+
+ virtual void AddSupportedFormats();
+ virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+ virtual void DragFinished( sal_Int8 nDropAction );
+
+public:
+
+ TransferDataContainer();
+ ~TransferDataContainer();
+
+ void CopyINetBookmark( const INetBookmark& rBkmk );
+ void CopyINetImage( const INetImage& rINtImg );
+ void CopyImageMap( const ImageMap& rImgMap );
+ void CopyGraphic( const Graphic& rGrf );
+ void CopyString( const String& rStr );
+ void CopyString( sal_uInt16 nFmt, const String& rStr );
+ void CopyAny( sal_uInt16 nFmt, const ::com::sun::star::uno::Any& rAny );
+
+ void CopyByteString( sal_uLong nFormatId, const OString& rStr );
+ void CopyAnyData( sal_uLong nFormatId, const sal_Char* pData, sal_uLong nLen );
+
+ sal_Bool HasAnyData() const;
+
+ using TransferableHelper::StartDrag;
+ void StartDrag( Window* pWindow, sal_Int8 nDragSourceActions,
+ const Link& rCallbck,
+ sal_Int32 nDragPointer = DND_POINTER_NONE,
+ sal_Int32 nDragImage = DND_IMAGE_NONE );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/treelist.hxx b/include/svtools/treelist.hxx
new file mode 100644
index 000000000000..220b2f4c7f88
--- /dev/null
+++ b/include/svtools/treelist.hxx
@@ -0,0 +1,366 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVTREELIST_HXX
+#define _SVTREELIST_HXX
+
+#include "svtools/svtdllapi.h"
+#include "svtools/treelistentries.hxx"
+#include "svtools/viewdataentry.hxx"
+
+#include <tools/solar.h>
+#include <tools/link.hxx>
+#include <tools/string.hxx>
+#include <tools/debug.hxx>
+
+#include <limits.h>
+#include <vector>
+#include <boost/ptr_container/ptr_map.hpp>
+
+#define LISTACTION_INSERTED 1
+#define LISTACTION_REMOVING 2
+#define LISTACTION_REMOVED 3
+#define LISTACTION_MOVING 4
+#define LISTACTION_MOVED 5
+#define LISTACTION_CLEARING 6
+#define LISTACTION_INSERTED_TREE 7
+#define LISTACTION_INVALIDATE_ENTRY 8
+#define LISTACTION_RESORTING 9
+#define LISTACTION_RESORTED 10
+#define LISTACTION_CLEARED 11
+
+class SvTreeListEntry;
+class SvListView;
+
+enum SvSortMode { SortAscending, SortDescending, SortNone };
+
+// For the return values of Sortlink:
+// See International::Compare( pLeft, pRight )
+// ( Compare(a,b) ==> b.Compare(a) ==> strcmp(a,b) )
+struct SvSortData
+{
+ const SvTreeListEntry* pLeft;
+ const SvTreeListEntry* pRight;
+};
+
+class SVT_DLLPUBLIC SvTreeList
+{
+ typedef std::vector<SvListView*> ListViewsType;
+
+ friend class SvListView;
+
+ ListViewsType aViewList;
+ sal_uLong nEntryCount;
+
+ Link aCloneLink;
+ Link aCompareLink;
+ SvSortMode eSortMode;
+
+ sal_uInt16 nRefCount;
+
+ sal_Bool bAbsPositionsValid;
+
+ SvTreeListEntry* FirstVisible() const { return First(); }
+ SvTreeListEntry* NextVisible( const SvListView*,SvTreeListEntry* pEntry, sal_uInt16* pDepth=0 ) const;
+ SvTreeListEntry* PrevVisible( const SvListView*,SvTreeListEntry* pEntry, sal_uInt16* pDepth=0 ) const;
+ SvTreeListEntry* LastVisible( const SvListView*,sal_uInt16* pDepth=0 ) const;
+ SvTreeListEntry* NextVisible( const SvListView*,SvTreeListEntry* pEntry, sal_uInt16& rDelta ) const;
+ SvTreeListEntry* PrevVisible( const SvListView*,SvTreeListEntry* pEntry, sal_uInt16& rDelta ) const;
+
+ sal_Bool IsEntryVisible( const SvListView*,SvTreeListEntry* pEntry ) const;
+ SvTreeListEntry* GetEntryAtVisPos( const SvListView*,sal_uLong nVisPos ) const;
+ sal_uLong GetVisiblePos( const SvListView*,SvTreeListEntry* pEntry ) const;
+ sal_uLong GetVisibleCount( SvListView* ) const;
+ sal_uLong GetVisibleChildCount( const SvListView*,SvTreeListEntry* pParent ) const;
+
+ SvTreeListEntry* FirstSelected( const SvListView*) const;
+ SvTreeListEntry* NextSelected( const SvListView*,SvTreeListEntry* pEntry ) const;
+ SvTreeListEntry* PrevSelected( const SvListView*,SvTreeListEntry* pEntry ) const;
+ SvTreeListEntry* LastSelected( const SvListView*) const;
+
+ sal_Bool Select( SvListView*,SvTreeListEntry* pEntry, sal_Bool bSelect=sal_True );
+ void SelectAll( SvListView*,sal_Bool bSelect ); // Does not call Select Handler
+ sal_uLong GetChildSelectionCount( const SvListView*,SvTreeListEntry* pParent ) const;
+
+ void Expand( SvListView*,SvTreeListEntry* pParent );
+ void Collapse( SvListView*,SvTreeListEntry* pParent );
+
+ SVT_DLLPRIVATE void SetAbsolutePositions();
+
+ SVT_DLLPRIVATE void CloneChildren(
+ SvTreeListEntries& rDst, sal_uLong& rCloneCount, SvTreeListEntries& rSrc, SvTreeListEntry* pNewParent) const;
+
+ /**
+ * Invalidate the cached position data to have them re-generated before
+ * the next access.
+ */
+ SVT_DLLPRIVATE void SetListPositions( SvTreeListEntries& rEntries );
+
+ // rPos is not changed for SortModeNone
+ SVT_DLLPRIVATE void GetInsertionPos(
+ SvTreeListEntry* pEntry,
+ SvTreeListEntry* pParent,
+ sal_uLong& rPos
+ );
+
+ SVT_DLLPRIVATE void ResortChildren( SvTreeListEntry* pParent );
+
+ SvTreeList(const SvTreeList&); // disabled
+ SvTreeList& operator= (const SvTreeList&); // disabled
+
+protected:
+ SvTreeListEntry* pRootItem;
+
+public:
+
+ SvTreeList();
+ virtual ~SvTreeList();
+
+ void InsertView( SvListView* );
+ void RemoveView( SvListView* );
+ sal_uLong GetViewCount() const
+ { return aViewList.size(); }
+
+ SvListView* GetView( sal_uLong nPos ) const
+ { return ( nPos < aViewList.size() ) ? aViewList[ nPos ] : NULL; }
+
+ void Broadcast(
+ sal_uInt16 nActionId,
+ SvTreeListEntry* pEntry1=0,
+ SvTreeListEntry* pEntry2=0,
+ sal_uLong nPos=0
+ );
+
+ // Notify all Listeners
+ void InvalidateEntry( SvTreeListEntry* );
+
+ sal_uLong GetEntryCount() const { return nEntryCount; }
+ SvTreeListEntry* First() const;
+ SvTreeListEntry* Next( SvTreeListEntry* pEntry, sal_uInt16* pDepth=0 ) const;
+ SvTreeListEntry* Prev( SvTreeListEntry* pEntry, sal_uInt16* pDepth=0 ) const;
+ SvTreeListEntry* Last() const;
+
+ SvTreeListEntry* FirstChild( SvTreeListEntry* pParent ) const;
+ SvTreeListEntry* NextSibling( SvTreeListEntry* pEntry ) const;
+ SvTreeListEntry* PrevSibling( SvTreeListEntry* pEntry ) const;
+ SvTreeListEntry* LastSibling( SvTreeListEntry* pEntry ) const;
+
+ sal_uLong Insert( SvTreeListEntry* pEntry,SvTreeListEntry* pPar,sal_uLong nPos=ULONG_MAX);
+ sal_uLong Insert( SvTreeListEntry* pEntry,sal_uLong nRootPos = ULONG_MAX )
+ { return Insert(pEntry, pRootItem, nRootPos ); }
+
+ void InsertTree( SvTreeListEntry* pTree, SvTreeListEntry* pTargetParent, sal_uLong nListPos );
+
+ // Entries need to be in the same Model!
+ void Move( SvTreeListEntry* pSource, SvTreeListEntry* pTarget );
+
+ // Creates ChildList if needed
+ sal_uLong Move( SvTreeListEntry* pSource, SvTreeListEntry* pTargetParent, sal_uLong nListPos);
+ void Copy( SvTreeListEntry* pSource, SvTreeListEntry* pTarget );
+ sal_uLong Copy( SvTreeListEntry* pSource, SvTreeListEntry* pTargetParent, sal_uLong nListPos);
+
+ bool Remove( const SvTreeListEntry* pEntry );
+ void Clear();
+
+ bool HasChildren( const SvTreeListEntry* pEntry ) const;
+ bool HasParent( const SvTreeListEntry* pEntry ) const;
+
+ bool IsChild(const SvTreeListEntry* pParent, const SvTreeListEntry* pChild) const;
+ SvTreeListEntry* GetEntry( SvTreeListEntry* pParent, sal_uLong nPos ) const;
+ SvTreeListEntry* GetEntry( sal_uLong nRootPos ) const;
+ SvTreeListEntry* GetEntryAtAbsPos( sal_uLong nAbsPos ) const;
+
+ const SvTreeListEntry* GetParent( const SvTreeListEntry* pEntry ) const;
+ SvTreeListEntry* GetParent( SvTreeListEntry* pEntry );
+
+ SvTreeListEntry* GetRootLevelParent( SvTreeListEntry* pEntry ) const;
+ const SvTreeListEntries& GetChildList( SvTreeListEntry* pParent ) const;
+ SvTreeListEntries& GetChildList( SvTreeListEntry* pParent );
+
+ std::pair<SvTreeListEntries::iterator, SvTreeListEntries::iterator>
+ GetChildIterators(SvTreeListEntry* pParent);
+
+ sal_uLong GetAbsPos( const SvTreeListEntry* pEntry ) const;
+ sal_uLong GetRelPos( const SvTreeListEntry* pChild ) const;
+
+ sal_uLong GetChildCount( const SvTreeListEntry* pParent ) const;
+ sal_uInt16 GetDepth( const SvTreeListEntry* pEntry ) const;
+ bool IsAtRootDepth( const SvTreeListEntry* pEntry ) const;
+
+ // The Model calls the Clone Link to clone Entries.
+ // Thus we do not need to derive from the Model if we derive from SvTreeListEntry.
+ // Declaration of the Clone Handler:
+ // DECL_LINK(CloneHdl,SvTreeListEntry*);
+ // The Handler needs to return a SvTreeListEntry*
+ SvTreeListEntry* Clone( SvTreeListEntry* pEntry, sal_uLong& nCloneCount ) const;
+ void SetCloneLink( const Link& rLink )
+ { aCloneLink=rLink; }
+
+ const Link& GetCloneLink() const
+ { return aCloneLink; }
+
+ virtual SvTreeListEntry* CloneEntry( SvTreeListEntry* pSource ) const; // Calls the Clone Link
+ virtual SvTreeListEntry* CreateEntry() const; // To create Entries
+
+ sal_uInt16 GetRefCount() const { return nRefCount; }
+ void SetRefCount( sal_uInt16 nRef ) { nRefCount = nRef; }
+
+ void SetSortMode( SvSortMode eMode ) { eSortMode = eMode; }
+ SvSortMode GetSortMode() const { return eSortMode; }
+ StringCompare Compare(const SvTreeListEntry* pLeft, const SvTreeListEntry* pRight) const;
+ void SetCompareHdl( const Link& rLink ) { aCompareLink = rLink; }
+ const Link& GetCompareHdl() const { return aCompareLink; }
+ void Resort();
+};
+
+class SVT_DLLPUBLIC SvListView
+{
+ friend class SvTreeList;
+
+ typedef boost::ptr_map<SvTreeListEntry*, SvViewDataEntry> SvDataTable;
+
+ sal_uLong nVisibleCount;
+ sal_uLong nSelectionCount;
+ sal_Bool bVisPositionsValid;
+
+ SVT_DLLPRIVATE void InitTable();
+ SVT_DLLPRIVATE void RemoveViewData( SvTreeListEntry* pParent );
+
+ SvDataTable maDataTable; // Mapping SvTreeListEntry -> ViewData
+
+ void ActionMoving( SvTreeListEntry* pEntry,SvTreeListEntry* pTargetPrnt,sal_uLong nChildPos);
+ void ActionMoved( SvTreeListEntry* pEntry,SvTreeListEntry* pTargetPrnt,sal_uLong nChildPos);
+ void ActionInserted( SvTreeListEntry* pEntry );
+ void ActionInsertedTree( SvTreeListEntry* pEntry );
+ void ActionRemoving( SvTreeListEntry* pEntry );
+ void ActionRemoved( SvTreeListEntry* pEntry );
+ void ActionClear();
+
+protected:
+ SvTreeList* pModel;
+
+public:
+ SvListView(); // Sets the Model to 0
+ virtual ~SvListView();
+ void Clear();
+ virtual void SetModel( SvTreeList* );
+ virtual void ModelNotification(
+ sal_uInt16 nActionId,
+ SvTreeListEntry* pEntry1,
+ SvTreeListEntry* pEntry2,
+ sal_uLong nPos
+ );
+
+ sal_uLong GetVisibleCount() const
+ { return pModel->GetVisibleCount( (SvListView*)this ); }
+
+ SvTreeListEntry* FirstVisible() const
+ { return pModel->FirstVisible(); }
+
+ SvTreeListEntry* NextVisible( SvTreeListEntry* pEntry, sal_uInt16* pDepth=0 ) const
+ { return pModel->NextVisible(this,pEntry,pDepth); }
+
+ SvTreeListEntry* PrevVisible( SvTreeListEntry* pEntry, sal_uInt16* pDepth=0 ) const
+ { return pModel->PrevVisible(this,pEntry,pDepth); }
+
+ SvTreeListEntry* LastVisible( sal_uInt16* pDepth=0 ) const
+ { return pModel->LastVisible(this,pDepth); }
+
+ SvTreeListEntry* NextVisible( SvTreeListEntry* pEntry, sal_uInt16& rDelta ) const
+ { return pModel->NextVisible(this,pEntry,rDelta); }
+
+ SvTreeListEntry* PrevVisible( SvTreeListEntry* pEntry, sal_uInt16& rDelta ) const
+ { return pModel->PrevVisible(this,pEntry,rDelta); }
+
+ sal_uLong GetSelectionCount() const
+ { return nSelectionCount; }
+
+ SvTreeListEntry* FirstSelected() const
+ { return pModel->FirstSelected(this); }
+
+ SvTreeListEntry* NextSelected( SvTreeListEntry* pEntry ) const
+ { return pModel->NextSelected(this,pEntry); }
+
+ SvTreeListEntry* PrevSelected( SvTreeListEntry* pEntry ) const
+ { return pModel->PrevSelected(this,pEntry); }
+
+ SvTreeListEntry* LastSelected() const
+ { return pModel->LastSelected(this); }
+ SvTreeListEntry* GetEntryAtAbsPos( sal_uLong nAbsPos ) const
+ { return pModel->GetEntryAtAbsPos(nAbsPos); }
+
+ SvTreeListEntry* GetEntryAtVisPos( sal_uLong nVisPos ) const
+ { return pModel->GetEntryAtVisPos((SvListView*)this,nVisPos); }
+
+ sal_uLong GetAbsPos( SvTreeListEntry* pEntry ) const
+ { return pModel->GetAbsPos(pEntry); }
+
+ sal_uLong GetVisiblePos( SvTreeListEntry* pEntry ) const
+ { return pModel->GetVisiblePos((SvListView*)this,pEntry); }
+
+ sal_uLong GetVisibleChildCount(SvTreeListEntry* pParent ) const
+ { return pModel->GetVisibleChildCount((SvListView*)this,pParent); }
+
+ sal_uLong GetChildSelectionCount( SvTreeListEntry* pParent ) const
+ { return pModel->GetChildSelectionCount((SvListView*)this,pParent); }
+
+ void Expand( SvTreeListEntry* pParent )
+ { pModel->Expand((SvListView*)this,pParent); }
+
+ void Collapse( SvTreeListEntry* pParent )
+ { pModel->Collapse((SvListView*)this,pParent); }
+
+ sal_Bool Select( SvTreeListEntry* pEntry, sal_Bool bSelect=sal_True )
+ { return pModel->Select((SvListView*)this,pEntry,bSelect); }
+
+ // Does not call the Select Handler
+ virtual void SelectAll( sal_Bool bSelect, sal_Bool )
+ { pModel->SelectAll((SvListView*)this, bSelect); }
+
+ sal_Bool IsEntryVisible( SvTreeListEntry* pEntry ) const
+ { return pModel->IsEntryVisible((SvListView*)this,pEntry); }
+
+ sal_Bool IsExpanded( SvTreeListEntry* pEntry ) const;
+ sal_Bool IsSelected( SvTreeListEntry* pEntry ) const;
+ void SetEntryFocus( SvTreeListEntry* pEntry, sal_Bool bFocus );
+ const SvViewDataEntry* GetViewData( const SvTreeListEntry* pEntry ) const;
+ SvViewDataEntry* GetViewData( SvTreeListEntry* pEntry );
+ sal_Bool HasViewData() const
+ { return maDataTable.size() > 1; } // There's always a ROOT
+
+ virtual SvViewDataEntry* CreateViewData( SvTreeListEntry* pEntry );
+ virtual void InitViewData( SvViewDataEntry*, SvTreeListEntry* pEntry );
+
+ virtual void ModelHasCleared();
+ virtual void ModelHasInserted( SvTreeListEntry* pEntry );
+ virtual void ModelHasInsertedTree( SvTreeListEntry* pEntry );
+ virtual void ModelIsMoving(
+ SvTreeListEntry* pSource,
+ SvTreeListEntry* pTargetParent,
+ sal_uLong nPos
+ );
+ virtual void ModelHasMoved( SvTreeListEntry* pSource );
+ virtual void ModelIsRemoving( SvTreeListEntry* pEntry );
+ virtual void ModelHasRemoved( SvTreeListEntry* pEntry );
+ virtual void ModelHasEntryInvalidated( SvTreeListEntry* pEntry );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/treelistbox.hxx b/include/svtools/treelistbox.hxx
new file mode 100644
index 000000000000..180050560bf9
--- /dev/null
+++ b/include/svtools/treelistbox.hxx
@@ -0,0 +1,806 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __SVTOOLS_TREELISTBOX_HXX__
+#define __SVTOOLS_TREELISTBOX_HXX__
+
+#include "svtools/svtdllapi.h"
+
+#include <deque>
+#include <vector>
+
+#include <vcl/ctrl.hxx>
+#include <vcl/seleng.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/timer.hxx>
+#include <vcl/accel.hxx>
+#include <vcl/mnemonicengine.hxx>
+#include <vcl/quickselectionengine.hxx>
+#include <vcl/image.hxx>
+#include <tools/gen.hxx>
+#include <tools/contnr.hxx>
+#include <svtools/treelist.hxx>
+#include <svtools/transfer.hxx>
+
+class Application;
+class SvTreeListBox;
+class SvTreeListEntry;
+struct SvViewDataItem;
+class SvViewDataEntry;
+class SvInplaceEdit2;
+class SvLBoxString;
+class SvLBoxButton;
+class SvLBoxContextBmp;
+class SvLBoxBmp;
+class SvImpLBox;
+class SvLBoxButtonData;
+struct SvLBoxDDInfo;
+
+namespace utl {
+ class AccessibleStateSetHelper;
+}
+
+enum SvLBoxButtonKind
+{
+ SvLBoxButtonKind_enabledCheckbox,
+ SvLBoxButtonKind_disabledCheckbox,
+ SvLBoxButtonKind_staticImage
+};
+
+enum SvButtonState { SV_BUTTON_UNCHECKED, SV_BUTTON_CHECKED, SV_BUTTON_TRISTATE };
+
+// *********************************************************************
+// *************************** Tabulators ******************************
+// *********************************************************************
+
+#define SV_LBOXTAB_DYNAMIC 0x0001 // Item's output column changes according to the Child Depth
+#define SV_LBOXTAB_ADJUST_RIGHT 0x0002 // Item's right margin at the tabulator
+#define SV_LBOXTAB_ADJUST_LEFT 0x0004 // Left margin
+#define SV_LBOXTAB_ADJUST_CENTER 0x0008 // Center the item at the tabulator
+#define SV_LBOXTAB_ADJUST_NUMERIC 0x0010 // Decimal point at the tabulator (strings)
+
+// Is not supported anymore! The focus is now controlled by selection!
+#define SV_LBOXTAB_SHOW_FOCUS 0x0020 // Visualize focus
+
+#define SV_LBOXTAB_SHOW_SELECTION 0x0040 // Visualize selection state
+ // Item needs to be able to return the surrounding polygon (D'n'D cursor)
+#define SV_LBOXTAB_EDITABLE 0x0100 // Item editable at the tabulator
+#define SV_LBOXTAB_PUSHABLE 0x0200 // Item acts like a Button
+#define SV_LBOXTAB_INV_ALWAYS 0x0400 // Always delete the background
+#define SV_LBOXTAB_FORCE 0x0800 // Switch off the default calculation of the first tabulator
+ // (on which Abo Tabpage/Extras/Option/Customize, etc. rely on)
+ // The first tab's position corresponds precisely to the Flags set
+ // and column widths
+
+#define SV_TAB_BORDER 8
+
+#define SV_ENTRYHEIGHTOFFS_PIXEL 2
+
+#define TREEFLAG_CHKBTN 0x0001
+#define TREEFLAG_USESEL 0x0002
+#define TREEFLAG_MANINS 0x0004
+#define TREEFLAG_RECALCTABS 0x0008
+
+typedef sal_Int64 ExtendedWinBits;
+
+// disable the behavior of automatically selecting a "CurEntry" upon painting the control
+#define EWB_NO_AUTO_CURENTRY 0x00000001
+
+#define SV_ITEM_ID_LBOXSTRING 1
+#define SV_ITEM_ID_LBOXBMP 2
+#define SV_ITEM_ID_LBOXBUTTON 3
+#define SV_ITEM_ID_LBOXCONTEXTBMP 4
+
+class SvLBoxTab
+{
+ long nPos;
+ void* pUserData;
+public:
+ SvLBoxTab();
+ SvLBoxTab( long nPos, sal_uInt16 nFlags=SV_LBOXTAB_ADJUST_LEFT );
+ SvLBoxTab( const SvLBoxTab& );
+ ~SvLBoxTab();
+
+ sal_uInt16 nFlags;
+
+ void SetUserData( void* pPtr ) { pUserData = pPtr; }
+ void* GetUserData() const { return pUserData; }
+ sal_Bool IsDynamic() const { return (sal_Bool)((nFlags & SV_LBOXTAB_DYNAMIC)!=0); }
+ void SetPos( long nNewPos) { nPos = nNewPos; }
+ long GetPos() const { return nPos; }
+ long CalcOffset( long nItemLength, long nTabWidth );
+ // long CalcOffset( const String&, const OutputDevice& );
+ sal_Bool IsEditable() const { return (sal_Bool)((nFlags & SV_LBOXTAB_EDITABLE)!=0); }
+ sal_Bool IsPushable() const { return (sal_Bool)((nFlags & SV_LBOXTAB_PUSHABLE)!=0); }
+};
+
+// *********************************************************************
+// ****************************** Items ********************************
+// *********************************************************************
+
+class SVT_DLLPUBLIC SvLBoxItem
+{
+public:
+ SvLBoxItem( SvTreeListEntry*, sal_uInt16 nFlags );
+ SvLBoxItem();
+ virtual ~SvLBoxItem();
+ virtual sal_uInt16 GetType() const = 0;
+ const Size& GetSize(const SvTreeListBox* pView, const SvTreeListEntry* pEntry) const;
+ const Size& GetSize(const SvViewDataEntry* pData, sal_uInt16 nItemPos) const;
+
+ virtual void Paint(
+ const Point& rPos, SvTreeListBox& rOutDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) = 0;
+
+ virtual void InitViewData( SvTreeListBox* pView, SvTreeListEntry* pEntry,
+ // If != 0: this Pointer must be used!
+ // If == 0: it needs to be retrieved via the View
+ SvViewDataItem* pViewData = 0) = 0;
+ virtual SvLBoxItem* Create() const = 0;
+ // View-dependent data is not cloned
+ virtual void Clone( SvLBoxItem* pSource ) = 0;
+};
+
+inline SvLBoxItem* new_clone(const SvLBoxItem& rSrc)
+{
+ SvLBoxItem* p = rSrc.Create();
+ p->Clone(const_cast<SvLBoxItem*>(&rSrc));
+ return p;
+}
+
+inline void delete_clone(const SvLBoxItem* p)
+{
+ delete p;
+}
+
+// *********************************************************************
+// ****************************** SvTreeListBox ************************
+// *********************************************************************
+
+#define WB_FORCE_SELECTION ((WinBits)0x8000)
+
+#define DragDropMode sal_uInt16
+#define SV_DRAGDROP_NONE (DragDropMode)0x0000
+#define SV_DRAGDROP_CTRL_MOVE (DragDropMode)0x0001
+#define SV_DRAGDROP_CTRL_COPY (DragDropMode)0x0002
+#define SV_DRAGDROP_APP_MOVE (DragDropMode)0x0004
+#define SV_DRAGDROP_APP_COPY (DragDropMode)0x0008
+#define SV_DRAGDROP_APP_DROP (DragDropMode)0x0010
+// Entries may be dropped via the uppermost Entry
+// The DropTarget is 0 in that case
+#define SV_DRAGDROP_ENABLE_TOP (DragDropMode)0x0020
+
+#define SVLISTBOX_ID_LBOX 0 // for SvTreeListBox::GetType()
+
+#define SVLBOX_IN_EDT 0x0001
+#define SVLBOX_EDT_ENABLED 0x0002
+#define SVLBOX_IS_EXPANDING 0x0004
+#define SVLBOX_IS_TRAVELSELECT 0x0008
+#define SVLBOX_TARGEMPH_VIS 0x0010
+#define SVLBOX_EDTEND_CALLED 0x0020
+
+struct SvTreeListBoxImpl;
+
+class SVT_DLLPUBLIC SvTreeListBox
+ :public Control
+ ,public SvListView
+ ,public DropTargetHelper
+ ,public DragSourceHelper
+ ,public ::vcl::IMnemonicEntryList
+ ,public ::vcl::ISearchableStringList
+{
+ friend class SvImpLBox;
+ friend class TreeControlPeer;
+
+ SvTreeListBoxImpl* mpImpl;
+ SvImpLBox* pImp;
+ Link aCheckButtonHdl;
+ Link aScrolledHdl;
+ Link aExpandedHdl;
+ Link aExpandingHdl;
+ Link aSelectHdl;
+ Link aDeselectHdl;
+
+ Accelerator aInpEditAcc;
+ Image aPrevInsertedExpBmp;
+ Image aPrevInsertedColBmp;
+ Image aCurInsertedExpBmp;
+ Image aCurInsertedColBmp;
+
+ short nContextBmpWidthMax;
+ short nEntryHeight;
+ short nEntryHeightOffs;
+ short nIndent;
+ short nFocusWidth;
+ sal_uInt16 nFirstSelTab;
+ sal_uInt16 nLastSelTab;
+ long mnCheckboxItemWidth;
+ bool mbContextBmpExpanded;
+
+ SvTreeListEntry* pHdlEntry;
+ SvLBoxItem* pHdlItem;
+
+ DragDropMode nDragDropMode;
+ DragDropMode nOldDragMode;
+ SelectionMode eSelMode;
+ sal_Int8 nDragOptions;
+
+ SvTreeListEntry* pEdEntry;
+ SvLBoxItem* pEdItem;
+
+protected:
+ Link aDoubleClickHdl;
+ SvTreeListEntry* pTargetEntry;
+ SvLBoxButtonData* pCheckButtonData;
+ std::vector<SvLBoxTab*> aTabs;
+ sal_uInt16 nTreeFlags;
+ sal_uInt16 nImpFlags;
+ // Move/CopySelection: Position of the current Entry in SelectionList
+ sal_uInt16 nCurEntrySelPos;
+
+private:
+ void SetBaseModel(SvTreeList* pNewModel);
+
+ DECL_DLLPRIVATE_LINK( CheckButtonClick, SvLBoxButtonData * );
+ DECL_DLLPRIVATE_LINK( TextEditEndedHdl_Impl, void * );
+ // Handler that is called by TreeList to clone an Entry
+ DECL_DLLPRIVATE_LINK( CloneHdl_Impl, SvTreeListEntry* );
+
+ // Handler and methods for Drag - finished handler.
+ // The Handle retrieved by GetDragFinishedHdl can be set on the
+ // TransferDataContainer. This link is a callback for the DragFinished
+ // call. The AddBox method is called from the GetDragFinishedHdl() and the
+ // remove is called in the link callback and in the dtor. So it can't be
+ // called for a deleted object.
+ SVT_DLLPRIVATE static void AddBoxToDDList_Impl( const SvTreeListBox& rB );
+ SVT_DLLPRIVATE static void RemoveBoxFromDDList_Impl( const SvTreeListBox& rB );
+ DECL_DLLPRIVATE_STATIC_LINK( SvTreeListBox, DragFinishHdl_Impl, sal_Int8* );
+
+protected:
+
+ sal_Bool CheckDragAndDropMode( SvTreeListBox* pSource, sal_Int8 );
+ void ImplShowTargetEmphasis( SvTreeListEntry* pEntry, sal_Bool bShow);
+ void EnableSelectionAsDropTarget( sal_Bool bEnable = sal_True,
+ sal_Bool bWithChildren = sal_True );
+ // Standard impl returns 0; must be overloaded by derived classes which support D'n'D
+ using Window::GetDropTarget;
+ virtual SvTreeListEntry* GetDropTarget( const Point& );
+
+ // Put View-specific data into the Dragserver
+ // Is called at the SourceView (in BeginDrag Handler)
+ virtual void WriteDragServerInfo( const Point&, SvLBoxDDInfo* );
+ // Is called at the TargetView (in Drop Handler)
+ virtual void ReadDragServerInfo( const Point&,SvLBoxDDInfo* );
+
+ // Invalidate children on enable/disable
+ virtual void StateChanged( StateChangedType eType );
+
+ virtual sal_uLong Insert( SvTreeListEntry* pEnt,SvTreeListEntry* pPar,sal_uLong nPos=LIST_APPEND);
+ virtual sal_uLong Insert( SvTreeListEntry* pEntry,sal_uLong nRootPos = LIST_APPEND );
+
+ // In-place editing
+ SvInplaceEdit2* pEdCtrl;
+ void EditText( const String&, const Rectangle&,const Selection&);
+ void EditText( const String&, const Rectangle&,const Selection&, sal_Bool bMulti);
+ void EditTextMultiLine( const String&, const Rectangle&,const Selection&);
+ void CancelTextEditing();
+ sal_Bool EditingCanceled() const;
+ bool IsEmptyTextAllowed() const;
+
+ // Return value must be derived from SvViewDataEntry!
+ virtual SvViewDataEntry* CreateViewData( SvTreeListEntry* );
+ // InitViewData is called right after CreateViewData
+ // The Entry is has not yet been added to the View in InitViewData!
+ virtual void InitViewData( SvViewDataEntry*, SvTreeListEntry* pEntry );
+ // Calls InitViewData for all Items
+ void RecalcViewData();
+ // Callback of RecalcViewData
+ virtual void ViewDataInitialized( SvTreeListEntry* );
+
+ // Handler and methods for Drag - finished handler. This link can be set
+ // to the TransferDataContainer. The AddBox/RemoveBox methods must be
+ // called before the StartDrag call.
+ // The Remove will be called from the handler, which then calls DragFinish.
+ // The Remove is also called in the DTOR of the SvTreeListBox -
+ // so it can't be called for a deleted object.
+ Link GetDragFinishedHdl() const;
+
+ // For asynchronous D'n'D
+ sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt, SvTreeListBox* pSourceView );
+
+ void OnCurrentEntryChanged();
+
+ // IMnemonicEntryList
+ virtual const void* FirstSearchEntry( String& _rEntryText ) const;
+ virtual const void* NextSearchEntry( const void* _pCurrentSearchEntry, String& _rEntryText ) const;
+ virtual void SelectSearchEntry( const void* _pEntry );
+ virtual void ExecuteSearchEntry( const void* _pEntry ) const;
+
+ // ISearchableStringList
+ virtual ::vcl::StringEntryIdentifier CurrentEntry( String& _out_entryText ) const;
+ virtual ::vcl::StringEntryIdentifier NextEntry( ::vcl::StringEntryIdentifier _currentEntry, String& _out_entryText ) const;
+ virtual void SelectEntry( ::vcl::StringEntryIdentifier _entry );
+
+public:
+
+ SvTreeListBox( Window* pParent, WinBits nWinStyle=0 );
+ SvTreeListBox( Window* pParent, const ResId& rResId );
+ virtual ~SvTreeListBox();
+
+ SvTreeList* GetModel() const { return pModel; }
+ using SvListView::SetModel;
+ void SetModel(SvTreeList* pNewModel);
+
+ sal_uLong GetEntryCount() const {return pModel->GetEntryCount();}
+ SvTreeListEntry* First() const { return pModel->First(); }
+ SvTreeListEntry* Next( SvTreeListEntry* pEntry, sal_uInt16* pDepth=0 ) const { return pModel->Next(pEntry,pDepth); }
+ SvTreeListEntry* Prev( SvTreeListEntry* pEntry, sal_uInt16* pDepth=0 ) const { return pModel->Prev(pEntry,pDepth); }
+ SvTreeListEntry* Last() const { return pModel->Last(); }
+
+ SvTreeListEntry* FirstChild( SvTreeListEntry* pParent ) const;
+ SvTreeListEntry* NextSibling( SvTreeListEntry* pEntry ) const;
+ SvTreeListEntry* PrevSibling( SvTreeListEntry* pEntry ) const;
+
+ sal_Bool CopySelection( SvTreeListBox* pSource, SvTreeListEntry* pTarget );
+ sal_Bool MoveSelection( SvTreeListBox* pSource, SvTreeListEntry* pTarget );
+ sal_Bool MoveSelectionCopyFallbackPossible( SvTreeListBox* pSource, SvTreeListEntry* pTarget, sal_Bool bAllowCopyFallback );
+ void RemoveSelection();
+
+ DragDropMode GetDragDropMode() const { return nDragDropMode; }
+ SelectionMode GetSelectionMode() const { return eSelMode; }
+
+ // pParent == 0 -> Root level
+ SvTreeListEntry* GetEntry( SvTreeListEntry* pParent, sal_uLong nPos ) const;
+ SvTreeListEntry* GetEntry( sal_uLong nRootPos ) const;
+
+ SvTreeListEntry* GetEntryFromPath( const ::std::deque< sal_Int32 >& _rPath ) const;
+ void FillEntryPath( SvTreeListEntry* pEntry, ::std::deque< sal_Int32 >& _rPath ) const;
+
+ using Window::GetParent;
+ const SvTreeListEntry* GetParent( const SvTreeListEntry* pEntry ) const;
+ SvTreeListEntry* GetParent( SvTreeListEntry* pEntry ) const;
+ SvTreeListEntry* GetRootLevelParent(SvTreeListEntry* pEntry ) const;
+
+ using Window::GetChildCount;
+ sal_uLong GetChildCount( SvTreeListEntry* pParent ) const;
+ sal_uLong GetLevelChildCount( SvTreeListEntry* pParent ) const;
+
+ SvViewDataEntry* GetViewDataEntry( SvTreeListEntry* pEntry ) const;
+ SvViewDataItem* GetViewDataItem(SvTreeListEntry*, SvLBoxItem*);
+ const SvViewDataItem* GetViewDataItem(const SvTreeListEntry*, const SvLBoxItem*) const;
+
+ bool IsInplaceEditingEnabled() const { return ((nImpFlags & SVLBOX_EDT_ENABLED) != 0); }
+ bool IsEditingActive() const { return ((nImpFlags & SVLBOX_IN_EDT) != 0); }
+ void EndEditing( bool bCancel = false );
+ void ForbidEmptyText();
+
+ void Clear();
+
+ /** Enables or disables mnemonic characters in the entry texts.
+
+ If mnemonics are enabled, then entries are selected and made current when
+ there mnemonic character is pressed. If there are multiple entries with the
+ same mnemonic, the selection cycles between them.
+
+ Entries with an collapsed ancestor are not included in the calculation of
+ mnemonics. That is, if you press the accelerator key of an invisible
+ entry, then this entry is *not* selected.
+
+ Be aware that enabling mnemonics gets more expensive as you add to the list.
+ */
+ void EnableEntryMnemonics( bool _bEnable = true );
+ bool IsEntryMnemonicsEnabled() const;
+
+ /** Handles the given key event.
+
+ At the moment this merely checks for accelerator keys, if entry mnemonics
+ are enabled.
+
+ This method may come in handy if you want to use keyboard acceleration
+ while the control does not have the focus.
+
+ If the key event describes the pressing of a shortcut for an entry,
+ then SelectSearchEntry resp. ExecuteSearchEntry are called.
+
+ @see IMnemonicEntryList
+ @see MnemonicEngine
+
+ @return
+ <TRUE/> if the event has been consumed, <FALSE/> otherwise.
+ */
+ bool HandleKeyInput( const KeyEvent& rKEvt );
+
+ void SetSelectHdl( const Link& rNewHdl ) {aSelectHdl=rNewHdl; }
+ void SetDeselectHdl( const Link& rNewHdl ) {aDeselectHdl=rNewHdl; }
+ void SetDoubleClickHdl(const Link& rNewHdl) {aDoubleClickHdl=rNewHdl;}
+ const Link& GetSelectHdl() const { return aSelectHdl; }
+ const Link& GetDeselectHdl() const { return aDeselectHdl; }
+ const Link& GetDoubleClickHdl() const { return aDoubleClickHdl; }
+ void SetExpandingHdl(const Link& rNewHdl){aExpandingHdl=rNewHdl;}
+ void SetExpandedHdl(const Link& rNewHdl){aExpandedHdl=rNewHdl;}
+ const Link& GetExpandingHdl() const { return aExpandingHdl; }
+
+ virtual void ExpandedHdl();
+ virtual long ExpandingHdl();
+ virtual void SelectHdl();
+ virtual void DeselectHdl();
+ virtual sal_Bool DoubleClickHdl();
+ sal_Bool IsTravelSelect() const { return (sal_Bool)((nImpFlags&SVLBOX_IS_TRAVELSELECT)!=0);}
+ SvTreeListEntry* GetHdlEntry() const { return pHdlEntry; }
+ SvLBoxItem* GetHdlItem() const;
+
+ // Is called for an Entry that gets expanded with the Flag
+ // ENTRYFLAG_CHILDREN_ON_DEMAND set.
+ virtual void RequestingChildren( SvTreeListEntry* pParent );
+
+ // Drag & Drop
+ // New D'n'D API
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
+ virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
+ virtual DragDropMode NotifyStartDrag( TransferDataContainer& rData,
+ SvTreeListEntry* );
+ virtual void DragFinished( sal_Int8 nDropAction );
+ virtual sal_Bool NotifyAcceptDrop( SvTreeListEntry* );
+
+ void SetDragOptions( sal_Int8 nOptions ) { nDragOptions = nOptions; }
+ sal_Int8 GetDragOptions() const { return nDragOptions; }
+
+ SvTreeListBox* GetSourceView() const;
+
+ virtual void NotifyRemoving( SvTreeListEntry* );
+ virtual SvTreeListEntry* CloneEntry( SvTreeListEntry* pSource );
+ virtual SvTreeListEntry* CreateEntry() const; // To create new Entries
+
+ // Return value: sal_True == Ok, sal_False == Cancel
+ virtual sal_Bool NotifyMoving(
+ SvTreeListEntry* pTarget, // D'n'D DropPosition in this->GetModel()
+ SvTreeListEntry* pEntry, // Entry to be moved from GetSourceListBox()->GetModel()
+ SvTreeListEntry*& rpNewParent, // New TargetParent
+ sal_uLong& rNewChildPos); // The TargetParent's position in Childlist
+
+ // Return value: sal_True == Ok, sal_False == Cancel
+ virtual sal_Bool NotifyCopying(
+ SvTreeListEntry* pTarget, // D'n'D DropPosition in this->GetModel()
+ SvTreeListEntry* pEntry, // Entry to be copied from GetSourceListBox()->GetModel()
+ SvTreeListEntry*& rpNewParent, // New TargetParent
+ sal_uLong& rNewChildPos); // The TargetParent's position in Childlist
+
+ // ACCESSIBILITY ==========================================================
+
+ /** Creates and returns the accessible object of the Box. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > CreateAccessible();
+
+ /** Fills the StateSet with all states (except DEFUNC, done by the accessible object). */
+ virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& rStateSet ) const;
+
+ /** Fills the StateSet of one entry. */
+ virtual void FillAccessibleEntryStateSet( SvTreeListEntry* pEntry, ::utl::AccessibleStateSetHelper& rStateSet ) const;
+
+ /** Calculate and return the bounding rectangle of an entry.
+ @param pEntry
+ The entry.
+ @return The bounding rectangle of an entry. */
+ virtual Rectangle GetBoundingRect( SvTreeListEntry* pEntry );
+
+ /** Enables, that one cell of a tablistbox entry can be focused */
+ void EnableCellFocus();
+
+protected:
+ using SvListView::Expand;
+ using SvListView::Collapse;
+ using SvListView::Select;
+ using SvListView::SelectAll;
+
+ SVT_DLLPRIVATE short GetHeightOffset( const Image& rBmp, Size& rLogicSize);
+ SVT_DLLPRIVATE short GetHeightOffset( const Font& rFont, Size& rLogicSize);
+
+ SVT_DLLPRIVATE void SetEntryHeight( SvTreeListEntry* pEntry );
+ SVT_DLLPRIVATE void AdjustEntryHeight( const Image& rBmp );
+ SVT_DLLPRIVATE void AdjustEntryHeight( const Font& rFont );
+
+ SVT_DLLPRIVATE void ImpEntryInserted( SvTreeListEntry* pEntry );
+ SVT_DLLPRIVATE long PaintEntry1( SvTreeListEntry*, long nLine,
+ sal_uInt16 nTabFlagMask=0xffff,
+ sal_Bool bHasClipRegion=sal_False );
+
+ SVT_DLLPRIVATE void InitTreeView();
+ SVT_DLLPRIVATE SvLBoxItem* GetItem_Impl( SvTreeListEntry*, long nX, SvLBoxTab** ppTab,
+ sal_uInt16 nEmptyWidth );
+ SVT_DLLPRIVATE void ImplInitStyle();
+
+protected:
+
+ void EditItemText( SvTreeListEntry* pEntry, SvLBoxString* pItem,
+ const Selection& );
+ void EditedText( const XubString& );
+
+ // Recalculate all tabs depending on TreeListStyle and Bitmap sizes
+ // Is called automatically when inserting/changing Bitmaps, changing the Model etc.
+ virtual void SetTabs();
+ void SetTabs_Impl();
+ void AddTab( long nPos,sal_uInt16 nFlags=SV_LBOXTAB_ADJUST_LEFT,
+ void* pUserData = 0 );
+ sal_uInt16 TabCount() const { return aTabs.size(); }
+ SvLBoxTab* GetFirstDynamicTab() const;
+ SvLBoxTab* GetFirstDynamicTab( sal_uInt16& rTabPos ) const;
+ SvLBoxTab* GetFirstTab( sal_uInt16 nFlagMask, sal_uInt16& rTabPos );
+ SvLBoxTab* GetLastTab( sal_uInt16 nFlagMask, sal_uInt16& rTabPos );
+ SvLBoxTab* GetTab( SvTreeListEntry*, SvLBoxItem* ) const;
+ void ClearTabList();
+
+ virtual void InitEntry(SvTreeListEntry*, const OUString&, const Image&, const Image&, SvLBoxButtonKind);
+
+ virtual void NotifyBeginScroll();
+ virtual void NotifyEndScroll();
+ // nLines == 0 => horizontal Scrolling
+ virtual void NotifyScrolling( long nLines );
+ virtual void NotifyScrolled();
+ void SetScrolledHdl( const Link& rLink ) { aScrolledHdl = rLink; }
+ const Link& GetScrolledHdl() const { return aScrolledHdl; }
+ long GetXOffset() const { return GetMapMode().GetOrigin().X(); }
+
+ // Is called _before_ Areas in the Control are invalidated.
+ // This can be used to hide Elements which are painted from outside into the Control
+ virtual void NotifyInvalidating();
+
+ virtual void Command( const CommandEvent& rCEvt );
+
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+ virtual void CursorMoved( SvTreeListEntry* pNewCursor );
+ virtual void PreparePaint( SvTreeListEntry* );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ void InitSettings(sal_Bool bFont,sal_Bool bForeground,sal_Bool bBackground);
+ sal_Bool IsCellFocusEnabled() const;
+ bool SetCurrentTabPos( sal_uInt16 _nNewPos );
+ sal_uInt16 GetCurrentTabPos() const;
+ void CallImplEventListeners(sal_uLong nEvent, void* pData);
+
+ void ImplEditEntry( SvTreeListEntry* pEntry );
+
+ sal_Bool AreChildrenTransient() const;
+ void SetChildrenNotTransient();
+
+public:
+
+ void SetExtendedWinBits( ExtendedWinBits _nBits );
+
+ void DisconnectFromModel();
+
+ void EnableCheckButton( SvLBoxButtonData* );
+ void SetCheckButtonData( SvLBoxButtonData* );
+ void SetNodeBitmaps( const Image& rCollapsedNodeBmp, const Image& rExpandedNodeBmp );
+
+ /** Returns the default image which clients should use for expanded nodes, to have a consistent user
+ interface experience in the whole product.
+ */
+ static const Image& GetDefaultExpandedNodeImage( );
+
+ /** Returns the default image which clients should use for expanded nodes, to have a consistent user
+ interface experience in the whole product.
+ */
+ static const Image& GetDefaultCollapsedNodeImage( );
+
+ /** Sets default bitmaps for collapsed and expanded nodes.
+ */
+ inline void SetNodeDefaultImages( )
+ {
+ SetNodeBitmaps(
+ GetDefaultCollapsedNodeImage( ),
+ GetDefaultExpandedNodeImage( )
+ );
+ }
+
+ virtual SvTreeListEntry* InsertEntry( const XubString& rText, SvTreeListEntry* pParent = 0,
+ sal_Bool bChildrenOnDemand = sal_False,
+ sal_uLong nPos=LIST_APPEND, void* pUserData = 0,
+ SvLBoxButtonKind eButtonKind = SvLBoxButtonKind_enabledCheckbox );
+
+ virtual SvTreeListEntry* InsertEntry( const XubString& rText,
+ const Image& rExpandedEntryBmp,
+ const Image& rCollapsedEntryBmp,
+ SvTreeListEntry* pParent = 0,
+ sal_Bool bChildrenOnDemand = sal_False,
+ sal_uLong nPos = LIST_APPEND, void* pUserData = 0,
+ SvLBoxButtonKind eButtonKind = SvLBoxButtonKind_enabledCheckbox );
+
+ const Image& GetDefaultExpandedEntryBmp( ) const;
+ const Image& GetDefaultCollapsedEntryBmp( ) const;
+
+ void SetDefaultExpandedEntryBmp( const Image& rBmp );
+ void SetDefaultCollapsedEntryBmp( const Image& rBmp );
+
+ void SetCheckButtonState( SvTreeListEntry*, SvButtonState );
+ SvButtonState GetCheckButtonState( SvTreeListEntry* ) const;
+
+ void SetEntryText(SvTreeListEntry*, const XubString& );
+ void SetExpandedEntryBmp( SvTreeListEntry* _pEntry, const Image& _rImage );
+ void SetCollapsedEntryBmp( SvTreeListEntry* _pEntry, const Image& _rImage );
+
+ virtual String GetEntryText( SvTreeListEntry* pEntry ) const;
+ String SearchEntryText( SvTreeListEntry* pEntry ) const;
+ const Image& GetExpandedEntryBmp(const SvTreeListEntry* _pEntry ) const;
+ const Image& GetCollapsedEntryBmp(const SvTreeListEntry* _pEntry ) const;
+
+ void SetCheckButtonHdl( const Link& rLink ) { aCheckButtonHdl=rLink; }
+ Link GetCheckButtonHdl() const { return aCheckButtonHdl; }
+ virtual void CheckButtonHdl();
+
+ void SetSublistOpenWithReturn( sal_Bool bMode = sal_True ); // open/close sublist with return/enter
+ void SetSublistOpenWithLeftRight( sal_Bool bMode = sal_True ); // open/close sublist with cursor left/right
+
+ void EnableInplaceEditing( bool bEnable );
+ // Edits the Entry's first StringItem, 0 == Cursor
+ void EditEntry( SvTreeListEntry* pEntry = NULL );
+ virtual sal_Bool EditingEntry( SvTreeListEntry* pEntry, Selection& );
+ virtual sal_Bool EditedEntry( SvTreeListEntry* pEntry, const OUString& rNewText );
+
+ virtual void Paint( const Rectangle& rRect );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void Resize();
+ virtual void GetFocus();
+ virtual void LoseFocus();
+ void SetUpdateMode( sal_Bool );
+
+ virtual void ModelHasCleared();
+ virtual void ModelHasInserted( SvTreeListEntry* pEntry );
+ virtual void ModelHasInsertedTree( SvTreeListEntry* pEntry );
+ virtual void ModelIsMoving(SvTreeListEntry* pSource,
+ SvTreeListEntry* pTargetParent, sal_uLong nChildPos );
+ virtual void ModelHasMoved(SvTreeListEntry* pSource );
+ virtual void ModelIsRemoving( SvTreeListEntry* pEntry );
+ virtual void ModelHasRemoved( SvTreeListEntry* pEntry );
+ void ModelHasEntryInvalidated( SvTreeListEntry* pEntry );
+
+ void ShowTargetEmphasis( SvTreeListEntry*, sal_Bool bShow );
+ void ScrollOutputArea( short nDeltaEntries );
+
+ short GetEntryHeight() const { return nEntryHeight; }
+ void SetEntryHeight( short nHeight, sal_Bool bAlways = sal_False );
+ Size GetOutputSizePixel() const;
+ short GetIndent() const { return nIndent; }
+ void SetIndent( short nIndent );
+ void SetSpaceBetweenEntries( short nSpace );
+ short GetSpaceBetweenEntries() const {return nEntryHeightOffs;}
+ Point GetEntryPosition( SvTreeListEntry* ) const;
+ void ShowEntry( SvTreeListEntry* ); // !!!OBSOLETE, use MakeVisible
+ void MakeVisible( SvTreeListEntry* pEntry );
+ void MakeVisible( SvTreeListEntry* pEntry, sal_Bool bMoveToTop );
+
+ void SetCollapsedNodeBmp( const Image& );
+ void SetExpandedNodeBmp( const Image& );
+ Image GetExpandedNodeBmp( ) const;
+
+ void SetFont( const Font& rFont );
+
+ using Window::SetCursor;
+ void SetCursor( SvTreeListEntry* pEntry, sal_Bool bForceNoSelect = sal_False );
+
+ SvTreeListEntry* GetEntry( const Point& rPos, sal_Bool bHit = sal_False ) const;
+
+ void PaintEntry( SvTreeListEntry* );
+ long PaintEntry( SvTreeListEntry*, long nLine,
+ sal_uInt16 nTabFlagMask=0xffff );
+ virtual Rectangle GetFocusRect( SvTreeListEntry*, long nLine );
+ // Respects indentation
+ virtual long GetTabPos( SvTreeListEntry*, SvLBoxTab* );
+ void InvalidateEntry( SvTreeListEntry* );
+ SvLBoxItem* GetItem( SvTreeListEntry*, long nX, SvLBoxTab** ppTab);
+ SvLBoxItem* GetItem( SvTreeListEntry*, long nX );
+
+ void SetDragDropMode( DragDropMode );
+ void SetSelectionMode( SelectionMode );
+
+ sal_Bool Expand( SvTreeListEntry* pParent );
+ sal_Bool Collapse( SvTreeListEntry* pParent );
+ sal_Bool Select( SvTreeListEntry* pEntry, sal_Bool bSelect=sal_True );
+ sal_uLong SelectChildren( SvTreeListEntry* pParent, sal_Bool bSelect );
+ virtual void SelectAll( sal_Bool bSelect, sal_Bool bPaint = sal_True );
+
+ void SetCurEntry( SvTreeListEntry* _pEntry );
+ SvTreeListEntry* GetCurEntry() const;
+
+ using Window::Invalidate;
+ virtual void Invalidate( sal_uInt16 nFlags = 0);
+ virtual void Invalidate( const Rectangle&, sal_uInt16 nFlags = 0 );
+
+ void SetHighlightRange(sal_uInt16 nFirstTab=0,sal_uInt16 nLastTab=0xffff);
+
+ // A Parent's Children are turned into Children of the Parent which comes next in hierarchy
+ void RemoveParentKeepChildren( SvTreeListEntry* pParent );
+
+ DECL_LINK( DefaultCompare, SvSortData* );
+ virtual void ModelNotification( sal_uInt16 nActionId, SvTreeListEntry* pEntry1,
+ SvTreeListEntry* pEntry2, sal_uLong nPos );
+
+ void EndSelection();
+ void RepaintScrollBars() const;
+ ScrollBar* GetVScroll();
+ ScrollBar* GetHScroll();
+ void EnableAsyncDrag( sal_Bool b );
+
+ SvTreeListEntry* GetFirstEntryInView() const;
+ SvTreeListEntry* GetNextEntryInView(SvTreeListEntry*) const;
+ SvTreeListEntry* GetLastEntryInView() const;
+ void ScrollToAbsPos( long nPos );
+
+ void ShowFocusRect( const SvTreeListEntry* pEntry );
+ void InitStartEntry();
+
+ virtual PopupMenu* CreateContextMenu( void );
+ virtual void ExcecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry );
+
+ void EnableContextMenuHandling( void );
+ void EnableContextMenuHandling( sal_Bool bEnable );
+ sal_Bool IsContextMenuHandlingEnabled( void ) const;
+
+ void EnableList( bool _bEnable );
+
+ long getPreferredDimensions(std::vector<long> &rWidths) const;
+
+ virtual Size GetOptimalSize() const;
+};
+
+#define SV_LBOX_DD_FORMAT "SV_LBOX_DD_FORMAT"
+struct SvLBoxDDInfo
+{
+ Application* pApp;
+ SvTreeListBox* pSource;
+ SvTreeListEntry* pDDStartEntry;
+ // Relative position in the Entry at DragBeginn (IconView)
+ long nMouseRelX,nMouseRelY;
+ sal_uLong nRes1,nRes2,nRes3,nRes4;
+};
+
+class SvInplaceEdit2
+{
+ Link aCallBackHdl;
+ Accelerator aAccReturn;
+ Accelerator aAccEscape;
+ Timer aTimer;
+ Edit* pEdit;
+ sal_Bool bCanceled;
+ sal_Bool bAlreadyInCallBack;
+
+ void CallCallBackHdl_Impl();
+ DECL_LINK( Timeout_Impl, void * );
+ DECL_LINK( ReturnHdl_Impl, void * );
+ DECL_LINK( EscapeHdl_Impl, void * );
+
+public:
+ SvInplaceEdit2( Window* pParent, const Point& rPos, const Size& rSize,
+ const String& rData, const Link& rNotifyEditEnd,
+ const Selection&, sal_Bool bMultiLine = sal_False );
+ ~SvInplaceEdit2();
+ sal_Bool KeyInput( const KeyEvent& rKEvt );
+ void LoseFocus();
+ sal_Bool EditingCanceled() const { return bCanceled; }
+ OUString GetText() const;
+ String GetSavedValue() const;
+ void StopEditing( sal_Bool bCancel = sal_False );
+ void Hide();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/treelistentries.hxx b/include/svtools/treelistentries.hxx
new file mode 100755
index 000000000000..d52d09aac107
--- /dev/null
+++ b/include/svtools/treelistentries.hxx
@@ -0,0 +1,20 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef __SVTOOLS_TREELISTENTRIES_HXX__
+#define __SVTOOLS_TREELISTENTRIES_HXX__
+
+#include <boost/ptr_container/ptr_vector.hpp>
+
+class SvTreeListEntry;
+typedef boost::ptr_vector<SvTreeListEntry> SvTreeListEntries;
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/treelistentry.hxx b/include/svtools/treelistentry.hxx
new file mode 100644
index 000000000000..dfea2651eb0e
--- /dev/null
+++ b/include/svtools/treelistentry.hxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __SVTOOLS_TREELISTENTRY_HXX__
+#define __SVTOOLS_TREELISTENTRY_HXX__
+
+#include "svtdllapi.h"
+#include "tools/solar.h"
+#include "treelistbox.hxx"
+#include "treelistentries.hxx"
+
+#include <boost/ptr_container/ptr_vector.hpp>
+
+// Flags, die am Model haengen
+#define SV_ENTRYFLAG_CHILDREN_ON_DEMAND 0x0001
+#define SV_ENTRYFLAG_DISABLE_DROP 0x0002
+#define SV_ENTRYFLAG_IN_USE 0x0004
+// wird gesetzt, wenn RequestingChildren keine Children gestzt hat
+#define SV_ENTRYFLAG_NO_NODEBMP 0x0008
+// Eintrag hatte oder hat Kinder
+#define SV_ENTRYFLAG_HAD_CHILDREN 0x0010
+
+#define SV_ENTRYFLAG_USER_FLAGS 0xF000
+#define SV_ENTRYFLAG_SEMITRANSPARENT 0x8000 // draw semi-transparent entry bitmaps
+
+
+class SVT_DLLPUBLIC SvTreeListEntry
+{
+ friend class SvTreeList;
+ friend class SvListView;
+ friend class SvTreeListBox;
+
+ typedef boost::ptr_vector<SvLBoxItem> ItemsType;
+
+ SvTreeListEntry* pParent;
+ SvTreeListEntries maChildren;
+ sal_uLong nAbsPos;
+ sal_uLong nListPos;
+ ItemsType maItems;
+ void* pUserData;
+ sal_uInt16 nEntryFlags;
+
+private:
+ void ClearChildren();
+ void SetListPositions();
+ void InvalidateChildrensListPositions();
+
+public:
+ static size_t ITEM_NOT_FOUND;
+
+ SvTreeListEntry();
+ SvTreeListEntry(const SvTreeListEntry& r);
+ virtual ~SvTreeListEntry();
+
+ bool HasChildren() const;
+ bool HasChildListPos() const;
+ sal_uLong GetChildListPos() const;
+
+ SvTreeListEntries& GetChildEntries();
+ const SvTreeListEntries& GetChildEntries() const;
+
+ void Clone(SvTreeListEntry* pSource);
+
+ size_t ItemCount() const;
+
+ // DARF NUR GERUFEN WERDEN, WENN DER EINTRAG NOCH NICHT IM MODEL
+ // EINGEFUEGT IST, DA SONST FUER DAS ITEM KEINE VIEW-ABHAENGIGEN
+ // DATEN ALLOZIERT WERDEN!
+ void AddItem( SvLBoxItem* pItem );
+ void ReplaceItem( SvLBoxItem* pNewItem, size_t nPos );
+ const SvLBoxItem* GetItem( size_t nPos ) const;
+ SvLBoxItem* GetItem( size_t nPos );
+ const SvLBoxItem* GetFirstItem( sal_uInt16 nId ) const;
+ SvLBoxItem* GetFirstItem( sal_uInt16 nId );
+ size_t GetPos( const SvLBoxItem* pItem ) const;
+ void* GetUserData() const;
+ void SetUserData( void* pPtr );
+ void EnableChildrenOnDemand( bool bEnable=true );
+ bool HasChildrenOnDemand() const;
+ bool HasInUseEmphasis() const;
+
+ sal_uInt16 GetFlags() const;
+ void SetFlags( sal_uInt16 nFlags );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/unitconv.hxx b/include/svtools/unitconv.hxx
new file mode 100644
index 000000000000..637f575eb9ee
--- /dev/null
+++ b/include/svtools/unitconv.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVT_UNITCONV_HXX
+#define _SVT_UNITCONV_HXX
+
+#include <vcl/field.hxx>
+#include "svtools/svtdllapi.h"
+#include <svl/poolitem.hxx>
+
+// macro -----------------------------------------------------------------
+
+// typedef ---------------------------------------------------------------
+
+typedef long (*FUNC_CONVERT)(long);
+
+// Functions -------------------------------------------------------------
+
+SVT_DLLPUBLIC void SetFieldUnit( MetricField& rCtrl, FieldUnit eUnit, sal_Bool bAll = sal_False );
+SVT_DLLPUBLIC void SetFieldUnit( MetricBox& rCtrl, FieldUnit eUnit, sal_Bool bAll = sal_False );
+
+SVT_DLLPUBLIC long CalcToUnit( float nIn, SfxMapUnit eUnit );
+SVT_DLLPUBLIC long CalcToPoint( long nIn, SfxMapUnit eUnit, sal_uInt16 nFaktor );
+
+SVT_DLLPUBLIC long ItemToControl( long nIn, SfxMapUnit eItem, SfxFieldUnit eCtrl );
+SVT_DLLPUBLIC long ControlToItem( long nIn, SfxFieldUnit eCtrl, SfxMapUnit eItem );
+
+SVT_DLLPUBLIC FieldUnit MapToFieldUnit( const SfxMapUnit eUnit );
+
+SVT_DLLPUBLIC void SetMetricValue( MetricField& rField, long lCoreValue, SfxMapUnit eUnit );
+SVT_DLLPUBLIC long GetCoreValue( const MetricField& rField, SfxMapUnit eUnit );
+
+SVT_DLLPUBLIC long PointToTwips( long nIn );
+
+SVT_DLLPUBLIC long TransformMetric( long nVal, FieldUnit aOld, FieldUnit aNew );
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/unoevent.hxx b/include/svtools/unoevent.hxx
new file mode 100644
index 000000000000..581df582a64e
--- /dev/null
+++ b/include/svtools/unoevent.hxx
@@ -0,0 +1,320 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVTOOLS_UNOEVENT_HXX_
+#define _SVTOOLS_UNOEVENT_HXX_
+
+#include "svtools/svtdllapi.h"
+#include <com/sun/star/container/XNameReplace.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <cppuhelper/implbase2.hxx>
+
+class SvxMacroTableDtor;
+class SvxMacroItem;
+class SvxMacro;
+
+/** SvEventDescription: Description of a single event.
+ mnEvent is the id used by SvxMacroItem
+ mpEventName is the api name for this event
+
+ the last event in an array is indicated by mnEvent && mpEventName == 0
+*/
+struct SvEventDescription
+{
+ sal_uInt16 mnEvent;
+ const sal_Char* mpEventName;
+};
+
+/**
+ * SvBaseEventDescriptor: Abstract class that implements the basics
+ * of an XNameReplace that is delivered by the
+ * XEventsSupplier::getEvents() method.
+ *
+ * The functionality this class provides is:
+ * 1) Which elements are in the XNameReplace?
+ * 2) Mapping from Api names to item IDs.
+ * 3) conversion from SvxMacroItem to Any and vice versa.
+ *
+ * All details of how to actually get and set SvxMacroItem(s) have to
+ * be supplied by the base class.
+ */
+class SVT_DLLPUBLIC SvBaseEventDescriptor : public cppu::WeakImplHelper2
+<
+ ::com::sun::star::container::XNameReplace,
+ ::com::sun::star::lang::XServiceInfo
+>
+{
+ const OUString sEventType;
+ const OUString sMacroName;
+ const OUString sLibrary;
+ const OUString sStarBasic;
+ const OUString sJavaScript;
+ const OUString sScript;
+ const OUString sNone;
+
+
+ /// name of own service
+ const OUString sServiceName;
+
+protected:
+ const OUString sEmpty;
+
+ /// last element is 0, 0
+ const SvEventDescription* mpSupportedMacroItems;
+ sal_Int16 mnMacroItems;
+
+public:
+
+ SvBaseEventDescriptor(const SvEventDescription* pSupportedMacroItems);
+
+ virtual ~SvBaseEventDescriptor();
+
+
+ // XNameReplace
+ /// calls replaceByName(const sal_uInt16, const SvxMacro&)
+ virtual void SAL_CALL replaceByName(
+ const OUString& rName, /// API name of event
+ const ::com::sun::star::uno::Any& rElement ) /// event (PropertyValues)
+ throw(
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XNameAccess (via XNameReplace)
+ /// calls getByName(sal_uInt16)
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName(
+ const OUString& rName ) /// API name of event
+ throw(
+ ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XNameAxcess (via XNameReplace)
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL
+ getElementNames()
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // XNameAccess (via XNameReplace)
+ virtual sal_Bool SAL_CALL hasByName(
+ const OUString& rName )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // XElementAccess (via XNameReplace)
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // XElementAccess (via XNameReplace)
+ virtual sal_Bool SAL_CALL hasElements()
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ /// must be implemented in subclass
+ virtual OUString SAL_CALL getImplementationName(void)
+ throw( ::com::sun::star::uno::RuntimeException ) = 0;
+
+ // XServiceInfo
+ virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName)
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ // XServiceInfo
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL
+ getSupportedServiceNames(void)
+ throw( ::com::sun::star::uno::RuntimeException );
+
+protected:
+
+ /// Must be implemented in subclass.
+ virtual void replaceByName(
+ const sal_uInt16 nEvent, /// item ID of event
+ const SvxMacro& rMacro) /// event (will be copied)
+ throw(
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException) = 0;
+
+ /// Must be implemented in subclass.
+ virtual void getByName(
+ SvxMacro& rMacro,
+ const sal_uInt16 nEvent )
+ throw(
+ ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException) = 0;
+
+ /// convert an API event name to the event ID as used by SvxMacroItem
+ sal_uInt16 mapNameToEventID(const OUString& rName) const;
+
+ /// get the event ID for the name; return 0 if not supported
+ sal_uInt16 getMacroID(const OUString& rName) const;
+
+ /// create PropertyValues and Any from macro
+ void getAnyFromMacro(
+ ::com::sun::star::uno::Any& aAny, // Any to be filled by Macro values
+ const SvxMacro& rMacro);
+
+ /// create macro from PropertyValues (in an Any)
+ void getMacroFromAny(
+ SvxMacro& aMacro, // reference to be filled by Any
+ const ::com::sun::star::uno::Any& rAny)
+ throw (
+ ::com::sun::star::lang::IllegalArgumentException);
+
+};
+
+
+
+
+/**
+ * SvEventDescriptor: Implement the XNameReplace that is delivered by
+ * the XEventsSupplier::getEvents() method. The SvEventDescriptor has
+ * to be subclassed to implement the events for a specific
+ * objects. The subclass has to
+ * 1) supply the super class constructor with a list of known events (item IDs)
+ * 2) supply the super class constructor with a reference of it's parent object
+ * (to prevent destruction)
+ * 3) implement getItem() and setItem(...) methods.
+ *
+ * If no object is available to which the SvEventDescriptor can attach itself,
+ * the class SvDetachedEventDescriptor should be used.
+ */
+class SVT_DLLPUBLIC SvEventDescriptor : public SvBaseEventDescriptor
+{
+ /// keep reference to parent to prevent it from being destroyed
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > xParentRef;
+
+public:
+
+ SvEventDescriptor(::com::sun::star::uno::XInterface& rParent,
+ const SvEventDescription* pSupportedMacroItems);
+
+ virtual ~SvEventDescriptor();
+
+
+protected:
+
+
+ using SvBaseEventDescriptor::replaceByName;
+ virtual void replaceByName(
+ const sal_uInt16 nEvent, /// item ID of event
+ const SvxMacro& rMacro) /// event (will be copied)
+ throw(
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ using SvBaseEventDescriptor::getByName;
+ virtual void getByName(
+ SvxMacro& rMacros, /// macro to be filled with values
+ const sal_uInt16 nEvent ) /// item ID of event
+ throw(
+ ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+
+ /// Get the SvxMacroItem from the parent.
+ /// must be implemented by subclass
+ virtual const SvxMacroItem& getMacroItem() = 0;
+
+ /// Set the SvxMacroItem at the parent.
+ /// must be implemented by subclass
+ virtual void setMacroItem(const SvxMacroItem& rItem) = 0;
+
+ /// Get the SvxMacroItem Which Id needed for the current application
+ /// must be implemented by subclass
+ virtual sal_uInt16 getMacroItemWhich() const = 0;
+};
+
+
+/**
+ * SvDetachedEventDescriptor:
+ */
+class SVT_DLLPUBLIC SvDetachedEventDescriptor : public SvBaseEventDescriptor
+{
+ // the macros; aMacros[i] is the value for aSupportedMacroItemIDs[i]
+ SvxMacro** aMacros;
+
+ const OUString sImplName;
+
+public:
+
+ SvDetachedEventDescriptor(const SvEventDescription* pSupportedMacroItems);
+
+ virtual ~SvDetachedEventDescriptor();
+
+ //XServiceInfo
+ virtual OUString SAL_CALL getImplementationName(void)
+ throw( ::com::sun::star::uno::RuntimeException );
+
+protected:
+
+ sal_Int16 getIndex(const sal_uInt16 nID) const;
+
+ using SvBaseEventDescriptor::replaceByName;
+ virtual void replaceByName(
+ const sal_uInt16 nEvent, /// item ID of event
+ const SvxMacro& rMacro) /// event (will be copied)
+ throw(
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ using SvBaseEventDescriptor::getByName;
+ virtual void getByName(
+ SvxMacro& rMacro, /// macro to be filled
+ const sal_uInt16 nEvent ) /// item ID of event
+ throw(
+ ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ /// do we have an event?
+ /// return sal_True: we have a macro for the event
+ /// return sal_False: no macro; getByName() will return an empty macro
+ /// IllegalArgumentException: the event is not supported
+ using SvBaseEventDescriptor::hasByName;
+ virtual sal_Bool hasByName(
+ const sal_uInt16 nEvent ) const /// item ID of event
+ throw(
+ ::com::sun::star::lang::IllegalArgumentException);
+
+};
+
+class SVT_DLLPUBLIC SvMacroTableEventDescriptor : public SvDetachedEventDescriptor
+{
+public:
+
+ SvMacroTableEventDescriptor(const SvEventDescription* pSupportedMacroItems);
+ SvMacroTableEventDescriptor(const SvxMacroTableDtor& aFmt,
+ const SvEventDescription* pSupportedMacroItems);
+
+ virtual ~SvMacroTableEventDescriptor();
+
+ void copyMacrosFromTable(const SvxMacroTableDtor& aFmt);
+ void copyMacrosIntoTable(SvxMacroTableDtor& aFmt);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/unoimap.hxx b/include/svtools/unoimap.hxx
new file mode 100644
index 000000000000..03fd3ea3e84b
--- /dev/null
+++ b/include/svtools/unoimap.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVTOOLS_UNOIMAP_HXX
+#define _SVTOOLS_UNOIMAP_HXX
+
+#include "svtools/svtdllapi.h"
+#include <com/sun/star/uno/XInterface.hpp>
+
+class ImageMap;
+struct SvEventDescription;
+
+SVT_DLLPUBLIC com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SvUnoImageMapRectangleObject_createInstance( const SvEventDescription* pSupportedMacroItems );
+SVT_DLLPUBLIC com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SvUnoImageMapCircleObject_createInstance( const SvEventDescription* pSupportedMacroItems );
+SVT_DLLPUBLIC com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SvUnoImageMapPolygonObject_createInstance( const SvEventDescription* pSupportedMacroItems );
+
+SVT_DLLPUBLIC com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SvUnoImageMap_createInstance( const SvEventDescription* pSupportedMacroItems );
+SVT_DLLPUBLIC com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SvUnoImageMap_createInstance( const ImageMap& rMap, const SvEventDescription* pSupportedMacroItems );
+SVT_DLLPUBLIC sal_Bool SvUnoImageMap_fillImageMap( com::sun::star::uno::Reference< com::sun::star::uno::XInterface > xImageMap, ImageMap& rMap );
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/urlcontrol.hxx b/include/svtools/urlcontrol.hxx
new file mode 100644
index 000000000000..682573855000
--- /dev/null
+++ b/include/svtools/urlcontrol.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVTOOLS_URLCONTROL_HXX
+#define SVTOOLS_URLCONTROL_HXX
+
+#include "svtools/svtdllapi.h"
+#include <svtools/inettbc.hxx>
+
+//.........................................................................
+namespace svt
+{
+//.........................................................................
+
+ //=====================================================================
+ //= OFileURLControl
+ //=====================================================================
+ class SVT_DLLPUBLIC OFileURLControl : public SvtURLBox
+ {
+ protected:
+ String m_sPreservedText;
+
+ public:
+ OFileURLControl(Window* _pParent, const ResId& _rId);
+
+ protected:
+ virtual long PreNotify( NotifyEvent& rNEvt );
+ virtual long Notify( NotifyEvent& rNEvt );
+ };
+
+//.........................................................................
+} // namespace svt
+//.........................................................................
+
+#endif // SVTOOLS_URLCONTROL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx
new file mode 100644
index 000000000000..ff032fd3baa4
--- /dev/null
+++ b/include/svtools/valueset.hxx
@@ -0,0 +1,391 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _VALUESET_HXX
+#define _VALUESET_HXX
+
+#include "svtools/svtdllapi.h"
+
+#include <vcl/ctrl.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/timer.hxx>
+#include <vector>
+
+class MouseEvent;
+class TrackingEvent;
+class HelpEvent;
+class KeyEvent;
+class DataChangedEvent;
+class ScrollBar;
+
+struct ValueSetItem;
+typedef ::std::vector< ValueSetItem* > ValueItemList;
+
+#ifdef _SV_VALUESET_CXX
+class ValueSetAcc;
+class ValueItemAcc;
+#endif
+
+/*************************************************************************
+
+Description
+============
+
+class ValueSet
+
+This class allows the selection of an item. In the process items are
+drawn side by side. The selection of items can be more clear than in a
+ListBox shape for example in case of colors or samples.
+The amount of columns drawn by the control and whether the items
+should be encircled can be specified. Optional a NoSelection or name
+field could be shown. By default image and color items are supported.
+Items could be drawn by oneself if InsertItem() is only called with
+an ID. To achieve this the UserDraw handler needs to be overloaded. The
+description text could be specified afterwards in case of UserDraw
+and any other items.
+
+Cross references
+
+class ListBox
+
+--------------------------------------------------------------------------
+
+WinBits
+
+WB_RADIOSEL If set the selection will be drawn like an
+ ImageRadioButton. This does only make sense if the image
+ is at least 8 pixel smaller on each side than the item
+ and also WB_DOUBLEBORDER is set and as color
+ COL_WINDOWWORKSPACE is specified.
+WB_FLATVALUESET Flat Look (if you set WB_ITEMBORDER or WB_DOUBLEBORDER,
+ then you get extra border space, but the Borders
+ aren't painted),
+WB_ITEMBORDER Items will be bordered
+WB_DOUBLEBORDER Items will be bordered twice. Additionally WB_ITEMBORDER
+ has to be set, as otherwise this WinBit wouldn't have any
+ effect. It is needed if there are items with a white
+ background, since otherwise the 3D effect wouldn't be
+ recognizable.
+WB_NAMEFIELD There is a namefield, where the name of an item will be
+ shown.
+WB_NONEFIELD There is a NoSelection field which can be selected if
+ 0 is passed along with SelectItem. Respectively
+ GetSelectItemId() returns 0 if this field or nothing
+ is selected. This field shows the text which is specified
+ by SetText() respectively no one, if no text was set. With
+ SetNoSelection() the selection can be disabled.
+WB_VSCROLL A scroolbar will be always shown. The visible number of
+ lines have to be specified with SetLineCount() if this
+ flag is set.
+WB_BORDER A border will be drawn around the window.
+WB_NOPOINTERFOCUS The focus won't be gathered, if the control was pressed by
+ the mouse.
+WB_TABSTOP It is possible to jump into the ValueSet with the tab key.
+WB_NOTABSTOP It is not possible to jump into the ValueSet with the
+ tab key.
+WB_NO_DIRECTSELECT Cursor travelling doesn't call select immediately. To
+ execute the selection <RETURN> has to be pressed.
+--------------------------------------------------------------------------
+
+The number of columns must be either set with SetColCount() or
+SetItemWidth(). If the number of colums is specified by SetColCount()
+the width of the items will be calculated by the visible range.
+If the items should have a static width, it has to be specified
+with SetItemWidth(). In this case the number of columns will be calculated
+by the visible range.
+
+The number of rows is given by the number of items / number of columns. The
+number of visible rows must either specified by SetLineCount() or
+SetItemWidth(). If the number of visible rows is specified by SetLineCount(),
+the height of the items will be calculated from the visible height. If the
+items should have a fixed height it has to be specified with SetItemHeight().
+In this case the number of visible rows is then calculated from the visible
+height. If the number of visible rows is neither specified by SetLineCount()
+nor by SetItemHeight() all rows will be shown. The height of the items will
+be calculated by the visible height. If the number of visible rows is
+specified by SetLineCount() or SetItemHeight() ValueSet does scroll
+automatically when more lines are available, as are visible. If scrolling
+should be also possible with a ScrollBar WB_VSCROLL needs to be set.
+
+The distance between the items can be increased by SetExtraSpacing(). The
+distance, which will be shown between two items (both in x and in y), is
+measured in pixels.
+
+The exact window size for a specific item size can be calculated by
+CalcWindowSizePixel(). To do this all relevant data (number of columns/...)
+have to be specified and if no number of rows was set, all items need to
+be inserted. If the window was created with WB_BORDER/Border=sal_True the
+size has to be specified with SetOutputSizePixel(). In other cases different
+size-methods can be used. With CalcItemSize() the inner and outer size of
+an item could be calculated (for this the free space defined by
+SetExtraSpacing() will not be included).
+
+The background color could be specified by SetColor(), with which the image
+or UserDraw items will be underlayed. If no color is specified the color
+of other windows (WindowColor) will be used for the background.
+
+--------------------------------------------------------------------------
+
+At first all items should be inserted and only then Show() should be called
+since the output area will be precomputed. If this is not done the first
+Paint will appear a little bit slower. Therefore the Control, if it is loaded
+from the resource and only supplied with items during runtime, should be
+loaded with Hide = sal_True and then displayed with Show().
+
+In case of a visible Control the creation of the new output area could be
+activated before Paint by calling Format().
+
+--------------------------------------------------------------------------
+
+If Drag and Drop will be called from the ValueSet the Command-Handler has to
+be overloaded. From this StartDrag needs to be called. If this method returns
+sal_True the drag-process could be initiated by ExecuteDrag(), otherwise no
+processing will take place. This method makes sure that ValueSet stops its
+processing and as appropriate selects the entry. Therefore the calling of
+Select-Handler within this function must be expected.
+
+For dropping QueryDrop() and Drop() need to be overloaded and ShowDropPos()
+and HideDropPos() should be called within these methods.
+To show the insertion point ShowDropPos() has to be called within the
+QueryDrop-Handler. ShowDropPos() also scrolls the ValueSet if the passed
+position is located at the window border. Furthermore ShowDropPos() returns
+the position, at which the item should be inserted respectively which
+insertion point was shown. If no insertion point was determined
+VALUESET_ITEM_NOTFOUND will be returned. If the window was left during dragging
+or the drag process is terminated HideDropPos() should be called in any case.
+
+--------------------------------------------------------------------------
+
+This class is currently still in the SV-Tools. That's why the ValueSet needs
+to be loaded as a Control out of the resource and the desired WinBits have
+to be set (before Show) with SetStyle().
+
+*************************************************************************/
+
+// ------------------
+// - ValueSet types -
+// ------------------
+
+#define WB_RADIOSEL ((WinBits)0x00008000)
+#define WB_ITEMBORDER ((WinBits)0x00010000)
+#define WB_DOUBLEBORDER ((WinBits)0x00020000)
+#define WB_NAMEFIELD ((WinBits)0x00040000)
+#define WB_NONEFIELD ((WinBits)0x00080000)
+#define WB_FLATVALUESET ((WinBits)0x02000000)
+#define WB_NO_DIRECTSELECT ((WinBits)0x04000000)
+#define WB_MENUSTYLEVALUESET ((WinBits)0x08000000)
+
+// ------------
+// - ValueSet -
+// ------------
+
+#define VALUESET_APPEND ((sal_uInt16)-1)
+#define VALUESET_ITEM_NOTFOUND ((sal_uInt16)-1)
+
+class SVT_DLLPUBLIC ValueSet : public Control
+{
+private:
+
+ VirtualDevice maVirDev;
+ Timer maTimer;
+ ValueItemList mItemList;
+ ValueSetItem* mpNoneItem;
+ ScrollBar* mpScrBar;
+ Rectangle maNoneItemRect;
+ Rectangle maItemListRect;
+ long mnItemWidth;
+ long mnItemHeight;
+ long mnTextOffset;
+ long mnVisLines;
+ long mnLines;
+ long mnUserItemWidth;
+ long mnUserItemHeight;
+ sal_uInt16 mnSelItemId;
+ sal_uInt16 mnHighItemId;
+ sal_uInt16 mnCols;
+ sal_uInt16 mnCurCol;
+ sal_uInt16 mnUserCols;
+ sal_uInt16 mnUserVisLines;
+ sal_uInt16 mnFirstLine;
+ sal_uInt16 mnSpacing;
+ sal_uInt16 mnFrameStyle;
+ bool mbFormat : 1;
+ bool mbHighlight : 1;
+ bool mbSelection : 1;
+ bool mbNoSelection : 1;
+ bool mbDrawSelection : 1;
+ bool mbBlackSel : 1;
+ bool mbDoubleSel : 1;
+ bool mbScroll : 1;
+ bool mbFullMode : 1;
+ bool mbIsTransientChildrenDisabled : 1;
+ bool mbHasVisibleItems : 1;
+ Color maColor;
+ Link maDoubleClickHdl;
+ Link maSelectHdl;
+ Link maHighlightHdl;
+
+#ifdef _SV_VALUESET_CXX
+ friend class ValueSetAcc;
+ friend class ValueItemAcc;
+ using Control::ImplInitSettings;
+ using Window::ImplInit;
+ SVT_DLLPRIVATE void ImplInit();
+ SVT_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
+ SVT_DLLPRIVATE void ImplInitScrollBar();
+ SVT_DLLPRIVATE void ImplDeleteItems();
+ SVT_DLLPRIVATE void ImplFormatItem( ValueSetItem* pItem, Rectangle aRect );
+ SVT_DLLPRIVATE void ImplDrawItemText(const OUString& rStr);
+ SVT_DLLPRIVATE void ImplDrawSelect( sal_uInt16 nItemId, const bool bFocus, const bool bDrawSel );
+ SVT_DLLPRIVATE void ImplDrawSelect();
+ SVT_DLLPRIVATE void ImplHideSelect( sal_uInt16 nItemId );
+ SVT_DLLPRIVATE void ImplHighlightItem( sal_uInt16 nItemId, bool bIsSelection = true );
+ SVT_DLLPRIVATE void ImplDraw();
+ using Window::ImplScroll;
+ SVT_DLLPRIVATE bool ImplScroll( const Point& rPos );
+ SVT_DLLPRIVATE size_t ImplGetItem( const Point& rPoint, bool bMove = false ) const;
+ SVT_DLLPRIVATE ValueSetItem* ImplGetItem( size_t nPos );
+ SVT_DLLPRIVATE ValueSetItem* ImplGetFirstItem();
+ SVT_DLLPRIVATE sal_uInt16 ImplGetVisibleItemCount() const;
+ SVT_DLLPRIVATE ValueSetItem* ImplGetVisibleItem( sal_uInt16 nVisiblePos );
+ SVT_DLLPRIVATE void ImplInsertItem( ValueSetItem *const pItem, const size_t nPos );
+ SVT_DLLPRIVATE Rectangle ImplGetItemRect( size_t nPos ) const;
+ SVT_DLLPRIVATE void ImplFireAccessibleEvent( short nEventId, const ::com::sun::star::uno::Any& rOldValue, const ::com::sun::star::uno::Any& rNewValue );
+ SVT_DLLPRIVATE bool ImplHasAccessibleListeners();
+ SVT_DLLPRIVATE void ImplTracking( const Point& rPos, bool bRepeat );
+ SVT_DLLPRIVATE void ImplEndTracking( const Point& rPos, bool bCancel );
+ DECL_DLLPRIVATE_LINK( ImplScrollHdl, ScrollBar* );
+ DECL_DLLPRIVATE_LINK( ImplTimerHdl, void* );
+#endif
+
+ // Forbidden and not implemented.
+ ValueSet (const ValueSet &);
+ ValueSet & operator= (const ValueSet &);
+
+protected:
+
+ bool StartDrag( const CommandEvent& rCEvt, Region& rRegion );
+
+protected:
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
+
+public:
+ ValueSet( Window* pParent, WinBits nWinStyle, bool bDisableTransientChildren = false );
+ ValueSet( Window* pParent, const ResId& rResId, bool bDisableTransientChildren = false );
+ ~ValueSet();
+
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void Tracking( const TrackingEvent& rMEvt );
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual void Paint( const Rectangle& rRect );
+ virtual void GetFocus();
+ virtual void LoseFocus();
+ virtual void Resize();
+ virtual Size GetOptimalSize() const;
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+ virtual void StateChanged( StateChangedType nStateChange );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ virtual void Select();
+ virtual void DoubleClick();
+ virtual void UserDraw( const UserDrawEvent& rUDEvt );
+
+ void InsertItem( sal_uInt16 nItemId, const Image& rImage,
+ size_t nPos = VALUESET_APPEND );
+ void InsertItem( sal_uInt16 nItemId, const Color& rColor,
+ size_t nPos = VALUESET_APPEND );
+ void InsertItem( sal_uInt16 nItemId,
+ const Image& rImage, const OUString& rStr,
+ size_t nPos = VALUESET_APPEND );
+ void InsertItem( sal_uInt16 nItemId,
+ const Color& rColor, const OUString& rStr,
+ size_t nPos = VALUESET_APPEND );
+ void InsertItem( sal_uInt16 nItemId,
+ size_t nPos = VALUESET_APPEND );
+ void RemoveItem( sal_uInt16 nItemId );
+
+ void Clear();
+
+ size_t GetItemCount() const;
+ size_t GetItemPos( sal_uInt16 nItemId ) const;
+ sal_uInt16 GetItemId( size_t nPos ) const;
+ sal_uInt16 GetItemId( const Point& rPos ) const;
+ Rectangle GetItemRect( sal_uInt16 nItemId ) const;
+
+ void EnableFullItemMode( bool bFullMode = true );
+ bool IsFullItemModeEnabled() const { return mbFullMode; }
+ void SetColCount( sal_uInt16 nNewCols = 1 );
+ sal_uInt16 GetColCount() const { return mnUserCols; }
+ void SetLineCount( sal_uInt16 nNewLines = 0 );
+ sal_uInt16 GetLineCount() const { return mnUserVisLines; }
+ void SetItemWidth( long nItemWidth = 0 );
+ long GetItemWidth() const { return mnUserItemWidth; }
+ void SetItemHeight( long nLineHeight = 0 );
+ long GetItemHeight() const { return mnUserItemHeight; }
+ sal_uInt16 GetFirstLine() const { return mnFirstLine; }
+
+ void SelectItem( sal_uInt16 nItemId );
+ sal_uInt16 GetSelectItemId() const { return mnSelItemId; }
+ bool IsItemSelected( sal_uInt16 nItemId ) const
+ { return !mbNoSelection && (nItemId == mnSelItemId); }
+ void SetNoSelection();
+ bool IsNoSelection() const { return mbNoSelection; }
+
+ void SetItemImage( sal_uInt16 nItemId, const Image& rImage );
+ Image GetItemImage( sal_uInt16 nItemId ) const;
+ void SetItemColor( sal_uInt16 nItemId, const Color& rColor );
+ Color GetItemColor( sal_uInt16 nItemId ) const;
+ void SetItemData( sal_uInt16 nItemId, void* pData );
+ void* GetItemData( sal_uInt16 nItemId ) const;
+ void SetItemText( sal_uInt16 nItemId, const OUString& rStr );
+ OUString GetItemText( sal_uInt16 nItemId ) const;
+ void SetColor( const Color& rColor );
+ void SetColor() { SetColor( Color( COL_TRANSPARENT ) ); }
+ Color GetColor() const { return maColor; }
+ bool IsColor() const { return maColor.GetTransparency() == 0; }
+
+ void SetExtraSpacing( sal_uInt16 nNewSpacing );
+ sal_uInt16 GetExtraSpacing() { return mnSpacing; }
+
+ void Format();
+
+ void StartSelection();
+ void EndSelection();
+
+ Size CalcWindowSizePixel( const Size& rItemSize,
+ sal_uInt16 nCalcCols = 0,
+ sal_uInt16 nCalcLines = 0 ) const;
+ Size CalcItemSizePixel( const Size& rSize, bool bOut = true ) const;
+ long GetScrollWidth() const;
+
+ void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; }
+ const Link& GetSelectHdl() const { return maSelectHdl; }
+ void SetDoubleClickHdl( const Link& rLink ) { maDoubleClickHdl = rLink; }
+ const Link& GetDoubleClickHdl() const { return maDoubleClickHdl; }
+
+ void SetHighlightHdl( const Link& rLink );
+};
+
+#endif // _VALUESET_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/viewdataentry.hxx b/include/svtools/viewdataentry.hxx
new file mode 100644
index 000000000000..3800b293fd2b
--- /dev/null
+++ b/include/svtools/viewdataentry.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __SVTOOLS_VIEWDATAENTRY_HXX__
+#define __SVTOOLS_VIEWDATAENTRY_HXX__
+
+#include "svtdllapi.h"
+#include "tools/solar.h"
+#include "tools/gen.hxx"
+
+#include <vector>
+
+struct SvViewDataItem
+{
+ Size maSize;
+};
+
+/**
+ * View-dependent data for a tree list entry created in the virtual function
+ * SvTreeListBox::CreateViewData(). The item array contains the same number
+ * of items as that of the items in its corresponding tree list entry.
+ *
+ * When an entry is selected, it is logically selected and visually
+ * highlighted. When an entry is only highlighted, it looks visually
+ * highlighted, but not logically selected.
+ */
+class SVT_DLLPUBLIC SvViewDataEntry
+{
+ friend class SvTreeList;
+
+ std::vector<SvViewDataItem> maItems;
+ sal_uLong nVisPos;
+ bool mbSelected:1;
+ bool mbHighlighted:1;
+ bool mbExpanded:1;
+ bool mbFocused:1;
+ bool mbCursored:1;
+ bool mbSelectable:1;
+
+public:
+ SvViewDataEntry();
+ SvViewDataEntry( const SvViewDataEntry& );
+ ~SvViewDataEntry();
+
+ bool IsSelected() const;
+ bool IsHighlighted() const;
+ bool IsExpanded() const;
+ bool HasFocus() const;
+ bool IsCursored() const;
+ bool IsSelectable() const;
+ void SetFocus( bool bFocus );
+ void SetSelected( bool bSelected );
+ void SetHighlighted( bool bHighlighted );
+ void SetExpanded( bool bExpanded );
+ void SetSelectable( bool bSelectable );
+
+ void Init(size_t nSize);
+
+ const SvViewDataItem* GetItem(size_t nPos) const;
+ SvViewDataItem* GetItem(size_t nPos);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/wizardmachine.hxx b/include/svtools/wizardmachine.hxx
new file mode 100644
index 000000000000..8283b131007d
--- /dev/null
+++ b/include/svtools/wizardmachine.hxx
@@ -0,0 +1,385 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVTOOLS_WIZARDMACHINE_HXX_
+#define _SVTOOLS_WIZARDMACHINE_HXX_
+
+#include "svtools/svtdllapi.h"
+#include <svtools/wizdlg.hxx>
+#include <vcl/button.hxx>
+#include <vcl/tabpage.hxx>
+#include <comphelper/stl_types.hxx>
+
+class Bitmap;
+//.........................................................................
+namespace svt
+{
+//.........................................................................
+
+// wizard buttons
+#define WZB_NONE 0x0000
+#define WZB_NEXT 0x0001
+#define WZB_PREVIOUS 0x0002
+#define WZB_FINISH 0x0004
+#define WZB_CANCEL 0x0008
+#define WZB_HELP 0x0010
+
+// wizard states
+#define WZS_INVALID_STATE ((WizardState)-1)
+
+ //=====================================================================
+ //= WizardTypes
+ //=====================================================================
+ struct WizardTypes
+ {
+ typedef sal_Int16 WizardState;
+ enum CommitPageReason
+ {
+ eTravelForward, // traveling forward (maybe with skipping pages)
+ eTravelBackward, // traveling backward (maybe with skipping pages)
+ eFinish, // the wizard is about to be finished
+ eValidate // the data should be validated only, no traveling wll happen
+ };
+ };
+
+ class SAL_NO_VTABLE IWizardPageController
+ {
+ public:
+ //-----------------------------------------------------------------
+ // This methods behave somewhat different than ActivatePage/DeactivatePage
+ // The latter are handled by the base class itself whenever changing the pages is in the offing,
+ // i.e., when it's already decided which page is the next.
+ // We may have situations where the next page depends on the state of the current, which needs
+ // to be committed for this.
+ // So initializePage and commitPage are designated to initialitzing/committing data on the page.
+ virtual void initializePage() = 0;
+ virtual sal_Bool commitPage( WizardTypes::CommitPageReason _eReason ) = 0;
+
+ /** determines whether or not it is allowed to advance to a next page
+
+ You should make this dependent on the current state of the page only, not on
+ states on other pages of the whole dialog.
+
+ The default implementation always returns <TRUE/>.
+ */
+ virtual bool canAdvance() const = 0;
+
+ protected:
+ ~IWizardPageController() {}
+ };
+
+ //=====================================================================
+ //= OWizardPage
+ //=====================================================================
+ class OWizardMachine;
+ struct WizardPageImplData;
+
+ class SVT_DLLPUBLIC OWizardPage : public TabPage, public IWizardPageController
+ {
+ private:
+ WizardPageImplData* m_pImpl;
+
+ public:
+ /** @param _pParent
+ if the OWizardPage is used in an OWizardMachine, this parameter
+ must be the OWizardMachine (which is derived from Window)
+ */
+ OWizardPage( Window* _pParent, const ResId& _rResId );
+ ~OWizardPage();
+
+ // IWizardPageController overridables
+ virtual void initializePage();
+ virtual sal_Bool commitPage( WizardTypes::CommitPageReason _eReason );
+ virtual bool canAdvance() const;
+
+ protected:
+ // TabPage overridables
+ virtual void ActivatePage();
+
+ /** updates the travel-related UI elements of the OWizardMachine we live in (if any)
+
+ If the parent of the tab page is a OWizardMachine, then updateTravelUI at this instance
+ is called. Otherwise, nothing happens.
+ */
+ void updateDialogTravelUI();
+ };
+
+ //=====================================================================
+ //= OWizardMachine
+ //=====================================================================
+ struct WizardMachineImplData;
+ /** implements some kind of finite automata, where the states of the automata exactly correlate
+ with tab pages.
+
+ That is, the machine can have up to n states, where at each point in time exactly one state is
+ the current one. A state being current is represented as one of n tab pages being displayed
+ currently.
+
+ The class handles the UI for traveling between the states (e.g. it administrates the <em>Next</em> and
+ <em>Previous</em> buttons which you usually find in a wizard.
+
+ Derived classes have to implement the travel logic by overriding <member>determineNextState</member>,
+ which has to determine the state which follows the current state. Since this may depend
+ on the actual data presented in the wizard (e.g. checkboxes checked, or something like this),
+ they can implement non-linear traveling this way.
+ */
+
+ class SVT_DLLPUBLIC OWizardMachine : public WizardDialog, public WizardTypes
+ {
+ private:
+ // restrict access to some aspects of our base class
+ SVT_DLLPRIVATE void AddPage( TabPage* pPage ) { WizardDialog::AddPage(pPage); }
+ SVT_DLLPRIVATE void RemovePage( TabPage* pPage ) { WizardDialog::RemovePage(pPage); }
+ SVT_DLLPRIVATE void SetPage( sal_uInt16 nLevel, TabPage* pPage ) { WizardDialog::SetPage(nLevel, pPage); }
+ // TabPage* GetPage( sal_uInt16 nLevel ) const { return WizardDialog::GetPage(nLevel); }
+ // TODO: probably the complete page handling (next, previous etc.) should be prohibited ...
+
+ // IMPORTANT:
+ // traveling pages should not be done by calling these base class member, some mechanisms of this class
+ // here (e.g. committing page data) depend on having full control over page traveling.
+ // So use the travelXXX methods if you need to travel
+
+ protected:
+ OKButton* m_pFinish;
+ CancelButton* m_pCancel;
+ PushButton* m_pNextPage;
+ PushButton* m_pPrevPage;
+ HelpButton* m_pHelp;
+
+ private:
+ WizardMachineImplData*
+ m_pImpl;
+ // hold members in this structure to allow keeping compatible when members are added
+
+ SVT_DLLPRIVATE void addButtons(Window* _pParent, sal_uInt32 _nButtonFlags);
+
+ public:
+ /** ctor
+
+ The ctor does not call FreeResource, this is the resposibility of the derived class.
+
+ For the button flags, use any combination of the WZB_* flags.
+ */
+ OWizardMachine(Window* _pParent, const ResId& _rRes, sal_uInt32 _nButtonFlags );
+ OWizardMachine(Window* _pParent, const WinBits i_nStyle, sal_uInt32 _nButtonFlags );
+ ~OWizardMachine();
+
+ /// enable (or disable) buttons
+ void enableButtons(sal_uInt32 _nWizardButtonFlags, sal_Bool _bEnable);
+ /// set the default style for a button
+ void defaultButton(sal_uInt32 _nWizardButtonFlags);
+ /// set the default style for a button
+ void defaultButton(PushButton* _pNewDefButton);
+
+ /// set the base of the title to use - the title of the current page is appended
+ void setTitleBase(const String& _rTitleBase);
+
+ /// determines whether there is a next state to which we can advance
+ virtual bool canAdvance() const;
+
+ /** updates the user interface which deals with traveling in the wizard
+
+ The default implementation simply checks whether both the current page and the wizard
+ itself allow to advance to the next state (<code>canAdvance</code>), and enables the "Next"
+ button if and only if this is the case.
+ */
+ virtual void updateTravelUI();
+
+ protected:
+ // WizardDialog overridables
+ virtual void ActivatePage();
+ virtual long DeactivatePage();
+
+ // our own overridables
+
+ /// to override to create new pages
+ virtual TabPage* createPage(WizardState _nState) = 0;
+
+ /// will be called when a new page is about to be displayed
+ virtual void enterState(WizardState _nState);
+
+ /** will be called when the current state is about to be left for the given reason
+
+ The base implementation in this class will simply call <member>OWizardPage::commitPage</member>
+ for the current page, and return whatever this call returns.
+
+ @param _eReason
+ The reason why the state is to be left.
+ @return
+ <TRUE/> if and only if the page is allowed to be left
+ */
+ virtual sal_Bool prepareLeaveCurrentState( CommitPageReason _eReason );
+
+ /** will be called when the given state is left
+
+ This is the very last possibility for derived classes to veto the deactivation
+ of a page.
+
+ @todo Normally, we would not need the return value here - derived classes now have
+ the possibility to veto page deactivations in <member>prepareLeaveCurrentState</member>. However,
+ changing this return type is too incompatible at the moment ...
+
+ @return
+ <TRUE/> if and only if the page is allowed to be left
+ */
+ virtual sal_Bool leaveState( WizardState _nState );
+
+ /** determine the next state to travel from the given one
+
+ The default behaviour is linear traveling, overwrite this to change it
+
+ Return WZS_INVALID_STATE to prevent traveling.
+ */
+ virtual WizardState determineNextState( WizardState _nCurrentState ) const;
+
+ /** called when the finish button is pressed
+ <p>By default, only the base class' Finnish method (which is not virtual) is called</p>
+ */
+ virtual sal_Bool onFinish();
+
+ /// travel to the next state
+ sal_Bool travelNext();
+
+ /// travel to the previous state
+ sal_Bool travelPrevious();
+
+ /** enables the automatic enabled/disabled state of the "Next" button
+
+ If this is <TRUE/>, then upon entering a new state, the "Next" button will automatically be
+ enabled if and only if determineNextState does not return WZS_INVALID_STATE.
+ */
+ void enableAutomaticNextButtonState( bool _bEnable = true );
+ bool isAutomaticNextButtonStateEnabled() const;
+
+ /** removes a page from the history. Should be called when the page is being disabled
+ */
+ void removePageFromHistory( WizardState nToRemove );
+
+ /** skip a state
+
+ The method behaves as if from the current state, <arg>_nSteps</arg> <method>travelNext</method>s were
+ called, but without actually creating or displaying the ntermediate pages. Only the
+ (<arg>_nSteps</arg> + 1)th page is created.
+
+ The skipped states appear in the state history, so <method>travelPrevious</method> will make use of them.
+
+ A very essential precondition for using this method is that your <method>determineNextState</method>
+ method is able to determine the next state without actually having the page of the current state.
+
+ @return
+ <TRUE/> if and only if traveling was successful
+
+ @see skipUntil
+ @see skipBackwardUntil
+ */
+ sal_Bool skip( sal_Int32 _nSteps = 1 );
+
+ /** skips one or more states, until a given state is reached
+
+ The method behaves as if from the current state, <method>travelNext</method>s were called
+ successively, until <arg>_nTargetState</arg> is reached, but without actually creating or
+ displaying the ntermediate pages.
+
+ The skipped states appear in the state history, so <method>travelPrevious</method> will make use of them.
+
+ @return
+ <TRUE/> if and only if traveling was successful
+
+ @see skip
+ @see skipBackwardUntil
+ */
+ sal_Bool skipUntil( WizardState _nTargetState );
+
+ /** moves back one or more states, until a given state is reached
+
+ This method allows traveling backwards more than one state without actually showing the intermediate
+ states.
+
+ For instance, if you want to travel two steps backward at a time, you could used
+ two travelPrevious calls, but this would <em>show</em> both pages, which is not necessary,
+ since you're interested in the target page only. Using <member>skipBackwardUntil</member> reliefs
+ you from this.
+
+ @return
+ <TRUE/> if and only if traveling was successful
+
+ @see skipUntil
+ @see skip
+ */
+ sal_Bool skipBackwardUntil( WizardState _nTargetState );
+
+ /** returns the current state of the machine
+
+ Vulgo, this is the identifier of the current tab page :)
+ */
+ WizardState getCurrentState() const { return WizardDialog::GetCurLevel(); }
+
+ virtual IWizardPageController*
+ getPageController( TabPage* _pCurrentPage ) const;
+
+ /** retrieves a copy of the state history, i.e. all states we already visited
+ */
+ void getStateHistory( ::std::vector< WizardState >& _out_rHistory );
+
+ public:
+ class AccessGuard { friend class WizardTravelSuspension; private: AccessGuard() { } };
+
+ void suspendTraveling( AccessGuard );
+ void resumeTraveling( AccessGuard );
+ bool isTravelingSuspended() const;
+
+ protected:
+ TabPage* GetOrCreatePage( const WizardState i_nState );
+
+ private:
+ // long OnNextPage( PushButton* );
+ DECL_DLLPRIVATE_LINK(OnNextPage, void*);
+ DECL_DLLPRIVATE_LINK(OnPrevPage, void*);
+ DECL_DLLPRIVATE_LINK(OnFinish, void*);
+
+ SVT_DLLPRIVATE void implResetDefault(Window* _pWindow);
+ SVT_DLLPRIVATE void implUpdateTitle();
+ SVT_DLLPRIVATE void implConstruct( const sal_uInt32 _nButtonFlags );
+ };
+
+ /// helper class to temporarily suspend any traveling in the wizard
+ class WizardTravelSuspension
+ {
+ public:
+ WizardTravelSuspension( OWizardMachine& _rWizard )
+ :m_rWizard( _rWizard )
+ {
+ m_rWizard.suspendTraveling( OWizardMachine::AccessGuard() );
+ }
+
+ ~WizardTravelSuspension()
+ {
+ m_rWizard.resumeTraveling( OWizardMachine::AccessGuard() );
+ }
+
+ private:
+ OWizardMachine& m_rWizard;
+ };
+
+//.........................................................................
+} // namespace svt
+//.........................................................................
+
+#endif // _SVTOOLS_WIZARDMACHINE_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/wizdlg.hxx b/include/svtools/wizdlg.hxx
new file mode 100644
index 000000000000..f161b7339ff7
--- /dev/null
+++ b/include/svtools/wizdlg.hxx
@@ -0,0 +1,301 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVT_WIZDLG_HXX
+#define _SVT_WIZDLG_HXX
+
+#include "svtools/svtdllapi.h"
+
+#include <vcl/dialog.hxx>
+
+class TabPage;
+class Button;
+class PushButton;
+class FixedLine;
+struct ImplWizPageData;
+struct ImplWizButtonData;
+
+/*************************************************************************
+
+Beschreibung
+============
+
+class WizardDialog
+
+Diese Klasse dient als Basis fuer einen WizardDialog. Als
+Basisfunktionalitaet wird das Anordnen der Controls angeboten und
+Hilfesmethoden fuer das Umschalten von TabPages. Der Dialog
+ordnet bei einer Groessenanderung die Controls auch wieder
+entsprechend an.
+
+--------------------------------------------------------------------------
+
+Mit SetPageSizePixel() kann als Groesse die Groesse der groessten
+TabPage vorgegeben werden. Wenn der Dialog angezeigt wird, wird
+zu dem Zeitpunkt wenn noch keine Groesse gesetzt wurde, dafuer
+die entsprechende Dialoggroesse berechnet und gesetzt. Wenn mit
+SetPageSizePixel() keine Groesse gesetzt wurde, wird als Groesse
+die maximale Groesse der zu diesem Zeitpunkt zugewiesenen TabPages
+berechnet und genommen.
+
+ShowPrevPage()/ShowNextPage() zeigt die vorherige/naechste TabPage
+an. Dazu wird zuerst der Deactivate-Handler vom Dialog gerufen und
+wenn dieser sal_True zurueckgegeben hat, wird der Acivate-Handler
+vom Dialog gerufen und die entsprechende TabPage angezeigt.
+Finnsh() kann gerufen werden, wenn der Finnish-Button betaetigt
+wird. Dort wird dann auch noch der Deactivate-Page-Handler vom
+Dialog und der aktuellen TabPage gerufen und dann der Dialog
+beendet (Close() oder EndDialog()).
+
+Mit AddPage()/RemovePage()/SetPage() koennen die TabPages dem Wizard
+bekannt gemacht werden. Es wird immer die TabPage des aktuellen Levels
+angezeigt, wenn fuer den aktuellen Level keine TabPage zugewiesen
+ist, wird die TabPages des hoechsten Levels angezeigt. Somit kann auch
+immer die aktuelle TabPage ausgetauscht werden, wobei zu
+beruecksichtigen ist, das im Activate-Handler die aktuelle TabPage
+nicht zerstoert werden darf.
+
+Mit SetPrevButton()/SetNextButton() werden der Prev-Button und der
+Next-Button dem Dialog bekannt gemacht. In dem Fall loest der
+Dialog bei Ctr+Tab, Shift+Ctrl+Tab den entsprechenden Click-Handler
+am zugewiesenen Button aus. Die Button werden nicht vom WizardDialog
+disablte. Eine entsprechende Steuerung muss der Benutzer dieses
+Dialoges selber programieren.
+
+Mit AddButton()/RemoveButton() koennen Buttons dem Wizard bekannt
+gemacht werden, die in der Reihenfolge der Hinzufuegung angeordnet
+werden. Die Buttons werden unabhengig von ihrem sichtbarkeitsstatus
+angeordnet, so das auch spaeter ein entsprechender Button angezeigt/
+gehidet werden kann. Der Offset wird in Pixeln angegeben und bezieht
+sich immer auf den nachfolgenden Button. Damit der Abstand zwischen
+den Buttons bei allen Dialogen gleich ist, gibt es das Define
+WIZARDDIALOG_BUTTON_STDOFFSET_X, welches als Standard-Offset genommen
+werden sollte.
+
+Mit ShowButtonFixedLine() kann gesteuert werden, ob die zwischen den
+Buttons und der TabPage eine Trennlinie angezeigt werden soll.
+
+Mit SetViewWindow() und SetViewAlign() kann ein Control gesetzt werden,
+welches als PreView-Window oder fuer die Anzeige von schoenen Bitmaps
+genutzt werden kann.
+
+--------------------------------------------------------------------------
+
+Der ActivatePage()-Handler wird gerufen, wenn eine neue TabPages
+angezeigt wird. In diesem Handler kann beispielsweise die neue
+TabPage erzeugt werden, wenn diese zu diesem Zeitpunkt noch nicht
+erzeugt wurde. Der Handler kann auch als Link gesetzt werden. Mit
+GetCurLevel() kann die aktuelle ebene abgefragt werden, wobei
+Level 0 die erste Seite ist.
+
+Der DeactivatePage()-Handler wird gerufen, wenn eine neue TabPage
+angezeigt werden soll. In diesem Handler kann noch eine Fehler-
+ueberprufung stattfinden und das Umschalten gegebenenfalls verhindert
+werden, indem sal_False zurueckgegeben wird. Der Handler kann auch als
+Link gesetzt werden. Die Defaultimplementierung ruft den Link und
+gibt den Rueckgabewert des Links zurueck und wenn kein Link gesetzt
+ist, wird sal_True zurueckgegeben.
+
+--------------------------------------------------------------------------
+
+Beispiel:
+
+MyWizardDlg-Ctor
+----------------
+
+// add buttons
+AddButton( &maHelpBtn, WIZARDDIALOG_BUTTON_STDOFFSET_X );
+AddButton( &maCancelBtn, WIZARDDIALOG_BUTTON_STDOFFSET_X );
+AddButton( &maPrevBtn );
+AddButton( &maNextBtn, WIZARDDIALOG_BUTTON_STDOFFSET_X );
+AddButton( &maFinnishBtn );
+SetPrevButton( &maPrevBtn );
+SetNextButton( &maNextBtn );
+
+// SetHandler
+maPrevBtn.SetClickHdl( LINK( this, MyWizardDlg, ImplPrevHdl ) );
+maNextBtn.SetClickHdl( LINK( this, MyWizardDlg, ImplNextHdl ) );
+
+// Set PreviewWindow
+SetViewWindow( &maPreview );
+
+// Show line between Buttons and Page
+ShowButtonFixedLine( sal_True );
+
+// Call ActivatePage, because the first page should be created an activated
+ActivatePage();
+
+
+MyWizardDlg-ActivatePage-Handler
+--------------------------------
+
+void MyWizardDlg::ActivatePage()
+{
+ WizardDialog::ActivatePage();
+
+ // Test, if Page is created already
+ if ( !GetPage( GetCurLevel() ) )
+ {
+ // Create and add new page
+ TabPage* pNewTabPage;
+ switch ( GetCurLevel() )
+ {
+ case 0:
+ pNewTabPage = CreateIntroPage();
+ break;
+ case 1:
+ pNewTabPage = CreateSecondPage();
+ break;
+ case 2:
+ pNewTabPage = CreateThirdPage();
+ break;
+ case 3:
+ pNewTabPage = CreateFinnishedPage();
+ break;
+
+ }
+ AddPage( pNewTabPage );
+ }
+}
+
+
+MyWizardDlg-Prev/Next-Handler
+-----------------------------
+
+IMPL_LINK( MyWizardDlg, ImplPrevHdl, PushButton*, pBtn )
+{
+ ShowPrevPage();
+ if ( !GetCurLevel() )
+ pBtn->Disable();
+ return 0;
+}
+
+IMPL_LINK( MyWizardDlg, ImplNextHdl, PushButton*, pBtn )
+{
+ ShowNextPage();
+ if ( GetCurLevel() < 3 )
+ pBtn->Disable();
+ return 0;
+}
+
+*************************************************************************/
+
+// ----------------------
+// - WizardDialog-Types -
+// ----------------------
+
+#define WIZARDDIALOG_BUTTON_STDOFFSET_X 6
+#define WIZARDDIALOG_BUTTON_SMALLSTDOFFSET_X 3
+
+// ----------------
+// - WizardDialog -
+// ----------------
+
+class SVT_DLLPUBLIC WizardDialog : public ModalDialog
+{
+private:
+ Size maPageSize;
+ ImplWizPageData* mpFirstPage;
+ ImplWizButtonData* mpFirstBtn;
+ FixedLine* mpFixedLine;
+ TabPage* mpCurTabPage;
+ PushButton* mpPrevBtn;
+ PushButton* mpNextBtn;
+ Window* mpViewWindow;
+ sal_uInt16 mnCurLevel;
+ WindowAlign meViewAlign;
+ Link maActivateHdl;
+ Link maDeactivateHdl;
+ sal_Int16 mnLeftAlignCount;
+ bool mbEmptyViewMargin;
+
+protected:
+ long LogicalCoordinateToPixel(int iCoordinate);
+ /**sets the number of buttons which should be left-aligned. Normally, buttons are right-aligned.
+
+ only to be used during construction, before any layouting happened
+ */
+ void SetLeftAlignedButtonCount( sal_Int16 _nCount );
+ /** declares the view area to have an empty margin
+
+ Normally, the view area has a certain margin to the top/left/bottom/right of the
+ dialog. By calling this method, you can reduce this margin to 0.
+ */
+ void SetEmptyViewMargin();
+
+#ifdef _SVT_WIZDLG_CXX
+private:
+ SVT_DLLPRIVATE void ImplInitData();
+ SVT_DLLPRIVATE void ImplCalcSize( Size& rSize );
+ SVT_DLLPRIVATE void ImplPosCtrls();
+ SVT_DLLPRIVATE void ImplPosTabPage();
+ SVT_DLLPRIVATE void ImplShowTabPage( TabPage* pPage );
+ SVT_DLLPRIVATE TabPage* ImplGetPage( sal_uInt16 nLevel ) const;
+#endif
+
+public:
+ WizardDialog( Window* pParent, WinBits nStyle = WB_STDTABDIALOG );
+ WizardDialog( Window* pParent, const ResId& rResId );
+ ~WizardDialog();
+
+ virtual void Resize();
+ virtual void StateChanged( StateChangedType nStateChange );
+ virtual long Notify( NotifyEvent& rNEvt );
+
+ virtual void ActivatePage();
+ virtual long DeactivatePage();
+
+ sal_Bool ShowPrevPage();
+ sal_Bool ShowNextPage();
+ sal_Bool ShowPage( sal_uInt16 nLevel );
+ sal_Bool Finnish( long nResult = 0 );
+ sal_uInt16 GetCurLevel() const { return mnCurLevel; }
+
+ void AddPage( TabPage* pPage );
+ void RemovePage( TabPage* pPage );
+ void SetPage( sal_uInt16 nLevel, TabPage* pPage );
+ TabPage* GetPage( sal_uInt16 nLevel ) const;
+
+ void AddButton( Button* pButton, long nOffset = 0 );
+ void RemoveButton( Button* pButton );
+
+ void SetPrevButton( PushButton* pButton ) { mpPrevBtn = pButton; }
+ PushButton* GetPrevButton() const { return mpPrevBtn; }
+ void SetNextButton( PushButton* pButton ) { mpNextBtn = pButton; }
+ PushButton* GetNextButton() const { return mpNextBtn; }
+
+ void ShowButtonFixedLine( sal_Bool bVisible );
+
+ void SetViewWindow( Window* pWindow ) { mpViewWindow = pWindow; }
+ Window* GetViewWindow() const { return mpViewWindow; }
+ void SetViewAlign( WindowAlign eAlign ) { meViewAlign = eAlign; }
+ WindowAlign GetViewAlign() const { return meViewAlign; }
+
+ void SetPageSizePixel( const Size& rSize ) { maPageSize = rSize; }
+ const Size& GetPageSizePixel() const { return maPageSize; }
+
+ void SetActivatePageHdl( const Link& rLink ) { maActivateHdl = rLink; }
+ const Link& GetActivatePageHdl() const { return maActivateHdl; }
+ void SetDeactivatePageHdl( const Link& rLink ) { maDeactivateHdl = rLink; }
+ const Link& GetDeactivatePageHdl() const { return maDeactivateHdl; }
+};
+
+#endif // _SVT_WIZDLG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svtools/xwindowitem.hxx b/include/svtools/xwindowitem.hxx
new file mode 100644
index 000000000000..fd7a8cd40ff9
--- /dev/null
+++ b/include/svtools/xwindowitem.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _XWINDOWITEM_HXX_
+#define _XWINDOWITEM_HXX_
+
+
+#include "svtools/svtdllapi.h"
+
+#include <svl/poolitem.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+
+#include <com/sun/star/awt/XWindow.hpp>
+
+class Window;
+
+//////////////////////////////////////////////////////////////////////
+
+class SVT_DLLPUBLIC XWindowItem : public SfxPoolItem
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xWin;
+
+ // disallow use assignment operator
+ XWindowItem & operator = ( const XWindowItem & );
+
+public:
+ TYPEINFO();
+ XWindowItem();
+ XWindowItem( const XWindowItem &rItem );
+ ~XWindowItem();
+
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual int operator == ( const SfxPoolItem& rAttr ) const;
+
+ Window * GetWindowPtr() const { return VCLUnoHelper::GetWindow( m_xWin ); }
+ com::sun::star::uno::Reference< com::sun::star::awt::XWindow > GetXWindow() const { return m_xWin; }
+};
+
+//////////////////////////////////////////////////////////////////////
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/AccessibleControlShape.hxx b/include/svx/AccessibleControlShape.hxx
new file mode 100644
index 000000000000..54cdd7719c99
--- /dev/null
+++ b/include/svx/AccessibleControlShape.hxx
@@ -0,0 +1,210 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_ACCESSIBILITY_ACCESSIBLE_CONTROL_SHAPE_HXX
+#define _SVX_ACCESSIBILITY_ACCESSIBLE_CONTROL_SHAPE_HXX
+
+#include <svx/AccessibleShape.hxx>
+
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/util/XModeChangeBroadcaster.hpp>
+#include <com/sun/star/container/XContainerListener.hpp>
+#include <cppuhelper/implbase3.hxx>
+#include <comphelper/uno3.hxx>
+
+namespace com { namespace sun { namespace star { namespace awt {
+ class XControl;
+} } } }
+
+namespace comphelper
+{
+ class OWrappedAccessibleChildrenManager;
+}
+
+class SdrObject;
+namespace accessibility {
+
+ typedef ::cppu::ImplHelper4 < ::com::sun::star::beans::XPropertyChangeListener
+ , ::com::sun::star::util::XModeChangeListener
+ , ::com::sun::star::container::XContainerListener
+ , ::com::sun::star::accessibility::XAccessibleEventListener
+ > AccessibleControlShape_Base;
+/** @descr
+*/
+class AccessibleControlShape
+ :public AccessibleShape
+ ,public AccessibleControlShape_Base
+{
+public:
+ //===== internal ========================================================
+ AccessibleControlShape(
+ const AccessibleShapeInfo& rShapeInfo,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo);
+ virtual ~AccessibleControlShape( );
+
+protected:
+ //--- XAccessible ----------------------------------------
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL getAccessibleContext( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //--- XAccessibleComponent -------------------------------
+ /// forward the focus to the contained control(in alive mode)
+ virtual void SAL_CALL grabFocus( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //--- XAccessibleContext ---------------------------------
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
+
+ //--- XServiceInfo ---------------------------------------
+ virtual OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //--- XInterface -----------------------------------------
+ DECLARE_XINTERFACE( )
+
+ //--- XTypeProvider --------------------------------------
+ DECLARE_XTYPEPROVIDER( )
+
+ //--- XPropertyChangeListener ----------------------------
+ virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException);
+
+ //--- XComponent -----------------------------------------
+ virtual void SAL_CALL disposing( );
+
+ //--- XEventListener -------------------------------------
+ virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw(::com::sun::star::uno::RuntimeException);
+
+ //--- XModeChangeListener --------------------------------
+ virtual void SAL_CALL modeChanged( const ::com::sun::star::util::ModeChangeEvent& _rSource ) throw(::com::sun::star::uno::RuntimeException);
+
+ //--- XAccessibleEventListener ----------------------------
+ virtual void SAL_CALL notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException);
+
+ //--- document::XEventListener ----------------------------
+ using AccessibleShape::notifyEvent;
+
+ // XVclContainerListener
+ virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ /** Initialize a new shape. See the documentation of the base' constructor
+ for the reason of this method's existence.
+ */
+ virtual void Init( );
+
+ /// Create a name string that contains the accessible name.
+ virtual OUString
+ CreateAccessibleBaseName( )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ /** Create a unique name string that contains the accessible name. The
+ name consists of the base name and the index.
+ */
+ virtual OUString
+ CreateAccessibleName( )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ /// Create a description string that contains the accessible description.
+ virtual OUString
+ CreateAccessibleDescription( )
+ throw(::com::sun::star::uno::RuntimeException);
+
+#ifdef DBG_UTIL
+ /// Set the specified state
+ virtual sal_Bool SetState( sal_Int16 _nState );
+#endif // DBG_UTIL
+
+ /// (safely) reads the given property from the model of the UNO control
+ OUString getControlModelStringProperty( const OUString& _rPropertyName ) const SAL_THROW(( ));
+
+ /// ensure that our control model exists(will be retrieved upon need only)
+ sal_Bool ensureControlModelAccess( ) SAL_THROW(( ));
+
+ /// ensures that we're listening for the given property if(and only if!) necessary
+ bool ensureListeningState( const bool _bCurrentlyListening, const bool _bNeedNewListening,
+ const OUString& _rPropertyName );
+
+ /// starts multiplexing the state changes of our aggregate context
+ void startStateMultiplexing( );
+ /// stops multiplexing the state changes of our aggregate context
+ void stopStateMultiplexing( );
+
+ /// retrieves the SdrObject of the shape we represent
+ SdrObject* getSdrObject( ) const;
+
+ /** adjusts our AccessibleRole, depending on the control type we're working for
+
+ <p>Only to be called during inituialization</p>
+ */
+ void adjustAccessibleRole( );
+
+ /** initializes composed states of the context
+
+ <p>Some of the states of our inner context need to be propagated to the "composed context", too
+ (such as "checked" for check boxes). At lifetime, this is done by multiplexing state changes,
+ at initialization time, this method is used.</p>
+ */
+ void initializeComposedState( );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ m_xControlModel;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
+ m_xModelPropsMeta; // cache this for performance reasons
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >
+ m_xUnoControl; // our UNO control
+
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessibleContext >
+ m_aControlContext; // the AccessibleContext of the control
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation >
+ m_xControlContextProxy; // the proxy for "aggregating" the AccessibleContext of the control
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider >
+ m_xControlContextTypeAccess; // cached interface of our aggregate
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
+ m_xControlContextComponent; // cached interface of our aggregate
+
+ ::comphelper::OWrappedAccessibleChildrenManager*
+ m_pChildManager;
+
+ bool m_bListeningForName : 1; // are we currently listening for changes of the "Name" property?
+ bool m_bListeningForDesc : 1; // are we currently listening for changes of the "HelpText" property?
+ bool m_bMultiplexingStates : 1; // are we currently multiplexing state changes of the native context?
+ bool m_bDisposeNativeContext : 1; // do we need to dispose mxNativeContextComponent?
+ bool m_bWaitingForControl : 1; // if we are created before our control exists, we need to wait for it to appear ...
+
+private:
+ /** Don't use the default constructor. Use the public constructor that
+ takes the original shape and the parent as arguments instead.
+ */
+ AccessibleControlShape( );
+
+ /// Don't use the constructor. not implemented.
+ AccessibleControlShape(const AccessibleControlShape&);
+
+ /// Don't use the assignment operator. not implemented.
+ AccessibleControlShape& operator= (const AccessibleControlShape&);
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/AccessibleGraphicShape.hxx b/include/svx/AccessibleGraphicShape.hxx
new file mode 100644
index 000000000000..cfe87332fe38
--- /dev/null
+++ b/include/svx/AccessibleGraphicShape.hxx
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_ACCESSIBILITY_ACCESSIBLE_GRAPHIC_SHAPE_HXX
+#define _SVX_ACCESSIBILITY_ACCESSIBLE_GRAPHIC_SHAPE_HXX
+
+#include <svx/AccessibleShape.hxx>
+#include <com/sun/star/accessibility/XAccessibleImage.hpp>
+#include "svx/svxdllapi.h"
+
+namespace accessibility {
+
+/** @descr
+ This class makes graphic shapes accessible. With respect to its
+ base class <type>AccessibleShape</type> it supports the additional
+ <type>XAccessibleImage</type> interface.
+*/
+class SVX_DLLPUBLIC AccessibleGraphicShape
+ : public AccessibleShape,
+ public ::com::sun::star::accessibility::XAccessibleImage
+{
+public:
+ //===== internal ========================================================
+ AccessibleGraphicShape (
+ const AccessibleShapeInfo& rShapeInfo,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo);
+
+ virtual ~AccessibleGraphicShape (void);
+
+ //===== XAccessibleImage ================================================
+
+ OUString SAL_CALL getAccessibleImageDescription (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ sal_Int32 SAL_CALL getAccessibleImageHeight (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ sal_Int32 SAL_CALL getAccessibleImageWidth (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== XInterface ======================================================
+
+ virtual com::sun::star::uno::Any SAL_CALL
+ queryInterface (const com::sun::star::uno::Type & rType)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ acquire (void)
+ throw ();
+
+ virtual void SAL_CALL
+ release (void)
+ throw ();
+
+ //===== XServiceInfo ====================================================
+
+ /** Returns an identifier for the implementation of this object.
+ */
+ virtual OUString SAL_CALL
+ getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Sequence< OUString> SAL_CALL
+ getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== XTypeProvider ===================================================
+
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL
+ getTypes (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ /// Create a name string that contains the accessible name.
+ virtual OUString
+ CreateAccessibleBaseName ()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Create a description string that contains the accessible description.
+ virtual OUString
+ CreateAccessibleDescription ()
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ /** Don't use the default constructor. Use the public constructor that
+ takes the original shape and the parent as arguments instead.
+ */
+ SVX_DLLPRIVATE AccessibleGraphicShape (void);
+
+ /// Don't use the constructor. Not yet implemented.
+ SVX_DLLPRIVATE AccessibleGraphicShape (const AccessibleGraphicShape&);
+
+ /// Don't use the assignment operator. Not yet implemented.
+ SVX_DLLPRIVATE AccessibleGraphicShape& operator= (const AccessibleGraphicShape&);
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/AccessibleOLEShape.hxx b/include/svx/AccessibleOLEShape.hxx
new file mode 100644
index 000000000000..1c3fe797ed59
--- /dev/null
+++ b/include/svx/AccessibleOLEShape.hxx
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_ACCESSIBILITY_ACCESSIBLE_OLE_SHAPE_HXX
+#define _SVX_ACCESSIBILITY_ACCESSIBLE_OLE_SHAPE_HXX
+
+#include <svx/AccessibleShape.hxx>
+
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+#include "svx/svxdllapi.h"
+
+namespace accessibility {
+
+/** @descr
+ This class makes OLE objects accessible. With respect to its
+ base class <type>AccessibleShape</type> it supports the additional
+ <type>XAccessibleAction</type> interface.
+*/
+class SVX_DLLPUBLIC AccessibleOLEShape
+ : public AccessibleShape,
+ public ::com::sun::star::accessibility::XAccessibleAction
+{
+public:
+ //===== internal ========================================================
+ AccessibleOLEShape (
+ const AccessibleShapeInfo& rShapeInfo,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo);
+ virtual ~AccessibleOLEShape (void);
+
+ //===== XAccessibleAction ===============================================
+
+ sal_Int32 SAL_CALL getAccessibleActionCount (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ sal_Bool SAL_CALL doAccessibleAction (sal_Int32 nIndex)
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+
+ OUString SAL_CALL getAccessibleActionDescription (sal_Int32 nIndex)
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleKeyBinding> SAL_CALL getAccessibleActionKeyBinding (
+ sal_Int32 nIndex)
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+
+ //===== XInterface ======================================================
+
+ virtual com::sun::star::uno::Any SAL_CALL
+ queryInterface (const com::sun::star::uno::Type & rType)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ acquire (void)
+ throw ();
+
+ virtual void SAL_CALL
+ release (void)
+ throw ();
+
+ //===== XServiceInfo ====================================================
+
+ virtual OUString SAL_CALL
+ getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Sequence< OUString> SAL_CALL
+ getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== XTypeProvider ===================================================
+
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL
+ getTypes (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ /// Create a name string that contains the accessible name.
+ virtual OUString
+ CreateAccessibleBaseName ()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Create a description string that contains the accessible description.
+ virtual OUString
+ CreateAccessibleDescription ()
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ /** Don't use the default constructor. Use the public constructor that
+ takes the original shape and the parent as arguments instead.
+ */
+ SVX_DLLPRIVATE AccessibleOLEShape (void);
+
+ /// Don't use the constructor. Not yet implemented.
+ SVX_DLLPRIVATE AccessibleOLEShape (const AccessibleOLEShape&);
+
+ /// Don't use the assignment operator. Not yet implemented.
+ SVX_DLLPRIVATE AccessibleOLEShape& operator= (const AccessibleOLEShape&);
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/AccessibleShape.hxx b/include/svx/AccessibleShape.hxx
new file mode 100644
index 000000000000..450b090f7562
--- /dev/null
+++ b/include/svx/AccessibleShape.hxx
@@ -0,0 +1,397 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef _SVX_ACCESSIBILITY_ACCESSIBLE_SHAPE_HXX
+#define _SVX_ACCESSIBILITY_ACCESSIBLE_SHAPE_HXX
+
+#include <editeng/AccessibleContextBase.hxx>
+#include <editeng/AccessibleComponentBase.hxx>
+#include <svx/IAccessibleViewForwarderListener.hxx>
+#include <com/sun/star/document/XEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <svx/AccessibleTextHelper.hxx>
+#include "svx/svxdllapi.h"
+#include "ChildrenManager.hxx"
+
+class SdrObject;
+
+namespace accessibility {
+
+class AccessibleShapeInfo;
+class AccessibleShapeTreeInfo;
+class IAccessibleParent;
+
+/** This base class provides a base implementation for all shapes. For more
+ detailed documentation about the methods refer to the descriptions of
+ the implemented interfaces. These are, among others,
+ <type>XAccessible</type>, <type>XAccessibleContext</type>,
+ <type>XAccessibleComponent</type> and
+ <type>XAccessibleExtendedComponent</type>.
+
+ <p>The children of a shape can stem from two sources which, in case of
+ SVX and SD shapes, are mutually exclusive. This implementation,
+ however, handles both simultaniously to cope with future extensions or
+ shapes from other projects.
+ <ul>
+ <li>If this shape is a group shape, i.e. a
+ <type>SvxShapeGroup</type> or a <type>Svx3DSceneObject</type>, it
+ can have nested shapes.</li>
+ <li>If this shape is a descendant from <type>SvxShapeText</type>
+ then the text paragraphs are its children.</li>
+ </ul>
+ </p>
+
+ <p>Accessible shapes do not listen for disposing() calls of the UNO
+ shapes they make accessible. This is the task of their owner, usually a
+ container, who can then call dispose() at the accessible object.</p>
+*/
+class SVX_DLLPUBLIC AccessibleShape
+ : public AccessibleContextBase,
+ public AccessibleComponentBase,
+ public IAccessibleViewForwarderListener,
+ public ::com::sun::star::document::XEventListener,
+ public ::com::sun::star::lang::XUnoTunnel
+{
+public:
+ //===== internal ========================================================
+
+ /** Create a new accessible object that makes the given shape accessible.
+ @param rShapeInfo
+ This object contains all information specific to the new
+ accessible shape. That are e.g. the shape to be made accessible
+ and the accessible object that will become the parent of the new
+ object.
+ @param rShapeTreeInfo
+ Bundel of information passed to this shape and all of its desendants.
+ @attention
+ Always call the <member>init</member> method after creating a
+ new accessible shape. This is one way to overcome the potential
+ problem of registering the new object with e.g. event
+ broadcasters. That would delete the new object if a broadcaster
+ would not keep a strong reference to the new object.
+ */
+ AccessibleShape (
+ const AccessibleShapeInfo& rShapeInfo,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo);
+
+ /** The destructor releases its children manager and text engine if
+ still existent. These are responsible to send appropriate events.
+ */
+ virtual ~AccessibleShape (void);
+
+ /** Initialize a new shape. See the documentation of the constructor
+ for the reason of this method's existence.
+ */
+ virtual void Init (void);
+
+ /** Compare two accessible shapes using object identity
+ @param rShape
+ This is the second operand.
+ @return
+ Returns true if both shapes are the same object.
+ */
+ virtual bool operator== (const AccessibleShape& rShape);
+
+ /** Set the specified state. If the state is <const>FOCUSED</const>
+ then, additionally to the inherited functionality, the focus
+ listeners registered with the <type>XAccessibleComponent</type>
+ interface are called (if that state really changes).
+
+ @param aState
+ The state to turn on.
+
+ @return
+ The returned flag indicates whether the specified state has been
+ changed (<TRUE/>), i.e. it has formerly not been set.
+ */
+ virtual sal_Bool SetState (sal_Int16 aState);
+
+ /** Reset the specified state. If the state is <const>FOCUSED</const>
+ then, additionally to the inherited functionality, the focus
+ listeners registered with the <type>XAccessibleComponent</type>
+ interface are called (if that state really changes).
+
+ @param aState
+ The state to turn off.
+
+ @return
+ The returned flag indicates whether the specified state has been
+ changed (<TRUE/>), i.e. it has formerly been set.
+ */
+ virtual sal_Bool ResetState (sal_Int16 aState);
+
+ /** Return the state of the specified state. Take the
+ <const>FOCUSED</const> state from the accessible edit engine.
+
+ @param aState
+ The state for which to return its value.
+ @return
+ A value of <TRUE/> indicates that the state is set. A <FALSE/>
+ value indicates an unset state or the inability to access the
+ entity that manages the state set.
+
+ */
+ sal_Bool GetState (sal_Int16 aState);
+
+
+ //===== XAccessibleContext ==============================================
+
+ /// Return the number of currently visible children.
+ virtual sal_Int32 SAL_CALL
+ getAccessibleChildCount (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Return the specified child.
+ @param nIndex
+ Index of the requested child.
+ @return
+ Reference of the requested child which is the accessible object
+ of a visible shape.
+ @raises IndexOutOfBoundsException
+ Throws an exception if the index is not valid.
+ */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> SAL_CALL
+ getAccessibleChild (sal_Int32 nIndex)
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+
+ /// Return the set of current states.
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
+ getAccessibleStateSet (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return this objects index among the parents children.
+ virtual sal_Int32 SAL_CALL
+ getAccessibleIndexInParent (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== XAccessibleComponent ============================================
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleAtPoint (const ::com::sun::star::awt::Point& aPoint)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Int32 SAL_CALL getForeground (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Int32 SAL_CALL getBackground (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== XAccessibleEventBroadcaster =====================================
+
+ /** This call is forwarded to a) the base class and b) to the
+ accessible edit engine if it is present.
+
+ @param rxListener
+ This listener is informed about accessibility events.
+ */
+ virtual void SAL_CALL
+ addAccessibleEventListener (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleEventListener >& rxListener)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** This call is forwarded to a) the base class and b) to the
+ accessible edit engine if it is present.
+
+ @param rxListener
+ This listener will not be informed about accessibility events
+ anymore.
+ */
+ virtual void SAL_CALL
+ removeAccessibleEventListener (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleEventListener >& rxListener)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ //===== XInterface ======================================================
+
+ virtual com::sun::star::uno::Any SAL_CALL
+ queryInterface (const com::sun::star::uno::Type & rType)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ acquire (void)
+ throw ();
+
+ virtual void SAL_CALL
+ release (void)
+ throw ();
+
+
+ //===== XServiceInfo ====================================================
+
+ /** Returns an identifier for the implementation of this object.
+ */
+ virtual OUString SAL_CALL
+ getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Sequence< OUString> SAL_CALL
+ getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== XTypeProvider ===================================================
+
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL
+ getTypes (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== IAccessibleViewForwarderListener ================================
+ virtual void ViewForwarderChanged (ChangeType aChangeType,
+ const IAccessibleViewForwarder* pViewForwarder);
+
+ //===== lang::XEventListener ============================================
+
+ /** Listen for disposing events of the model. The accessible shape
+ remains functional when this happens.
+ */
+ virtual void SAL_CALL
+ disposing (const ::com::sun::star::lang::EventObject& Source)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== document::XEventListener ========================================
+
+ virtual void SAL_CALL
+ notifyEvent (const ::com::sun::star::document::EventObject& rEventObject)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ //===== XUnoTunnel ========================================================
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelImplementationId() throw();
+ static AccessibleShape* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxIFace ) throw();
+ sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& _rIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ //===== Misc ========================================================
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ GetXShape();
+
+ /** set the index _nIndex at the accessible shape
+ @param _nIndex
+ The new index in parent.
+ */
+ inline void setIndexInParent(sal_Int32 _nIndex) { m_nIndexInParent = _nIndex; }
+
+protected:
+ /// Children manager. May be empty if there are no children.
+ ChildrenManager* mpChildrenManager;
+
+ /// Reference to the actual shape.
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape> mxShape;
+
+ /** Bundle of information passed to all shapes in a document tree.
+ */
+ AccessibleShapeTreeInfo maShapeTreeInfo;
+
+ /** Index that is appended to the object's name to disambiguate between
+ different names with the otherwise same name.
+ */
+ long mnIndex;
+
+ /** the index in parent.
+ */
+ sal_Int32 m_nIndexInParent;
+
+ /** The accessible text engine. May be NULL if it can not be created.
+ */
+ AccessibleTextHelper* mpText;
+
+ /** This object can be used to modify the child list of our parent.
+ */
+ IAccessibleParent* mpParent;
+
+ /** This object can be removed when we have an extra interface to ask if the shape is selected
+ */
+ SdrObject* m_pShape;
+
+ /** This method is called from the component helper base class while
+ disposing.
+ */
+ virtual void SAL_CALL disposing (void);
+
+ /** Create a base name string that contains the accessible name.
+ */
+ virtual OUString
+ CreateAccessibleBaseName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Create a unique name string that contains the accessible name. The
+ name consists of the base name and the index.
+ */
+ virtual OUString
+ CreateAccessibleName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Create a description string that contains the accessible description.
+ virtual OUString
+ CreateAccessibleDescription (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Update the <const>OPAQUE</const> and <const>SELECTED</const> state.
+ */
+ virtual void UpdateStates (void);
+
+private:
+ /** Don't use the default constructor. Use the public constructor that
+ takes the original shape and the parent as arguments instead.
+ */
+ SVX_DLLPRIVATE explicit AccessibleShape (void);
+ /// Don't use the copy constructor. Is there any use for it?
+ SVX_DLLPRIVATE explicit AccessibleShape (const AccessibleShape&);
+ /// Don't use the assignment operator. Do we need this?
+ SVX_DLLPRIVATE AccessibleShape& operator= (const AccessibleShape&);
+
+ /** Call this method when the title, name, or description of the mxShape
+ member (may) have been changed.
+ This method adapts the name and description members of the
+ AccessibleContextBase base class.
+ */
+ void UpdateNameAndDescription (void);
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/AccessibleShapeInfo.hxx b/include/svx/AccessibleShapeInfo.hxx
new file mode 100644
index 000000000000..c7ef007c9d65
--- /dev/null
+++ b/include/svx/AccessibleShapeInfo.hxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_ACCESSIBILITY_ACCESSIBLE_SHAPE_INFO_HXX
+#define _SVX_ACCESSIBILITY_ACCESSIBLE_SHAPE_INFO_HXX
+
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <svx/IAccessibleParent.hxx>
+#include "svx/svxdllapi.h"
+
+namespace accessibility {
+
+/** @descr
+ This class is a container for the information specific for a single
+ shape that is passed to the constructor of that shape. It allows to
+ separate the class definitions of the shapes from the information
+ needed on construction. Only the shapes' implementation has to be
+ adapted to a modified <type>AccessibleShapeInfo</type> definition.
+
+ <p>Note that this class complements the
+ <type>AccessibleShapeTreeInfo</type> interface which contains
+ information that is passed to all shapes in a subtree not just to a
+ single shape. </p>
+*/
+class SVX_DLLPUBLIC AccessibleShapeInfo
+{
+public:
+ /** The shape itself for which an accessible object is to be
+ constructed.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape> mxShape;
+
+ /** The accessible parent object of the shape.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> mxParent;
+
+ /** This object that may be realized by the same implementation as that
+ of that of <member>mxParent</member> can be used to modify
+ parent/child relationships with the shape as initiator.
+ Note that NULL is a valid value for this member.
+ */
+ IAccessibleParent* mpChildrenManager;
+
+ /** This index is used to disambiguate names of accessible objects. A
+ value of (the default) -1 leads to the use of the object's z-order
+ instead. Because that is not a good substitute, better pass an ever
+ increasing counter.
+ */
+ sal_Int32 mnIndex;
+
+ /** Copy the given values into the members described above.
+ */
+ AccessibleShapeInfo (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape>& rxShape,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& rxParent,
+ IAccessibleParent* pChildrenManager,
+ sal_Int32 nIndex = -1);
+
+ /** Copy the given values into the members described above.
+ The accessible parent implementation object is set to NULL.
+ */
+ AccessibleShapeInfo (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape>& rxShape,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& rxParent,
+ sal_Int32 nIndex = -1);
+
+ ~AccessibleShapeInfo (void);
+
+ AccessibleShapeInfo (const AccessibleShapeInfo&);
+private:
+ // Don't use these three methods.
+ SVX_DLLPRIVATE explicit AccessibleShapeInfo (void);
+ SVX_DLLPRIVATE AccessibleShapeInfo& operator= (const AccessibleShapeInfo&);
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/AccessibleShapeTreeInfo.hxx b/include/svx/AccessibleShapeTreeInfo.hxx
new file mode 100644
index 000000000000..da234960977e
--- /dev/null
+++ b/include/svx/AccessibleShapeTreeInfo.hxx
@@ -0,0 +1,197 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_ACCESSIBILITY_ACCESSIBLE_SHAPE_TREE_INFO_HXX
+#define _SVX_ACCESSIBILITY_ACCESSIBLE_SHAPE_TREE_INFO_HXX
+
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/document/XEventBroadcaster.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <svx/IAccessibleViewForwarder.hxx>
+#include "svx/svxdllapi.h"
+
+class SdrView;
+class Window;
+
+namespace accessibility {
+
+/** This class bundles all information that is passed down the tree of
+ accessible shapes so that each shape has access to that info.
+
+ There are basically four members that can be set and queried:
+ <ul>
+ <li>The model broadcaster is used for getting notified about shape
+ changes. Using this broadcaster makes in unnecessary to register at
+ each shape seperately.</li>
+ <li>The view forwarder is responsible for transformation between
+ coordinate systems and for providing the visible area both with respect
+ to a specific window.</li>
+ <li>The SdrView is used for creating accessible edit engines.</li>
+ <li>The Window is used for creating accessible edit engines.</li>
+ </ul>
+*/
+class SVX_DLLPUBLIC AccessibleShapeTreeInfo
+{
+public:
+ /** Use this constructor to create an empty object that is filled later
+ with more meaningfull data.
+ */
+ AccessibleShapeTreeInfo (void);
+
+ /** Create a copy of the given shape info.
+ @param rInfo
+ The shape tree info object to copy.
+ */
+ AccessibleShapeTreeInfo (const AccessibleShapeTreeInfo& rInfo);
+
+ ~AccessibleShapeTreeInfo (void);
+
+ AccessibleShapeTreeInfo& operator= (const AccessibleShapeTreeInfo& rInfo);
+
+ /** Deprecated. Don't use this method.
+ */
+ void SetDocumentWindow (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleComponent>& rxViewWindow);
+
+ /** Deprecated. Use the correctly named SetModelBroadcaster method
+ instead.
+ */
+ void SetControllerBroadcaster (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XEventBroadcaster>& rxControllerBroadcaster);
+ /** Deprecated. Use the correctly named GetModelBroadcaster method
+ instead.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XEventBroadcaster>
+ GetControllerBroadcaster (void) const;
+
+ /** Set a new broadcaster that sends events indicating shape changes.
+ The broadcaster usually is or belongs to a document model.
+ @param rxModelBroadcaster
+ The new broadcaster. It replaces the current one. An empty
+ reference may be passed to unset the broadcaster
+ */
+ void SetModelBroadcaster (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XEventBroadcaster>& rxModelBroadcaster);
+
+ /** Return the current model broadcaster.
+ @return
+ The returned reference may be empty if the broadcaster has not
+ been set or has been set to an empty reference.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XEventBroadcaster>
+ GetModelBroadcaster (void) const;
+
+ /** Set the view that will be used to construct SvxTextEditSources which
+ in turn are used to create accessible edit engines.
+ @param pView
+ The new SdrView that replaces the current one. A NULL pointer
+ may be passed to unset the view.
+ */
+ void SetSdrView (SdrView* pView);
+
+ /** Return the current SdrView.
+ @return
+ The returned value may be NULL.
+ */
+ SdrView* GetSdrView (void) const;
+
+ /** Set a new controller. This will usually but not necessarily
+ correspond to the SdrView.
+ @param rxController
+ The new controller that replaces the current one. An empty
+ reference may be passed to unset the controller.
+ */
+ void SetController (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XController>& rxController);
+
+ /** Return the currently set controller.
+ @return
+ The reference to the currently set controller may be empty.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XController>
+ GetController (void) const;
+
+ /** Set the window that is used to construct SvxTextEditSources which in
+ turn is used to create accessible edit engines.
+ */
+ void SetWindow (Window* pWindow);
+
+ /** Return the current Window.
+ @return
+ The returned value may be NULL.
+ */
+ Window* GetWindow (void) const;
+
+ /** The view forwarder allows the transformation between internal
+ and pixel coordinates and can be asked for the visible area.
+ @param pViewForwarder
+ This view forwarder replaces the current one.
+ */
+ void SetViewForwarder (const IAccessibleViewForwarder* pViewForwarder);
+
+ /** Return the current view forwarder.
+ @return
+ The returned pointer may be NULL.
+ */
+ const IAccessibleViewForwarder* GetViewForwarder (void) const;
+
+private:
+ /** Deprecated.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleComponent> mxDocumentWindow;
+
+ /** this broadcaster sends events indicating shape changes.
+ The broadcaster usually is or belongs to a document model.
+
+ This once was named mxControllerBroadcaster.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XEventBroadcaster> mxModelBroadcaster;
+
+ /** This view is necessary to construct an SvxTextEditSource which in
+ turn is used to create an accessible edit engine.
+ */
+ SdrView* mpView;
+
+ /** The controller is used e.g. for obtaining the selected shapes.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XController> mxController;
+
+ /** This window is necessary to construct an SvxTextEditSource which in
+ turn is used to create an accessible edit engine.
+ */
+ Window* mpWindow;
+
+ /** The view forwarder allows the transformation between internal
+ and pixel coordinates and can be asked for the visible area.
+ */
+ const IAccessibleViewForwarder* mpViewForwarder;
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/AccessibleTableShape.hxx b/include/svx/AccessibleTableShape.hxx
new file mode 100644
index 000000000000..fe239cf271c7
--- /dev/null
+++ b/include/svx/AccessibleTableShape.hxx
@@ -0,0 +1,126 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_ACCESSIBILITY_ACCESSIBLE_TABLE_SHAPE_HXX
+#define _SVX_ACCESSIBILITY_ACCESSIBLE_TABLE_SHAPE_HXX
+
+#include <com/sun/star/table/XTable.hpp>
+#include <com/sun/star/accessibility/XAccessibleTable.hpp>
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+
+#include <rtl/ref.hxx>
+
+#include <cppuhelper/implbase2.hxx>
+
+#include <svx/AccessibleShape.hxx>
+
+#include <boost/noncopyable.hpp>
+
+namespace sdr { namespace table {
+ class SvxTableController;
+} }
+
+namespace accessibility
+{
+ class AccessibleTableShapeImpl;
+
+ typedef ::cppu::ImplInheritanceHelper2< AccessibleShape,
+ ::com::sun::star::accessibility::XAccessibleSelection,
+ ::com::sun::star::accessibility::XAccessibleTable
+ > AccessibleTableShape_Base;
+/** @descr
+*/
+class AccessibleTableShape : boost::noncopyable, public AccessibleTableShape_Base
+{
+public:
+ AccessibleTableShape( const AccessibleShapeInfo& rShapeInfo, const AccessibleShapeTreeInfo& rShapeTreeInfo );
+ virtual ~AccessibleTableShape( );
+
+ virtual void Init (void);
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire( ) throw ();
+ virtual void SAL_CALL release( ) throw ();
+
+ // XAccessible
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL getAccessibleContext( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole (void) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleTable
+ virtual sal_Int32 SAL_CALL getAccessibleRowCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleColumnCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getAccessibleRowDescription( sal_Int32 nRow ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getAccessibleColumnDescription( sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL getAccessibleRowHeaders( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL getAccessibleColumnHeaders( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleRows( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleColumns( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isAccessibleRowSelected( sal_Int32 nRow ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isAccessibleColumnSelected( sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleCaption( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleSummary( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleRow( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleColumn( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleSelection
+ virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL clearAccessibleSelection( ) throw ( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL selectAllAccessibleChildren( ) throw ( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw ( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nChildIndex ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException );
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL disposing( );
+
+ using AccessibleShape::disposing;
+
+protected:
+ virtual OUString CreateAccessibleBaseName(void) throw (::com::sun::star::uno::RuntimeException);
+
+ sdr::table::SvxTableController* getTableController();
+
+ void checkCellPosition( sal_Int32 nCol, sal_Int32 nRow ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException );
+ void getColumnAndRow( sal_Int32 nChildIndex, sal_Int32& rnColumn, sal_Int32& rnRow ) throw (::com::sun::star::lang::IndexOutOfBoundsException );
+
+private:
+ rtl::Reference< AccessibleTableShapeImpl > mxImpl;
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/AccessibleTextHelper.hxx b/include/svx/AccessibleTextHelper.hxx
new file mode 100644
index 000000000000..c930af0cb2e4
--- /dev/null
+++ b/include/svx/AccessibleTextHelper.hxx
@@ -0,0 +1,425 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_ACCESSILE_TEXT_HELPER_HXX_
+#define _SVX_ACCESSILE_TEXT_HELPER_HXX_
+
+#include <memory>
+#include <sal/types.h>
+#include <tools/gen.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include "svx/svxdllapi.h"
+
+
+class SvxTextForwarder;
+class SvxViewForwarder;
+class SvxEditSource;
+
+namespace accessibility
+{
+
+ class AccessibleTextHelper_Impl;
+
+ /** Helper class for objects containing EditEngine/Outliner text
+
+ This class provides the methods from the XAccessibleContext,
+ XAccessibleEventBroadcaster and XAccessibleComponent
+ interfaces, that are common to all accessible objects
+ containing an edit engine.
+
+ The text contained in the EditEngine/Outliner is presented as
+ children of this class, namely for every text paragraph a
+ AccessibleEditableTextPara child object is generated. As this
+ class manages these children for itself, it has to send out
+ AccessibleEventId::CHILD events on your
+ behalf. Thus, you must forward every call to your
+ addEventListener()/removeEventListener() methods to the
+ AccessibleTextHelper (methods
+ AddEventListener/RemoveEventListener), otherwise none or not
+ every one of your event listener will notice child changes.
+
+ You have to implement the SvxEditSource, SvxTextForwarder,
+ SvxViewForwarder and SvxEditViewForwarder interfaces in order
+ to enable your object to cooperate with this
+ class. SvxTextForwarder encapsulates the fact that text
+ objects do not necessarily have an EditEngine at their
+ disposal, SvxViewForwarder and SvxEditViewForwarder do the
+ same for the document and the edit view. The three mentioned
+ forwarder objects are not stored by the AccessibleTextHelper,
+ but fetched every time from the SvxEditSource. So you are best
+ off making your SvxEditSource::Get*Forwarder methods cache the
+ current forwarder.
+
+ To support changes in edit mode or conversion of fixed text
+ into EditEngine text, you can change the SvxEditSource this
+ class is referring to. This might render all children invalid
+ and change the child count, since the AccessibleTextHelper
+ reinitializes itself from scratch.
+
+ This class registers itself at the SvxEditSource as a state
+ listener and manages the state of its children (i.e. the
+ paragraphs). See the method documentation of
+ AccessibleTextHelper::SetEditSource for the expected
+ events. Generally, be prepared that when sending any of these
+ events via SvxEditSource::GetBroadcaster() broadcaster, the
+ AccessibleTextHelper will call the SvxEditSource and their
+ forwarder to update it's state. Avoid being inconsistent in
+ the facts you tell in the events, e.g. when sending a
+ TEXT_HINT_PARAINSERTED event, the
+ SvxEditSource::GetTextForwarder().GetParagraphCount() should
+ already include the newly inserted paragraph.
+
+ @attention All public methods must not be called with any
+ mutex hold, except when calling from the main thread (with
+ holds the solar mutex), unless stated otherwise. This is
+ because they themselves might need the solar mutex in addition
+ to the object mutex, and the ordering of the locking must be:
+ first solar mutex, then object mutex. Furthermore, state
+ change events might be fired internally.
+
+ @derive Use this class in an aggregation and forward, or
+ derive from it and overwrite. If the Remove/AddEventListener
+ methods are overwritten, make sure FireEvent is adapted,
+ too.
+
+ @see SvxEditSource
+ @see SvxTextForwarder
+ @see SvxViewForwarder
+ @see SvxEditViewForwarder
+ */
+ class SVX_DLLPUBLIC AccessibleTextHelper
+ {
+
+ public:
+ typedef ::std::vector< sal_Int16 > VectorOfStates;
+
+ /** Create accessible text object for given edit source
+
+ @param pEditSource
+ The edit source to use. Object ownership is transferred
+ from the caller to the callee. The object listens on the
+ SvxEditSource for object disposal, so no provisions have
+ to be taken if the caller destroys the data (e.g. the
+ model) contained in the given SvxEditSource.
+
+ */
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ explicit AccessibleTextHelper( ::std::auto_ptr< SvxEditSource > pEditSource );
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+ virtual ~AccessibleTextHelper();
+
+ protected:
+
+ // declared, but not defined
+ AccessibleTextHelper( const AccessibleTextHelper& );
+ // declared, but not defined
+ AccessibleTextHelper& operator= ( const AccessibleTextHelper& );
+
+ public:
+ /** Query the current edit source
+
+ @attention This method returns by reference, so you are
+ responsible for serialization (typically, you aquired the
+ solar mutex when calling this method). Thus, the method
+ should only be called from the main office thread.
+
+ */
+ virtual const SvxEditSource& GetEditSource() const SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ /** Set the current edit source
+
+ @attention Might fire state change events, therefore,
+ don't hold any mutex except solar mutex, which you are
+ required to lock before. This method should only be called
+ from the main office thread.
+
+ The EditSource set here is required to broadcast out the
+ following hints: EDITSOURCE_HINT_PARASMOVED,
+ EDITSOURCE_HINT_SELECTIONCHANGED, TEXT_HINT_MODIFIED,
+ TEXT_HINT_PARAINSERTED, TEXT_HINT_PARAREMOVED,
+ TEXT_HINT_TEXTHEIGHTCHANGED,
+ TEXT_HINT_VIEWSCROLLED. Otherwise, not all state changes
+ will get noticed by the accessibility object. Further
+ more, when the corresponding core object or the model is
+ dying, either the edit source must be set to NULL or it
+ has to broadcast a SFX_HINT_DYING hint.
+
+ If the SvxEditSource's managed text can change between
+ edit/non-edit mode (i.e. there are times when
+ SvxEditSource::GetEditViewForwarder(sal_False) returns
+ NULL), then the two additional hints are required:
+ HINT_BEGEDIT and HINT_ENDEDIT. When the
+ AccessibleTextHelper receives a HINT_BEGEDIT, it expects
+ the SvxEditSource already in edit mode. On a HINT_ENDEDIT,
+ edit mode must already been left. The rationale for these
+ events are the fact that focus and selection have to be
+ updated in edit mode, and completely relinquished and
+ reset to the parent (for the focus) in non-edit mode.
+
+ This class does not have a dispose method, since it is not
+ a UNO component. Nevertheless, it holds C++ references to
+ several core objects, so you should issue a
+ SetEditSource(::std::auto_ptr<SvxEditSource>(NULL)) in
+ your dispose() method.
+
+ @param pEditSource
+ The new edit source to set. Object ownership is transferred
+ from the caller to the callee.
+ */
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ virtual void SetEditSource( ::std::auto_ptr< SvxEditSource > pEditSource ) SAL_THROW((::com::sun::star::uno::RuntimeException));
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+
+ /** Set the event source
+
+ You should set the event source before registering any
+ event listener and before requesting any child. Children
+ of this object receive the event source as their parent
+ accessible object. That is, the event source is best set
+ in your object's init method.
+
+ @attention When setting a reference here, you should call
+ Dispose() when you as the owner are disposing, since until
+ then this object will hold that reference
+
+ @param rInterface
+ The interface that should be set as the source for
+ accessibility events sent by this object.
+ */
+ virtual void SetEventSource( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rInterface );
+
+ /** Get the event source
+
+ @return the interface that is set as the source for
+ accessibility events sent by this object.
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetEventSource() const;
+
+ /** Set offset of EditEngine/Outliner from parent
+
+ If the origin of the underlying EditEngine/Outliner does
+ not correspond to the upper left corner of the object
+ using this class, you have to specify the offset.
+
+ @attention Might fire state change events, therefore,
+ don't hold any mutex except solar mutex, which you are
+ required to lock before. This method should only be called
+ from the main office thread.
+
+ @param rPoint
+ The offset in screen coordinates (i.e. pixel)
+ */
+ virtual void SetOffset( const Point& rPoint );
+
+ /** Query offset of EditEngine/Outliner from parent
+
+ @return the offset in screen coordinates (i.e. pixel)
+ */
+ virtual Point GetOffset() const;
+
+ /** Set offset the object adds to all children's indices
+
+ This can be used if the owner of this object has children
+ handled by itself. Setting an offset different from 0
+ leads to this object mimicking that all it's children are
+ within the range [nOffset, GetChildCount()+nOffset). That
+ means, GetChild() also expects the index to be in this
+ range.
+
+ @attention Might fire state change events, therefore,
+ don't hold any mutex except solar mutex, which you are
+ required to lock before. This method should only be called
+ from the main office thread.
+
+ @param nOffset
+ The offset to add to every children's index.
+ */
+ virtual void SetStartIndex( sal_Int32 nOffset );
+
+ /** Query offset the object adds to all children's indices
+
+ @return the offset to add to every children's index.
+ */
+ virtual sal_Int32 GetStartIndex() const;
+
+ /** Sets a vector of additional accessible states.
+
+ The states are passed to every created child object
+ (text paragraph). The state values are defined in
+ com::sun::star::accessibility::AccessibleStateType.
+
+ This function has to be called before querying for
+ any children (e.g. with GetChild()).
+ */
+ void SetAdditionalChildStates( const VectorOfStates& rChildStates );
+
+ /** Update the visible children
+
+ @attention Might fire state change events, therefore,
+ don't hold any mutex except solar mutex, which you are
+ required to lock before. This method should only be called
+ from the main office thread.
+
+ This method reevaluates the visibility of all
+ children. Call this method if your visibility state has
+ changed somehow, e.g. if the visible area has changed and
+ the AccessibleTextHelper isn't notified internally
+ (e.g. via TEXT_HINT_VIEWSCROLLED). Normally, there should
+ not be a need to call this method.
+ */
+ virtual void UpdateChildren() SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ /** Drop all references and enter disposed state
+
+ This method drops all references to external objects (also
+ the event source reference set via SetEventSource()) and
+ sets the object into the disposed state (i.e. the methods
+ return default values or throw a uno::DisposedException
+ exception).
+ */
+ virtual void Dispose();
+
+ /** Set the focus state of the accessibility object
+
+ Since this class handles children which also might get the
+ focus, the user of this class is encouraged to delegate
+ focus handling. Whenever the focus state of the
+ surrounding object changes, this method has to be called.
+
+ The protocol of focus handling for a user of this class is
+ then to call SetFocus() with the appropriate focus state,
+ and HaveFocus() to determine the focus state you tell the
+ outside.
+
+ @attention Might fire state change events, therefore,
+ don't hold any mutex except solar mutex, which you are
+ required to lock before. This method should only be called
+ from the main office thread.
+
+ @param bHaveFocus
+ Whether we got or we lost the focus. Set to sal_True if
+ focus is gotten, sal_False otherwise.
+
+ @see HaveFocus()
+ */
+ virtual void SetFocus( sal_Bool bHaveFocus = sal_True ) SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ /** Query the focus state of the surrounding object
+
+ If focus handling is delegated to this class, determine
+ focus state with this method. Be prepared that even if you
+ set the focus with SetFocus(sal_True), this method might
+ return sal_False. This is the case if one of the children
+ actually got the focus.
+
+ @return the state of the focus ownership
+ */
+ virtual sal_Bool HaveFocus() SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ /** Call this method to invoke all event listeners with the given event
+
+ @attention Fires state change events, therefore, don't hold any mutex
+
+ @param nEventId
+ Id of the event to send, @see AccessibleEventId
+
+ @param rNewValue
+ The value we've changed into
+
+ @param rOldValue
+ The old value before the change
+ */
+ virtual void FireEvent( const sal_Int16 nEventId,
+ const ::com::sun::star::uno::Any& rNewValue = ::com::sun::star::uno::Any(),
+ const ::com::sun::star::uno::Any& rOldValue = ::com::sun::star::uno::Any() ) const;
+
+ /** Call this method to invoke all event listeners with the given event
+
+ @attention Fires state change events, therefore, don't hold any mutex
+
+ @param rEvent
+ The event to send, @see AccessibleEventObject
+
+ */
+ // TODO: make that virtual next time
+ void FireEvent( const ::com::sun::star::accessibility::AccessibleEventObject& rEvent ) const;
+
+ /** Query select state of the text managed by this object
+
+ @attention Don't call with locked mutexes. You may hold
+ the solar mutex, but this method aquires it anyway.
+
+ @return sal_True, if the text or parts of it are currently selected
+ */
+ virtual sal_Bool IsSelected() const;
+
+ // XAccessibleContext child handling methods
+ //-----------------------------------------------------------------
+ /** Implements getAccessibleChildCount
+
+ @attention Don't call with locked mutexes. You may hold
+ the solar mutex, but this method aquires it anyway.
+ */
+ virtual sal_Int32 GetChildCount() SAL_THROW((::com::sun::star::uno::RuntimeException));
+ /** Implements getAccessibleChild
+
+ @attention Don't call with locked mutexes. You may hold
+ the solar mutex, but this method aquires it anyway.
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetChild( sal_Int32 i ) SAL_THROW((::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException));
+
+ // XAccessibleEventBroadcaster child related methods
+ //-----------------------------------------------------------------
+ /** Implements addEventListener
+
+ @attention Don't call with locked mutexes
+ */
+ virtual void AddEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) SAL_THROW((::com::sun::star::uno::RuntimeException));
+ /** Implements removeEventListener
+
+ @attention Don't call with locked mutexes
+ */
+ virtual void RemoveEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ // XAccessibleComponent child related methods
+ //-----------------------------------------------------------------
+ /** Implements getAccessibleAt
+
+ @attention Don't call with locked mutexes. You may hold
+ the solar mutex, but this method aquires it anyway.
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL GetAt( const ::com::sun::star::awt::Point& aPoint ) SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ private:
+
+ /// @dyn
+ const std::auto_ptr< AccessibleTextHelper_Impl > mpImpl;
+
+ };
+
+} // end of namespace accessibility
+
+#endif /* _SVX_ACCESSILE_TEXT_HELPER_HXX_ */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/ActionDescriptionProvider.hxx b/include/svx/ActionDescriptionProvider.hxx
new file mode 100644
index 000000000000..ce616409922e
--- /dev/null
+++ b/include/svx/ActionDescriptionProvider.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_ACTIONDESCRIPTIONPROVIDER_HXX
+#define _SVX_ACTIONDESCRIPTIONPROVIDER_HXX
+
+#include "svx/svxdllapi.h"
+
+// header for class OUString
+#include <rtl/ustring.hxx>
+
+//-----------------------------------------------------------------------------
+/** This class provides localized descriptions for some basic actions done with objects.
+The strings are intended to be provided to the user e.g. as description for undo actions in the menu.
+The name of the object acted on and the type of action needs to be given as input parameter.
+*/
+
+class SVX_DLLPUBLIC ActionDescriptionProvider
+{
+public:
+ enum ActionType
+ {
+ INSERT
+ , DELETE
+ , CUT
+ , MOVE
+ , RESIZE
+ , ROTATE
+ , TRANSFORM
+ , FORMAT
+ , MOVE_TOTOP
+ , MOVE_TOBOTTOM
+ , POS_SIZE
+ };
+
+public:
+ static OUString createDescription( ActionType eActionType
+ , const OUString& rObjectName );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/ChildrenManager.hxx b/include/svx/ChildrenManager.hxx
new file mode 100644
index 000000000000..6f05fe95426a
--- /dev/null
+++ b/include/svx/ChildrenManager.hxx
@@ -0,0 +1,210 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_ACCESSIBILITY_CHILDREN_MANAGER_HXX
+#define _SVX_ACCESSIBILITY_CHILDREN_MANAGER_HXX
+
+#include <svx/IAccessibleViewForwarderListener.hxx>
+#include <svx/AccessibleShapeTreeInfo.hxx>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <memory>
+#include "svx/svxdllapi.h"
+
+namespace accessibility {
+
+class AccessibleContextBase;
+class AccessibleShape;
+class ChildrenManagerImpl;
+
+/** The <type>AccessibleChildrenManager</type> class acts as a cache of the
+ accessible objects of the currently visible shapes of a draw page and as
+ a factory to create the corresponding accessible object for a given
+ shape.
+
+ <p>There are two sources of shapes. The first is a list of UNO shapes.
+ It is passes to the constructor and can be re-set with a call to
+ <member>SetShapeList</member>. Accessibility objects which represent
+ these shapes are constructed usually on demand. The second source is a
+ set of single <type>AccessibleShape</type> objects added by calls to
+ <member>AddAccessibleShape</member>. These are not modified by this
+ class. They are only copied into the list of visible shapes depending
+ on their visibility. The later list can be cleared by calling
+ <member>ClearAccessibleShapeList</member>. The actual set of children
+ accessible through the <member>GetChildrenCount</member> and
+ <member>GetChild</member> methods are the accessible objects that lie
+ completely or partially inside the visible area obtained from the view
+ forwarder in the shape tree info.</p>
+
+ <p>A children manager registers itself at the broadcaster passed to its
+ constructor and transforms/forwards the received events to the listeners
+ of the also given context base. The transformation process includes
+ interpreting a <type>document::XEventListener</type>, the change from
+ XShape references to the associated XAccessible reference, and the
+ creation of an XAccessibleEventObject. The event object is then passed
+ to the <method>fireEvent</method> method of the context and from there
+ forwarded to all listeners.</p>
+
+ <p>Note that some of the data given to the constructor is passed to the
+ accessible shape objects created by that child manager which in turn
+ pass these data to their child managers. The data is thus propagated
+ down a tree of child managers/accessible shape objects from a top level
+ class that is usually a document/model. This is the way to give all
+ accessible objects access to data normally known only to the top level
+ owner of the shapes.</p>
+*/
+class SVX_DLLPUBLIC ChildrenManager
+ : public IAccessibleViewForwarderListener
+{
+public:
+ /** Create a children manager, which manages the children of the given
+ parent. The parent is used for creating accessible objects. The
+ list of shapes for which to create those objects is not derived from
+ the parent and has to be provided seperately by calling one of the
+ update methods.
+ @param rxParent
+ The parent of the accessible objects which will be created
+ on demand at some point of time in the future.
+ @param rxShapeList
+ List of UNO shapes to manage.
+ @param rShapeTreeInfo
+ Bundel of information passed down the shape tree.
+ @param rContext
+ An accessible context object that is called for fireing events
+ for new and deleted children, i.e. that holds a list of
+ listeners to be informed.
+ */
+ ChildrenManager (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& rxParent,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes>& rxShapeList,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo,
+ AccessibleContextBase& rContext);
+
+ /** If there still are managed children these are marked as DEFUNC and
+ released.
+ */
+ virtual ~ChildrenManager (void);
+
+ /** Return the number of currently visible accessible children.
+ @return
+ If there are no children a 0 is returned.
+ */
+ long GetChildCount (void) const throw ();
+
+ /** Return the requested accessible child or throw and
+ IndexOutOfBoundsException if the given index is invalid.
+ @param nIndex
+ Index of the requested child. Call getChildCount for obtaining
+ the number of children.
+ @return
+ In case of a valid index this method returns a reference to the
+ requested accessible child. This reference is empty if it has
+ not been possible to create the accessible object of the
+ corresponding shape.
+ @raises
+ Throws an IndexOutOfBoundsException if the index is not valid.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>
+ GetChild (long nIndex)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IndexOutOfBoundsException);
+
+ /** Update the child manager. Take care of a modified set of children
+ and modified visible area. This method can optimize the update
+ process with respect seperate updates of a modified children list
+ and visible area.
+ @param bCreateNewObjectsOnDemand
+ If </true> then accessible objects associated with the visible
+ shapes are created only when asked for. No event is sent on
+ creation. If </false> then the accessible objects are created
+ before this method returns and events are sent to inform the
+ listeners of the new object.
+ */
+ void Update (bool bCreateNewObjectsOnDemand = true);
+
+ /** Replace the list of UNO shapes by the specified list.
+ @param xShapeList
+ The new list of shapes.
+ */
+ void SetShapeList (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes>& xShapeList);
+
+ /** Add an accessible shape. The difference to the UNO shapes in the
+ list passed to the constructor the specified object does not have to
+ be created by the shape factory. This gives the caller full control
+ over object creation.
+
+ @param pShape
+ This class <em>does</em> take ownership of the argument.
+ */
+ void AddAccessibleShape (std::auto_ptr<AccessibleShape> pShape);
+
+ /** Clear the list of accessible shapes which have been added by
+ previous calls to <member>AddAccessibleShape</member>.
+ */
+ void ClearAccessibleShapeList (void);
+
+ /** Take a new event shape tree info. Call this method to inform the
+ children manager of a change of the info bundle.
+ @param rShapeTreeInfo
+ The new info that replaces the current one.
+ */
+ void SetInfo (AccessibleShapeTreeInfo& rShapeTreeInfo);
+
+ /** Update the SELECTED and FOCUSED states of all visible children
+ according to the given selection. This includes setting
+ <em>and</em> resetting the states.
+ */
+ void UpdateSelection (void);
+
+ /** Return whether one of the shapes managed by this object has
+ currently the focus.
+ @return
+ Returns <true/> when there is a shape that has the focus and
+ <false/> when there is no such shape.
+ */
+ bool HasFocus (void);
+
+ /** When there is a shape that currently has the focus,
+ i.e. <member>HasFocus()</member> returns <true/> then remove the
+ focus from that shape. Otherwise nothing changes.
+ */
+ void RemoveFocus (void);
+
+ //===== IAccessibleViewForwarderListener ================================
+ virtual void ViewForwarderChanged (ChangeType aChangeType,
+ const IAccessibleViewForwarder* pViewForwarder);
+
+protected:
+ ChildrenManagerImpl* mpImpl;
+
+private:
+ // Don't use the copy constructor or the assignment operator. They are
+ // not implemented (and are not intended to be).
+ SVX_DLLPRIVATE ChildrenManager (const ChildrenManager&);
+ SVX_DLLPRIVATE ChildrenManager& operator= (const ChildrenManager&);
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/DescriptionGenerator.hxx b/include/svx/DescriptionGenerator.hxx
new file mode 100644
index 000000000000..fce8478719c9
--- /dev/null
+++ b/include/svx/DescriptionGenerator.hxx
@@ -0,0 +1,200 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef _SVX_ACCESSIBILITY_DESCRIPTION_GENERATOR_HXX
+#define _SVX_ACCESSIBILITY_DESCRIPTION_GENERATOR_HXX
+
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <rtl/ustrbuf.hxx>
+#include "svx/svxdllapi.h"
+
+
+namespace accessibility {
+
+/** This class creates description strings for shapes.
+ <p>Initialized with a given shape additional calls to the
+ <member>addProperty</member> method will build a descriptive string that
+ starts with a general shape description and the shapes style. Appended
+ are all the specified property names and values that differ from the
+ default values in the style.</p>
+*/
+class SVX_DLLPUBLIC DescriptionGenerator
+{
+public:
+ enum PropertyType {
+ COLOR,
+ INTEGER,
+ STRING,
+ FILL_STYLE
+ };
+
+ /** Creates a new description generator with an empty description
+ string. Usually you will want to call initialize next to specifiy
+ a general description of the shape.
+ @param xShape
+ The shape from which properties will be extracted by later calls
+ to <member>addProperty</member>.
+ */
+ DescriptionGenerator (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape>& xShape);
+
+ ~DescriptionGenerator (void);
+
+ /** Initialize the description with the given prefix followed by the
+ shape's style in parantheses and a colon.
+ @param sPrefix
+ An introductory description of the shape that is made more
+ specific by later calls to <member>addProperty</member>.
+ */
+ void Initialize (OUString sPrefix);
+
+ /** Initialize the description with the specified string from the
+ resource followed by the shape's style in parantheses and a colon.
+ @param nResourceId
+ A resource id the specifies the introductory description of the
+ shape that is made more specific by later calls to
+ <member>addProperty</member>.
+ */
+ void Initialize (sal_Int32 nResourceId);
+
+ /** Returns the description string and then resets it. Usually called
+ as last method before destroying the object.
+ @return
+ The description string in its current form.
+ */
+ OUString operator() (void);
+
+ /** Add the given property name and its associated value to the
+ description string. If the property value does not differ from the
+ default value of the shape's style then the description string is
+ not modified.
+ @param sPropertyName
+ The Name of the property to append.
+ @param aType
+ Type of the property's value. It controls the transformation
+ into the value's string representation.
+ @param sLocalizedName
+ Localized name of the property. An empty string tells the
+ method to use the property name instead.
+ @param nWhichId
+ This which id is used to localize the property value. If it is
+ not known a value of -1 signals to use a default representation.
+ */
+ void AddProperty (const OUString& sPropertyName,
+ PropertyType aType,
+ const OUString& sLocalizedName=OUString(),
+ long nWhichId=-1);
+
+ /** Add the given property name and its associated value to the
+ description string. If the property value does not differ from the
+ default value of the shape's style then the description string is
+ not modified. This method forwards the request to its cousing but
+ first replaces the id of the localized name by the associated string
+ from the resource.
+ @param sPropertyName
+ The Name of the property to append.
+ @param aType
+ Type of the property's value. It controls the transformation
+ into the value's string representation.
+ @param nResourceId
+ Id of the kocalized name of the property int the resource.
+ @param nWhichId
+ This which id is used to localize the property value. If it is
+ not known a value of -1 signals to use a default representation.
+ */
+ void AddProperty (const OUString& sPropertyName,
+ PropertyType aType,
+ sal_Int32 nResourceId,
+ long nWhichId=-1);
+
+ /** Append the given string as is to the current description.
+ @param sString
+ String to append to the current description. It is not modified
+ in any way.
+ */
+ void AppendString (const OUString& sString);
+
+ /** Add properties that describe line and border attributes.
+ */
+ void AddLineProperties (void);
+
+ /** Add properties that describe how areas are filled.
+ */
+ void AddFillProperties (void);
+
+ /** Add properties that describesattributes of 3D objects.
+ */
+ void Add3DProperties (void);
+
+ /** Add properties that describe text attributes.
+ */
+ void AddTextProperties (void);
+
+private:
+ /// Reference to the shape from which the properties are extracted.
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape> mxShape;
+
+ /// Reference to the shape's property set.
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> mxSet;
+
+ /// The description string that is build.
+ OUStringBuffer msDescription;
+
+ /** This flag is used to determine whether to insert a separator e.g. a
+ comma before the next property.
+ */
+ bool mbIsFirstProperty;
+
+ /** Add a property value formated as color to the description string.
+ */
+ SVX_DLLPRIVATE void AddColor (const OUString& sPropertyName,
+ const OUString& sLocalizedName);
+
+ /** Add a property value formated as integer to the description string.
+ */
+ SVX_DLLPRIVATE void AddInteger (const OUString& sPropertyName,
+ const OUString& sLocalizedName);
+
+ /** Add a property value formated as string to the description string.
+ @param sPropertyName
+ Name of the property.
+ */
+ SVX_DLLPRIVATE void AddString (const OUString& sPropertyName,
+ const OUString& sLocalizedName, long nWhichId = -1);
+
+ /** Add a property value formated as fill style to the description
+ string. If the fill style is <const>HATCH</const>,
+ <const>GRADIENT</const>, or <const>BITMAP</const>, then the of the
+ hatch, gradient, or bitmap is appended as well.
+ @param sPropertyName
+ Name of the property. Usually this will be "FillStyle".
+ */
+ SVX_DLLPRIVATE void AddFillStyle (const OUString& sPropertyName,
+ const OUString& sLocalizedName);
+};
+
+
+} // end of namespace accessibility
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/EnhancedCustomShape2d.hxx b/include/svx/EnhancedCustomShape2d.hxx
new file mode 100644
index 000000000000..600e247db6b5
--- /dev/null
+++ b/include/svx/EnhancedCustomShape2d.hxx
@@ -0,0 +1,228 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _ENHANCEDCUSTOMSHAPE2D_HXX
+#define _ENHANCEDCUSTOMSHAPE2D_HXX
+
+#include <svx/msdffdef.hxx>
+#include <svx/sdasitm.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <svl/itemset.hxx>
+#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeParameter.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
+#include <svx/EnhancedCustomShapeFunctionParser.hxx>
+#include <tools/gen.hxx>
+
+#include <boost/shared_ptr.hpp>
+#include <vector>
+
+#define DFF_CUSTOMSHAPE_FLIP_V 1
+#define DFF_CUSTOMSHAPE_FLIP_H 2
+#define DFF_CUSTOMSHAPE_EXCH 4
+
+class SdrModel;
+class SdrObject;
+class SfxItemSet;
+struct SvxMSDffVertPair;
+struct SvxMSDffCalculationData;
+struct SvxMSDffTextRectangles;
+
+#define HANDLE_FLAGS_MIRRORED_X 0x0001
+#define HANDLE_FLAGS_MIRRORED_Y 0x0002
+#define HANDLE_FLAGS_SWITCHED 0x0004
+#define HANDLE_FLAGS_POLAR 0x0008
+#define HANDLE_FLAGS_MAP 0x0010
+#define HANDLE_FLAGS_RANGE_X_MINIMUM 0x0020
+#define HANDLE_FLAGS_RANGE_X_MAXIMUM 0x0040
+#define HANDLE_FLAGS_RANGE_Y_MINIMUM 0x0080
+#define HANDLE_FLAGS_RANGE_Y_MAXIMUM 0x0100
+#define HANDLE_FLAGS_RADIUS_RANGE_MINIMUM 0x0200
+#define HANDLE_FLAGS_RADIUS_RANGE_MAXIMUM 0x0400
+#define HANDLE_FLAGS_REFX 0x0800
+#define HANDLE_FLAGS_REFY 0x1000
+#define HANDLE_FLAGS_REFANGLE 0x2000
+#define HANDLE_FLAGS_REFR 0x4000
+
+// MSDFF_HANDLE_FLAGS_RANGE_Y seems to be not defined in
+// escher, but we are using it internally in to differentiate
+// between X_RANGE and Y_RANGE
+
+class SdrPathObj;
+
+class EnhancedCustomShape2d : public SfxItemSet
+{
+ SdrObject* pCustomShapeObj;
+ MSO_SPT eSpType;
+
+ sal_Int32 nCoordLeft;
+ sal_Int32 nCoordTop;
+ sal_Int32 nCoordWidthG;
+ sal_Int32 nCoordHeightG;
+ sal_Int32 nCoordWidth;
+ sal_Int32 nCoordHeight;
+ Rectangle aLogicRect;
+
+ double fXScale;
+ double fYScale;
+ double fXRatio;
+ double fYRatio;
+
+ sal_Bool bOOXMLShape;
+
+ sal_Int32 nXRef;
+ sal_Int32 nYRef;
+ sal_uInt32 nFlags;
+ sal_uInt32 nColorData;
+
+ /*
+
+ */
+ struct EquationResult {
+ sal_Bool bReady;
+ double fValue;
+ };
+ com::sun::star::uno::Sequence< OUString > seqEquations;
+ std::vector< ::boost::shared_ptr< EnhancedCustomShape::ExpressionNode > > vNodesSharedPtr;
+ std::vector< EquationResult > vEquationResults;
+
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment > seqSegments;
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair> seqCoordinates;
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeTextFrame > seqTextFrames;
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair> seqGluePoints;
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue > seqAdjustmentValues;
+ com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValues > seqHandles;
+ com::sun::star::uno::Sequence< com::sun::star::awt::Size > seqSubViewSize;
+
+ sal_Bool bTextFlow : 1;
+ sal_Bool bFilled : 1;
+ sal_Bool bStroked : 1;
+
+ sal_Bool bFlipH;
+ sal_Bool bFlipV;
+ sal_Int32 nRotateAngle;
+
+ bool SetAdjustValueAsDouble( const double& rValue, const sal_Int32 nIndex );
+ sal_Int32 GetLuminanceChange( sal_uInt32 nIndex ) const;
+ Color GetColorData( const Color& rFillColor, sal_uInt32 nIndex, double dBrightness ) const;
+ void AdaptObjColor(SdrPathObj& rObj, const SfxItemSet& rCustomShapeSet,
+ sal_uInt32& nColorIndex, sal_uInt32 nColorCount);
+ bool GetParameter( double& rParameterReturnValue, const com::sun::star::drawing::EnhancedCustomShapeParameter&,
+ const bool bReplaceGeoWidth, const bool bReplaceGeoHeight ) const;
+ Point GetPoint( const com::sun::star::drawing::EnhancedCustomShapeParameterPair&,
+ const bool bScale = true, const bool bReplaceGeoSize = false ) const;
+
+ void CreateSubPath( sal_uInt16& rSrcPt, sal_uInt16& rSegmentInd, std::vector< SdrPathObj* >& rObjectList,
+ sal_Bool bLineGeometryNeededOnly, sal_Bool bSortFilledObjectsToBack,
+ sal_Int32 nIndex );
+ SdrObject* CreatePathObj( sal_Bool bLineGeometryNeededOnly );
+ const sal_Int32* ApplyShapeAttributes( const SdrCustomShapeGeometryItem& rItem );
+
+ void SetPathSize( sal_Int32 nIndex = 0 );
+
+ public :
+
+ struct Handle
+ {
+ sal_uInt32 nFlags;
+
+ sal_Bool bMirroredX;
+ sal_Bool bMirroredY;
+ sal_Bool bSwitched;
+
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair aPosition;
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair aPolar;
+
+ sal_Int32 nRefX;
+ sal_Int32 nRefY;
+ sal_Int32 nRefAngle;
+ sal_Int32 nRefR;
+
+ com::sun::star::drawing::EnhancedCustomShapeParameter aRadiusRangeMinimum;
+ com::sun::star::drawing::EnhancedCustomShapeParameter aRadiusRangeMaximum;
+ com::sun::star::drawing::EnhancedCustomShapeParameter aXRangeMinimum;
+ com::sun::star::drawing::EnhancedCustomShapeParameter aXRangeMaximum;
+ com::sun::star::drawing::EnhancedCustomShapeParameter aYRangeMinimum;
+ com::sun::star::drawing::EnhancedCustomShapeParameter aYRangeMaximum;
+
+ Handle() : bMirroredX ( sal_False ), bMirroredY ( sal_False ), bSwitched( sal_False ),
+ nRefX( -1 ), nRefY( -1 ), nRefAngle( -1 ), nRefR( -1 ) {};
+ };
+
+ sal_Bool IsFlipVert() { return bFlipV; };
+ sal_Bool IsFlipHorz() { return bFlipH; };
+ sal_Int32 GetRotateAngle() { return nRotateAngle; };
+ SVX_DLLPUBLIC bool IsPostRotate() const;
+
+ SVX_DLLPUBLIC SdrObject* CreateLineGeometry();
+ SVX_DLLPUBLIC SdrObject* CreateObject( sal_Bool bLineGeometryNeededOnly );
+ SVX_DLLPUBLIC void ApplyGluePoints( SdrObject* pObj );
+ SVX_DLLPUBLIC Rectangle GetTextRect() const;
+
+ SVX_DLLPUBLIC sal_uInt32 GetHdlCount() const;
+ SVX_DLLPUBLIC bool GetHandlePosition( const sal_uInt32 nIndex, Point& rReturnPosition ) const;
+ SVX_DLLPUBLIC bool SetHandleControllerPosition( const sal_uInt32 nIndex, const com::sun::star::awt::Point& rPosition );
+
+ SVX_DLLPUBLIC EnhancedCustomShape2d( SdrObject* pSdrObjCustomShape );
+ SVX_DLLPUBLIC ~EnhancedCustomShape2d();
+
+ enum EnumFunc
+ {
+ ENUM_FUNC_PI,
+ ENUM_FUNC_LEFT,
+ ENUM_FUNC_TOP,
+ ENUM_FUNC_RIGHT,
+ ENUM_FUNC_BOTTOM,
+ ENUM_FUNC_XSTRETCH,
+ ENUM_FUNC_YSTRETCH,
+ ENUM_FUNC_HASSTROKE,
+ ENUM_FUNC_HASFILL,
+ ENUM_FUNC_WIDTH,
+ ENUM_FUNC_HEIGHT,
+ ENUM_FUNC_LOGWIDTH,
+ ENUM_FUNC_LOGHEIGHT
+ };
+ double GetEnumFunc( const EnumFunc eVal ) const;
+
+ double GetAdjustValueAsDouble( const sal_Int32 nIndex ) const;
+ double GetEquationValueAsDouble( const sal_Int32 nIndex ) const;
+ sal_Int32 GetAdjustValueAsInteger( const sal_Int32 nIndex, const sal_Int32 nDefault = 0 ) const;
+
+ SVX_DLLPUBLIC static OUString GetEquation( const sal_uInt16 nFlags, sal_Int16 nPara1, sal_Int16 nPara2, sal_Int16 nPara3 );
+
+ static void AppendEnhancedCustomShapeEquationParameter( OUString& rParameter, const sal_Int16 nPara, const bool bIsSpecialValue );
+
+ static void SetEnhancedCustomShapeEquationParameter( com::sun::star::drawing::EnhancedCustomShapeParameter&
+ rParameter, const sal_Int16 nPara, const sal_Bool bIsSpecialValue );
+ SVX_DLLPUBLIC static void SetEnhancedCustomShapeParameter( com::sun::star::drawing::EnhancedCustomShapeParameter&
+ rParameter, const sal_Int32 nValue );
+ SVX_DLLPUBLIC static void SetEnhancedCustomShapeHandleParameter( com::sun::star::drawing::EnhancedCustomShapeParameter&
+ rParameter, const sal_Int32 nPara, const bool bIsSpecialValue, bool bHorz );
+ static bool ConvertSequenceToEnhancedCustomShape2dHandle( const com::sun::star::beans::PropertyValues& rHandleProperties,
+ EnhancedCustomShape2d::Handle& rDestinationHandle );
+ static void SwapStartAndEndArrow( SdrObject* pObj );
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/EnhancedCustomShapeFunctionParser.hxx b/include/svx/EnhancedCustomShapeFunctionParser.hxx
new file mode 100644
index 000000000000..28df983df61c
--- /dev/null
+++ b/include/svx/EnhancedCustomShapeFunctionParser.hxx
@@ -0,0 +1,208 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _ENHANCEDCUSTOMSHAPEFUNCTIONPARSER_HXX
+#define _ENHANCEDCUSTOMSHAPEFUNCTIONPARSER_HXX
+
+#include <sal/config.h>
+#include <boost/shared_ptr.hpp>
+#include "EnhancedCustomShapeFunctionParser.hxx"
+#include <com/sun/star/drawing/EnhancedCustomShapeParameter.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
+#include <vector>
+
+#include <svx/svxdllapi.h>
+
+struct EnhancedCustomShapeEquation
+{
+ sal_Int32 nOperation;
+ sal_Int32 nPara[ 3 ];
+
+ EnhancedCustomShapeEquation() :
+ nOperation ( 0 )
+ {
+ nPara[ 0 ] = nPara[ 1 ] = nPara[ 2 ] = 0;
+ }
+};
+
+class EnhancedCustomShape2d;
+
+namespace EnhancedCustomShape {
+
+enum ExpressionFunct
+{
+ FUNC_CONST,
+
+ ENUM_FUNC_PI,
+ ENUM_FUNC_LEFT,
+ ENUM_FUNC_TOP,
+ ENUM_FUNC_RIGHT,
+ ENUM_FUNC_BOTTOM,
+ ENUM_FUNC_XSTRETCH,
+ ENUM_FUNC_YSTRETCH,
+ ENUM_FUNC_HASSTROKE,
+ ENUM_FUNC_HASFILL,
+ ENUM_FUNC_WIDTH,
+ ENUM_FUNC_HEIGHT,
+ ENUM_FUNC_LOGWIDTH,
+ ENUM_FUNC_LOGHEIGHT,
+ ENUM_FUNC_ADJUSTMENT,
+ ENUM_FUNC_EQUATION,
+
+ UNARY_FUNC_ABS,
+ UNARY_FUNC_SQRT,
+ UNARY_FUNC_SIN,
+ UNARY_FUNC_COS,
+ UNARY_FUNC_TAN,
+ UNARY_FUNC_ATAN,
+ UNARY_FUNC_NEG,
+
+ BINARY_FUNC_PLUS,
+ BINARY_FUNC_MINUS,
+ BINARY_FUNC_MUL,
+ BINARY_FUNC_DIV,
+ BINARY_FUNC_MIN,
+ BINARY_FUNC_MAX,
+ BINARY_FUNC_ATAN2,
+
+ TERNARY_FUNC_IF
+};
+
+#define EXPRESSION_FLAG_SUMANGLE_MODE 1
+
+SVX_DLLPUBLIC void FillEquationParameter( const com::sun::star::drawing::EnhancedCustomShapeParameter&, const sal_Int32, EnhancedCustomShapeEquation& );
+
+class ExpressionNode
+{
+public:
+ virtual ~ExpressionNode();
+
+ /** Predicate whether this node is constant.
+
+ This predicate returns true, if this node is
+ neither time- nor ViewInfo dependent. This allows
+ for certain obtimizations, i.e. not the full
+ expression tree needs be represented by
+ ExpressionNodes.
+
+ @returns true, if the note is constant
+ */
+ virtual bool isConstant() const = 0;
+
+ /** Operator to calculate function value.
+
+ This method calculates the function value.
+ */
+ virtual double operator()() const = 0;
+
+ /** Operator to retrieve the type of expression node
+ */
+ virtual ExpressionFunct getType() const = 0;
+
+ /** Operator to retrieve the ms version of expression
+ */
+ virtual com::sun::star::drawing::EnhancedCustomShapeParameter fillNode(
+ std::vector< EnhancedCustomShapeEquation >& rEquations, ExpressionNode* pOptionalArg, sal_uInt32 nFlags ) = 0;
+};
+typedef ::boost::shared_ptr< ExpressionNode > ExpressionNodeSharedPtr;
+
+/** This exception is thrown, when the arithmetic expression
+ parser failed to parse a string.
+ */
+struct ParseError
+{
+ ParseError() {}
+ ParseError( const char* ) {}
+};
+
+class FunctionParser
+{
+public:
+
+ /** Parse a string
+
+ The following grammar is accepted by this method:
+ <code>
+
+ number_digit = '0'|'1'|'2'|'3'|'4'|'5'|'6'|'7'|'8'|'9'
+
+ number = number number_digit | number_digit
+
+ identifier = 'pi'|'left'|'top'|'right'|'bottom'|'xstretch'|'ystretch'|
+ 'hasstroke'|'hasfill'|'width'|'height'|'logwidth'|'logheight'
+
+ unary_function = 'abs'|'sqrt'|'sin'|'cos'|'tan'|'atan'
+ binary_function = 'min'|'max'|'atan2'
+ ternary_function = 'if'
+
+ function_reference = '?' 'a-z,A-Z,0-9' ' '
+ modifier_reference = '$' '0-9' ' '
+
+ basic_expression =
+ number |
+ identifier |
+ function_reference |
+ unary_function '(' additive_expression ')' |
+ binary_function '(' additive_expression ',' additive_expression ')' |
+ ternary_function '(' additive_expression ',' additive_expression ',
+ ' additive_expression ')' | '(' additive_expression ')'
+
+ unary_expression = '-' basic_expression
+
+ multiplicative_expression =
+ basic_expression |
+ multiplicative_expression '*' basic_expression |
+ multiplicative_expression '/' basic_expression
+
+ additive_expression =
+ multiplicative_expression |
+ additive_expression '+' multiplicative_expression |
+ additive_expression '-' multiplicative_expression
+
+ </code>
+
+ @param rFunction
+ The string to parse
+
+ @param rCustoShape
+ The CustomShape is required for calculation of dynamic values such
+ "hasstroke", function references and or modifier references ...
+
+ @throws ParseError if an invalid expression is given.
+
+ @return the generated function object.
+ */
+
+ SVX_DLLPUBLIC static ExpressionNodeSharedPtr parseFunction( const OUString& rFunction, const EnhancedCustomShape2d& rCustoShape );
+
+private:
+ // disabled constructor/destructor, since this is
+ // supposed to be a singleton
+ FunctionParser();
+
+ // default: disabled copy/assignment
+ FunctionParser(const FunctionParser&);
+ FunctionParser& operator=( const FunctionParser& );
+};
+
+}
+
+#endif /* _ENHANCEDCUSTOMSHAPEFUNCTIONPARSER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/EnhancedCustomShapeGeometry.hxx b/include/svx/EnhancedCustomShapeGeometry.hxx
new file mode 100644
index 000000000000..4669e68ca137
--- /dev/null
+++ b/include/svx/EnhancedCustomShapeGeometry.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _ENHANCEDCUSTOMSHAPEGEOMETRY_HXX
+#define _ENHANCEDCUSTOMSHAPEGEOMETRY_HXX
+
+#include <sal/types.h>
+#include <svx/msdffdef.hxx>
+
+struct SvxMSDffVertPair
+{
+ sal_Int32 nValA;
+ sal_Int32 nValB;
+};
+struct SvxMSDffCalculationData
+{
+ sal_uInt16 nFlags;
+ sal_Int16 nVal[ 3 ];
+};
+struct SvxMSDffTextRectangles
+{
+ SvxMSDffVertPair nPairA;
+ SvxMSDffVertPair nPairB;
+};
+
+#define MSDFF_HANDLE_FLAGS_MIRRORED_X 0x0001
+#define MSDFF_HANDLE_FLAGS_MIRRORED_Y 0x0002
+#define MSDFF_HANDLE_FLAGS_SWITCHED 0x0004
+#define MSDFF_HANDLE_FLAGS_POLAR 0x0008
+#define MSDFF_HANDLE_FLAGS_MAP 0x0010
+#define MSDFF_HANDLE_FLAGS_RANGE 0x0020
+#define MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL 0x0080
+#define MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL 0x0100
+#define MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL 0x0200
+#define MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL 0x0400
+#define MSDFF_HANDLE_FLAGS_CENTER_X_IS_SPECIAL 0x0800
+#define MSDFF_HANDLE_FLAGS_CENTER_Y_IS_SPECIAL 0x1000
+#define MSDFF_HANDLE_FLAGS_RADIUS_RANGE 0x2000
+
+struct SvxMSDffHandle
+{
+ sal_uInt32 nFlags;
+ sal_Int32 nPositionX, nPositionY, nCenterX, nCenterY, nRangeXMin, nRangeXMax, nRangeYMin, nRangeYMax;
+};
+struct mso_CustomShape
+{
+ SvxMSDffVertPair* pVertices;
+ sal_uInt32 nVertices;
+ sal_uInt16* pElements;
+ sal_uInt32 nElements;
+ SvxMSDffCalculationData* pCalculation;
+ sal_uInt32 nCalculation;
+ sal_Int32* pDefData;
+ SvxMSDffTextRectangles* pTextRect;
+ sal_uInt32 nTextRect;
+ sal_Int32 nCoordWidth;
+ sal_Int32 nCoordHeight;
+ sal_Int32 nXRef;
+ sal_Int32 nYRef;
+ SvxMSDffVertPair* pGluePoints;
+ sal_uInt32 nGluePoints;
+ SvxMSDffHandle* pHandles;
+ sal_uInt32 nHandles;
+};
+
+#define MSO_I | (sal_Int32)0x80000000
+
+sal_Bool SortFilledObjectsToBackByDefault( MSO_SPT eSpType );
+SVX_DLLPUBLIC sal_Bool IsCustomShapeFilledByDefault( MSO_SPT eSpType );
+SVX_DLLPUBLIC sal_Int16 GetCustomShapeConnectionTypeDefault( MSO_SPT eSpType );
+
+// #i28269#
+SVX_DLLPUBLIC sal_Bool IsCustomShapeStrokedByDefault( MSO_SPT eSpType );
+
+SVX_DLLPUBLIC const mso_CustomShape* GetCustomShapeContent( MSO_SPT eSpType );
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/EnhancedCustomShapeTypeNames.hxx b/include/svx/EnhancedCustomShapeTypeNames.hxx
new file mode 100644
index 000000000000..6be004105956
--- /dev/null
+++ b/include/svx/EnhancedCustomShapeTypeNames.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _ENHANCED_CUSTOMSHAPE_TYPE_NAMES_HXX
+#define _ENHANCED_CUSTOMSHAPE_TYPE_NAMES_HXX
+#include <svx/msdffdef.hxx>
+#include <rtl/ustring.hxx>
+
+namespace EnhancedCustomShapeTypeNames
+{
+ SVX_DLLPUBLIC MSO_SPT Get( const OUString& );
+ SVX_DLLPUBLIC OUString Get( const MSO_SPT );
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/IAccessibleParent.hxx b/include/svx/IAccessibleParent.hxx
new file mode 100644
index 000000000000..05854b66e3b8
--- /dev/null
+++ b/include/svx/IAccessibleParent.hxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_ACCESSIBILITY_IACCESSIBLE_PARENT_HXX
+#define _SVX_ACCESSIBILITY_IACCESSIBLE_PARENT_HXX
+
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <sal/types.h>
+
+namespace accessibility {
+
+class AccessibleShape;
+class AccessibleShapeTreeInfo;
+
+/** This interface contains methods missing from the
+ <type>XAccessibleContext</type> interface that allow the modification of
+ parent/child relationship.
+*/
+class IAccessibleParent
+{
+public:
+ /** Allow for a virtual destructor.
+ */
+ virtual ~IAccessibleParent (void){};
+
+ /** A call to this method requests the implementor to replace one child
+ with another and send the appropriate notifications. That are two
+ child events: One notifying the removal of the current child and one
+ about the existence of the new child. The index of the new child is
+ implementation dependent, i.e. it is not garanteed that the
+ replacement has the same index as the current child has.
+
+ <p>A default implementation can just use the ShapeTypeHandler::CreateAccessibleObject
+ to let a factory create the new instance with the parameters given, and then
+ place the new shape into the own structures.</p>
+
+ @param pCurrentChild
+ This child is about to be replaced.
+
+ @param _rxShape
+ The UNO shape which the old and new child represent
+
+ @param _nIndex
+ The IndexInParent of the old child. Note that the index in
+ parent of the replacement is not necessarily the same as
+ that of the current child.
+
+ @param _rShapeTreeInfo
+ The TreeInfo for the old child.
+
+ @return
+ If the replacement has taken place successfully <TRUE/> is
+ returned. If the replacement can not be carried out or an error
+ occurs that does not result in an exception then <FALSE/> is
+ returned.
+
+ @raises RuntimeException
+ in case something went heavily wrong
+ */
+ virtual sal_Bool ReplaceChild (
+ AccessibleShape* pCurrentChild,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& _rxShape,
+ const long _nIndex,
+ const AccessibleShapeTreeInfo& _rShapeTreeInfo
+ ) throw (::com::sun::star::uno::RuntimeException) = 0;
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/IAccessibleViewForwarder.hxx b/include/svx/IAccessibleViewForwarder.hxx
new file mode 100644
index 000000000000..60883e754ee3
--- /dev/null
+++ b/include/svx/IAccessibleViewForwarder.hxx
@@ -0,0 +1,126 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_ACCESSIBILITY_IACCESSIBLE_VIEW_FORWARDER_HXX
+#define _SVX_ACCESSIBILITY_IACCESSIBLE_VIEW_FORWARDER_HXX
+
+#include <sal/types.h>
+#include <tools/gen.hxx>
+
+
+namespace accessibility {
+
+
+
+/** <p>This interface provides the means to transform between internal
+ coordinates in 100th of mm and screen coordinates without giving direct
+ access to the underlying view. Each view forwarder represents a
+ specific real or virtual window. A call to
+ <method>GetVisibleArea</method> returns the visible rectangle that
+ corresponds to this window.</p>
+
+ <p>This interface is similar to the <type>SvxViewForwarder</type> but
+ differs in two important points: Firstly the <member>GetVisArea</member>
+ method returns a rectangle in internal coordinates and secondly the
+ transformation methods do not require explicit mapmodes. These have to
+ be provided implicitely by the classes that implement this
+ interface. A third, less important, difference are the additional
+ transfomation methods for sizes. The reasons for their existince are
+ convenience and improved performance.</p>
+
+ @attention
+ Note, that modifications of the underlying view that lead to
+ different transformations between internal and screen coordinates or
+ change the validity of the forwarder have to be signaled seperately.
+*/
+class IAccessibleViewForwarder
+{
+public:
+ virtual ~IAccessibleViewForwarder (void){};
+
+ /** This method informs you about the state of the forwarder. Do not
+ use it when the returned value is <false/>.
+
+ @return
+ Return <true/> if the view forwarder is valid and <false/> else.
+ */
+ virtual sal_Bool IsValid (void) const = 0;
+
+ /** Returns the area of the underlying document that is visible in the
+ * corresponding window.
+
+ @return
+ The rectangle of the visible part of the document. The values
+ are, contrary to the base class, in internal coordinates of
+ 100th of mm.
+ */
+ virtual Rectangle GetVisibleArea() const = 0;
+
+ /** Transform the specified point from internal coordinates in 100th of
+ mm to an absolute screen position.
+
+ @param rPoint
+ Point in internal coordinates (100th of mm).
+
+ @return
+ The same point but in screen coordinates relative to the upper
+ left corner of the (current) screen.
+ */
+ virtual Point LogicToPixel (const Point& rPoint) const = 0;
+
+ /** Transform the specified size from internal coordinates in 100th of
+ mm to a screen oriented pixel size.
+
+ @param rSize
+ Size in internal coordinates (100th of mm).
+
+ @return
+ The same size but in screen coordinates.
+ */
+ virtual Size LogicToPixel (const Size& rSize) const = 0;
+
+ /** Transform the specified point from absolute screen coordinates to
+ internal coordinates (100th of mm).
+
+ @param rPoint
+ Point in screen coordinates relative to the upper left corner of
+ the (current) screen.
+
+ @return
+ The same point but in internal coordinates (100th of mm).
+ */
+ virtual Point PixelToLogic (const Point& rPoint) const = 0;
+
+ /** Transform the specified size from screen coordinates to internal
+ coordinates (100th of mm).
+
+ @param rSize
+ Size in screen coordinates.
+
+ @return
+ The same size but in internal coordinates (100th of mm).
+ */
+ virtual Size PixelToLogic (const Size& rSize) const = 0;
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/IAccessibleViewForwarderListener.hxx b/include/svx/IAccessibleViewForwarderListener.hxx
new file mode 100644
index 000000000000..8a9a061bfb5e
--- /dev/null
+++ b/include/svx/IAccessibleViewForwarderListener.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_ACCESSIBILITY_IACCESSIBLE_VIEW_FORWARDER_LISTENER_HXX
+#define _SVX_ACCESSIBILITY_IACCESSIBLE_VIEW_FORWARDER_LISTENER_HXX
+
+#include <sal/types.h>
+
+
+namespace accessibility {
+
+class IAccessibleViewForwarder;
+
+/** <p>The purpose of this interface is to notify a user of an
+ IAccessibleViewForwarder when that view forwarder changes its
+ properties. Such a change may be one of the following:
+ <ul>
+ <li>Change of the coordinate transformation.</li>
+ <li>Change of the visible area (which in turn results in a change of the
+ coordinate transformation.</li>
+ <li>Change of the validity state of the view forwarder.</li>
+*/
+class IAccessibleViewForwarderListener
+{
+public:
+ /** Enumeration of the different change types.
+ */
+ enum ChangeType {TRANSFORMATION, VISIBLE_AREA, STATE};
+
+ /** This method is called to indicate a change of the specified view
+ forwarder.
+ @param aChangeType
+ The type of the change. TRANSFORMATION indicates a change of
+ the coordinate transformation with a constant visible area. If
+ the visible area changes, just use VISIBLE_AREA. This changes
+ the transformation implicitly. The value STATE indicates a
+ change of the validity state. Check the IsValid method of the
+ view forwarder before doing further calls.
+ @param pViewForwarder
+ The modified view forwarder. It is specified just in case that
+ there is more than one view forwarder in use at the same time.
+ */
+ virtual void ViewForwarderChanged (ChangeType aChangeType,
+ const IAccessibleViewForwarder* pViewForwarder) = 0;
+
+protected:
+ ~IAccessibleViewForwarderListener() {}
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/ParseContext.hxx b/include/svx/ParseContext.hxx
new file mode 100644
index 000000000000..55934efcc545
--- /dev/null
+++ b/include/svx/ParseContext.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef SVX_QUERYDESIGNCONTEXT_HXX
+#define SVX_QUERYDESIGNCONTEXT_HXX
+
+#include "svx/svxdllapi.h"
+#include <connectivity/IParseContext.hxx>
+#include <tools/string.hxx>
+#include <unotools/localedatawrapper.hxx>
+
+
+#include <vector>
+
+namespace svxform
+{
+ //==========================================================================
+ //= OSystemParseContext
+ //==========================================================================
+ class SVX_DLLPUBLIC OSystemParseContext : public ::connectivity::IParseContext
+ {
+ private:
+
+ ::std::vector< String > m_aLocalizedKeywords;
+
+ public:
+ OSystemParseContext();
+
+ virtual ~OSystemParseContext();
+ // retrieves language specific error messages
+ virtual OUString getErrorMessage(ErrorCode _eCodes) const;
+
+ // retrieves language specific keyword strings (only ASCII allowed)
+ virtual OString getIntlKeywordAscii(InternationalKeyCode _eKey) const;
+
+ // finds out, if we have an international keyword (only ASCII allowed)
+ virtual InternationalKeyCode getIntlKeyCode(const OString& rToken) const;
+
+ /** get's a locale instance which should be used when parsing in the context specified by this instance
+ <p>if this is not overridden by derived classes, it returns the static default locale.</p>
+ */
+ virtual ::com::sun::star::lang::Locale getPreferredLocale( ) const;
+
+ };
+
+ //==========================================================================
+ //= OParseContextClient
+ //==========================================================================
+ /** helper class which needs access to a (shared and ref-counted) OSystemParseContext
+ instance.
+ */
+ class SVX_DLLPUBLIC OParseContextClient
+ {
+ protected:
+ OParseContextClient();
+ virtual ~OParseContextClient();
+
+ const OSystemParseContext* getParseContext() const;
+ };
+}
+#endif // SVX_QUERYDESIGNCONTEXT_HXX
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/ShapeTypeHandler.hxx b/include/svx/ShapeTypeHandler.hxx
new file mode 100644
index 000000000000..4dea0232bc90
--- /dev/null
+++ b/include/svx/ShapeTypeHandler.hxx
@@ -0,0 +1,220 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_ACCESSIBILITY_SHAPE_TYPE_HANDLER_HXX
+#define _SVX_ACCESSIBILITY_SHAPE_TYPE_HANDLER_HXX
+
+#include <svx/AccessibleShapeTreeInfo.hxx>
+#include <svx/AccessibleShapeInfo.hxx>
+#include <svx/AccessibleShape.hxx>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <comphelper/stl_types.hxx>
+#include <com/sun/star/document/XEventBroadcaster.hpp>
+#include "svx/svxdllapi.h"
+
+#include <rtl/ustring.hxx>
+#include <vector>
+#include <boost/unordered_map.hpp>
+
+namespace accessibility {
+
+/** Use an integer to represent shape type ids. A ShapeTypeId is unique
+ inside one project but is not over the project boundaries.
+*/
+typedef int ShapeTypeId;
+
+/** Define the function type for creating accessible objects for given
+ service names.
+*/
+typedef AccessibleShape* (*tCreateFunction)
+ (const AccessibleShapeInfo& rShapeInfo,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo,
+ ShapeTypeId nId);
+
+/** Each shape type is described by listing its id, its service name and a
+ function which creates a new accessible object that can represent that
+ service. The id has to be unique with respect to the create function.
+*/
+struct ShapeTypeDescriptor
+{
+ ShapeTypeId mnShapeTypeId;
+ OUString msServiceName;
+ tCreateFunction maCreateFunction;
+ ShapeTypeDescriptor (
+ ShapeTypeId nId, const OUString& sName, tCreateFunction aFunction)
+ : mnShapeTypeId (nId),
+ msServiceName (sName),
+ maCreateFunction (aFunction)
+ {}
+ ShapeTypeDescriptor (void)
+ : mnShapeTypeId (-1),
+ msServiceName (),
+ maCreateFunction (NULL)
+ {}
+};
+
+/** @descr
+ This class is a singleton that has the purpose to transform between
+ service names of shapes and associated enum values and to create new
+ accessible objects for given shapes.
+*/
+class SVX_DLLPUBLIC ShapeTypeHandler
+{
+public:
+ enum { UNKNOWN_SHAPE_TYPE = 0 };
+
+ /** This function returns a reference to the only instance of this class.
+ Use this instance to retrieve a shape's type and service name.
+ @return
+ Returns a reference to a <type>ShapeTypeHandler</type> object.
+ */
+ static ShapeTypeHandler& Instance (void);
+
+ /** Determines the type id of a shape with the given service name.
+ @param aServiceName
+ Service name of the shape for which to return the type id.
+ @return
+ Returns the type id of the shape with the given service name or
+ -1 when the service name is not known.
+ */
+ ShapeTypeId GetTypeId (const OUString& aServiceName) const;
+
+ /** Determines the type id of the specified shape.
+ @param xShape
+ Reference to the shape for which to return the type id.
+ @return
+ Returns the type id of the specified shape or
+ -1 when the given reference is either not
+ set or the referenced object does not support the
+ <type>XShapeDescriptor</type> interface.
+ */
+ ShapeTypeId GetTypeId (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape>& rxShape) const;
+
+ /** Create a new accessible object for the given shape.
+ @param rShapeInfo
+ Bundle of information passed to the new accessible shape.
+ @param rShapeTreeInfo
+ Bundle of information passed down the shape tree.
+ @return
+ Pointer to the implementation object that implements the
+ <code>XAccessible</code> interface. This pointer may be NULL
+ if the specified shape is of unknown type.
+ */
+ AccessibleShape*
+ CreateAccessibleObject (
+ const AccessibleShapeInfo& rShapeInfo,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo) const;
+
+ /** Compatibility function.
+ */
+ AccessibleShape*
+ CreateAccessibleObject (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape>& rxShape,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& rxParent,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo) const
+ {
+ AccessibleShapeInfo aShapeInfo(rxShape, rxParent);
+ return CreateAccessibleObject (aShapeInfo, rShapeTreeInfo);
+ }
+
+ /** Add new shape types to the internal tables. Each new shape type is
+ described by one shape type descriptor. See
+ <type>ShapeTypeDescriptor</type> for more details.
+
+ @param nDescriptorCount
+ Number of new shape types.
+ @param aDescriptorList
+ Array of new shape type descriptors.
+ @return
+ The returned flag indicates whether the specified shape
+ descriptors have been successfully added.
+ */
+ bool AddShapeTypeList (int nDescriptorCount,
+ ShapeTypeDescriptor aDescriptorList[]);
+
+ /// get the accessible base name for an object
+ static OUString CreateAccessibleBaseName (
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape)
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ // Declare default constructor, copy constructor, destructor, and
+ // assignment operation protected so that no one accidentally creates a
+ // second instance of this singleton class or deletes it.
+ ShapeTypeHandler (void);
+ ShapeTypeHandler (const ShapeTypeHandler& aHandler); // never implemented, this is a singleton class
+ ShapeTypeHandler& operator= (const ShapeTypeHandler& aHandler); // never implemented, this is a singleton class
+
+ /** This destructor is never called at the moment. But because this
+ class is a singleton this is not a problem.
+ */
+ virtual ~ShapeTypeHandler (void);
+
+private:
+ /// Pointer to the only instance of this class.
+ static ShapeTypeHandler* instance;
+
+ /** List of shape type descriptors. This list is normally build up in
+ several steps when libraries that implement shapes are loaded and
+ call the addShapeTypeList method. After that no modifications of
+ the list take place.
+ */
+ ::std::vector<ShapeTypeDescriptor> maShapeTypeDescriptorList;
+
+ /** This hash map allows the fast look up of a type descriptor for a
+ given service name.
+ */
+ typedef ::boost::unordered_map<
+ OUString,ShapeTypeId,
+ OUStringHash,
+ ::comphelper::UStringEqual> tServiceNameToSlotId;
+ mutable tServiceNameToSlotId maServiceNameToSlotId;
+
+ /** Determine the slot id of the specified shape type. With this id
+ internal methods can access the associated type descriptor.
+ @param aServiceName
+ Service name of the shape for which to return the slot id.
+ @return
+ Returns the slot id of the shape with the given service name or
+ 0 when the service name is not known.
+ */
+ SVX_DLLPRIVATE long GetSlotId (const OUString& aServiceName) const;
+
+ /** Determine the slot id of the specified shape type. With this id
+ internal methods can access the associated type descriptor.
+ @param rxShape
+ Shape for which to return the slot id.
+ @return
+ Returns the slot id of the shape with the given service name or
+ 0 when the service name is not known.
+ */
+ SVX_DLLPRIVATE long GetSlotId (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape>& rxShape) const;
+};
+
+} // end of namespace accessible
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/SmartTagCtl.hxx b/include/svx/SmartTagCtl.hxx
new file mode 100644
index 000000000000..59a7c59168e3
--- /dev/null
+++ b/include/svx/SmartTagCtl.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_SMARTTAGSCONTROL_HXX
+#define _SVX_SMARTTAGSCONTROL_HXX
+
+#include <tools/link.hxx>
+#include <sfx2/mnuitem.hxx>
+#include "svx/svxdllapi.h"
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <vector>
+
+class SfxBindings;
+class SvxSmartTagItem;
+class PopupMenu;
+
+namespace com { namespace sun { namespace star { namespace smarttags {
+ class XSmartTagAction;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace container {
+ class XStringKeyMap;
+} } } }
+
+// class SvxFontMenuControl ----------------------------------------------
+
+class SVX_DLLPUBLIC SvxSmartTagsControl : public SfxMenuControl
+{
+private:
+ PopupMenu* mpMenu;
+ Menu& mrParent;
+ const SvxSmartTagItem* mpSmartTagItem;
+
+ struct InvokeAction
+ {
+ com::sun::star::uno::Reference< com::sun::star::smarttags::XSmartTagAction > mxAction;
+ com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > mxSmartTagProperties;
+ sal_uInt32 mnActionID;
+ InvokeAction( com::sun::star::uno::Reference< com::sun::star::smarttags::XSmartTagAction > xAction,
+ com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > xSmartTagProperties,
+ sal_uInt32 nActionID ) : mxAction( xAction ), mxSmartTagProperties( xSmartTagProperties ), mnActionID( nActionID ) {}
+ };
+
+ std::vector< InvokeAction > maInvokeActions;
+
+ void FillMenu();
+ DECL_LINK( MenuSelect, PopupMenu * );
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+
+public:
+ SvxSmartTagsControl( sal_uInt16 nId, Menu&, SfxBindings& );
+ ~SvxSmartTagsControl();
+
+ virtual PopupMenu* GetPopup() const;
+ SFX_DECL_MENU_CONTROL();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/SmartTagItem.hxx b/include/svx/SmartTagItem.hxx
new file mode 100644
index 000000000000..8b4364b979a8
--- /dev/null
+++ b/include/svx/SmartTagItem.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_SMARTTAGITEM_HXX
+#define _SVX_SMARTTAGITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/smarttags/XSmartTagAction.hpp>
+#include "svx/svxdllapi.h"
+
+namespace com { namespace sun { namespace star { namespace container {
+ class XStringKeyMap;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace text {
+ class XTextRange;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace frame {
+ class XController;
+} } } }
+
+// class SvxSmartTagItem -----------------------------------------------------
+
+class SVX_DLLPUBLIC SvxSmartTagItem : public SfxPoolItem
+{
+ const com::sun::star::uno::Sequence < com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::smarttags::XSmartTagAction > > > maActionComponentsSequence;
+ const com::sun::star::uno::Sequence < com::sun::star::uno::Sequence< sal_Int32 > > maActionIndicesSequence;
+ const com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > > maStringKeyMaps;
+ const com::sun::star::uno::Reference<com::sun::star::text::XTextRange> mxRange;
+ const com::sun::star::uno::Reference<com::sun::star::frame::XController> mxController;
+ const com::sun::star::lang::Locale maLocale;
+ const OUString maApplicationName;
+ const OUString maRangeText;
+
+public:
+ TYPEINFO();
+
+ SvxSmartTagItem( const sal_uInt16 nId,
+ const com::sun::star::uno::Sequence < com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::smarttags::XSmartTagAction > > >& rActionComponentsSequence,
+ const com::sun::star::uno::Sequence < com::sun::star::uno::Sequence< sal_Int32 > >& rActionIndicesSequence,
+ const com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > >& rStringKeyMaps,
+ const com::sun::star::uno::Reference<com::sun::star::text::XTextRange> rRange,
+ const com::sun::star::uno::Reference<com::sun::star::frame::XController> rController,
+ const com::sun::star::lang::Locale rLocale,
+ const OUString& rApplicationName,
+ const OUString& rRangeText );
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; // leer
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; // leer
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ const com::sun::star::uno::Sequence < com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::smarttags::XSmartTagAction > > >& GetActionComponentsSequence() const { return maActionComponentsSequence; }
+ const com::sun::star::uno::Sequence < com::sun::star::uno::Sequence< sal_Int32 > >& GetActionIndicesSequence() const { return maActionIndicesSequence; }
+ const com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > >& GetStringKeyMaps() const { return maStringKeyMaps; }
+ const com::sun::star::uno::Reference<com::sun::star::text::XTextRange>& GetTextRange() const { return mxRange; }
+ const com::sun::star::uno::Reference<com::sun::star::frame::XController>& GetController() const { return mxController; }
+ const com::sun::star::lang::Locale& GetLocale() const { return maLocale; }
+ const OUString GetApplicationName() const { return maApplicationName; }
+ const OUString GetRangeText() const { return maRangeText; }
+};
+
+#endif // #ifndef _SVX_SMARTTAGITEM_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/SmartTagMgr.hxx b/include/svx/SmartTagMgr.hxx
new file mode 100644
index 000000000000..836ff820650f
--- /dev/null
+++ b/include/svx/SmartTagMgr.hxx
@@ -0,0 +1,226 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SMARTTAGMGR_HXX
+#define _SMARTTAGMGR_HXX
+
+#include <cppuhelper/implbase2.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/util/XModifyListener.hpp>
+#include <com/sun/star/util/XChangesListener.hpp>
+#include "svx/svxdllapi.h"
+
+#include <vector>
+#include <map>
+#include <set>
+
+namespace com { namespace sun { namespace star { namespace uno {
+ class XComponentContext;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace smarttags {
+ class XSmartTagRecognizer;
+ class XSmartTagAction;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace text {
+ class XTextMarkup;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace i18n {
+ class XBreakIterator;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace lang {
+ struct Locale;
+ struct EventObject;
+ struct ChangesEvent;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace beans {
+ class XPropertySet;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace frame {
+ class XController;
+} } } }
+
+/** A reference to a smart tag action
+
+ An action service can support various actions. Therefore an ActionReference
+ consists of a reference to the service and and index.
+ */
+struct ActionReference
+{
+ com::sun::star::uno::Reference< com::sun::star::smarttags::XSmartTagAction > mxSmartTagAction;
+ sal_Int32 mnSmartTagIndex;
+ ActionReference( com::sun::star::uno::Reference< com::sun::star::smarttags::XSmartTagAction > xSmartTagAction, sal_Int32 nSmartTagIndex )
+ : mxSmartTagAction( xSmartTagAction), mnSmartTagIndex( nSmartTagIndex ) {}
+};
+
+/** The smart tag manager maintains all installed action and recognizer services
+
+ This class organizes the available smarttag libraries and provides access functions
+ to these libraries. The smart tag manager is a singleton.
+*/
+class SVX_DLLPUBLIC SmartTagMgr : public cppu::WeakImplHelper2< ::com::sun::star::util::XModifyListener,
+ ::com::sun::star::util::XChangesListener >
+{
+private:
+
+ const OUString maApplicationName;
+ std::vector< com::sun::star::uno::Reference< com::sun::star::smarttags::XSmartTagRecognizer > > maRecognizerList;
+ std::vector< com::sun::star::uno::Reference< com::sun::star::smarttags::XSmartTagAction > > maActionList;
+ std::set< OUString > maDisabledSmartTagTypes;
+ std::multimap < OUString, ActionReference > maSmartTagMap;
+ mutable com::sun::star::uno::Reference< com::sun::star::i18n::XBreakIterator > mxBreakIter;
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext> mxContext;
+ com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > mxConfigurationSettings;
+ bool mbLabelTextWithSmartTags;
+
+ /** Checks for installed smart tag recognizers/actions and stores them in
+ maRecognizerList and maActionList.
+ */
+ void LoadLibraries();
+
+ /** Prepare configuration access.
+ */
+ void PrepareConfiguration( const OUString& rConfigurationGroupName );
+
+ /** Reads the configuration data.
+ */
+ void ReadConfiguration( bool bExcludedTypes, bool bRecognize );
+
+ /** Registeres the smart tag manager as listener at the package manager.
+ */
+ void RegisterListener();
+
+ /** Sets up a map that maps smart tag type names to actions references.
+ */
+ void AssociateActionsWithRecognizers();
+
+ void CreateBreakIterator() const;
+
+public:
+
+ SmartTagMgr( const OUString& rApplicationName );
+ virtual ~SmartTagMgr();
+
+ /** Triggeres configuration reading, library loading and listener registration
+ NOTE: MUST BE CALLED AFTER CONSTRUCTION!
+ */
+ void Init( const OUString& rConfigurationGroupName );
+
+ /** Dispatches the recognize call to all installed smart tag recognizers
+
+ @param rText
+ The string to be scanned by the recognizers.
+
+ @param xMarkup
+ The object allows the recognizers to store any found smart tags.
+
+ @param xController
+ The current controller of the document.
+
+ @param rLocale
+ The locale of rText.
+
+ @param nStart
+ The start offset of the text to be scanned in rText.
+
+ @param nLen
+ The length of the text to be scanned.
+
+ */
+ void Recognize( const OUString& rText,
+ const com::sun::star::uno::Reference< com::sun::star::text::XTextMarkup > xMarkup,
+ const com::sun::star::uno::Reference< com::sun::star::frame::XController > xController,
+ const com::sun::star::lang::Locale& rLocale,
+ sal_uInt32 nStart, sal_uInt32 nLen ) const;
+
+ /** Returns all action references associated with a given list of smart tag types
+
+ @param rSmartTagTypes
+ The list of types
+
+ @param rActionComponentsSequence
+ Output parameter
+
+ @param rActionIndicesSequence
+ Output parameter
+ */
+ void GetActionSequences( com::sun::star::uno::Sequence < OUString >& rSmartTagTypes,
+ com::sun::star::uno::Sequence < com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::smarttags::XSmartTagAction > > >& rActionComponentsSequence,
+ com::sun::star::uno::Sequence < com::sun::star::uno::Sequence< sal_Int32 > >& rActionIndicesSequence ) const;
+
+ /** Returns the caption for a smart tag type.
+
+ @param rSmartTagType
+ The given smart tag type.
+
+ @param rLocale
+ The locale.
+ */
+ OUString GetSmartTagCaption( const OUString& rSmartTagType, const com::sun::star::lang::Locale& rLocale ) const;
+
+ /** Returns true if the given smart tag type is enabled.
+ */
+ bool IsSmartTagTypeEnabled( const OUString& rSmartTagType ) const;
+
+ /** Enable or disable smart tags.
+ */
+ bool IsLabelTextWithSmartTags() const { return mbLabelTextWithSmartTags; }
+
+ /** Returns the number of registered recognizers.
+ */
+ sal_uInt32 NumberOfRecognizers() const { return maRecognizerList.size(); }
+
+ /** Returns a recognizer.
+ */
+ com::sun::star::uno::Reference< com::sun::star::smarttags::XSmartTagRecognizer >
+ GetRecognizer( sal_uInt32 i ) const { return maRecognizerList[i]; }
+
+ /** Is smart tag recognization active?
+ */
+ bool IsSmartTagsEnabled() const { return 0 != NumberOfRecognizers() &&
+ IsLabelTextWithSmartTags(); }
+
+ /** Writes configuration settings.
+ */
+ void WriteConfiguration( const bool* bLabelTextWithSmartTags,
+ const std::vector< OUString >* pDisabledTypes ) const;
+
+ /** Returns the name of the application this instance has been created by.
+ */
+ const OUString GetApplicationName() const { return maApplicationName; }
+
+ // ::com::sun::star::lang::XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::util::XModifyListener
+ virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::util::XChangesListener
+ virtual void SAL_CALL changesOccurred( const ::com::sun::star::util::ChangesEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/SpellDialogChildWindow.hxx b/include/svx/SpellDialogChildWindow.hxx
new file mode 100644
index 000000000000..669c5d193dfa
--- /dev/null
+++ b/include/svx/SpellDialogChildWindow.hxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVX_SPELL_DIALOG_CHILD_WINDOW_HXX
+#define SVX_SPELL_DIALOG_CHILD_WINDOW_HXX
+
+#include <sfx2/childwin.hxx>
+#include <editeng/SpellPortions.hxx>
+#include "svx/svxdllapi.h"
+#include <vcl/image.hxx>
+
+class AbstractSpellDialog;
+
+namespace svx {
+
+/** The child window wrapper of the actual spellin dialog. To use the
+ spelling dialog in an application you have to do the ususal things:
+ <ol>
+ <li>Call this class' RegisterChildWindow() method with the module
+ as second argument that you want the dialog included in.</li>
+ <li>In the SFX_IMPL_INTERFACE implementation of the view shell
+ that wants to use the dialog call SFX_CHILDWINDOW_REGISTRATION()
+ with the id returned by this class' GetChildWindowId()
+ method.</li>
+ <li>Include the item associated with this child window to the SDI
+ description of the view shell.</li>
+ </ol>
+*/
+class SVX_DLLPUBLIC SpellDialogChildWindow
+ : public SfxChildWindow
+{
+ friend class SpellDialog;
+ AbstractSpellDialog* m_pAbstractSpellDialog;
+public:
+ SpellDialogChildWindow (
+ Window*pParent,
+ sal_uInt16 nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo);
+ virtual ~SpellDialogChildWindow ();
+
+protected:
+ /** This abstract method has to be defined by a derived class. It
+ returns the next wrong sentence.
+ @return
+ returns an empty vector if no error could be found
+ */
+ virtual SpellPortions GetNextWrongSentence (bool bRecheck) = 0;
+
+ /** This abstract method applies the changes made in the spelling dialog
+ to the document.
+ The dialog always updates its settings when it gets the focus. The document
+ can rely on the fact that the methods ApplyChangedSentence() is called for the
+ position that the last GetNextWrongSentence() returned.
+ If 'bRecheck' is set to true then the same sentence should be rechecked once from
+ the start. This should be used too find errors that the user has introduced by
+ manual changes in the edit field, and in order to not miss the still following errors
+ in that sentence.
+ */
+ virtual void ApplyChangedSentence(const SpellPortions& rChanged, bool bRecheck ) = 0;
+ /** This methods determines whether the application supports AutoCorrection
+ */
+ virtual bool HasAutoCorrection();
+ /** This method adds a word pair to the AutoCorrection - if available
+ */
+ virtual void AddAutoCorrection(const String& rOld, const String& rNew, LanguageType eLanguage);
+ /** Return the sfx bindings for this child window. They are
+ retrieved from the dialog so they do not have to be stored in
+ this class as well. The bindings may be necessary to be used
+ by the abstract methods.
+ */
+ /** This method determines if grammar checking is supported
+ */
+ virtual bool HasGrammarChecking();
+ /** determines if grammar checking is switched on
+ */
+ virtual bool IsGrammarChecking();
+ /** switches grammar checking on/off
+ */
+ virtual void SetGrammarChecking(bool bOn);
+
+ SfxBindings& GetBindings (void) const;
+ /** Set the spell dialog into the 'resume' state. This method should be called
+ to notify the SpellDialog about changes in the document that invalidate the
+ current state which results in disabling most of the dialog controls and presenting
+ a "Resume" button that initiates a reinitialization.
+ */
+ void InvalidateSpellDialog();
+ /** Notifies the ChildWindow about the get focus event. The ChildWindow should no check if
+ the spelling dialog should be set to the 'Resume' state by calling InvalidateSpellDialog()
+ */
+ virtual void GetFocus() = 0;
+ /** Notifies the ChildWindow about the lose focus event. The ChildWindow should use it to save
+ the current selection/state.
+ */
+ virtual void LoseFocus() = 0;
+};
+
+} // end of namespace ::svx
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/SvxShapeTypes.hxx b/include/svx/SvxShapeTypes.hxx
new file mode 100644
index 000000000000..4821603938ed
--- /dev/null
+++ b/include/svx/SvxShapeTypes.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_ACCESSIBILITY_SVX_SHAPE_TYPES_HXX
+#define _SVX_ACCESSIBILITY_SVX_SHAPE_TYPES_HXX
+
+#include <svx/ShapeTypeHandler.hxx>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+namespace accessibility {
+
+/** Register the SVX draw shape types with the ShapeTypeHandler singleton.
+ This method is usually called from the shape type handler constructor.
+*/
+void RegisterDrawShapeTypes (void);
+
+/** Enum describing all shape types known in the SVX project.
+*/
+enum SvxShapeTypes
+{
+ DRAWING_RECTANGLE = 1,
+ DRAWING_ELLIPSE,
+ DRAWING_CONTROL,
+ DRAWING_CONNECTOR,
+ DRAWING_MEASURE,
+ DRAWING_LINE,
+ DRAWING_POLY_POLYGON,
+ DRAWING_POLY_LINE,
+ DRAWING_OPEN_BEZIER,
+ DRAWING_CLOSED_BEZIER,
+ DRAWING_OPEN_FREEHAND,
+ DRAWING_CLOSED_FREEHAND,
+ DRAWING_POLY_POLYGON_PATH,
+ DRAWING_POLY_LINE_PATH,
+ DRAWING_GRAPHIC_OBJECT,
+ DRAWING_GROUP,
+ DRAWING_TEXT,
+ DRAWING_OLE,
+ DRAWING_PAGE,
+ DRAWING_CAPTION,
+ DRAWING_FRAME,
+ DRAWING_PLUGIN,
+ DRAWING_APPLET,
+ DRAWING_3D_SCENE,
+ DRAWING_3D_CUBE,
+ DRAWING_3D_SPHERE,
+ DRAWING_3D_LATHE,
+ DRAWING_3D_EXTRUDE,
+ DRAWING_CUSTOM,
+ DRAWING_TABLE, /* = 30 */
+ DRAWING_MEDIA, /* = 31 */
+ DRAWING_END = DRAWING_MEDIA
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/UnoNamespaceMap.hxx b/include/svx/UnoNamespaceMap.hxx
new file mode 100644
index 000000000000..be9d7788bbc1
--- /dev/null
+++ b/include/svx/UnoNamespaceMap.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_UNONAMESPACEMAP_HXX_
+#define _SVX_UNONAMESPACEMAP_HXX_
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include "svx/svxdllapi.h"
+
+class SfxItemPool;
+
+namespace svx {
+
+SVX_DLLPUBLIC com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL NamespaceMap_createInstance( sal_uInt16* pWhichIds, SfxItemPool* pPool );
+
+}
+
+#endif // _SVX_UNONAMESPACEMAP_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/XPropertyTable.hxx b/include/svx/XPropertyTable.hxx
new file mode 100644
index 000000000000..0722434963f9
--- /dev/null
+++ b/include/svx/XPropertyTable.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_XPROPERTYTABLE_HXX
+#define _SVX_XPROPERTYTABLE_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include "svx/svxdllapi.h"
+#include <svx/xtable.hxx>
+
+// FIXME: should have a single factory method with an enumeration here [!]
+
+::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoXColorTable_createInstance( XPropertyList* pList ) throw();
+::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoXLineEndTable_createInstance( XPropertyList* pList ) throw();
+::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoXDashTable_createInstance( XPropertyList* pList ) throw();
+::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoXHatchTable_createInstance( XPropertyList* pList ) throw();
+::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoXGradientTable_createInstance( XPropertyList* pList ) throw();
+::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoXBitmapTable_createInstance( XPropertyList* pList ) throw();
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/algitem.hxx b/include/svx/algitem.hxx
new file mode 100644
index 000000000000..00a554d6e5f9
--- /dev/null
+++ b/include/svx/algitem.hxx
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_ALGITEM_HXX
+#define _SVX_ALGITEM_HXX
+
+#include <svx/svxids.hrc>
+#include <svl/poolitem.hxx>
+#include <svl/eitem.hxx>
+#include <editeng/svxenum.hxx>
+#include "svx/svxdllapi.h"
+
+class SvStream;
+
+//------------------------------------------------------------------------
+
+class SVX_DLLPUBLIC SvxOrientationItem: public SfxEnumItem
+{
+public:
+ TYPEINFO();
+
+ SvxOrientationItem(
+ const SvxCellOrientation eOrientation /*= SVX_ORIENTATION_STANDARD*/,
+ const sal_uInt16 nId );
+
+ SvxOrientationItem(
+ sal_Int32 nRotation, sal_Bool bStacked,
+ const sal_uInt16 nId );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual sal_uInt16 GetValueCount() const;
+ virtual String GetValueText( sal_uInt16 nVal ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const;
+
+ inline SvxOrientationItem& operator=(const SvxOrientationItem& rOrientation)
+ {
+ SetValue( rOrientation.GetValue() );
+ return *this;
+ }
+
+ /** Returns sal_True, if the item represents STACKED state. */
+ sal_Bool IsStacked() const;
+ /** Returns the rotation this item represents (returns nStdAngle for STANDARD and STACKED state). */
+ sal_Int32 GetRotation( sal_Int32 nStdAngle = 0 ) const;
+ /** Fills this item according to passed item values. */
+ void SetFromRotation( sal_Int32 nRotation, sal_Bool bStacked );
+};
+
+//------------------------------------------------------------------------
+
+class SVX_DLLPUBLIC SvxMarginItem: public SfxPoolItem
+{
+ sal_Int16 nLeftMargin;
+ sal_Int16 nTopMargin;
+ sal_Int16 nRightMargin;
+ sal_Int16 nBottomMargin;
+public:
+ TYPEINFO();
+ SvxMarginItem( const sal_uInt16 nId );
+ SvxMarginItem( sal_Int16 nLeft, sal_Int16 nTop /*= 0*/,
+ sal_Int16 nRight /*= 0*/, sal_Int16 nBottom /*= 0*/,
+ const sal_uInt16 nId );
+ SvxMarginItem( const SvxMarginItem& );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const;
+ virtual SvStream& Store( SvStream&, sal_uInt16 nItemVersion ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ sal_Int16 GetLeftMargin() const {return nLeftMargin; }
+ sal_Bool SetLeftMargin(sal_Int16 nLeft);
+ sal_Int16 GetTopMargin() const {return nTopMargin; }
+ sal_Bool SetTopMargin(sal_Int16 nTop);
+ sal_Int16 GetRightMargin() const {return nRightMargin; }
+ sal_Bool SetRightMargin(sal_Int16 nRight);
+ sal_Int16 GetBottomMargin() const {return nBottomMargin; }
+ sal_Bool SetBottomMargin(sal_Int16 nBottom);
+
+ inline SvxMarginItem& operator=(const SvxMarginItem& rMargin)
+ {
+ nLeftMargin = rMargin.nLeftMargin;
+ nTopMargin = rMargin.nTopMargin;
+ nRightMargin = rMargin.nRightMargin;
+ nBottomMargin = rMargin.nBottomMargin;
+ return *this;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/anchorid.hxx b/include/svx/anchorid.hxx
new file mode 100644
index 000000000000..f532b34b3fb2
--- /dev/null
+++ b/include/svx/anchorid.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_ANCHORID_HXX
+#define _SVX_ANCHORID_HXX
+
+
+enum SvxAnchorIds
+{
+ SVX_OBJ_AT_CNTNT = 0x01, // Frame bound to paragraph
+ SVX_OBJ_IN_CNTNT = 0x02, // Frame bound to character
+ SVX_OBJ_PAGE = 0x04, // Frame bound to page
+ SVX_OBJ_AT_FLY = 0x08 // Frame bound to other frame
+// SVX_OBJ_AUTO_CNTNT = 0x10 // Automatically positioned frame bound to paragraph
+};
+
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/bmpmask.hxx b/include/svx/bmpmask.hxx
new file mode 100644
index 000000000000..247beaafc7d2
--- /dev/null
+++ b/include/svx/bmpmask.hxx
@@ -0,0 +1,181 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _BMPMASK_HXX_
+#define _BMPMASK_HXX_
+
+#include <sfx2/ctrlitem.hxx>
+#include <sfx2/dockwin.hxx>
+#include <vcl/toolbox.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/group.hxx>
+#include <vcl/graph.hxx>
+#include "svx/svxdllapi.h"
+
+#include <svx/dlgctrl.hxx>
+
+/*************************************************************************
+|*
+|* class SvxBmpMaskSelectItem
+|*
+\************************************************************************/
+class SvxBmpMask;
+
+class SvxBmpMaskSelectItem : public SfxControllerItem
+{
+private:
+ SvxBmpMask &rBmpMask;
+
+protected:
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+
+public:
+ SvxBmpMaskSelectItem( sal_uInt16 nId, SvxBmpMask& rMask,
+ SfxBindings& rBindings );
+};
+
+/*************************************************************************
+|*
+|* Derivative from SfxChildWindow as 'container' for Float
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC SvxBmpMaskChildWindow : public SfxChildWindow
+{
+ public:
+ SvxBmpMaskChildWindow( Window*,
+ sal_uInt16, SfxBindings*,
+ SfxChildWinInfo* );
+
+ SFX_DECL_CHILDWINDOW_WITHID(SvxBmpMaskChildWindow);
+};
+
+/*************************************************************************
+|*
+|* class SvxBmpMask
+|*
+\************************************************************************/
+
+class MaskData;
+class MaskSet;
+class ColorWindow;
+
+class SVX_DLLPUBLIC SvxBmpMask : public SfxDockingWindow
+{
+ friend class MaskData;
+ friend class MaskSet;
+
+ Size aLastSize;
+ ToolBox aTbxPipette;
+ ColorWindow* pCtlPipette;
+ PushButton aBtnExec;
+ FixedLine aGrpQ;
+
+ FixedText aFt1;
+ FixedText aFt2;
+ FixedText aFt3;
+ CheckBox aCbx1;
+ MaskSet* pQSet1;
+ MetricField aSp1;
+ ColorLB aLbColor1;
+
+ CheckBox aCbx2;
+ MaskSet* pQSet2;
+ MetricField aSp2;
+ ColorLB aLbColor2;
+
+ CheckBox aCbx3;
+ MaskSet* pQSet3;
+ MetricField aSp3;
+ ColorLB aLbColor3;
+
+ CheckBox aCbx4;
+ MaskSet* pQSet4;
+ MetricField aSp4;
+ ColorLB aLbColor4;
+
+ MaskData* pData;
+ CheckBox aCbxTrans;
+ ColorLB aLbColorTrans;
+
+ XColorListRef pColLst;
+ Color aPipetteColor;
+ SvxBmpMaskSelectItem aSelItem;
+
+ Image maImgPipette;
+
+ virtual sal_Bool Close();
+
+#ifdef BMPMASK_PRIVATE
+
+ sal_uInt16 InitColorArrays( Color* pSrcCols, Color* pDstCols,
+ sal_uIntPtr* pTols );
+
+ Bitmap ImpMask( const Bitmap& rBitmap );
+ GDIMetaFile ImpMask( const GDIMetaFile& rMtf );
+ Animation ImpMask( const Animation& rAnimation );
+ BitmapEx ImpMaskTransparent( const BitmapEx& rBitmapEx,
+ const Color& rColor,
+ const long nTol );
+ BitmapEx ImpReplaceTransparency( const BitmapEx& rBmpEx,
+ const Color& rColor );
+ Animation ImpReplaceTransparency( const Animation& rAnim,
+ const Color& rColor );
+ GDIMetaFile ImpReplaceTransparency( const GDIMetaFile& rMtf,
+ const Color& rColor );
+
+#endif // BMPMASK_PRIVATE
+
+public:
+
+ SvxBmpMask( SfxBindings *pBindinx,
+ SfxChildWindow *pCW,
+ Window* pParent,
+ const ResId& rResId );
+ ~SvxBmpMask();
+
+ void SetColor( const Color& rColor );
+ void PipetteClicked();
+
+ sal_Bool NeedsColorList() const;
+ void SetColorList( const XColorListRef &pColorList );
+
+ void SetExecState( sal_Bool bEnable );
+
+ Graphic Mask( const Graphic& rGraphic );
+
+ sal_Bool IsEyedropping() const;
+
+ void onSelect( MaskSet* pSet );
+
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ void ApplyStyle();
+
+private:
+
+ /** Set names for accessible objects. This is necessary for objects
+ like the source color checkboxes which initially have no name and
+ for which the description would be read by AT.
+ */
+ SVX_DLLPRIVATE void SetAccessibleNames (void);
+};
+
+#endif // _BMPMASK_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/camera3d.hxx b/include/svx/camera3d.hxx
new file mode 100644
index 000000000000..96a5526b4501
--- /dev/null
+++ b/include/svx/camera3d.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CAMERA3D_HXX
+#define _CAMERA3D_HXX
+
+#include <svx/viewpt3d.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|* Camera derivative
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC Camera3D : public Viewport3D
+{
+ protected:
+ basegfx::B3DPoint aResetPos;
+ basegfx::B3DPoint aResetLookAt;
+ double fResetFocalLength;
+ double fResetBankAngle;
+
+ basegfx::B3DPoint aPosition;
+ basegfx::B3DPoint aLookAt;
+ double fFocalLength;
+ double fBankAngle;
+
+ bool bAutoAdjustProjection;
+
+ public:
+ Camera3D(const basegfx::B3DPoint& rPos, const basegfx::B3DPoint& rLookAt,
+ double fFocalLen = 35.0, double fBankAng = 0);
+ Camera3D();
+
+ void SetDefaults(const basegfx::B3DPoint& rPos, const basegfx::B3DPoint& rLookAt,
+ double fFocalLen = 35.0, double fBankAng = 0);
+
+ void SetViewWindow(double fX, double fY, double fW, double fH);
+
+ void SetPosition(const basegfx::B3DPoint& rNewPos);
+ const basegfx::B3DPoint& GetPosition() const { return aPosition; }
+ void SetLookAt(const basegfx::B3DPoint& rNewLookAt);
+ const basegfx::B3DPoint& GetLookAt() const { return aLookAt; }
+ void SetPosAndLookAt(const basegfx::B3DPoint& rNewPos, const basegfx::B3DPoint& rNewLookAt);
+
+ // Focal length in mm
+ void SetFocalLength(double fLen);
+ double GetFocalLength() const { return fFocalLength; }
+
+ // Bank angle links/rechts
+ void SetBankAngle(double fAngle);
+ double GetBankAngle() const { return fBankAngle; }
+
+ void SetAutoAdjustProjection(bool bAdjust = true)
+ { bAutoAdjustProjection = bAdjust; }
+ bool IsAutoAdjustProjection() const { return bAutoAdjustProjection; }
+};
+
+#endif // _CAMERA3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/charmap.hxx b/include/svx/charmap.hxx
new file mode 100644
index 000000000000..8f1ff765f78d
--- /dev/null
+++ b/include/svx/charmap.hxx
@@ -0,0 +1,134 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_CHARMAP_HXX
+#define _SVX_CHARMAP_HXX
+
+#include <vcl/ctrl.hxx>
+#include <vcl/metric.hxx>
+#include <vcl/scrbar.hxx>
+#include <boost/shared_ptr.hpp>
+#include <map>
+#include <tools/shl.hxx>
+#include "svx/svxdllapi.h"
+
+// define ----------------------------------------------------------------
+
+#define COLUMN_COUNT 16
+#define ROW_COUNT 8
+
+namespace svx
+{
+ struct SvxShowCharSetItem;
+ class SvxShowCharSetVirtualAcc;
+}
+
+// class SvxShowCharSet --------------------------------------------------
+
+class SVX_DLLPUBLIC SvxShowCharSet : public Control
+{
+public:
+ SvxShowCharSet( Window* pParent, const ResId& rResId );
+ SvxShowCharSet( Window* pParent );
+ ~SvxShowCharSet();
+
+ void SetFont( const Font& rFont );
+
+ void SelectCharacter( sal_uInt32 cNew, sal_Bool bFocus = sal_False );
+ sal_UCS4 GetSelectCharacter() const;
+
+ Link GetDoubleClickHdl() const { return aDoubleClkHdl; }
+ void SetDoubleClickHdl( const Link& rLink ) { aDoubleClkHdl = rLink; }
+ Link GetSelectHdl() const { return aSelectHdl; }
+ void SetSelectHdl( const Link& rHdl ) { aSelectHdl = rHdl; }
+ Link GetHighlightHdl() const { return aHighHdl; }
+ void SetHighlightHdl( const Link& rHdl ) { aHighHdl = rHdl; }
+ Link GetPreSelectHdl() const { return aHighHdl; }
+ void SetPreSelectHdl( const Link& rHdl ) { aPreSelectHdl = rHdl; }
+ static sal_uInt32& getSelectedChar();
+
+#ifdef _SVX_CHARMAP_CXX_
+ ::svx::SvxShowCharSetItem* ImplGetItem( int _nPos );
+ int FirstInView( void) const;
+ int LastInView( void) const;
+ int PixelToMapIndex( const Point&) const;
+ void SelectIndex( int index, sal_Bool bFocus = sal_False );
+ void DeSelect();
+ inline sal_Bool IsSelected(sal_uInt16 _nPos) const { return _nPos == nSelectedIndex; }
+ inline sal_uInt16 GetSelectIndexId() const { return sal::static_int_cast<sal_uInt16>(nSelectedIndex); }
+ sal_uInt16 GetRowPos(sal_uInt16 _nPos) const;
+ sal_uInt16 GetColumnPos(sal_uInt16 _nPos) const;
+
+ ScrollBar* getScrollBar();
+ void ReleaseAccessible();
+ sal_Int32 getMaxCharCount() const;
+#endif // _SVX_CHARMAP_CXX_
+
+ virtual void Resize();
+
+protected:
+ virtual void Paint( const Rectangle& );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void GetFocus();
+ virtual void LoseFocus();
+ virtual void StateChanged( StateChangedType nStateChange );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
+
+
+
+private:
+ typedef ::std::map<sal_Int32, boost::shared_ptr<svx::SvxShowCharSetItem> > ItemsMap;
+ ItemsMap m_aItems;
+ Link aDoubleClkHdl;
+ Link aSelectHdl;
+ Link aHighHdl;
+ Link aPreSelectHdl;
+ ::svx::SvxShowCharSetVirtualAcc* m_pAccessible;
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xAccessible;
+ long nX;
+ long nY;
+ long m_nXGap;
+ long m_nYGap;
+ sal_Bool bDrag;
+
+ sal_Int32 nSelectedIndex;
+
+ FontCharMap maFontCharMap;
+ ScrollBar aVscrollSB;
+
+private:
+ void DrawChars_Impl( int n1, int n2);
+ void InitSettings( sal_Bool bForeground, sal_Bool bBackground);
+ // abstraction layers are: Unicode<->MapIndex<->Pixel
+ Point MapIndexToPixel( int) const;
+ DECL_LINK(VscrollHdl, void *);
+
+ void init();
+ Rectangle getGridRectangle(const Point &rPointUL, const Size &rOutputSize);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/charthelper.hxx b/include/svx/charthelper.hxx
new file mode 100644
index 000000000000..3b43c4bb7f10
--- /dev/null
+++ b/include/svx/charthelper.hxx
@@ -0,0 +1,52 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CHARTHELPER_HXX
+#define CHARTHELPER_HXX
+
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <svx/svxdllapi.h>
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+namespace svt { class EmbeddedObjectRef; }
+
+//////////////////////////////////////////////////////////////////////////////
+
+class SVX_DLLPUBLIC ChartHelper
+{
+public:
+ // test if given reference is a chart
+ static bool IsChart(const svt::EmbeddedObjectRef& xObjRef);
+
+ // try to access rXModel in case of a chart to to get the chart content
+ // as sequence of primitives. Return range of primitives (chart size) in rRange;
+ // it will be used to embed the chart to the SdrObject transformation. This
+ // allows to define possible distances between chart and SDrObject bounds here
+ static drawinglayer::primitive2d::Primitive2DSequence tryToGetChartContentAsPrimitive2DSequence(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rXModel,
+ basegfx::B2DRange& rRange);
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //CHARTHELPER_HXX
diff --git a/include/svx/checklbx.hxx b/include/svx/checklbx.hxx
new file mode 100644
index 000000000000..8a9b3558d272
--- /dev/null
+++ b/include/svx/checklbx.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_CHECKLBX_HXX
+#define _SVX_CHECKLBX_HXX
+
+#include <svtools/treelistbox.hxx>
+#include <svtools/svlbitm.hxx>
+
+#include <vcl/lstbox.hxx>
+#include "svx/svxdllapi.h"
+
+// class SvxCheckListBox -------------------------------------------------
+
+class SVX_DLLPUBLIC SvxCheckListBox : public SvTreeListBox
+{
+ using Window::GetText;
+
+private:
+ SvLBoxButtonData* pCheckButton;
+
+#ifdef _SVX_CHECKLBX_CXX
+ SVX_DLLPRIVATE void Init_Impl();
+#endif
+
+ using SvTreeListBox::InsertEntry;
+ // Avoid ambiguity with new InsertEntry:
+ virtual SvTreeListEntry* InsertEntry( const XubString& rText, SvTreeListEntry* pParent,
+ sal_Bool bChildrenOnDemand,
+ sal_uIntPtr nPos, void* pUserData,
+ SvLBoxButtonKind eButtonKind );
+
+public:
+ SvxCheckListBox( Window* pParent, WinBits nWinStyle = 0 );
+ SvxCheckListBox( Window* pParent, const ResId& rResId );
+ SvxCheckListBox( Window* pParent, const ResId& rResId,
+ const Image& rNormalStaticImage );
+ ~SvxCheckListBox();
+
+ void InsertEntry ( const String& rStr,
+ sal_uInt16 nPos = LISTBOX_APPEND,
+ void* pUserData = NULL,
+ SvLBoxButtonKind eButtonKind =
+ SvLBoxButtonKind_enabledCheckbox );
+ void RemoveEntry ( sal_uInt16 nPos );
+
+ void SelectEntryPos ( sal_uInt16 nPos, sal_Bool bSelect = sal_True );
+ sal_uInt16 GetSelectEntryPos () const;
+
+ String GetText ( sal_uInt16 nPos ) const;
+ sal_uInt16 GetCheckedEntryCount() const;
+ void CheckEntryPos ( sal_uInt16 nPos, sal_Bool bCheck = sal_True );
+ sal_Bool IsChecked ( sal_uInt16 nPos ) const;
+ void ToggleCheckButton ( SvTreeListEntry* pEntry );
+
+ void* SetEntryData ( sal_uInt16 nPos, void* pNewData );
+ void* GetEntryData ( sal_uInt16 nPos ) const;
+
+ virtual void MouseButtonDown ( const MouseEvent& rMEvt );
+ virtual void KeyInput ( const KeyEvent& rKEvt );
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/chrtitem.hxx b/include/svx/chrtitem.hxx
new file mode 100644
index 000000000000..92045aa37c77
--- /dev/null
+++ b/include/svx/chrtitem.hxx
@@ -0,0 +1,334 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_CHRTITEM_HXX
+#define _SVX_CHRTITEM_HXX
+
+#include <svl/eitem.hxx>
+#include "svx/svxdllapi.h"
+
+//------------------------------------------------------------------------
+
+enum SvxChartStyle
+{
+ CHSTYLE_2D_LINE,
+ CHSTYLE_2D_STACKEDLINE,
+ CHSTYLE_2D_PERCENTLINE,
+ CHSTYLE_2D_COLUMN,
+ CHSTYLE_2D_STACKEDCOLUMN,
+ CHSTYLE_2D_PERCENTCOLUMN,
+ CHSTYLE_2D_BAR,
+ CHSTYLE_2D_STACKEDBAR,
+ CHSTYLE_2D_PERCENTBAR,
+ CHSTYLE_2D_AREA,
+ CHSTYLE_2D_STACKEDAREA,
+ CHSTYLE_2D_PERCENTAREA,
+ CHSTYLE_2D_PIE,
+ CHSTYLE_3D_STRIPE,
+ CHSTYLE_3D_COLUMN,
+ CHSTYLE_3D_FLATCOLUMN,
+ CHSTYLE_3D_STACKEDFLATCOLUMN,
+ CHSTYLE_3D_PERCENTFLATCOLUMN,
+ CHSTYLE_3D_AREA,
+ CHSTYLE_3D_STACKEDAREA,
+ CHSTYLE_3D_PERCENTAREA,
+ CHSTYLE_3D_SURFACE,
+ CHSTYLE_3D_PIE,
+ CHSTYLE_2D_XY,
+ CHSTYLE_3D_XYZ,
+ CHSTYLE_2D_LINESYMBOLS,
+ CHSTYLE_2D_STACKEDLINESYM,
+ CHSTYLE_2D_PERCENTLINESYM,
+ CHSTYLE_2D_XYSYMBOLS,
+ CHSTYLE_3D_XYZSYMBOLS,
+ CHSTYLE_2D_DONUT1,
+ CHSTYLE_2D_DONUT2,
+ CHSTYLE_3D_BAR,
+ CHSTYLE_3D_FLATBAR,
+ CHSTYLE_3D_STACKEDFLATBAR,
+ CHSTYLE_3D_PERCENTFLATBAR,
+ CHSTYLE_2D_PIE_SEGOF1,
+ CHSTYLE_2D_PIE_SEGOFALL,
+ CHSTYLE_2D_NET,
+ CHSTYLE_2D_NET_SYMBOLS,
+ CHSTYLE_2D_NET_STACK,
+ CHSTYLE_2D_NET_SYMBOLS_STACK,
+ CHSTYLE_2D_NET_PERCENT,
+ CHSTYLE_2D_NET_SYMBOLS_PERCENT,
+ CHSTYLE_2D_CUBIC_SPLINE,
+ CHSTYLE_2D_CUBIC_SPLINE_SYMBOL,
+ CHSTYLE_2D_B_SPLINE,
+ CHSTYLE_2D_B_SPLINE_SYMBOL,
+ CHSTYLE_2D_CUBIC_SPLINE_XY,
+ CHSTYLE_2D_CUBIC_SPLINE_SYMBOL_XY,
+ CHSTYLE_2D_B_SPLINE_XY,
+ CHSTYLE_2D_B_SPLINE_SYMBOL_XY,
+ CHSTYLE_2D_XY_LINE,
+ CHSTYLE_2D_LINE_COLUMN,
+ CHSTYLE_2D_LINE_STACKEDCOLUMN,
+ CHSTYLE_2D_STOCK_1,
+ CHSTYLE_2D_STOCK_2,
+ CHSTYLE_2D_STOCK_3,
+ CHSTYLE_2D_STOCK_4,
+ CHSTYLE_ADDIN
+};
+
+#define CHSTYLE_COUNT (CHSTYLE_ADDIN + 1)
+
+enum SvxChartDataDescr
+{
+ CHDESCR_NONE,
+ CHDESCR_VALUE,
+ CHDESCR_PERCENT,
+ CHDESCR_TEXT,
+ CHDESCR_TEXTANDPERCENT,
+ CHDESCR_NUMFORMAT_PERCENT,
+ CHDESCR_NUMFORMAT_VALUE,
+ CHDESCR_TEXTANDVALUE
+};
+
+#define CHDESCR_COUNT (CHDESCR_TEXTANDVALUE + 1)
+
+enum SvxChartTextOrder
+{
+ CHTXTORDER_SIDEBYSIDE,
+ CHTXTORDER_UPDOWN,
+ CHTXTORDER_DOWNUP,
+ CHTXTORDER_AUTO
+};
+
+#define CHTXTORDER_COUNT (CHTXTORDER_AUTO + 1)
+
+enum SvxChartTextOrient
+{
+ CHTXTORIENT_AUTOMATIC,
+ CHTXTORIENT_STANDARD,
+ CHTXTORIENT_BOTTOMTOP,
+ CHTXTORIENT_STACKED,
+ CHTXTORIENT_TOPBOTTOM
+};
+
+#define CHTXTORIENT_COUNT (CHTXTORIENT_TOPBOTTOM + 1)
+
+enum SvxChartKindError
+{
+ CHERROR_NONE,
+ CHERROR_VARIANT,
+ CHERROR_SIGMA,
+ CHERROR_PERCENT,
+ CHERROR_BIGERROR,
+ CHERROR_CONST,
+ CHERROR_STDERROR,
+ CHERROR_RANGE
+};
+
+#define CHERROR_COUNT (CHERROR_RANGE + 1)
+
+enum SvxChartIndicate
+{
+ CHINDICATE_NONE,
+ CHINDICATE_BOTH,
+ CHINDICATE_UP,
+ CHINDICATE_DOWN
+};
+
+#define CHINDICATE_COUNT (CHINDICATE_DOWN + 1)
+
+enum SvxChartRegress
+{
+ CHREGRESS_NONE,
+ CHREGRESS_LINEAR,
+ CHREGRESS_LOG,
+ CHREGRESS_EXP,
+ CHREGRESS_POWER
+};
+
+#define CHREGRESS_COUNT (CHREGRESS_POWER + 1)
+
+//------------------------------------------------------------------
+
+class SVX_DLLPUBLIC SvxChartStyleItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+ SvxChartStyleItem(SvxChartStyle eStyle /*= CHSTYLE_2D_LINE*/,
+ sal_uInt16 nId );
+ SvxChartStyleItem(SvStream& rIn, sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+
+ sal_uInt16 GetValueCount() const { return CHSTYLE_COUNT; }
+ SvxChartStyle GetValue() const
+ { return (SvxChartStyle)SfxEnumItem::GetValue(); }
+};
+
+//------------------------------------------------------------------
+
+class SVX_DLLPUBLIC SvxChartRegressItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+ SvxChartRegressItem(SvxChartRegress eRegress /*= CHREGRESS_LINEAR*/,
+ sal_uInt16 nId );
+ SvxChartRegressItem(SvStream& rIn, sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+
+ sal_uInt16 GetValueCount() const { return CHREGRESS_COUNT; }
+ SvxChartRegress GetValue() const
+ { return (SvxChartRegress)SfxEnumItem::GetValue(); }
+ sal_uInt16 GetVersion (sal_uInt16 nFileFormatVersion) const;
+};
+
+//------------------------------------------------------------------
+
+class SVX_DLLPUBLIC SvxChartDataDescrItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+ SvxChartDataDescrItem(SvStream& rIn,
+ sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+
+ sal_uInt16 GetValueCount() const { return CHDESCR_COUNT; }
+ SvxChartDataDescr GetValue() const
+ { return (SvxChartDataDescr)SfxEnumItem::GetValue(); }
+};
+
+//------------------------------------------------------------------
+
+class SVX_DLLPUBLIC SvxChartTextOrderItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+ SvxChartTextOrderItem(SvxChartTextOrder eOrder /*= CHTXTORDER_SIDEBYSIDE*/,
+ sal_uInt16 nId );
+ SvxChartTextOrderItem(SvStream& rIn,
+ sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ sal_uInt16 GetValueCount() const { return CHTXTORDER_COUNT; }
+ SvxChartTextOrder GetValue() const
+ { return (SvxChartTextOrder)SfxEnumItem::GetValue(); }
+};
+
+//------------------------------------------------------------------
+
+class SVX_DLLPUBLIC SvxChartTextOrientItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+ SvxChartTextOrientItem(SvStream& rIn,
+ sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+
+ sal_uInt16 GetValueCount() const { return CHTXTORDER_COUNT; }
+ SvxChartTextOrient GetValue() const
+ { return (SvxChartTextOrient)SfxEnumItem::GetValue(); }
+};
+
+//------------------------------------------------------------------
+
+class SVX_DLLPUBLIC SvxChartKindErrorItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+ SvxChartKindErrorItem(SvxChartKindError /*eOrient = CHERROR_NONE*/,
+ sal_uInt16 nId );
+ SvxChartKindErrorItem(SvStream& rIn,
+ sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+
+ sal_uInt16 GetValueCount() const { return CHERROR_COUNT; }
+ SvxChartKindError GetValue() const
+ { return (SvxChartKindError)SfxEnumItem::GetValue(); }
+
+ sal_uInt16 GetVersion (sal_uInt16 nFileFormatVersion) const;
+};
+
+//------------------------------------------------------------------
+
+class SVX_DLLPUBLIC SvxChartIndicateItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+ SvxChartIndicateItem(SvxChartIndicate eOrient /*= CHINDICATE_NONE*/,
+ sal_uInt16 nId );
+ SvxChartIndicateItem(SvStream& rIn,
+ sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+
+ sal_uInt16 GetValueCount() const { return CHINDICATE_COUNT; }
+ SvxChartIndicate GetValue() const
+ { return (SvxChartIndicate)SfxEnumItem::GetValue(); }
+
+ sal_uInt16 GetVersion (sal_uInt16 nFileFormatVersion) const;
+};
+
+//------------------------------------------------------------------
+
+class SVX_DLLPUBLIC SvxDoubleItem : public SfxPoolItem
+{
+ double fVal;
+
+public:
+ TYPEINFO();
+ SvxDoubleItem(double fValue /*= 0.0*/, sal_uInt16 nId );
+ SvxDoubleItem(const SvxDoubleItem& rItem);
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual String GetValueText() const;
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0) const;
+
+ virtual int operator == (const SfxPoolItem&) const;
+ virtual SfxPoolItem* Clone(SfxItemPool *pPool = NULL) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVersion) const;
+ virtual SvStream& Store(SvStream& rOut, sal_uInt16 nItemVersion ) const;
+
+ virtual double GetMin() const;
+ virtual double GetMax() const;
+
+ virtual SfxFieldUnit GetUnit() const;
+
+ double GetValue() const { return fVal; }
+ void SetValue(double fNewVal) { fVal = fNewVal; }
+};
+
+#endif // _SVX_CHRTITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/clipboardctl.hxx b/include/svx/clipboardctl.hxx
new file mode 100644
index 000000000000..465436367fad
--- /dev/null
+++ b/include/svx/clipboardctl.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_CLIPBOARDCTL_HXX_
+#define _SVX_CLIPBOARDCTL_HXX_
+
+#include <sfx2/tbxctrl.hxx>
+#include <sfx2/ctrlitem.hxx>
+#include <svl/poolitem.hxx>
+
+
+#include "svx/svxdllapi.h"
+
+class PopupMenu;
+class SvxClipboardFmtItem;
+
+
+class SVX_DLLPUBLIC SvxClipBoardControl : public SfxToolBoxControl
+{
+ SfxPoolItem* pClipboardFmtItem;
+ PopupMenu* pPopup;
+ sal_Bool bDisabled;
+
+ void DelPopup();
+
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ SvxClipBoardControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ~SvxClipBoardControl();
+
+ virtual SfxPopupWindowType GetPopupWindowType() const;
+ virtual SfxPopupWindow* CreatePopupWindow();
+ virtual void StateChanged( sal_uInt16 nSID,
+ SfxItemState eState,
+ const SfxPoolItem* pState );
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/clipfmtitem.hxx b/include/svx/clipfmtitem.hxx
new file mode 100644
index 000000000000..2debc5e0747d
--- /dev/null
+++ b/include/svx/clipfmtitem.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_CLIPFMTITEM_HXX
+#define _SVX_CLIPFMTITEM_HXX
+
+#include <rtl/ustring.hxx>
+#include <svl/poolitem.hxx>
+#include "svx/svxdllapi.h"
+
+struct SvxClipboardFmtItem_Impl;
+
+class SVX_DLLPUBLIC SvxClipboardFmtItem : public SfxPoolItem
+{
+ SvxClipboardFmtItem_Impl* pImpl;
+protected:
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+
+public:
+ TYPEINFO();
+ SvxClipboardFmtItem( sal_uInt16 nId = 0 );
+ SvxClipboardFmtItem( const SvxClipboardFmtItem& );
+ virtual ~SvxClipboardFmtItem();
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId );
+
+ void AddClipbrdFormat( sal_uIntPtr nId, sal_uInt16 nPos = USHRT_MAX );
+ void AddClipbrdFormat( sal_uIntPtr nId, const OUString& rName,
+ sal_uInt16 nPos = USHRT_MAX );
+ sal_uInt16 Count() const;
+
+ sal_uIntPtr GetClipbrdFormatId( sal_uInt16 nPos ) const;
+ const OUString GetClipbrdFormatName( sal_uInt16 nPos ) const;
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/colrctrl.hxx b/include/svx/colrctrl.hxx
new file mode 100644
index 000000000000..ee3451bc857c
--- /dev/null
+++ b/include/svx/colrctrl.hxx
@@ -0,0 +1,135 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_COLRCTRL_HXX
+#define _SVX_COLRCTRL_HXX
+
+#include <sfx2/dockwin.hxx>
+#include <sfx2/childwin.hxx>
+#include <svtools/valueset.hxx>
+#include <svtools/transfer.hxx>
+#include <svl/lstner.hxx>
+#include <svx/svxdllapi.h>
+#include <svx/xtable.hxx>
+
+class SvData;
+
+/*************************************************************************
+|*
+|* SvxColorValueSet
+|*
+\************************************************************************/
+
+class SvxColorValueSet : public ValueSet, public DragSourceHelper
+{
+ using ValueSet::StartDrag;
+
+private:
+
+ sal_Bool bLeft;
+ Point aDragPosPixel;
+
+protected:
+
+ void DoDrag();
+
+ // ValueSet
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void Command(const CommandEvent& rCEvt );
+
+ // DragSourceHelper
+ virtual void StartDrag( sal_Int8 nAction, const Point& rPtPixel );
+
+ DECL_STATIC_LINK(SvxColorValueSet, ExecDragHdl, void*);
+
+public:
+ SvxColorValueSet( Window* pParent, const ResId& rResId );
+
+ sal_Bool IsLeftButton() const { return bLeft; }
+};
+
+/*************************************************************************
+|*
+|* Derivation from SfxChildWindow as "container" for Controller
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC SvxColorChildWindow : public SfxChildWindow
+{
+ public:
+ SvxColorChildWindow( Window*, sal_uInt16, SfxBindings*,
+ SfxChildWinInfo* );
+
+ SFX_DECL_CHILDWINDOW_WITHID(SvxColorChildWindow);
+};
+
+/*************************************************************************
+|*
+|* SvxColorDockingWindow
+|*
+\************************************************************************/
+
+class SvxColorDockingWindow : public SfxDockingWindow, public SfxListener
+{
+ friend class SvxColorChildWindow;
+
+private:
+ XColorListRef pColorList;
+ SvxColorValueSet aColorSet;
+ sal_uInt16 nLeftSlot;
+ sal_uInt16 nRightSlot;
+ sal_uInt16 nCols;
+ sal_uInt16 nLines;
+ long nCount;
+ Size aColorSize;
+ Size aItemSize;
+
+ void FillValueSet();
+ void SetSize();
+ DECL_LINK( SelectHdl, void * );
+
+ /** This function is called when the window gets the focus. It grabs
+ the focus to the color value set so that it can be controlled with
+ the keyboard.
+ */
+ virtual void GetFocus (void);
+
+protected:
+ virtual sal_Bool Close();
+ virtual void Resize();
+ virtual void Resizing( Size& rSize );
+
+public:
+ SvxColorDockingWindow( SfxBindings* pBindings,
+ SfxChildWindow *pCW,
+ Window* pParent,
+ const ResId& rResId );
+ ~SvxColorDockingWindow();
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ void SetSlotIDs( sal_uInt16 nLeft, sal_uInt16 nRight )
+ { nLeftSlot = nLeft; nRightSlot = nRight; }
+
+ virtual long Notify( NotifyEvent& rNEvt );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/compressgraphicdialog.hxx b/include/svx/compressgraphicdialog.hxx
new file mode 100644
index 000000000000..a733fa2b6298
--- /dev/null
+++ b/include/svx/compressgraphicdialog.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _COMPRESS_GRAPHIC_DIALOG_HXX
+#define _COMPRESS_GRAPHIC_DIALOG_HXX
+
+#include <vcl/dialog.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/field.hxx>
+#include <sfx2/bindings.hxx>
+#include "svx/svxdllapi.h"
+
+class SdrGrafObj;
+
+class SVX_DLLPUBLIC CompressGraphicsDialog : public ModalDialog
+{
+private:
+ FixedText* m_pFixedText2;
+ FixedText* m_pFixedText3;
+ FixedText* m_pFixedText5;
+ FixedText* m_pFixedText6;
+
+ CheckBox* m_pReduceResolutionCB;
+ NumericField* m_pMFNewWidth;
+ NumericField* m_pMFNewHeight;
+ ComboBox* m_pResolutionLB;
+ RadioButton* m_pLosslessRB;
+ RadioButton* m_pJpegCompRB;
+ NumericField* m_pCompressionMF;
+ NumericField* m_pQualityMF;
+ PushButton* m_pBtnCalculate;
+ ListBox* m_pInterpolationCombo;
+
+ SdrGrafObj* m_pGraphicObj;
+ Graphic m_aGraphic;
+ Size m_aViewSize100mm;
+ Rectangle m_aCropRectangle;
+ SfxBindings& m_rBindings;
+
+ double m_dResolution;
+
+ void Initialize();
+
+ DECL_LINK( NewWidthModifiedHdl, void* );
+ DECL_LINK( NewHeightModifiedHdl, void* );
+ DECL_LINK( ResolutionModifiedHdl, void* );
+ DECL_LINK( ToggleCompressionRB, void* );
+ DECL_LINK( ToggleReduceResolutionRB, void* );
+
+ DECL_LINK( CalculateClickHdl, void* );
+
+ void Update();
+ void UpdateNewWidthMF();
+ void UpdateNewHeightMF();
+ void UpdateResolutionLB();
+
+ void Compress(SvStream& aStream);
+
+ double GetViewWidthInch();
+ double GetViewHeightInch();
+
+ sal_uLong GetSelectedInterpolationType();
+
+public:
+ CompressGraphicsDialog( Window* pParent, SdrGrafObj* pGraphicObj, SfxBindings& rBindings );
+ CompressGraphicsDialog( Window* pParent, Graphic& rGraphic, Size rViewSize100mm, Rectangle& rCropRectangle, SfxBindings& rBindings );
+
+ virtual ~CompressGraphicsDialog();
+
+ SdrGrafObj* GetCompressedSdrGrafObj();
+ Graphic GetCompressedGraphic();
+
+ Rectangle GetScaledCropRectangle();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/connctrl.hxx b/include/svx/connctrl.hxx
new file mode 100644
index 000000000000..a559f615c14c
--- /dev/null
+++ b/include/svx/connctrl.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_CONNCTRL_HXX
+#define _SVX_CONNCTRL_HXX
+
+#include <vcl/ctrl.hxx>
+#include "svx/svxdllapi.h"
+
+class SfxItemSet;
+class SdrEdgeObj;
+class SdrView;
+class SdrObjList;
+
+/*************************************************************************
+|*
+|* SvxXConnectionPreview
+|*
+\************************************************************************/
+class SVX_DLLPUBLIC SvxXConnectionPreview : public Control
+{
+ friend class SvxConnectionPage;
+
+private:
+ const SfxItemSet& rAttrs;
+ SdrEdgeObj* pEdgeObj;
+ SdrObjList* pObjList;
+ const SdrView* pView;
+
+ SVX_DLLPRIVATE void SetStyles();
+public:
+ SvxXConnectionPreview( Window* pParent, const ResId& rResId,
+ const SfxItemSet& rInAttrs );
+ ~SvxXConnectionPreview();
+
+ virtual void Paint( const Rectangle& rRect );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+
+ void SetAttributes( const SfxItemSet& rInAttrs );
+ sal_uInt16 GetLineDeltaAnz();
+
+ void Construct();
+ void SetView( const SdrView* pSdrView ) { pView = pSdrView; }
+
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+};
+
+
+#endif // _SVX_CONNCTRL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/contdlg.hxx b/include/svx/contdlg.hxx
new file mode 100644
index 000000000000..2ba38f1e9e31
--- /dev/null
+++ b/include/svx/contdlg.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONTDLG_HXX_
+#define _CONTDLG_HXX_
+
+#include <sfx2/basedlgs.hxx>
+#include <sfx2/ctrlitem.hxx>
+#include <sfx2/childwin.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|* Derivation from SfxChildWindow as "container" for Float
+|*
+\************************************************************************/
+
+class Graphic;
+
+class SVX_DLLPUBLIC SvxContourDlgChildWindow : public SfxChildWindow
+{
+ public:
+
+ SvxContourDlgChildWindow( Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo* );
+
+ SFX_DECL_CHILDWINDOW_WITHID( SvxContourDlgChildWindow );
+};
+
+#ifndef _REDUCED_ContourDlg_HXX_
+#define _REDUCED_CONTDLG_HXX_
+
+class SvxSuperContourDlg;
+
+class SvxContourDlgItem : public SfxControllerItem
+{
+ SvxSuperContourDlg& rDlg;
+
+protected:
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+
+public:
+
+ SvxContourDlgItem( sal_uInt16 nId, SvxSuperContourDlg& rDlg, SfxBindings& rBindings );
+};
+
+class SVX_DLLPUBLIC SvxContourDlg : public SfxFloatingWindow